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