コード例 #1
0
 static function run_safe_installer()
 {
     global $wpdb;
     //Do this if multi-site setup
     if (function_exists('is_multisite') && 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) {
             $old_blog = $wpdb->blogid;
             // Get all blog ids
             $blogids = $wpdb->get_col("SELECT blog_id FROM {$wpdb->blogs}");
             foreach ($blogids as $blog_id) {
                 switch_to_blog($blog_id);
                 SwpmInstallation::installer();
                 SwpmInstallation::initdb();
             }
             switch_to_blog($old_blog);
             return;
         }
     }
     //Do this if single site standard install
     SwpmInstallation::installer();
     SwpmInstallation::initdb();
 }
 public static function activate()
 {
     wp_schedule_event(time(), 'daily', 'swpm_account_status_event');
     wp_schedule_event(time(), 'daily', 'swpm_delete_pending_account_event');
     include_once 'class.swpm-installation.php';
     SwpmInstallation::run_safe_installer();
 }