| @@ -1,32 +1,58 @@ | ||
| 1 | 1 | <?php |
| 2 | +/** | |
| 3 | + * Manages functionality for the Stream Admin pages on both | |
| 4 | + * single and multi-sites. | |
| 5 | + * | |
| 6 | + * @package WP_Stream | |
| 7 | + */ | |
| 8 | + | |
| 2 | 9 | namespace WP_Stream; |
| 3 | 10 | |
| 11 | +/** | |
| 12 | + * Class - Network | |
| 13 | + */ | |
| 4 | 14 | class Network { |
| 5 | 15 | /** |
| 6 | - * Hold Plugin class | |
| 16 | + * Holds instance of plugin object | |
| 17 | + * | |
| 7 | 18 | * @var Plugin |
| 8 | 19 | */ |
| 9 | 20 | public $plugin; |
| 10 | 21 | |
| 22 | + /** | |
| 23 | + * Network page slug | |
| 24 | + * | |
| 25 | + * @var string | |
| 26 | + */ | |
| 11 | 27 | public $network_settings_page_slug = 'wp_stream_network_settings'; |
| 12 | 28 | |
| 13 | - public $default_settings_page_slug = 'wp_stream_default_settings'; | |
| 29 | + /** | |
| 30 | + * The option name for the network settings. | |
| 31 | + * | |
| 32 | + * @var string | |
| 33 | + */ | |
| 34 | + public $network_settings_option = 'wp_stream_network'; | |
| 14 | 35 | |
| 15 | - function __construct( $plugin ) { | |
| 36 | + /** | |
| 37 | + * Class constructor | |
| 38 | + * | |
| 39 | + * @param Plugin $plugin Instance of plugin object. | |
| 40 | + */ | |
| 41 | + public function __construct( $plugin ) { | |
| 16 | 42 | $this->plugin = $plugin; |
| 17 | 43 | |
| 18 | - // Always add default site_id/blog_id params when multisite | |
| 44 | + // Always add default site_id/blog_id params when multisite. | |
| 19 | 45 | if ( is_multisite() ) { |
| 20 | 46 | add_filter( 'wp_stream_query_args', array( $this, 'network_query_args' ) ); |
| 21 | 47 | } |
| 22 | 48 | |
| 23 | - // Bail early if not network-activated | |
| 49 | + // Bail early if not network-activated. | |
| 24 | 50 | if ( ! $this->is_network_activated() ) { |
| 25 | 51 | return; |
| 26 | 52 | } |
| 27 | 53 | |
| 28 | - // Actions | |
| 54 | + // Actions. | |
| 29 | 55 | add_action( 'init', array( $this, 'ajax_network_admin' ) ); |
| 30 | 56 | add_action( 'network_admin_menu', array( $this->plugin->admin, 'register_menu' ) ); |
| 31 | 57 | add_action( 'network_admin_menu', array( $this, 'admin_menu_screens' ) ); |
| 32 | 58 | add_action( 'admin_menu', array( $this, 'admin_menu_screens' ) ); |
| @@ -34,9 +60,9 @@ | ||
| 34 | 60 | add_action( 'network_admin_notices', array( $this->plugin->admin, 'admin_notices' ) ); |
| 35 | 61 | add_action( 'wpmuadminedit', array( $this, 'network_options_action' ) ); |
| 36 | 62 | add_action( 'update_site_option_' . $this->plugin->settings->network_options_key, array( $this, 'updated_option_ttl_remove_records' ), 10, 3 ); |
| 37 | 63 | |
| 38 | - // Filters | |
| 64 | + // Filters. | |
| 39 | 65 | add_filter( 'wp_stream_blog_id_logged', array( $this, 'blog_id_logged' ) ); |
| 40 | 66 | add_filter( 'wp_stream_admin_page_title', array( $this, 'network_admin_page_title' ) ); |
| 41 | 67 | add_filter( 'wp_stream_list_table_screen_id', array( $this, 'list_table_screen_id' ) ); |
| 42 | 68 | add_filter( 'wp_stream_list_table_filters', array( $this, 'list_table_filters' ) ); |
| @@ -50,8 +76,10 @@ | ||
| 50 | 76 | |
| 51 | 77 | /** |
| 52 | 78 | * Workaround to get admin-ajax.php to know when the request is from the Network Admin |
| 53 | 79 | * |
| 80 | + * @return bool | |
| 81 | + * | |
| 54 | 82 | * @action init |
| 55 | 83 | * |
| 56 | 84 | * @see https://core.trac.wordpress.org/ticket/22589 |
| 57 | 85 | */ |
| @@ -63,9 +91,12 @@ | ||
| 63 | 91 | && |
| 64 | 92 | preg_match( '#^' . network_admin_url() . '#i', $_SERVER['HTTP_REFERER'] ) |
| 65 | 93 | ) { |
| 66 | 94 | define( 'WP_NETWORK_ADMIN', true ); |
| 95 | + return WP_NETWORK_ADMIN; | |
| 67 | 96 | } |
| 97 | + | |
| 98 | + return false; | |
| 68 | 99 | } |
| 69 | 100 | |
| 70 | 101 | /** |
| 71 | 102 | * Builds a stdClass object used when displaying actions done in network administration |
| @@ -72,9 +103,9 @@ | ||
| 72 | 103 | * |
| 73 | 104 | * @return object |
| 74 | 105 | */ |
| 75 | 106 | public function get_network_blog() { |
| 76 | - $blog = new \stdClass; | |
| 107 | + $blog = new \stdClass(); | |
| 77 | 108 | $blog->blog_id = 0; |
| 78 | 109 | $blog->blogname = esc_html__( 'Network Admin', 'stream' ); |
| 79 | 110 | |
| 80 | 111 | return $blog; |
| @@ -85,13 +116,9 @@ | ||
| 85 | 116 | * |
| 86 | 117 | * @return bool |
| 87 | 118 | */ |
| 88 | 119 | public function is_network_activated() { |
| 89 | - if ( ! function_exists( 'is_plugin_active_for_network' ) ) { | |
| 90 | - require_once( ABSPATH . '/wp-admin/includes/plugin.php' ); | |
| 91 | - } | |
| 92 | - | |
| 93 | - return is_plugin_active_for_network( $this->plugin->locations['plugin'] ); | |
| 120 | + return $this->plugin->is_network_activated(); | |
| 94 | 121 | } |
| 95 | 122 | |
| 96 | 123 | /** |
| 97 | 124 | * Adds Stream to the admin bar under the "My Sites > Network Admin" menu |
| @@ -98,9 +125,9 @@ | ||
| 98 | 125 | * if Stream has been network-activated. |
| 99 | 126 | * |
| 100 | 127 | * @action admin_bar_menu |
| 101 | 128 | * |
| 102 | - * @param object $admin_bar | |
| 129 | + * @param object $admin_bar Admin bar object. | |
| 103 | 130 | * |
| 104 | 131 | * @return void |
| 105 | 132 | */ |
| 106 | 133 | public function network_admin_bar_menu( $admin_bar ) { |
| @@ -125,9 +152,9 @@ | ||
| 125 | 152 | ); |
| 126 | 153 | } |
| 127 | 154 | |
| 128 | 155 | /** |
| 129 | - * Add Network Settings and Default Settings menu items | |
| 156 | + * Add Network Settings and Default Settings menu pages | |
| 130 | 157 | * |
| 131 | 158 | * @return array |
| 132 | 159 | */ |
| 133 | 160 | public function admin_menu_screens() { |
| @@ -135,8 +162,9 @@ | ||
| 135 | 162 | return; |
| 136 | 163 | } |
| 137 | 164 | |
| 138 | 165 | remove_submenu_page( $this->plugin->admin->records_page_slug, 'wp_stream_settings' ); |
| 166 | + remove_submenu_page( $this->plugin->admin->records_page_slug, 'edit.php?post_type=wp_stream_alerts' ); | |
| 139 | 167 | |
| 140 | 168 | $this->plugin->admin->screen_id['network_settings'] = add_submenu_page( |
| 141 | 169 | $this->plugin->admin->records_page_slug, |
| 142 | 170 | __( 'Stream Network Settings', 'stream' ), |
| @@ -149,11 +177,11 @@ | ||
| 149 | 177 | |
| 150 | 178 | /** |
| 151 | 179 | * Remove records when records TTL is shortened |
| 152 | 180 | * |
| 153 | - * @param string $option_key | |
| 154 | - * @param array $old_value | |
| 155 | - * @param array $new_value | |
| 181 | + * @param string $option_key Unused. | |
| 182 | + * @param array $new_value New value. | |
| 183 | + * @param array $old_value Old value. | |
| 156 | 184 | * |
| 157 | 185 | * @action update_option_wp_stream |
| 158 | 186 | * @return void |
| 159 | 187 | */ |
| @@ -164,9 +192,9 @@ | ||
| 164 | 192 | |
| 165 | 193 | /** |
| 166 | 194 | * Adjust the action of the settings form when in the Network Admin |
| 167 | 195 | * |
| 168 | - * @param $action | |
| 196 | + * @param string $action Query string. | |
| 169 | 197 | * |
| 170 | 198 | * @return string |
| 171 | 199 | */ |
| 172 | 200 | public function settings_form_action( $action ) { |
| @@ -171,9 +199,14 @@ | ||
| 171 | 199 | */ |
| 172 | 200 | public function settings_form_action( $action ) { |
| 173 | 201 | if ( is_network_admin() ) { |
| 174 | 202 | $current_page = wp_stream_filter_input( INPUT_GET, 'page' ); |
| 175 | - $action = add_query_arg( array( 'action' => $current_page ), 'edit.php' ); | |
| 203 | + $action = add_query_arg( | |
| 204 | + array( | |
| 205 | + 'action' => $current_page, | |
| 206 | + ), | |
| 207 | + 'edit.php' | |
| 208 | + ); | |
| 176 | 209 | } |
| 177 | 210 | |
| 178 | 211 | return $action; |
| 179 | 212 | } |
| @@ -180,9 +213,9 @@ | ||
| 180 | 213 | |
| 181 | 214 | /** |
| 182 | 215 | * Add a description to each of the Settings pages in the Network Admin |
| 183 | 216 | * |
| 184 | - * @param $description | |
| 217 | + * @param string $description Description of the current page. | |
| 185 | 218 | * |
| 186 | 219 | * @return string |
| 187 | 220 | */ |
| 188 | 221 | public function settings_form_description( $description ) { |
| @@ -191,15 +224,10 @@ | ||
| 191 | 224 | } |
| 192 | 225 | |
| 193 | 226 | $current_page = wp_stream_filter_input( INPUT_GET, 'page' ); |
| 194 | 227 | |
| 195 | - switch ( $current_page ) { | |
| 196 | - case $this->network_settings_page_slug : | |
| 197 | - $description = __( 'These settings apply to all sites on the network.', 'stream' ); | |
| 198 | - break; | |
| 199 | - case $this->default_settings_page_slug : | |
| 200 | - $description = __( 'These default settings will apply to new sites created on the network. These settings do not alter existing sites.', 'stream' ); | |
| 201 | - break; | |
| 228 | + if ( $this->network_settings_page_slug === $current_page ) { | |
| 229 | + $description = __( 'These settings apply to all sites on the network.', 'stream' ); | |
| 202 | 230 | } |
| 203 | 231 | |
| 204 | 232 | return $description; |
| 205 | 233 | } |
| @@ -206,9 +234,9 @@ | ||
| 206 | 234 | |
| 207 | 235 | /** |
| 208 | 236 | * Adjusts the settings fields displayed in various network admin screens |
| 209 | 237 | * |
| 210 | - * @param $fields | |
| 238 | + * @param array $fields Page settings fields. | |
| 211 | 239 | * |
| 212 | 240 | * @return mixed |
| 213 | 241 | */ |
| 214 | 242 | public function get_network_admin_fields( $fields ) { |
| @@ -218,11 +246,13 @@ | ||
| 218 | 246 | |
| 219 | 247 | $stream_hidden_options = apply_filters( |
| 220 | 248 | 'wp_stream_hidden_option_fields', |
| 221 | 249 | array( |
| 222 | - 'general' => array( | |
| 250 | + 'general' => array( | |
| 251 | + 'records_ttl', | |
| 252 | + ), | |
| 253 | + 'advanced' => array( | |
| 223 | 254 | 'delete_all_records', |
| 224 | - 'records_ttl', | |
| 225 | 255 | ), |
| 226 | 256 | ) |
| 227 | 257 | ); |
| 228 | 258 | |
| @@ -243,9 +273,9 @@ | ||
| 243 | 273 | ), |
| 244 | 274 | ) |
| 245 | 275 | ); |
| 246 | 276 | |
| 247 | - // Remove settings based on context | |
| 277 | + // Remove settings based on context. | |
| 248 | 278 | if ( $this->plugin->settings->network_options_key === $this->plugin->settings->option_key ) { |
| 249 | 279 | $hidden_options = $network_hidden_options; |
| 250 | 280 | } else { |
| 251 | 281 | $hidden_options = $stream_hidden_options; |
| @@ -256,15 +286,15 @@ | ||
| 256 | 286 | if ( ! isset( $hidden_options[ $section_key ] ) ) { |
| 257 | 287 | continue; |
| 258 | 288 | } |
| 259 | 289 | |
| 260 | - if ( in_array( $field['name'], $hidden_options[ $section_key ] ) ) { | |
| 290 | + if ( in_array( $field['name'], $hidden_options[ $section_key ], true ) ) { | |
| 261 | 291 | unset( $fields[ $section_key ]['fields'][ $key ] ); |
| 262 | 292 | } |
| 263 | 293 | } |
| 264 | 294 | } |
| 265 | 295 | |
| 266 | - // Add settings based on context | |
| 296 | + // Add settings based on context. | |
| 267 | 297 | if ( $this->plugin->settings->network_options_key === $this->plugin->settings->option_key ) { |
| 268 | 298 | $new_fields['general']['fields'][] = array( |
| 269 | 299 | 'name' => 'site_access', |
| 270 | 300 | 'title' => __( 'Site Access', 'stream' ), |
| @@ -276,9 +306,9 @@ | ||
| 276 | 306 | |
| 277 | 307 | $fields = array_merge_recursive( $new_fields, $fields ); |
| 278 | 308 | } |
| 279 | 309 | |
| 280 | - // Remove empty settings sections | |
| 310 | + // Remove empty settings sections. | |
| 281 | 311 | foreach ( $fields as $section_key => $section ) { |
| 282 | 312 | if ( empty( $section['fields'] ) ) { |
| 283 | 313 | unset( $fields[ $section_key ] ); |
| 284 | 314 | } |
| @@ -291,8 +321,10 @@ | ||
| 291 | 321 | * Get translations of serialized Stream Network settings |
| 292 | 322 | * |
| 293 | 323 | * @filter wp_stream_serialized_labels |
| 294 | 324 | * |
| 325 | + * @param array $labels Setting labels. | |
| 326 | + * | |
| 295 | 327 | * @return array Multidimensional array of fields |
| 296 | 328 | */ |
| 297 | 329 | public function get_settings_translations( $labels ) { |
| 298 | 330 | $network_key = $this->plugin->settings->network_options_key; |
| @@ -313,48 +345,44 @@ | ||
| 313 | 345 | /** |
| 314 | 346 | * Wrapper for the settings API to work on the network settings page |
| 315 | 347 | */ |
| 316 | 348 | public function network_options_action() { |
| 317 | - $allowed_referers = array( | |
| 318 | - $this->network_settings_page_slug, | |
| 319 | - $this->default_settings_page_slug, | |
| 320 | - ); | |
| 321 | 349 | |
| 322 | - if ( ! isset( $_GET['action'] ) || ! in_array( $_GET['action'], $allowed_referers ) ) { | |
| 350 | + // Check the nonce. | |
| 351 | + if ( empty( $_POST['_wpnonce'] ) || ! wp_verify_nonce( $_POST['_wpnonce'], sprintf( '%s-options', $this->network_settings_option ) ) ) { | |
| 323 | 352 | return; |
| 324 | 353 | } |
| 325 | 354 | |
| 326 | - // @codingStandardsIgnoreStart | |
| 327 | - $options = isset( $_POST['option_page'] ) ? explode( ',', stripslashes( $_POST['option_page'] ) ) : null; | |
| 328 | - // @codingStandardsIgnoreEnd | |
| 355 | + // Check the user capability. | |
| 356 | + if ( ! current_user_can( $this->plugin->admin->settings_cap ) ) { | |
| 357 | + return; | |
| 358 | + } | |
| 329 | 359 | |
| 330 | - if ( $options ) { | |
| 360 | + // Check the action. | |
| 361 | + if ( ! isset( $_GET['action'] ) || $this->network_settings_page_slug !== $_GET['action'] ) { | |
| 362 | + return; | |
| 363 | + } | |
| 331 | 364 | |
| 332 | - foreach ( $options as $option ) { | |
| 333 | - $option = trim( $option ); | |
| 334 | - $value = null; | |
| 335 | - $sections = $this->plugin->settings->get_fields(); | |
| 365 | + $option = ! empty( $_POST['option_page'] ) ? $_POST['option_page'] : false; | |
| 336 | 366 | |
| 337 | - foreach ( $sections as $section_name => $section ) { | |
| 338 | - foreach ( $section['fields'] as $field_idx => $field ) { | |
| 339 | - $option_key = $section_name . '_' . $field['name']; | |
| 367 | + if ( $option && $this->network_settings_option === $option ) { | |
| 340 | 368 | |
| 341 | - // @codingStandardsIgnoreStart | |
| 342 | - if ( isset( $_POST[ $option ][ $option_key ] ) ) { | |
| 343 | - $value[ $option_key ] = $_POST[ $option ][ $option_key ]; | |
| 344 | - } else { | |
| 345 | - $value[ $option_key ] = false; | |
| 346 | - } | |
| 347 | - // @codingStandardsIgnoreEnd | |
| 369 | + $value = array(); | |
| 370 | + $sections = $this->plugin->settings->get_fields(); | |
| 371 | + | |
| 372 | + foreach ( $sections as $section_name => $section ) { | |
| 373 | + foreach ( $section['fields'] as $field_idx => $field ) { | |
| 374 | + $option_key = $section_name . '_' . $field['name']; | |
| 375 | + | |
| 376 | + if ( isset( $_POST[ $option ][ $option_key ] ) ) { | |
| 377 | + $value[ $option_key ] = $this->plugin->settings->sanitize_setting_by_field_type( $_POST[ $option ][ $option_key ], $field['type'] ); | |
| 378 | + } else { | |
| 379 | + $value[ $option_key ] = false; | |
| 348 | 380 | } |
| 349 | 381 | } |
| 382 | + } | |
| 350 | 383 | |
| 351 | - if ( ! is_array( $value ) ) { | |
| 352 | - $value = trim( $value ); | |
| 353 | - } | |
| 354 | - | |
| 355 | - update_site_option( $option, $value ); | |
| 356 | - } | |
| 384 | + update_site_option( $this->network_settings_option, $value ); | |
| 357 | 385 | } |
| 358 | 386 | |
| 359 | 387 | if ( ! count( get_settings_errors() ) ) { |
| 360 | 388 | add_settings_error( 'general', 'settings_updated', __( 'Settings saved.', 'stream' ), 'updated' ); |
| @@ -363,9 +391,9 @@ | ||
| 363 | 391 | set_transient( 'settings_errors', get_settings_errors(), 30 ); |
| 364 | 392 | |
| 365 | 393 | $go_back = add_query_arg( 'settings-updated', 'true', wp_get_referer() ); |
| 366 | 394 | |
| 367 | - wp_redirect( $go_back ); | |
| 395 | + wp_safe_redirect( $go_back ); | |
| 368 | 396 | |
| 369 | 397 | exit; |
| 370 | 398 | } |
| 371 | 399 | |
| @@ -373,9 +401,9 @@ | ||
| 373 | 401 | * Add the Site filter to the Network records screen |
| 374 | 402 | * |
| 375 | 403 | * @filter wp_stream_list_table_filters |
| 376 | 404 | * |
| 377 | - * @param $filters | |
| 405 | + * @param array $filters Filters. | |
| 378 | 406 | * |
| 379 | 407 | * @return array |
| 380 | 408 | */ |
| 381 | 409 | public function list_table_filters( $filters ) { |
| @@ -384,9 +412,9 @@ | ||
| 384 | 412 | } |
| 385 | 413 | |
| 386 | 414 | $blogs = array(); |
| 387 | 415 | |
| 388 | - // Display network blog as the first option | |
| 416 | + // Display network blog as the first option. | |
| 389 | 417 | $network_blog = $this->get_network_blog(); |
| 390 | 418 | |
| 391 | 419 | $blogs[ $network_blog->blog_id ] = array( |
| 392 | 420 | 'label' => $network_blog->blogname, |
| @@ -392,13 +420,13 @@ | ||
| 392 | 420 | 'label' => $network_blog->blogname, |
| 393 | 421 | 'disabled' => '', |
| 394 | 422 | ); |
| 395 | 423 | |
| 396 | - // add all sites | |
| 397 | - foreach ( wp_get_sites() as $blog ) { | |
| 398 | - $blog_data = get_blog_details( $blog ); | |
| 424 | + // Add all sites. | |
| 425 | + foreach ( wp_stream_get_sites() as $blog ) { | |
| 426 | + $blog_data = get_blog_details( $blog->blog_id ); | |
| 399 | 427 | |
| 400 | - $blogs[ $blog['blog_id'] ] = array( | |
| 428 | + $blogs[ $blog->blog_id ] = array( | |
| 401 | 429 | 'label' => $blog_data->blogname, |
| 402 | 430 | 'disabled' => '', |
| 403 | 431 | ); |
| 404 | 432 | } |
| @@ -413,9 +441,9 @@ | ||
| 413 | 441 | |
| 414 | 442 | /** |
| 415 | 443 | * Add the Site toggle to screen options in network admin |
| 416 | 444 | * |
| 417 | - * @param $filters | |
| 445 | + * @param array $filters Filters. | |
| 418 | 446 | * |
| 419 | 447 | * @return array |
| 420 | 448 | */ |
| 421 | 449 | public function toggle_filters( $filters ) { |
| @@ -428,9 +456,9 @@ | ||
| 428 | 456 | |
| 429 | 457 | /** |
| 430 | 458 | * Add the network suffix to the $screen_id when in the network admin |
| 431 | 459 | * |
| 432 | - * @param $screen_id | |
| 460 | + * @param int $screen_id Screen ID. | |
| 433 | 461 | * |
| 434 | 462 | * @return string |
| 435 | 463 | */ |
| 436 | 464 | public function list_table_screen_id( $screen_id ) { |
| @@ -445,8 +473,10 @@ | ||
| 445 | 473 | |
| 446 | 474 | /** |
| 447 | 475 | * Set blog_id for network admin activity |
| 448 | 476 | * |
| 477 | + * @param int $blog_id Blog ID. | |
| 478 | + * | |
| 449 | 479 | * @return int |
| 450 | 480 | */ |
| 451 | 481 | public function blog_id_logged( $blog_id ) { |
| 452 | 482 | return is_network_admin() ? 0 : $blog_id; |
| @@ -456,9 +486,9 @@ | ||
| 456 | 486 | * Customize query args on multisite installs |
| 457 | 487 | * |
| 458 | 488 | * @filter wp_stream_query_args |
| 459 | 489 | * |
| 460 | - * @param array $args | |
| 490 | + * @param array $args Site arguments. | |
| 461 | 491 | * |
| 462 | 492 | * @return array |
| 463 | 493 | */ |
| 464 | 494 | public function network_query_args( $args ) { |
| @@ -472,15 +502,16 @@ | ||
| 472 | 502 | * Add site count to the page title in the network admin |
| 473 | 503 | * |
| 474 | 504 | * @filter wp_stream_admin_page_title |
| 475 | 505 | * |
| 476 | - * @param string $page_title | |
| 506 | + * @param string $page_title Page title. | |
| 477 | 507 | * |
| 478 | 508 | * @return string |
| 479 | 509 | */ |
| 480 | 510 | public function network_admin_page_title( $page_title ) { |
| 481 | 511 | if ( is_network_admin() ) { |
| 482 | - $site_count = sprintf( _n( '1 site', '%s sites', get_blog_count(), 'stream' ), number_format( get_blog_count() ) ); | |
| 512 | + /* translators: %d: number of sites on the network (e.g. "42") */ | |
| 513 | + $site_count = sprintf( _n( '%d site', '%d sites', get_blog_count(), 'stream' ), number_format( get_blog_count() ) ); | |
| 483 | 514 | $page_title = sprintf( '%s (%s)', $page_title, $site_count ); |
| 484 | 515 | } |
| 485 | 516 | |
| 486 | 517 | return $page_title; |
| @@ -488,14 +519,14 @@ | ||
| 488 | 519 | |
| 489 | 520 | /** |
| 490 | 521 | * Add the Site column to the network stream records |
| 491 | 522 | * |
| 492 | - * @param $columns | |
| 523 | + * @param array $columns Columns data. | |
| 493 | 524 | * |
| 494 | 525 | * @return mixed |
| 495 | 526 | */ |
| 496 | 527 | public function network_admin_columns( $columns ) { |
| 497 | - if ( is_network_admin() ) { | |
| 528 | + if ( is_network_admin() || $this->ajax_network_admin() ) { | |
| 498 | 529 | $columns = array_merge( |
| 499 | 530 | array_slice( $columns, 0, -1 ), |
| 500 | 531 | array( |
| 501 | 532 | 'blog_id' => esc_html__( 'Site', 'stream' ), |
| @@ -509,9 +540,9 @@ | ||
| 509 | 540 | |
| 510 | 541 | /** |
| 511 | 542 | * Prevent the Blogs connector from loading when not in Network Admin |
| 512 | 543 | * |
| 513 | - * @param $connectors | |
| 544 | + * @param array $connectors Connectors. | |
| 514 | 545 | * |
| 515 | 546 | * @return mixed |
| 516 | 547 | */ |
| 517 | 548 | public function hide_blogs_connector( $connectors ) { |