@@ -101,7 +101,7 @@ discard block |
||
| 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 |
||
| 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 | |
@@ -98,7 +98,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 | } |
@@ -115,8 +115,8 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | } |
@@ -91,7 +91,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 | } |
@@ -79,7 +79,7 @@ |
||
| 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']; |
@@ -141,7 +141,8 @@ discard block |
||
| 141 | 141 | * @since {VERSION} |
| 142 | 142 | * |
| 143 | 143 | */ |
| 144 | - public function verify( $notifications ) { // phpcs:ignore Generic.Metrics.CyclomaticComplexity.TooHigh |
|
| 144 | + public function verify( $notifications ) { |
|
| 145 | +// phpcs:ignore Generic.Metrics.CyclomaticComplexity.TooHigh |
|
| 145 | 146 | |
| 146 | 147 | $data = array(); |
| 147 | 148 | |
@@ -462,7 +463,8 @@ discard block |
||
| 462 | 463 | // Remove notification and add in dismissed array. |
| 463 | 464 | if ( is_array( $option[ $type ] ) && ! empty( $option[ $type ] ) ) { |
| 464 | 465 | foreach ( $option[ $type ] as $key => $notification ) { |
| 465 | - if ( $notification['id'] == $id ) { // phpcs:ignore WordPress.PHP.StrictComparisons |
|
| 466 | + if ( $notification['id'] == $id ) { |
|
| 467 | +// phpcs:ignore WordPress.PHP.StrictComparisons |
|
| 466 | 468 | // Add notification to dismissed array. |
| 467 | 469 | array_unshift( $option['dismissed'], $notification ); |
| 468 | 470 | // Remove notification from feed or events. |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | ( ! empty( $notification['end'] ) && time() > strtotime( $notification['end'] ) ) || |
| 233 | 233 | ( ! empty( $notification['type'] ) && ! in_array( $license_type, $notification['type'] ) ) |
| 234 | 234 | ) { |
| 235 | - unset( $notifications[ $key ] ); |
|
| 235 | + unset( $notifications[$key] ); |
|
| 236 | 236 | } |
| 237 | 237 | } |
| 238 | 238 | |
@@ -289,8 +289,8 @@ discard block |
||
| 289 | 289 | |
| 290 | 290 | foreach ( $notifications as $key => $notification ) { |
| 291 | 291 | if ( ! empty( $notification['content'] ) ) { |
| 292 | - $notifications[ $key ]['content'] = wpautop( $notification['content'] ); |
|
| 293 | - $notifications[ $key ]['content'] = apply_filters( 'monsterinsights_notification_content_display', $notifications[ $key ]['content'] ); |
|
| 292 | + $notifications[$key]['content'] = wpautop( $notification['content'] ); |
|
| 293 | + $notifications[$key]['content'] = apply_filters( 'monsterinsights_notification_content_display', $notifications[$key]['content'] ); |
|
| 294 | 294 | } |
| 295 | 295 | } |
| 296 | 296 | |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | |
| 317 | 317 | // Translators: Readable time to display |
| 318 | 318 | $modified_start_time = sprintf( __( '%1$s ago', 'google-analytics-for-wordpress' ), human_time_diff( strtotime( $notification['start'] ), current_time( 'timestamp' ) ) ); |
| 319 | - $notifications[ $key ]['start'] = $modified_start_time; |
|
| 319 | + $notifications[$key]['start'] = $modified_start_time; |
|
| 320 | 320 | } |
| 321 | 321 | |
| 322 | 322 | return $notifications; |
@@ -446,13 +446,13 @@ discard block |
||
| 446 | 446 | if ( is_array( $option['feed'] ) && ! empty( $option['feed'] ) ) { |
| 447 | 447 | foreach ( $option['feed'] as $key => $notification ) { |
| 448 | 448 | array_unshift( $option['dismissed'], $notification ); |
| 449 | - unset( $option['feed'][ $key ] ); |
|
| 449 | + unset( $option['feed'][$key] ); |
|
| 450 | 450 | } |
| 451 | 451 | } |
| 452 | 452 | if ( is_array( $option['events'] ) && ! empty( $option['events'] ) ) { |
| 453 | 453 | foreach ( $option['events'] as $key => $notification ) { |
| 454 | 454 | array_unshift( $option['dismissed'], $notification ); |
| 455 | - unset( $option['events'][ $key ] ); |
|
| 455 | + unset( $option['events'][$key] ); |
|
| 456 | 456 | } |
| 457 | 457 | } |
| 458 | 458 | } |
@@ -460,13 +460,13 @@ discard block |
||
| 460 | 460 | $type = is_numeric( $id ) ? 'feed' : 'events'; |
| 461 | 461 | |
| 462 | 462 | // Remove notification and add in dismissed array. |
| 463 | - if ( is_array( $option[ $type ] ) && ! empty( $option[ $type ] ) ) { |
|
| 464 | - foreach ( $option[ $type ] as $key => $notification ) { |
|
| 463 | + if ( is_array( $option[$type] ) && ! empty( $option[$type] ) ) { |
|
| 464 | + foreach ( $option[$type] as $key => $notification ) { |
|
| 465 | 465 | if ( $notification['id'] == $id ) { // phpcs:ignore WordPress.PHP.StrictComparisons |
| 466 | 466 | // Add notification to dismissed array. |
| 467 | 467 | array_unshift( $option['dismissed'], $notification ); |
| 468 | 468 | // Remove notification from feed or events. |
| 469 | - unset( $option[ $type ][ $key ] ); |
|
| 469 | + unset( $option[$type][$key] ); |
|
| 470 | 470 | break; |
| 471 | 471 | } |
| 472 | 472 | } |
@@ -515,8 +515,8 @@ discard block |
||
| 515 | 515 | * |
| 516 | 516 | * @return string |
| 517 | 517 | */ |
| 518 | - public function get_view_url( $scroll_to, $page, $tab='' ) { |
|
| 519 | - $disabled = monsterinsights_get_option( 'dashboards_disabled', false ); |
|
| 518 | + public function get_view_url( $scroll_to, $page, $tab = '' ) { |
|
| 519 | + $disabled = monsterinsights_get_option( 'dashboards_disabled', false ); |
|
| 520 | 520 | |
| 521 | 521 | $url = add_query_arg( array( |
| 522 | 522 | 'page' => $page, |
@@ -525,7 +525,7 @@ discard block |
||
| 525 | 525 | ), admin_url( 'admin.php' ) ); |
| 526 | 526 | |
| 527 | 527 | if ( ! empty( $tab ) ) { |
| 528 | - $url .= '#/'. $tab; |
|
| 528 | + $url .= '#/' . $tab; |
|
| 529 | 529 | } |
| 530 | 530 | |
| 531 | 531 | if ( false !== $disabled ) { |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | if ( ! is_array( $inbound_paths ) ) { |
| 62 | 62 | $inbound_paths = array(); |
| 63 | 63 | } else { |
| 64 | - foreach( $inbound_paths as $index => $pair ) { |
|
| 64 | + foreach ( $inbound_paths as $index => $pair ) { |
|
| 65 | 65 | // if empty pair, unset and continue |
| 66 | 66 | if ( empty( $pair['path'] ) ) { |
| 67 | 67 | unset( $inbound_paths[$index] ); |
@@ -87,8 +87,8 @@ discard block |
||
| 87 | 87 | $download_extensions = array( $download_extensions ); |
| 88 | 88 | } |
| 89 | 89 | $i = 0; |
| 90 | - foreach( $download_extensions as $extension ){ |
|
| 91 | - $download_extensions[ $i ] = esc_js( trim( $extension ) ); |
|
| 90 | + foreach ( $download_extensions as $extension ) { |
|
| 91 | + $download_extensions[$i] = esc_js( trim( $extension ) ); |
|
| 92 | 92 | $i++; |
| 93 | 93 | } |
| 94 | 94 | |
@@ -87,7 +87,7 @@ |
||
| 87 | 87 | $download_extensions = array( $download_extensions ); |
| 88 | 88 | } |
| 89 | 89 | $i = 0; |
| 90 | - foreach( $download_extensions as $extension ){ |
|
| 90 | + foreach( $download_extensions as $extension ) { |
|
| 91 | 91 | $download_extensions[ $i ] = esc_js( trim( $extension ) ); |
| 92 | 92 | $i++; |
| 93 | 93 | } |
@@ -163,7 +163,7 @@ |
||
| 163 | 163 | * |
| 164 | 164 | * @return string |
| 165 | 165 | */ |
| 166 | - public function get_view_url( $scroll_to, $page, $tab='' ) { |
|
| 166 | + public function get_view_url( $scroll_to, $page, $tab = '' ) { |
|
| 167 | 167 | return MonsterInsights()->notifications->get_view_url( $scroll_to, $page, $tab ); |
| 168 | 168 | } |
| 169 | 169 | |
@@ -361,7 +361,7 @@ |
||
| 361 | 361 | <?php } ?> |
| 362 | 362 | } else { |
| 363 | 363 | <?php if ( $this->should_do_optout() ) { ?> |
| 364 | - console.log( "<?php echo esc_js( $reason );?>" ); |
|
| 364 | + console.log( "<?php echo esc_js( $reason ); ?>" ); |
|
| 365 | 365 | ( function () { |
| 366 | 366 | function __gtagTracker() { |
| 367 | 367 | return null; |