function install()
 {
     global $wpdb;
     include_once 'admin/install.php';
     $this->remove_transients();
     if (is_multisite()) {
         $network = isset($_SERVER['SCRIPT_NAME']) ? $_SERVER['SCRIPT_NAME'] : "";
         $activate = isset($_GET['action']) ? $_GET['action'] : "";
         $isNetwork = $network == '/wp-admin/network/plugins.php' ? true : false;
         $isActivation = $activate == 'deactivate' ? false : true;
         if ($isNetwork and $isActivation) {
             $old_blog = $wpdb->blogid;
             $blogids = $wpdb->get_col($wpdb->prepare("SELECT blog_id FROM {$wpdb->blogs}", NULL));
             foreach ($blogids as $blog_id) {
                 switch_to_blog($blog_id);
                 nggallery_install($this);
             }
             switch_to_blog($old_blog);
             return;
         }
     }
     // remove the update message
     delete_option('ngg_update_exists');
     nggallery_install($this);
 }
Example #2
0
 function activate()
 {
     global $wpdb;
     //Starting from version 1.8.0 it's works only with PHP5.2
     //if (version_compare(PHP_VERSION, '5.2.0', '<')) {
     //        deactivate_plugins(plugin_basename(__FILE__)); // Deactivate ourself
     //        wp_die("Sorry, but you can't run this plugin, it requires PHP 5.2 or higher.");
     //		return;
     //}
     include_once dirname(__FILE__) . '/admin/install.php';
     if (is_multisite()) {
         // check if it is a network activation - if so, run the activation function for each blog id
         if (isset($_GET['networkwide']) && $_GET['networkwide'] == 1) {
             $current_blog = $wpdb->blogid;
             // Get all blog ids
             $blogids = $wpdb->get_col($wpdb->prepare("SELECT blog_id FROM {$wpdb->blogs}"));
             foreach ($blogids as $blog_id) {
                 switch_to_blog($blog_id);
                 nggallery_install();
             }
             switch_to_blog($current_blog);
             return;
         }
     }
     // check for tables
     nggallery_install();
     // remove the update message
     delete_option('ngg_update_exists');
 }
Example #3
0
 /**
  * Activation hook
  * register_activation_hook( $this->plugin_name, array(&$this, 'activate') );
  * Disable Plugin if PHP version is lower than 5.2
  * However, why the plugin spread initial validation over so different places? Not need to do that...
  */
 function activate()
 {
     global $wpdb;
     //Starting from version 1.8.0 it's works only with PHP5.2
     if (version_compare(PHP_VERSION, '5.2.0', '<')) {
         deactivate_plugins($this->plugin_name);
         // Deactivate ourself
         wp_die("Sorry, but you can't run this plugin, it requires PHP 5.2 or higher.");
         return;
     }
     // Clean up transients
     self::remove_transients();
     include_once dirname(__FILE__) . '/admin/install.php';
     if (is_multisite()) {
         $network = isset($_SERVER['SCRIPT_NAME']) ? $_SERVER['SCRIPT_NAME'] : "";
         $activate = isset($_GET['action']) ? $_GET['action'] : "";
         $isNetwork = $network == '/wp-admin/network/plugins.php' ? true : false;
         $isActivation = $activate == 'deactivate' ? false : true;
         if ($isNetwork and $isActivation) {
             $old_blog = $wpdb->blogid;
             $blogids = $wpdb->get_col($wpdb->prepare("SELECT blog_id FROM {$wpdb->blogs}", NULL));
             foreach ($blogids as $blog_id) {
                 switch_to_blog($blog_id);
                 nggallery_install();
             }
             switch_to_blog($old_blog);
             return;
         }
     }
     // check for tables
     nggallery_install();
     // remove the update message
     delete_option('ngg_update_exists');
 }
Example #4
0
 function activate()
 {
     include_once dirname(__FILE__) . '/admin/install.php';
     // check for tables
     nggallery_install();
     // remove the update message
     delete_option('ngg_update_exists');
 }
 function multisite_new_blog($blog_id, $user_id, $domain, $path, $site_id, $meta)
 {
     global $wpdb;
     include_once dirname(__FILE__) . '/admin/install.php';
     if (is_plugin_active_for_network($this->plugin_name)) {
         $current_blog = $wpdb->blogid;
         switch_to_blog($blog_id);
         $installer = new C_NggLegacy_Installer();
         nggallery_install($installer);
         switch_to_blog($current_blog);
     }
 }
 function install()
 {
     include_once 'admin/install.php';
     nggallery_install();
 }
Example #7
0
 function activate()
 {
     //Since version 1.4.0 it's tested only with PHP5.2, currently we keep PHP4 support a while
     //if (version_compare(PHP_VERSION, '5.2.0', '<')) {
     //        deactivate_plugins(plugin_basename(__FILE__)); // Deactivate ourself
     //        wp_die("Sorry, but you can't run this plugin, it requires PHP 5.2 or higher.");
     //		return;
     //}
     include_once dirname(__FILE__) . '/admin/install.php';
     // check for tables
     nggallery_install();
     // remove the update message
     delete_option('ngg_update_exists');
 }