@@ -37,10 +37,10 @@ |
||
37 | 37 | |
38 | 38 | foreach ( $this->input_attrs as $attr => $value ) { |
39 | 39 | if ( 'style' !== $attr ) { |
40 | - $this->json['inputAttrs'] .= $attr . '="' . esc_attr( $value ) . '" '; |
|
40 | + $this->json[ 'inputAttrs' ] .= $attr . '="' . esc_attr( $value ) . '" '; |
|
41 | 41 | continue; |
42 | 42 | } |
43 | - $this->json['labelStyle'] = 'style="' . esc_attr( $value ) . '" '; |
|
43 | + $this->json[ 'labelStyle' ] = 'style="' . esc_attr( $value ) . '" '; |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | } |
@@ -39,14 +39,14 @@ |
||
39 | 39 | if ( is_array( $this->choices ) ) { |
40 | 40 | foreach ( $this->choices as $choice => $value ) { |
41 | 41 | if ( 'labels' !== $choice && true === $value ) { |
42 | - $this->json['choices'][ $choice ] = true; |
|
42 | + $this->json[ 'choices' ][ $choice ] = true; |
|
43 | 43 | } |
44 | 44 | } |
45 | 45 | } |
46 | - if ( is_array( $this->json['default'] ) ) { |
|
47 | - foreach ( $this->json['default'] as $key => $value ) { |
|
48 | - if ( isset( $this->json['choices'][ $key ] ) && ! isset( $this->json['value'][ $key ] ) ) { |
|
49 | - $this->json['value'][ $key ] = $value; |
|
46 | + if ( is_array( $this->json[ 'default' ] ) ) { |
|
47 | + foreach ( $this->json[ 'default' ] as $key => $value ) { |
|
48 | + if ( isset( $this->json[ 'choices' ][ $key ] ) && ! isset( $this->json[ 'value' ][ $key ] ) ) { |
|
49 | + $this->json[ 'value' ][ $key ] = $value; |
|
50 | 50 | } |
51 | 51 | } |
52 | 52 | } |
@@ -128,30 +128,30 @@ |
||
128 | 128 | // Get the basics from the parent class. |
129 | 129 | parent::to_json(); |
130 | 130 | // Default. |
131 | - $this->json['default'] = $this->setting->default; |
|
131 | + $this->json[ 'default' ] = $this->setting->default; |
|
132 | 132 | if ( isset( $this->default ) ) { |
133 | - $this->json['default'] = $this->default; |
|
133 | + $this->json[ 'default' ] = $this->default; |
|
134 | 134 | } |
135 | 135 | // Required. |
136 | - $this->json['required'] = $this->required; |
|
136 | + $this->json[ 'required' ] = $this->required; |
|
137 | 137 | // Output. |
138 | - $this->json['output'] = $this->output; |
|
138 | + $this->json[ 'output' ] = $this->output; |
|
139 | 139 | // Value. |
140 | - $this->json['value'] = $this->value(); |
|
140 | + $this->json[ 'value' ] = $this->value(); |
|
141 | 141 | // Choices. |
142 | - $this->json['choices'] = $this->choices; |
|
142 | + $this->json[ 'choices' ] = $this->choices; |
|
143 | 143 | // The link. |
144 | - $this->json['link'] = $this->get_link(); |
|
144 | + $this->json[ 'link' ] = $this->get_link(); |
|
145 | 145 | // The ID. |
146 | - $this->json['id'] = $this->id; |
|
146 | + $this->json[ 'id' ] = $this->id; |
|
147 | 147 | // Translation strings. |
148 | - $this->json['l10n'] = $this->l10n(); |
|
148 | + $this->json[ 'l10n' ] = $this->l10n(); |
|
149 | 149 | // The ajaxurl in case we need it. |
150 | - $this->json['ajaxurl'] = admin_url( 'admin-ajax.php' ); |
|
150 | + $this->json[ 'ajaxurl' ] = admin_url( 'admin-ajax.php' ); |
|
151 | 151 | // Input attributes. |
152 | - $this->json['inputAttrs'] = ''; |
|
152 | + $this->json[ 'inputAttrs' ] = ''; |
|
153 | 153 | foreach ( $this->input_attrs as $attr => $value ) { |
154 | - $this->json['inputAttrs'] .= $attr . '="' . esc_attr( $value ) . '" '; |
|
154 | + $this->json[ 'inputAttrs' ] .= $attr . '="' . esc_attr( $value ) . '" '; |
|
155 | 155 | } |
156 | 156 | } |
157 | 157 |
@@ -43,7 +43,7 @@ |
||
43 | 43 | public function to_json() { |
44 | 44 | parent::to_json(); |
45 | 45 | |
46 | - $this->json['alpha'] = (bool) $this->alpha; |
|
46 | + $this->json[ 'alpha' ] = (bool) $this->alpha; |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
@@ -37,7 +37,7 @@ |
||
37 | 37 | public function to_json() { |
38 | 38 | parent::to_json(); |
39 | 39 | |
40 | - $this->json['choices'] = wp_parse_args( $this->json['choices'], array( |
|
40 | + $this->json[ 'choices' ] = wp_parse_args( $this->json[ 'choices' ], array( |
|
41 | 41 | 'min' => '0', |
42 | 42 | 'max' => '100', |
43 | 43 | 'step' => '1', |
@@ -38,11 +38,11 @@ |
||
38 | 38 | parent::to_json(); |
39 | 39 | |
40 | 40 | // If no palette has been defined, use Material Design Palette. |
41 | - if ( ! isset( $this->json['choices']['colors'] ) || empty( $this->json['choices']['colors'] ) ) { |
|
42 | - $this->json['choices']['colors'] = Kirki_Helper::get_material_design_colors( 'primary' ); |
|
41 | + if ( ! isset( $this->json[ 'choices' ][ 'colors' ] ) || empty( $this->json[ 'choices' ][ 'colors' ] ) ) { |
|
42 | + $this->json[ 'choices' ][ 'colors' ] = Kirki_Helper::get_material_design_colors( 'primary' ); |
|
43 | 43 | } |
44 | - if ( ! isset( $this->json['choices']['size'] ) || empty( $this->json['choices']['size'] ) ) { |
|
45 | - $this->json['choices']['size'] = 20; |
|
44 | + if ( ! isset( $this->json[ 'choices' ][ 'size' ] ) || empty( $this->json[ 'choices' ][ 'size' ] ) ) { |
|
45 | + $this->json[ 'choices' ][ 'size' ] = 20; |
|
46 | 46 | } |
47 | 47 | } |
48 | 48 |
@@ -24,8 +24,8 @@ |
||
24 | 24 | if ( ! is_array( $this->choices ) ) { |
25 | 25 | $this->choices = array(); |
26 | 26 | } |
27 | - $this->choices['element'] = 'input'; |
|
28 | - $this->choices['type'] = 'text'; |
|
27 | + $this->choices[ 'element' ] = 'input'; |
|
28 | + $this->choices[ 'type' ] = 'text'; |
|
29 | 29 | |
30 | 30 | } |
31 | 31 |
@@ -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. |
@@ -164,18 +164,18 @@ |
||
164 | 164 | */ |
165 | 165 | public function loop_fields( $config_id ) { |
166 | 166 | foreach ( Kirki::$fields as $field ) { |
167 | - if ( isset( $field['kirki_config'] ) && $config_id !== $field['kirki_config'] ) { |
|
167 | + if ( isset( $field[ 'kirki_config' ] ) && $config_id !== $field[ 'kirki_config' ] ) { |
|
168 | 168 | continue; |
169 | 169 | } |
170 | 170 | if ( true === apply_filters( "kirki/{$config_id}/webfonts/skip_hidden", true ) ) { |
171 | 171 | // Only continue if field dependencies are met. |
172 | - if ( ! empty( $field['required'] ) ) { |
|
172 | + if ( ! empty( $field[ 'required' ] ) ) { |
|
173 | 173 | $valid = true; |
174 | 174 | |
175 | - foreach ( $field['required'] as $requirement ) { |
|
176 | - if ( isset( $requirement['setting'] ) && isset( $requirement['value'] ) && isset( $requirement['operator'] ) ) { |
|
177 | - $controller_value = Kirki_Values::get_value( $config_id, $requirement['setting'] ); |
|
178 | - if ( ! Kirki_Helper::compare_values( $controller_value, $requirement['value'], $requirement['operator'] ) ) { |
|
175 | + foreach ( $field[ 'required' ] as $requirement ) { |
|
176 | + if ( isset( $requirement[ 'setting' ] ) && isset( $requirement[ 'value' ] ) && isset( $requirement[ 'operator' ] ) ) { |
|
177 | + $controller_value = Kirki_Values::get_value( $config_id, $requirement[ 'setting' ] ); |
|
178 | + if ( ! Kirki_Helper::compare_values( $controller_value, $requirement[ 'value' ], $requirement[ 'operator' ] ) ) { |
|
179 | 179 | $valid = false; |
180 | 180 | } |
181 | 181 | } |