@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | * Build the field. |
| 88 | 88 | * We're merging with the original field here, so any extra properties are inherited. |
| 89 | 89 | */ |
| 90 | - $fields[ $property_setting ] = array_merge( $field, array( |
|
| 90 | + $fields[$property_setting] = array_merge( $field, array( |
|
| 91 | 91 | 'type' => $type, |
| 92 | 92 | 'label' => $label, |
| 93 | 93 | 'settings' => $property_setting, |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | 'description' => $description, |
| 99 | 99 | 'default' => $value, |
| 100 | 100 | 'id' => Kirki_Field_Sanitize::sanitize_id( array( 'settings' => Kirki_Field_Sanitize::sanitize_settings( array( 'settings' => $field['settings'] . '_' . $setting ) ) ) ), |
| 101 | - 'choices' => isset( $choices[ $key ] ) ? $choices[ $key ] : array(), |
|
| 101 | + 'choices' => isset( $choices[$key] ) ? $choices[$key] : array(), |
|
| 102 | 102 | 'output' => ( '' != $field['output'] ) ? array( |
| 103 | 103 | array( |
| 104 | 104 | 'element' => $field['output'], |
@@ -79,7 +79,7 @@ |
||
| 79 | 79 | $class_name = 'WP_Customize_Control'; |
| 80 | 80 | // Get the classname from the array of control classnames |
| 81 | 81 | if ( array_key_exists( $args['type'], self::$control_types ) ) { |
| 82 | - $class_name = self::$control_types[ $args['type'] ]; |
|
| 82 | + $class_name = self::$control_types[$args['type']]; |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | return $class_name; |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | $args['active_callback'] = ( isset( $args['required'] ) ) ? array( 'Kirki_Active_Callback', 'evaluate' ) : '__return_true'; |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | - self::$panels[ $args['id'] ] = $args; |
|
| 70 | + self::$panels[$args['id']] = $args; |
|
| 71 | 71 | |
| 72 | 72 | } |
| 73 | 73 | |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | $args['active_callback'] = ( isset( $args['required'] ) ) ? array( 'Kirki_Active_Callback', 'evaluate' ) : '__return_true'; |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - self::$sections[ $args['id'] ] = $args; |
|
| 91 | + self::$sections[$args['id']] = $args; |
|
| 92 | 92 | |
| 93 | 93 | } |
| 94 | 94 | |
@@ -50,9 +50,9 @@ |
||
| 50 | 50 | // Make sure that every row is an array, not an object |
| 51 | 51 | foreach ( $sanitized as $key => $_value ) { |
| 52 | 52 | if ( empty( $_value ) ) { |
| 53 | - unset( $sanitized[ $key ] ); |
|
| 53 | + unset( $sanitized[$key] ); |
|
| 54 | 54 | } else { |
| 55 | - $sanitized[ $key ] = (array) $_value; |
|
| 55 | + $sanitized[$key] = (array) $_value; |
|
| 56 | 56 | } |
| 57 | 57 | } |
| 58 | 58 | |
@@ -46,7 +46,7 @@ |
||
| 46 | 46 | // Allow empty value as the config ID by setting the id to global. |
| 47 | 47 | $config_id = ( '' == $config_id ) ? 'global' : $config_id; |
| 48 | 48 | // Set the config |
| 49 | - Kirki::$config[ $config_id ] = array_merge( $this->default_args, $args ); |
|
| 49 | + Kirki::$config[$config_id] = array_merge( $this->default_args, $args ); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | /** |
@@ -15,11 +15,11 @@ |
||
| 15 | 15 | $fields = Kirki::$fields; |
| 16 | 16 | |
| 17 | 17 | // Make sure the current object matches a registered field. |
| 18 | - if ( ! isset( $object->setting->id ) || ! isset( $fields[ $object->setting->id ] ) ) { |
|
| 18 | + if ( ! isset( $object->setting->id ) || ! isset( $fields[$object->setting->id] ) ) { |
|
| 19 | 19 | return true; |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | - $current_object = $fields[ $object->setting->id ]; |
|
| 22 | + $current_object = $fields[$object->setting->id]; |
|
| 23 | 23 | |
| 24 | 24 | if ( isset( $current_object['required'] ) ) { |
| 25 | 25 | |
@@ -26,18 +26,18 @@ discard block |
||
| 26 | 26 | /** |
| 27 | 27 | * fallback to 'global' if $config_id is not found |
| 28 | 28 | */ |
| 29 | - if ( ! isset( Kirki::$config[ $config_id ] ) ) { |
|
| 29 | + if ( ! isset( Kirki::$config[$config_id] ) ) { |
|
| 30 | 30 | $config_id = 'global'; |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | - if ( 'theme_mod' == Kirki::$config[ $config_id ]['option_type'] ) { |
|
| 33 | + if ( 'theme_mod' == Kirki::$config[$config_id]['option_type'] ) { |
|
| 34 | 34 | /** |
| 35 | 35 | * We're using theme_mods. |
| 36 | 36 | * so just get the value using get_theme_mod |
| 37 | 37 | */ |
| 38 | 38 | $default_value = null; |
| 39 | - if ( isset( Kirki::$fields[ $field_id ] ) && isset( Kirki::$fields[ $field_id ]['default'] ) ) { |
|
| 40 | - $default_value = Kirki::$fields[ $field_id ]['default']; |
|
| 39 | + if ( isset( Kirki::$fields[$field_id] ) && isset( Kirki::$fields[$field_id]['default'] ) ) { |
|
| 40 | + $default_value = Kirki::$fields[$field_id]['default']; |
|
| 41 | 41 | } |
| 42 | 42 | $value = get_theme_mod( $field_id, $default_value ); |
| 43 | 43 | |
@@ -45,51 +45,51 @@ discard block |
||
| 45 | 45 | * If the field is a background field, then get the sub-fields |
| 46 | 46 | * and return an array of the values. |
| 47 | 47 | */ |
| 48 | - if ( isset( Kirki::$fields[ $field_id ] ) && isset( Kirki::$fields[ $field_id ]['type'] ) && 'background' == Kirki::$fields[ $field_id ]['type'] ) { |
|
| 48 | + if ( isset( Kirki::$fields[$field_id] ) && isset( Kirki::$fields[$field_id]['type'] ) && 'background' == Kirki::$fields[$field_id]['type'] ) { |
|
| 49 | 49 | $value = array(); |
| 50 | 50 | if ( null == $default_value ) { |
| 51 | 51 | $default_value = array(); |
| 52 | 52 | } |
| 53 | 53 | foreach ( $default_value as $property_key => $property_default ) { |
| 54 | - $value[ $property_key ] = get_theme_mod( $field_id . '_' . $property_key, $property_default ); |
|
| 54 | + $value[$property_key] = get_theme_mod( $field_id . '_' . $property_key, $property_default ); |
|
| 55 | 55 | } |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - } elseif ( 'option' == Kirki::$config[ $config_id ]['option_type'] ) { |
|
| 58 | + } elseif ( 'option' == Kirki::$config[$config_id]['option_type'] ) { |
|
| 59 | 59 | /** |
| 60 | 60 | * We're using options. |
| 61 | 61 | */ |
| 62 | - if ( '' != Kirki::$config[ $config_id ]['option_name'] ) { |
|
| 62 | + if ( '' != Kirki::$config[$config_id]['option_name'] ) { |
|
| 63 | 63 | /** |
| 64 | 64 | * Options are serialized as a single option in the db. |
| 65 | 65 | * We'll have to get the option and then get the item from the array. |
| 66 | 66 | */ |
| 67 | - $options = get_option( Kirki::$config[ $config_id ]['option_name'] ); |
|
| 67 | + $options = get_option( Kirki::$config[$config_id]['option_name'] ); |
|
| 68 | 68 | |
| 69 | - if ( ! isset( Kirki::$fields[ $field_id ] ) && isset( Kirki::$fields[ Kirki::$config[ $config_id ]['option_name'] . '[' . $field_id . ']'] ) ) { |
|
| 70 | - $field_id = Kirki::$config[ $config_id ]['option_name'] . '[' . $field_id . ']'; |
|
| 69 | + if ( ! isset( Kirki::$fields[$field_id] ) && isset( Kirki::$fields[Kirki::$config[$config_id]['option_name'] . '[' . $field_id . ']'] ) ) { |
|
| 70 | + $field_id = Kirki::$config[$config_id]['option_name'] . '[' . $field_id . ']'; |
|
| 71 | 71 | } |
| 72 | - $setting_modified = str_replace( ']', '', str_replace( Kirki::$config[ $config_id ]['option_name'] . '[', '', $field_id ) ); |
|
| 72 | + $setting_modified = str_replace( ']', '', str_replace( Kirki::$config[$config_id]['option_name'] . '[', '', $field_id ) ); |
|
| 73 | 73 | |
| 74 | 74 | /** |
| 75 | 75 | * If this is a background field, get the individual sub-fields and return an array. |
| 76 | 76 | */ |
| 77 | - if ( 'background' == Kirki::$fields[ $field_id ]['type'] ) { |
|
| 77 | + if ( 'background' == Kirki::$fields[$field_id]['type'] ) { |
|
| 78 | 78 | $value = array(); |
| 79 | 79 | |
| 80 | - foreach ( Kirki::$fields[ $field_id ]['default'] as $property => $property_default ) { |
|
| 80 | + foreach ( Kirki::$fields[$field_id]['default'] as $property => $property_default ) { |
|
| 81 | 81 | |
| 82 | - if ( isset( $options[ $setting_modified . '_' . $property ] ) ) { |
|
| 83 | - $value[ $property ] = $options[ $setting_modified . '_' . $property ]; |
|
| 82 | + if ( isset( $options[$setting_modified . '_' . $property] ) ) { |
|
| 83 | + $value[$property] = $options[$setting_modified . '_' . $property]; |
|
| 84 | 84 | } else { |
| 85 | - $value[ $property ] = $property_default; |
|
| 85 | + $value[$property] = $property_default; |
|
| 86 | 86 | } |
| 87 | 87 | } |
| 88 | 88 | } else { |
| 89 | 89 | /** |
| 90 | 90 | * This is not a background field so continue and get the value. |
| 91 | 91 | */ |
| 92 | - $value = ( isset( $options[ $setting_modified ] ) ) ? $options[ $setting_modified ] : Kirki::$fields[ $field_id ]['default']; |
|
| 92 | + $value = ( isset( $options[$setting_modified] ) ) ? $options[$setting_modified] : Kirki::$fields[$field_id]['default']; |
|
| 93 | 93 | $value = maybe_unserialize( $value ); |
| 94 | 94 | } |
| 95 | 95 | |
@@ -97,16 +97,16 @@ discard block |
||
| 97 | 97 | /** |
| 98 | 98 | * Each option separately saved in the db |
| 99 | 99 | */ |
| 100 | - $value = get_option( $field_id, Kirki::$fields[ $field_id ]['default'] ); |
|
| 100 | + $value = get_option( $field_id, Kirki::$fields[$field_id]['default'] ); |
|
| 101 | 101 | |
| 102 | 102 | /** |
| 103 | 103 | * If the field is a background field, then get the sub-fields |
| 104 | 104 | * and return an array of the values. |
| 105 | 105 | */ |
| 106 | - if ( 'background' == Kirki::$fields[ $field_id ]['type'] ) { |
|
| 106 | + if ( 'background' == Kirki::$fields[$field_id]['type'] ) { |
|
| 107 | 107 | $value = array(); |
| 108 | - foreach ( Kirki::$fields[ $field_id ]['default'] as $property_key => $property_default ) { |
|
| 109 | - $value[ $property_key ] = get_option( $field_id . '_' . $property_key, $property_default ); |
|
| 108 | + foreach ( Kirki::$fields[$field_id]['default'] as $property_key => $property_default ) { |
|
| 109 | + $value[$property_key] = get_option( $field_id . '_' . $property_key, $property_default ); |
|
| 110 | 110 | } |
| 111 | 111 | } |
| 112 | 112 | |
@@ -129,8 +129,8 @@ discard block |
||
| 129 | 129 | if ( isset( $field['option_name'] ) && '' != $field['option_name'] ) { |
| 130 | 130 | $all_values = get_option( $field['option_name'], array() ); |
| 131 | 131 | $sub_setting_id = str_replace( array( ']', $field['option_name'] . '[' ), '', $field['settings'] ); |
| 132 | - if ( isset( $all_values[ $sub_setting_id ] ) ) { |
|
| 133 | - $value = $all_values[ $sub_setting_id ]; |
|
| 132 | + if ( isset( $all_values[$sub_setting_id] ) ) { |
|
| 133 | + $value = $all_values[$sub_setting_id]; |
|
| 134 | 134 | } |
| 135 | 135 | } else { |
| 136 | 136 | $value = get_option( $field['settings'], $field['default'] ); |
@@ -172,9 +172,9 @@ |
||
| 172 | 172 | * If no callback is defined (false) then just get the value. |
| 173 | 173 | */ |
| 174 | 174 | if ( $variable_callback ) { |
| 175 | - $variables[ $variable_name ] = call_user_func( $field_variable['callback'], Kirki::get_option( $field['settings'] ) ); |
|
| 175 | + $variables[$variable_name] = call_user_func( $field_variable['callback'], Kirki::get_option( $field['settings'] ) ); |
|
| 176 | 176 | } else { |
| 177 | - $variables[ $variable_name ] = Kirki::get_option( $field['settings'] ); |
|
| 177 | + $variables[$variable_name] = Kirki::get_option( $field['settings'] ); |
|
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | } |
@@ -21,8 +21,8 @@ |
||
| 21 | 21 | |
| 22 | 22 | $previous_path = ''; |
| 23 | 23 | for ( $i = 0; $i < $levels; $i++ ) { |
| 24 | - $paths[] = $path . $previous_path . strtolower( $exploded[ $i ] ) . '/' . $filename; |
|
| 25 | - $previous_path .= strtolower( $exploded[ $i ] ) . '/'; |
|
| 24 | + $paths[] = $path . $previous_path . strtolower( $exploded[$i] ) . '/' . $filename; |
|
| 25 | + $previous_path .= strtolower( $exploded[$i] ) . '/'; |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | foreach ( $paths as $path ) { |