Plugin Directory

Changeset 1030633


Ignore:
Timestamp:
11/22/2014 08:09:14 AM (11 years ago)
Author:
NullLogic
Message:

v1.0.0

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pagenator/trunk/public/pagenator-public.php

    r1030632 r1030633  
    4747    public static function activate( $network_wide ) {
    4848
    49         if ( function_exists( 'is_multisite' ) && is_multisite() ) {
    50 
    51             if ( $network_wide ) {
    52 
    53                 // Get all blog ids
    54                 $blog_ids = self::get_blog_ids();
    55 
    56                 foreach ( $blog_ids as $blog_id ) {
    57 
    58                     switch_to_blog( $blog_id );
    59                     self::single_activate();
    60 
    61                     restore_current_blog();
    62                 }
    63 
    64             } else {
    65                 self::single_activate();
    66             }
    67 
    68         } else {
    69             self::single_activate();
    70         }
    71 
    7249    }
    7350
    7451    public static function deactivate( $network_wide ) {
    75 
    76         if ( function_exists( 'is_multisite' ) && is_multisite() ) {
    77 
    78             if ( $network_wide ) {
    79 
    80                 // Get all blog ids
    81                 $blog_ids = self::get_blog_ids();
    82 
    83                 foreach ( $blog_ids as $blog_id ) {
    84 
    85                     switch_to_blog( $blog_id );
    86                     self::single_deactivate();
    87 
    88                     restore_current_blog();
    89 
    90                 }
    91 
    92             } else {
    93                 self::single_deactivate();
    94             }
    95 
    96         } else {
    97             self::single_deactivate();
    98         }
    99 
    100     }
    101 
    102     public function activate_new_site( $blog_id ) {
    103 
    104         if ( 1 !== did_action( 'wpmu_new_blog' ) ) {
    105             return;
    106         }
    107 
    108         switch_to_blog( $blog_id );
    109         self::single_activate();
    110         restore_current_blog();
    111 
    112     }
    113 
    114     private static function get_blog_ids() {
    115 
    116         global $wpdb;
    117 
    118         // get an array of blog ids
    119         $sql = "SELECT blog_id FROM $wpdb->blogs
    120             WHERE archived = '0' AND spam = '0'
    121             AND deleted = '0'";
    122 
    123         return $wpdb->get_col( $sql );
    124 
    125     }
    126 
    127     private static function single_activate() {
    128 
    129     }
    130 
    131     private static function single_deactivate() {
    13252
    13353    }
Note: See TracChangeset for help on using the changeset viewer.