@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | if ( method_exists( $this, 'get_themes_' . $type ) ) { |
65 | 65 | $this->themes = call_user_func( array( $this, 'get_themes_' . $type ) ); |
66 | 66 | if ( ! empty( $theme ) ) { |
67 | - $this->theme = isset( $this->themes[ $theme ] ) ? $this->themes[ $theme ] : array(); |
|
67 | + $this->theme = isset( $this->themes[$theme] ) ? $this->themes[$theme] : array(); |
|
68 | 68 | |
69 | 69 | return $this->theme; |
70 | 70 | } else { |
@@ -114,14 +114,14 @@ discard block |
||
114 | 114 | |
115 | 115 | $settings = $this->get_theme_stored_styles(); |
116 | 116 | |
117 | - if ( ! empty( $settings[ $type ] ) ) { |
|
117 | + if ( ! empty( $settings[$type] ) ) { |
|
118 | 118 | foreach ( $themes as $theme_key => $theme_values ) { |
119 | - if ( ! empty( $settings[ $type ][ $theme_key ] ) ) { |
|
120 | - foreach ( $themes[ $theme_key ]['styles'] as $object => $props ) { |
|
121 | - if ( ! empty( $settings[ $type ][ $theme_key ][ $object ] ) ) { |
|
119 | + if ( ! empty( $settings[$type][$theme_key] ) ) { |
|
120 | + foreach ( $themes[$theme_key]['styles'] as $object => $props ) { |
|
121 | + if ( ! empty( $settings[$type][$theme_key][$object] ) ) { |
|
122 | 122 | foreach ( $props as $style_key => $style_value ) { |
123 | - if ( ! empty( $settings[ $type ][ $theme_key ][ $object ][ $style_key ] ) ) { |
|
124 | - $themes[ $theme_key ]['styles'][ $object ][ $style_key ] = $settings[ $type ][ $theme_key ][ $object ][ $style_key ]; |
|
123 | + if ( ! empty( $settings[$type][$theme_key][$object][$style_key] ) ) { |
|
124 | + $themes[$theme_key]['styles'][$object][$style_key] = $settings[$type][$theme_key][$object][$style_key]; |
|
125 | 125 | } |
126 | 126 | } |
127 | 127 | } |
@@ -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 | ); |
@@ -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( |
@@ -70,12 +70,12 @@ |
||
70 | 70 | <?php |
71 | 71 | // Translators: strong tag to make text bold, link to website to learn more |
72 | 72 | echo sprintf( |
73 | - esc_html__('%1$sPlus%2$s, upgrading to pro will unlock %3$sall%4$s of advanced reports, tracking, and integrations. %5$sLearn more about Pro%6$s', 'monsterinsights'), |
|
73 | + esc_html__( '%1$sPlus%2$s, upgrading to pro will unlock %3$sall%4$s of advanced reports, tracking, and integrations. %5$sLearn more about Pro%6$s', 'monsterinsights' ), |
|
74 | 74 | '<strong>', |
75 | 75 | '</strong>', |
76 | 76 | '<strong>', |
77 | 77 | '</strong>', |
78 | - '<a target="_blank" href="' . esc_url($learn_more) . '" title="'. esc_attr__('Upgrade', 'monsterinsights') .'">', |
|
78 | + '<a target="_blank" href="' . esc_url( $learn_more ) . '" title="' . esc_attr__( 'Upgrade', 'monsterinsights' ) . '">', |
|
79 | 79 | '</a>' |
80 | 80 | ); ?> |
81 | 81 | </p> |
@@ -102,8 +102,8 @@ discard block |
||
102 | 102 | |
103 | 103 | // Attept to place the widget at the top. |
104 | 104 | $normal_dashboard = $wp_meta_boxes['dashboard']['normal']['core']; |
105 | - $widget_instance = array( self::WIDGET_KEY => $normal_dashboard[ self::WIDGET_KEY ] ); |
|
106 | - unset( $normal_dashboard[ self::WIDGET_KEY ] ); |
|
105 | + $widget_instance = array( self::WIDGET_KEY => $normal_dashboard[self::WIDGET_KEY] ); |
|
106 | + unset( $normal_dashboard[self::WIDGET_KEY] ); |
|
107 | 107 | $sorted_dashboard = array_merge( $widget_instance, $normal_dashboard ); |
108 | 108 | $wp_meta_boxes['dashboard']['normal']['core'] = $sorted_dashboard; |
109 | 109 | } |
@@ -185,8 +185,8 @@ discard block |
||
185 | 185 | $wp_forms_url = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=wpforms-lite' ), 'install-plugin_wpforms-lite' ); |
186 | 186 | } |
187 | 187 | |
188 | - $userfeedback_keys = array ( 'userfeedback-lite/userfeedback.php' => 1, 'userfeedback/userfeedback.php' => 2 ); |
|
189 | - $userfeedback_versions = array_intersect_key($userfeedback_keys, $plugins); |
|
188 | + $userfeedback_keys = array( 'userfeedback-lite/userfeedback.php' => 1, 'userfeedback/userfeedback.php' => 2 ); |
|
189 | + $userfeedback_versions = array_intersect_key( $userfeedback_keys, $plugins ); |
|
190 | 190 | |
191 | 191 | if ( ! empty( $userfeedback_versions ) ) { |
192 | 192 | $uf_plugin_key = array_keys( $userfeedback_versions )[0]; |
@@ -310,10 +310,10 @@ discard block |
||
310 | 310 | $b = (array) $b; |
311 | 311 | $result = $b; |
312 | 312 | foreach ( $a as $k => &$v ) { |
313 | - if ( is_array( $v ) && isset( $result[ $k ] ) ) { |
|
314 | - $result[ $k ] = self::wp_parse_args_recursive( $v, $result[ $k ] ); |
|
313 | + if ( is_array( $v ) && isset( $result[$k] ) ) { |
|
314 | + $result[$k] = self::wp_parse_args_recursive( $v, $result[$k] ); |
|
315 | 315 | } else { |
316 | - $result[ $k ] = $v; |
|
316 | + $result[$k] = $v; |
|
317 | 317 | } |
318 | 318 | } |
319 | 319 | |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | public function load_notice() { |
327 | 327 | |
328 | 328 | $screen = get_current_screen(); |
329 | - $tracking_id = monsterinsights_get_v4_id(); |
|
329 | + $tracking_id = monsterinsights_get_v4_id(); |
|
330 | 330 | if ( isset( $screen->id ) && 'dashboard' === $screen->id && ! empty( $tracking_id ) ) { |
331 | 331 | ?> |
332 | 332 | <div id="monsterinsights-reminder-notice"></div> |
@@ -114,8 +114,8 @@ |
||
114 | 114 | ); |
115 | 115 | |
116 | 116 | // verify params present (oth & download link). |
117 | - $post_oth = ! empty( $_REQUEST['oth'] ) ? sanitize_text_field($_REQUEST['oth']) : ''; |
|
118 | - $post_url = ! empty( $_REQUEST['file'] ) ? sanitize_url($_REQUEST['file']) : ''; |
|
117 | + $post_oth = ! empty( $_REQUEST['oth'] ) ? sanitize_text_field( $_REQUEST['oth'] ) : ''; |
|
118 | + $post_url = ! empty( $_REQUEST['file'] ) ? sanitize_url( $_REQUEST['file'] ) : ''; |
|
119 | 119 | $license = get_option( 'monsterinsights_connect', false ); |
120 | 120 | $network = ! empty( $license['network'] ) ? (bool) $license['network'] : false; |
121 | 121 | if ( empty( $post_oth ) || empty( $post_url ) ) { |
@@ -99,7 +99,7 @@ |
||
99 | 99 | public function is_tracking() { |
100 | 100 | |
101 | 101 | if ( ! isset( $this->is_tracking ) ) { |
102 | - $tracking_id = monsterinsights_get_v4_id(); |
|
102 | + $tracking_id = monsterinsights_get_v4_id(); |
|
103 | 103 | $this->is_tracking = ! empty( $tracking_id ); |
104 | 104 | } |
105 | 105 |
@@ -35,17 +35,17 @@ discard block |
||
35 | 35 | if ( ! empty( $data['data']['countries'] ) ) { |
36 | 36 | $country_names = monsterinsights_get_country_list( true ); |
37 | 37 | foreach ( $data['data']['countries'] as $key => $country ) { |
38 | - $data['data']['countries'][ $key ]['name'] = isset( $country_names[ $country['iso'] ] ) ? $country_names[ $country['iso'] ] : $country['iso']; |
|
38 | + $data['data']['countries'][$key]['name'] = isset( $country_names[$country['iso']] ) ? $country_names[$country['iso']] : $country['iso']; |
|
39 | 39 | } |
40 | 40 | } |
41 | 41 | |
42 | 42 | // Escape urls for the top pages report. |
43 | 43 | if ( ! empty( $data['data']['toppages'] ) ) { |
44 | 44 | foreach ( $data['data']['toppages'] as $key => $page ) { |
45 | - $title = $data['data']['toppages'][ $key ]['title']; |
|
46 | - $url = '(not set)' === $title ? '' : esc_url( $data['data']['toppages'][ $key ]['hostname'] ); |
|
45 | + $title = $data['data']['toppages'][$key]['title']; |
|
46 | + $url = '(not set)' === $title ? '' : esc_url( $data['data']['toppages'][$key]['hostname'] ); |
|
47 | 47 | |
48 | - $data['data']['toppages'][ $key ]['hostname'] = $url; |
|
48 | + $data['data']['toppages'][$key]['hostname'] = $url; |
|
49 | 49 | } |
50 | 50 | } |
51 | 51 | |
@@ -78,10 +78,10 @@ discard block |
||
78 | 78 | * @return string |
79 | 79 | */ |
80 | 80 | public function default_end_date() { |
81 | - $current_year = date('Y'); |
|
81 | + $current_year = date( 'Y' ); |
|
82 | 82 | |
83 | 83 | // If we are still in 2023 we should get data from yesterday |
84 | - if ($current_year === '2023') { |
|
84 | + if ( $current_year === '2023' ) { |
|
85 | 85 | return date( 'Y-m-d', strtotime( '-1' ) ); |
86 | 86 | } |
87 | 87 |