@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | |
77 | 77 | foreach ( Kirki::$fields as $field ) { |
78 | 78 | if ( isset( $field['tooltip'] ) && ! empty( $field['tooltip'] ) ) { |
79 | - $this->tooltips_content[ $field['settings'] ] = array( |
|
79 | + $this->tooltips_content[$field['settings']] = array( |
|
80 | 80 | 'id' => str_replace( array( '[', ']' ), array( '-', '' ), $field['settings'] ), |
81 | 81 | 'content' => wp_kses_post( $field['tooltip'] ), |
82 | 82 | ); |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | */ |
95 | 95 | public function add_tooltip( $field_id, $tooltip ) { |
96 | 96 | |
97 | - $this->tooltips_content[ $field_id ] = array( |
|
97 | + $this->tooltips_content[$field_id] = array( |
|
98 | 98 | 'id' => sanitize_key( $field_id ), |
99 | 99 | 'content' => wp_kses_post( $tooltip ), |
100 | 100 | ); |
@@ -80,8 +80,8 @@ discard block |
||
80 | 80 | return $value; |
81 | 81 | } |
82 | 82 | |
83 | - if ( is_array( $value ) && isset( $output['choice'] ) && isset( $this->value[ $output['choice'] ] ) ) { |
|
84 | - $value[ $output['choice'] ] = call_user_func( $output['sanitize_callback'], $this->value[ $output['choice'] ] ); |
|
83 | + if ( is_array( $value ) && isset( $output['choice'] ) && isset( $this->value[$output['choice']] ) ) { |
|
84 | + $value[$output['choice']] = call_user_func( $output['sanitize_callback'], $this->value[$output['choice']] ); |
|
85 | 85 | return $value; |
86 | 86 | } |
87 | 87 | return call_user_func( $output['sanitize_callback'], $this->value ); |
@@ -106,16 +106,16 @@ discard block |
||
106 | 106 | } |
107 | 107 | if ( is_array( $value ) ) { |
108 | 108 | foreach ( array_keys( $value ) as $value_k ) { |
109 | - if ( ! is_string( $value[ $value_k ] ) ) { |
|
109 | + if ( ! is_string( $value[$value_k] ) ) { |
|
110 | 110 | continue; |
111 | 111 | } |
112 | 112 | if ( isset( $output['choice'] ) ) { |
113 | 113 | if ( $output['choice'] === $value_k ) { |
114 | - $value[ $output['choice'] ] = str_replace( '$', $value[ $output['choice'] ], $output['value_pattern'] ); |
|
114 | + $value[$output['choice']] = str_replace( '$', $value[$output['choice']], $output['value_pattern'] ); |
|
115 | 115 | } |
116 | 116 | continue; |
117 | 117 | } |
118 | - $value[ $value_k ] = str_replace( '$', $value[ $value_k ], $output['value_pattern'] ); |
|
118 | + $value[$value_k] = str_replace( '$', $value[$value_k], $output['value_pattern'] ); |
|
119 | 119 | } |
120 | 120 | } |
121 | 121 | $value = $this->apply_pattern_replace( $output, $value ); |
@@ -145,16 +145,16 @@ discard block |
||
145 | 145 | if ( is_array( $options ) ) { |
146 | 146 | if ( $option_name ) { |
147 | 147 | $subkey = str_replace( array( $option_name, '[', ']' ), '', $replace ); |
148 | - $replacement = ( isset( $options[ $subkey ] ) ) ? $options[ $subkey ] : ''; |
|
148 | + $replacement = ( isset( $options[$subkey] ) ) ? $options[$subkey] : ''; |
|
149 | 149 | break; |
150 | 150 | } |
151 | - $replacement = ( isset( $options[ $replace ] ) ) ? $options[ $replace ] : ''; |
|
151 | + $replacement = ( isset( $options[$replace] ) ) ? $options[$replace] : ''; |
|
152 | 152 | break; |
153 | 153 | } |
154 | 154 | $replacement = get_option( $replace ); |
155 | 155 | break; |
156 | 156 | case 'site_option': |
157 | - $replacement = ( is_array( $options ) && isset( $options[ $replace ] ) ) ? $options[ $replace ] : get_site_option( $replace ); |
|
157 | + $replacement = ( is_array( $options ) && isset( $options[$replace] ) ) ? $options[$replace] : get_site_option( $replace ); |
|
158 | 158 | break; |
159 | 159 | case 'user_meta': |
160 | 160 | $user_id = get_current_user_id(); |
@@ -171,11 +171,11 @@ discard block |
||
171 | 171 | foreach ( $value as $k => $v ) { |
172 | 172 | if ( isset( $output['choice'] ) ) { |
173 | 173 | if ( $k === $output['choice'] ) { |
174 | - $value[ $k ] = str_replace( $search, $replacement, $v ); |
|
174 | + $value[$k] = str_replace( $search, $replacement, $v ); |
|
175 | 175 | } |
176 | 176 | continue; |
177 | 177 | } |
178 | - $value[ $k ] = str_replace( $search, $replacement, $v ); |
|
178 | + $value[$k] = str_replace( $search, $replacement, $v ); |
|
179 | 179 | } |
180 | 180 | return $value; |
181 | 181 | } |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | } |
218 | 218 | // If 'choice' is defined check for sub-values too. |
219 | 219 | // Fixes https://github.com/aristath/kirki/issues/1416. |
220 | - if ( isset( $output['choice'] ) && isset( $value[ $output['choice'] ] ) && $exclude == $value[ $output['choice'] ] ) { |
|
220 | + if ( isset( $output['choice'] ) && isset( $value[$output['choice']] ) && $exclude == $value[$output['choice']] ) { |
|
221 | 221 | $skip = true; |
222 | 222 | } |
223 | 223 | } |
@@ -275,13 +275,13 @@ discard block |
||
275 | 275 | 'background', |
276 | 276 | ); |
277 | 277 | if ( in_array( $output['property'], $accepts_multiple, true ) ) { |
278 | - if ( isset( $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] ) && ! is_array( $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] ) ) { |
|
279 | - $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = (array) $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ]; |
|
278 | + if ( isset( $this->styles[$output['media_query']][$output['element']][$output['property']] ) && ! is_array( $this->styles[$output['media_query']][$output['element']][$output['property']] ) ) { |
|
279 | + $this->styles[$output['media_query']][$output['element']][$output['property']] = (array) $this->styles[$output['media_query']][$output['element']][$output['property']]; |
|
280 | 280 | } |
281 | - $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ][] = $output['prefix'] . $value . $output['units'] . $output['suffix']; |
|
281 | + $this->styles[$output['media_query']][$output['element']][$output['property']][] = $output['prefix'] . $value . $output['units'] . $output['suffix']; |
|
282 | 282 | return; |
283 | 283 | } |
284 | - $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = $output['prefix'] . $this->process_property_value( $output['property'], $value ) . $output['units'] . $output['suffix']; |
|
284 | + $this->styles[$output['media_query']][$output['element']][$output['property']] = $output['prefix'] . $this->process_property_value( $output['property'], $value ) . $output['units'] . $output['suffix']; |
|
285 | 285 | } |
286 | 286 | |
287 | 287 | /** |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | 'background-position' => 'Kirki_Output_Property_Background_Position', |
302 | 302 | ) ); |
303 | 303 | if ( array_key_exists( $property, $properties ) ) { |
304 | - $classname = $properties[ $property ]; |
|
304 | + $classname = $properties[$property]; |
|
305 | 305 | $obj = new $classname( $property, $value ); |
306 | 306 | return $obj->get_value(); |
307 | 307 | } |
@@ -45,13 +45,13 @@ |
||
45 | 45 | if ( false !== strpos( $output['property'], '%%' ) ) { |
46 | 46 | $property = str_replace( '%%', $key, $output['property'] ); |
47 | 47 | } |
48 | - $this->styles[ $output['media_query'] ][ $output['element'] ][ $property ] = $output['prefix'] . $this->process_property_value( $property, $value[ $key ] ) . $output['suffix']; |
|
48 | + $this->styles[$output['media_query']][$output['element']][$property] = $output['prefix'] . $this->process_property_value( $property, $value[$key] ) . $output['suffix']; |
|
49 | 49 | } |
50 | 50 | } elseif ( isset( $output['choice'] ) ) { |
51 | 51 | if ( false !== strpos( $output['property'], '%%' ) ) { |
52 | 52 | $output['property'] = str_replace( '%%', $key, $output['property'] ); |
53 | 53 | } |
54 | - $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = $output['prefix'] . $this->process_property_value( $output['property'], $value ) . $output['suffix']; |
|
54 | + $this->styles[$output['media_query']][$output['element']][$output['property']] = $output['prefix'] . $this->process_property_value( $output['property'], $value ) . $output['suffix']; |
|
55 | 55 | } |
56 | 56 | } |
57 | 57 | } |
@@ -141,11 +141,11 @@ discard block |
||
141 | 141 | } |
142 | 142 | |
143 | 143 | // Add the requested google-font. |
144 | - if ( ! isset( $this->fonts[ $value['font-family'] ] ) ) { |
|
145 | - $this->fonts[ $value['font-family'] ] = array(); |
|
144 | + if ( ! isset( $this->fonts[$value['font-family']] ) ) { |
|
145 | + $this->fonts[$value['font-family']] = array(); |
|
146 | 146 | } |
147 | - if ( ! in_array( $value['variant'], $this->fonts[ $value['font-family'] ], true ) ) { |
|
148 | - $this->fonts[ $value['font-family'] ][] = $value['variant']; |
|
147 | + if ( ! in_array( $value['variant'], $this->fonts[$value['font-family']], true ) ) { |
|
148 | + $this->fonts[$value['font-family']][] = $value['variant']; |
|
149 | 149 | } |
150 | 150 | // Are we force-loading all variants? |
151 | 151 | if ( true === self::$force_load_all_variants ) { |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | |
156 | 156 | if ( ! empty( $args['choices']['variant'] ) && is_array( $args['choices']['variant'] ) ) { |
157 | 157 | foreach ( $args['choices']['variant'] as $extra_variant ) { |
158 | - $this->fonts[ $value['font-family'] ][] = $extra_variant; |
|
158 | + $this->fonts[$value['font-family']][] = $extra_variant; |
|
159 | 159 | } |
160 | 160 | } |
161 | 161 | } else { |
@@ -175,12 +175,12 @@ discard block |
||
175 | 175 | if ( is_string( $value ) ) { |
176 | 176 | if ( 'font-family' === $output['property'] ) { |
177 | 177 | if ( ! array_key_exists( $value, $this->fonts ) ) { |
178 | - $this->fonts[ $value ] = array(); |
|
178 | + $this->fonts[$value] = array(); |
|
179 | 179 | } |
180 | 180 | } elseif ( 'font-weight' === $output['property'] ) { |
181 | 181 | foreach ( $this->fonts as $font => $variants ) { |
182 | 182 | if ( ! in_array( $value, $variants, true ) ) { |
183 | - $this->fonts[ $font ][] = $value; |
|
183 | + $this->fonts[$font][] = $value; |
|
184 | 184 | } |
185 | 185 | } |
186 | 186 | } elseif ( 'font-subset' === $output['property'] || 'subset' === $output['property'] || 'subsets' === $output['property'] ) { |
@@ -220,31 +220,31 @@ discard block |
||
220 | 220 | // Determine if this is indeed a google font or not. |
221 | 221 | // If it's not, then just remove it from the array. |
222 | 222 | if ( ! array_key_exists( $font, $this->google_fonts ) ) { |
223 | - unset( $this->fonts[ $font ] ); |
|
223 | + unset( $this->fonts[$font] ); |
|
224 | 224 | continue; |
225 | 225 | } |
226 | 226 | |
227 | 227 | // Get all valid font variants for this font. |
228 | 228 | $font_variants = array(); |
229 | - if ( isset( $this->google_fonts[ $font ]['variants'] ) ) { |
|
230 | - $font_variants = $this->google_fonts[ $font ]['variants']; |
|
229 | + if ( isset( $this->google_fonts[$font]['variants'] ) ) { |
|
230 | + $font_variants = $this->google_fonts[$font]['variants']; |
|
231 | 231 | } |
232 | 232 | foreach ( $variants as $variant ) { |
233 | 233 | |
234 | 234 | // If this is not a valid variant for this font-family |
235 | 235 | // then unset it and move on to the next one. |
236 | 236 | if ( ! in_array( $variant, $font_variants, true ) ) { |
237 | - $variant_key = array_search( $variant, $this->fonts[ $font ], true ); |
|
238 | - unset( $this->fonts[ $font ][ $variant_key ] ); |
|
237 | + $variant_key = array_search( $variant, $this->fonts[$font], true ); |
|
238 | + unset( $this->fonts[$font][$variant_key] ); |
|
239 | 239 | continue; |
240 | 240 | } |
241 | 241 | } |
242 | 242 | |
243 | 243 | // Check if the selected subsets exist, even in one of the selected fonts. |
244 | 244 | // If they don't, then they have to be removed otherwise the link will fail. |
245 | - if ( isset( $this->google_fonts[ $font ]['subsets'] ) ) { |
|
245 | + if ( isset( $this->google_fonts[$font]['subsets'] ) ) { |
|
246 | 246 | foreach ( $this->subsets as $subset ) { |
247 | - if ( in_array( $subset, $this->google_fonts[ $font ]['subsets'], true ) ) { |
|
247 | + if ( in_array( $subset, $this->google_fonts[$font]['subsets'], true ) ) { |
|
248 | 248 | $valid_subsets[] = $subset; |
249 | 249 | } |
250 | 250 | } |