' . __('Please deactivate one of them, then reactivate either Lite or Pro 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')); } } public static function addTempWarningMultisiteNotice() { if (current_user_can('activate_plugins') && !is_plugin_active_for_network(plugin_basename(self::$pluginFile)) && false === get_option(\DUP_UI_Notice::OPTION_KEY_IS_MU_NOTICE_DISMISSED, false)) { add_action('admin_notices', array(__CLASS__, 'tempWarningMultisiteNotice')); } } /** * 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() { ?>
'; echo '' . __('Duplicator Notice:', 'duplicator') . ' '; echo __('The "Duplicator Lite" and "Duplicator Pro" plugins cannot both be active at the same time. ', 'duplicator'); echo ''; echo __('To use "Duplicator Lite" please deactivate "Duplicator Pro" from the ', 'duplicator'); echo "" . __('plugins page', 'duplicator') . "."; ?>
' . __('NOTICE: Duplicator Lite cannot be activated individually in the sub-sites of a multisite installation but must be activated only on the network. ' . 'Please deactivate Duplicator Lite at this site and activate it on the network.', 'duplicator'); ?>