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