@@ -58,8 +58,8 @@ discard block |
||
58 | 58 | |
59 | 59 | // Apply the kirki/config filter. |
60 | 60 | $config = apply_filters( 'kirki/config', array() ); |
61 | - if ( isset( $config['url_path'] ) ) { |
|
62 | - Kirki::$url = $config['url_path']; |
|
61 | + if ( isset( $config[ 'url_path' ] ) ) { |
|
62 | + Kirki::$url = $config[ 'url_path' ]; |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | // Make sure the right protocol is used. |
@@ -167,10 +167,10 @@ discard block |
||
167 | 167 | if ( ! empty( Kirki::$panels ) ) { |
168 | 168 | foreach ( Kirki::$panels as $panel_args ) { |
169 | 169 | // Extra checks for nested panels. |
170 | - if ( isset( $panel_args['panel'] ) ) { |
|
171 | - if ( isset( Kirki::$panels[ $panel_args['panel'] ] ) ) { |
|
170 | + if ( isset( $panel_args[ 'panel' ] ) ) { |
|
171 | + if ( isset( Kirki::$panels[ $panel_args[ 'panel' ] ] ) ) { |
|
172 | 172 | // Set the type to nested. |
173 | - $panel_args['type'] = 'kirki-nested'; |
|
173 | + $panel_args[ 'type' ] = 'kirki-nested'; |
|
174 | 174 | } |
175 | 175 | } |
176 | 176 | |
@@ -188,14 +188,14 @@ discard block |
||
188 | 188 | if ( ! empty( Kirki::$sections ) ) { |
189 | 189 | foreach ( Kirki::$sections as $section_args ) { |
190 | 190 | // Extra checks for nested sections. |
191 | - if ( isset( $section_args['section'] ) ) { |
|
192 | - if ( isset( Kirki::$sections[ $section_args['section'] ] ) ) { |
|
191 | + if ( isset( $section_args[ 'section' ] ) ) { |
|
192 | + if ( isset( Kirki::$sections[ $section_args[ 'section' ] ] ) ) { |
|
193 | 193 | // Set the type to nested. |
194 | - $section_args['type'] = 'kirki-nested'; |
|
194 | + $section_args[ 'type' ] = 'kirki-nested'; |
|
195 | 195 | // We need to check if the parent section is nested inside a panel. |
196 | - $parent_section = Kirki::$sections[ $section_args['section'] ]; |
|
197 | - if ( isset( $parent_section['panel'] ) ) { |
|
198 | - $section_args['panel'] = $parent_section['panel']; |
|
196 | + $parent_section = Kirki::$sections[ $section_args[ 'section' ] ]; |
|
197 | + if ( isset( $parent_section[ 'panel' ] ) ) { |
|
198 | + $section_args[ 'panel' ] = $parent_section[ 'panel' ]; |
|
199 | 199 | } |
200 | 200 | } |
201 | 201 | } |
@@ -40,17 +40,17 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public function typography_field_tweaks( $value, $field_id ) { |
42 | 42 | |
43 | - if ( isset( Kirki::$fields[ $field_id ] ) && isset( Kirki::$fields[ $field_id ]['type'] ) ) { |
|
44 | - if ( 'kirki-typography' === Kirki::$fields[ $field_id ]['type'] ) { |
|
43 | + if ( isset( Kirki::$fields[ $field_id ] ) && isset( Kirki::$fields[ $field_id ][ 'type' ] ) ) { |
|
44 | + if ( 'kirki-typography' === Kirki::$fields[ $field_id ][ 'type' ] ) { |
|
45 | 45 | |
46 | 46 | // Sanitize the value. |
47 | 47 | // This also adds font-weight if it doesn't already exist. |
48 | 48 | $value = Kirki_Field_Typography::sanitize( $value ); |
49 | 49 | |
50 | 50 | // Combine font-family and font-backup. |
51 | - if ( isset( $value['font-family'] ) && isset( $value['font-backup'] ) ) { |
|
52 | - $value['font-family'] .= ', ' . $value['font-backup']; |
|
53 | - unset( $value['font-backup'] ); |
|
51 | + if ( isset( $value[ 'font-family' ] ) && isset( $value[ 'font-backup' ] ) ) { |
|
52 | + $value[ 'font-family' ] .= ', ' . $value[ 'font-backup' ]; |
|
53 | + unset( $value[ 'font-backup' ] ); |
|
54 | 54 | } |
55 | 55 | } |
56 | 56 | } |
@@ -87,39 +87,39 @@ discard block |
||
87 | 87 | $config_id = 'global'; |
88 | 88 | } |
89 | 89 | |
90 | - if ( 'theme_mod' === Kirki::$config[ $config_id ]['option_type'] ) { |
|
90 | + if ( 'theme_mod' === Kirki::$config[ $config_id ][ 'option_type' ] ) { |
|
91 | 91 | |
92 | 92 | // We're using theme_mods so just get the value using get_theme_mod. |
93 | 93 | $default_value = null; |
94 | - if ( isset( Kirki::$fields[ $field_id ] ) && isset( Kirki::$fields[ $field_id ]['default'] ) ) { |
|
95 | - $default_value = Kirki::$fields[ $field_id ]['default']; |
|
94 | + if ( isset( Kirki::$fields[ $field_id ] ) && isset( Kirki::$fields[ $field_id ][ 'default' ] ) ) { |
|
95 | + $default_value = Kirki::$fields[ $field_id ][ 'default' ]; |
|
96 | 96 | } |
97 | 97 | $value = get_theme_mod( $field_id, $default_value ); |
98 | 98 | return apply_filters( 'kirki/values/get_value', $value, $field_id ); |
99 | 99 | } |
100 | 100 | |
101 | - if ( 'option' === Kirki::$config[ $config_id ]['option_type'] ) { |
|
101 | + if ( 'option' === Kirki::$config[ $config_id ][ 'option_type' ] ) { |
|
102 | 102 | |
103 | 103 | // We're using options. |
104 | - if ( '' !== Kirki::$config[ $config_id ]['option_name'] ) { |
|
104 | + if ( '' !== Kirki::$config[ $config_id ][ 'option_name' ] ) { |
|
105 | 105 | |
106 | 106 | // Options are serialized as a single option in the db. |
107 | 107 | // We'll have to get the option and then get the item from the array. |
108 | - $options = get_option( Kirki::$config[ $config_id ]['option_name'] ); |
|
108 | + $options = get_option( Kirki::$config[ $config_id ][ 'option_name' ] ); |
|
109 | 109 | |
110 | - if ( ! isset( Kirki::$fields[ $field_id ] ) && isset( Kirki::$fields[ Kirki::$config[ $config_id ]['option_name'] . '[' . $field_id . ']' ] ) ) { |
|
111 | - $field_id = Kirki::$config[ $config_id ]['option_name'] . '[' . $field_id . ']'; |
|
110 | + if ( ! isset( Kirki::$fields[ $field_id ] ) && isset( Kirki::$fields[ Kirki::$config[ $config_id ][ 'option_name' ] . '[' . $field_id . ']' ] ) ) { |
|
111 | + $field_id = Kirki::$config[ $config_id ][ 'option_name' ] . '[' . $field_id . ']'; |
|
112 | 112 | } |
113 | - $setting_modified = str_replace( ']', '', str_replace( Kirki::$config[ $config_id ]['option_name'] . '[', '', $field_id ) ); |
|
113 | + $setting_modified = str_replace( ']', '', str_replace( Kirki::$config[ $config_id ][ 'option_name' ] . '[', '', $field_id ) ); |
|
114 | 114 | |
115 | - $default_value = ( isset( Kirki::$fields[ $field_id ] ) && isset( Kirki::$fields[ $field_id ]['default'] ) ) ? Kirki::$fields[ $field_id ]['default'] : ''; |
|
115 | + $default_value = ( isset( Kirki::$fields[ $field_id ] ) && isset( Kirki::$fields[ $field_id ][ 'default' ] ) ) ? Kirki::$fields[ $field_id ][ 'default' ] : ''; |
|
116 | 116 | $value = ( isset( $options[ $setting_modified ] ) ) ? $options[ $setting_modified ] : $default_value; |
117 | 117 | $value = maybe_unserialize( $value ); |
118 | 118 | return apply_filters( 'kirki/values/get_value', $value, $field_id ); |
119 | 119 | } |
120 | 120 | |
121 | 121 | // Each option separately saved in the db. |
122 | - $value = get_option( $field_id, Kirki::$fields[ $field_id ]['default'] ); |
|
122 | + $value = get_option( $field_id, Kirki::$fields[ $field_id ][ 'default' ] ); |
|
123 | 123 | return apply_filters( 'kirki/values/get_value', $value, $field_id ); |
124 | 124 | |
125 | 125 | } // End if(). |
@@ -137,18 +137,18 @@ discard block |
||
137 | 137 | * @return string|array |
138 | 138 | */ |
139 | 139 | public static function get_sanitized_field_value( $field ) { |
140 | - $value = $field['default']; |
|
141 | - if ( isset( $field['option_type'] ) && 'theme_mod' === $field['option_type'] ) { |
|
142 | - $value = get_theme_mod( $field['settings'], $field['default'] ); |
|
143 | - } elseif ( isset( $field['option_type'] ) && 'option' === $field['option_type'] ) { |
|
144 | - if ( isset( $field['option_name'] ) && '' !== $field['option_name'] ) { |
|
145 | - $all_values = get_option( $field['option_name'], array() ); |
|
146 | - $sub_setting_id = str_replace( array( ']', $field['option_name'] . '[' ), '', $field['settings'] ); |
|
140 | + $value = $field[ 'default' ]; |
|
141 | + if ( isset( $field[ 'option_type' ] ) && 'theme_mod' === $field[ 'option_type' ] ) { |
|
142 | + $value = get_theme_mod( $field[ 'settings' ], $field[ 'default' ] ); |
|
143 | + } elseif ( isset( $field[ 'option_type' ] ) && 'option' === $field[ 'option_type' ] ) { |
|
144 | + if ( isset( $field[ 'option_name' ] ) && '' !== $field[ 'option_name' ] ) { |
|
145 | + $all_values = get_option( $field[ 'option_name' ], array() ); |
|
146 | + $sub_setting_id = str_replace( array( ']', $field[ 'option_name' ] . '[' ), '', $field[ 'settings' ] ); |
|
147 | 147 | if ( isset( $all_values[ $sub_setting_id ] ) ) { |
148 | 148 | $value = $all_values[ $sub_setting_id ]; |
149 | 149 | } |
150 | 150 | } else { |
151 | - $value = get_option( $field['settings'], $field['default'] ); |
|
151 | + $value = get_option( $field[ 'settings' ], $field[ 'default' ] ); |
|
152 | 152 | } |
153 | 153 | } |
154 | 154 |
@@ -43,7 +43,7 @@ |
||
43 | 43 | include_once ABSPATH . 'wp-admin/includes/plugin.php'; |
44 | 44 | } |
45 | 45 | $data = get_plugin_data( KIRKI_PLUGIN_FILE ); |
46 | - $version = ( isset( $data['Version'] ) ) ? $data['Version'] : false; |
|
46 | + $version = ( isset( $data[ 'Version' ] ) ) ? $data[ 'Version' ] : false; |
|
47 | 47 | define( 'KIRKI_VERSION', $version ); |
48 | 48 | } |
49 | 49 |
@@ -89,23 +89,23 @@ discard block |
||
89 | 89 | $name_parts = explode( '_', str_replace( 'Kirki_', '', $class_name ) ); |
90 | 90 | |
91 | 91 | // Handle modules loading. |
92 | - if ( isset( $name_parts[0] ) && 'Modules' === $name_parts[0] ) { |
|
92 | + if ( isset( $name_parts[ 0 ] ) && 'Modules' === $name_parts[ 0 ] ) { |
|
93 | 93 | $path = dirname( __FILE__ ) . '/modules/'; |
94 | 94 | $path .= strtolower( str_replace( '_', '-', str_replace( 'Kirki_Modules_', '', $class_name ) ) ) . '/'; |
95 | - $paths[] = $path . $filename; |
|
95 | + $paths[ ] = $path . $filename; |
|
96 | 96 | } |
97 | 97 | |
98 | - if ( isset( $name_parts[0] ) ) { |
|
98 | + if ( isset( $name_parts[ 0 ] ) ) { |
|
99 | 99 | |
100 | 100 | // Handle controls loading. |
101 | - if ( 'Control' === $name_parts[0] || 'Settings' === $name_parts[0] ) { |
|
102 | - $path = dirname( __FILE__ ) . '/controls/php/'; |
|
103 | - $paths[] = $path . $filename; |
|
101 | + if ( 'Control' === $name_parts[ 0 ] || 'Settings' === $name_parts[ 0 ] ) { |
|
102 | + $path = dirname( __FILE__ ) . '/controls/php/'; |
|
103 | + $paths[ ] = $path . $filename; |
|
104 | 104 | } |
105 | 105 | } |
106 | 106 | |
107 | - $paths[] = dirname( __FILE__ ) . '/core/' . $filename; |
|
108 | - $paths[] = dirname( __FILE__ ) . '/lib/' . $filename; |
|
107 | + $paths[ ] = dirname( __FILE__ ) . '/core/' . $filename; |
|
108 | + $paths[ ] = dirname( __FILE__ ) . '/lib/' . $filename; |
|
109 | 109 | |
110 | 110 | $substr = str_replace( 'Kirki_', '', $class_name ); |
111 | 111 | $exploded = explode( '_', $substr ); |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | |
114 | 114 | $previous_path = ''; |
115 | 115 | for ( $i = 0; $i < $levels; $i++ ) { |
116 | - $paths[] = dirname( __FILE__ ) . '/' . $previous_path . strtolower( $exploded[ $i ] ) . '/' . $filename; |
|
116 | + $paths[ ] = dirname( __FILE__ ) . '/' . $previous_path . strtolower( $exploded[ $i ] ) . '/' . $filename; |
|
117 | 117 | $previous_path .= strtolower( $exploded[ $i ] ) . '/'; |
118 | 118 | } |
119 | 119 | return $paths; |
@@ -49,10 +49,10 @@ |
||
49 | 49 | 'panel', |
50 | 50 | ) ); |
51 | 51 | |
52 | - $array['title'] = html_entity_decode( $this->title, ENT_QUOTES, get_bloginfo( 'charset' ) ); |
|
53 | - $array['content'] = $this->get_content(); |
|
54 | - $array['active'] = $this->active(); |
|
55 | - $array['instanceNumber'] = $this->instance_number; |
|
52 | + $array[ 'title' ] = html_entity_decode( $this->title, ENT_QUOTES, get_bloginfo( 'charset' ) ); |
|
53 | + $array[ 'content' ] = $this->get_content(); |
|
54 | + $array[ 'active' ] = $this->active(); |
|
55 | + $array[ 'instanceNumber' ] = $this->instance_number; |
|
56 | 56 | |
57 | 57 | return $array; |
58 | 58 | } |
@@ -51,15 +51,15 @@ |
||
51 | 51 | 'section', |
52 | 52 | ) ); |
53 | 53 | |
54 | - $array['title'] = html_entity_decode( $this->title, ENT_QUOTES, get_bloginfo( 'charset' ) ); |
|
55 | - $array['content'] = $this->get_content(); |
|
56 | - $array['active'] = $this->active(); |
|
57 | - $array['instanceNumber'] = $this->instance_number; |
|
54 | + $array[ 'title' ] = html_entity_decode( $this->title, ENT_QUOTES, get_bloginfo( 'charset' ) ); |
|
55 | + $array[ 'content' ] = $this->get_content(); |
|
56 | + $array[ 'active' ] = $this->active(); |
|
57 | + $array[ 'instanceNumber' ] = $this->instance_number; |
|
58 | 58 | |
59 | - $array['customizeAction'] = esc_attr__( 'Customizing', 'kirki' ); |
|
59 | + $array[ 'customizeAction' ] = esc_attr__( 'Customizing', 'kirki' ); |
|
60 | 60 | if ( $this->panel ) { |
61 | 61 | /* translators: The title. */ |
62 | - $array['customizeAction'] = sprintf( esc_attr__( 'Customizing ▸ %s', 'kirki' ), esc_html( $this->manager->get_panel( $this->panel )->title ) ); |
|
62 | + $array[ 'customizeAction' ] = sprintf( esc_attr__( 'Customizing ▸ %s', 'kirki' ), esc_html( $this->manager->get_panel( $this->panel )->title ) ); |
|
63 | 63 | } |
64 | 64 | return $array; |
65 | 65 | } |
@@ -69,13 +69,13 @@ |
||
69 | 69 | |
70 | 70 | // Start parsing the fields. |
71 | 71 | foreach ( $fields as $field ) { |
72 | - if ( isset( $field['partial_refresh'] ) && ! empty( $field['partial_refresh'] ) ) { |
|
72 | + if ( isset( $field[ 'partial_refresh' ] ) && ! empty( $field[ 'partial_refresh' ] ) ) { |
|
73 | 73 | // Start going through each item in the array of partial refreshes. |
74 | - foreach ( $field['partial_refresh'] as $partial_refresh => $partial_refresh_args ) { |
|
74 | + foreach ( $field[ 'partial_refresh' ] as $partial_refresh => $partial_refresh_args ) { |
|
75 | 75 | // If we have all we need, create the selective refresh call. |
76 | - if ( isset( $partial_refresh_args['render_callback'] ) && isset( $partial_refresh_args['selector'] ) ) { |
|
76 | + if ( isset( $partial_refresh_args[ 'render_callback' ] ) && isset( $partial_refresh_args[ 'selector' ] ) ) { |
|
77 | 77 | $partial_refresh_args = wp_parse_args( $partial_refresh_args, array( |
78 | - 'settings' => $field['settings'], |
|
78 | + 'settings' => $field[ 'settings' ], |
|
79 | 79 | ) ); |
80 | 80 | $wp_customize->selective_refresh->add_partial( $partial_refresh, $partial_refresh_args ); |
81 | 81 | } |
@@ -68,10 +68,10 @@ discard block |
||
68 | 68 | public function custom_css() { |
69 | 69 | |
70 | 70 | $config = apply_filters( 'kirki/config', array() ); |
71 | - if ( ! isset( $config['color_accent'] ) && ! isset( $config['color_back'] ) ) { |
|
71 | + if ( ! isset( $config[ 'color_accent' ] ) && ! isset( $config[ 'color_back' ] ) ) { |
|
72 | 72 | return; |
73 | 73 | } |
74 | - $back = isset( $config['color_back'] ) ? $config['color_back'] : false; |
|
74 | + $back = isset( $config[ 'color_back' ] ) ? $config[ 'color_back' ] : false; |
|
75 | 75 | |
76 | 76 | $text_on_back = ''; |
77 | 77 | $border_on_back = ''; |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | $hover_on_back = ( 90 < $back_obj->lightness ) ? $back_obj->getNew( 'lightness', $back_obj->lightness - 3 )->toCSS( $back_obj->mode ) : $back_obj->getNew( 'lightness', $back_obj->lightness + 3 )->toCSS( $back_obj->mode ); |
94 | 94 | $arrows_on_back = ( 50 > $back_obj->lightness ) ? $back_obj->getNew( 'lightness', $back_obj->lightness + 30 )->toCSS( $back_obj->mode ) : $back_obj->getNew( 'lightness', $back_obj->lightness - 30 )->toCSS( $back_obj->mode ); |
95 | 95 | } |
96 | - $accent = ( isset( $config['color_accent'] ) ) ? $config['color_accent'] : false; |
|
96 | + $accent = ( isset( $config[ 'color_accent' ] ) ) ? $config[ 'color_accent' ] : false; |
|
97 | 97 | if ( $accent ) { |
98 | 98 | $accent_obj = ariColor::newColor( $accent ); |
99 | 99 | $text_on_accent = ( 60 > $accent_obj->lightness ) ? $accent_obj->getNew( 'lightness', $accent_obj->lightness + 60 )->toCSS( $accent_obj->mode ) : $accent_obj->getNew( 'lightness', $accent_obj->lightness - 60 )->toCSS( $accent_obj->mode ); |
@@ -405,18 +405,18 @@ discard block |
||
405 | 405 | color: #444 !important; |
406 | 406 | } |
407 | 407 | |
408 | - <?php if ( isset( $config['width'] ) ) : ?> |
|
408 | + <?php if ( isset( $config[ 'width' ] ) ) : ?> |
|
409 | 409 | .wp-full-overlay-sidebar { |
410 | - width: <?php echo esc_attr( $config['width'] ); // WPCS: XSS ok. ?>; |
|
410 | + width: <?php echo esc_attr( $config[ 'width' ] ); // WPCS: XSS ok. ?>; |
|
411 | 411 | } |
412 | 412 | .expanded .wp-full-overlay-footer { |
413 | - width: <?php echo esc_attr( $config['width'] ); // WPCS: XSS ok. ?>; |
|
413 | + width: <?php echo esc_attr( $config[ 'width' ] ); // WPCS: XSS ok. ?>; |
|
414 | 414 | } |
415 | 415 | .wp-full-overlay.expanded { |
416 | - margin-left: <?php echo esc_attr( $config['width'] ); // WPCS: XSS ok. ?>; |
|
416 | + margin-left: <?php echo esc_attr( $config[ 'width' ] ); // WPCS: XSS ok. ?>; |
|
417 | 417 | } |
418 | 418 | .wp-full-overlay.collapsed .wp-full-overlay-sidebar { |
419 | - margin-left: -<?php echo esc_attr( $config['width'] ); // WPCS: XSS ok. ?>; |
|
419 | + margin-left: -<?php echo esc_attr( $config[ 'width' ] ); // WPCS: XSS ok. ?>; |
|
420 | 420 | } |
421 | 421 | <?php endif; ?> |
422 | 422 | </style> |
@@ -73,14 +73,14 @@ |
||
73 | 73 | 'logoImage' => '', |
74 | 74 | 'description' => '', |
75 | 75 | ); |
76 | - if ( isset( $config['logo_image'] ) && '' !== $config['logo_image'] ) { |
|
77 | - $vars['logoImage'] = esc_url_raw( $config['logo_image'] ); |
|
76 | + if ( isset( $config[ 'logo_image' ] ) && '' !== $config[ 'logo_image' ] ) { |
|
77 | + $vars[ 'logoImage' ] = esc_url_raw( $config[ 'logo_image' ] ); |
|
78 | 78 | } |
79 | - if ( isset( $config['description'] ) && '' !== $config['description'] ) { |
|
80 | - $vars['description'] = esc_textarea( $config['description'] ); |
|
79 | + if ( isset( $config[ 'description' ] ) && '' !== $config[ 'description' ] ) { |
|
80 | + $vars[ 'description' ] = esc_textarea( $config[ 'description' ] ); |
|
81 | 81 | } |
82 | 82 | |
83 | - if ( ! empty( $vars['logoImage'] ) || ! empty( $vars['description'] ) ) { |
|
83 | + if ( ! empty( $vars[ 'logoImage' ] ) || ! empty( $vars[ 'description' ] ) ) { |
|
84 | 84 | wp_register_script( 'kirki-branding', Kirki::$url . '/modules/customizer-branding/branding.js', array(), KIRKI_VERSION ); |
85 | 85 | wp_localize_script( 'kirki-branding', 'kirkiBranding', $vars ); |
86 | 86 | wp_enqueue_script( 'kirki-branding' ); |