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