@@ -176,8 +176,8 @@ discard block |
||
| 176 | 176 | |
| 177 | 177 | // Fix for https://github.com/aristath/kirki/issues/1405. |
| 178 | 178 | foreach ( $this->json['value'] as $key => $val ) { |
| 179 | - if ( isset( $this->json['default'][ $key ] ) && false === $this->json['default'][ $key ] ) { |
|
| 180 | - unset( $this->json['value'][ $key ] ); |
|
| 179 | + if ( isset( $this->json['default'][$key] ) && false === $this->json['default'][$key] ) { |
|
| 180 | + unset( $this->json['value'][$key] ); |
|
| 181 | 181 | } |
| 182 | 182 | } |
| 183 | 183 | $this->json['show_variants'] = ( true === Kirki_Fonts_Google::$force_load_all_variants ) ? false : true; |
@@ -361,7 +361,7 @@ discard block |
||
| 361 | 361 | if ( is_string( $variant ) ) { |
| 362 | 362 | $final_variants[] = array( |
| 363 | 363 | 'id' => $variant, |
| 364 | - 'label' => isset( $all_variants[ $variant ] ) ? $all_variants[ $variant ] : $variant, |
|
| 364 | + 'label' => isset( $all_variants[$variant] ) ? $all_variants[$variant] : $variant, |
|
| 365 | 365 | ); |
| 366 | 366 | } elseif ( is_array( $variant ) && isset( $variant['id'] ) && isset( $variant['label'] ) ) { |
| 367 | 367 | $final_variants[] = $variant; |
@@ -436,7 +436,7 @@ discard block |
||
| 436 | 436 | if ( array_key_exists( $variant, $all_variants ) ) { |
| 437 | 437 | $available_variants[] = array( |
| 438 | 438 | 'id' => $variant, |
| 439 | - 'label' => $all_variants[ $variant ], |
|
| 439 | + 'label' => $all_variants[$variant], |
|
| 440 | 440 | ); |
| 441 | 441 | } |
| 442 | 442 | } |
@@ -448,7 +448,7 @@ discard block |
||
| 448 | 448 | if ( array_key_exists( $subset, $all_subsets ) ) { |
| 449 | 449 | $available_subsets[] = array( |
| 450 | 450 | 'id' => $subset, |
| 451 | - 'label' => $all_subsets[ $subset ], |
|
| 451 | + 'label' => $all_subsets[$subset], |
|
| 452 | 452 | ); |
| 453 | 453 | } |
| 454 | 454 | } |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | if ( class_exists( $module_class ) ) { |
| 88 | 88 | // Use this syntax instead of $module_class::get_instance() |
| 89 | 89 | // for PHP 5.2 compatibility. |
| 90 | - self::$active_modules[ $key ] = call_user_func( array( $module_class, 'get_instance' ) ); |
|
| 90 | + self::$active_modules[$key] = call_user_func( array( $module_class, 'get_instance' ) ); |
|
| 91 | 91 | } |
| 92 | 92 | } |
| 93 | 93 | } |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | |
| 121 | 121 | $key = array_search( $module, self::$modules, true ); |
| 122 | 122 | if ( false !== $key ) { |
| 123 | - unset( self::$modules[ $key ] ); |
|
| 123 | + unset( self::$modules[$key] ); |
|
| 124 | 124 | } |
| 125 | 125 | } |
| 126 | 126 | |
@@ -118,9 +118,9 @@ |
||
| 118 | 118 | // If we have a variable_callback defined then get the value of the option |
| 119 | 119 | // and run it through the callback function. |
| 120 | 120 | // If no callback is defined (false) then just get the value. |
| 121 | - $variables[ $variable_name ] = Kirki::get_option( $field['settings'] ); |
|
| 121 | + $variables[$variable_name] = Kirki::get_option( $field['settings'] ); |
|
| 122 | 122 | if ( $variable_callback ) { |
| 123 | - $variables[ $variable_name ] = call_user_func( $field_variable['callback'], Kirki::get_option( $field['settings'] ) ); |
|
| 123 | + $variables[$variable_name] = call_user_func( $field_variable['callback'], Kirki::get_option( $field['settings'] ) ); |
|
| 124 | 124 | } |
| 125 | 125 | } |
| 126 | 126 | } |
@@ -77,25 +77,25 @@ |
||
| 77 | 77 | foreach ( array( 'start', 'end' ) as $context ) { |
| 78 | 78 | |
| 79 | 79 | // Make sure value is array. |
| 80 | - if ( ! isset( $value[ $context ] ) ) { |
|
| 81 | - $value[ $context ] = array(); |
|
| 80 | + if ( ! isset( $value[$context] ) ) { |
|
| 81 | + $value[$context] = array(); |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | // Make sure color is defined. |
| 85 | - if ( ! isset( $value[ $context ]['color'] ) ) { |
|
| 86 | - $value[ $context ]['color'] = ''; |
|
| 85 | + if ( ! isset( $value[$context]['color'] ) ) { |
|
| 86 | + $value[$context]['color'] = ''; |
|
| 87 | 87 | } |
| 88 | 88 | // Sanitize colors. |
| 89 | - $color_obj = ariColor::newColor( $value[ $context ]['color'] ); |
|
| 90 | - $value[ $context ]['color'] = $color_obj->toCSS( $color_obj->mode ); |
|
| 89 | + $color_obj = ariColor::newColor( $value[$context]['color'] ); |
|
| 90 | + $value[$context]['color'] = $color_obj->toCSS( $color_obj->mode ); |
|
| 91 | 91 | |
| 92 | 92 | // Make sure position is defined. |
| 93 | - if ( ! isset( $value[ $context ]['position'] ) ) { |
|
| 94 | - $value[ $context ]['position'] = 0; |
|
| 93 | + if ( ! isset( $value[$context]['position'] ) ) { |
|
| 94 | + $value[$context]['position'] = 0; |
|
| 95 | 95 | }; |
| 96 | 96 | // Sanitize positions. |
| 97 | - $value[ $context ]['position'] = (int) $value[ $context ]['position']; |
|
| 98 | - $value[ $context ]['position'] = max( min( $value[ $context ]['position'], 100 ), 0 ); |
|
| 97 | + $value[$context]['position'] = (int) $value[$context]['position']; |
|
| 98 | + $value[$context]['position'] = max( min( $value[$context]['position'], 100 ), 0 ); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | // Make siure angle exists. |
@@ -179,7 +179,7 @@ |
||
| 179 | 179 | case 'letter-spacing': |
| 180 | 180 | case 'word-spacing': |
| 181 | 181 | case 'line-height': |
| 182 | - $value[ $key ] = Kirki_Sanitize_Values::css_dimension( $val ); |
|
| 182 | + $value[$key] = Kirki_Sanitize_Values::css_dimension( $val ); |
|
| 183 | 183 | break; |
| 184 | 184 | case 'text-align': |
| 185 | 185 | if ( ! in_array( $val, array( 'inherit', 'left', 'center', 'right', 'justify' ), true ) ) { |
@@ -38,14 +38,14 @@ |
||
| 38 | 38 | |
| 39 | 39 | $output['media_query'] = ( isset( $output['media_query'] ) ) ? $output['media_query'] : 'global'; |
| 40 | 40 | |
| 41 | - $this->styles[ $output['media_query'] ][ $output['element'] ]['background'] = $value['start']['color']; |
|
| 41 | + $this->styles[$output['media_query']][$output['element']]['background'] = $value['start']['color']; |
|
| 42 | 42 | switch ( $value['mode'] ) { |
| 43 | 43 | |
| 44 | 44 | case 'linear': |
| 45 | - $this->styles[ $output['media_query'] ][ $output['element'] ]['background'] = 'linear-gradient(' . intval( $value['angle'] ) . 'deg, ' . $value['start']['color'] . ' ' . $value['start']['position'] . '%,' . $value['end']['color'] . ' ' . $value['end']['position'] . '%)'; |
|
| 45 | + $this->styles[$output['media_query']][$output['element']]['background'] = 'linear-gradient(' . intval( $value['angle'] ) . 'deg, ' . $value['start']['color'] . ' ' . $value['start']['position'] . '%,' . $value['end']['color'] . ' ' . $value['end']['position'] . '%)'; |
|
| 46 | 46 | break; |
| 47 | 47 | case 'radial': |
| 48 | - $this->styles[ $output['media_query'] ][ $output['element'] ]['background'] = 'radial-gradient(ellipse at center,' . $value['start']['color'] . ' ' . $value['start']['position'] . '%,' . $value['end']['color'] . ' ' . $value['end']['position'] . '%)'; |
|
| 48 | + $this->styles[$output['media_query']][$output['element']]['background'] = 'radial-gradient(ellipse at center,' . $value['start']['color'] . ' ' . $value['start']['position'] . '%,' . $value['end']['color'] . ' ' . $value['end']['position'] . '%)'; |
|
| 49 | 49 | break; |
| 50 | 50 | } |
| 51 | 51 | } |
@@ -101,19 +101,19 @@ discard block |
||
| 101 | 101 | $value = str_replace( '$', $value, $output['value_pattern'] ); |
| 102 | 102 | } |
| 103 | 103 | if ( is_array( $value ) ) { |
| 104 | - if ( isset( $output['choice'] ) && isset( $value[ $output['choice'] ] ) ) { |
|
| 105 | - $value[ $output['choice'] ] = str_replace( '$', $value[ $output['choice'] ], $output['value_pattern'] ); |
|
| 104 | + if ( isset( $output['choice'] ) && isset( $value[$output['choice']] ) ) { |
|
| 105 | + $value[$output['choice']] = str_replace( '$', $value[$output['choice']], $output['value_pattern'] ); |
|
| 106 | 106 | } else { |
| 107 | 107 | foreach ( $value as $k => $v ) { |
| 108 | - $value[ $k ] = str_replace( '$', $value[ $k ], $output['value_pattern'] ); |
|
| 108 | + $value[$k] = str_replace( '$', $value[$k], $output['value_pattern'] ); |
|
| 109 | 109 | } |
| 110 | 110 | } |
| 111 | 111 | } |
| 112 | 112 | if ( isset( $output['pattern_replace'] ) && is_array( $output['pattern_replace'] ) ) { |
| 113 | 113 | $option_type = 'theme_mod'; |
| 114 | 114 | $option_name = false; |
| 115 | - if ( isset( Kirki::$config[ $this->config_id ] ) ) { |
|
| 116 | - $config = Kirki::$config[ $this->config_id ]; |
|
| 115 | + if ( isset( Kirki::$config[$this->config_id] ) ) { |
|
| 116 | + $config = Kirki::$config[$this->config_id]; |
|
| 117 | 117 | $option_type = ( isset( $config['option_type'] ) ) ? $config['option_type'] : 'theme_mod'; |
| 118 | 118 | if ( 'option' === $option_type || 'site_option' === $option_type ) { |
| 119 | 119 | $option_name = ( isset( $config['option_name'] ) ) ? $config['option_name'] : false; |
@@ -129,16 +129,16 @@ discard block |
||
| 129 | 129 | if ( is_array( $options ) ) { |
| 130 | 130 | if ( $option_name ) { |
| 131 | 131 | $subkey = str_replace( array( $option_name, '[', ']' ), '', $replace ); |
| 132 | - $replacement = ( isset( $options[ $subkey ] ) ) ? $options[ $subkey ] : ''; |
|
| 132 | + $replacement = ( isset( $options[$subkey] ) ) ? $options[$subkey] : ''; |
|
| 133 | 133 | break; |
| 134 | 134 | } |
| 135 | - $replacement = ( isset( $options[ $replace ] ) ) ? $options[ $replace ] : ''; |
|
| 135 | + $replacement = ( isset( $options[$replace] ) ) ? $options[$replace] : ''; |
|
| 136 | 136 | break; |
| 137 | 137 | } |
| 138 | 138 | $replacement = get_option( $replace ); |
| 139 | 139 | break; |
| 140 | 140 | case 'site_option': |
| 141 | - $replacement = ( is_array( $options ) && isset( $options[ $replace ] ) ) ? $options[ $replace ] : get_site_option( $replace ); |
|
| 141 | + $replacement = ( is_array( $options ) && isset( $options[$replace] ) ) ? $options[$replace] : get_site_option( $replace ); |
|
| 142 | 142 | break; |
| 143 | 143 | case 'user_meta': |
| 144 | 144 | $user_id = get_current_user_id(); |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | $replacement = ( false === $replacement ) ? '' : $replacement; |
| 154 | 154 | if ( is_array( $value ) ) { |
| 155 | 155 | foreach ( $value as $k => $v ) { |
| 156 | - $value[ $k ] = str_replace( $search, $replacement, $value[ $v ] ); |
|
| 156 | + $value[$k] = str_replace( $search, $replacement, $value[$v] ); |
|
| 157 | 157 | } |
| 158 | 158 | return $value; |
| 159 | 159 | } |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | } |
| 199 | 199 | // If 'choice' is defined check for sub-values too. |
| 200 | 200 | // Fixes https://github.com/aristath/kirki/issues/1416. |
| 201 | - if ( isset( $output['choice'] ) && isset( $value[ $output['choice'] ] ) && $exclude == $value[ $output['choice'] ] ) { |
|
| 201 | + if ( isset( $output['choice'] ) && isset( $value[$output['choice']] ) && $exclude == $value[$output['choice']] ) { |
|
| 202 | 202 | $skip = true; |
| 203 | 203 | } |
| 204 | 204 | } |
@@ -244,9 +244,9 @@ discard block |
||
| 244 | 244 | return; |
| 245 | 245 | } |
| 246 | 246 | $output['media_query'] = ( isset( $output['media_query'] ) ) ? $output['media_query'] : 'global'; |
| 247 | - $output['prefix'] = ( isset( $output['prefix'] ) ) ? $output['prefix'] : ''; |
|
| 248 | - $output['units'] = ( isset( $output['units'] ) ) ? $output['units'] : ''; |
|
| 249 | - $output['suffix'] = ( isset( $output['suffix'] ) ) ? $output['suffix'] : ''; |
|
| 247 | + $output['prefix'] = ( isset( $output['prefix'] ) ) ? $output['prefix'] : ''; |
|
| 248 | + $output['units'] = ( isset( $output['units'] ) ) ? $output['units'] : ''; |
|
| 249 | + $output['suffix'] = ( isset( $output['suffix'] ) ) ? $output['suffix'] : ''; |
|
| 250 | 250 | |
| 251 | 251 | // Properties that can accept multiple values. |
| 252 | 252 | // Useful for example for gradients where all browsers use the "background-image" property |
@@ -256,13 +256,13 @@ discard block |
||
| 256 | 256 | 'background', |
| 257 | 257 | ); |
| 258 | 258 | if ( in_array( $output['property'], $accepts_multiple, true ) ) { |
| 259 | - if ( isset( $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] ) && ! is_array( $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] ) ) { |
|
| 260 | - $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = (array) $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ]; |
|
| 259 | + if ( isset( $this->styles[$output['media_query']][$output['element']][$output['property']] ) && ! is_array( $this->styles[$output['media_query']][$output['element']][$output['property']] ) ) { |
|
| 260 | + $this->styles[$output['media_query']][$output['element']][$output['property']] = (array) $this->styles[$output['media_query']][$output['element']][$output['property']]; |
|
| 261 | 261 | } |
| 262 | - $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ][] = $output['prefix'] . $value . $output['units'] . $output['suffix']; |
|
| 262 | + $this->styles[$output['media_query']][$output['element']][$output['property']][] = $output['prefix'] . $value . $output['units'] . $output['suffix']; |
|
| 263 | 263 | return; |
| 264 | 264 | } |
| 265 | - $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = $output['prefix'] . $value . $output['units'] . $output['suffix']; |
|
| 265 | + $this->styles[$output['media_query']][$output['element']][$output['property']] = $output['prefix'] . $value . $output['units'] . $output['suffix']; |
|
| 266 | 266 | } |
| 267 | 267 | |
| 268 | 268 | /** |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | 'background-position' => 'Kirki_Output_Property_Background_Position', |
| 283 | 283 | ) ); |
| 284 | 284 | if ( array_key_exists( $property, $properties ) ) { |
| 285 | - $classname = $properties[ $property ]; |
|
| 285 | + $classname = $properties[$property]; |
|
| 286 | 286 | $obj = new $classname( $property, $value ); |
| 287 | 287 | return $obj->get_value(); |
| 288 | 288 | } |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | $this->control_types = $this->default_control_types( apply_filters( 'kirki/control_types', $this->control_types ) ); |
| 168 | 168 | foreach ( $this->control_types as $key => $classname ) { |
| 169 | 169 | if ( ! class_exists( $classname ) ) { |
| 170 | - unset( $control_types[ $key ] ); |
|
| 170 | + unset( $control_types[$key] ); |
|
| 171 | 171 | } |
| 172 | 172 | } |
| 173 | 173 | |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | foreach ( Kirki::$panels as $panel_args ) { |
| 194 | 194 | // Extra checks for nested panels. |
| 195 | 195 | if ( isset( $panel_args['panel'] ) ) { |
| 196 | - if ( isset( Kirki::$panels[ $panel_args['panel'] ] ) ) { |
|
| 196 | + if ( isset( Kirki::$panels[$panel_args['panel']] ) ) { |
|
| 197 | 197 | // Set the type to nested. |
| 198 | 198 | $panel_args['type'] = 'kirki-nested'; |
| 199 | 199 | } |
@@ -215,11 +215,11 @@ discard block |
||
| 215 | 215 | foreach ( Kirki::$sections as $section_args ) { |
| 216 | 216 | // Extra checks for nested sections. |
| 217 | 217 | if ( isset( $section_args['section'] ) ) { |
| 218 | - if ( isset( Kirki::$sections[ $section_args['section'] ] ) ) { |
|
| 218 | + if ( isset( Kirki::$sections[$section_args['section']] ) ) { |
|
| 219 | 219 | // Set the type to nested. |
| 220 | 220 | $section_args['type'] = 'kirki-nested'; |
| 221 | 221 | // We need to check if the parent section is nested inside a panel. |
| 222 | - $parent_section = Kirki::$sections[ $section_args['section'] ]; |
|
| 222 | + $parent_section = Kirki::$sections[$section_args['section']]; |
|
| 223 | 223 | if ( isset( $parent_section['panel'] ) ) { |
| 224 | 224 | $section_args['panel'] = $parent_section['panel']; |
| 225 | 225 | } |
@@ -335,13 +335,13 @@ discard block |
||
| 335 | 335 | |
| 336 | 336 | // Get the config arguments, and merge them with the defaults. |
| 337 | 337 | $config_defaults = ( isset( Kirki::$config['global'] ) ) ? Kirki::$config['global'] : array(); |
| 338 | - if ( 'global' !== $this->kirki_config && isset( Kirki::$config[ $this->kirki_config ] ) ) { |
|
| 339 | - $config_defaults = Kirki::$config[ $this->kirki_config ]; |
|
| 338 | + if ( 'global' !== $this->kirki_config && isset( Kirki::$config[$this->kirki_config] ) ) { |
|
| 339 | + $config_defaults = Kirki::$config[$this->kirki_config]; |
|
| 340 | 340 | } |
| 341 | 341 | $config_defaults = ( is_array( $config_defaults ) ) ? $config_defaults : array(); |
| 342 | 342 | foreach ( $config_defaults as $key => $value ) { |
| 343 | - if ( isset( $defaults[ $key ] ) && ! empty( $value ) && $value != $defaults[ $key ] ) { |
|
| 344 | - $defaults[ $key ] = $value; |
|
| 343 | + if ( isset( $defaults[$key] ) && ! empty( $value ) && $value != $defaults[$key] ) { |
|
| 344 | + $defaults[$key] = $value; |
|
| 345 | 345 | } |
| 346 | 346 | } |
| 347 | 347 | |
@@ -378,8 +378,8 @@ discard block |
||
| 378 | 378 | // Remove any whitelisted properties from above. |
| 379 | 379 | // These will get a free pass, completely unfiltered. |
| 380 | 380 | foreach ( $whitelisted_properties as $key => $default_value ) { |
| 381 | - if ( isset( $properties[ $key ] ) ) { |
|
| 382 | - unset( $properties[ $key ] ); |
|
| 381 | + if ( isset( $properties[$key] ) ) { |
|
| 382 | + unset( $properties[$key] ); |
|
| 383 | 383 | } |
| 384 | 384 | } |
| 385 | 385 | |
@@ -411,7 +411,7 @@ discard block |
||
| 411 | 411 | // Get all arguments with their values. |
| 412 | 412 | $args = get_object_vars( $this ); |
| 413 | 413 | foreach ( $args as $key => $default_value ) { |
| 414 | - $args[ $key ] = $this->$key; |
|
| 414 | + $args[$key] = $this->$key; |
|
| 415 | 415 | } |
| 416 | 416 | |
| 417 | 417 | // Add the whitelisted properties through the back door. |
@@ -419,11 +419,11 @@ discard block |
||
| 419 | 419 | if ( ! isset( $this->$key ) ) { |
| 420 | 420 | $this->$key = $default_value; |
| 421 | 421 | } |
| 422 | - $args[ $key ] = $this->$key; |
|
| 422 | + $args[$key] = $this->$key; |
|
| 423 | 423 | } |
| 424 | 424 | |
| 425 | 425 | // Add the field to the static $fields variable properly indexed. |
| 426 | - Kirki::$fields[ $this->settings ] = $args; |
|
| 426 | + Kirki::$fields[$this->settings] = $args; |
|
| 427 | 427 | |
| 428 | 428 | } |
| 429 | 429 | |
@@ -530,7 +530,7 @@ discard block |
||
| 530 | 530 | if ( ! is_array( $args ) || ! isset( $args['selector'] ) || ! isset( $args['render_callback'] ) || ! is_callable( $args['render_callback'] ) ) { |
| 531 | 531 | /* translators: %1$s represents the field ID where the error occurs. */ |
| 532 | 532 | _doing_it_wrong( __METHOD__, sprintf( esc_attr__( '"partial_refresh" invalid entry in field %s', 'kirki' ), esc_attr( $this->settings ) ), '3.0.10' ); |
| 533 | - unset( $this->partial_refresh[ $id ] ); |
|
| 533 | + unset( $this->partial_refresh[$id] ); |
|
| 534 | 534 | continue; |
| 535 | 535 | } |
| 536 | 536 | } |
@@ -558,10 +558,10 @@ discard block |
||
| 558 | 558 | } |
| 559 | 559 | $settings = array(); |
| 560 | 560 | foreach ( $this->settings as $setting_key => $setting_value ) { |
| 561 | - $settings[ sanitize_key( $setting_key ) ] = esc_attr( $setting_value ); |
|
| 561 | + $settings[sanitize_key( $setting_key )] = esc_attr( $setting_value ); |
|
| 562 | 562 | // If we're using serialized options then we need to spice this up. |
| 563 | 563 | if ( 'option' === $this->option_type && '' !== $this->option_name && ( false === strpos( $setting_key, '[' ) ) ) { |
| 564 | - $settings[ sanitize_key( $setting_key ) ] = esc_attr( $this->option_name ) . '[' . esc_attr( $setting_value ) . ']'; |
|
| 564 | + $settings[sanitize_key( $setting_key )] = esc_attr( $this->option_name ) . '[' . esc_attr( $setting_value ) . ']'; |
|
| 565 | 565 | } |
| 566 | 566 | } |
| 567 | 567 | $this->settings = $settings; |