' . __('Please deactivate Duplicator PRO, then reactivate LITE version from the ', 'duplicator') . "" . __('plugins page', 'duplicator') . "."; $result = false; } if ($result === false) { register_activation_hook($pluginFile, array(__CLASS__, 'deactivateOnActivation')); } return $result; } /** * * @param string $plugin * @return boolean // return true if plugin key is active and plugin file exists */ protected static function isPluginActive($plugin) { $isActive = false; if (in_array($plugin, (array) get_option('active_plugins', array()))) { $isActive = true; } if (is_multisite()) { $plugins = get_site_option('active_sitewide_plugins'); if (isset($plugins[$plugin])) { $isActive = true; } } return ($isActive && file_exists(WP_PLUGIN_DIR . '/' . $plugin)); } /** * display admin notice only if user can manage plugins. */ public static function addProEnableNotice() { if (current_user_can('activate_plugins')) { add_action('admin_notices', array(__CLASS__, 'proEnabledNotice')); } } /** * display admin notice */ public static function addMultisiteNotice() { if (current_user_can('activate_plugins')) { add_action('admin_notices', array(__CLASS__, 'multisiteNotice')); } } /** * deactivate current plugin on activation */ public static function deactivateOnActivation() { deactivate_plugins(plugin_basename(self::$pluginFile)); wp_die(self::$deactivationMessage); } /** * Display admin notice if duplicator pro is enabled */ public static function proEnabledNotice() { $pluginUrl = (is_multisite() ? network_admin_url('plugins.php') : admin_url('plugins.php')); ?>

.