@@ -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> |
@@ -63,7 +63,7 @@ |
||
63 | 63 | } |
64 | 64 | // Allow disabling the custom loader using the kirki_config filter. |
65 | 65 | $config = apply_filters( 'kirki_config', array() ); |
66 | - if ( isset( $config['disable_loader'] ) && true === $config['disable_loader'] ) { |
|
66 | + if ( isset( $config[ 'disable_loader' ] ) && true === $config[ 'disable_loader' ] ) { |
|
67 | 67 | return; |
68 | 68 | } |
69 | 69 | // Add the "loading" icon. |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | $config = apply_filters( 'kirki_config', array() ); |
77 | 77 | |
78 | 78 | // If we have set $config['disable_google_fonts'] to true then do not proceed any further. |
79 | - if ( isset( $config['disable_google_fonts'] ) && true === $config['disable_google_fonts'] ) { |
|
79 | + if ( isset( $config[ 'disable_google_fonts' ] ) && true === $config[ 'disable_google_fonts' ] ) { |
|
80 | 80 | return; |
81 | 81 | } |
82 | 82 | |
@@ -113,64 +113,64 @@ discard block |
||
113 | 113 | public function generate_google_font( $args ) { |
114 | 114 | |
115 | 115 | // Process typography fields. |
116 | - if ( isset( $args['type'] ) && 'kirki-typography' === $args['type'] ) { |
|
116 | + if ( isset( $args[ 'type' ] ) && 'kirki-typography' === $args[ 'type' ] ) { |
|
117 | 117 | |
118 | 118 | // Get the value. |
119 | 119 | $value = Kirki_Values::get_sanitized_field_value( $args ); |
120 | 120 | |
121 | 121 | // If we don't have a font-family then we can skip this. |
122 | - if ( ! isset( $value['font-family'] ) ) { |
|
122 | + if ( ! isset( $value[ 'font-family' ] ) ) { |
|
123 | 123 | return; |
124 | 124 | } |
125 | 125 | |
126 | 126 | // If not a google-font, then we can skip this. |
127 | - if ( ! Kirki_Fonts::is_google_font( $value['font-family'] ) ) { |
|
127 | + if ( ! Kirki_Fonts::is_google_font( $value[ 'font-family' ] ) ) { |
|
128 | 128 | return; |
129 | 129 | } |
130 | 130 | |
131 | 131 | // Set a default value for variants. |
132 | - if ( ! isset( $value['variant'] ) ) { |
|
133 | - $value['variant'] = 'regular'; |
|
132 | + if ( ! isset( $value[ 'variant' ] ) ) { |
|
133 | + $value[ 'variant' ] = 'regular'; |
|
134 | 134 | } |
135 | - if ( isset( $value['subsets'] ) ) { |
|
135 | + if ( isset( $value[ 'subsets' ] ) ) { |
|
136 | 136 | |
137 | 137 | // Add the subset directly to the array of subsets in the Kirki_GoogleFonts_Manager object. |
138 | 138 | // Subsets must be applied to ALL fonts if possible. |
139 | - if ( ! is_array( $value['subsets'] ) ) { |
|
140 | - $this->subsets[] = $value['subsets']; |
|
139 | + if ( ! is_array( $value[ 'subsets' ] ) ) { |
|
140 | + $this->subsets[ ] = $value[ 'subsets' ]; |
|
141 | 141 | } else { |
142 | - foreach ( $value['subsets'] as $subset ) { |
|
143 | - $this->subsets[] = $subset; |
|
142 | + foreach ( $value[ 'subsets' ] as $subset ) { |
|
143 | + $this->subsets[ ] = $subset; |
|
144 | 144 | } |
145 | 145 | } |
146 | 146 | } |
147 | 147 | |
148 | 148 | // Add the requested google-font. |
149 | - if ( ! isset( $this->fonts[ $value['font-family'] ] ) ) { |
|
150 | - $this->fonts[ $value['font-family'] ] = array(); |
|
149 | + if ( ! isset( $this->fonts[ $value[ 'font-family' ] ] ) ) { |
|
150 | + $this->fonts[ $value[ 'font-family' ] ] = array(); |
|
151 | 151 | } |
152 | - if ( ! in_array( $value['variant'], $this->fonts[ $value['font-family'] ], true ) ) { |
|
153 | - $this->fonts[ $value['font-family'] ][] = $value['variant']; |
|
152 | + if ( ! in_array( $value[ 'variant' ], $this->fonts[ $value[ 'font-family' ] ], true ) ) { |
|
153 | + $this->fonts[ $value[ 'font-family' ] ][ ] = $value[ 'variant' ]; |
|
154 | 154 | } |
155 | 155 | // Are we force-loading all variants? |
156 | 156 | if ( true === self::$force_load_all_variants ) { |
157 | 157 | $all_variants = Kirki_Fonts::get_all_variants(); |
158 | - $args['choices']['variant'] = array_keys( $all_variants ); |
|
158 | + $args[ 'choices' ][ 'variant' ] = array_keys( $all_variants ); |
|
159 | 159 | } |
160 | 160 | |
161 | - if ( ! empty( $args['choices']['variant'] ) && is_array( $args['choices']['variant'] ) ) { |
|
162 | - foreach ( $args['choices']['variant'] as $extra_variant ) { |
|
163 | - $this->fonts[ $value['font-family'] ][] = $extra_variant; |
|
161 | + if ( ! empty( $args[ 'choices' ][ 'variant' ] ) && is_array( $args[ 'choices' ][ 'variant' ] ) ) { |
|
162 | + foreach ( $args[ 'choices' ][ 'variant' ] as $extra_variant ) { |
|
163 | + $this->fonts[ $value[ 'font-family' ] ][ ] = $extra_variant; |
|
164 | 164 | } |
165 | 165 | } |
166 | 166 | } else { |
167 | 167 | |
168 | 168 | // Process non-typography fields. |
169 | - if ( isset( $args['output'] ) && is_array( $args['output'] ) ) { |
|
170 | - foreach ( $args['output'] as $output ) { |
|
169 | + if ( isset( $args[ 'output' ] ) && is_array( $args[ 'output' ] ) ) { |
|
170 | + foreach ( $args[ 'output' ] as $output ) { |
|
171 | 171 | |
172 | 172 | // If we don't have a typography-related output argument we can skip this. |
173 | - if ( ! isset( $output['property'] ) || ! in_array( $output['property'], array( 'font-family', 'font-weight', 'font-subset', 'subset', 'subsets' ), true ) ) { |
|
173 | + if ( ! isset( $output[ 'property' ] ) || ! in_array( $output[ 'property' ], array( 'font-family', 'font-weight', 'font-subset', 'subset', 'subsets' ), true ) ) { |
|
174 | 174 | continue; |
175 | 175 | } |
176 | 176 | |
@@ -178,25 +178,25 @@ discard block |
||
178 | 178 | $value = Kirki_Values::get_sanitized_field_value( $args ); |
179 | 179 | |
180 | 180 | if ( is_string( $value ) ) { |
181 | - if ( 'font-family' === $output['property'] ) { |
|
181 | + if ( 'font-family' === $output[ 'property' ] ) { |
|
182 | 182 | if ( ! array_key_exists( $value, $this->fonts ) ) { |
183 | 183 | $this->fonts[ $value ] = array(); |
184 | 184 | } |
185 | - } elseif ( 'font-weight' === $output['property'] ) { |
|
185 | + } elseif ( 'font-weight' === $output[ 'property' ] ) { |
|
186 | 186 | foreach ( $this->fonts as $font => $variants ) { |
187 | 187 | if ( ! in_array( $value, $variants, true ) ) { |
188 | - $this->fonts[ $font ][] = $value; |
|
188 | + $this->fonts[ $font ][ ] = $value; |
|
189 | 189 | } |
190 | 190 | } |
191 | - } elseif ( 'font-subset' === $output['property'] || 'subset' === $output['property'] || 'subsets' === $output['property'] ) { |
|
191 | + } elseif ( 'font-subset' === $output[ 'property' ] || 'subset' === $output[ 'property' ] || 'subsets' === $output[ 'property' ] ) { |
|
192 | 192 | if ( ! is_array( $value ) ) { |
193 | 193 | if ( ! in_array( $value, $this->subsets, true ) ) { |
194 | - $this->subsets[] = $value; |
|
194 | + $this->subsets[ ] = $value; |
|
195 | 195 | } |
196 | 196 | } else { |
197 | 197 | foreach ( $value as $subset ) { |
198 | 198 | if ( ! in_array( $subset, $this->subsets, true ) ) { |
199 | - $this->subsets[] = $subset; |
|
199 | + $this->subsets[ ] = $subset; |
|
200 | 200 | } |
201 | 201 | } |
202 | 202 | } |
@@ -231,8 +231,8 @@ discard block |
||
231 | 231 | |
232 | 232 | // Get all valid font variants for this font. |
233 | 233 | $font_variants = array(); |
234 | - if ( isset( $this->google_fonts[ $font ]['variants'] ) ) { |
|
235 | - $font_variants = $this->google_fonts[ $font ]['variants']; |
|
234 | + if ( isset( $this->google_fonts[ $font ][ 'variants' ] ) ) { |
|
235 | + $font_variants = $this->google_fonts[ $font ][ 'variants' ]; |
|
236 | 236 | } |
237 | 237 | foreach ( $variants as $variant ) { |
238 | 238 | |
@@ -247,10 +247,10 @@ discard block |
||
247 | 247 | |
248 | 248 | // Check if the selected subsets exist, even in one of the selected fonts. |
249 | 249 | // If they don't, then they have to be removed otherwise the link will fail. |
250 | - if ( isset( $this->google_fonts[ $font ]['subsets'] ) ) { |
|
250 | + if ( isset( $this->google_fonts[ $font ][ 'subsets' ] ) ) { |
|
251 | 251 | foreach ( $this->subsets as $subset ) { |
252 | - if ( in_array( $subset, $this->google_fonts[ $font ]['subsets'], true ) ) { |
|
253 | - $valid_subsets[] = $subset; |
|
252 | + if ( in_array( $subset, $this->google_fonts[ $font ][ 'subsets' ], true ) ) { |
|
253 | + $valid_subsets[ ] = $subset; |
|
254 | 254 | } |
255 | 255 | } |
256 | 256 | } |
@@ -169,18 +169,18 @@ |
||
169 | 169 | */ |
170 | 170 | public function loop_fields( $config_id ) { |
171 | 171 | foreach ( Kirki::$fields as $field ) { |
172 | - if ( isset( $field['kirki_config'] ) && $config_id !== $field['kirki_config'] ) { |
|
172 | + if ( isset( $field[ 'kirki_config' ] ) && $config_id !== $field[ 'kirki_config' ] ) { |
|
173 | 173 | continue; |
174 | 174 | } |
175 | 175 | if ( true === apply_filters( "kirki_{$config_id}_webfonts_skip_hidden", true ) ) { |
176 | 176 | // Only continue if field dependencies are met. |
177 | - if ( ! empty( $field['required'] ) ) { |
|
177 | + if ( ! empty( $field[ 'required' ] ) ) { |
|
178 | 178 | $valid = true; |
179 | 179 | |
180 | - foreach ( $field['required'] as $requirement ) { |
|
181 | - if ( isset( $requirement['setting'] ) && isset( $requirement['value'] ) && isset( $requirement['operator'] ) ) { |
|
182 | - $controller_value = Kirki_Values::get_value( $config_id, $requirement['setting'] ); |
|
183 | - if ( ! Kirki_Helper::compare_values( $controller_value, $requirement['value'], $requirement['operator'] ) ) { |
|
180 | + foreach ( $field[ 'required' ] as $requirement ) { |
|
181 | + if ( isset( $requirement[ 'setting' ] ) && isset( $requirement[ 'value' ] ) && isset( $requirement[ 'operator' ] ) ) { |
|
182 | + $controller_value = Kirki_Values::get_value( $config_id, $requirement[ 'setting' ] ); |
|
183 | + if ( ! Kirki_Helper::compare_values( $controller_value, $requirement[ 'value' ], $requirement[ 'operator' ] ) ) { |
|
184 | 184 | $valid = false; |
185 | 185 | } |
186 | 186 | } |
@@ -146,10 +146,10 @@ discard block |
||
146 | 146 | public static function css( $field ) { |
147 | 147 | |
148 | 148 | // Set class vars. |
149 | - self::$settings = $field['settings']; |
|
150 | - self::$callback = $field['sanitize_callback']; |
|
151 | - self::$field_type = $field['type']; |
|
152 | - self::$output = $field['output']; |
|
149 | + self::$settings = $field[ 'settings' ]; |
|
150 | + self::$callback = $field[ 'sanitize_callback' ]; |
|
151 | + self::$field_type = $field[ 'type' ]; |
|
152 | + self::$output = $field[ 'output' ]; |
|
153 | 153 | if ( ! is_array( self::$output ) ) { |
154 | 154 | self::$output = array( |
155 | 155 | array( |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | |
165 | 165 | // Find the class that will handle the outpout for this field. |
166 | 166 | $classname = 'Kirki_Output'; |
167 | - $field_output_classes = apply_filters( "kirki_{$field['kirki_config']}_output_control_classnames", array( |
|
167 | + $field_output_classes = apply_filters( "kirki_{$field[ 'kirki_config' ]}_output_control_classnames", array( |
|
168 | 168 | 'kirki-background' => 'Kirki_Output_Field_Background', |
169 | 169 | 'kirki-dimensions' => 'Kirki_Output_Field_Dimensions', |
170 | 170 | 'kirki-image' => 'Kirki_Output_Field_Image', |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | if ( array_key_exists( self::$field_type, $field_output_classes ) ) { |
175 | 175 | $classname = $field_output_classes[ self::$field_type ]; |
176 | 176 | } |
177 | - $obj = new $classname( $field['kirki_config'], self::$output, self::$value, $field ); |
|
177 | + $obj = new $classname( $field[ 'kirki_config' ], self::$output, self::$value, $field ); |
|
178 | 178 | return $obj->get_styles(); |
179 | 179 | |
180 | 180 | } |
@@ -119,12 +119,12 @@ discard block |
||
119 | 119 | |
120 | 120 | $config = apply_filters( 'kirki_config', array() ); |
121 | 121 | $priority = 999; |
122 | - if ( isset( $config['styles_priority'] ) ) { |
|
123 | - $priority = absint( $config['styles_priority'] ); |
|
122 | + if ( isset( $config[ 'styles_priority' ] ) ) { |
|
123 | + $priority = absint( $config[ 'styles_priority' ] ); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | // Allow completely disabling Kirki CSS output. |
127 | - if ( ( defined( 'KIRKI_NO_OUTPUT' ) && true === KIRKI_NO_OUTPUT ) || ( isset( $config['disable_output'] ) && true === $config['disable_output'] ) ) { |
|
127 | + if ( ( defined( 'KIRKI_NO_OUTPUT' ) && true === KIRKI_NO_OUTPUT ) || ( isset( $config[ 'disable_output' ] ) && true === $config[ 'disable_output' ] ) ) { |
|
128 | 128 | return; |
129 | 129 | } |
130 | 130 | |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | |
156 | 156 | // If we are in the customizer, load CSS using inline-styles. |
157 | 157 | // If we are in the frontend AND self::$ajax is true, then load dynamic CSS using AJAX. |
158 | - if ( ( true === self::$ajax ) || ( isset( $config['inline_css'] ) && false === $config['inline_css'] ) ) { |
|
158 | + if ( ( true === self::$ajax ) || ( isset( $config[ 'inline_css' ] ) && false === $config[ 'inline_css' ] ) ) { |
|
159 | 159 | add_action( 'wp_enqueue_scripts', array( $this, 'frontend_styles' ), $priority ); |
160 | 160 | add_action( 'wp_ajax_kirki_dynamic_css', array( $this, 'ajax_dynamic_css' ) ); |
161 | 161 | add_action( 'wp_ajax_nopriv_kirki_dynamic_css', array( $this, 'ajax_dynamic_css' ) ); |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | $configs = Kirki::$config; |
187 | 187 | if ( ! $this->processed ) { |
188 | 188 | foreach ( $configs as $config_id => $args ) { |
189 | - if ( isset( $args['disable_output'] ) && true === $args['disable_output'] ) { |
|
189 | + if ( isset( $args[ 'disable_output' ] ) && true === $args[ 'disable_output' ] ) { |
|
190 | 190 | continue; |
191 | 191 | } |
192 | 192 | $styles = self::loop_controls( $config_id ); |
@@ -243,19 +243,19 @@ discard block |
||
243 | 243 | foreach ( $fields as $field ) { |
244 | 244 | |
245 | 245 | // Only process fields that belong to $config_id. |
246 | - if ( $config_id !== $field['kirki_config'] ) { |
|
246 | + if ( $config_id !== $field[ 'kirki_config' ] ) { |
|
247 | 247 | continue; |
248 | 248 | } |
249 | 249 | |
250 | 250 | if ( true === apply_filters( "kirki_{$config_id}_css_skip_hidden", true ) ) { |
251 | 251 | // Only continue if field dependencies are met. |
252 | - if ( ! empty( $field['required'] ) ) { |
|
252 | + if ( ! empty( $field[ 'required' ] ) ) { |
|
253 | 253 | $valid = true; |
254 | 254 | |
255 | - foreach ( $field['required'] as $requirement ) { |
|
256 | - if ( isset( $requirement['setting'] ) && isset( $requirement['value'] ) && isset( $requirement['operator'] ) ) { |
|
257 | - $controller_value = Kirki_Values::get_value( $config_id, $requirement['setting'] ); |
|
258 | - if ( ! Kirki_Helper::compare_values( $controller_value, $requirement['value'], $requirement['operator'] ) ) { |
|
255 | + foreach ( $field[ 'required' ] as $requirement ) { |
|
256 | + if ( isset( $requirement[ 'setting' ] ) && isset( $requirement[ 'value' ] ) && isset( $requirement[ 'operator' ] ) ) { |
|
257 | + $controller_value = Kirki_Values::get_value( $config_id, $requirement[ 'setting' ] ); |
|
258 | + if ( ! Kirki_Helper::compare_values( $controller_value, $requirement[ 'value' ], $requirement[ 'operator' ] ) ) { |
|
259 | 259 | $valid = false; |
260 | 260 | } |
261 | 261 | } |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | } |
269 | 269 | |
270 | 270 | // Only continue if $field['output'] is set. |
271 | - if ( isset( $field['output'] ) && ! empty( $field['output'] ) ) { |
|
271 | + if ( isset( $field[ 'output' ] ) && ! empty( $field[ 'output' ] ) ) { |
|
272 | 272 | $css = Kirki_Helper::array_replace_recursive( $css, Kirki_Modules_CSS_Generator::css( $field ) ); |
273 | 273 | |
274 | 274 | // Add the globals. |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | $config_ids = Kirki_Config::get_config_ids(); |
54 | 54 | global $kirki_deprecated_filters_iteration; |
55 | 55 | foreach ( $config_ids as $config_id ) { |
56 | - foreach( array( |
|
56 | + foreach ( array( |
|
57 | 57 | '/dynamic_css', |
58 | 58 | '/output/control-classnames', |
59 | 59 | '/css/skip_hidden', |
@@ -64,8 +64,8 @@ discard block |
||
64 | 64 | $kirki_deprecated_filters_iteration = array( $config_id, $filter_suffix ); |
65 | 65 | add_filter( "kirki_{$config_id}_{$filter_suffix}", function( $args ) { |
66 | 66 | global $kirki_deprecated_filters_iteration; |
67 | - $kirki_deprecated_filters_iteration[1] = str_replace( '-', '_', $kirki_deprecated_filters_iteration[1] ); |
|
68 | - return apply_filters( "kirki/{$kirki_deprecated_filters_iteration[0]}/{$kirki_deprecated_filters_iteration[1]}", $args ); |
|
67 | + $kirki_deprecated_filters_iteration[ 1 ] = str_replace( '-', '_', $kirki_deprecated_filters_iteration[ 1 ] ); |
|
68 | + return apply_filters( "kirki/{$kirki_deprecated_filters_iteration[ 0 ]}/{$kirki_deprecated_filters_iteration[ 1 ]}", $args ); |
|
69 | 69 | }, 99 ); |
70 | 70 | } |
71 | 71 | } |