@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | $key = esc_attr( $key ); |
37 | 37 | $setting = $key; |
38 | 38 | $tooltip = $field['tooltip']; |
39 | - $description = isset( $i18n[ 'background-' . $key ] ) ? $i18n[ 'background-' . $key ] : ''; |
|
39 | + $description = isset( $i18n['background-' . $key] ) ? $i18n['background-' . $key] : ''; |
|
40 | 40 | $output_property = 'background-' . $key; |
41 | 41 | $label = ( 0 === $i ) ? $field['label'] : ''; |
42 | 42 | $type = 'select'; |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | * Build the field. |
92 | 92 | * We're merging with the original field here, so any extra properties are inherited. |
93 | 93 | */ |
94 | - $fields[ $property_setting ] = array_merge( $field, array( |
|
94 | + $fields[$property_setting] = array_merge( $field, array( |
|
95 | 95 | 'type' => $type, |
96 | 96 | 'label' => $label, |
97 | 97 | 'settings' => $property_setting, |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | 'description' => $description, |
103 | 103 | 'default' => $value, |
104 | 104 | 'id' => sanitize_key( str_replace( '[', '-', str_replace( ']', '', $property_setting ) ) ), |
105 | - 'choices' => isset( $choices[ $key ] ) ? $choices[ $key ] : array(), |
|
105 | + 'choices' => isset( $choices[$key] ) ? $choices[$key] : array(), |
|
106 | 106 | 'sanitize_callback' => $sanitize_callback, |
107 | 107 | 'output' => ( ! empty( $field['output'] ) ) ? array( |
108 | 108 | array( |
@@ -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'] ); |
@@ -243,13 +243,13 @@ |
||
243 | 243 | $strings = self::get_strings(); |
244 | 244 | |
245 | 245 | // No need to proceed if the key is invalid. |
246 | - if ( ! isset( $strings[ $key ] ) ) { |
|
246 | + if ( ! isset( $strings[$key] ) ) { |
|
247 | 247 | return; |
248 | 248 | } |
249 | 249 | |
250 | 250 | $strings = apply_filters( 'kirki/' . $config . '/l10n', $strings ); |
251 | 251 | |
252 | - return $strings[ $key ]; |
|
252 | + return $strings[$key]; |
|
253 | 253 | } |
254 | 254 | } |
255 | 255 | } |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | foreach ( $args as $key => $value ) { |
85 | 85 | // Is this property whitelisted? |
86 | 86 | if ( property_exists( $this, $key ) ) { |
87 | - $args[ $key ] = $value; |
|
87 | + $args[$key] = $value; |
|
88 | 88 | } |
89 | 89 | } |
90 | 90 | |
@@ -122,10 +122,10 @@ discard block |
||
122 | 122 | $id = ( '' == $id ) ? 'global' : $id; |
123 | 123 | |
124 | 124 | $id_md5 = md5( $id ); |
125 | - if ( ! isset( self::$instances[ $id_md5 ] ) ) { |
|
126 | - self::$instances[ $id_md5 ] = new self( $id, $args ); |
|
125 | + if ( ! isset( self::$instances[$id_md5] ) ) { |
|
126 | + self::$instances[$id_md5] = new self( $id, $args ); |
|
127 | 127 | } |
128 | - return self::$instances[ $id_md5 ]; |
|
128 | + return self::$instances[$id_md5]; |
|
129 | 129 | |
130 | 130 | } |
131 | 131 |
@@ -189,7 +189,7 @@ |
||
189 | 189 | return 'auto'; |
190 | 190 | } |
191 | 191 | // Return empty if there are no numbers in the value. |
192 | - if ( ! preg_match( '#[0-9]#' , $value ) ) { |
|
192 | + if ( ! preg_match( '#[0-9]#', $value ) ) { |
|
193 | 193 | return ''; |
194 | 194 | } |
195 | 195 | // The raw value without the units |
@@ -28,13 +28,13 @@ |
||
28 | 28 | $fields = Kirki::$fields; |
29 | 29 | |
30 | 30 | // Make sure the current object matches a registered field. |
31 | - if ( ! isset( $object->setting->id ) || ! isset( $fields[ $object->setting->id ] ) ) { |
|
31 | + if ( ! isset( $object->setting->id ) || ! isset( $fields[$object->setting->id] ) ) { |
|
32 | 32 | return true; |
33 | 33 | } |
34 | 34 | |
35 | 35 | $show = true; |
36 | 36 | |
37 | - $field = $fields[ $object->setting->id ]; |
|
37 | + $field = $fields[$object->setting->id]; |
|
38 | 38 | |
39 | 39 | if ( isset( $field['required'] ) ) { |
40 | 40 |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | if ( ! isset( $args['type'] ) || ! array_key_exists( $args['type'], $this->setting_types ) ) { |
55 | 55 | $args['type'] = 'default'; |
56 | 56 | } |
57 | - $classname = $this->setting_types[ $args['type'] ]; |
|
57 | + $classname = $this->setting_types[$args['type']]; |
|
58 | 58 | |
59 | 59 | // If settings are defined as an array, then we need to go through them |
60 | 60 | // and call add_setting for each one of them separately. |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | $args['default'] = array(); |
65 | 65 | } |
66 | 66 | foreach ( $args['settings'] as $key => $value ) { |
67 | - $default = ( isset( $defaults[ $key ] ) ) ? $defaults[ $key ] : ''; |
|
67 | + $default = ( isset( $defaults[$key] ) ) ? $defaults[$key] : ''; |
|
68 | 68 | $this->add_setting( $classname, $value, $default, $args['option_type'], $args['capability'], $args['transport'], $args['sanitize_callback'] ); |
69 | 69 | } |
70 | 70 | } |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | foreach ( $this->setting_types as $key => $classname ) { |
116 | 116 | |
117 | 117 | if ( ! class_exists( $classname ) ) { |
118 | - unset( $this->setting_types[ $key ] ); |
|
118 | + unset( $this->setting_types[$key] ); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | } |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * @access public |
46 | 46 | * @var array |
47 | 47 | */ |
48 | - public static $config = array(); |
|
48 | + public static $config = array(); |
|
49 | 49 | |
50 | 50 | /** |
51 | 51 | * An array containing all fields. |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | * @access public |
55 | 55 | * @var array |
56 | 56 | */ |
57 | - public static $fields = array(); |
|
57 | + public static $fields = array(); |
|
58 | 58 | |
59 | 59 | /** |
60 | 60 | * An array containing all panels. |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | * @access public |
64 | 64 | * @var array |
65 | 65 | */ |
66 | - public static $panels = array(); |
|
66 | + public static $panels = array(); |
|
67 | 67 | |
68 | 68 | /** |
69 | 69 | * An array containing all sections. |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | |
100 | 100 | $config = Kirki_Config::get_instance( $config_id, $args ); |
101 | 101 | $config_args = $config->get_config(); |
102 | - self::$config[ $config_args['id'] ] = $config_args; |
|
102 | + self::$config[$config_args['id']] = $config_args; |
|
103 | 103 | |
104 | 104 | } |
105 | 105 | |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | $args['active_callback'] = ( isset( $args['required'] ) ) ? array( 'Kirki_Active_Callback', 'evaluate' ) : '__return_true'; |
120 | 120 | } |
121 | 121 | |
122 | - self::$panels[ $args['id'] ] = $args; |
|
122 | + self::$panels[$args['id']] = $args; |
|
123 | 123 | |
124 | 124 | } |
125 | 125 | |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | $args['active_callback'] = ( isset( $args['required'] ) ) ? array( 'Kirki_Active_Callback', 'evaluate' ) : '__return_true'; |
142 | 142 | } |
143 | 143 | |
144 | - self::$sections[ $args['id'] ] = $args; |
|
144 | + self::$sections[$args['id']] = $args; |
|
145 | 145 | |
146 | 146 | } |
147 | 147 |
@@ -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 | } |