403Webshell
Server IP : 34.67.85.211  /  Your IP : 216.73.217.52
Web Server : Apache
System : Linux wordpress-1-vm 4.9.0-13-amd64 #1 SMP Debian 4.9.228-1 (2020-07-05) x86_64
User : root ( 0)
PHP Version : 7.4.9
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 : OFF
Directory :  /var/www/html/wp-content/plugins/mailchimp-for-wp/includes/admin/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/wp-content/plugins/mailchimp-for-wp/includes/admin/class-update-optin.php
<?php

class MC4WP_Update_Optin {


	/**
	 * @const string
	 */
	const CAPABILITY = 'install_plugins';

	/**
	 * @var string
	 */
	protected $plugin_file = '';

	/**
	 * @var string
	 */
	protected $to_version;

	/**
	 * @var string
	 */
	protected $view_file;

	/**
	 * @var string
	 */
	protected $option_enable;

	/**
	 * @var string
	 */
	protected $option_notice;

	/**
	 * @var bool
	 */
	protected $active = false;

	/**
	 * @param string $to_version
	 * @param string $plugin_file
	 * @param string $view_file
	 */
	public function __construct( $to_version, $plugin_file, $view_file ) {
		$this->to_version  = $to_version;
		$this->plugin_file = $plugin_file;
		$this->view_file   = $view_file;

		$this->option_enable = 'mc4wp_enable_' . sanitize_key( $this->to_version );
		$this->option_notice = 'mc4wp_notice_' . sanitize_key( $this->to_version );
	}

	/**
	 * Add hooks
	 */
	public function add_hooks() {
		add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'maybe_hide_update' ) );
		add_action( 'init', array( $this, 'listen' ) );

		global $pagenow;
		$on_settings_page = isset( $_GET['page'] ) && stristr( $_GET['page'], dirname( $this->plugin_file ) ) !== false;
		if ( $pagenow === 'plugins.php' || $pagenow === 'update-core.php' || $on_settings_page ) {
			add_action( 'admin_notices', array( $this, 'show_update_optin' ) );
		}
	}
	/**
	 * Listen for actions
	 */
	public function listen() {

		// only show to users with required capability
		if ( ! current_user_can( self::CAPABILITY ) ) {
			return;
		}

		if ( isset( $_GET[ $this->option_enable ] ) ) {
			$this->enable_major_updates();
		}
	}
	/**
	 * Prevents updates from showing
	 *
	 * @param array $data
	 * @return array
	 */
	public function maybe_hide_update( $data ) {
		if ( empty( $data->response ) ) {
			return $data;
		}

		// do nothing if the specified version is not out there yet..
		if ( empty( $data->response[ $this->plugin_file ]->new_version )
			|| version_compare( $data->response[ $this->plugin_file ]->new_version, $this->to_version, '<' ) ) {

			// reset flags here in case we revert the update
			if ( ! $this->active ) {
				delete_option( $this->option_notice );
				delete_option( $this->option_enable );
			}

			return $data;
		}

		// return unmodified data if already opted-in
		$opted_in = get_option( $this->option_enable, false );
		if ( $opted_in ) {
			return $data;
		}

		// set a flag to start showing "update to x.x" notice
		update_option( $this->option_notice, 1 );

		// unset update data
		unset( $data->response[ $this->plugin_file ] );

		// set flag because this filter runs multiple times..
		$this->active = true;

		return $data;
	}

	/**
	 * Enables major updates (opts-in to 3.x update)
	 */
	public function enable_major_updates() {

		// update option
		update_option( $this->option_enable, 1 );

		// delete site transient so wp core will fetch latest version
		delete_site_transient( 'update_plugins' );

		// redirect to updates page
		wp_safe_redirect( admin_url( 'update-core.php' ) );
		exit;
	}

	/**
	 * Shows update opt-in
	 */
	public function show_update_optin() {
		if ( ! $this->should_show_update_optin() ) {
			return;
		}

		// prepare link URL
		$update_link = add_query_arg( array( $this->option_enable => 1 ) );

		// show!
		include $this->view_file;
	}

	/**
	 * @return bool
	 */
	public function should_show_update_optin() {

		// don't show if flag is not set
		if ( ! get_option( $this->option_notice, false ) ) {
			return false;
		}

		// stop showing if opted-in already
		if ( get_option( $this->option_enable, false ) ) {
			return false;
		}

		// only show to users with required capability
		if ( ! current_user_can( self::CAPABILITY ) ) {
			return false;
		}

		return true;
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit