@@ -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 | } |
@@ -42,7 +42,7 @@ |
||
42 | 42 | */ |
43 | 43 | public function to_json() { |
44 | 44 | parent::to_json(); |
45 | - $this->json['alpha'] = (bool) $this->alpha; |
|
45 | + $this->json[ 'alpha' ] = (bool) $this->alpha; |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | /** |
@@ -36,10 +36,10 @@ |
||
36 | 36 | parent::to_json(); |
37 | 37 | foreach ( $this->input_attrs as $attr => $value ) { |
38 | 38 | if ( 'style' !== $attr ) { |
39 | - $this->json['inputAttrs'] .= $attr . '="' . esc_attr( $value ) . '" '; |
|
39 | + $this->json[ 'inputAttrs' ] .= $attr . '="' . esc_attr( $value ) . '" '; |
|
40 | 40 | continue; |
41 | 41 | } |
42 | - $this->json['labelStyle'] = 'style="' . esc_attr( $value ) . '" '; |
|
42 | + $this->json[ 'labelStyle' ] = 'style="' . esc_attr( $value ) . '" '; |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | } |
@@ -36,8 +36,8 @@ |
||
36 | 36 | */ |
37 | 37 | public function to_json() { |
38 | 38 | parent::to_json(); |
39 | - $this->json['choices'] = wp_parse_args( |
|
40 | - $this->json['choices'], array( |
|
39 | + $this->json[ 'choices' ] = wp_parse_args( |
|
40 | + $this->json[ 'choices' ], array( |
|
41 | 41 | 'min' => '0', |
42 | 42 | 'max' => '100', |
43 | 43 | 'step' => '1', |
@@ -23,8 +23,8 @@ |
||
23 | 23 | if ( ! is_array( $this->choices ) ) { |
24 | 24 | $this->choices = array(); |
25 | 25 | } |
26 | - $this->choices['element'] = 'input'; |
|
27 | - $this->choices['type'] = 'text'; |
|
26 | + $this->choices[ 'element' ] = 'input'; |
|
27 | + $this->choices[ 'type' ] = 'text'; |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | /** |
@@ -97,14 +97,14 @@ discard block |
||
97 | 97 | } |
98 | 98 | |
99 | 99 | // Get the subfield-type. |
100 | - if ( ! isset( $this->fields[ $subfield_id ]['type'] ) ) { |
|
100 | + if ( ! isset( $this->fields[ $subfield_id ][ 'type' ] ) ) { |
|
101 | 101 | continue; |
102 | 102 | } |
103 | - $subfield_type = $this->fields[ $subfield_id ]['type']; |
|
103 | + $subfield_type = $this->fields[ $subfield_id ][ 'type' ]; |
|
104 | 104 | |
105 | 105 | // Allow using a sanitize-callback on a per-field basis. |
106 | - if ( isset( $this->fields[ $subfield_id ]['sanitize_callback'] ) ) { |
|
107 | - $subfield_value = call_user_func( $this->fields[ $subfield_id ]['sanitize_callback'], $subfield_value ); |
|
106 | + if ( isset( $this->fields[ $subfield_id ][ 'sanitize_callback' ] ) ) { |
|
107 | + $subfield_value = call_user_func( $this->fields[ $subfield_id ][ 'sanitize_callback' ], $subfield_value ); |
|
108 | 108 | } else { |
109 | 109 | |
110 | 110 | switch ( $subfield_type ) { |
@@ -139,11 +139,11 @@ discard block |
||
139 | 139 | $subfield_value = (bool) $subfield_value; |
140 | 140 | break; |
141 | 141 | case 'select': |
142 | - if ( isset( $this->fields[ $subfield_id ]['multiple'] ) ) { |
|
143 | - if ( true === $this->fields[ $subfield_id ]['multiple'] ) { |
|
142 | + if ( isset( $this->fields[ $subfield_id ][ 'multiple' ] ) ) { |
|
143 | + if ( true === $this->fields[ $subfield_id ][ 'multiple' ] ) { |
|
144 | 144 | $multiple = 2; |
145 | 145 | } |
146 | - $multiple = (int) $this->fields[ $subfield_id ]['multiple']; |
|
146 | + $multiple = (int) $this->fields[ $subfield_id ][ 'multiple' ]; |
|
147 | 147 | if ( 1 < $multiple ) { |
148 | 148 | $subfield_value = (array) $subfield_value; |
149 | 149 | foreach ( $subfield_value as $sub_subfield_key => $sub_subfield_value ) { |
@@ -61,10 +61,10 @@ |
||
61 | 61 | * @access protected |
62 | 62 | */ |
63 | 63 | protected function set_choices() { |
64 | - $this->choices['controls'] = array(); |
|
64 | + $this->choices[ 'controls' ] = array(); |
|
65 | 65 | if ( is_array( $this->default ) ) { |
66 | 66 | foreach ( $this->default as $key => $value ) { |
67 | - $this->choices['controls'][ $key ] = true; |
|
67 | + $this->choices[ 'controls' ][ $key ] = true; |
|
68 | 68 | } |
69 | 69 | } |
70 | 70 | } |
@@ -50,12 +50,12 @@ discard block |
||
50 | 50 | return array(); |
51 | 51 | } |
52 | 52 | return array( |
53 | - 'background-color' => ( isset( $value['background-color'] ) ) ? sanitize_text_field( $value['background-color'] ) : '', |
|
54 | - 'background-image' => ( isset( $value['background-image'] ) ) ? esc_url_raw( $value['background-image'] ) : '', |
|
55 | - 'background-repeat' => ( isset( $value['background-repeat'] ) ) ? sanitize_text_field( $value['background-repeat'] ) : '', |
|
56 | - 'background-position' => ( isset( $value['background-position'] ) ) ? sanitize_text_field( $value['background-position'] ) : '', |
|
57 | - 'background-size' => ( isset( $value['background-size'] ) ) ? sanitize_text_field( $value['background-size'] ) : '', |
|
58 | - 'background-attachment' => ( isset( $value['background-attachment'] ) ) ? sanitize_text_field( $value['background-attachment'] ) : '', |
|
53 | + 'background-color' => ( isset( $value[ 'background-color' ] ) ) ? sanitize_text_field( $value[ 'background-color' ] ) : '', |
|
54 | + 'background-image' => ( isset( $value[ 'background-image' ] ) ) ? esc_url_raw( $value[ 'background-image' ] ) : '', |
|
55 | + 'background-repeat' => ( isset( $value[ 'background-repeat' ] ) ) ? sanitize_text_field( $value[ 'background-repeat' ] ) : '', |
|
56 | + 'background-position' => ( isset( $value[ 'background-position' ] ) ) ? sanitize_text_field( $value[ 'background-position' ] ) : '', |
|
57 | + 'background-size' => ( isset( $value[ 'background-size' ] ) ) ? sanitize_text_field( $value[ 'background-size' ] ) : '', |
|
58 | + 'background-attachment' => ( isset( $value[ 'background-attachment' ] ) ) ? sanitize_text_field( $value[ 'background-attachment' ] ) : '', |
|
59 | 59 | ); |
60 | 60 | } |
61 | 61 | |
@@ -89,20 +89,20 @@ discard block |
||
89 | 89 | foreach ( $this->output as $output ) { |
90 | 90 | |
91 | 91 | // If 'element' is not defined, skip this. |
92 | - if ( ! isset( $output['element'] ) ) { |
|
92 | + if ( ! isset( $output[ 'element' ] ) ) { |
|
93 | 93 | continue; |
94 | 94 | } |
95 | - if ( is_array( $output['element'] ) ) { |
|
96 | - $output['element'] = implode( ',', $output['element'] ); |
|
95 | + if ( is_array( $output[ 'element' ] ) ) { |
|
96 | + $output[ 'element' ] = implode( ',', $output[ 'element' ] ); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | // If there's a sanitize_callback defined, skip this. |
100 | - if ( isset( $output['sanitize_callback'] ) && ! empty( $output['sanitize_callback'] ) ) { |
|
100 | + if ( isset( $output[ 'sanitize_callback' ] ) && ! empty( $output[ 'sanitize_callback' ] ) ) { |
|
101 | 101 | continue; |
102 | 102 | } |
103 | 103 | |
104 | 104 | // If we got this far, it's safe to add this. |
105 | - $js_vars[] = $output; |
|
105 | + $js_vars[ ] = $output; |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | // Did we manage to get all the items from 'output'? |