| @@ 123-148 (lines=26) @@ | ||
| 120 | * WPMU is disabled or plugin is |
|
| 121 | * activated on an individual blog. |
|
| 122 | */ |
|
| 123 | public static function activate( $network_wide ) { |
|
| 124 | ||
| 125 | if ( function_exists( 'is_multisite' ) && is_multisite() ) { |
|
| 126 | ||
| 127 | if ( $network_wide ) { |
|
| 128 | ||
| 129 | // Get all blog ids |
|
| 130 | $blog_ids = self::get_blog_ids(); |
|
| 131 | ||
| 132 | foreach ( $blog_ids as $blog_id ) { |
|
| 133 | ||
| 134 | switch_to_blog( $blog_id ); |
|
| 135 | self::single_activate(); |
|
| 136 | } |
|
| 137 | ||
| 138 | restore_current_blog(); |
|
| 139 | ||
| 140 | } else { |
|
| 141 | self::single_activate(); |
|
| 142 | } |
|
| 143 | ||
| 144 | } else { |
|
| 145 | self::single_activate(); |
|
| 146 | } |
|
| 147 | ||
| 148 | } |
|
| 149 | ||
| 150 | /** |
|
| 151 | * Fired when the plugin is deactivated. |
|
| @@ 160-186 (lines=27) @@ | ||
| 157 | * WPMU is disabled or plugin is |
|
| 158 | * deactivated on an individual blog. |
|
| 159 | */ |
|
| 160 | public static function deactivate( $network_wide ) { |
|
| 161 | ||
| 162 | if ( function_exists( 'is_multisite' ) && is_multisite() ) { |
|
| 163 | ||
| 164 | if ( $network_wide ) { |
|
| 165 | ||
| 166 | // Get all blog ids |
|
| 167 | $blog_ids = self::get_blog_ids(); |
|
| 168 | ||
| 169 | foreach ( $blog_ids as $blog_id ) { |
|
| 170 | ||
| 171 | switch_to_blog( $blog_id ); |
|
| 172 | self::single_deactivate(); |
|
| 173 | ||
| 174 | } |
|
| 175 | ||
| 176 | restore_current_blog(); |
|
| 177 | ||
| 178 | } else { |
|
| 179 | self::single_deactivate(); |
|
| 180 | } |
|
| 181 | ||
| 182 | } else { |
|
| 183 | self::single_deactivate(); |
|
| 184 | } |
|
| 185 | ||
| 186 | } |
|
| 187 | ||
| 188 | /** |
|
| 189 | * Fired when a new site is activated with a WPMU environment. |
|