@@ -38,7 +38,7 @@ |
||
38 | 38 | |
39 | 39 | // We're using a flat select. |
40 | 40 | foreach ( $this->choices as $key => $args ) { |
41 | - $this->choices[ $key ] = $args['label']; |
|
41 | + $this->choices[ $key ] = $args[ 'label' ]; |
|
42 | 42 | } |
43 | 43 | } |
44 | 44 | } |
@@ -36,12 +36,12 @@ |
||
36 | 36 | foreach ( array( 'background-image', 'background-color', 'background-repeat', 'background-position', 'background-size', 'background-attachment' ) as $property ) { |
37 | 37 | |
38 | 38 | // See https://github.com/aristath/kirki/issues/1808. |
39 | - if ( 'background-color' === $property && isset( $value['background-color'] ) && $value['background-color'] && ( ! isset( $value['background-image'] ) || empty( $value['background-image'] ) ) ) { |
|
40 | - $this->styles[ $output['media_query'] ][ $output['element'] ]['background'] = $output['prefix'] . $this->process_property_value( $property, $value[ $property ] ) . $output['suffix']; |
|
39 | + if ( 'background-color' === $property && isset( $value[ 'background-color' ] ) && $value[ 'background-color' ] && ( ! isset( $value[ 'background-image' ] ) || empty( $value[ 'background-image' ] ) ) ) { |
|
40 | + $this->styles[ $output[ 'media_query' ] ][ $output[ 'element' ] ][ 'background' ] = $output[ 'prefix' ] . $this->process_property_value( $property, $value[ $property ] ) . $output[ 'suffix' ]; |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | if ( isset( $value[ $property ] ) && ! empty( $value[ $property ] ) ) { |
44 | - $this->styles[ $output['media_query'] ][ $output['element'] ][ $property ] = $output['prefix'] . $this->process_property_value( $property, $value[ $property ] ) . $output['suffix']; |
|
44 | + $this->styles[ $output[ 'media_query' ] ][ $output[ 'element' ] ][ $property ] = $output[ 'prefix' ] . $this->process_property_value( $property, $value[ $property ] ) . $output[ 'suffix' ]; |
|
45 | 45 | } |
46 | 46 | } |
47 | 47 | } |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | $config = apply_filters( 'kirki_config', array() ); |
78 | 78 | |
79 | 79 | // If we have set $config['disable_google_fonts'] to true then do not proceed any further. |
80 | - if ( isset( $config['disable_google_fonts'] ) && true === $config['disable_google_fonts'] ) { |
|
80 | + if ( isset( $config[ 'disable_google_fonts' ] ) && true === $config[ 'disable_google_fonts' ] ) { |
|
81 | 81 | return; |
82 | 82 | } |
83 | 83 | |
@@ -115,57 +115,57 @@ discard block |
||
115 | 115 | global $wp_customize; |
116 | 116 | |
117 | 117 | // Process typography fields. |
118 | - if ( isset( $args['type'] ) && 'kirki-typography' === $args['type'] ) { |
|
118 | + if ( isset( $args[ 'type' ] ) && 'kirki-typography' === $args[ 'type' ] ) { |
|
119 | 119 | |
120 | 120 | // Get the value. |
121 | 121 | $value = Kirki_Values::get_sanitized_field_value( $args ); |
122 | 122 | |
123 | - if ( isset( $value['downloadFont'] ) && $value['downloadFont'] ) { |
|
124 | - $this->hosted_fonts[] = $value['font-family']; |
|
123 | + if ( isset( $value[ 'downloadFont' ] ) && $value[ 'downloadFont' ] ) { |
|
124 | + $this->hosted_fonts[ ] = $value[ 'font-family' ]; |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | // If we don't have a font-family then we can skip this. |
128 | - if ( ! $wp_customize && ( ! isset( $value['font-family'] ) || in_array( $value['font-family'], $this->hosted_fonts, true ) ) ) { |
|
128 | + if ( ! $wp_customize && ( ! isset( $value[ 'font-family' ] ) || in_array( $value[ 'font-family' ], $this->hosted_fonts, true ) ) ) { |
|
129 | 129 | return; |
130 | 130 | } |
131 | 131 | |
132 | 132 | // If not a google-font, then we can skip this. |
133 | - if ( ! isset( $value['font-family'] ) || ! Kirki_Fonts::is_google_font( $value['font-family'] ) ) { |
|
133 | + if ( ! isset( $value[ 'font-family' ] ) || ! Kirki_Fonts::is_google_font( $value[ 'font-family' ] ) ) { |
|
134 | 134 | return; |
135 | 135 | } |
136 | 136 | |
137 | 137 | // Set a default value for variants. |
138 | - if ( ! isset( $value['variant'] ) ) { |
|
139 | - $value['variant'] = 'regular'; |
|
138 | + if ( ! isset( $value[ 'variant' ] ) ) { |
|
139 | + $value[ 'variant' ] = 'regular'; |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | // Add the requested google-font. |
143 | - if ( ! isset( $this->fonts[ $value['font-family'] ] ) ) { |
|
144 | - $this->fonts[ $value['font-family'] ] = array(); |
|
143 | + if ( ! isset( $this->fonts[ $value[ 'font-family' ] ] ) ) { |
|
144 | + $this->fonts[ $value[ 'font-family' ] ] = array(); |
|
145 | 145 | } |
146 | - if ( ! in_array( $value['variant'], $this->fonts[ $value['font-family'] ], true ) ) { |
|
147 | - $this->fonts[ $value['font-family'] ][] = $value['variant']; |
|
146 | + if ( ! in_array( $value[ 'variant' ], $this->fonts[ $value[ 'font-family' ] ], true ) ) { |
|
147 | + $this->fonts[ $value[ 'font-family' ] ][ ] = $value[ 'variant' ]; |
|
148 | 148 | } |
149 | 149 | // Are we force-loading all variants? |
150 | 150 | if ( true === self::$force_load_all_variants ) { |
151 | 151 | $all_variants = Kirki_Fonts::get_all_variants(); |
152 | - $args['choices']['variant'] = array_keys( $all_variants ); |
|
152 | + $args[ 'choices' ][ 'variant' ] = array_keys( $all_variants ); |
|
153 | 153 | } |
154 | 154 | |
155 | - if ( ! empty( $args['choices']['variant'] ) && is_array( $args['choices']['variant'] ) ) { |
|
156 | - foreach ( $args['choices']['variant'] as $extra_variant ) { |
|
157 | - $this->fonts[ $value['font-family'] ][] = $extra_variant; |
|
155 | + if ( ! empty( $args[ 'choices' ][ 'variant' ] ) && is_array( $args[ 'choices' ][ 'variant' ] ) ) { |
|
156 | + foreach ( $args[ 'choices' ][ 'variant' ] as $extra_variant ) { |
|
157 | + $this->fonts[ $value[ 'font-family' ] ][ ] = $extra_variant; |
|
158 | 158 | } |
159 | 159 | } |
160 | 160 | return; |
161 | 161 | } |
162 | 162 | |
163 | 163 | // Process non-typography fields. |
164 | - if ( isset( $args['output'] ) && is_array( $args['output'] ) ) { |
|
165 | - foreach ( $args['output'] as $output ) { |
|
164 | + if ( isset( $args[ 'output' ] ) && is_array( $args[ 'output' ] ) ) { |
|
165 | + foreach ( $args[ 'output' ] as $output ) { |
|
166 | 166 | |
167 | 167 | // If we don't have a typography-related output argument we can skip this. |
168 | - if ( ! isset( $output['property'] ) || ! in_array( $output['property'], array( 'font-family', 'font-weight' ), true ) ) { |
|
168 | + if ( ! isset( $output[ 'property' ] ) || ! in_array( $output[ 'property' ], array( 'font-family', 'font-weight' ), true ) ) { |
|
169 | 169 | continue; |
170 | 170 | } |
171 | 171 | |
@@ -173,14 +173,14 @@ discard block |
||
173 | 173 | $value = Kirki_Values::get_sanitized_field_value( $args ); |
174 | 174 | |
175 | 175 | if ( is_string( $value ) ) { |
176 | - if ( 'font-family' === $output['property'] ) { |
|
176 | + if ( 'font-family' === $output[ 'property' ] ) { |
|
177 | 177 | if ( ! array_key_exists( $value, $this->fonts ) ) { |
178 | 178 | $this->fonts[ $value ] = array(); |
179 | 179 | } |
180 | - } elseif ( 'font-weight' === $output['property'] ) { |
|
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 | } |
@@ -212,8 +212,8 @@ discard block |
||
212 | 212 | |
213 | 213 | // Get all valid font variants for this font. |
214 | 214 | $font_variants = array(); |
215 | - if ( isset( $this->google_fonts[ $font ]['variants'] ) ) { |
|
216 | - $font_variants = $this->google_fonts[ $font ]['variants']; |
|
215 | + if ( isset( $this->google_fonts[ $font ][ 'variants' ] ) ) { |
|
216 | + $font_variants = $this->google_fonts[ $font ][ 'variants' ]; |
|
217 | 217 | } |
218 | 218 | foreach ( $variants as $variant ) { |
219 | 219 |
@@ -453,7 +453,8 @@ |
||
453 | 453 | $variants = array_keys( $this->files ); |
454 | 454 | } |
455 | 455 | foreach ( $this->files as $variant => $file ) { |
456 | - if ( in_array( $variant, $variants ) ) { // phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict |
|
456 | + if ( in_array( $variant, $variants ) ) { |
|
457 | +// phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict |
|
457 | 458 | $this->download_font_file( $file ); |
458 | 459 | } |
459 | 460 | } |
@@ -202,13 +202,13 @@ discard block |
||
202 | 202 | } |
203 | 203 | |
204 | 204 | // Return regular if the one we want could not be found. |
205 | - if ( isset( $local_urls['regular'] ) ) { |
|
206 | - return $local_urls['regular']; |
|
205 | + if ( isset( $local_urls[ 'regular' ] ) ) { |
|
206 | + return $local_urls[ 'regular' ]; |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | // Return the first available if all else failed. |
210 | 210 | $vals = array_values( $local_urls ); |
211 | - return $vals[0]; |
|
211 | + return $vals[ 0 ]; |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | /** |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | |
402 | 402 | // Get the upload directory for this site. |
403 | 403 | $upload_dir = wp_upload_dir(); |
404 | - $path = untrailingslashit( wp_normalize_path( $upload_dir['basedir'] ) ) . '/webfonts'; |
|
404 | + $path = untrailingslashit( wp_normalize_path( $upload_dir[ 'basedir' ] ) ) . '/webfonts'; |
|
405 | 405 | |
406 | 406 | // If the folder doesn't exist, create it. |
407 | 407 | if ( ! file_exists( $path ) ) { |
@@ -426,7 +426,7 @@ discard block |
||
426 | 426 | $upload_dir = wp_upload_dir(); |
427 | 427 | |
428 | 428 | // The URL. |
429 | - $url = trailingslashit( $upload_dir['baseurl'] ); |
|
429 | + $url = trailingslashit( $upload_dir[ 'baseurl' ] ); |
|
430 | 430 | |
431 | 431 | // Take care of domain mapping. |
432 | 432 | // When using domain mapping we have to make sure that the URL to the file |
@@ -69,14 +69,14 @@ |
||
69 | 69 | |
70 | 70 | // Start parsing the fields. |
71 | 71 | foreach ( $fields as $field ) { |
72 | - if ( isset( $field['partial_refresh'] ) && ! empty( $field['partial_refresh'] ) ) { |
|
72 | + if ( isset( $field[ 'partial_refresh' ] ) && ! empty( $field[ 'partial_refresh' ] ) ) { |
|
73 | 73 | // Start going through each item in the array of partial refreshes. |
74 | - foreach ( $field['partial_refresh'] as $partial_refresh => $partial_refresh_args ) { |
|
74 | + foreach ( $field[ 'partial_refresh' ] as $partial_refresh => $partial_refresh_args ) { |
|
75 | 75 | // If we have all we need, create the selective refresh call. |
76 | - if ( isset( $partial_refresh_args['render_callback'] ) && isset( $partial_refresh_args['selector'] ) ) { |
|
76 | + if ( isset( $partial_refresh_args[ 'render_callback' ] ) && isset( $partial_refresh_args[ 'selector' ] ) ) { |
|
77 | 77 | $partial_refresh_args = wp_parse_args( |
78 | 78 | $partial_refresh_args, array( |
79 | - 'settings' => $field['settings'], |
|
79 | + 'settings' => $field[ 'settings' ], |
|
80 | 80 | ) |
81 | 81 | ); |
82 | 82 | $wp_customize->selective_refresh->add_partial( $partial_refresh, $partial_refresh_args ); |
@@ -73,14 +73,14 @@ |
||
73 | 73 | 'logoImage' => '', |
74 | 74 | 'description' => '', |
75 | 75 | ); |
76 | - if ( isset( $config['logo_image'] ) && '' !== $config['logo_image'] ) { |
|
77 | - $vars['logoImage'] = esc_url_raw( $config['logo_image'] ); |
|
76 | + if ( isset( $config[ 'logo_image' ] ) && '' !== $config[ 'logo_image' ] ) { |
|
77 | + $vars[ 'logoImage' ] = esc_url_raw( $config[ 'logo_image' ] ); |
|
78 | 78 | } |
79 | - if ( isset( $config['description'] ) && '' !== $config['description'] ) { |
|
80 | - $vars['description'] = esc_textarea( $config['description'] ); |
|
79 | + if ( isset( $config[ 'description' ] ) && '' !== $config[ 'description' ] ) { |
|
80 | + $vars[ 'description' ] = esc_textarea( $config[ 'description' ] ); |
|
81 | 81 | } |
82 | 82 | |
83 | - if ( ! empty( $vars['logoImage'] ) || ! empty( $vars['description'] ) ) { |
|
83 | + if ( ! empty( $vars[ 'logoImage' ] ) || ! empty( $vars[ 'description' ] ) ) { |
|
84 | 84 | wp_register_script( 'kirki-branding', Kirki::$url . '/modules/customizer-branding/branding.js', array(), KIRKI_VERSION, false ); |
85 | 85 | wp_localize_script( 'kirki-branding', 'kirkiBranding', $vars ); |
86 | 86 | wp_enqueue_script( 'kirki-branding' ); |
@@ -51,10 +51,10 @@ |
||
51 | 51 | ) |
52 | 52 | ); |
53 | 53 | |
54 | - $array['title'] = html_entity_decode( $this->title, ENT_QUOTES, get_bloginfo( 'charset' ) ); |
|
55 | - $array['content'] = $this->get_content(); |
|
56 | - $array['active'] = $this->active(); |
|
57 | - $array['instanceNumber'] = $this->instance_number; |
|
54 | + $array[ 'title' ] = html_entity_decode( $this->title, ENT_QUOTES, get_bloginfo( 'charset' ) ); |
|
55 | + $array[ 'content' ] = $this->get_content(); |
|
56 | + $array[ 'active' ] = $this->active(); |
|
57 | + $array[ 'instanceNumber' ] = $this->instance_number; |
|
58 | 58 | |
59 | 59 | return $array; |
60 | 60 | } |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | |
37 | 37 | // Handle the arguments, merge one by one. |
38 | 38 | $args = func_get_args(); |
39 | - $array = $args[0]; |
|
39 | + $array = $args[ 0 ]; |
|
40 | 40 | if ( ! is_array( $array ) ) { |
41 | 41 | return $array; |
42 | 42 | } |
@@ -92,27 +92,27 @@ discard block |
||
92 | 92 | |
93 | 93 | if ( 'ftpext' === $method ) { |
94 | 94 | // If defined, set it to that, Else, set to NULL. |
95 | - $credentials['hostname'] = defined( 'FTP_HOST' ) ? preg_replace( '|\w+://|', '', FTP_HOST ) : null; |
|
96 | - $credentials['username'] = defined( 'FTP_USER' ) ? FTP_USER : null; |
|
97 | - $credentials['password'] = defined( 'FTP_PASS' ) ? FTP_PASS : null; |
|
95 | + $credentials[ 'hostname' ] = defined( 'FTP_HOST' ) ? preg_replace( '|\w+://|', '', FTP_HOST ) : null; |
|
96 | + $credentials[ 'username' ] = defined( 'FTP_USER' ) ? FTP_USER : null; |
|
97 | + $credentials[ 'password' ] = defined( 'FTP_PASS' ) ? FTP_PASS : null; |
|
98 | 98 | |
99 | 99 | // Set FTP port. |
100 | - if ( strpos( $credentials['hostname'], ':' ) && null !== $credentials['hostname'] ) { |
|
101 | - list( $credentials['hostname'], $credentials['port'] ) = explode( ':', $credentials['hostname'], 2 ); |
|
102 | - if ( ! is_numeric( $credentials['port'] ) ) { |
|
103 | - unset( $credentials['port'] ); |
|
100 | + if ( strpos( $credentials[ 'hostname' ], ':' ) && null !== $credentials[ 'hostname' ] ) { |
|
101 | + list( $credentials[ 'hostname' ], $credentials[ 'port' ] ) = explode( ':', $credentials[ 'hostname' ], 2 ); |
|
102 | + if ( ! is_numeric( $credentials[ 'port' ] ) ) { |
|
103 | + unset( $credentials[ 'port' ] ); |
|
104 | 104 | } |
105 | 105 | } else { |
106 | - unset( $credentials['port'] ); |
|
106 | + unset( $credentials[ 'port' ] ); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | // Set connection type. |
110 | 110 | if ( ( defined( 'FTP_SSL' ) && FTP_SSL ) && 'ftpext' === $method ) { |
111 | - $credentials['connection_type'] = 'ftps'; |
|
111 | + $credentials[ 'connection_type' ] = 'ftps'; |
|
112 | 112 | } elseif ( ! array_filter( $credentials ) ) { |
113 | - $credentials['connection_type'] = null; |
|
113 | + $credentials[ 'connection_type' ] = null; |
|
114 | 114 | } else { |
115 | - $credentials['connection_type'] = 'ftp'; |
|
115 | + $credentials[ 'connection_type' ] = 'ftp'; |
|
116 | 116 | } |
117 | 117 | } |
118 | 118 | |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | } |
150 | 150 | |
151 | 151 | if ( ! empty( $attachment ) ) { |
152 | - return $attachment[0]; |
|
152 | + return $attachment[ 0 ]; |
|
153 | 153 | } |
154 | 154 | return 0; |
155 | 155 | } |
@@ -166,10 +166,10 @@ discard block |
||
166 | 166 | $image = wp_get_attachment_image_src( $image_id, 'full' ); |
167 | 167 | |
168 | 168 | return array( |
169 | - 'url' => $image[0], |
|
170 | - 'width' => $image[1], |
|
171 | - 'height' => $image[2], |
|
172 | - 'thumbnail' => $image[3], |
|
169 | + 'url' => $image[ 0 ], |
|
170 | + 'width' => $image[ 1 ], |
|
171 | + 'height' => $image[ 2 ], |
|
172 | + 'thumbnail' => $image[ 3 ], |
|
173 | 173 | ); |
174 | 174 | |
175 | 175 | } |
@@ -190,8 +190,8 @@ discard block |
||
190 | 190 | 'suppress_filters' => false, |
191 | 191 | ) |
192 | 192 | ); |
193 | - } elseif ( is_array( $args ) && ! isset( $args['suppress_filters'] ) ) { |
|
194 | - $args['suppress_filters'] = false; |
|
193 | + } elseif ( is_array( $args ) && ! isset( $args[ 'suppress_filters' ] ) ) { |
|
194 | + $args[ 'suppress_filters' ] = false; |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | // Get the posts. |
@@ -341,41 +341,41 @@ discard block |
||
341 | 341 | $key = absint( $context ) / 100; |
342 | 342 | if ( 'A100' === $context ) { |
343 | 343 | $key = 10; |
344 | - unset( $colors['grey'] ); |
|
344 | + unset( $colors[ 'grey' ] ); |
|
345 | 345 | } elseif ( 'A200' === $context ) { |
346 | 346 | $key = 11; |
347 | - unset( $colors['grey'] ); |
|
347 | + unset( $colors[ 'grey' ] ); |
|
348 | 348 | } elseif ( 'A400' === $context ) { |
349 | 349 | $key = 12; |
350 | - unset( $colors['grey'] ); |
|
350 | + unset( $colors[ 'grey' ] ); |
|
351 | 351 | } elseif ( 'A700' === $context ) { |
352 | 352 | $key = 13; |
353 | - unset( $colors['grey'] ); |
|
353 | + unset( $colors[ 'grey' ] ); |
|
354 | 354 | } |
355 | - unset( $colors['primary'] ); |
|
355 | + unset( $colors[ 'primary' ] ); |
|
356 | 356 | $position_colors = array(); |
357 | 357 | foreach ( $colors as $color_family ) { |
358 | 358 | if ( isset( $color_family[ $key ] ) ) { |
359 | - $position_colors[] = $color_family[ $key ]; |
|
359 | + $position_colors[ ] = $color_family[ $key ]; |
|
360 | 360 | } |
361 | 361 | } |
362 | 362 | return $position_colors; |
363 | 363 | case 'all': |
364 | - unset( $colors['primary'] ); |
|
364 | + unset( $colors[ 'primary' ] ); |
|
365 | 365 | $all_colors = array(); |
366 | 366 | foreach ( $colors as $color_family ) { |
367 | 367 | foreach ( $color_family as $color ) { |
368 | - $all_colors[] = $color; |
|
368 | + $all_colors[ ] = $color; |
|
369 | 369 | } |
370 | 370 | } |
371 | 371 | return $all_colors; |
372 | 372 | case 'primary': |
373 | - return $colors['primary']; |
|
373 | + return $colors[ 'primary' ]; |
|
374 | 374 | default: |
375 | 375 | if ( isset( $colors[ $context ] ) ) { |
376 | 376 | return $colors[ $context ]; |
377 | 377 | } |
378 | - return $colors['primary']; |
|
378 | + return $colors[ 'primary' ]; |
|
379 | 379 | } |
380 | 380 | } |
381 | 381 |
@@ -441,7 +441,8 @@ |
||
441 | 441 | if ( 'contains' === $operator || 'in' === $operator ) { |
442 | 442 | if ( is_array( $value1 ) && is_array( $value2 ) ) { |
443 | 443 | foreach ( $value2 as $val ) { |
444 | - if ( in_array( $val, $value1 ) ) { // phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict |
|
444 | + if ( in_array( $val, $value1 ) ) { |
|
445 | +// phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict |
|
445 | 446 | return true; |
446 | 447 | } |
447 | 448 | } |
@@ -20,8 +20,8 @@ |
||
20 | 20 | * @access protected |
21 | 21 | */ |
22 | 22 | protected function process_value() { |
23 | - if ( is_array( $this->value ) && isset( $this->value['url'] ) ) { |
|
24 | - $this->value = $this->value['url']; |
|
23 | + if ( is_array( $this->value ) && isset( $this->value[ 'url' ] ) ) { |
|
24 | + $this->value = $this->value[ 'url' ]; |
|
25 | 25 | } |
26 | 26 | if ( false === strpos( $this->value, 'gradient' ) && false === strpos( $this->value, 'url(' ) ) { |
27 | 27 | if ( empty( $this->value ) ) { |