@@ -64,7 +64,7 @@ |
||
| 64 | 64 | |
| 65 | 65 | if ( is_array( $value ) ) { |
| 66 | 66 | foreach ( $value as $key => $subvalue ) { |
| 67 | - $value[ $key ] = esc_attr( $subvalue ); |
|
| 67 | + $value[$key] = esc_attr( $subvalue ); |
|
| 68 | 68 | } |
| 69 | 69 | return $value; |
| 70 | 70 | } |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | $class_name = 'WP_Customize_Control'; |
| 68 | 68 | // Get the classname from the array of control classnames. |
| 69 | 69 | if ( array_key_exists( $args['type'], $this->control_types ) ) { |
| 70 | - $class_name = $this->control_types[ $args['type'] ]; |
|
| 70 | + $class_name = $this->control_types[$args['type']]; |
|
| 71 | 71 | } |
| 72 | 72 | return $class_name; |
| 73 | 73 | |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | foreach ( $this->control_types as $key => $classname ) { |
| 134 | 134 | |
| 135 | 135 | if ( ! class_exists( $classname ) ) { |
| 136 | - unset( $this->control_types[ $key ] ); |
|
| 136 | + unset( $this->control_types[$key] ); |
|
| 137 | 137 | } |
| 138 | 138 | } |
| 139 | 139 | } |
@@ -43,73 +43,73 @@ discard block |
||
| 43 | 43 | $config_id = ( '' === $config_id ) ? 'global' : $config_id; |
| 44 | 44 | |
| 45 | 45 | // Fallback to 'global' if $config_id is not found. |
| 46 | - if ( ! isset( Kirki::$config[ $config_id ] ) ) { |
|
| 46 | + if ( ! isset( Kirki::$config[$config_id] ) ) { |
|
| 47 | 47 | $config_id = 'global'; |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | - if ( 'theme_mod' === Kirki::$config[ $config_id ]['option_type'] ) { |
|
| 50 | + if ( 'theme_mod' === Kirki::$config[$config_id]['option_type'] ) { |
|
| 51 | 51 | |
| 52 | 52 | // We're using theme_mods so just get the value using get_theme_mod. |
| 53 | 53 | $default_value = null; |
| 54 | - if ( isset( Kirki::$fields[ $field_id ] ) && isset( Kirki::$fields[ $field_id ]['default'] ) ) { |
|
| 55 | - $default_value = Kirki::$fields[ $field_id ]['default']; |
|
| 54 | + if ( isset( Kirki::$fields[$field_id] ) && isset( Kirki::$fields[$field_id]['default'] ) ) { |
|
| 55 | + $default_value = Kirki::$fields[$field_id]['default']; |
|
| 56 | 56 | } |
| 57 | 57 | $value = get_theme_mod( $field_id, $default_value ); |
| 58 | 58 | |
| 59 | 59 | // If the field is a background field, then get the sub-fields |
| 60 | 60 | // and return an array of the values. |
| 61 | - if ( isset( Kirki::$fields[ $field_id ] ) && isset( Kirki::$fields[ $field_id ]['type'] ) && 'background' === Kirki::$fields[ $field_id ]['type'] ) { |
|
| 61 | + if ( isset( Kirki::$fields[$field_id] ) && isset( Kirki::$fields[$field_id]['type'] ) && 'background' === Kirki::$fields[$field_id]['type'] ) { |
|
| 62 | 62 | $value = array(); |
| 63 | 63 | if ( null === $default_value ) { |
| 64 | 64 | $default_value = array(); |
| 65 | 65 | } |
| 66 | 66 | foreach ( $default_value as $property_key => $property_default ) { |
| 67 | - $value[ $property_key ] = get_theme_mod( $field_id . '_' . $property_key, $property_default ); |
|
| 67 | + $value[$property_key] = get_theme_mod( $field_id . '_' . $property_key, $property_default ); |
|
| 68 | 68 | } |
| 69 | 69 | } |
| 70 | - } elseif ( 'option' === Kirki::$config[ $config_id ]['option_type'] ) { |
|
| 70 | + } elseif ( 'option' === Kirki::$config[$config_id]['option_type'] ) { |
|
| 71 | 71 | |
| 72 | 72 | // We're using options. |
| 73 | - if ( '' !== Kirki::$config[ $config_id ]['option_name'] ) { |
|
| 73 | + if ( '' !== Kirki::$config[$config_id]['option_name'] ) { |
|
| 74 | 74 | |
| 75 | 75 | // Options are serialized as a single option in the db. |
| 76 | 76 | // We'll have to get the option and then get the item from the array. |
| 77 | - $options = get_option( Kirki::$config[ $config_id ]['option_name'] ); |
|
| 77 | + $options = get_option( Kirki::$config[$config_id]['option_name'] ); |
|
| 78 | 78 | |
| 79 | - if ( ! isset( Kirki::$fields[ $field_id ] ) && isset( Kirki::$fields[ Kirki::$config[ $config_id ]['option_name'] . '[' . $field_id . ']' ] ) ) { |
|
| 80 | - $field_id = Kirki::$config[ $config_id ]['option_name'] . '[' . $field_id . ']'; |
|
| 79 | + if ( ! isset( Kirki::$fields[$field_id] ) && isset( Kirki::$fields[Kirki::$config[$config_id]['option_name'] . '[' . $field_id . ']'] ) ) { |
|
| 80 | + $field_id = Kirki::$config[$config_id]['option_name'] . '[' . $field_id . ']'; |
|
| 81 | 81 | } |
| 82 | - $setting_modified = str_replace( ']', '', str_replace( Kirki::$config[ $config_id ]['option_name'] . '[', '', $field_id ) ); |
|
| 82 | + $setting_modified = str_replace( ']', '', str_replace( Kirki::$config[$config_id]['option_name'] . '[', '', $field_id ) ); |
|
| 83 | 83 | |
| 84 | 84 | // If this is a background field, get the individual sub-fields and return an array. |
| 85 | - if ( 'background' === Kirki::$fields[ $field_id ]['type'] ) { |
|
| 85 | + if ( 'background' === Kirki::$fields[$field_id]['type'] ) { |
|
| 86 | 86 | $value = array(); |
| 87 | 87 | |
| 88 | - foreach ( Kirki::$fields[ $field_id ]['default'] as $property => $property_default ) { |
|
| 88 | + foreach ( Kirki::$fields[$field_id]['default'] as $property => $property_default ) { |
|
| 89 | 89 | |
| 90 | - if ( isset( $options[ $setting_modified . '_' . $property ] ) ) { |
|
| 91 | - $value[ $property ] = $options[ $setting_modified . '_' . $property ]; |
|
| 90 | + if ( isset( $options[$setting_modified . '_' . $property] ) ) { |
|
| 91 | + $value[$property] = $options[$setting_modified . '_' . $property]; |
|
| 92 | 92 | } else { |
| 93 | - $value[ $property ] = $property_default; |
|
| 93 | + $value[$property] = $property_default; |
|
| 94 | 94 | } |
| 95 | 95 | } |
| 96 | 96 | } else { |
| 97 | 97 | |
| 98 | 98 | // This is not a background field so continue and get the value. |
| 99 | - $value = ( isset( $options[ $setting_modified ] ) ) ? $options[ $setting_modified ] : Kirki::$fields[ $field_id ]['default']; |
|
| 99 | + $value = ( isset( $options[$setting_modified] ) ) ? $options[$setting_modified] : Kirki::$fields[$field_id]['default']; |
|
| 100 | 100 | $value = maybe_unserialize( $value ); |
| 101 | 101 | } |
| 102 | 102 | } else { |
| 103 | 103 | |
| 104 | 104 | // Each option separately saved in the db. |
| 105 | - $value = get_option( $field_id, Kirki::$fields[ $field_id ]['default'] ); |
|
| 105 | + $value = get_option( $field_id, Kirki::$fields[$field_id]['default'] ); |
|
| 106 | 106 | |
| 107 | 107 | // If the field is a background field, then get the sub-fields. |
| 108 | 108 | // and return an array of the values. |
| 109 | - if ( 'background' === Kirki::$fields[ $field_id ]['type'] ) { |
|
| 109 | + if ( 'background' === Kirki::$fields[$field_id]['type'] ) { |
|
| 110 | 110 | $value = array(); |
| 111 | - foreach ( Kirki::$fields[ $field_id ]['default'] as $property_key => $property_default ) { |
|
| 112 | - $value[ $property_key ] = get_option( $field_id . '_' . $property_key, $property_default ); |
|
| 111 | + foreach ( Kirki::$fields[$field_id]['default'] as $property_key => $property_default ) { |
|
| 112 | + $value[$property_key] = get_option( $field_id . '_' . $property_key, $property_default ); |
|
| 113 | 113 | } |
| 114 | 114 | } |
| 115 | 115 | } |
@@ -135,8 +135,8 @@ discard block |
||
| 135 | 135 | if ( isset( $field['option_name'] ) && '' !== $field['option_name'] ) { |
| 136 | 136 | $all_values = get_option( $field['option_name'], array() ); |
| 137 | 137 | $sub_setting_id = str_replace( array( ']', $field['option_name'] . '[' ), '', $field['settings'] ); |
| 138 | - if ( isset( $all_values[ $sub_setting_id ] ) ) { |
|
| 139 | - $value = $all_values[ $sub_setting_id ]; |
|
| 138 | + if ( isset( $all_values[$sub_setting_id] ) ) { |
|
| 139 | + $value = $all_values[$sub_setting_id]; |
|
| 140 | 140 | } |
| 141 | 141 | } else { |
| 142 | 142 | $value = get_option( $field['settings'], $field['default'] ); |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | foreach ( $args as $key => $value ) { |
| 105 | 105 | // Is this property whitelisted? |
| 106 | 106 | if ( property_exists( $this, $key ) ) { |
| 107 | - $args[ $key ] = $value; |
|
| 107 | + $args[$key] = $value; |
|
| 108 | 108 | } |
| 109 | 109 | } |
| 110 | 110 | |
@@ -141,10 +141,10 @@ discard block |
||
| 141 | 141 | $id = ( '' === $id ) ? 'global' : $id; |
| 142 | 142 | |
| 143 | 143 | $id_md5 = md5( $id ); |
| 144 | - if ( ! isset( self::$instances[ $id_md5 ] ) ) { |
|
| 145 | - self::$instances[ $id_md5 ] = new self( $id, $args ); |
|
| 144 | + if ( ! isset( self::$instances[$id_md5] ) ) { |
|
| 145 | + self::$instances[$id_md5] = new self( $id, $args ); |
|
| 146 | 146 | } |
| 147 | - return self::$instances[ $id_md5 ]; |
|
| 147 | + return self::$instances[$id_md5]; |
|
| 148 | 148 | |
| 149 | 149 | } |
| 150 | 150 | |
@@ -120,7 +120,7 @@ |
||
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | // Return empty if there are no numbers in the value. |
| 123 | - if ( ! preg_match( '#[0-9]#' , $value ) ) { |
|
| 123 | + if ( ! preg_match( '#[0-9]#', $value ) ) { |
|
| 124 | 124 | return ''; |
| 125 | 125 | } |
| 126 | 126 | |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | if ( ! isset( $args['type'] ) || ! array_key_exists( $args['type'], $this->setting_types ) ) { |
| 70 | 70 | $args['type'] = 'default'; |
| 71 | 71 | } |
| 72 | - $classname = $this->setting_types[ $args['type'] ]; |
|
| 72 | + $classname = $this->setting_types[$args['type']]; |
|
| 73 | 73 | |
| 74 | 74 | // If settings are defined as an array, then we need to go through them |
| 75 | 75 | // and call add_setting for each one of them separately. |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | $args['default'] = array(); |
| 81 | 81 | } |
| 82 | 82 | foreach ( $args['settings'] as $key => $value ) { |
| 83 | - $default = ( isset( $defaults[ $key ] ) ) ? $defaults[ $key ] : ''; |
|
| 83 | + $default = ( isset( $defaults[$key] ) ) ? $defaults[$key] : ''; |
|
| 84 | 84 | $this->add_setting( $classname, $value, $default, $args['option_type'], $args['capability'], $args['transport'], $args['sanitize_callback'] ); |
| 85 | 85 | } |
| 86 | 86 | } |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | foreach ( $this->setting_types as $key => $classname ) { |
| 132 | 132 | |
| 133 | 133 | if ( ! class_exists( $classname ) ) { |
| 134 | - unset( $this->setting_types[ $key ] ); |
|
| 134 | + unset( $this->setting_types[$key] ); |
|
| 135 | 135 | } |
| 136 | 136 | } |
| 137 | 137 | } |
@@ -26,11 +26,11 @@ |
||
| 26 | 26 | $fields = Kirki::$fields; |
| 27 | 27 | |
| 28 | 28 | // Make sure the current object matches a registered field. |
| 29 | - if ( ! isset( $object->setting->id ) || ! isset( $fields[ $object->setting->id ] ) ) { |
|
| 29 | + if ( ! isset( $object->setting->id ) || ! isset( $fields[$object->setting->id] ) ) { |
|
| 30 | 30 | return true; |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | - $field = $fields[ $object->setting->id ]; |
|
| 33 | + $field = $fields[$object->setting->id]; |
|
| 34 | 34 | |
| 35 | 35 | if ( isset( $field['required'] ) ) { |
| 36 | 36 | |
@@ -330,14 +330,14 @@ discard block |
||
| 330 | 330 | |
| 331 | 331 | // Get the config arguments, and merge them with the defaults. |
| 332 | 332 | $config_defaults = ( isset( Kirki::$config['global'] ) ) ? Kirki::$config['global'] : array(); |
| 333 | - if ( 'global' !== $this->kirki_config && isset( Kirki::$config[ $this->kirki_config ] ) ) { |
|
| 334 | - $config_defaults = Kirki::$config[ $this->kirki_config ]; |
|
| 333 | + if ( 'global' !== $this->kirki_config && isset( Kirki::$config[$this->kirki_config] ) ) { |
|
| 334 | + $config_defaults = Kirki::$config[$this->kirki_config]; |
|
| 335 | 335 | } |
| 336 | 336 | $config_defaults = ( is_array( $config_defaults ) ) ? $config_defaults : array(); |
| 337 | 337 | foreach ( $config_defaults as $key => $value ) { |
| 338 | - if ( isset( $defaults[ $key ] ) ) { |
|
| 339 | - if ( ! empty( $value ) && $value != $defaults[ $key ] ) { |
|
| 340 | - $defaults[ $key ] = $value; |
|
| 338 | + if ( isset( $defaults[$key] ) ) { |
|
| 339 | + if ( ! empty( $value ) && $value != $defaults[$key] ) { |
|
| 340 | + $defaults[$key] = $value; |
|
| 341 | 341 | } |
| 342 | 342 | } |
| 343 | 343 | } |
@@ -375,8 +375,8 @@ discard block |
||
| 375 | 375 | // Remove any whitelisted properties from above. |
| 376 | 376 | // These will get a free pass, completely unfiltered. |
| 377 | 377 | foreach ( $whitelisted_properties as $key => $default_value ) { |
| 378 | - if ( isset( $properties[ $key ] ) ) { |
|
| 379 | - unset( $properties[ $key ] ); |
|
| 378 | + if ( isset( $properties[$key] ) ) { |
|
| 379 | + unset( $properties[$key] ); |
|
| 380 | 380 | } |
| 381 | 381 | } |
| 382 | 382 | |
@@ -408,7 +408,7 @@ discard block |
||
| 408 | 408 | // Get all arguments with their values. |
| 409 | 409 | $args = get_class_vars( __CLASS__ ); |
| 410 | 410 | foreach ( $args as $key => $default_value ) { |
| 411 | - $args[ $key ] = $this->$key; |
|
| 411 | + $args[$key] = $this->$key; |
|
| 412 | 412 | } |
| 413 | 413 | |
| 414 | 414 | // Add the whitelisted properties through the back door. |
@@ -416,11 +416,11 @@ discard block |
||
| 416 | 416 | if ( ! isset( $this->$key ) ) { |
| 417 | 417 | $this->$key = $default_value; |
| 418 | 418 | } |
| 419 | - $args[ $key ] = $this->$key; |
|
| 419 | + $args[$key] = $this->$key; |
|
| 420 | 420 | } |
| 421 | 421 | |
| 422 | 422 | // Add the field to the static $fields variable properly indexed. |
| 423 | - Kirki::$fields[ $this->settings ] = $args; |
|
| 423 | + Kirki::$fields[$this->settings] = $args; |
|
| 424 | 424 | |
| 425 | 425 | if ( 'background' === $this->type ) { |
| 426 | 426 | // Build the background fields. |
@@ -526,7 +526,7 @@ discard block |
||
| 526 | 526 | } |
| 527 | 527 | foreach ( $this->partial_refresh as $id => $args ) { |
| 528 | 528 | if ( ! is_array( $args ) || ! isset( $args['selector'] ) || ! isset( $args['render_callback'] ) || ! is_callable( $args['render_callback'] ) ) { |
| 529 | - unset( $this->partial_refresh[ $id ] ); |
|
| 529 | + unset( $this->partial_refresh[$id] ); |
|
| 530 | 530 | continue; |
| 531 | 531 | } |
| 532 | 532 | } |
@@ -552,10 +552,10 @@ discard block |
||
| 552 | 552 | } |
| 553 | 553 | $settings = array(); |
| 554 | 554 | foreach ( $this->settings as $setting_key => $setting_value ) { |
| 555 | - $settings[ sanitize_key( $setting_key ) ] = esc_attr( $setting_value ); |
|
| 555 | + $settings[sanitize_key( $setting_key )] = esc_attr( $setting_value ); |
|
| 556 | 556 | // If we're using serialized options then we need to spice this up. |
| 557 | 557 | if ( 'option' === $this->option_type && '' !== $this->option_name && ( false === strpos( $setting_key, '[' ) ) ) { |
| 558 | - $settings[ sanitize_key( $setting_key ) ] = esc_attr( $this->option_name ) . '[' . esc_attr( $setting_value ) . ']'; |
|
| 558 | + $settings[sanitize_key( $setting_key )] = esc_attr( $this->option_name ) . '[' . esc_attr( $setting_value ) . ']'; |
|
| 559 | 559 | } |
| 560 | 560 | } |
| 561 | 561 | $this->settings = $settings; |
@@ -655,7 +655,7 @@ discard block |
||
| 655 | 655 | ); |
| 656 | 656 | |
| 657 | 657 | if ( array_key_exists( $this->type, $default_callbacks ) ) { |
| 658 | - $this->sanitize_callback = $default_callbacks[ $this->type ]; |
|
| 658 | + $this->sanitize_callback = $default_callbacks[$this->type]; |
|
| 659 | 659 | } |
| 660 | 660 | |
| 661 | 661 | } |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | * @access public |
| 51 | 51 | * @var array |
| 52 | 52 | */ |
| 53 | - public static $config = array(); |
|
| 53 | + public static $config = array(); |
|
| 54 | 54 | |
| 55 | 55 | /** |
| 56 | 56 | * An array containing all fields. |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | * @access public |
| 60 | 60 | * @var array |
| 61 | 61 | */ |
| 62 | - public static $fields = array(); |
|
| 62 | + public static $fields = array(); |
|
| 63 | 63 | |
| 64 | 64 | /** |
| 65 | 65 | * An array containing all panels. |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | * @access public |
| 69 | 69 | * @var array |
| 70 | 70 | */ |
| 71 | - public static $panels = array(); |
|
| 71 | + public static $panels = array(); |
|
| 72 | 72 | |
| 73 | 73 | /** |
| 74 | 74 | * An array containing all sections. |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | |
| 116 | 116 | $config = Kirki_Config::get_instance( $config_id, $args ); |
| 117 | 117 | $config_args = $config->get_config(); |
| 118 | - self::$config[ $config_args['id'] ] = $config_args; |
|
| 118 | + self::$config[$config_args['id']] = $config_args; |
|
| 119 | 119 | |
| 120 | 120 | } |
| 121 | 121 | |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | $args['active_callback'] = ( isset( $args['required'] ) ) ? array( 'Kirki_Active_Callback', 'evaluate' ) : '__return_true'; |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | - self::$panels[ $args['id'] ] = $args; |
|
| 141 | + self::$panels[$args['id']] = $args; |
|
| 142 | 142 | |
| 143 | 143 | } |
| 144 | 144 | |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | $args['active_callback'] = ( isset( $args['required'] ) ) ? array( 'Kirki_Active_Callback', 'evaluate' ) : '__return_true'; |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | - self::$sections[ $args['id'] ] = $args; |
|
| 165 | + self::$sections[$args['id']] = $args; |
|
| 166 | 166 | |
| 167 | 167 | } |
| 168 | 168 | |