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