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