@@ -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 |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | return; |
65 | 65 | } |
66 | 66 | |
67 | - $site_license = array( |
|
67 | + $site_license = array( |
|
68 | 68 | 'key' => MonsterInsights()->license->get_site_license_key(), |
69 | 69 | 'type' => MonsterInsights()->license->get_site_license_type(), |
70 | 70 | 'is_disabled' => MonsterInsights()->license->site_license_disabled(), |
@@ -124,8 +124,8 @@ discard block |
||
124 | 124 | // Array fields are needed even if empty. |
125 | 125 | $array_fields = array( 'view_reports', 'save_settings', 'ignore_users' ); |
126 | 126 | foreach ( $array_fields as $array_field ) { |
127 | - if ( ! isset( $options[ $array_field ] ) ) { |
|
128 | - $options[ $array_field ] = array(); |
|
127 | + if ( ! isset( $options[$array_field] ) ) { |
|
128 | + $options[$array_field] = array(); |
|
129 | 129 | } |
130 | 130 | } |
131 | 131 | if ( isset( $options['custom_code'] ) ) { |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | } |
257 | 257 | } |
258 | 258 | if ( $empty ) { |
259 | - unset( $value[ $key ] ); |
|
259 | + unset( $value[$key] ); |
|
260 | 260 | } |
261 | 261 | } |
262 | 262 | } |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | } else { |
307 | 307 | $addon = $this->get_addon( $installed_plugins, $addons_type, $addon, $slug ); |
308 | 308 | } |
309 | - $parsed_addons[ $addon->slug ] = $addon; |
|
309 | + $parsed_addons[$addon->slug] = $addon; |
|
310 | 310 | } |
311 | 311 | } |
312 | 312 | |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | 'slug' => 'pretty-link', |
385 | 385 | ); |
386 | 386 | // SeedProd. |
387 | - $parsed_addons['coming-soon'] = array( |
|
387 | + $parsed_addons['coming-soon'] = array( |
|
388 | 388 | 'active' => function_exists( 'seed_csp4_activation' ), |
389 | 389 | 'icon' => plugin_dir_url( MONSTERINSIGHTS_PLUGIN_FILE ) . 'assets/images/seedprod.png', |
390 | 390 | 'title' => 'SeedProd', |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | 'basename' => 'coming-soon/coming-soon.php', |
394 | 394 | 'slug' => 'coming-soon', |
395 | 395 | ); |
396 | - $parsed_addons['rafflepress'] = array( |
|
396 | + $parsed_addons['rafflepress'] = array( |
|
397 | 397 | 'active' => function_exists( 'rafflepress_lite_activation' ), |
398 | 398 | 'icon' => plugin_dir_url( MONSTERINSIGHTS_PLUGIN_FILE ) . 'assets/images/rafflepress.png', |
399 | 399 | 'title' => 'RafflePress', |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | $installed = false; |
435 | 435 | $plugin_basename = monsterinsights_get_plugin_basename_from_slug( $slug ); |
436 | 436 | |
437 | - if ( isset( $installed_plugins[ $plugin_basename ] ) ) { |
|
437 | + if ( isset( $installed_plugins[$plugin_basename] ) ) { |
|
438 | 438 | $installed = true; |
439 | 439 | |
440 | 440 | if ( is_multisite() && is_network_admin() ) { |
@@ -577,8 +577,8 @@ discard block |
||
577 | 577 | ); |
578 | 578 | |
579 | 579 | foreach ( $exclude as $e ) { |
580 | - if ( ! empty( $new_settings[ $e ] ) ) { |
|
581 | - unset( $new_settings[ $e ] ); |
|
580 | + if ( ! empty( $new_settings[$e] ) ) { |
|
581 | + unset( $new_settings[$e] ); |
|
582 | 582 | } |
583 | 583 | } |
584 | 584 | |
@@ -589,8 +589,8 @@ discard block |
||
589 | 589 | } |
590 | 590 | |
591 | 591 | foreach ( $exclude as $e ) { |
592 | - if ( ! empty( $settings[ $e ] ) ) { |
|
593 | - $new_settings = $settings[ $e ]; |
|
592 | + if ( ! empty( $settings[$e] ) ) { |
|
593 | + $new_settings = $settings[$e]; |
|
594 | 594 | } |
595 | 595 | } |
596 | 596 | |
@@ -750,7 +750,7 @@ discard block |
||
750 | 750 | ), |
751 | 751 | admin_url( 'admin.php' ) |
752 | 752 | ); |
753 | - $url = esc_url( $url ); |
|
753 | + $url = esc_url( $url ); |
|
754 | 754 | |
755 | 755 | ob_start(); |
756 | 756 | if ( false === ( $creds = request_filesystem_credentials( $url, $method, false, false, null ) ) ) { |
@@ -856,7 +856,7 @@ discard block |
||
856 | 856 | $homepage = get_option( 'page_on_front' ); |
857 | 857 | if ( ! $homepage ) { |
858 | 858 | $array[] = array( |
859 | - 'id' => - 1, |
|
859 | + 'id' => -1, |
|
860 | 860 | 'title' => __( 'Homepage', 'google-analytics-for-wordpress' ), |
861 | 861 | ); |
862 | 862 | } |
@@ -930,7 +930,7 @@ discard block |
||
930 | 930 | if ( ! post_type_supports( $post_type->name, 'editor' ) || 'product' === $post_type->name ) { |
931 | 931 | continue; |
932 | 932 | } |
933 | - $post_types_parsed[ $post_type->name ] = $post_type->labels->singular_name; |
|
933 | + $post_types_parsed[$post_type->name] = $post_type->labels->singular_name; |
|
934 | 934 | } |
935 | 935 | |
936 | 936 | $post_types_parsed = apply_filters( 'monsterinsights_vue_post_types_editor', $post_types_parsed ); |
@@ -1052,18 +1052,18 @@ discard block |
||
1052 | 1052 | $value = sanitize_text_field( wp_unslash( $_POST['value'] ) ); // Value of custom style like 12px or #fff. |
1053 | 1053 | $settings = get_option( $settings_key, array() ); |
1054 | 1054 | |
1055 | - if ( ! isset( $settings[ $type ] ) ) { |
|
1056 | - $settings[ $type ] = array(); |
|
1055 | + if ( ! isset( $settings[$type] ) ) { |
|
1056 | + $settings[$type] = array(); |
|
1057 | 1057 | } |
1058 | - if ( ! isset( $settings[ $type ][ $theme ] ) ) { |
|
1059 | - $settings[ $type ][ $theme ] = array(); |
|
1058 | + if ( ! isset( $settings[$type][$theme] ) ) { |
|
1059 | + $settings[$type][$theme] = array(); |
|
1060 | 1060 | } |
1061 | 1061 | |
1062 | - if ( ! isset( $settings[ $type ][ $theme ][ $object ] ) ) { |
|
1063 | - $settings[ $type ][ $theme ][ $object ] = array(); |
|
1062 | + if ( ! isset( $settings[$type][$theme][$object] ) ) { |
|
1063 | + $settings[$type][$theme][$object] = array(); |
|
1064 | 1064 | } |
1065 | 1065 | |
1066 | - $settings[ $type ][ $theme ][ $object ][ $key ] = $value; |
|
1066 | + $settings[$type][$theme][$object][$key] = $value; |
|
1067 | 1067 | |
1068 | 1068 | update_option( $settings_key, $settings ); |
1069 | 1069 |
@@ -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 |
@@ -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 | } |