@@ -26,7 +26,7 @@ |
||
26 | 26 | public function prepare_notification_data( $notification ) { |
27 | 27 | $notification['title'] = __( 'Upgrade to MonsterInsights Pro to Track Form Conversion', 'google-analytics-for-wordpress' ); |
28 | 28 | // Translators: upgrade for form conversion notification content |
29 | - $notification['content'] = sprintf( __( 'Forms are one of the most important points of interaction on your website. When a visitor fills out a form on your site, they’re taking the next step in their customer journey. That’s why it’s so crucial that your WordPress forms are optimized for conversions. Upgrade to %sMonsterInsights Pro%s to track %sform conversions in Google Analytics.%s', 'google-analytics-for-wordpress' ), '<a href="'. $this->get_upgrade_url() .'" target="_blank">', '</a>', '<a href="'. $this->build_external_link( 'https://www.monsterinsights.com/addon/forms/' ) .'" target="_blank">', '</a>' ); |
|
29 | + $notification['content'] = sprintf( __( 'Forms are one of the most important points of interaction on your website. When a visitor fills out a form on your site, they’re taking the next step in their customer journey. That’s why it’s so crucial that your WordPress forms are optimized for conversions. Upgrade to %sMonsterInsights Pro%s to track %sform conversions in Google Analytics.%s', 'google-analytics-for-wordpress' ), '<a href="' . $this->get_upgrade_url() . '" target="_blank">', '</a>', '<a href="' . $this->build_external_link( 'https://www.monsterinsights.com/addon/forms/' ) . '" target="_blank">', '</a>' ); |
|
30 | 30 | $notification['btns'] = array( |
31 | 31 | "get_monsterinsights_pro" => array( |
32 | 32 | 'url' => $this->get_upgrade_url(), |
@@ -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 | |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | |
293 | 293 | // Translators: Readable time to display |
294 | 294 | $modified_start_time = sprintf( __( '%1$s ago', 'google-analytics-for-wordpress' ), human_time_diff( strtotime( $notification['start'] ), current_time( 'timestamp' ) ) ); |
295 | - $notifications[ $key ]['start'] = $modified_start_time; |
|
295 | + $notifications[$key]['start'] = $modified_start_time; |
|
296 | 296 | } |
297 | 297 | |
298 | 298 | return $notifications; |
@@ -415,28 +415,28 @@ discard block |
||
415 | 415 | if ( $id === 'all' ) { |
416 | 416 | if ( is_array( $option['feed'] ) && ! empty( $option['feed'] ) ) { |
417 | 417 | foreach ( $option['feed'] as $key => $notification ) { |
418 | - array_unshift($option['dismissed'], $notification); |
|
419 | - unset( $option['feed'][ $key ] ); |
|
418 | + array_unshift( $option['dismissed'], $notification ); |
|
419 | + unset( $option['feed'][$key] ); |
|
420 | 420 | } |
421 | 421 | } |
422 | 422 | if ( is_array( $option['events'] ) && ! empty( $option['events'] ) ) { |
423 | 423 | foreach ( $option['events'] as $key => $notification ) { |
424 | - array_unshift($option['dismissed'], $notification); |
|
425 | - unset( $option['events'][ $key ] ); |
|
424 | + array_unshift( $option['dismissed'], $notification ); |
|
425 | + unset( $option['events'][$key] ); |
|
426 | 426 | } |
427 | 427 | } |
428 | 428 | } |
429 | 429 | |
430 | - $type = is_numeric( $id ) ? 'feed' : 'events'; |
|
430 | + $type = is_numeric( $id ) ? 'feed' : 'events'; |
|
431 | 431 | |
432 | 432 | // Remove notification and add in dismissed array. |
433 | - if ( is_array( $option[ $type ] ) && ! empty( $option[ $type ] ) ) { |
|
434 | - foreach ( $option[ $type ] as $key => $notification ) { |
|
433 | + if ( is_array( $option[$type] ) && ! empty( $option[$type] ) ) { |
|
434 | + foreach ( $option[$type] as $key => $notification ) { |
|
435 | 435 | if ( $notification['id'] == $id ) { // phpcs:ignore WordPress.PHP.StrictComparisons |
436 | 436 | // add notification to dismissed array |
437 | - array_unshift($option['dismissed'], $notification); |
|
437 | + array_unshift( $option['dismissed'], $notification ); |
|
438 | 438 | // remove notification from feed or events |
439 | - unset( $option[ $type ][ $key ] ); |
|
439 | + unset( $option[$type][$key] ); |
|
440 | 440 | break; |
441 | 441 | } |
442 | 442 | } |
@@ -455,7 +455,7 @@ discard block |
||
455 | 455 | public function get_menu_count() { |
456 | 456 | |
457 | 457 | if ( $this->get_count() > 0 ) { |
458 | - return '<span class="monsterinsights-menu-notification-indicator">'. $this->get_count() .'</span>'; |
|
458 | + return '<span class="monsterinsights-menu-notification-indicator">' . $this->get_count() . '</span>'; |
|
459 | 459 | } |
460 | 460 | |
461 | 461 | return ''; |
@@ -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 | |
@@ -350,7 +351,8 @@ discard block |
||
350 | 351 | |
351 | 352 | $option = $this->get_option(); |
352 | 353 | |
353 | - if ( in_array( $notification['id'], $option['dismissed'] ) ) { // phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict |
|
354 | + if ( in_array( $notification['id'], $option['dismissed'] ) ) { |
|
355 | +// phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict |
|
354 | 356 | return; |
355 | 357 | } |
356 | 358 | |
@@ -432,7 +434,8 @@ discard block |
||
432 | 434 | // Remove notification and add in dismissed array. |
433 | 435 | if ( is_array( $option[ $type ] ) && ! empty( $option[ $type ] ) ) { |
434 | 436 | foreach ( $option[ $type ] as $key => $notification ) { |
435 | - if ( $notification['id'] == $id ) { // phpcs:ignore WordPress.PHP.StrictComparisons |
|
437 | + if ( $notification['id'] == $id ) { |
|
438 | +// phpcs:ignore WordPress.PHP.StrictComparisons |
|
436 | 439 | // add notification to dismissed array |
437 | 440 | array_unshift($option['dismissed'], $notification); |
438 | 441 | // remove notification from feed or events |
@@ -155,7 +155,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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' ), |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | // if new install or Yoast Era instal |
64 | 64 | if ( ! $version ) { |
65 | 65 | // See if from Yoast |
66 | - $yoast = get_option( 'yst_ga', false ); |
|
66 | + $yoast = get_option( 'yst_ga', false ); |
|
67 | 67 | |
68 | 68 | // In case from Yoast, start from scratch |
69 | 69 | delete_option( 'yoast-ga-access_token' ); |
@@ -355,25 +355,25 @@ discard block |
||
355 | 355 | public function v700_upgrades() { |
356 | 356 | // 1. Default all event tracking and tracking to GA + JS respectively |
357 | 357 | // 3a Set tracking_mode to use analytics.js |
358 | - $this->new_settings['tracking_mode' ] = 'analytics'; |
|
358 | + $this->new_settings['tracking_mode'] = 'analytics'; |
|
359 | 359 | |
360 | 360 | |
361 | 361 | // 3b Set events mode to use JS if the events mode is not set explicitly to none |
362 | - if ( empty( $this->new_settings['events_mode' ] ) || $this->new_settings['events_mode' ] !== 'none' ) { |
|
363 | - $this->new_settings['events_mode' ] = 'js'; |
|
362 | + if ( empty( $this->new_settings['events_mode'] ) || $this->new_settings['events_mode'] !== 'none' ) { |
|
363 | + $this->new_settings['events_mode'] = 'js'; |
|
364 | 364 | } |
365 | 365 | |
366 | 366 | // 2. Migrate manual UA codes |
367 | 367 | // 2a Manual UA has the lowest priority |
368 | - if ( ! empty( $this->new_settings['manual_ua_code' ] ) ) { |
|
368 | + if ( ! empty( $this->new_settings['manual_ua_code'] ) ) { |
|
369 | 369 | // Set as manual UA code |
370 | - is_network_admin() ? update_site_option( 'monsterinsights_network_profile', array( 'manual' => $this->new_settings['manual_ua_code' ] ) ) : update_option( 'monsterinsights_site_profile', array( 'manual' => $this->new_settings['manual_ua_code' ] ) ); |
|
370 | + is_network_admin() ? update_site_option( 'monsterinsights_network_profile', array( 'manual' => $this->new_settings['manual_ua_code'] ) ) : update_option( 'monsterinsights_site_profile', array( 'manual' => $this->new_settings['manual_ua_code'] ) ); |
|
371 | 371 | } |
372 | 372 | |
373 | 373 | // 2b Then try the oAuth UA code |
374 | - if ( ! empty( $this->new_settings['analytics_profile_code' ] ) ) { |
|
374 | + if ( ! empty( $this->new_settings['analytics_profile_code'] ) ) { |
|
375 | 375 | // Set as manual UA code |
376 | - is_network_admin() ? update_site_option( 'monsterinsights_network_profile', array( 'manual' => $this->new_settings['analytics_profile_code' ] ) ) : update_option( 'monsterinsights_site_profile', array( 'manual' => $this->new_settings['analytics_profile_code' ] ) ); |
|
376 | + is_network_admin() ? update_site_option( 'monsterinsights_network_profile', array( 'manual' => $this->new_settings['analytics_profile_code'] ) ) : update_option( 'monsterinsights_site_profile', array( 'manual' => $this->new_settings['analytics_profile_code'] ) ); |
|
377 | 377 | } |
378 | 378 | |
379 | 379 | // 3. Migrate License keys |
@@ -415,8 +415,8 @@ discard block |
||
415 | 415 | 'track_internal_as_label', |
416 | 416 | ); |
417 | 417 | foreach ( $settings as $setting ) { |
418 | - if ( ! empty( $this->new_settings[ $setting ] ) ) { |
|
419 | - unset( $this->new_settings[ $setting ] ); |
|
418 | + if ( ! empty( $this->new_settings[$setting] ) ) { |
|
419 | + unset( $this->new_settings[$setting] ); |
|
420 | 420 | } |
421 | 421 | } |
422 | 422 | } |
@@ -460,8 +460,8 @@ discard block |
||
460 | 460 | ); |
461 | 461 | |
462 | 462 | foreach ( $settings as $setting ) { |
463 | - if ( ! empty( $this->new_settings[ $setting ] ) ) { |
|
464 | - unset( $this->new_settings[ $setting ] ); |
|
463 | + if ( ! empty( $this->new_settings[$setting] ) ) { |
|
464 | + unset( $this->new_settings[$setting] ); |
|
465 | 465 | } |
466 | 466 | } |
467 | 467 | |
@@ -500,8 +500,8 @@ discard block |
||
500 | 500 | ); |
501 | 501 | |
502 | 502 | foreach ( $settings as $setting ) { |
503 | - if ( ! empty( $this->new_settings[ $setting ] ) ) { |
|
504 | - unset( $this->new_settings[ $setting ] ); |
|
503 | + if ( ! empty( $this->new_settings[$setting] ) ) { |
|
504 | + unset( $this->new_settings[$setting] ); |
|
505 | 505 | } |
506 | 506 | } |
507 | 507 | |
@@ -592,7 +592,7 @@ discard block |
||
592 | 592 | } |
593 | 593 | preg_match( $regex, $cross_domain['domain'], $matches ); |
594 | 594 | if ( count( $matches ) > 0 ) { |
595 | - unset( $this->new_settings['cross_domains'][ $key ] ); |
|
595 | + unset( $this->new_settings['cross_domains'][$key] ); |
|
596 | 596 | } |
597 | 597 | } |
598 | 598 | } |
@@ -672,7 +672,7 @@ discard block |
||
672 | 672 | 'js', |
673 | 673 | 'tgz' |
674 | 674 | ); |
675 | - $extensions_to_add = array( |
|
675 | + $extensions_to_add = array( |
|
676 | 676 | 'docx', |
677 | 677 | 'pptx', |
678 | 678 | 'xlsx', |
@@ -774,8 +774,8 @@ discard block |
||
774 | 774 | ); |
775 | 775 | |
776 | 776 | foreach ( $popular_posts_defaults as $key => $value ) { |
777 | - if ( empty( $this->new_settings[ $key ] ) ) { |
|
778 | - $this->new_settings[ $key ] = $value; |
|
777 | + if ( empty( $this->new_settings[$key] ) ) { |
|
778 | + $this->new_settings[$key] = $value; |
|
779 | 779 | } |
780 | 780 | } |
781 | 781 | |
@@ -790,7 +790,7 @@ discard block |
||
790 | 790 | $content = isset( $dismiss_notification['content'] ) ? $dismiss_notification['content'] : ''; |
791 | 791 | |
792 | 792 | if ( empty( $title ) || empty( $content ) ) { |
793 | - unset( $dismissed_notifications[ $key ] ); |
|
793 | + unset( $dismissed_notifications[$key] ); |
|
794 | 794 | } |
795 | 795 | } |
796 | 796 |
@@ -63,14 +63,14 @@ discard block |
||
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 |
||
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 | ); |
@@ -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 = mb_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 === mb_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 | |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | |
151 | 151 | |
152 | 152 | foreach ( $this->conditional_options as $key => $obj ) { |
153 | - $new_instance = $this->maybe_remove_option( ! empty( $theme['styles'][ $obj[0] ][ $obj[1] ] ), $key, $new_instance ); |
|
153 | + $new_instance = $this->maybe_remove_option( ! empty( $theme['styles'][$obj[0]][$obj[1]] ), $key, $new_instance ); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | return $new_instance; |
@@ -173,12 +173,12 @@ discard block |
||
173 | 173 | 'meta_comments', |
174 | 174 | ); |
175 | 175 | |
176 | - if ( $is_used && ! isset( $instance[ $key ] ) && in_array( $key, $checkboxes ) ) { |
|
177 | - $instance[ $key ] = 'off'; |
|
178 | - } elseif ( ! $is_used && isset( $instance[ $key ] ) ) { |
|
179 | - unset( $instance[ $key ] ); |
|
180 | - } elseif ( $is_used && isset( $instance[ $key ] ) ) { |
|
181 | - $instance[ $key ] = wp_strip_all_tags( $instance[ $key ] ); |
|
176 | + if ( $is_used && ! isset( $instance[$key] ) && in_array( $key, $checkboxes ) ) { |
|
177 | + $instance[$key] = 'off'; |
|
178 | + } elseif ( ! $is_used && isset( $instance[$key] ) ) { |
|
179 | + unset( $instance[$key] ); |
|
180 | + } elseif ( $is_used && isset( $instance[$key] ) ) { |
|
181 | + $instance[$key] = wp_strip_all_tags( $instance[$key] ); |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | return $instance; |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | <input type="text" |
322 | 322 | id="<?php echo esc_attr( $this->get_field_id( $name ) ); ?>" |
323 | 323 | name="<?php echo esc_attr( $this->get_field_name( $name ) ); ?>" |
324 | - value="<?php echo esc_attr( $instance[ $name ] ); ?>" |
|
324 | + value="<?php echo esc_attr( $instance[$name] ); ?>" |
|
325 | 325 | class="widefat monsterinsights-color-field"/> |
326 | 326 | </p> |
327 | 327 | <?php |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | <input type="text" |
344 | 344 | id="<?php echo esc_attr( $this->get_field_id( $name ) ); ?>" |
345 | 345 | name="<?php echo esc_attr( $this->get_field_name( $name ) ); ?>" |
346 | - value="<?php echo esc_attr( $instance[ $name ] ); ?>" class="widefat"/> |
|
346 | + value="<?php echo esc_attr( $instance[$name] ); ?>" class="widefat"/> |
|
347 | 347 | </p> |
348 | 348 | <?php |
349 | 349 | } |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | <select id="<?php echo esc_attr( $this->get_field_id( $name ) ); ?>" |
366 | 366 | name="<?php echo esc_attr( $this->get_field_name( $name ) ); ?>" class="widefat"> |
367 | 367 | <?php foreach ( $range as $font_size ) { ?> |
368 | - <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> |
|
368 | + <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> |
|
369 | 369 | <?php } ?> |
370 | 370 | </select> |
371 | 371 | </p> |
@@ -379,8 +379,8 @@ discard block |
||
379 | 379 | */ |
380 | 380 | public function prepare_defaults_from_theme( $theme ) { |
381 | 381 | foreach ( $this->conditional_options as $key => $obj ) { |
382 | - if ( ! empty( $theme['styles'][ $obj[0] ][ $obj[1] ] ) ) { |
|
383 | - $this->defaults[ $key ] = $theme['styles'][ $obj[0] ][ $obj[1] ]; |
|
382 | + if ( ! empty( $theme['styles'][$obj[0]][$obj[1]] ) ) { |
|
383 | + $this->defaults[$key] = $theme['styles'][$obj[0]][$obj[1]]; |
|
384 | 384 | } |
385 | 385 | } |
386 | 386 | } |
@@ -36,7 +36,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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( |
@@ -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 |