@@ -47,7 +47,7 @@ |
||
47 | 47 | $output['suffix'] = ( isset( $output['suffix'] ) ) ? $output['suffix'] : ''; |
48 | 48 | |
49 | 49 | // Create the styles. |
50 | - $this->styles[ $output['media_query'] ][ $output['element'] ][ $property ] = $sub_value . $output['suffix']; |
|
50 | + $this->styles[$output['media_query']][$output['element']][$property] = $sub_value . $output['suffix']; |
|
51 | 51 | |
52 | 52 | } |
53 | 53 | } |
@@ -93,7 +93,7 @@ |
||
93 | 93 | * Returns an array of paths where translation files may be located. |
94 | 94 | * |
95 | 95 | * @access protected |
96 | - * @return array |
|
96 | + * @return string[] |
|
97 | 97 | */ |
98 | 98 | protected function get_paths() { |
99 | 99 |
@@ -117,9 +117,9 @@ |
||
117 | 117 | public function override_load_textdomain( $override, $domain, $mofile ) { |
118 | 118 | |
119 | 119 | global $l10n; |
120 | - if ( isset( $l10n[ $this->get_theme_textdomain() ] ) ) { |
|
120 | + if ( isset( $l10n[$this->get_theme_textdomain()] ) ) { |
|
121 | 121 | // @codingStandardsIgnoreLine WordPress.Variables.GlobalVariables.OverrideProhibited |
122 | - $l10n['kirki'] = $l10n[ $this->get_theme_textdomain() ]; |
|
122 | + $l10n['kirki'] = $l10n[$this->get_theme_textdomain()]; |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | // Check if the domain is "kirki". |
@@ -200,10 +200,13 @@ |
||
200 | 200 | </div> |
201 | 201 | <?php if ( Kirki_Util::get_wp_version() >= 4.9 ) : ?> |
202 | 202 | <input class="background-hidden-value" type="hidden" {{{ data.link }}}> |
203 | - <?php else : ?> |
|
203 | + <?php else { |
|
204 | + : ?> |
|
204 | 205 | <# valueJSON = JSON.stringify( data.value ).replace( /'/g, ''' ); #> |
205 | 206 | <input class="background-hidden-value" type="hidden" value='{{{ valueJSON }}}' {{{ data.link }}}> |
206 | - <?php endif; ?> |
|
207 | + <?php endif; |
|
208 | +} |
|
209 | +?> |
|
207 | 210 | <?php |
208 | 211 | } |
209 | 212 | } |
@@ -54,8 +54,8 @@ discard block |
||
54 | 54 | } |
55 | 55 | |
56 | 56 | // Check if we've got it cached and ready. |
57 | - if ( isset( $this->cached_paths[ $class_name ] ) && file_exists( $this->cached_paths[ $class_name ] ) ) { |
|
58 | - include_once $this->cached_paths[ $class_name ]; |
|
57 | + if ( isset( $this->cached_paths[$class_name] ) && file_exists( $this->cached_paths[$class_name] ) ) { |
|
58 | + include_once $this->cached_paths[$class_name]; |
|
59 | 59 | return; |
60 | 60 | } |
61 | 61 | |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | foreach ( $paths as $path ) { |
65 | 65 | $path = wp_normalize_path( $path ); |
66 | 66 | if ( file_exists( $path ) ) { |
67 | - $this->cached_paths[ $class_name ] = $path; |
|
67 | + $this->cached_paths[$class_name] = $path; |
|
68 | 68 | include_once $path; |
69 | 69 | return; |
70 | 70 | } |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | |
100 | 100 | // Handle controls loading. |
101 | 101 | if ( 'Control' === $name_parts[0] || 'Settings' === $name_parts[0] ) { |
102 | - $path = dirname( __FILE__ ) . '/controls/php/'; |
|
102 | + $path = dirname( __FILE__ ) . '/controls/php/'; |
|
103 | 103 | $paths[] = $path . $filename; |
104 | 104 | } |
105 | 105 | } |
@@ -113,8 +113,8 @@ 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; |
|
117 | - $previous_path .= strtolower( $exploded[ $i ] ) . '/'; |
|
116 | + $paths[] = dirname( __FILE__ ) . '/' . $previous_path . strtolower( $exploded[$i] ) . '/' . $filename; |
|
117 | + $previous_path .= strtolower( $exploded[$i] ) . '/'; |
|
118 | 118 | } |
119 | 119 | return $paths; |
120 | 120 | } |
@@ -52,12 +52,12 @@ discard block |
||
52 | 52 | |
53 | 53 | if ( is_array( $this->json['value'] ) ) { |
54 | 54 | foreach ( array_keys( $this->json['value'] ) as $key ) { |
55 | - if ( ! in_array( $key, array( 'variant', 'font-weight', 'font-style' ), true ) && ! isset( $this->json['default'][ $key ] ) ) { |
|
56 | - unset( $this->json['value'][ $key ] ); |
|
55 | + if ( ! in_array( $key, array( 'variant', 'font-weight', 'font-style' ), true ) && ! isset( $this->json['default'][$key] ) ) { |
|
56 | + unset( $this->json['value'][$key] ); |
|
57 | 57 | } |
58 | 58 | // Fix for https://github.com/aristath/kirki/issues/1405. |
59 | - if ( isset( $this->json['default'][ $key ] ) && false === $this->json['default'][ $key ] ) { |
|
60 | - unset( $this->json['value'][ $key ] ); |
|
59 | + if ( isset( $this->json['default'][$key] ) && false === $this->json['default'][$key] ) { |
|
60 | + unset( $this->json['value'][$key] ); |
|
61 | 61 | } |
62 | 62 | } |
63 | 63 | } |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | if ( is_string( $variant ) ) { |
258 | 258 | $final_variants[] = array( |
259 | 259 | 'id' => $variant, |
260 | - 'label' => isset( $all_variants[ $variant ] ) ? $all_variants[ $variant ] : $variant, |
|
260 | + 'label' => isset( $all_variants[$variant] ) ? $all_variants[$variant] : $variant, |
|
261 | 261 | ); |
262 | 262 | } elseif ( is_array( $variant ) && isset( $variant['id'] ) && isset( $variant['label'] ) ) { |
263 | 263 | $final_variants[] = $variant; |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | if ( array_key_exists( $variant, $all_variants ) ) { |
339 | 339 | $available_variants[] = array( |
340 | 340 | 'id' => $variant, |
341 | - 'label' => $all_variants[ $variant ], |
|
341 | + 'label' => $all_variants[$variant], |
|
342 | 342 | ); |
343 | 343 | } |
344 | 344 | } |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | if ( array_key_exists( $subset, $all_subsets ) ) { |
351 | 351 | $available_subsets[] = array( |
352 | 352 | 'id' => $subset, |
353 | - 'label' => $all_subsets[ $subset ], |
|
353 | + 'label' => $all_subsets[$subset], |
|
354 | 354 | ); |
355 | 355 | } |
356 | 356 | } |
@@ -73,23 +73,23 @@ discard block |
||
73 | 73 | // Kirki does not exist, continue with our custom implementation. |
74 | 74 | // Get the default value of the field. |
75 | 75 | $default = ''; |
76 | - if ( isset( self::$fields[ $field_id ] ) && isset( self::$fields[ $field_id ]['default'] ) ) { |
|
77 | - $default = self::$fields[ $field_id ]['default']; |
|
76 | + if ( isset( self::$fields[$field_id] ) && isset( self::$fields[$field_id]['default'] ) ) { |
|
77 | + $default = self::$fields[$field_id]['default']; |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | // Make sure the config is defined. |
81 | - if ( isset( self::$config[ $config_id ] ) ) { |
|
82 | - if ( 'option' == self::$config[ $config_id ]['option_type'] ) { |
|
81 | + if ( isset( self::$config[$config_id] ) ) { |
|
82 | + if ( 'option' == self::$config[$config_id]['option_type'] ) { |
|
83 | 83 | |
84 | 84 | // check if we're using serialized options. |
85 | - if ( isset( self::$config[ $config_id ]['option_name'] ) && ! empty( self::$config[ $config_id ]['option_name'] ) ) { |
|
85 | + if ( isset( self::$config[$config_id]['option_name'] ) && ! empty( self::$config[$config_id]['option_name'] ) ) { |
|
86 | 86 | |
87 | 87 | // Get all our options. |
88 | - $all_options = get_option( self::$config[ $config_id ]['option_name'], array() ); |
|
88 | + $all_options = get_option( self::$config[$config_id]['option_name'], array() ); |
|
89 | 89 | |
90 | 90 | // If our option is not saved, return the default value. |
91 | 91 | // If option was set, return its value unserialized. |
92 | - return ( ! isset( $all_options[ $field_id ] ) ) ? $default : maybe_unserialize( $all_options[ $field_id ] ); |
|
92 | + return ( ! isset( $all_options[$field_id] ) ) ? $default : maybe_unserialize( $all_options[$field_id] ); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | // If we're not using serialized options, get the value and return it. |
@@ -148,11 +148,11 @@ discard block |
||
148 | 148 | } |
149 | 149 | |
150 | 150 | // Kirki does not exist, set the config arguments. |
151 | - $config[ $config_id ] = $args; |
|
151 | + $config[$config_id] = $args; |
|
152 | 152 | |
153 | 153 | // Make sure an option_type is defined. |
154 | - if ( ! isset( self::$config[ $config_id ]['option_type'] ) ) { |
|
155 | - self::$config[ $config_id ]['option_type'] = 'theme_mod'; |
|
154 | + if ( ! isset( self::$config[$config_id]['option_type'] ) ) { |
|
155 | + self::$config[$config_id]['option_type'] = 'theme_mod'; |
|
156 | 156 | } |
157 | 157 | } |
158 | 158 | |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | if ( ! isset( $args['kirki_config'] ) ) { |
181 | 181 | $args['kirki_config'] = $config_id; |
182 | 182 | } |
183 | - self::$fields[ $args['settings'] ] = $args; |
|
183 | + self::$fields[$args['settings']] = $args; |
|
184 | 184 | } |
185 | 185 | } |
186 | 186 | |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | if ( ! is_array( $value ) ) { |
265 | 265 | $value = str_replace( '$', $value, $output['value_pattern'] ); |
266 | 266 | if ( ! empty( $output['element'] ) && ! empty( $output['property'] ) ) { |
267 | - $css[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = $output['prefix'] . $value . $output['units'] . $output['suffix']; |
|
267 | + $css[$output['media_query']][$output['element']][$output['property']] = $output['prefix'] . $value . $output['units'] . $output['suffix']; |
|
268 | 268 | } |
269 | 269 | } else { |
270 | 270 | if ( 'typography' === $field['type'] ) { |
@@ -278,27 +278,27 @@ discard block |
||
278 | 278 | |
279 | 279 | // Add double quotes if needed to font-families. |
280 | 280 | if ( 'font-family' == $key && false !== strpos( $subvalue, ' ' ) && false === strpos( $subvalue, '"' ) ) { |
281 | - $css[ $output['media_query'] ][ $output['element'] ]['font-family'] = '"' . $subvalue . '"'; |
|
281 | + $css[$output['media_query']][$output['element']]['font-family'] = '"' . $subvalue . '"'; |
|
282 | 282 | } |
283 | 283 | |
284 | 284 | // Variants contain both font-weight & italics. |
285 | 285 | if ( 'variant' === $key ) { |
286 | 286 | $font_weight = str_replace( 'italic', '', $subvalue ); |
287 | 287 | $font_weight = ( in_array( $font_weight, array( '', 'regular' ) ) ) ? '400' : $font_weight; |
288 | - $css[ $output['media_query'] ][ $output['element'] ]['font-weight'] = $font_weight; |
|
288 | + $css[$output['media_query']][$output['element']]['font-weight'] = $font_weight; |
|
289 | 289 | |
290 | 290 | // Is this italic? |
291 | 291 | if ( false !== strpos( $subvalue, 'italic' ) ) { |
292 | - $css[ $output['media_query'] ][ $output['element'] ]['font-style'] = 'italic'; |
|
292 | + $css[$output['media_query']][$output['element']]['font-style'] = 'italic'; |
|
293 | 293 | } |
294 | 294 | } else { |
295 | - $css[ $output['media_query'] ][ $output['element'] ][ $key ] = $subvalue; |
|
295 | + $css[$output['media_query']][$output['element']][$key] = $subvalue; |
|
296 | 296 | } |
297 | 297 | } |
298 | 298 | } elseif ( 'multicolor' == $field['type'] ) { |
299 | 299 | |
300 | 300 | if ( ! empty( $output['element'] ) && ! empty( $output['property'] ) && ! empty( $output['choice'] ) ) { |
301 | - $css[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = $output['prefix'] . $value[ $output['choice'] ] . $output['units'] . $output['suffix']; |
|
301 | + $css[$output['media_query']][$output['element']][$output['property']] = $output['prefix'] . $value[$output['choice']] . $output['units'] . $output['suffix']; |
|
302 | 302 | } |
303 | 303 | } else { |
304 | 304 | |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | $subvalue = 'url("' . $subvalue . '")'; |
314 | 314 | } |
315 | 315 | if ( $subvalue ) { |
316 | - $css[ $output['media_query'] ][ $output['element'] ][ $property ] = $subvalue; |
|
316 | + $css[$output['media_query']][$output['element']][$property] = $subvalue; |
|
317 | 317 | } |
318 | 318 | } |
319 | 319 | } |
@@ -55,8 +55,11 @@ |
||
55 | 55 | <a class="install-now button-primary button" data-slug="kirki" href="<?php echo esc_url_raw( $plugin_install_url ); ?>" aria-label="<?php esc_attr_e( 'Install Kirki Toolkit now', 'textdomain' ); ?>" data-name="Kirki Toolkit"> |
56 | 56 | <?php esc_html_e( 'Install Now', 'textdomain' ); ?> |
57 | 57 | </a> |
58 | - <?php else : ?> |
|
59 | - <p style="text-align:left;margin-top:0;"><?php esc_attr_e( 'You have installed Kirki. Activate it to take advantage of this theme\'s features in the customizer.', 'textdomain' ); ?></p> |
|
58 | + <?php else { |
|
59 | + : ?> |
|
60 | + <p style="text-align:left;margin-top:0;"><?php esc_attr_e( 'You have installed Kirki. Activate it to take advantage of this theme\'s features in the customizer.', 'textdomain' ); |
|
61 | +} |
|
62 | +?></p> |
|
60 | 63 | <a class="install-now button-secondary button change-theme" data-slug="kirki" href="<?php echo esc_url_raw( self_admin_url( 'plugins.php' ) ); ?>" aria-label="<?php esc_attr_e( 'Activate Kirki Toolkit now', 'textdomain' ); ?>" data-name="Kirki Toolkit"> |
61 | 64 | <?php esc_html_e( 'Activate Now', 'textdomain' ); ?> |
62 | 65 | </a> |
@@ -101,16 +101,16 @@ discard block |
||
101 | 101 | } |
102 | 102 | if ( is_array( $value ) ) { |
103 | 103 | foreach ( array_keys( $value ) as $value_k ) { |
104 | - if ( ! is_string( $value[ $value_k ] ) ) { |
|
104 | + if ( ! is_string( $value[$value_k] ) ) { |
|
105 | 105 | continue; |
106 | 106 | } |
107 | 107 | if ( isset( $output['choice'] ) ) { |
108 | 108 | if ( $output['choice'] === $value_k ) { |
109 | - $value[ $output['choice'] ] = str_replace( '$', $value[ $output['choice'] ], $output['value_pattern'] ); |
|
109 | + $value[$output['choice']] = str_replace( '$', $value[$output['choice']], $output['value_pattern'] ); |
|
110 | 110 | } |
111 | 111 | continue; |
112 | 112 | } |
113 | - $value[ $value_k ] = str_replace( '$', $value[ $value_k ], $output['value_pattern'] ); |
|
113 | + $value[$value_k] = str_replace( '$', $value[$value_k], $output['value_pattern'] ); |
|
114 | 114 | } |
115 | 115 | } |
116 | 116 | $value = $this->apply_pattern_replace( $output, $value ); |
@@ -140,16 +140,16 @@ discard block |
||
140 | 140 | if ( is_array( $options ) ) { |
141 | 141 | if ( $option_name ) { |
142 | 142 | $subkey = str_replace( array( $option_name, '[', ']' ), '', $replace ); |
143 | - $replacement = ( isset( $options[ $subkey ] ) ) ? $options[ $subkey ] : ''; |
|
143 | + $replacement = ( isset( $options[$subkey] ) ) ? $options[$subkey] : ''; |
|
144 | 144 | break; |
145 | 145 | } |
146 | - $replacement = ( isset( $options[ $replace ] ) ) ? $options[ $replace ] : ''; |
|
146 | + $replacement = ( isset( $options[$replace] ) ) ? $options[$replace] : ''; |
|
147 | 147 | break; |
148 | 148 | } |
149 | 149 | $replacement = get_option( $replace ); |
150 | 150 | break; |
151 | 151 | case 'site_option': |
152 | - $replacement = ( is_array( $options ) && isset( $options[ $replace ] ) ) ? $options[ $replace ] : get_site_option( $replace ); |
|
152 | + $replacement = ( is_array( $options ) && isset( $options[$replace] ) ) ? $options[$replace] : get_site_option( $replace ); |
|
153 | 153 | break; |
154 | 154 | case 'user_meta': |
155 | 155 | $user_id = get_current_user_id(); |
@@ -164,10 +164,10 @@ discard block |
||
164 | 164 | $replacement = ( false === $replacement ) ? '' : $replacement; |
165 | 165 | if ( is_array( $value ) ) { |
166 | 166 | foreach ( $value as $k => $v ) { |
167 | - if ( isset( $value[ $v ] ) ) { |
|
168 | - $value[ $k ] = str_replace( $search, $replacement, $value[ $v ] ); |
|
167 | + if ( isset( $value[$v] ) ) { |
|
168 | + $value[$k] = str_replace( $search, $replacement, $value[$v] ); |
|
169 | 169 | } else { |
170 | - $value[ $k ] = str_replace( $search, $replacement, $v ); |
|
170 | + $value[$k] = str_replace( $search, $replacement, $v ); |
|
171 | 171 | } |
172 | 172 | } |
173 | 173 | return $value; |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | } |
211 | 211 | // If 'choice' is defined check for sub-values too. |
212 | 212 | // Fixes https://github.com/aristath/kirki/issues/1416. |
213 | - if ( isset( $output['choice'] ) && isset( $value[ $output['choice'] ] ) && $exclude == $value[ $output['choice'] ] ) { |
|
213 | + if ( isset( $output['choice'] ) && isset( $value[$output['choice']] ) && $exclude == $value[$output['choice']] ) { |
|
214 | 214 | $skip = true; |
215 | 215 | } |
216 | 216 | } |
@@ -268,13 +268,13 @@ discard block |
||
268 | 268 | 'background', |
269 | 269 | ); |
270 | 270 | if ( in_array( $output['property'], $accepts_multiple, true ) ) { |
271 | - if ( isset( $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] ) && ! is_array( $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] ) ) { |
|
272 | - $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = (array) $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ]; |
|
271 | + if ( isset( $this->styles[$output['media_query']][$output['element']][$output['property']] ) && ! is_array( $this->styles[$output['media_query']][$output['element']][$output['property']] ) ) { |
|
272 | + $this->styles[$output['media_query']][$output['element']][$output['property']] = (array) $this->styles[$output['media_query']][$output['element']][$output['property']]; |
|
273 | 273 | } |
274 | - $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ][] = $output['prefix'] . $value . $output['units'] . $output['suffix']; |
|
274 | + $this->styles[$output['media_query']][$output['element']][$output['property']][] = $output['prefix'] . $value . $output['units'] . $output['suffix']; |
|
275 | 275 | return; |
276 | 276 | } |
277 | - $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = $output['prefix'] . $this->process_property_value( $output['property'], $value ) . $output['units'] . $output['suffix']; |
|
277 | + $this->styles[$output['media_query']][$output['element']][$output['property']] = $output['prefix'] . $this->process_property_value( $output['property'], $value ) . $output['units'] . $output['suffix']; |
|
278 | 278 | } |
279 | 279 | |
280 | 280 | /** |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | ) |
297 | 297 | ); |
298 | 298 | if ( array_key_exists( $property, $properties ) ) { |
299 | - $classname = $properties[ $property ]; |
|
299 | + $classname = $properties[$property]; |
|
300 | 300 | $obj = new $classname( $property, $value ); |
301 | 301 | return $obj->get_value(); |
302 | 302 | } |
@@ -257,13 +257,13 @@ discard block |
||
257 | 257 | |
258 | 258 | // Get the config arguments, and merge them with the defaults. |
259 | 259 | $config_defaults = ( isset( Kirki::$config['global'] ) ) ? Kirki::$config['global'] : array(); |
260 | - if ( 'global' !== $this->kirki_config && isset( Kirki::$config[ $this->kirki_config ] ) ) { |
|
261 | - $config_defaults = Kirki::$config[ $this->kirki_config ]; |
|
260 | + if ( 'global' !== $this->kirki_config && isset( Kirki::$config[$this->kirki_config] ) ) { |
|
261 | + $config_defaults = Kirki::$config[$this->kirki_config]; |
|
262 | 262 | } |
263 | 263 | $config_defaults = ( is_array( $config_defaults ) ) ? $config_defaults : array(); |
264 | 264 | foreach ( $config_defaults as $key => $value ) { |
265 | - if ( isset( $defaults[ $key ] ) && ! empty( $value ) && $value !== $defaults[ $key ] ) { |
|
266 | - $defaults[ $key ] = $value; |
|
265 | + if ( isset( $defaults[$key] ) && ! empty( $value ) && $value !== $defaults[$key] ) { |
|
266 | + $defaults[$key] = $value; |
|
267 | 267 | } |
268 | 268 | } |
269 | 269 | |
@@ -308,11 +308,11 @@ discard block |
||
308 | 308 | // Get all arguments with their values. |
309 | 309 | $args = get_object_vars( $this ); |
310 | 310 | foreach ( array_keys( $args ) as $key ) { |
311 | - $args[ $key ] = $this->$key; |
|
311 | + $args[$key] = $this->$key; |
|
312 | 312 | } |
313 | 313 | |
314 | 314 | // Add the field to the static $fields variable properly indexed. |
315 | - Kirki::$fields[ $this->settings ] = $args; |
|
315 | + Kirki::$fields[$this->settings] = $args; |
|
316 | 316 | |
317 | 317 | } |
318 | 318 | |
@@ -407,7 +407,7 @@ discard block |
||
407 | 407 | if ( ! is_array( $args ) || ! isset( $args['selector'] ) || ! isset( $args['render_callback'] ) || ! is_callable( $args['render_callback'] ) ) { |
408 | 408 | /* translators: %1$s represents the field ID where the error occurs. */ |
409 | 409 | _doing_it_wrong( __METHOD__, sprintf( esc_attr__( '"partial_refresh" invalid entry in field %s', 'kirki' ), esc_attr( $this->settings ) ), '3.0.10' ); |
410 | - unset( $this->partial_refresh[ $id ] ); |
|
410 | + unset( $this->partial_refresh[$id] ); |
|
411 | 411 | continue; |
412 | 412 | } |
413 | 413 | } |
@@ -435,10 +435,10 @@ discard block |
||
435 | 435 | } |
436 | 436 | $settings = array(); |
437 | 437 | foreach ( $this->settings as $setting_key => $setting_value ) { |
438 | - $settings[ $setting_key ] = $setting_value; |
|
438 | + $settings[$setting_key] = $setting_value; |
|
439 | 439 | // If we're using serialized options then we need to spice this up. |
440 | 440 | if ( 'option' === $this->option_type && '' !== $this->option_name && ( false === strpos( $setting_key, '[' ) ) ) { |
441 | - $settings[ $setting_key ] = "{$this->option_name}[{$setting_value}]"; |
|
441 | + $settings[$setting_key] = "{$this->option_name}[{$setting_value}]"; |
|
442 | 442 | } |
443 | 443 | } |
444 | 444 | $this->settings = $settings; |
@@ -550,27 +550,27 @@ discard block |
||
550 | 550 | } |
551 | 551 | foreach ( $this->output as $key => $output ) { |
552 | 552 | if ( empty( $output ) || ! isset( $output['element'] ) ) { |
553 | - unset( $this->output[ $key ] ); |
|
553 | + unset( $this->output[$key] ); |
|
554 | 554 | continue; |
555 | 555 | } |
556 | 556 | if ( ! isset( $output['sanitize_callback'] ) && isset( $output['callback'] ) ) { |
557 | - $this->output[ $key ]['sanitize_callback'] = $output['callback']; |
|
557 | + $this->output[$key]['sanitize_callback'] = $output['callback']; |
|
558 | 558 | } |
559 | 559 | // Convert element arrays to strings. |
560 | 560 | if ( isset( $output['element'] ) && is_array( $output['element'] ) ) { |
561 | - $this->output[ $key ]['element'] = array_unique( $this->output[ $key ]['element'] ); |
|
562 | - sort( $this->output[ $key ]['element'] ); |
|
561 | + $this->output[$key]['element'] = array_unique( $this->output[$key]['element'] ); |
|
562 | + sort( $this->output[$key]['element'] ); |
|
563 | 563 | |
564 | 564 | // Trim each element in the array. |
565 | - foreach ( $this->output[ $key ]['element'] as $index => $element ) { |
|
566 | - $this->output[ $key ]['element'][ $index ] = trim( $element ); |
|
565 | + foreach ( $this->output[$key]['element'] as $index => $element ) { |
|
566 | + $this->output[$key]['element'][$index] = trim( $element ); |
|
567 | 567 | } |
568 | - $this->output[ $key ]['element'] = implode( ',', $this->output[ $key ]['element'] ); |
|
568 | + $this->output[$key]['element'] = implode( ',', $this->output[$key]['element'] ); |
|
569 | 569 | } |
570 | 570 | |
571 | 571 | // Fix for https://github.com/aristath/kirki/issues/1659#issuecomment-346229751. |
572 | - $this->output[ $key ]['element'] = str_replace( array( "\t", "\n", "\r", "\0", "\x0B" ), ' ', $this->output[ $key ]['element'] ); |
|
573 | - $this->output[ $key ]['element'] = trim( preg_replace( '/\s+/', ' ', $this->output[ $key ]['element'] ) ); |
|
572 | + $this->output[$key]['element'] = str_replace( array( "\t", "\n", "\r", "\0", "\x0B" ), ' ', $this->output[$key]['element'] ); |
|
573 | + $this->output[$key]['element'] = trim( preg_replace( '/\s+/', ' ', $this->output[$key]['element'] ) ); |
|
574 | 574 | } |
575 | 575 | } |
576 | 576 |