@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | |
145 | 145 | $config = Kirki_Config::get_instance( $config_id, $args ); |
146 | 146 | $config_args = $config->get_config(); |
147 | - self::$config[ $config_args['id'] ] = $config_args; |
|
147 | + self::$config[ $config_args[ 'id' ] ] = $config_args; |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | /** |
@@ -157,13 +157,13 @@ discard block |
||
157 | 157 | */ |
158 | 158 | public static function add_panel( $id = '', $args = array() ) { |
159 | 159 | |
160 | - $args['id'] = esc_attr( $id ); |
|
161 | - $args['description'] = ( isset( $args['description'] ) ) ? $args['description'] : ''; |
|
162 | - $args['priority'] = ( isset( $args['priority'] ) ) ? absint( $args['priority'] ) : 10; |
|
163 | - $args['type'] = ( isset( $args['type'] ) ) ? $args['type'] : 'default'; |
|
164 | - $args['type'] = 'kirki-' . $args['type']; |
|
160 | + $args[ 'id' ] = esc_attr( $id ); |
|
161 | + $args[ 'description' ] = ( isset( $args[ 'description' ] ) ) ? $args[ 'description' ] : ''; |
|
162 | + $args[ 'priority' ] = ( isset( $args[ 'priority' ] ) ) ? absint( $args[ 'priority' ] ) : 10; |
|
163 | + $args[ 'type' ] = ( isset( $args[ 'type' ] ) ) ? $args[ 'type' ] : 'default'; |
|
164 | + $args[ 'type' ] = 'kirki-' . $args[ 'type' ]; |
|
165 | 165 | |
166 | - self::$panels[ $args['id'] ] = $args; |
|
166 | + self::$panels[ $args[ 'id' ] ] = $args; |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | /** |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | */ |
177 | 177 | public static function remove_panel( $id = '' ) { |
178 | 178 | if ( ! in_array( $id, self::$panels_to_remove, true ) ) { |
179 | - self::$panels_to_remove[] = $id; |
|
179 | + self::$panels_to_remove[ ] = $id; |
|
180 | 180 | } |
181 | 181 | } |
182 | 182 | |
@@ -190,14 +190,14 @@ discard block |
||
190 | 190 | */ |
191 | 191 | public static function add_section( $id, $args ) { |
192 | 192 | |
193 | - $args['id'] = esc_attr( $id ); |
|
194 | - $args['panel'] = ( isset( $args['panel'] ) ) ? esc_attr( $args['panel'] ) : ''; |
|
195 | - $args['description'] = ( isset( $args['description'] ) ) ? $args['description'] : ''; |
|
196 | - $args['priority'] = ( isset( $args['priority'] ) ) ? absint( $args['priority'] ) : 10; |
|
197 | - $args['type'] = ( isset( $args['type'] ) ) ? $args['type'] : 'default'; |
|
198 | - $args['type'] = 'kirki-' . $args['type']; |
|
193 | + $args[ 'id' ] = esc_attr( $id ); |
|
194 | + $args[ 'panel' ] = ( isset( $args[ 'panel' ] ) ) ? esc_attr( $args[ 'panel' ] ) : ''; |
|
195 | + $args[ 'description' ] = ( isset( $args[ 'description' ] ) ) ? $args[ 'description' ] : ''; |
|
196 | + $args[ 'priority' ] = ( isset( $args[ 'priority' ] ) ) ? absint( $args[ 'priority' ] ) : 10; |
|
197 | + $args[ 'type' ] = ( isset( $args[ 'type' ] ) ) ? $args[ 'type' ] : 'default'; |
|
198 | + $args[ 'type' ] = 'kirki-' . $args[ 'type' ]; |
|
199 | 199 | |
200 | - self::$sections[ $args['id'] ] = $args; |
|
200 | + self::$sections[ $args[ 'id' ] ] = $args; |
|
201 | 201 | } |
202 | 202 | |
203 | 203 | /** |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | */ |
211 | 211 | public static function remove_section( $id = '' ) { |
212 | 212 | if ( ! in_array( $id, self::$sections_to_remove, true ) ) { |
213 | - self::$sections_to_remove[] = $id; |
|
213 | + self::$sections_to_remove[ ] = $id; |
|
214 | 214 | } |
215 | 215 | } |
216 | 216 | |
@@ -229,16 +229,16 @@ discard block |
||
229 | 229 | } |
230 | 230 | |
231 | 231 | // Early exit if 'type' is not defined. |
232 | - if ( ! isset( $args['type'] ) ) { |
|
232 | + if ( ! isset( $args[ 'type' ] ) ) { |
|
233 | 233 | return; |
234 | 234 | } |
235 | 235 | |
236 | 236 | // If the field is font-awesome, enqueue the icons on the frontend. |
237 | - if ( class_exists( 'Kirki_Modules_CSS' ) && ( 'fontawesome' === $args['type'] || 'kirki-fontawesome' === $args['type'] ) ) { |
|
237 | + if ( class_exists( 'Kirki_Modules_CSS' ) && ( 'fontawesome' === $args[ 'type' ] || 'kirki-fontawesome' === $args[ 'type' ] ) ) { |
|
238 | 238 | Kirki_Modules_CSS::add_fontawesome_script(); |
239 | 239 | } |
240 | 240 | |
241 | - $str = str_replace( array( '-', '_' ), ' ', $args['type'] ); |
|
241 | + $str = str_replace( array( '-', '_' ), ' ', $args[ 'type' ] ); |
|
242 | 242 | $classname = 'Kirki_Field_' . str_replace( ' ', '_', ucwords( $str ) ); |
243 | 243 | if ( class_exists( $classname ) ) { |
244 | 244 | new $classname( $config_id, $args ); |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | */ |
267 | 267 | public static function remove_control( $id ) { |
268 | 268 | if ( ! in_array( $id, self::$controls_to_remove, true ) ) { |
269 | - self::$controls_to_remove[] = $id; |
|
269 | + self::$controls_to_remove[ ] = $id; |
|
270 | 270 | } |
271 | 271 | } |
272 | 272 |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | $fonts_to_load = $this->googlefonts->fonts; |
78 | 78 | |
79 | 79 | if ( ! empty( $fonts_to_load ) && 'preconnect' === $relation_type ) { |
80 | - $urls[] = array( |
|
80 | + $urls[ ] = array( |
|
81 | 81 | 'href' => 'https://fonts.gstatic.com', |
82 | 82 | 'crossorigin', |
83 | 83 | ); |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | $weights[ $key ] = str_replace( array( 'regular', 'bold', 'italic' ), array( '400', '', 'i' ), $value ); |
112 | 112 | } |
113 | 113 | } |
114 | - $fonts_to_load[] = $font . ':' . join( ',', $weights ) . ':cyrillic,cyrillic-ext,devanagari,greek,greek-ext,khmer,latin,latin-ext,vietnamese,hebrew,arabic,bengali,gujarati,tamil,telugu,thai'; |
|
114 | + $fonts_to_load[ ] = $font . ':' . join( ',', $weights ) . ':cyrillic,cyrillic-ext,devanagari,greek,greek-ext,khmer,latin,latin-ext,vietnamese,hebrew,arabic,bengali,gujarati,tamil,telugu,thai'; |
|
115 | 115 | } |
116 | 116 | wp_enqueue_script( 'webfont-loader', 'https://ajax.googleapis.com/ajax/libs/webfont/1.6.26/webfont.js', array() ); |
117 | 117 | if ( empty( $fonts_to_load ) ) { |
@@ -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-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-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 | } |
@@ -49,13 +49,13 @@ discard block |
||
49 | 49 | protected function set_default() { |
50 | 50 | |
51 | 51 | // Accomodate the use of font-weight and convert to variant. |
52 | - if ( isset( $this->default['font-weight'] ) ) { |
|
53 | - $this->default['variant'] = ( 'regular' === $this->default['font-weight'] ) ? 400 : (string) intval( $this->default['font-weight'] ); |
|
52 | + if ( isset( $this->default[ 'font-weight' ] ) ) { |
|
53 | + $this->default[ 'variant' ] = ( 'regular' === $this->default[ 'font-weight' ] ) ? 400 : (string) intval( $this->default[ 'font-weight' ] ); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | // Make sure letter-spacing has units. |
57 | - if ( isset( $this->default['letter-spacing'] ) && is_numeric( $this->default['letter-spacing'] ) && $this->default['letter-spacing'] ) { |
|
58 | - $this->default['letter-spacing'] .= 'px'; |
|
57 | + if ( isset( $this->default[ 'letter-spacing' ] ) && is_numeric( $this->default[ 'letter-spacing' ] ) && $this->default[ 'letter-spacing' ] ) { |
|
58 | + $this->default[ 'letter-spacing' ] .= 'px'; |
|
59 | 59 | } |
60 | 60 | } |
61 | 61 | |
@@ -106,15 +106,15 @@ discard block |
||
106 | 106 | foreach ( $this->output as $output ) { |
107 | 107 | |
108 | 108 | // If 'element' or 'property' are not defined, skip this. |
109 | - if ( ! isset( $output['element'] ) ) { |
|
109 | + if ( ! isset( $output[ 'element' ] ) ) { |
|
110 | 110 | continue; |
111 | 111 | } |
112 | - if ( is_array( $output['element'] ) ) { |
|
113 | - $output['element'] = implode( ',', $output['element'] ); |
|
112 | + if ( is_array( $output[ 'element' ] ) ) { |
|
113 | + $output[ 'element' ] = implode( ',', $output[ 'element' ] ); |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | // If we got this far, it's safe to add this. |
117 | - $js_vars[] = $output; |
|
117 | + $js_vars[ ] = $output; |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | // Did we manage to get all the items from 'output'? |
@@ -146,26 +146,26 @@ discard block |
||
146 | 146 | foreach ( $value as $key => $val ) { |
147 | 147 | switch ( $key ) { |
148 | 148 | case 'font-family': |
149 | - $value['font-family'] = esc_attr( $val ); |
|
149 | + $value[ 'font-family' ] = esc_attr( $val ); |
|
150 | 150 | break; |
151 | 151 | case 'font-weight': |
152 | - if ( isset( $value['variant'] ) ) { |
|
152 | + if ( isset( $value[ 'variant' ] ) ) { |
|
153 | 153 | break; |
154 | 154 | } |
155 | - $value['variant'] = $val; |
|
156 | - if ( isset( $value['font-style'] ) && 'italic' === $value['font-style'] ) { |
|
157 | - $value['variant'] = ( '400' !== $val || 400 !== $val ) ? $value['variant'] . 'italic' : 'italic'; |
|
155 | + $value[ 'variant' ] = $val; |
|
156 | + if ( isset( $value[ 'font-style' ] ) && 'italic' === $value[ 'font-style' ] ) { |
|
157 | + $value[ 'variant' ] = ( '400' !== $val || 400 !== $val ) ? $value[ 'variant' ] . 'italic' : 'italic'; |
|
158 | 158 | } |
159 | 159 | break; |
160 | 160 | case 'variant': |
161 | 161 | // Use 'regular' instead of 400 for font-variant. |
162 | - $value['variant'] = ( 400 === $val || '400' === $val ) ? 'regular' : $val; |
|
162 | + $value[ 'variant' ] = ( 400 === $val || '400' === $val ) ? 'regular' : $val; |
|
163 | 163 | // Get font-weight from variant. |
164 | - $value['font-weight'] = filter_var( $value['variant'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION ); |
|
165 | - $value['font-weight'] = ( 'regular' === $value['variant'] || 'italic' === $value['variant'] ) ? 400 : absint( $value['font-weight'] ); |
|
164 | + $value[ 'font-weight' ] = filter_var( $value[ 'variant' ], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION ); |
|
165 | + $value[ 'font-weight' ] = ( 'regular' === $value[ 'variant' ] || 'italic' === $value[ 'variant' ] ) ? 400 : absint( $value[ 'font-weight' ] ); |
|
166 | 166 | // Get font-style from variant. |
167 | - if ( ! isset( $value['font-style'] ) ) { |
|
168 | - $value['font-style'] = ( false === strpos( $value['variant'], 'italic' ) ) ? 'normal' : 'italic'; |
|
167 | + if ( ! isset( $value[ 'font-style' ] ) ) { |
|
168 | + $value[ 'font-style' ] = ( false === strpos( $value[ 'variant' ], 'italic' ) ) ? 'normal' : 'italic'; |
|
169 | 169 | } |
170 | 170 | break; |
171 | 171 | case 'font-size': |
@@ -176,21 +176,21 @@ discard block |
||
176 | 176 | break; |
177 | 177 | case 'text-align': |
178 | 178 | if ( ! in_array( $val, array( '', 'inherit', 'left', 'center', 'right', 'justify' ), true ) ) { |
179 | - $value['text-align'] = ''; |
|
179 | + $value[ 'text-align' ] = ''; |
|
180 | 180 | } |
181 | 181 | break; |
182 | 182 | case 'text-transform': |
183 | 183 | if ( ! in_array( $val, array( '', 'none', 'capitalize', 'uppercase', 'lowercase', 'initial', 'inherit' ), true ) ) { |
184 | - $value['text-transform'] = ''; |
|
184 | + $value[ 'text-transform' ] = ''; |
|
185 | 185 | } |
186 | 186 | break; |
187 | 187 | case 'text-decoration': |
188 | - if ( ! in_array( $val, array( ''. 'none', 'underline', 'overline', 'line-through', 'initial', 'inherit' ), true ) ) { |
|
189 | - $value['text-transform'] = ''; |
|
188 | + if ( ! in_array( $val, array( '' . 'none', 'underline', 'overline', 'line-through', 'initial', 'inherit' ), true ) ) { |
|
189 | + $value[ 'text-transform' ] = ''; |
|
190 | 190 | } |
191 | 191 | break; |
192 | 192 | case 'color': |
193 | - $value['color'] = '' === $value['color'] ? '' : ariColor::newColor( $val )->toCSS( 'hex' ); |
|
193 | + $value[ 'color' ] = '' === $value[ 'color' ] ? '' : ariColor::newColor( $val )->toCSS( 'hex' ); |
|
194 | 194 | break; |
195 | 195 | } // End switch(). |
196 | 196 | } // End foreach(). |