function katb_testimomial_basics_activate()
{
    //Check version compatibilities
    if (version_compare(get_bloginfo('version'), '3.9', '<')) {
        deactivate_plugins(basename(__FILE__));
        // Deactivate our plugin
        die('Please Upgrade your WordPress to use this plugin.');
    }
    global $wpdb, $katb_db_new_version, $katb_tb_installed_version;
    $katb_tb_installed_version = get_option('katb_database_version');
    $tablename = $wpdb->prefix . 'testimonial_basics';
    $tableprefix = strtolower($wpdb->prefix);
    if ($wpdb->get_var("SHOW TABLES LIKE '{$tablename}'") != $tablename && $wpdb->get_var("SHOW TABLES LIKE '{$tablename}'") != $tableprefix . 'testimonial_basics') {
        // add charset & collate like wp core
        $charset_collate = $wpdb->get_charset_collate();
        //create new table
        $sql = "CREATE TABLE `{$tablename}` (\r\n\t\t\t\t`tb_id` int(4) UNSIGNED NOT NULL AUTO_INCREMENT,\r\n\t\t\t\t`tb_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,\r\n\t\t\t\t`tb_group` char(100) NOT NULL,\r\n\t\t\t\t`tb_order` int(4) UNSIGNED NOT NULL,\r\n\t\t\t\t`tb_approved` int(1) UNSIGNED NOT NULL,\r\n\t\t\t\t`tb_name` char(100) NOT NULL,\r\n\t\t\t\t`tb_location` char(100) NOT NULL,\r\n\t\t\t\t`tb_email` char(100) NOT NULL,\r\n\t\t\t\t`tb_pic_url` char(150) NOT NULL,\r\n\t\t\t\t`tb_url` char(150) NOT NULL,\r\n\t\t\t\t`tb_rating` char(5) NOT NULL,\r\n\t\t\t\t`tb_testimonial` text NOT NULL,\r\n\t\t\t\tPRIMARY KEY (`tb_id`)\r\n\t\t\t){$charset_collate};";
        require_once ABSPATH . 'wp-admin/includes/upgrade.php';
        dbDelta($sql);
        update_option('katb_database_version', $katb_db_new_version);
    } elseif ($katb_tb_installed_version !== $katb_db_new_version) {
        //ensure all tables are upgraded to 1.4
        $sql = "CREATE TABLE `{$tablename}` (\r\n\t\t\t\t`tb_id` int(4) UNSIGNED NOT NULL AUTO_INCREMENT,\r\n\t\t\t\t`tb_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,\r\n\t\t\t\t`tb_group` char(100) NOT NULL,\r\n\t\t\t\t`tb_order` int(4) UNSIGNED NOT NULL,\r\n\t\t\t\t`tb_approved` int(1) UNSIGNED NOT NULL,\r\n\t\t\t\t`tb_name` char(100) NOT NULL,\r\n\t\t\t\t`tb_location` char(100) NOT NULL,\r\n\t\t\t\t`tb_email` char(100) NOT NULL,\r\n\t\t\t\t`tb_pic_url` char(150) NOT NULL,\r\n\t\t\t\t`tb_url` char(150) NOT NULL,\r\n\t\t\t\t`tb_rating` char(5) NOT NULL,\r\n\t\t\t\t`tb_testimonial` text NOT NULL\r\n\t\t\t);";
        require_once ABSPATH . 'wp-admin/includes/upgrade.php';
        dbDelta($sql);
        update_option('katb_database_version', $katb_db_new_version);
    }
}
Example #2
0
function wpcb_update()
{
    $wp_version_required = "3.0";
    global $wp_version;
    $plugin = plugin_basename(__FILE__);
    $plugin_data = get_plugin_data(__FILE__, false);
    if (version_compare($wp_version, $wp_version_required, "<")) {
        if (is_plugin_active($plugin)) {
            deactivate_plugins($plugin);
            wp_die("'" . $plugin_data['Name'] . "' requires WordPress " . $wp_version_required . " or higher, and has been deactivated! Please upgrade WordPress and try again.<br /><br />Back to <a href='" . admin_url() . "'>WordPress admin</a>.");
        }
    }
    // Check if it is a plugin update :
    $wpcb_dev = get_option('wpcb_dev');
    if (version_compare($wpcb_dev['version'], $plugin_data['Version'], "<")) {
        wpcb_activate();
        // So that the 2 files atos.merchant.php  are copied again
    }
    // if the ZF plugin is successfully loaded this constant is set to true
    if (defined('WP_ZEND_FRAMEWORK') && constant('WP_ZEND_FRAMEWORK')) {
        return true;
    }
    // you can also check if ZF is available on the system
    $paths = explode(PATH_SEPARATOR, get_include_path());
    foreach ($paths as $path) {
        if (file_exists("{$path}/Zend/Loader.php")) {
            define('WP_ZEND_FRAMEWORK', true);
            return true;
        }
    }
    // nothing found, you may advice the user to install the ZF plugin
    define('WP_ZEND_FRAMEWORK', false);
}
Example #3
0
 public function activate()
 {
     if (!in_array('woocommerce/woocommerce.php', get_option('active_plugins')) || !defined('WC_VERSION') || !version_compare(WC_VERSION, '2.6', '>=')) {
         deactivate_plugins(plugin_basename(__FILE__));
         wp_die(sprintf(__('Для работы плагина eDostavka нужно установить %s! не ниже 2.6 версии'), '<a href="http://wordpress.org/extend/plugins/woocommerce/">WooCommerce</a>'));
     }
 }
function deactivate_featured_item_conditional()
{
    if (is_plugin_active('ux-featured-item/portfolio-post-type.php')) {
        deactivate_plugins('ux-featured-item/portfolio-post-type.php');
        flush_rewrite_rules();
    }
}
 function check_wc_version()
 {
     if (!function_exists('WC') || version_compare(WC()->version, $this->required_wc_version) < 0) {
         deactivate_plugins(plugin_basename(__FILE__));
         add_action('admin_notices', array(__CLASS__, 'wc_version_notice'));
     }
 }
Example #6
0
function gmp_install()
{
    global $wp_version, $wpdb;
    if (version_compare($wp_version, "2.9", "<")) {
        deactivate_plugins(basename(__FILE__));
        // Deactivate our plugin
        wp_die("This plugin requires WordPress version 2.9 or higher.");
    }
    //set the table structure version
    $gmp_db_version = "1.0";
    //define the custom table name
    $table_name = $wpdb->prefix . "gmp_ data";
    //verify the table doesn’t already exist
    if ($wpdb->get_var("SHOW TABLES LIKE '{$table_name}'") != $table_name) {
        //build our query to create our new table
        $sql = "CREATE TABLE " . $table_name . " (\n            id mediumint(9) NOT NULL AUTO_INCREMENT,\n            time bigint(11) DEFAULT ‘0’ NOT NULL,\n            name tinytext NOT NULL,\n            text text NOT NULL,\n            url VARCHAR(55) NOT NULL,\n            UNIQUE KEY id (id)\n        );";
        require_once ABSPATH . 'wp-admin/includes/upgrade.php';
        //execute the query creating our table
        dbDelta($sql);
        //save the table structure version number
        add_option("gmp_db_version", $gmp_db_version);
    }
    $installed_ver = get_option("gmp_ db_version");
    if ($installed_ver != $gmp_db_version) {
        //update database table here
        //update table version
        update_option("gmp_db_version", $gmp_db_version);
    }
}
 /** 
  * Gallery To Slideshow Activation
  *
  * @package Gallery To Slideshow
  * @since 1.0
  *
  */
 function mv_gallery_to_slideshow_activation()
 {
     // check compatibility
     if (version_compare(get_bloginfo('version'), '3.4') >= 0) {
         deactivate_plugins(basename(__FILE__));
     }
 }
Example #8
0
function storm_menu_social_icons_init()
{
    // PHP Version Check
    $php_is_outdated = version_compare(PHP_VERSION, '5.2', '<');
    // Only exit and warn if on admin page
    $okay_to_exit = is_admin() && (!defined('DOING_AJAX') || !DOING_AJAX);
    if ($php_is_outdated) {
        if ($okay_to_exit) {
            require_once ABSPATH . '/wp-admin/includes/plugin.php';
            deactivate_plugins(__FILE__);
            wp_die(sprintf(__('Menu Social Icons requires PHP 5.2 or higher, as does WordPress 3.2 and higher. The plugin has now disabled itself. For information on upgrading, %ssee this article%s.', 'menu-social-icons'), '<a href="http://codex.wordpress.org/Switching_to_PHP5" target="_blank">', '</a>'));
        } else {
            return;
        }
    }
    require_once dirname(__FILE__) . '/classes/msi-frontend.php';
    require_once dirname(__FILE__) . '/classes/msi-admin.php';
    if (class_exists('BWP_MINIFY')) {
        require_once dirname(__FILE__) . '/classes/msi-bwp-compatibility.php';
    }
    // Frontend actions
    // WP E-Commerce blocks other template_redirect actions by exiting at priority 10.
    add_action('template_redirect', 'MSI_Frontend::get_instance', 5);
    // Admin actions
    add_action('admin_init', 'MSI_Admin::get_instance');
}
Example #9
0
function task_breaker_deactivate_thrive_intranet()
{
    // De-activate Thrive Intranet in case it is used to prevent conflict.
    require_once ABSPATH . 'wp-admin/includes/plugin.php';
    deactivate_plugins('/thrive-intranet/thrive-intranet.php');
    return;
}
 /**
  * Check some thinks on plugin activation
  *
  * @since   0.0.1
  * @access  public
  * @static
  * @return  void
  */
 public static function on_activate()
 {
     // check WordPress version
     if (!version_compare($GLOBALS['wp_version'], '4.0', '>=')) {
         deactivate_plugins(RW_Distributed_Profile_Server::$plugin_filename);
         die(wp_sprintf('<strong>%s:</strong> ' . __('This plugin requires WordPress 4.0 or newer to work', RW_Site_Config::get_textdomain()), RW_Site_Config::get_plugin_data('Name')));
     }
     // check php version
     if (version_compare(PHP_VERSION, '5.3.0', '<')) {
         deactivate_plugins(RW_Site_Config::$plugin_filename);
         die(wp_sprintf('<strong>%1s:</strong> ' . __('This plugin requires PHP 5.3 or newer to work. Your current PHP version is %1s, please update.', RW_Site_Config::get_textdomain()), RW_Site_Config::get_plugin_data('Name'), PHP_VERSION));
     }
     if (defined('RW_SITE_CONFIG_PLUGINS_CONFIG')) {
         if (false === get_site_option('rw_site_config_plugins')) {
             $plugins = unserialize(RW_SITE_CONFIG_PLUGINS_CONFIG);
             update_site_option('rw_site_config_plugins', $plugins);
         }
     }
     if (defined('RW_SITE_CONFIG_OPTIONS_CONFIG')) {
         if (false === get_site_option('rw_site_config_options')) {
             $options = unserialize(RW_SITE_CONFIG_OPTIONS_CONFIG);
             update_site_option('rw_site_config_options', $options);
         }
     }
 }
Example #11
0
function wp_call_to_action_activate($wp = '3.6', $php = '5.3', $lp = '1.3.6', $leads = '1.2.1')
{
    global $wp_version;
    if (version_compare(phpversion(), $php, '<')) {
        $flag = 'PHP';
        $php_version = phpversion();
        $version = 'PHP' == $flag ? $php : $wp;
        wp_die(__('<p>The <strong>WordPress Calls to Action</strong> plugin requires' . $flag . '  version ' . $php . ' or greater.</p>Your server is running version ' . $php_version . '. Please Contact your hosting provider to update your PHP version. PHP 5.3 came out in December of 2010.', 'cta'), 'Plugin Activation Error', array('response' => 200, 'back_link' => TRUE));
        deactivate_plugins(basename(WP_CTA_FILE));
    } elseif (version_compare($wp_version, $wp, '<')) {
        $flag = 'WordPress';
        wp_die(sprintf(__('<p>The <strong>WordPress Calls to Action</strong> plugin requires %s  version %s or greater.</p>', 'cta'), $flag, $php), 'Plugin Activation Error', array('response' => 200, 'back_link' => TRUE));
        deactivate_plugins(basename(WP_CTA_FILE));
    } elseif (defined('LANDINGPAGES_CURRENT_VERSION') && version_compare(LANDINGPAGES_CURRENT_VERSION, $lp, '<')) {
        $flag = 'Landing Pages';
        wp_die(sprintf(__('<p>The <strong>WordPress Calls to Action</strong> plugin requires %s  version %s or greater. <br><br>Please Update WordPress Landing Page Plugin to update Calls to action</p>', 'cta'), $flag, $lp), 'Plugin Activation Error', array('response' => 200, 'back_link' => TRUE));
    } elseif (defined('LEADS_CURRENT_VERSION') && version_compare(LEADS_CURRENT_VERSION, $leads, '<')) {
        $flag = 'Leads';
        wp_die(sprintf(__('<p>The <strong>WordPress Calls to Action</strong> plugin requires %s  version %s or greater. <br><br>Please Update WordPress Leads Plugin to update Calls to action</p>', 'cta'), $flag, $leads), 'Plugin Activation Error', array('response' => 200, 'back_link' => TRUE));
    } else {
        // Activate Plugin
        add_option('wp_cta_global_css', '', '', 'no');
        add_option('wp_cta_global_js', '', '', 'no');
        add_option('wp_cta_global_record_admin_actions', '1', '', 'no');
        add_option('wp_cta_global_wp_cta_slug', 'cta', '', 'no');
        update_option('wp_cta_activate_rewrite_check', '1');
        global $wp_rewrite;
        $wp_rewrite->flush_rules();
    }
    // Add default CTA setup and setup 3 categores: sidebar, blog post, popup
}
Example #12
0
function update_primary_shareaholic_plugin_file()
{
    if (is_plugin_active('shareaholic/sexy-bookmarks.php')) {
        deactivate_plugins('shareaholic/sexy-bookmarks.php');
        activate_plugins('shareaholic/shareaholic.php');
    }
}
Example #13
0
 /**
  * Perform check.
  *
  * @since 160618 Rewrite.
  */
 protected static function doCheck()
 {
     if (!empty($GLOBALS[GLOBAL_NS . '_conflicting_plugin'])) {
         return $GLOBALS[GLOBAL_NS . '_conflicting_plugin'];
     }
     $conflicting_plugin_slugs = [str_replace('_', '-', GLOBAL_NS) . (IS_PRO ? '' : '-pro')];
     $active_plugins = (array) get_option('active_plugins', array());
     $active_sitewide_plugins = is_multisite() ? array_keys((array) get_site_option('active_sitewide_plugins', array())) : array();
     $active_plugins = array_unique(array_merge($active_plugins, $active_sitewide_plugins));
     foreach ($active_plugins as $_active_plugin_basename) {
         if (!($_active_plugin_slug = strstr($_active_plugin_basename, '/', true))) {
             continue;
             // Nothing to check in this case.
         }
         if (in_array($_active_plugin_slug, $conflicting_plugin_slugs, true)) {
             if (in_array($_active_plugin_slug, array('comment-mail', 'comment-mail-pro'), true)) {
                 add_action('admin_init', function () use($_active_plugin_basename) {
                     if (function_exists('deactivate_plugins')) {
                         // Can deactivate?
                         deactivate_plugins($_active_plugin_basename, true);
                     }
                 }, -1000);
             } else {
                 return $GLOBALS[GLOBAL_NS . '_conflicting_plugin'] = $_active_plugin_slug;
             }
         }
     }
     return $GLOBALS[GLOBAL_NS . '_conflicting_plugin'] = '';
     // i.e. No conflicting plugins.
 }
/**
 * Plugin activation check
 */
function wc_fedex_activation_check()
{
    if (!class_exists('SoapClient')) {
        deactivate_plugins(basename(__FILE__));
        wp_die('Sorry, but you cannot run this plugin, it requires the <a href="http://php.net/manual/en/class.soapclient.php">SOAP</a> support on your server/hosting to function.');
    }
}
Example #15
0
 /**
  * Placeholder for activation function
  * Nothing being called here yet.
  *
  * @since 0.1
  *
  * @return 0.1
  */
 public function activate()
 {
     // bail out if the php version is lower than
     if (version_compare(PHP_VERSION, $this->min_php, '<')) {
         deactivate_plugins(basename(WPERP_FILE));
         $error = '<h1>An Error Occured</h1>';
         $error .= '<h2>Your installed PHP Version is: ' . PHP_VERSION . '</h2>';
         $error .= '<p>The <strong>WP ERP</strong> plugin requires PHP version <strong>' . $this->min_php . '</strong> or greater';
         $error .= '<p>The version of your PHP is <a href="http://php.net/supported-versions.php" target="_blank"><strong>unsupported and old</strong></a>. ';
         $error .= 'You should update your PHP software or contact your host regarding this matter.</p>';
         wp_die($error, 'Plugin Activation Error', array('response' => 200, 'back_link' => true));
     }
     $this->create_tables();
     $this->set_default_modules();
     $this->create_roles();
     $this->set_role();
     $this->create_cron_jobs();
     $current_erp_version = get_option('wp_erp_version', null);
     $current_db_version = get_option('wp_erp_db_version', null);
     if (is_null($current_erp_version) && is_null($current_db_version) && apply_filters('erp_enable_setup_wizard', true)) {
         set_transient('_erp_activation_redirect', 1, 30);
     }
     // update to latest version
     $latest_version = erp_get_version();
     update_option('wp_erp_version', $latest_version);
     update_option('wp_erp_db_version', $latest_version);
 }
Example #16
0
function dfrapi_wp_version_check()
{
    $version = get_bloginfo('version');
    if (version_compare($version, '3.8', '<')) {
        deactivate_plugins(DFRAPI_BASENAME);
    }
}
/**
 * Register activation hook
 */
function woocommerce_gateway_klarna_activate()
{
    if (version_compare(PHP_VERSION, '5.4', '<')) {
        deactivate_plugins(basename(__FILE__));
        wp_die(__('<p><strong>WooCommerce Gateway Klarna</strong> plugin requires PHP version 5.4 or greater.</p>', 'woocommerce-gateway-klarna'));
    }
}
Example #18
0
 /**
  *	Plugin activation
  *  
  *  Checks minimum requirements.
  *  If met, ensure any previously set options are retained, and new ones set as needed.
  *  If the plugin has additional installation requirements, calls the custom function to perform them.
  * 
  *  @package WP_Plugin_Admin
  * 	@since 1.2
  * 	@params none
  * 	@return void
  */
 function activate_plugin()
 {
     global $wp_version;
     $min_php = isset($this->min_php) ? $this->min_php : '5.2.4';
     $min_wp = isset($this->min_wp) ? $this->min_wp : '3.1';
     $min = true;
     if (version_compare(PHP_VERSION, $min_php) == -1) {
         $min = false;
     }
     if (version_compare($wp_version, $min_wp) == -1) {
         $min = false;
     }
     if ($min == false) {
         $msg = '<p>' . ucwords(str_replace('-', ' ', $this->unique_id)) . __(' requires WordPress version ') . $min_wp . __(' and PHP version ') . $min_php . '<br />';
         $msg .= __('You are running Wordpress version ') . $wp_version . __(' and PHP version ') . PHP_VERSION . '</p>';
         if (is_plugin_active($this->base_plugin)) {
             deactivate_plugins($this->base_plugin);
         }
         exit($msg);
     } else {
         // set the basic options
         $options = $this->get_options();
         update_option($this->unique_id, $options);
         // do any installation steps required by the extends class
         if (method_exists($this, 'custom_activate_plugin')) {
             $this->custom_activate_plugin();
         }
     }
 }
 /**
  * Deactivate the plugin if we are not on a multisite installation
  * @since 0.2.0
  */
 public static function check_if_multisite()
 {
     if (!function_exists('is_multisite') || !is_multisite()) {
         deactivate_plugins(plugin_basename(__FILE__));
         wp_die('MultiSite Clone Duplicator works only for multisite installation');
     }
 }
Example #20
0
 public static function activation()
 {
     // TODO: Implement activation() method.
     if (!version_compare(PHP_VERSION, '5.3.0', '>=')) {
         global $locale;
         $error_msg = '';
         switch ($locale) {
             case "ru_RU":
                 $error_msg = '<p>К сожалению, плагин Travelpayouts не работает с версиями PHP ниже чем 5.3.х.
             Ознакомьтесь с информацией о том, <a href="https://support.travelpayouts.com/hc/ru/articles/207794617#02?utm_source=wpplugin&utm_medium=php_error&utm_campaign=ru">
             как вы можете обновиться</a>.</p>';
                 break;
             case "en_US":
                 $error_msg = '<p>Unfortunately, Travelpayouts plugin can not run on PHP versions that are older than 5.3.х.
             Read more information about <a href="https://support.travelpayouts.com/hc/en-us/articles/207794617#02?utm_source=wpplugin&utm_medium=php_error&utm_campaign=en">
             how you can update</a>.</p>';
                 break;
             default:
                 $error_msg = '<p>Unfortunately, Travelpayouts plugin can not run on PHP versions that are older than 5.3.х.
             Read more information about <a href="https://support.travelpayouts.com/hc/en-us/articles/207794617#02?utm_source=wpplugin&utm_medium=php_error&utm_campaign=en">
             how you can update</a>.</p>';
                 break;
         }
         deactivate_plugins(TPOPlUGIN_NAME);
         wp_die($error_msg);
     } else {
         if (!get_option(TPOPlUGIN_OPTION_NAME)) {
             update_option(TPOPlUGIN_OPTION_NAME, TPDefault::defaultOptions());
         }
         if (!get_option(TPOPlUGIN_OPTION_VERSION)) {
             update_option(TPOPlUGIN_OPTION_VERSION, TPOPlUGIN_VERSION);
         }
         models\admin\menu\TPSearchFormsModel::createTable();
     }
 }
Example #21
0
/**
 * Plugin activation check
 */
function wc_ups_activation_check()
{
    if (!function_exists('simplexml_load_string')) {
        deactivate_plugins(basename(__FILE__));
        wp_die("Sorry, but you can't run this plugin, it requires the SimpleXML library installed on your server/hosting to function.");
    }
}
Example #22
0
 public function __construct($logger)
 {
     // do not run this plugin on local or staging
     if (defined("ENV") && (ENV == "local" || ENV == "staging")) {
         return;
     }
     $this->logger = $logger;
     add_action("admin_init", function () {
         if (defined("ENV") && ENV == "local") {
             deactivate_plugins(plugin_basename(__FILE__));
         }
     });
     if (defined("ENV") && ENV != "local") {
         register_activation_hook(__FILE__, function () {
             wp_schedule_event(time(), "daily", "wp_location_grams_import");
             wp_schedule_event(time(), "daily", "wp_location_grams_archive");
         });
         add_action("wp_location_grams_import", array($this, "import"));
         add_action("wp_location_grams_archive", array($this, "archive"));
         register_deactivation_hook(__FILE__, function () {
             wp_clear_scheduled_hook("wp_location_grams_import");
             wp_clear_scheduled_hook("wp_location_grams_archive");
         });
     }
     // add_action("admin_init", array($this, "import")); // for auto import
     // add_action("admin_init", array($this, "archive")); // for auto archive
 }
/**
 * Upon activation of the plugin, see if we are running the required version and deploy theme in defined.
 *
 * @since 0.1
 */
function seedprod_ucsp_activation()
{
    if (version_compare(get_bloginfo('version'), '3.0', '<')) {
        deactivate_plugins(__FILE__);
        wp_die(__('WordPress 3.0 and higher required. The plugin has now disabled itself. On a side note why are you running an old version :( Upgrade!', 'ultimate-coming-soon-page'));
    }
}
Example #24
0
/**
 * Deactivate if plugin in loaded not as mu-plugin.
 * @param $plugin
 * @param $network_wide
 */
function ghu_deactivate($plugin, $network_wide)
{
    $ghu_plugin_file = 'github-updater/github-updater.php';
    if ($ghu_plugin_file === $plugin) {
        deactivate_plugins($ghu_plugin_file);
    }
}
Example #25
0
 /**
  * Checks if another version of WPMDB(Pro) is active and deactivates it.
  * To be hooked on `activated_plugin` so other plugin is deactivated when current plugin is activated.
  *
  * @param string $plugin
  *
  */
 public static function deactivate_other_instances($plugin)
 {
     if (!in_array(basename($plugin), array('wp-migrate-db-pro.php', 'wp-migrate-db.php'))) {
         return;
     }
     $plugin_to_deactivate = 'wp-migrate-db.php';
     $deactivated_notice_id = '1';
     if (basename($plugin) == $plugin_to_deactivate) {
         $plugin_to_deactivate = 'wp-migrate-db-pro.php';
         $deactivated_notice_id = '2';
     }
     if (is_multisite()) {
         $active_plugins = (array) get_site_option('active_sitewide_plugins', array());
         $active_plugins = array_keys($active_plugins);
     } else {
         $active_plugins = (array) get_option('active_plugins', array());
     }
     foreach ($active_plugins as $basename) {
         if (false !== strpos($basename, $plugin_to_deactivate)) {
             set_transient('wp_migrate_db_deactivated_notice_id', $deactivated_notice_id, 1 * HOUR_IN_SECONDS);
             deactivate_plugins($basename);
             return;
         }
     }
 }
/**
 * This function runs on admin_init and checks to make sure Genesis is active, if not, it 
 * deactivates the plugin. This is useful for when users switch to a non-Genesis themes.
 */
function wpstudio_deactivate_check()
{
    if (!function_exists('genesis_pre')) {
        deactivate_plugins(plugin_basename(__FILE__));
        // Deactivate plugin
    }
}
 function fts_plugin_version_check()
 {
     // return error if no data retreived
     try {
         $update_msg = 'Please update ALL Premium Extensions for Feed Them Social because they will no longer work with this version of Feed Them Social. We have made some Major Changes to the Core of the plugin to help with plugin conflicts. Please update your extensions from your <a href="http://www.slickremix.com/my-account" target="_blank">My Account</a> page on our website if you are not receiving notifications for updates on the premium extensions. Thanks again for using our plugin!';
         $list_old_plugins = array('feed-them-premium/feed-them-premium.php', 'fts-bar/fts-bar.php', 'feed-them-social-facebook-reviews/feed-them-social-facebook-reviews.php');
         $plugins = get_plugins();
         foreach ($list_old_plugins as $single_plugin) {
             require_once ABSPATH . '/wp-admin/includes/plugin.php';
             if (isset($plugins[$single_plugin])) {
                 $fts_versions_needed = \fts_versions_needed();
                 if ($plugins[$single_plugin]['Version'] < $fts_versions_needed[$single_plugin] && is_plugin_active($single_plugin)) {
                     //Don't Let Old Plugins Activate
                     throw new \Exception('<div class="fts-update-message fts_old_plugins_message">' . $update_msg . '</div>');
                     deactivate_plugins($single_plugin);
                 }
             }
         }
     } catch (\Exception $e) {
         add_action('admin_notices', function () use($e) {
             echo $e->getMessage();
         });
         return true;
     }
 }
 /**
  * Activation Hook - Confirm site is using Genesis
  *
  */
 function activation_hook()
 {
     if ('genesis' != basename(TEMPLATEPATH)) {
         deactivate_plugins(plugin_basename(__FILE__));
         wp_die(sprintf(__('Sorry, you can&rsquo;t activate unless you have installed <a href="%s">Genesis</a>', 'genesis-title-toggle'), 'http://www.billerickson.net/get-genesis'));
     }
 }
 /**
  * This function run at plugin's activation.
  * checks if gameday theme is active, and LeagueManager plugin is active
  */
 static function activate()
 {
     if (!self::are_requirements_meets()) {
         add_action('admin_notices', array('Lm_Gd_Scoreboard', 'force_deactivate_message'));
         deactivate_plugins(plugin_basename(__FILE__));
     }
 }
Example #30
-1
 /**
  * Deactivates our plugin if anything goes wrong. Also, removes the
  * "Plugin activated" message, if we don't pass requriments check.
  */
 public static function pluginDeactivate($message)
 {
     require_once ABSPATH . 'wp-admin/includes/plugin.php';
     deactivate_plugins('comment-attachment/comment-attachment.php');
     unset($_GET['activate']);
     wp_die($message);
 }