. */ if (!function_exists('is_plugin_active')) { include_once ABSPATH . 'wp-admin/includes/plugin.php'; } if (!class_exists('EzKillLite')) { class EzKillLite { var $lite, $pro, $killer; var $liteName, $proName; static $adminNotice = ''; static $killed = false; function __construct($lite, $pro = '', $killer = '') { $this->lite = $lite; $this->pro = $pro; $this->killer = $killer; } function init() { include_once ABSPATH . 'wp-admin/includes/plugin.php'; deactivate_plugins($this->lite); } function admin_footer_kill() { printf(''); } function admin_footer_deny() { printf(''); } function kill() { $killed = false; $proActive = is_plugin_active($this->pro); $liteActive = is_plugin_active($this->lite); if ($proActive && $liteActive) { add_action('init', array($this, 'init')); $plgPath = ABSPATH . PLUGINDIR . "/$this->lite"; $liteData = get_plugin_data($plgPath); $plgPath = ABSPATH . PLUGINDIR . "/$this->pro"; $proData = get_plugin_data($plgPath); $this->liteName = $liteData['Name']; $this->proName = $proData['Name']; self::$adminNotice .= sprintf('

'); self::$adminNotice .= sprintf(__("%s cannot be active now. Deactivating it so that you can use the Pro version %s If you really want to use the %s version, please deactivate the %s version first.", "easy-common"), "{$this->liteName}", "{$this->proName}.
", "Lite", "Pro"); self::$adminNotice .= sprintf("
" . __("Please reload this page to remove stale links.", 'easy-common') . " "); self::$adminNotice .= sprintf('

'); add_action('admin_notices', array('EzKillLite', 'admin_notices')); add_action('admin_footer-plugins.php', array($this, 'admin_footer_kill')); $killed = true; } self::$killed = $killed; return $killed; } function deny() { if (self::$killed) { return; } $this->liteName = ''; if (is_plugin_active($this->lite)) { $litePlg = ABSPATH . PLUGINDIR . "/" . $this->lite; $liteData = get_plugin_data($litePlg); $this->liteName = $liteData['Name']; if (!empty($_REQUEST['plugin'])) { add_action('init', array($this, 'init')); self::$adminNotice .= sprintf("
" . __("%s: Another plugin of the same family is active.
Please deactivate it before activating %s.", "easy-common") . "
", "{$this->liteName}", "{$this->liteName}"); add_action('admin_notices', array('EzKillLite', 'admin_notices')); add_action('admin_footer-plugins.php', 'admin_footer_deny'); return false; } else { return $this->liteName; } } } static function admin_notices() { echo self::$adminNotice; } } } if (!empty($liteList)) { foreach ($liteList as $lite) { $ezKillLite = new EzKillLite($lite, $pro, $ezKillingPlg); if ($ezKillLite->kill()) { break; } } }