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