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