Passed
Push — master ( ac9aa8...8b4016 )
by
unknown
10:20
created
includes/popular-posts/class-popular-posts.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -521,13 +521,13 @@  discard block
 block discarded – undo
521 521
 						continue;
522 522
 					}
523 523
 
524
-					if ( ! empty( $atts[ $atts_key ] ) ) {
525
-						if ( is_bool( $atts[ $atts_key ] ) || 'on' === $atts[ $atts_key ] ) {
524
+					if ( ! empty( $atts[$atts_key] ) ) {
525
+						if ( is_bool( $atts[$atts_key] ) || 'on' === $atts[$atts_key] ) {
526 526
 							continue;
527 527
 						}
528 528
 						if ( 'size' === $style_key ) {
529
-							$style_key         = 'font-size';
530
-							$atts[ $atts_key ] .= 'px';
529
+							$style_key = 'font-size';
530
+							$atts[$atts_key] .= 'px';
531 531
 						}
532 532
 						if ( 'background' === $style_key || 'background' === $element && 'color' === $style_key ) {
533 533
 							$style_key = 'background-color';
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
 						if ( 'border' === $element || 'border' === $style_key ) {
536 536
 							$style_key = 'border-color';
537 537
 						}
538
-						$style_css .= $style_key . ':' . $atts[ $atts_key ] . ';';
538
+						$style_css .= $style_key . ':' . $atts[$atts_key] . ';';
539 539
 					}
540 540
 				}
541 541
 			}
@@ -558,11 +558,11 @@  discard block
 block discarded – undo
558 558
 
559 559
 		$class = get_called_class();
560 560
 
561
-		if ( ! isset( self::$instances[ $class ] ) ) {
562
-			self::$instances[ $class ] = new $class;
561
+		if ( ! isset( self::$instances[$class] ) ) {
562
+			self::$instances[$class] = new $class;
563 563
 		}
564 564
 
565
-		return self::$instances[ $class ];
565
+		return self::$instances[$class];
566 566
 
567 567
 	}
568 568
 
@@ -723,7 +723,7 @@  discard block
 block discarded – undo
723 723
 	public function get_themes_styles_for_output() {
724 724
 
725 725
 		$stored_styles = $this->get_theme_props()->get_theme_stored_styles();
726
-		$themes        = ! empty( $stored_styles[ $this->type ] ) && is_array( $stored_styles[ $this->type ] ) ? $stored_styles[ $this->type ] : array();
726
+		$themes        = ! empty( $stored_styles[$this->type] ) && is_array( $stored_styles[$this->type] ) ? $stored_styles[$this->type] : array();
727 727
 
728 728
 		return $themes;
729 729
 
Please login to merge, or discard this patch.
includes/admin/sharedcount.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 		$this->save_progress( $page, $this->more_pages );
156 156
 
157 157
 		if ( $this->more_pages ) {
158
-			$page ++;
158
+			$page++;
159 159
 			$this->schedule_next_page( $page );
160 160
 		}
161 161
 
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 	 */
193 193
 	public function get_post_urls( $page = 1 ) {
194 194
 
195
-		$posts_args  = array(
195
+		$posts_args = array(
196 196
 			'posts_per_page'   => 100, // Don't try to load more than 500 posts at once.
197 197
 			'fields'           => 'ids', // Load just the ids.
198 198
 			'paged'            => $page,
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 			while ( $posts_query->have_posts() ) {
206 206
 				$posts_query->the_post();
207 207
 
208
-				$urls[ get_the_ID() ] = get_permalink( get_the_ID() );
208
+				$urls[get_the_ID()] = get_permalink( get_the_ID() );
209 209
 			}
210 210
 		}
211 211
 
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 
232 232
 		$urls_as_keys = array();
233 233
 		foreach ( $urls as $id => $url ) {
234
-			$urls_as_keys[ $url ] = $id;
234
+			$urls_as_keys[$url] = $id;
235 235
 		}
236 236
 
237 237
 		return $urls_as_keys;
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
 	public function store_bulk_data( $bulk_data, $urls_as_keys ) {
370 370
 		if ( ! empty( $bulk_data['data'] ) && is_array( $bulk_data['data'] ) ) {
371 371
 			foreach ( $bulk_data['data'] as $url => $values ) {
372
-				$post_id = array_key_exists( $url, $urls_as_keys ) ? $urls_as_keys[ $url ] : false;
372
+				$post_id = array_key_exists( $url, $urls_as_keys ) ? $urls_as_keys[$url] : false;
373 373
 
374 374
 				if ( $post_id ) {
375 375
 					$this->store_post_counts( $post_id, $values );
@@ -606,7 +606,7 @@  discard block
 block discarded – undo
606 606
 	 */
607 607
 	public static function query_popular_posts( $count = 5 ) {
608 608
 
609
-		$popular_posts_args  = array(
609
+		$popular_posts_args = array(
610 610
 			'posts_per_page' => $count,
611 611
 			'meta_value'     => 'monsterinsights_sharedcount_total',
612 612
 			'orderby'        => 'meta_value_num',
@@ -618,7 +618,7 @@  discard block
 block discarded – undo
618 618
 		if ( $popular_posts_query->have_posts() ) {
619 619
 			while ( $popular_posts_query->have_posts() ) {
620 620
 				$popular_posts_query->the_post();
621
-				$popular_posts[ get_the_ID() ] = array(
621
+				$popular_posts[get_the_ID()] = array(
622 622
 					'post_title' => get_the_title(),
623 623
 					'permalink'  => get_permalink(),
624 624
 					'thumbnail'  => get_the_post_thumbnail_url( get_the_ID(), 'medium' ),
Please login to merge, or discard this patch.
lite/includes/popular-posts/class-popular-posts-cache.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -63,14 +63,14 @@  discard block
 block discarded – undo
63 63
 		$cached_data        = get_option( $this->get_cache_key(), array() );
64 64
 		$args_key           = $this->get_args_key( $args ); // Generate an unique key based on the instance settings.
65 65
 
66
-		if ( isset( $cached_data[ $args_key ] ) && isset( $cached_data[ $args_key ]['saved_at'] ) ) {
67
-			$time_since = time() - $cached_data[ $args_key ]['saved_at'];
66
+		if ( isset( $cached_data[$args_key] ) && isset( $cached_data[$args_key]['saved_at'] ) ) {
67
+			$time_since = time() - $cached_data[$args_key]['saved_at'];
68 68
 
69 69
 			if ( $time_since < intval( $cache_refresh_days ) * DAY_IN_SECONDS ) {
70
-				return $cached_data[ $args_key ]['posts'];
70
+				return $cached_data[$args_key]['posts'];
71 71
 			} else {
72 72
 				// It's expired so let's delete it.
73
-				unset( $cached_data[ $args_key ] );
73
+				unset( $cached_data[$args_key] );
74 74
 				update_option( $this->get_cache_key(), $cached_data );
75 75
 			}
76 76
 		}
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 		$args_key    = md5( wp_json_encode( $args ) ); // Generate an unique key based on the instance settings.
113 113
 		$cached_data = get_option( $this->get_cache_key(), array() );
114 114
 
115
-		$cached_data[ $args_key ] = array(
115
+		$cached_data[$args_key] = array(
116 116
 			'saved_at' => time(),
117 117
 			'posts'    => $posts,
118 118
 		);
Please login to merge, or discard this patch.
lite/includes/popular-posts/class-popular-posts-ajax.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 		register_rest_route( 'monsterinsights/v1', '/popular-posts/themes/(?P<type>[a-zA-Z0-9-]+)', array(
37 37
 			'methods'             => 'GET',
38 38
 			'callback'            => array( $this, 'get_gutenberg_themes' ),
39
-			'permission_callback' => function () {
39
+			'permission_callback' => function() {
40 40
 				return current_user_can( 'edit_posts' );
41 41
 			},
42 42
 			'args'                => array(
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 		register_rest_route( 'monsterinsights/v1', '/terms/(?P<slug>[a-zA-Z0-9-_]+)', array(
48 48
 			'methods'             => 'GET',
49 49
 			'callback'            => array( $this, 'get_taxonomy_terms' ),
50
-			'permission_callback' => function () {
50
+			'permission_callback' => function() {
51 51
 				return current_user_can( 'edit_posts' );
52 52
 			},
53 53
 			'args'                => array(
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 		register_rest_route( 'monsterinsights/v1', '/taxonomy/(?P<slug>[a-zA-Z0-9-_]+)', array(
59 59
 			'methods'             => 'GET',
60 60
 			'callback'            => array( $this, 'get_taxonomy' ),
61
-			'permission_callback' => function () {
61
+			'permission_callback' => function() {
62 62
 				return current_user_can( 'edit_posts' );
63 63
 			},
64 64
 			'args'                => array(
@@ -114,8 +114,8 @@  discard block
 block discarded – undo
114 114
 		$themes       = $this->get_themes( $type, $theme );
115 115
 		$themes_array = $themes->themes;
116 116
 
117
-		if ( isset( $themes_array[ $theme ] ) && $styled ) {
118
-			$themes_array[ $theme ] = $themes->get_theme();
117
+		if ( isset( $themes_array[$theme] ) && $styled ) {
118
+			$themes_array[$theme] = $themes->get_theme();
119 119
 		}
120 120
 
121 121
 		$response = array(
Please login to merge, or discard this patch.
lite/includes/popular-posts/class-popular-posts-widget.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 
102 102
 		$display_count = 0;
103 103
 		foreach ( $posts as $post ) {
104
-			$display_count ++;
104
+			$display_count++;
105 105
 			if ( $display_count > $limit ) {
106 106
 				break;
107 107
 			}
@@ -118,12 +118,12 @@  discard block
 block discarded – undo
118 118
 				$html .= '<span class="monsterinsights-widget-popular-posts-label" ' . $this->get_element_style( $theme, 'label', $atts ) . '>' . $label_text . '</span>';
119 119
 			}
120 120
 			$html .= '<span class="monsterinsights-widget-popular-posts-title" ' . $this->get_element_style( $theme, 'title', $atts ) . '>' . $post['title'] . '</span>';
121
-			$html .= '</div>';// monsterinsights-widget-popular-posts-text.
121
+			$html .= '</div>'; // monsterinsights-widget-popular-posts-text.
122 122
 			$html .= '</a>';
123 123
 			$html .= '</li>';
124 124
 		}
125 125
 
126
-		$html .= '</ul></div><p></p>';// Main div.
126
+		$html .= '</ul></div><p></p>'; // Main div.
127 127
 
128 128
 		return $html;
129 129
 
Please login to merge, or discard this patch.
lite/includes/popular-posts/class-popular-posts-inline.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 
99 99
 		$display_count = 0;
100 100
 		foreach ( $posts as $post ) {
101
-			$display_count ++;
101
+			$display_count++;
102 102
 			if ( $display_count > $limit ) {
103 103
 				break;
104 104
 			}
@@ -108,8 +108,8 @@  discard block
 block discarded – undo
108 108
 			$html .= '</div>';
109 109
 		}
110 110
 
111
-		$html .= '</div>';// Text div.
112
-		$html .= '</div><p></p>';// Main div.
111
+		$html .= '</div>'; // Text div.
112
+		$html .= '</div><p></p>'; // Main div.
113 113
 
114 114
 		return $html;
115 115
 
@@ -217,12 +217,12 @@  discard block
 block discarded – undo
217 217
 			$count = 0;
218 218
 
219 219
 			foreach ( $words as $index => $word ) {
220
-				$count ++;
220
+				$count++;
221 221
 				if ( $count > $after_count ) {
222 222
 					$p_index = strpos( $word, '</p>' );
223 223
 					// Make sure the paragraph tag is not wrapped in another element like a blockquote.
224 224
 					if ( false !== $p_index && false === strpos( $word, '</p></' ) ) {
225
-						$words[ $index ] = substr_replace( $word, $this->shortcode_output( array() ), $p_index + 4, 0 );
225
+						$words[$index] = substr_replace( $word, $this->shortcode_output( array() ), $p_index + 4, 0 );
226 226
 						$this->posts     = array();
227 227
 						break;
228 228
 					}
Please login to merge, or discard this patch.
lite/includes/popular-posts/class-popular-posts-widget-sidebar.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -115,8 +115,8 @@  discard block
 block discarded – undo
115 115
 		);
116 116
 
117 117
 		foreach ( $this->conditional_options as $key => $default ) {
118
-			if ( ! empty( $instance[ $key ] ) ) {
119
-				$atts[ $key ] = $instance[ $key ];
118
+			if ( ! empty( $instance[$key] ) ) {
119
+				$atts[$key] = $instance[$key];
120 120
 			}
121 121
 		}
122 122
 
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 		$theme  = $themes->get_theme();
150 150
 
151 151
 		foreach ( $this->conditional_options as $key => $obj ) {
152
-			$new_instance = $this->maybe_remove_option( ! empty( $theme['styles'][ $obj[0] ][ $obj[1] ] ), $key, $new_instance );
152
+			$new_instance = $this->maybe_remove_option( ! empty( $theme['styles'][$obj[0]][$obj[1]] ), $key, $new_instance );
153 153
 		}
154 154
 
155 155
 		return $new_instance;
@@ -172,12 +172,12 @@  discard block
 block discarded – undo
172 172
 			'meta_comments',
173 173
 		);
174 174
 
175
-		if ( $is_used && ! isset( $instance[ $key ] ) && in_array( $key, $checkboxes ) ) {
176
-			$instance[ $key ] = 'off';
177
-		} elseif ( ! $is_used && isset( $instance[ $key ] ) ) {
178
-			unset( $instance[ $key ] );
179
-		} elseif ( $is_used && isset( $instance[ $key ] ) ) {
180
-			$instance[ $key ] = wp_strip_all_tags( $instance[ $key ] );
175
+		if ( $is_used && ! isset( $instance[$key] ) && in_array( $key, $checkboxes ) ) {
176
+			$instance[$key] = 'off';
177
+		} elseif ( ! $is_used && isset( $instance[$key] ) ) {
178
+			unset( $instance[$key] );
179
+		} elseif ( $is_used && isset( $instance[$key] ) ) {
180
+			$instance[$key] = wp_strip_all_tags( $instance[$key] );
181 181
 		}
182 182
 
183 183
 		return $instance;
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
 			<input type="text"
325 325
 				   id="<?php echo esc_attr( $this->get_field_id( $name ) ); ?>"
326 326
 				   name="<?php echo esc_attr( $this->get_field_name( $name ) ); ?>"
327
-				   value="<?php echo esc_attr( $instance[ $name ] ); ?>"
327
+				   value="<?php echo esc_attr( $instance[$name] ); ?>"
328 328
 				   class="widefat monsterinsights-color-field"/>
329 329
 		</p>
330 330
 		<?php
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
 			<input type="text"
347 347
 				   id="<?php echo esc_attr( $this->get_field_id( $name ) ); ?>"
348 348
 				   name="<?php echo esc_attr( $this->get_field_name( $name ) ); ?>"
349
-				   value="<?php echo esc_attr( $instance[ $name ] ); ?>" class="widefat"/>
349
+				   value="<?php echo esc_attr( $instance[$name] ); ?>" class="widefat"/>
350 350
 		</p>
351 351
 		<?php
352 352
 	}
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
 			<select id="<?php echo esc_attr( $this->get_field_id( $name ) ); ?>"
369 369
 					name="<?php echo esc_attr( $this->get_field_name( $name ) ); ?>" class="widefat">
370 370
 				<?php foreach ( $range as $font_size ) { ?>
371
-					<option value="<?php echo absint( $font_size ); ?>" <?php selected( $instance[ $name ], $font_size ); ?>><?php printf( esc_html_x( '%dpx', 'google-analytics-for-wordpress' ), $font_size ); ?></option>
371
+					<option value="<?php echo absint( $font_size ); ?>" <?php selected( $instance[$name], $font_size ); ?>><?php printf( esc_html_x( '%dpx', 'google-analytics-for-wordpress' ), $font_size ); ?></option>
372 372
 				<?php } ?>
373 373
 			</select>
374 374
 		</p>
@@ -382,8 +382,8 @@  discard block
 block discarded – undo
382 382
 	 */
383 383
 	public function prepare_defaults_from_theme( $theme ) {
384 384
 		foreach ( $this->conditional_options as $key => $obj ) {
385
-			if ( ! empty( $theme['styles'][ $obj[0] ][ $obj[1] ] ) ) {
386
-				$this->defaults[ $key ] = $theme['styles'][ $obj[0] ][ $obj[1] ];
385
+			if ( ! empty( $theme['styles'][$obj[0]][$obj[1]] ) ) {
386
+				$this->defaults[$key] = $theme['styles'][$obj[0]][$obj[1]];
387 387
 			}
388 388
 		}
389 389
 	}
Please login to merge, or discard this patch.
includes/admin/notification-event-runner.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 			$time = time();
92 92
 		}
93 93
 
94
-		$this->last_run[ $notification_id ] = $time;
94
+		$this->last_run[$notification_id] = $time;
95 95
 		$this->changed                      = true;
96 96
 	}
97 97
 
@@ -124,12 +124,12 @@  discard block
 block discarded – undo
124 124
 			 *
125 125
 			 * @var MonsterInsights_Notification_Event $notification
126 126
 			 */
127
-			if ( empty( $last_runs[ $notification->notification_id ] ) ) {
127
+			if ( empty( $last_runs[$notification->notification_id] ) ) {
128 128
 				// If the notification never ran, save current time to show it after the interval.
129 129
 				$this->update_last_run( $notification->notification_id );
130 130
 			} else {
131 131
 				// Has run before so let's check if enough days passed since the last run.
132
-				$time_since = $last_runs[ $notification->notification_id ] + $notification->notification_interval * DAY_IN_SECONDS;
132
+				$time_since = $last_runs[$notification->notification_id] + $notification->notification_interval * DAY_IN_SECONDS;
133 133
 				$time_now   = time();
134 134
 				if ( $time_since < $time_now ) {
135 135
 					// Interval passed since it ran so let's add this one.
@@ -164,8 +164,8 @@  discard block
 block discarded – undo
164 164
 	public function register_notification( $notification ) {
165 165
 
166 166
 		$notification_id = isset( $notification->notification_id ) ? $notification->notification_id : false;
167
-		if ( ! empty( $notification_id ) && ! isset( self::$notifications[ $notification_id ] ) ) {
168
-			self::$notifications[ $notification_id ] = $notification;
167
+		if ( ! empty( $notification_id ) && ! isset( self::$notifications[$notification_id] ) ) {
168
+			self::$notifications[$notification_id] = $notification;
169 169
 		}
170 170
 
171 171
 	}
Please login to merge, or discard this patch.
includes/admin/notifications/notification-audience.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@
 block discarded – undo
79 79
 					$translations  = wp_get_available_translations();
80 80
 
81 81
 					if ( is_array( $translations ) && ! empty( $translations ) ) {
82
-						$site_iso = isset( $translations[ $site_language ]['iso'] ) ? $translations[ $site_language ]['iso'] : array(); // keep empty array, because site language has no iso setup for en_US language
82
+						$site_iso = isset( $translations[$site_language]['iso'] ) ? $translations[$site_language]['iso'] : array(); // keep empty array, because site language has no iso setup for en_US language
83 83
 
84 84
 						if ( is_array( $site_iso ) && ! in_array( $country['iso'], $site_iso ) ) {
85 85
 							$data['country']    = $country['name'];
Please login to merge, or discard this patch.