@@ -27,7 +27,7 @@ |
||
27 | 27 | if ( ! empty( $data ) && $data['prev_sessions_difference'] < 0 ) { |
28 | 28 | $notification['title'] = __( 'Your Website Traffic Is Dropping', 'google-analytics-for-wordpress' ); |
29 | 29 | // Translators: Traffic dropping notification content |
30 | - $notification['content'] = sprintf( __( 'Your website traffic is decreasing and that’s a reason to take action now. Less traffic means less opportunities to make your brand known, make relationships and ultimately sell your service or product. <br><br>Follow the marketing hacks of %sthis article%s to start growing your traffic again.', 'google-analytics-for-wordpress' ), '<a href="'. $this->build_external_link( 'https://www.monsterinsights.com/marketing-hacks-guaranteed-to-grow-your-traffic/' ) .'" target="_blank">', '</a>' ); |
|
30 | + $notification['content'] = sprintf( __( 'Your website traffic is decreasing and that’s a reason to take action now. Less traffic means less opportunities to make your brand known, make relationships and ultimately sell your service or product. <br><br>Follow the marketing hacks of %sthis article%s to start growing your traffic again.', 'google-analytics-for-wordpress' ), '<a href="' . $this->build_external_link( 'https://www.monsterinsights.com/marketing-hacks-guaranteed-to-grow-your-traffic/' ) . '" target="_blank">', '</a>' ); |
|
31 | 31 | $notification['btns'] = array( |
32 | 32 | "learn_more" => array( |
33 | 33 | 'url' => $this->build_external_link( 'https://www.monsterinsights.com/marketing-hacks-guaranteed-to-grow-your-traffic/' ), |
@@ -28,7 +28,7 @@ |
||
28 | 28 | // Translators: Returning visitors notification title |
29 | 29 | $notification['title'] = sprintf( __( 'Only %s%% of your visitors return to your site', 'google-analytics-for-wordpress' ), $data['returning'] ); |
30 | 30 | // Translators: Returning visitors notification content |
31 | - $notification['content'] = sprintf( __( 'For any website, returning visitors are important because they indicate how successful your marketing campaigns are, who are your loyal customers, and how powerful your brand is. %sIn this article%s, we’ll show you 7 proven ways to increase your returning visitor rate.', 'google-analytics-for-wordpress' ), '<a href="'. $this->build_external_link( 'https://www.monsterinsights.com/proven-ways-to-increase-your-returning-visitor-rate/' ) .'" target="_blank">', '</a>' ); |
|
31 | + $notification['content'] = sprintf( __( 'For any website, returning visitors are important because they indicate how successful your marketing campaigns are, who are your loyal customers, and how powerful your brand is. %sIn this article%s, we’ll show you 7 proven ways to increase your returning visitor rate.', 'google-analytics-for-wordpress' ), '<a href="' . $this->build_external_link( 'https://www.monsterinsights.com/proven-ways-to-increase-your-returning-visitor-rate/' ) . '" target="_blank">', '</a>' ); |
|
32 | 32 | $notification['btns'] = array( |
33 | 33 | "view_report" => array( |
34 | 34 | 'url' => $this->get_view_url(), |
@@ -33,7 +33,7 @@ |
||
33 | 33 | |
34 | 34 | $notification['title'] = __( 'Set Up Affiliate Link Tracking', 'google-analytics-for-wordpress' ); |
35 | 35 | // Translators: Set up affiliate links notification content |
36 | - $notification['content'] = sprintf( __( 'By tracking your affiliate links in Google Analytics, you can gather all the data you need to optimize your links for maximizing affiliate revenue. You can track affiliate link clicks on your website with little configuration needed.<br><br>%sIn this article%s, we’ll show you how to set up affiliate link tracking in WordPress.', 'google-analytics-for-wordpress' ), '<a href="'. $this->build_external_link( 'https://www.monsterinsights.com/how-to-set-up-affiliate-link-tracking-in-wordpress/' ) .'" target="_blank">', '</a>' ); |
|
36 | + $notification['content'] = sprintf( __( 'By tracking your affiliate links in Google Analytics, you can gather all the data you need to optimize your links for maximizing affiliate revenue. You can track affiliate link clicks on your website with little configuration needed.<br><br>%sIn this article%s, we’ll show you how to set up affiliate link tracking in WordPress.', 'google-analytics-for-wordpress' ), '<a href="' . $this->build_external_link( 'https://www.monsterinsights.com/how-to-set-up-affiliate-link-tracking-in-wordpress/' ) . '" target="_blank">', '</a>' ); |
|
37 | 37 | $notification['btns'] = array( |
38 | 38 | "read_more" => array( |
39 | 39 | 'url' => $this->build_external_link( 'https://www.monsterinsights.com/how-to-set-up-affiliate-link-tracking-in-wordpress/' ), |
@@ -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,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 | } |