@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | * @param array $value The field's value. |
23 | 23 | */ |
24 | 24 | protected function process_output( $output, $value ) { |
25 | - if ( ! isset( $output['element'] ) || ! isset( $output['property'] ) ) { |
|
25 | + if ( ! isset( $output[ 'element' ] ) || ! isset( $output[ 'property' ] ) ) { |
|
26 | 26 | return; |
27 | 27 | } |
28 | 28 | $output = wp_parse_args( |
@@ -34,16 +34,16 @@ discard block |
||
34 | 34 | ) |
35 | 35 | ); |
36 | 36 | if ( is_array( $value ) ) { |
37 | - if ( isset( $output['choice'] ) && $output['choice'] ) { |
|
38 | - $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = $output['prefix'] . $this->process_property_value( $output['property'], $value[ $output['choice'] ] ) . $output['units'] . $output['suffix']; |
|
37 | + if ( isset( $output[ 'choice' ] ) && $output[ 'choice' ] ) { |
|
38 | + $this->styles[ $output[ 'media_query' ] ][ $output[ 'element' ] ][ $output[ 'property' ] ] = $output[ 'prefix' ] . $this->process_property_value( $output[ 'property' ], $value[ $output[ 'choice' ] ] ) . $output[ 'units' ] . $output[ 'suffix' ]; |
|
39 | 39 | return; |
40 | 40 | } |
41 | - if ( isset( $value['url'] ) ) { |
|
42 | - $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = $output['prefix'] . $this->process_property_value( $output['property'], $value['url'] ) . $output['units'] . $output['suffix']; |
|
41 | + if ( isset( $value[ 'url' ] ) ) { |
|
42 | + $this->styles[ $output[ 'media_query' ] ][ $output[ 'element' ] ][ $output[ 'property' ] ] = $output[ 'prefix' ] . $this->process_property_value( $output[ 'property' ], $value[ 'url' ] ) . $output[ 'units' ] . $output[ 'suffix' ]; |
|
43 | 43 | return; |
44 | 44 | } |
45 | 45 | return; |
46 | 46 | } |
47 | - $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = $output['prefix'] . $this->process_property_value( $output['property'], $value ) . $output['units'] . $output['suffix']; |
|
47 | + $this->styles[ $output[ 'media_query' ] ][ $output[ 'element' ] ][ $output[ 'property' ] ] = $output[ 'prefix' ] . $this->process_property_value( $output[ 'property' ], $value ) . $output[ 'units' ] . $output[ 'suffix' ]; |
|
48 | 48 | } |
49 | 49 | } |
@@ -52,15 +52,15 @@ discard block |
||
52 | 52 | protected function get_path( $context = '' ) { |
53 | 53 | $upload_dir = wp_upload_dir(); |
54 | 54 | $paths = array( |
55 | - 'file' => wp_normalize_path( $upload_dir['basedir'] . '/kirki-css/styles.css' ), |
|
56 | - 'folder' => wp_normalize_path( $upload_dir['basedir'] . '/kirki-css' ), |
|
55 | + 'file' => wp_normalize_path( $upload_dir[ 'basedir' ] . '/kirki-css/styles.css' ), |
|
56 | + 'folder' => wp_normalize_path( $upload_dir[ 'basedir' ] . '/kirki-css' ), |
|
57 | 57 | ); |
58 | 58 | |
59 | 59 | if ( 'file' === $context ) { |
60 | - return $paths['file']; |
|
60 | + return $paths[ 'file' ]; |
|
61 | 61 | } |
62 | 62 | if ( 'folder' === $context ) { |
63 | - return $paths['folder']; |
|
63 | + return $paths[ 'folder' ]; |
|
64 | 64 | } |
65 | 65 | return $paths; |
66 | 66 | } |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | */ |
75 | 75 | public function get_url() { |
76 | 76 | $upload_dir = wp_upload_dir(); |
77 | - return esc_url_raw( $upload_dir['baseurl'] . '/kirki-css/styles.css' ); |
|
77 | + return esc_url_raw( $upload_dir[ 'baseurl' ] . '/kirki-css/styles.css' ); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | /** |
@@ -52,15 +52,15 @@ |
||
52 | 52 | ) |
53 | 53 | ); |
54 | 54 | |
55 | - $array['title'] = html_entity_decode( $this->title, ENT_QUOTES, get_bloginfo( 'charset' ) ); |
|
56 | - $array['content'] = $this->get_content(); |
|
57 | - $array['active'] = $this->active(); |
|
58 | - $array['instanceNumber'] = $this->instance_number; |
|
55 | + $array[ 'title' ] = html_entity_decode( $this->title, ENT_QUOTES, get_bloginfo( 'charset' ) ); |
|
56 | + $array[ 'content' ] = $this->get_content(); |
|
57 | + $array[ 'active' ] = $this->active(); |
|
58 | + $array[ 'instanceNumber' ] = $this->instance_number; |
|
59 | 59 | |
60 | - $array['customizeAction'] = esc_html__( 'Customizing', 'kirki' ); |
|
60 | + $array[ 'customizeAction' ] = esc_html__( 'Customizing', 'kirki' ); |
|
61 | 61 | if ( $this->panel ) { |
62 | 62 | /* translators: The title. */ |
63 | - $array['customizeAction'] = sprintf( esc_html__( 'Customizing ▸ %s', 'kirki' ), esc_html( $this->manager->get_panel( $this->panel )->title ) ); |
|
63 | + $array[ 'customizeAction' ] = sprintf( esc_html__( 'Customizing ▸ %s', 'kirki' ), esc_html( $this->manager->get_panel( $this->panel )->title ) ); |
|
64 | 64 | } |
65 | 65 | return $array; |
66 | 66 | } |
@@ -65,10 +65,10 @@ discard block |
||
65 | 65 | */ |
66 | 66 | public function custom_css() { |
67 | 67 | $config = apply_filters( 'kirki_config', array() ); |
68 | - if ( ! isset( $config['color_accent'] ) && ! isset( $config['color_back'] ) ) { |
|
68 | + if ( ! isset( $config[ 'color_accent' ] ) && ! isset( $config[ 'color_back' ] ) ) { |
|
69 | 69 | return; |
70 | 70 | } |
71 | - $back = isset( $config['color_back'] ) ? $config['color_back'] : false; |
|
71 | + $back = isset( $config[ 'color_back' ] ) ? $config[ 'color_back' ] : false; |
|
72 | 72 | |
73 | 73 | $text_on_back = ''; |
74 | 74 | $border_on_back = ''; |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | $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 ); |
91 | 91 | $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 ); |
92 | 92 | } |
93 | - $accent = ( isset( $config['color_accent'] ) ) ? $config['color_accent'] : false; |
|
93 | + $accent = ( isset( $config[ 'color_accent' ] ) ) ? $config[ 'color_accent' ] : false; |
|
94 | 94 | if ( $accent ) { |
95 | 95 | $accent_obj = ariColor::newColor( $accent ); |
96 | 96 | $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 ); |
@@ -402,18 +402,18 @@ discard block |
||
402 | 402 | color: #444 !important; |
403 | 403 | } |
404 | 404 | |
405 | - <?php if ( isset( $config['width'] ) ) : ?> |
|
405 | + <?php if ( isset( $config[ 'width' ] ) ) : ?> |
|
406 | 406 | .wp-full-overlay-sidebar { |
407 | - width: <?php echo esc_html( $config['width'] ); ?>; |
|
407 | + width: <?php echo esc_html( $config[ 'width' ] ); ?>; |
|
408 | 408 | } |
409 | 409 | .expanded .wp-full-overlay-footer { |
410 | - width: <?php echo esc_html( $config['width'] ); ?>; |
|
410 | + width: <?php echo esc_html( $config[ 'width' ] ); ?>; |
|
411 | 411 | } |
412 | 412 | .wp-full-overlay.expanded { |
413 | - margin-left: <?php echo esc_html( $config['width'] ); ?>; |
|
413 | + margin-left: <?php echo esc_html( $config[ 'width' ] ); ?>; |
|
414 | 414 | } |
415 | 415 | .wp-full-overlay.collapsed .wp-full-overlay-sidebar { |
416 | - margin-left: -<?php echo esc_html( $config['width'] ); ?>; |
|
416 | + margin-left: -<?php echo esc_html( $config[ 'width' ] ); ?>; |
|
417 | 417 | } |
418 | 418 | <?php endif; ?> |
419 | 419 | </style> |
@@ -75,13 +75,13 @@ |
||
75 | 75 | private function parse_fields() { |
76 | 76 | $fields = Kirki::$fields; |
77 | 77 | foreach ( $fields as $field ) { |
78 | - if ( isset( $field['tooltip'] ) && ! empty( $field['tooltip'] ) ) { |
|
78 | + if ( isset( $field[ 'tooltip' ] ) && ! empty( $field[ 'tooltip' ] ) ) { |
|
79 | 79 | // Get the control ID and properly format it for the tooltips. |
80 | - $id = str_replace( '[', '-', str_replace( ']', '', $field['settings'] ) ); |
|
80 | + $id = str_replace( '[', '-', str_replace( ']', '', $field[ 'settings' ] ) ); |
|
81 | 81 | // Add the tooltips content. |
82 | 82 | $this->tooltips_content[ $id ] = array( |
83 | 83 | 'id' => $id, |
84 | - 'content' => $field['tooltip'], |
|
84 | + 'content' => $field[ 'tooltip' ], |
|
85 | 85 | ); |
86 | 86 | } |
87 | 87 | } |
@@ -34,7 +34,7 @@ |
||
34 | 34 | */ |
35 | 35 | public function to_json() { |
36 | 36 | parent::to_json(); |
37 | - $this->json['icons'] = Kirki_Helper::get_dashicons(); |
|
37 | + $this->json[ 'icons' ] = Kirki_Helper::get_dashicons(); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | /** |
@@ -83,28 +83,28 @@ discard block |
||
83 | 83 | |
84 | 84 | if ( empty( $this->button_label ) ) { |
85 | 85 | /* translators: %s represents the label of the row. */ |
86 | - $this->button_label = sprintf( esc_html__( 'Add new %s', 'kirki' ), $this->row_label['value'] ); |
|
86 | + $this->button_label = sprintf( esc_html__( 'Add new %s', 'kirki' ), $this->row_label[ 'value' ] ); |
|
87 | 87 | } |
88 | 88 | |
89 | - if ( empty( $args['fields'] ) || ! is_array( $args['fields'] ) ) { |
|
90 | - $args['fields'] = array(); |
|
89 | + if ( empty( $args[ 'fields' ] ) || ! is_array( $args[ 'fields' ] ) ) { |
|
90 | + $args[ 'fields' ] = array(); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | // An array to store keys of fields that need to be filtered. |
94 | 94 | $media_fields_to_filter = array(); |
95 | 95 | |
96 | - foreach ( $args['fields'] as $key => $value ) { |
|
97 | - if ( ! isset( $value['default'] ) ) { |
|
98 | - $args['fields'][ $key ]['default'] = ''; |
|
96 | + foreach ( $args[ 'fields' ] as $key => $value ) { |
|
97 | + if ( ! isset( $value[ 'default' ] ) ) { |
|
98 | + $args[ 'fields' ][ $key ][ 'default' ] = ''; |
|
99 | 99 | } |
100 | - if ( ! isset( $value['label'] ) ) { |
|
101 | - $args['fields'][ $key ]['label'] = ''; |
|
100 | + if ( ! isset( $value[ 'label' ] ) ) { |
|
101 | + $args[ 'fields' ][ $key ][ 'label' ] = ''; |
|
102 | 102 | } |
103 | - $args['fields'][ $key ]['id'] = $key; |
|
103 | + $args[ 'fields' ][ $key ][ 'id' ] = $key; |
|
104 | 104 | |
105 | 105 | // We check if the filed is an uploaded media ( image , file, video, etc.. ). |
106 | - if ( isset( $value['type'] ) ) { |
|
107 | - switch ( $value['type'] ) { |
|
106 | + if ( isset( $value[ 'type' ] ) ) { |
|
107 | + switch ( $value[ 'type' ] ) { |
|
108 | 108 | case 'image': |
109 | 109 | case 'cropped_image': |
110 | 110 | case 'upload': |
@@ -127,14 +127,14 @@ discard block |
||
127 | 127 | ); |
128 | 128 | |
129 | 129 | // Hackily add in the data link parameter. |
130 | - $dropdown = str_replace( '<select', '<select data-field="' . esc_attr( $args['fields'][ $key ]['id'] ) . '"' . $this->get_link(), $dropdown ); // phpcs:ignore Generic.Formatting.MultipleStatementAlignment.NotSameWarning |
|
131 | - $args['fields'][ $key ]['dropdown'] = $dropdown; |
|
130 | + $dropdown = str_replace( '<select', '<select data-field="' . esc_attr( $args[ 'fields' ][ $key ][ 'id' ] ) . '"' . $this->get_link(), $dropdown ); // phpcs:ignore Generic.Formatting.MultipleStatementAlignment.NotSameWarning |
|
131 | + $args[ 'fields' ][ $key ][ 'dropdown' ] = $dropdown; |
|
132 | 132 | break; |
133 | 133 | } |
134 | 134 | } |
135 | 135 | } |
136 | 136 | |
137 | - $this->fields = $args['fields']; |
|
137 | + $this->fields = $args[ 'fields' ]; |
|
138 | 138 | |
139 | 139 | // Now we are going to filter the fields. |
140 | 140 | // First we create a copy of the value that would be used otherwise. |
@@ -194,14 +194,14 @@ discard block |
||
194 | 194 | |
195 | 195 | $fields = $this->fields; |
196 | 196 | |
197 | - $this->json['fields'] = $fields; |
|
198 | - $this->json['row_label'] = $this->row_label; |
|
197 | + $this->json[ 'fields' ] = $fields; |
|
198 | + $this->json[ 'row_label' ] = $this->row_label; |
|
199 | 199 | |
200 | 200 | // If filtered_value has been set and is not empty we use it instead of the actual value. |
201 | 201 | if ( is_array( $this->filtered_value ) && ! empty( $this->filtered_value ) ) { |
202 | - $this->json['value'] = $this->filtered_value; |
|
202 | + $this->json[ 'value' ] = $this->filtered_value; |
|
203 | 203 | } |
204 | - $this->json['value'] = apply_filters( "kirki_controls_repeater_value_{$this->id}", $this->json['value'] ); |
|
204 | + $this->json[ 'value' ] = apply_filters( "kirki_controls_repeater_value_{$this->id}", $this->json[ 'value' ] ); |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | /** |
@@ -224,9 +224,9 @@ discard block |
||
224 | 224 | |
225 | 225 | <ul class="repeater-fields"></ul> |
226 | 226 | |
227 | - <?php if ( isset( $this->choices['limit'] ) ) : ?> |
|
227 | + <?php if ( isset( $this->choices[ 'limit' ] ) ) : ?> |
|
228 | 228 | <?php /* translators: %s represents the number of rows we're limiting the repeater to allow. */ ?> |
229 | - <p class="limit"><?php printf( esc_html__( 'Limit: %s rows', 'kirki' ), esc_html( $this->choices['limit'] ) ); ?></p> |
|
229 | + <p class="limit"><?php printf( esc_html__( 'Limit: %s rows', 'kirki' ), esc_html( $this->choices[ 'limit' ] ) ); ?></p> |
|
230 | 230 | <?php endif; ?> |
231 | 231 | <button class="button-secondary repeater-add"><?php echo esc_html( $this->button_label ); ?></button> |
232 | 232 | |
@@ -459,24 +459,24 @@ discard block |
||
459 | 459 | protected function row_label( $args ) { |
460 | 460 | |
461 | 461 | // Validating args for row labels. |
462 | - if ( isset( $args['row_label'] ) && is_array( $args['row_label'] ) && ! empty( $args['row_label'] ) ) { |
|
462 | + if ( isset( $args[ 'row_label' ] ) && is_array( $args[ 'row_label' ] ) && ! empty( $args[ 'row_label' ] ) ) { |
|
463 | 463 | |
464 | 464 | // Validating row label type. |
465 | - if ( isset( $args['row_label']['type'] ) && ( 'text' === $args['row_label']['type'] || 'field' === $args['row_label']['type'] ) ) { |
|
466 | - $this->row_label['type'] = $args['row_label']['type']; |
|
465 | + if ( isset( $args[ 'row_label' ][ 'type' ] ) && ( 'text' === $args[ 'row_label' ][ 'type' ] || 'field' === $args[ 'row_label' ][ 'type' ] ) ) { |
|
466 | + $this->row_label[ 'type' ] = $args[ 'row_label' ][ 'type' ]; |
|
467 | 467 | } |
468 | 468 | |
469 | 469 | // Validating row label type. |
470 | - if ( isset( $args['row_label']['value'] ) && ! empty( $args['row_label']['value'] ) ) { |
|
471 | - $this->row_label['value'] = esc_html( $args['row_label']['value'] ); |
|
470 | + if ( isset( $args[ 'row_label' ][ 'value' ] ) && ! empty( $args[ 'row_label' ][ 'value' ] ) ) { |
|
471 | + $this->row_label[ 'value' ] = esc_html( $args[ 'row_label' ][ 'value' ] ); |
|
472 | 472 | } |
473 | 473 | |
474 | 474 | // Validating row label field. |
475 | - if ( isset( $args['row_label']['field'] ) && ! empty( $args['row_label']['field'] ) && isset( $args['fields'][ sanitize_key( $args['row_label']['field'] ) ] ) ) { |
|
476 | - $this->row_label['field'] = esc_html( $args['row_label']['field'] ); |
|
475 | + if ( isset( $args[ 'row_label' ][ 'field' ] ) && ! empty( $args[ 'row_label' ][ 'field' ] ) && isset( $args[ 'fields' ][ sanitize_key( $args[ 'row_label' ][ 'field' ] ) ] ) ) { |
|
476 | + $this->row_label[ 'field' ] = esc_html( $args[ 'row_label' ][ 'field' ] ); |
|
477 | 477 | } else { |
478 | 478 | // If from field is not set correctly, making sure standard is set as the type. |
479 | - $this->row_label['type'] = 'text'; |
|
479 | + $this->row_label[ 'type' ] = 'text'; |
|
480 | 480 | } |
481 | 481 | } |
482 | 482 | } |
@@ -161,55 +161,55 @@ |
||
161 | 161 | parent::to_json(); |
162 | 162 | |
163 | 163 | // Default value. |
164 | - $this->json['default'] = $this->setting->default; |
|
164 | + $this->json[ 'default' ] = $this->setting->default; |
|
165 | 165 | if ( isset( $this->default ) ) { |
166 | - $this->json['default'] = $this->default; |
|
166 | + $this->json[ 'default' ] = $this->default; |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | // Required. |
170 | - $this->json['required'] = $this->required; |
|
170 | + $this->json[ 'required' ] = $this->required; |
|
171 | 171 | |
172 | 172 | // Output. |
173 | - $this->json['output'] = $this->output; |
|
173 | + $this->json[ 'output' ] = $this->output; |
|
174 | 174 | |
175 | 175 | // Value. |
176 | - $this->json['value'] = $this->value(); |
|
176 | + $this->json[ 'value' ] = $this->value(); |
|
177 | 177 | |
178 | 178 | // Choices. |
179 | - $this->json['choices'] = $this->choices; |
|
179 | + $this->json[ 'choices' ] = $this->choices; |
|
180 | 180 | |
181 | 181 | // The link. |
182 | - $this->json['link'] = $this->get_link(); |
|
182 | + $this->json[ 'link' ] = $this->get_link(); |
|
183 | 183 | |
184 | 184 | // The ID. |
185 | - $this->json['id'] = $this->id; |
|
185 | + $this->json[ 'id' ] = $this->id; |
|
186 | 186 | |
187 | 187 | // Translation strings. |
188 | - $this->json['l10n'] = $this->l10n(); |
|
188 | + $this->json[ 'l10n' ] = $this->l10n(); |
|
189 | 189 | |
190 | 190 | // The ajaxurl in case we need it. |
191 | - $this->json['ajaxurl'] = admin_url( 'admin-ajax.php' ); |
|
191 | + $this->json[ 'ajaxurl' ] = admin_url( 'admin-ajax.php' ); |
|
192 | 192 | |
193 | 193 | // Input attributes. |
194 | - $this->json['inputAttrs'] = ''; |
|
194 | + $this->json[ 'inputAttrs' ] = ''; |
|
195 | 195 | foreach ( $this->input_attrs as $attr => $value ) { |
196 | - $this->json['inputAttrs'] .= $attr . '="' . esc_attr( $value ) . '" '; |
|
196 | + $this->json[ 'inputAttrs' ] .= $attr . '="' . esc_attr( $value ) . '" '; |
|
197 | 197 | } |
198 | 198 | |
199 | 199 | // The kirki-config. |
200 | - $this->json['kirkiConfig'] = $this->kirki_config; |
|
200 | + $this->json[ 'kirkiConfig' ] = $this->kirki_config; |
|
201 | 201 | |
202 | 202 | // The option-type. |
203 | - $this->json['kirkiOptionType'] = $this->option_type; |
|
203 | + $this->json[ 'kirkiOptionType' ] = $this->option_type; |
|
204 | 204 | |
205 | 205 | // The option-name. |
206 | - $this->json['kirkiOptionName'] = $this->option_name; |
|
206 | + $this->json[ 'kirkiOptionName' ] = $this->option_name; |
|
207 | 207 | |
208 | 208 | // The preset. |
209 | - $this->json['preset'] = $this->preset; |
|
209 | + $this->json[ 'preset' ] = $this->preset; |
|
210 | 210 | |
211 | 211 | // The CSS-Variables. |
212 | - $this->json['css-var'] = $this->css_vars; |
|
212 | + $this->json[ 'css-var' ] = $this->css_vars; |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | /** |
@@ -52,7 +52,7 @@ |
||
52 | 52 | */ |
53 | 53 | public function to_json() { |
54 | 54 | parent::to_json(); |
55 | - $this->json['multiple'] = $this->multiple; |
|
56 | - $this->json['placeholder'] = $this->placeholder; |
|
55 | + $this->json[ 'multiple' ] = $this->multiple; |
|
56 | + $this->json[ 'placeholder' ] = $this->placeholder; |
|
57 | 57 | } |
58 | 58 | } |