@@ -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_Values::get_value( $field['settings'] ); |
|
121 | + $variables[$variable_name] = Kirki_Values::get_value( $field['settings'] ); |
|
122 | 122 | if ( $variable_callback ) { |
123 | - $variables[ $variable_name ] = call_user_func( $field_variable['callback'], Kirki_Values::get_value( $field['settings'] ) ); |
|
123 | + $variables[$variable_name] = call_user_func( $field_variable['callback'], Kirki_Values::get_value( $field['settings'] ) ); |
|
124 | 124 | } |
125 | 125 | } |
126 | 126 | } |
@@ -40,8 +40,8 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public function typography_field_tweaks( $value, $field_id ) { |
42 | 42 | |
43 | - if ( isset( Kirki::$fields[ $field_id ] ) && isset( Kirki::$fields[ $field_id ]['type'] ) ) { |
|
44 | - if ( 'kirki-typography' === Kirki::$fields[ $field_id ]['type'] ) { |
|
43 | + if ( isset( Kirki::$fields[$field_id] ) && isset( Kirki::$fields[$field_id]['type'] ) ) { |
|
44 | + if ( 'kirki-typography' === Kirki::$fields[$field_id]['type'] ) { |
|
45 | 45 | |
46 | 46 | // Sanitize the value. |
47 | 47 | // This also adds font-weight if it doesn't already exist. |
@@ -83,43 +83,43 @@ discard block |
||
83 | 83 | $config_id = ( '' === $config_id ) ? 'global' : $config_id; |
84 | 84 | |
85 | 85 | // Fallback to 'global' if $config_id is not found. |
86 | - if ( ! isset( Kirki::$config[ $config_id ] ) ) { |
|
86 | + if ( ! isset( Kirki::$config[$config_id] ) ) { |
|
87 | 87 | $config_id = 'global'; |
88 | 88 | } |
89 | 89 | |
90 | - if ( 'theme_mod' === Kirki::$config[ $config_id ]['option_type'] ) { |
|
90 | + if ( 'theme_mod' === Kirki::$config[$config_id]['option_type'] ) { |
|
91 | 91 | |
92 | 92 | // We're using theme_mods so just get the value using get_theme_mod. |
93 | 93 | $default_value = null; |
94 | - if ( isset( Kirki::$fields[ $field_id ] ) && isset( Kirki::$fields[ $field_id ]['default'] ) ) { |
|
95 | - $default_value = Kirki::$fields[ $field_id ]['default']; |
|
94 | + if ( isset( Kirki::$fields[$field_id] ) && isset( Kirki::$fields[$field_id]['default'] ) ) { |
|
95 | + $default_value = Kirki::$fields[$field_id]['default']; |
|
96 | 96 | } |
97 | 97 | $value = get_theme_mod( $field_id, $default_value ); |
98 | 98 | return apply_filters( 'kirki/values/get_value', $value, $field_id ); |
99 | 99 | } |
100 | 100 | |
101 | - if ( 'option' === Kirki::$config[ $config_id ]['option_type'] ) { |
|
101 | + if ( 'option' === Kirki::$config[$config_id]['option_type'] ) { |
|
102 | 102 | |
103 | 103 | // We're using options. |
104 | - if ( '' !== Kirki::$config[ $config_id ]['option_name'] ) { |
|
104 | + if ( '' !== Kirki::$config[$config_id]['option_name'] ) { |
|
105 | 105 | |
106 | 106 | // Options are serialized as a single option in the db. |
107 | 107 | // We'll have to get the option and then get the item from the array. |
108 | - $options = get_option( Kirki::$config[ $config_id ]['option_name'] ); |
|
108 | + $options = get_option( Kirki::$config[$config_id]['option_name'] ); |
|
109 | 109 | |
110 | - if ( ! isset( Kirki::$fields[ $field_id ] ) && isset( Kirki::$fields[ Kirki::$config[ $config_id ]['option_name'] . '[' . $field_id . ']' ] ) ) { |
|
111 | - $field_id = Kirki::$config[ $config_id ]['option_name'] . '[' . $field_id . ']'; |
|
110 | + if ( ! isset( Kirki::$fields[$field_id] ) && isset( Kirki::$fields[Kirki::$config[$config_id]['option_name'] . '[' . $field_id . ']'] ) ) { |
|
111 | + $field_id = Kirki::$config[$config_id]['option_name'] . '[' . $field_id . ']'; |
|
112 | 112 | } |
113 | - $setting_modified = str_replace( ']', '', str_replace( Kirki::$config[ $config_id ]['option_name'] . '[', '', $field_id ) ); |
|
113 | + $setting_modified = str_replace( ']', '', str_replace( Kirki::$config[$config_id]['option_name'] . '[', '', $field_id ) ); |
|
114 | 114 | |
115 | - $default_value = ( isset( Kirki::$fields[ $field_id ] ) && isset( Kirki::$fields[ $field_id ]['default'] ) ) ? Kirki::$fields[ $field_id ]['default'] : ''; |
|
116 | - $value = ( isset( $options[ $setting_modified ] ) ) ? $options[ $setting_modified ] : $default_value; |
|
115 | + $default_value = ( isset( Kirki::$fields[$field_id] ) && isset( Kirki::$fields[$field_id]['default'] ) ) ? Kirki::$fields[$field_id]['default'] : ''; |
|
116 | + $value = ( isset( $options[$setting_modified] ) ) ? $options[$setting_modified] : $default_value; |
|
117 | 117 | $value = maybe_unserialize( $value ); |
118 | 118 | return apply_filters( 'kirki/values/get_value', $value, $field_id ); |
119 | 119 | } |
120 | 120 | |
121 | 121 | // Each option separately saved in the db. |
122 | - $value = get_option( $field_id, Kirki::$fields[ $field_id ]['default'] ); |
|
122 | + $value = get_option( $field_id, Kirki::$fields[$field_id]['default'] ); |
|
123 | 123 | return apply_filters( 'kirki/values/get_value', $value, $field_id ); |
124 | 124 | |
125 | 125 | } // End if(). |
@@ -144,8 +144,8 @@ discard block |
||
144 | 144 | if ( isset( $field['option_name'] ) && '' !== $field['option_name'] ) { |
145 | 145 | $all_values = get_option( $field['option_name'], array() ); |
146 | 146 | $sub_setting_id = str_replace( array( ']', $field['option_name'] . '[' ), '', $field['settings'] ); |
147 | - if ( isset( $all_values[ $sub_setting_id ] ) ) { |
|
148 | - $value = $all_values[ $sub_setting_id ]; |
|
147 | + if ( isset( $all_values[$sub_setting_id] ) ) { |
|
148 | + $value = $all_values[$sub_setting_id]; |
|
149 | 149 | } |
150 | 150 | } else { |
151 | 151 | $value = get_option( $field['settings'], $field['default'] ); |
@@ -34,15 +34,15 @@ |
||
34 | 34 | ) ); |
35 | 35 | if ( is_array( $value ) ) { |
36 | 36 | if ( isset( $output['choice'] ) && $output['choice'] ) { |
37 | - $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = $output['prefix'] . $this->process_property_value( $output['property'], $value[ $output['choice'] ] ) . $output['units'] . $output['suffix']; |
|
37 | + $this->styles[$output['media_query']][$output['element']][$output['property']] = $output['prefix'] . $this->process_property_value( $output['property'], $value[$output['choice']] ) . $output['units'] . $output['suffix']; |
|
38 | 38 | return; |
39 | 39 | } |
40 | 40 | if ( isset( $value['url'] ) ) { |
41 | - $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = $output['prefix'] . $this->process_property_value( $output['property'], $value['url'] ) . $output['units'] . $output['suffix']; |
|
41 | + $this->styles[$output['media_query']][$output['element']][$output['property']] = $output['prefix'] . $this->process_property_value( $output['property'], $value['url'] ) . $output['units'] . $output['suffix']; |
|
42 | 42 | return; |
43 | 43 | } |
44 | 44 | return; |
45 | 45 | } |
46 | - $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = $output['prefix'] . $this->process_property_value( $output['property'], $value ) . $output['units'] . $output['suffix']; |
|
46 | + $this->styles[$output['media_query']][$output['element']][$output['property']] = $output['prefix'] . $this->process_property_value( $output['property'], $value ) . $output['units'] . $output['suffix']; |
|
47 | 47 | } |
48 | 48 | } |
@@ -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,7 +164,7 @@ discard block |
||
164 | 164 | $replacement = ( false === $replacement ) ? '' : $replacement; |
165 | 165 | if ( is_array( $value ) ) { |
166 | 166 | foreach ( $value as $k => $v ) { |
167 | - $value[ $k ] = str_replace( $search, $replacement, $value[ $v ] ); |
|
167 | + $value[$k] = str_replace( $search, $replacement, $value[$v] ); |
|
168 | 168 | } |
169 | 169 | return $value; |
170 | 170 | } |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | } |
207 | 207 | // If 'choice' is defined check for sub-values too. |
208 | 208 | // Fixes https://github.com/aristath/kirki/issues/1416. |
209 | - if ( isset( $output['choice'] ) && isset( $value[ $output['choice'] ] ) && $exclude == $value[ $output['choice'] ] ) { |
|
209 | + if ( isset( $output['choice'] ) && isset( $value[$output['choice']] ) && $exclude == $value[$output['choice']] ) { |
|
210 | 210 | $skip = true; |
211 | 211 | } |
212 | 212 | } |
@@ -264,13 +264,13 @@ discard block |
||
264 | 264 | 'background', |
265 | 265 | ); |
266 | 266 | if ( in_array( $output['property'], $accepts_multiple, true ) ) { |
267 | - if ( isset( $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] ) && ! is_array( $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] ) ) { |
|
268 | - $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = (array) $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ]; |
|
267 | + if ( isset( $this->styles[$output['media_query']][$output['element']][$output['property']] ) && ! is_array( $this->styles[$output['media_query']][$output['element']][$output['property']] ) ) { |
|
268 | + $this->styles[$output['media_query']][$output['element']][$output['property']] = (array) $this->styles[$output['media_query']][$output['element']][$output['property']]; |
|
269 | 269 | } |
270 | - $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ][] = $output['prefix'] . $value . $output['units'] . $output['suffix']; |
|
270 | + $this->styles[$output['media_query']][$output['element']][$output['property']][] = $output['prefix'] . $value . $output['units'] . $output['suffix']; |
|
271 | 271 | return; |
272 | 272 | } |
273 | - $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = $output['prefix'] . $this->process_property_value( $output['property'], $value ) . $output['units'] . $output['suffix']; |
|
273 | + $this->styles[$output['media_query']][$output['element']][$output['property']] = $output['prefix'] . $this->process_property_value( $output['property'], $value ) . $output['units'] . $output['suffix']; |
|
274 | 274 | } |
275 | 275 | |
276 | 276 | /** |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | 'background-position' => 'Kirki_Output_Property_Background_Position', |
291 | 291 | ) ); |
292 | 292 | if ( array_key_exists( $property, $properties ) ) { |
293 | - $classname = $properties[ $property ]; |
|
293 | + $classname = $properties[$property]; |
|
294 | 294 | $obj = new $classname( $property, $value ); |
295 | 295 | return $obj->get_value(); |
296 | 296 | } |
@@ -44,7 +44,7 @@ |
||
44 | 44 | if ( false !== strpos( $output['property'], '%%' ) ) { |
45 | 45 | $property = str_replace( '%%', $key, $output['property'] ); |
46 | 46 | } |
47 | - $this->styles[ $output['media_query'] ][ $output['element'] ][ $property ] = $output['prefix'] . $this->process_property_value( $property, $value[ $key ] ) . $output['suffix']; |
|
47 | + $this->styles[$output['media_query']][$output['element']][$property] = $output['prefix'] . $this->process_property_value( $property, $value[$key] ) . $output['suffix']; |
|
48 | 48 | } |
49 | 49 | } |
50 | 50 | } |