PluginProbe
Stream – Activity Log & Audit Trail / 3.4.2
Stream – Activity Log & Audit Trail v3.4.2
4.4.0 4.3.0 4.2.2 4.2.1 trunk 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.1 3.1.1 3.10.0 3.2.0 3.2.1 3.2.2 3.2.3 All 50 releases
← All changes | classes/class-network.php +16 -15 3.2.03.4.2 View file →
@@ -3,8 +3,9 @@
3 3
4 4 class Network {
5 5 /**
6 6 * Hold Plugin class
7 + *
7 8 * @var Plugin
8 9 */
9 10 public $plugin;
10 11
@@ -11,9 +12,9 @@
11 12 public $network_settings_page_slug = 'wp_stream_network_settings';
12 13
13 14 public $default_settings_page_slug = 'wp_stream_default_settings';
14 15
15 - function __construct( $plugin ) {
16 + public function __construct( $plugin ) {
16 17 $this->plugin = $plugin;
17 18
18 19 // Always add default site_id/blog_id params when multisite
19 20 if ( is_multisite() ) {
@@ -77,9 +78,9 @@
77 78 *
78 79 * @return object
79 80 */
80 81 public function get_network_blog() {
81 - $blog = new \stdClass;
82 + $blog = new \stdClass();
82 83 $blog->blog_id = 0;
83 84 $blog->blogname = esc_html__( 'Network Admin', 'stream' );
84 85
85 86 return $blog;
@@ -90,13 +91,9 @@
90 91 *
91 92 * @return bool
92 93 */
93 94 public function is_network_activated() {
94 - if ( ! function_exists( 'is_plugin_active_for_network' ) ) {
95 - require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
96 - }
97 -
98 - return is_plugin_active_for_network( $this->plugin->locations['plugin'] );
95 + return $this->plugin->is_network_activated();
99 96 }
100 97
101 98 /**
102 99 * Adds Stream to the admin bar under the "My Sites > Network Admin" menu
@@ -177,9 +174,14 @@
177 174 */
178 175 public function settings_form_action( $action ) {
179 176 if ( is_network_admin() ) {
180 177 $current_page = wp_stream_filter_input( INPUT_GET, 'page' );
181 - $action = add_query_arg( array( 'action' => $current_page ), 'edit.php' );
178 + $action = add_query_arg(
179 + array(
180 + 'action' => $current_page,
181 + ),
182 + 'edit.php'
183 + );
182 184 }
183 185
184 186 return $action;
185 187 }
@@ -198,12 +200,12 @@
198 200
199 201 $current_page = wp_stream_filter_input( INPUT_GET, 'page' );
200 202
201 203 switch ( $current_page ) {
202 - case $this->network_settings_page_slug :
204 + case $this->network_settings_page_slug:
203 205 $description = __( 'These settings apply to all sites on the network.', 'stream' );
204 206 break;
205 - case $this->default_settings_page_slug :
207 + case $this->default_settings_page_slug:
206 208 $description = __( 'These default settings will apply to new sites created on the network. These settings do not alter existing sites.', 'stream' );
207 209 break;
208 210 }
209 211
@@ -224,9 +226,9 @@
224 226
225 227 $stream_hidden_options = apply_filters(
226 228 'wp_stream_hidden_option_fields',
227 229 array(
228 - 'general' => array(
230 + 'general' => array(
229 231 'records_ttl',
230 232 ),
231 233 'advanced' => array(
232 234 'delete_all_records',
@@ -326,15 +328,13 @@
326 328 $this->network_settings_page_slug,
327 329 $this->default_settings_page_slug,
328 330 );
329 331
330 - if ( ! isset( $_GET['action'] ) || ! in_array( $_GET['action'], $allowed_referers, true ) ) {
332 + if ( ! isset( $_GET['action'] ) || ! in_array( $_GET['action'], $allowed_referers, true ) ) { // CSRF okay
331 333 return;
332 334 }
333 335
334 - // @codingStandardsIgnoreStart
335 - $options = isset( $_POST['option_page'] ) ? explode( ',', stripslashes( $_POST['option_page'] ) ) : null;
336 - // @codingStandardsIgnoreEnd
336 + $options = isset( $_POST['option_page'] ) ? explode( ',', stripslashes( $_POST['option_page'] ) ) : null; // CSRF okay
337 337
338 338 if ( $options ) {
339 339
340 340 foreach ( $options as $option ) {
@@ -486,8 +486,9 @@
486 486 * @return string
487 487 */
488 488 public function network_admin_page_title( $page_title ) {
489 489 if ( is_network_admin() ) {
490 + // translators: Placeholder refers to a number of sites on the network (e.g. "42")
490 491 $site_count = sprintf( _n( '%d site', '%d sites', get_blog_count(), 'stream' ), number_format( get_blog_count() ) );
491 492 $page_title = sprintf( '%s (%s)', $page_title, $site_count );
492 493 }
493 494