@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | ); |
56 | 56 | add_filter( "monsterinsights_is_autoupdate_setting_html_filtered_${plugin_file}", '__return_true' ); |
57 | 57 | } elseif ( $has_permission && |
58 | - ( $is_main_free || $is_main_pro || ( $is_addon && $is_pro ) ) |
|
58 | + ( $is_main_free || $is_main_pro || ( $is_addon && $is_pro ) ) |
|
59 | 59 | ) { |
60 | 60 | $text = __( 'Manage auto-updates', 'google-analytics-for-wordpress' ); |
61 | 61 | $html .= '<br>' . sprintf( '<a href="%s"">%s</a>', admin_url( 'admin.php?page=monsterinsights_settings#/advanced' ), $text ); |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | |
125 | 125 | // If this is multisite and is not on the main site, return early. |
126 | 126 | if ( is_multisite() && ! is_main_site() ) { |
127 | - return $update; |
|
127 | + return $update; |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | // When used in the context of automatic plugin update routine, the $item |
@@ -132,12 +132,12 @@ discard block |
||
132 | 132 | |
133 | 133 | // If we don't have everything we need, return early. |
134 | 134 | if ( ! isset( $item['new_version'] ) || ! isset( $item['slug'] ) ) { |
135 | - return $update; |
|
135 | + return $update; |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | // If the plugin isn't ours, return early. |
139 | 139 | if ( ( ! $is_free && ! $is_paid ) || ( $is_free && ! defined( 'MONSTERINSIGHTS_LITE_VERSION' ) ) ) { |
140 | - return $update; |
|
140 | + return $update; |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | $version = $is_free ? MONSTERINSIGHTS_LITE_VERSION : $item['old_version']; |
@@ -146,20 +146,20 @@ discard block |
||
146 | 146 | |
147 | 147 | // If the opt in update allows major updates but there is no major version update, return early. |
148 | 148 | if ( $current_major < $new_major ) { |
149 | - if ( $automatic_updates === 'all' ) { |
|
150 | - return true; |
|
151 | - } else { |
|
152 | - return $update; |
|
153 | - } |
|
149 | + if ( $automatic_updates === 'all' ) { |
|
150 | + return true; |
|
151 | + } else { |
|
152 | + return $update; |
|
153 | + } |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | // If the opt in update allows minor updates but there is no minor version update, return early. |
157 | 157 | if ( $current_major == $new_major ) { |
158 | - if ( $automatic_updates === 'all' || $automatic_updates === 'minor' ) { |
|
159 | - return true; |
|
160 | - } else { |
|
161 | - return $update; |
|
162 | - } |
|
158 | + if ( $automatic_updates === 'all' || $automatic_updates === 'minor' ) { |
|
159 | + return true; |
|
160 | + } else { |
|
161 | + return $update; |
|
162 | + } |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | // All our checks have passed - this plugin can be updated! |
@@ -197,8 +197,8 @@ discard block |
||
197 | 197 | function monsterinsights_get_major_version( $version ) { |
198 | 198 | $exploded_version = explode( '.', $version ); |
199 | 199 | if ( isset( $exploded_version[2] ) ) { |
200 | - return $exploded_version[0] . '.' . $exploded_version[1] . '.' . $exploded_version[2]; |
|
200 | + return $exploded_version[0] . '.' . $exploded_version[1] . '.' . $exploded_version[2]; |
|
201 | 201 | } else { |
202 | - return $exploded_version[0] . '.' . $exploded_version[1] . '.0'; |
|
202 | + return $exploded_version[0] . '.' . $exploded_version[1] . '.0'; |
|
203 | 203 | } |
204 | 204 | } |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | */ |
26 | 26 | public function __construct( $args = array() ) { |
27 | 27 | |
28 | - parent::__construct(); |
|
28 | + parent::__construct(); |
|
29 | 29 | |
30 | 30 | } |
31 | 31 | |
@@ -38,9 +38,9 @@ discard block |
||
38 | 38 | */ |
39 | 39 | public function set_upgrader( &$upgrader ) { |
40 | 40 | |
41 | - if ( is_object( $upgrader ) ) { |
|
42 | - $this->upgrader =& $upgrader; |
|
43 | - } |
|
41 | + if ( is_object( $upgrader ) ) { |
|
42 | + $this->upgrader =& $upgrader; |
|
43 | + } |
|
44 | 44 | |
45 | 45 | } |
46 | 46 | |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | */ |
54 | 54 | public function set_result( $result ) { |
55 | 55 | |
56 | - $this->result = $result; |
|
56 | + $this->result = $result; |
|
57 | 57 | |
58 | 58 | } |
59 | 59 |
@@ -39,7 +39,7 @@ |
||
39 | 39 | public function set_upgrader( &$upgrader ) { |
40 | 40 | |
41 | 41 | if ( is_object( $upgrader ) ) { |
42 | - $this->upgrader =& $upgrader; |
|
42 | + $this->upgrader = & $upgrader; |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | } |
@@ -97,7 +97,8 @@ discard block |
||
97 | 97 | */ |
98 | 98 | $options = apply_filters( 'upgrader_package_options', $options ); |
99 | 99 | |
100 | - if ( ! $options['is_multi'] ) { // call $this->header separately if running multiple times |
|
100 | + if ( ! $options['is_multi'] ) { |
|
101 | +// call $this->header separately if running multiple times |
|
101 | 102 | $this->skin->header(); |
102 | 103 | } |
103 | 104 | |
@@ -288,7 +289,8 @@ discard block |
||
288 | 289 | return $reply; |
289 | 290 | } |
290 | 291 | |
291 | - if ( ! preg_match( '!^(http|https|ftp)://!i', $package ) && file_exists( $package ) ) { //Local file or remote? |
|
292 | + if ( ! preg_match( '!^(http|https|ftp)://!i', $package ) && file_exists( $package ) ) { |
|
293 | +//Local file or remote? |
|
292 | 294 | return $package; //must be a local file.. |
293 | 295 | } |
294 | 296 | |
@@ -443,11 +445,13 @@ discard block |
||
443 | 445 | $remote_destination = $wp_filesystem->find_folder( $local_destination ); |
444 | 446 | |
445 | 447 | //Locate which directory to copy to the new folder, This is based on the actual folder holding the files. |
446 | - if ( 1 == count( $source_files ) && $wp_filesystem->is_dir( trailingslashit( $args['source'] ) . $source_files[0] . '/' ) ) { //Only one folder? Then we want its contents. |
|
448 | + if ( 1 == count( $source_files ) && $wp_filesystem->is_dir( trailingslashit( $args['source'] ) . $source_files[0] . '/' ) ) { |
|
449 | +//Only one folder? Then we want its contents. |
|
447 | 450 | $source = trailingslashit( $args['source'] ) . trailingslashit( $source_files[0] ); |
448 | 451 | } elseif ( count( $source_files ) == 0 ) { |
449 | 452 | return new WP_Error( 'incompatible_archive_empty', $this->strings['incompatible_archive'], $this->strings['no_files'] ); // There are no files? |
450 | - } else { // It's only a single file, the upgrader will use the folder name of this file as the destination folder. Folder name is based on zip filename. |
|
453 | + } else { |
|
454 | +// It's only a single file, the upgrader will use the folder name of this file as the destination folder. Folder name is based on zip filename. |
|
451 | 455 | $source = trailingslashit( $args['source'] ); |
452 | 456 | } |
453 | 457 |
@@ -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 | } |
@@ -521,13 +521,13 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -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( |
@@ -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 |