AnonSec Team
Server IP : 10.2.73.233  /  Your IP : 216.73.216.223
Web Server : Apache/2.4.59 (Debian)
System : Linux polon 4.19.0-27-amd64 #1 SMP Debian 4.19.316-1 (2024-06-25) x86_64
User : www-data ( 33)
PHP Version : 5.6.40-64+0~20230107.71+debian10~1.gbp673146
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
MySQL : ON  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /home/ilpnowa/../ilpnowa/web/wp-includes/certificates/../

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/ilpnowa/../ilpnowa/web/wp-includes/certificates/../wpglobus-plus-main.php
<?php
/**
 * Main Module
 *
 * @since      1.0.0
 * @package    WPGlobus Plus
 * @subpackage Administration
 */

/**
 * Class WPGlobusPlus
 */
class WPGlobusPlus {

	/**
	 * All options page
	 */
	const WPGLOBUS_PLUS_OPTIONS_PAGE = 'wpglobus-plus-options';

	/**
	 * Initialized at plugin loader
	 * @var string
	 */
	public static $PLUGIN_DIR_URL = '';

	/**
	 * Initialized at plugin loader
	 * @var string
	 */
	public static $PLUGIN_DIR_PATH = '';

	/** @var string[] List of modules */
	public $modules = array();

	/** @var string Key for the `options` table */
	public $option_key = 'wpglobus_plus_options';

	/** @var array Options */
	public $options = array();

	/**
	 * @param string[] $modules
	 */
	public function __construct( $modules ) {

		$this->modules = $modules;

		$this->options = (array) get_option( $this->option_key );

		add_action( 'wp_ajax_' . __CLASS__ . '_process_ajax', array(
			$this,
			'on_process_ajax'
		) );

		add_action( 'admin_print_scripts', array(
			$this,
			'on_admin_scripts'
		) );

		add_action( 'admin_print_styles', array(
			$this,
			'on_admin_styles'
		) );

		add_action( 'admin_menu', array(
			$this,
			'on_admin_menu'
		) );

	}

	/**
	 * Process ajax
	 */
	public function on_process_ajax() {

		$ajax_return = array();

		$order = $_POST['order'];
		
		switch ( $order['action'] ) :
			case 'activate-module':

				$order['active_status'] = ! empty( $order['active_status'] ) ? $order['active_status'] : '';

				$options = (array) get_option( $this->option_key );

				if ( '' === $order['active_status'] ) {
					$options[ $order['module'] ]['active_status'] = '';
				} else {
					$options[ $order['module'] ]['active_status'] = $order['active_status'];
				}
				$ajax_return['result'] = update_option( $this->option_key, $options, false );

				break;
			case 'wpglobeditor-save-page':
			case 'wpglobeditor-save-element':
				
				if ( $order['key'] === '0' ) {
					$order['key'] = 0;	
				} else {	
					$order['key'] = empty( $order['key'] ) ? '' : (int) $order['key'];
				}
				
				$opts = get_option( 'wpglobus_plus_wpglobeditor' );
				
				$action = 'add';
				if ( empty( $order['page'] ) ) {
					$ajax_return['result']  = 'error'; 
					$ajax_return['message'] = 'Empty field page'; 
				} else {
					if ( ! empty( $opts[ 'page_list' ] ) && ! empty( $opts[ 'page_list' ][ $order['page'] ] ) ) {
						/**
						 * check element existence in option
						 */
						foreach( $opts[ 'page_list' ][ $order['page'] ] as $key=>$value ) {
							if ( $value === $order['element'] ) {
								$action = '';
								break;
							}	
						}
					}
					
					if ( ( $order['key'] == 0 && isset( $opts[ 'page_list' ][ $order['page'] ][ $order['key'] ] ) ) || 
						( ! empty( $order['key'] ) && isset( $opts[ 'page_list' ][ $order['page'] ][ $order['key'] ] ) )
					) 
					{
						/**
						 * check key existence for update
						 */
						$action = 'update';
					}	

					if ( 'add' === $action ) {
						$opts[ 'page_list' ][ $order['page'] ][] = $order['element']; 
						$ajax_return = update_option( 'wpglobus_plus_wpglobeditor', $opts, false );
					} else if ( 'update' === $action ) {
						$opts[ 'page_list' ][ $order['page'] ][ $order['key'] ] = $order['element']; 
						$ajax_return = update_option( 'wpglobus_plus_wpglobeditor', $opts, false );
					} else {
						$ajax_return['result']  = 'error'; 
						$ajax_return['message'] = 'Element already exists'; 
					}	
				}
				break;
			case 'wpglobeditor-remove':

				$opts = get_option( 'wpglobus_plus_wpglobeditor' );
				
				if ( ! empty( $opts[ 'page_list' ][ $order['page'] ][ $order['key'] ] ) ) {
					unset( $opts[ 'page_list' ][ $order['page'] ][ $order['key'] ] );
				}
				
				if ( empty( $opts[ 'page_list' ][ $order['page'] ] ) ) {
					unset( $opts[ 'page_list' ][ $order['page'] ] );
				}	

				if ( empty( $opts[ 'page_list' ] ) ) {
					unset( $opts[ 'page_list' ] );
				}	

				$ajax_return = update_option( 'wpglobus_plus_wpglobeditor', $opts, false );
				
				break;
		endswitch;

		wp_die( json_encode( $ajax_return ) );

	}

	/**
	 * Enqueue admin scripts
	 *
	 * @since 1.0.0
	 * @return void
	 */
	public function on_admin_scripts() {
		
		/**
		 * Module WPGlobus Editor
		 */		
		if ( ! empty($_GET['tab']) && 'wpglobeditor' === $_GET['tab'] ) {
			wp_register_script(
				'wpglobus-plus-wpglobeditor',
				plugin_dir_url( __FILE__ ) . 'js/wpglobus-plus-wpglobeditor' . WPGlobus::SCRIPT_SUFFIX() . ".js",
				array( 'jquery' ),
				WPGLOBUS_PLUS_VERSION,
				true
			);
			wp_enqueue_script( 'wpglobus-plus-wpglobeditor' );

			wp_localize_script(
				'wpglobus-plus-wpglobeditor',
				'WPGlobusPlusEditor',
				array(
					'version'      => WPGLOBUS_PLUS_VERSION,
					'process_ajax' => __CLASS__ . '_process_ajax',
					'module'	   => 'wpglobeditor'
				)
			);
		}
		
		wp_register_script(
			'wpglobus-plus-main',
			plugin_dir_url( __FILE__ ) . 'js/wpglobus-plus-main' . WPGlobus::SCRIPT_SUFFIX() . ".js",
			array( 'jquery' ),
			WPGLOBUS_PLUS_VERSION,
			true
		);
		wp_enqueue_script( 'wpglobus-plus-main' );

		wp_localize_script(
			'wpglobus-plus-main',
			'WPGlobusPlus',
			array(
				'version'           => WPGLOBUS_PLUS_VERSION,
				'option_page'       => 'admin.php?page=' . self::WPGLOBUS_PLUS_OPTIONS_PAGE,
				'caption_menu_item' => esc_html__( 'WPGlobus Plus', 'wpglobus-plus' ),
				'process_ajax'      => __CLASS__ . '_process_ajax'
			)
		);

		/** @global string $pagenow */
		//		global $pagenow;
		//		if ( $pagenow === 'admin.php' && isset( $_GET['page'] ) && self::WPGLOBUS_PLUS_OPTIONS_PAGE === $_GET['page']  ) :
		// maybe later
		//		endif;

	}

	/**
	 * Add hidden submenu
	 *
	 * @since 1.0.0
	 * @return void
	 */
	public function on_admin_menu() {

		add_submenu_page(
			null,
			'',
			'',
			'administrator',
			self::WPGLOBUS_PLUS_OPTIONS_PAGE,
			array(
				$this,
				'options_page'
			)
		);

	}

	/**
	 * View: options panel
	 */
	public function options_page() { 
		
		$tabs = array();
		
		$tabs['modules'] = array(
			'href' 	=> '?page=' . self::WPGLOBUS_PLUS_OPTIONS_PAGE . '&tab=modules',
			'class' => 'nav-tab',
			'caption' => esc_html__( 'Modules', 'wpglobus-plus' )
		);
		
		$tabs['wpglobeditor'] = array(
			'href' 	=> '?page=' . self::WPGLOBUS_PLUS_OPTIONS_PAGE . '&tab=wpglobeditor',
			'class' => 'nav-tab',
			'caption' => esc_html__( 'Editor Settings', 'wpglobus-plus' )
		);


		$active_tab = 'modules'; // default tab
		if ( ! empty( $_GET['tab'] ) && array_key_exists( $_GET['tab'], $tabs ) ) {
			$active_tab = $_GET['tab'];
		}	

		?>
		
		<div class="wrap about-wrap">
			<h1 class="wpglobus"><span class="wpglobus-wp">WP</span>Globus
				<?php echo esc_html_x( 'Plus', 'Part of the WPGlobus Plus', 'wpglobus-plus' ); ?>
				<span class="wpglobus-version"><?php echo WPGLOBUS_PLUS_VERSION; ?></span>
			</h1>

			<h2 class="nav-tab-wrapper">	<?php
				foreach( $tabs as $tab=>$option ) {	
					if ( $active_tab === $tab ) {
						$option['class'] .= ' nav-tab-active';
					}	?>
					<a href="<?php echo $option['href']; ?>" class="<?php echo $option['class']; ?>"><?php echo $option['caption']; ?></a> <?php
				}	
				?>
			</h2>
			
			<div class="feature-main feature-section xcol xtwo-col">	<?php

				switch ( $active_tab ) :
					case 'modules': ?>
				
						<h4><?php esc_html_e( 'Active Modules:', 'wpglobus-plus' ); ?></h4>

						<p><em><?php esc_html_e( 'Uncheck the modules you are not planning to use:', 'wpglobus-plus' ); ?></em></p>
						<?php

						foreach ( $this->modules as $module => $option ) {
							$is_module_active = true;
							if ( ! empty( $this->options[ $module ] ) ) {
								if ( isset( $this->options[ $module ]['active_status'] ) && empty( $this->options[ $module ]['active_status'] ) ) {
									$is_module_active = false;
								}
							}
							$is_checkbox_disabled = false;
							if ( isset( $option['checkbox_disabled'] ) && $option['checkbox_disabled'] ) {
								$is_checkbox_disabled = true;
							}	
							?>
							<div class="module-block">
								<span class="wpglobus-plus-spinner"></span>
								<label for="wpglobus-plus-<?php echo $module; ?>" style="display: block">
									<input type="checkbox"
										   class="wpglobus-plus-module"
										   data-module="<?php echo $module; ?>"
										   id="wpglobus-plus-<?php echo $module; ?>"
										   name="wpglobus-plus-<?php echo $module; ?>"
										<?php checked( $is_module_active ) ?>
										<?php disabled( $is_checkbox_disabled ) ?> />
									<strong><?php echo $option['caption']; ?></strong>:
									<?php echo $option['desc']; ?>
								</label>
							</div>
							<br/>
							<?php
						} ?>
						<hr/>
						<div class="return-to-dashboard" style="padding-left:10px;">
							<a class="button button-primary" href="admin.php?page=wpglobus_options">
								<?php _e( 'Go to WPGlobus Settings', 'wpglobus' ); ?>
							</a>
						</div> <?php								
					break;
					case 'wpglobeditor' :
					
						$is_module_active = true;
						if ( ! empty( $this->options[ 'wpglobeditor' ] ) ) {
							if ( isset( $this->options[ 'wpglobeditor' ]['active_status'] ) && empty( $this->options[ 'wpglobeditor' ]['active_status'] ) ) {
								$is_module_active = false;
							}
						}
						if ( $is_module_active ) {
							include_once( 'class-wpglobus-plus-wpglobeditor.php' );
							$WPGlobusPlus_Editor_Table = new WPGlobusPlus_Editor_Table(); 
						} else { ?>
							<h4><?php esc_html_e( 'Please, activate module WPGlobus Editor', 'wpglobus-plus' ); ?></h4>	<?php
						}	
						
					break;	
				endswitch;	?>

			</div>

		</div> <!-- .wrap --> <?php
		// http://www.wpg.dev/wp-admin/admin.php?page=wpglobus-about
	}

	/**
	 * Enqueue admin styles
	 *
	 * @since 1.0.0
	 * @return void
	 */
	public function on_admin_styles() {

		/**
		 * Module WPGlobus Editor
		 */
		if ( ! empty($_GET['tab']) && 'wpglobeditor' === $_GET['tab'] ) {
			wp_register_style(
				'wpglobus-plus-wpglobeditor',
				plugin_dir_url( __FILE__ ) . '/css/wpglobus-plus-wpglobeditor' . WPGlobus::SCRIPT_SUFFIX() . ".css",
				array(),
				WPGLOBUS_PLUS_VERSION,
				'all'
			);
			wp_enqueue_style( 'wpglobus-plus-wpglobeditor' );			
		}	
	
		$enabled_pages = array(
			#Module Publish
			'post.php',
			'post-new.php',
			'admin.php'
		);

		if ( WPGlobus_WP::is_pagenow( $enabled_pages ) ) :
			
			global $pagenow;
			
			if ( 
				$pagenow == 'admin.php' && 
					( empty($_GET['page']) || $_GET['page'] != 'wpglobus-plus-options' ) 
			) {
				return;
			}	
 		
			wp_register_style(
				'wpglobus-plus-admin',
				plugin_dir_url( __FILE__ ) . '/css/wpglobus-plus-admin' . WPGlobus::SCRIPT_SUFFIX() . ".css",
				array(),
				WPGLOBUS_PLUS_VERSION,
				'all'
			);
			wp_enqueue_style( 'wpglobus-plus-admin' );

		endif;

	}

} // class

# --- EOF

AnonSec - 2021