Completed
Pull Request — master (#1693)
by Aristeides
04:13 queued 02:05
created
core/class-kirki.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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'] ) ) ? esc_textarea( $args['description'] ) : '';
162
-		$args['priority']    = ( isset( $args['priority'] ) ) ? esc_attr( $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' ] ) ) ? esc_textarea( $args[ 'description' ] ) : '';
162
+		$args[ 'priority' ]    = ( isset( $args[ 'priority' ] ) ) ? esc_attr( $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
 block discarded – undo
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
 block discarded – undo
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'] ) ) ? esc_textarea( $args['description'] ) : '';
196
-		$args['priority']    = ( isset( $args['priority'] ) ) ? esc_attr( $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' ] ) ) ? esc_textarea( $args[ 'description' ] ) : '';
196
+		$args[ 'priority' ]    = ( isset( $args[ 'priority' ] ) ) ? esc_attr( $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
 block discarded – undo
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,11 +229,11 @@  discard block
 block discarded – undo
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
-		$str = str_replace( array( '-', '_' ), ' ', $args['type'] );
236
+		$str = str_replace( array( '-', '_' ), ' ', $args[ 'type' ] );
237 237
 		$classname = 'Kirki_Field_' . str_replace( ' ', '_', ucwords( $str ) );
238 238
 		if ( class_exists( $classname ) ) {
239 239
 			new $classname( $config_id, $args );
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
 	 */
262 262
 	public static function remove_control( $id ) {
263 263
 		if ( ! in_array( $id, self::$controls_to_remove, true ) ) {
264
-			self::$controls_to_remove[] = $id;
264
+			self::$controls_to_remove[ ] = $id;
265 265
 		}
266 266
 	}
267 267
 
Please login to merge, or discard this patch.
modules/css/class-kirki-modules-css.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -119,12 +119,12 @@  discard block
 block discarded – undo
119 119
 
120 120
 		$config   = apply_filters( 'kirki/config', array() );
121 121
 		$priority = 999;
122
-		if ( isset( $config['styles_priority'] ) ) {
123
-			$priority = absint( $config['styles_priority'] );
122
+		if ( isset( $config[ 'styles_priority' ] ) ) {
123
+			$priority = absint( $config[ 'styles_priority' ] );
124 124
 		}
125 125
 
126 126
 		// Allow completely disabling Kirki CSS output.
127
-		if ( ( defined( 'KIRKI_NO_OUTPUT' ) && true === KIRKI_NO_OUTPUT ) || ( isset( $config['disable_output'] ) && true === $config['disable_output'] ) ) {
127
+		if ( ( defined( 'KIRKI_NO_OUTPUT' ) && true === KIRKI_NO_OUTPUT ) || ( isset( $config[ 'disable_output' ] ) && true === $config[ 'disable_output' ] ) ) {
128 128
 			return;
129 129
 		}
130 130
 
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 
156 156
 		// If we are in the customizer, load CSS using inline-styles.
157 157
 		// If we are in the frontend AND self::$ajax is true, then load dynamic CSS using AJAX.
158
-		if ( ( true === self::$ajax ) || ( isset( $config['inline_css'] ) && false === $config['inline_css'] ) ) {
158
+		if ( ( true === self::$ajax ) || ( isset( $config[ 'inline_css' ] ) && false === $config[ 'inline_css' ] ) ) {
159 159
 			add_action( 'wp_enqueue_scripts', array( $this, 'frontend_styles' ), $priority );
160 160
 			add_action( 'wp_ajax_kirki_dynamic_css', array( $this, 'ajax_dynamic_css' ) );
161 161
 			add_action( 'wp_ajax_nopriv_kirki_dynamic_css', array( $this, 'ajax_dynamic_css' ) );
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 		$configs = Kirki::$config;
187 187
 		if ( ! $this->processed ) {
188 188
 			foreach ( $configs as $config_id => $args ) {
189
-				if ( isset( $args['disable_output'] ) && true === $args['disable_output'] ) {
189
+				if ( isset( $args[ 'disable_output' ] ) && true === $args[ 'disable_output' ] ) {
190 190
 					continue;
191 191
 				}
192 192
 				$styles = self::loop_controls( $config_id );
@@ -243,19 +243,19 @@  discard block
 block discarded – undo
243 243
 		foreach ( $fields as $field ) {
244 244
 
245 245
 			// Only process fields that belong to $config_id.
246
-			if ( $config_id !== $field['kirki_config'] ) {
246
+			if ( $config_id !== $field[ 'kirki_config' ] ) {
247 247
 				continue;
248 248
 			}
249 249
 
250 250
 			if ( true === apply_filters( "kirki/{$config_id}/css/skip_hidden", true ) ) {
251 251
 				// Only continue if field dependencies are met.
252
-				if ( ! empty( $field['required'] ) ) {
252
+				if ( ! empty( $field[ 'required' ] ) ) {
253 253
 					$valid = true;
254 254
 
255
-					foreach ( $field['required'] as $requirement ) {
256
-						if ( isset( $requirement['setting'] ) && isset( $requirement['value'] ) && isset( $requirement['operator'] ) ) {
257
-							$controller_value = Kirki_Values::get_value( $config_id, $requirement['setting'] );
258
-							if ( ! Kirki_Helper::compare_values( $controller_value, $requirement['value'], $requirement['operator'] ) ) {
255
+					foreach ( $field[ 'required' ] as $requirement ) {
256
+						if ( isset( $requirement[ 'setting' ] ) && isset( $requirement[ 'value' ] ) && isset( $requirement[ 'operator' ] ) ) {
257
+							$controller_value = Kirki_Values::get_value( $config_id, $requirement[ 'setting' ] );
258
+							if ( ! Kirki_Helper::compare_values( $controller_value, $requirement[ 'value' ], $requirement[ 'operator' ] ) ) {
259 259
 								$valid = false;
260 260
 							}
261 261
 						}
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
 			}
269 269
 
270 270
 			// Only continue if $field['output'] is set.
271
-			if ( isset( $field['output'] ) && ! empty( $field['output'] ) ) {
271
+			if ( isset( $field[ 'output' ] ) && ! empty( $field[ 'output' ] ) ) {
272 272
 				$css = Kirki_Helper::array_replace_recursive( $css, Kirki_Modules_CSS_Generator::css( $field ) );
273 273
 
274 274
 				// Add the globals.
Please login to merge, or discard this patch.
modules/webfonts/class-kirki-modules-webfonts.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -164,18 +164,18 @@
 block discarded – undo
164 164
 	 */
165 165
 	public function loop_fields( $config_id ) {
166 166
 		foreach ( Kirki::$fields as $field ) {
167
-			if ( isset( $field['kirki_config'] ) && $config_id !== $field['kirki_config'] ) {
167
+			if ( isset( $field[ 'kirki_config' ] ) && $config_id !== $field[ 'kirki_config' ] ) {
168 168
 				continue;
169 169
 			}
170 170
 			if ( true === apply_filters( "kirki/{$config_id}/webfonts/skip_hidden", true ) ) {
171 171
 				// Only continue if field dependencies are met.
172
-				if ( ! empty( $field['required'] ) ) {
172
+				if ( ! empty( $field[ 'required' ] ) ) {
173 173
 					$valid = true;
174 174
 
175
-					foreach ( $field['required'] as $requirement ) {
176
-						if ( isset( $requirement['setting'] ) && isset( $requirement['value'] ) && isset( $requirement['operator'] ) ) {
177
-							$controller_value = Kirki_Values::get_value( $config_id, $requirement['setting'] );
178
-							if ( ! Kirki_Helper::compare_values( $controller_value, $requirement['value'], $requirement['operator'] ) ) {
175
+					foreach ( $field[ 'required' ] as $requirement ) {
176
+						if ( isset( $requirement[ 'setting' ] ) && isset( $requirement[ 'value' ] ) && isset( $requirement[ 'operator' ] ) ) {
177
+							$controller_value = Kirki_Values::get_value( $config_id, $requirement[ 'setting' ] );
178
+							if ( ! Kirki_Helper::compare_values( $controller_value, $requirement[ 'value' ], $requirement[ 'operator' ] ) ) {
179 179
 								$valid = false;
180 180
 							}
181 181
 						}
Please login to merge, or discard this patch.
modules/webfonts/class-kirki-modules-webfonts-async.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@
 block discarded – undo
86 86
 					$weights[ $key ] = str_replace( array( 'regular', 'bold', 'italic' ), array( '400', '', 'i' ), $value );
87 87
 				}
88 88
 			}
89
-			$fonts_to_load[] = $font . ':' . join( ',', $weights );
89
+			$fonts_to_load[ ] = $font . ':' . join( ',', $weights );
90 90
 		}
91 91
 		wp_enqueue_script( 'webfont-loader', 'https://ajax.googleapis.com/ajax/libs/webfont/1.6.26/webfont.js', array(), KIRKI_VERSION );
92 92
 		if ( empty( $fonts_to_load ) ) {
Please login to merge, or discard this patch.
modules/css/field/class-kirki-output-field-typography.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -23,10 +23,10 @@  discard block
 block discarded – undo
23 23
 	 */
24 24
 	protected function process_output( $output, $value ) {
25 25
 
26
-		$output['media_query'] = ( isset( $output['media_query'] ) ) ? $output['media_query'] : 'global';
27
-		$output['element']     = ( isset( $output['element'] ) ) ? $output['element'] : 'body';
28
-		$output['prefix']      = ( isset( $output['prefix'] ) ) ? $output['prefix'] : '';
29
-		$output['suffix']      = ( isset( $output['suffix'] ) ) ? $output['suffix'] : '';
26
+		$output[ 'media_query' ] = ( isset( $output[ 'media_query' ] ) ) ? $output[ 'media_query' ] : 'global';
27
+		$output[ 'element' ]     = ( isset( $output[ 'element' ] ) ) ? $output[ 'element' ] : 'body';
28
+		$output[ 'prefix' ]      = ( isset( $output[ 'prefix' ] ) ) ? $output[ 'prefix' ] : '';
29
+		$output[ 'suffix' ]      = ( isset( $output[ 'suffix' ] ) ) ? $output[ 'suffix' ] : '';
30 30
 
31 31
 		$value = Kirki_Field_Typography::sanitize( $value );
32 32
 
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 		foreach ( $properties as $property ) {
49 49
 
50 50
 			// Early exit if the value is not in the defaults.
51
-			if ( ! isset( $this->field['default'][ $property ] ) ) {
51
+			if ( ! isset( $this->field[ 'default' ][ $property ] ) ) {
52 52
 				continue;
53 53
 			}
54 54
 
@@ -58,37 +58,37 @@  discard block
 block discarded – undo
58 58
 			}
59 59
 
60 60
 			// Early exit if we use "choice" but not for this property.
61
-			if ( isset( $output['choice'] ) && $output['choice'] !== $property ) {
61
+			if ( isset( $output[ 'choice' ] ) && $output[ 'choice' ] !== $property ) {
62 62
 				continue;
63 63
 			}
64 64
 
65 65
 			// Take care of variants.
66
-			if ( 'variant' == $property && isset( $value['variant'] ) && ! empty( $value['variant'] ) ) {
66
+			if ( 'variant' == $property && isset( $value[ 'variant' ] ) && ! empty( $value[ 'variant' ] ) ) {
67 67
 
68 68
 				// Get the font_weight.
69
-				$font_weight = str_replace( 'italic', '', $value['variant'] );
69
+				$font_weight = str_replace( 'italic', '', $value[ 'variant' ] );
70 70
 				$font_weight = ( in_array( $font_weight, array( '', 'regular' ) ) ) ? '400' : $font_weight;
71 71
 
72 72
 				// Is this italic?
73
-				$is_italic = ( false !== strpos( $value['variant'], 'italic' ) );
74
-				$this->styles[ $output['media_query'] ][ $output['element'] ]['font-weight'] = $font_weight;
73
+				$is_italic = ( false !== strpos( $value[ 'variant' ], 'italic' ) );
74
+				$this->styles[ $output[ 'media_query' ] ][ $output[ 'element' ] ][ 'font-weight' ] = $font_weight;
75 75
 				if ( $is_italic ) {
76
-					$this->styles[ $output['media_query'] ][ $output['element'] ]['font-style'] = 'italic';
76
+					$this->styles[ $output[ 'media_query' ] ][ $output[ 'element' ] ][ 'font-style' ] = 'italic';
77 77
 				}
78 78
 				continue;
79 79
 			}
80 80
 
81 81
 			$property_value = $this->process_property_value( $property, $value[ $property ] );
82 82
 			if ( 'font-family' === $property ) {
83
-				$value['font-backup'] = ( isset( $value['font-backup'] ) ) ? $value['font-backup'] : '';
83
+				$value[ 'font-backup' ] = ( isset( $value[ 'font-backup' ] ) ) ? $value[ 'font-backup' ] : '';
84 84
 				$property_value = $this->process_property_value( $property, array(
85
-					$value['font-family'],
86
-					$value['font-backup'],
85
+					$value[ 'font-family' ],
86
+					$value[ 'font-backup' ],
87 87
 				) );
88 88
 			}
89
-			$property = ( isset( $output['choice'] ) && isset( $output['property'] ) ) ? $output['property'] : $property;
90
-			$property_value = ( is_array( $property_value ) && isset( $property_value[0] ) ) ? $property_value[0] : $property_value;
91
-			$this->styles[ $output['media_query'] ][ $output['element'] ][ $property ] = $output['prefix'] . $property_value . $output['suffix'];
89
+			$property = ( isset( $output[ 'choice' ] ) && isset( $output[ 'property' ] ) ) ? $output[ 'property' ] : $property;
90
+			$property_value = ( is_array( $property_value ) && isset( $property_value[ 0 ] ) ) ? $property_value[ 0 ] : $property_value;
91
+			$this->styles[ $output[ 'media_query' ] ][ $output[ 'element' ] ][ $property ] = $output[ 'prefix' ] . $property_value . $output[ 'suffix' ];
92 92
 		}
93 93
 	}
94 94
 }
Please login to merge, or discard this patch.