Passed
Push — main ( 137754...ffd9e1 )
by TARIQ
04:53
created
packages/kirki-framework/module-panels/src/Panel_Types/Nested.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@
 block discarded – undo
53 53
 			]
54 54
 		);
55 55
 
56
-		$array['title']          = html_entity_decode( $this->title, ENT_QUOTES, get_bloginfo( 'charset' ) );
56
+		$array['title']          = html_entity_decode($this->title, ENT_QUOTES, get_bloginfo('charset'));
57 57
 		$array['content']        = $this->get_content();
58 58
 		$array['active']         = $this->active();
59 59
 		$array['instanceNumber'] = $this->instance_number;
Please login to merge, or discard this patch.
kirki-4.0.24/packages/kirki-framework/module-css/src/CSS/Property.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@
 block discarded – undo
40 40
 	 * @param string $property The CSS property we're modifying.
41 41
 	 * @param mixed  $value    The value.
42 42
 	 */
43
-	public function __construct( $property, $value ) {
43
+	public function __construct($property, $value) {
44 44
 		$this->property = $property;
45 45
 		$this->value    = $value;
46 46
 		$this->process_value();
Please login to merge, or discard this patch.
kirki-4.0.24/packages/kirki-framework/module-css/src/CSS/Generator.php 1 patch
Spacing   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 use Kirki\Module\Webfonts\Fonts;
17 17
 
18 18
 // Exit if accessed directly.
19
-if ( ! defined( 'ABSPATH' ) ) {
19
+if (!defined('ABSPATH')) {
20 20
 	exit;
21 21
 }
22 22
 
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 	 * The class constructor.
111 111
 	 */
112 112
 	private function __construct() {
113
-		if ( is_null( self::$google_fonts ) ) {
113
+		if (is_null(self::$google_fonts)) {
114 114
 			self::$google_fonts = Fonts::get_google_fonts();
115 115
 		}
116 116
 	}
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 	 * @return object
122 122
 	 */
123 123
 	public static function get_instance() {
124
-		if ( null === self::$instance ) {
124
+		if (null === self::$instance) {
125 125
 			self::$instance = new self();
126 126
 		}
127 127
 		return self::$instance;
@@ -135,18 +135,18 @@  discard block
 block discarded – undo
135 135
 	 * @param array $field The field.
136 136
 	 * @return array
137 137
 	 */
138
-	public static function css( $field ) {
138
+	public static function css($field) {
139 139
 
140 140
 		// Set class vars.
141 141
 		self::$settings   = $field['settings'];
142
-		self::$callback   = isset( $field['sanitize_callback'] ) ? $field['sanitize_callback'] : '';
142
+		self::$callback   = isset($field['sanitize_callback']) ? $field['sanitize_callback'] : '';
143 143
 		self::$field_type = $field['type'];
144
-		self::$field_type = ( isset( $field['choices'] ) && isset( $field['choices']['parent_type'] ) ) ? $field['choices']['parent_type'] : self::$field_type;
144
+		self::$field_type = (isset($field['choices']) && isset($field['choices']['parent_type'])) ? $field['choices']['parent_type'] : self::$field_type;
145 145
 		self::$output     = $field['output'];
146 146
 
147
-		$field['kirki_config'] = isset( $field['kirki_config'] ) ? $field['kirki_config'] : 'global';
147
+		$field['kirki_config'] = isset($field['kirki_config']) ? $field['kirki_config'] : 'global';
148 148
 
149
-		if ( ! is_array( self::$output ) ) {
149
+		if (!is_array(self::$output)) {
150 150
 			self::$output = [
151 151
 				[
152 152
 					'element'           => self::$output,
@@ -156,26 +156,26 @@  discard block
 block discarded – undo
156 156
 		}
157 157
 
158 158
 		// Get the value of this field.
159
-		$option_type  = ( isset( $field['option_type'] ) ) ? $field['option_type'] : 'theme_mod';
160
-		$default      = ( isset( $field['default'] ) ) ? $field['default'] : '';
159
+		$option_type  = (isset($field['option_type'])) ? $field['option_type'] : 'theme_mod';
160
+		$default      = (isset($field['default'])) ? $field['default'] : '';
161 161
 		$setting_name = $field['settings'];
162 162
 
163
-		if ( 'option' === $option_type ) {
164
-			if ( ! empty( $field['option_name'] ) && 0 !== stripos( $setting_name, $field['option_name'] . '[' ) ) {
163
+		if ('option' === $option_type) {
164
+			if (!empty($field['option_name']) && 0 !== stripos($setting_name, $field['option_name'] . '[')) {
165 165
 				$setting_name = $field['option_name'] . '[' . $field['settings'] . ']';
166 166
 			}
167 167
 		}
168 168
 
169
-		self::$value = apply_filters( 'kirki_get_value', get_theme_mod( $field['settings'], $default ), $setting_name, $default, $option_type );
169
+		self::$value = apply_filters('kirki_get_value', get_theme_mod($field['settings'], $default), $setting_name, $default, $option_type);
170 170
 
171 171
 		// Find the class that will handle the outpout for this field.
172 172
 		$classname            = '\Kirki\Module\CSS\Output';
173
-		$field_output_classes = apply_filters( 'kirki_output_control_classnames', [] );
174
-		$field_output_classes = apply_filters( "kirki_{$field['kirki_config']}_output_control_classnames", $field_output_classes );
175
-		if ( array_key_exists( self::$field_type, $field_output_classes ) ) {
176
-			$classname = $field_output_classes[ self::$field_type ];
173
+		$field_output_classes = apply_filters('kirki_output_control_classnames', []);
174
+		$field_output_classes = apply_filters("kirki_{$field['kirki_config']}_output_control_classnames", $field_output_classes);
175
+		if (array_key_exists(self::$field_type, $field_output_classes)) {
176
+			$classname = $field_output_classes[self::$field_type];
177 177
 		}
178
-		$obj = new $classname( $field['kirki_config'], self::$output, self::$value, $field );
178
+		$obj = new $classname($field['kirki_config'], self::$output, self::$value, $field);
179 179
 		return $obj->get_styles();
180 180
 	}
181 181
 
@@ -187,42 +187,42 @@  discard block
 block discarded – undo
187 187
 	 * @param array $css The CSS definitions array.
188 188
 	 * @return string    The generated CSS.
189 189
 	 */
190
-	public static function styles_parse( $css = [] ) {
190
+	public static function styles_parse($css = []) {
191 191
 
192 192
 		// Pass our styles from the kirki_styles_array filter.
193
-		$css = apply_filters( 'kirki_styles_array', $css );
193
+		$css = apply_filters('kirki_styles_array', $css);
194 194
 
195 195
 		// Process the array of CSS properties and produce the final CSS.
196 196
 		$final_css = '';
197 197
 
198
-		if ( ! is_array( $css ) || empty( $css ) ) {
198
+		if (!is_array($css) || empty($css)) {
199 199
 			return '';
200 200
 		}
201 201
 
202
-		foreach ( $css as $media_query => $styles ) {
203
-			$final_css .= ( 'global' !== $media_query ) ? $media_query . '{' : '';
204
-			foreach ( $styles as $style => $style_array ) {
202
+		foreach ($css as $media_query => $styles) {
203
+			$final_css .= ('global' !== $media_query) ? $media_query . '{' : '';
204
+			foreach ($styles as $style => $style_array) {
205 205
 				$css_for_style = '';
206 206
 
207
-				foreach ( $style_array as $property => $value ) {
208
-					if ( is_string( $value ) && '' !== $value ) {
207
+				foreach ($style_array as $property => $value) {
208
+					if (is_string($value) && '' !== $value) {
209 209
 						$css_for_style .= $property . ':' . $value . ';';
210
-					} elseif ( is_array( $value ) ) {
211
-						foreach ( $value as $subvalue ) {
212
-							if ( is_string( $subvalue ) && '' !== $subvalue ) {
210
+					} elseif (is_array($value)) {
211
+						foreach ($value as $subvalue) {
212
+							if (is_string($subvalue) && '' !== $subvalue) {
213 213
 								$css_for_style .= $property . ':' . $subvalue . ';';
214 214
 							}
215 215
 						}
216 216
 					}
217
-					$value = ( is_string( $value ) ) ? $value : '';
217
+					$value = (is_string($value)) ? $value : '';
218 218
 				}
219 219
 
220
-				if ( '' !== $css_for_style ) {
220
+				if ('' !== $css_for_style) {
221 221
 					$final_css .= $style . '{' . $css_for_style . '}';
222 222
 				}
223 223
 			}
224 224
 
225
-			$final_css .= ( 'global' !== $media_query ) ? '}' : '';
225
+			$final_css .= ('global' !== $media_query) ? '}' : '';
226 226
 		}
227 227
 
228 228
 		return $final_css;
@@ -234,14 +234,14 @@  discard block
 block discarded – undo
234 234
 	 * @param  array $css The CSS definitions array.
235 235
 	 * @return array
236 236
 	 */
237
-	public static function add_prefixes( $css ) {
238
-		if ( is_array( $css ) ) {
239
-			foreach ( $css as $media_query => $elements ) {
240
-				foreach ( $elements as $element => $style_array ) {
241
-					foreach ( $style_array as $property => $value ) {
237
+	public static function add_prefixes($css) {
238
+		if (is_array($css)) {
239
+			foreach ($css as $media_query => $elements) {
240
+				foreach ($elements as $element => $style_array) {
241
+					foreach ($style_array as $property => $value) {
242 242
 
243 243
 						// Add -webkit-* and -moz-*.
244
-						if ( is_string( $property ) && in_array(
244
+						if (is_string($property) && in_array(
245 245
 							$property,
246 246
 							[
247 247
 								'border-radius',
@@ -254,15 +254,15 @@  discard block
 block discarded – undo
254 254
 								'transition-property',
255 255
 							],
256 256
 							true
257
-						) ) {
258
-							unset( $css[ $media_query ][ $element ][ $property ] );
259
-							$css[ $media_query ][ $element ][ '-webkit-' . $property ] = $value;
260
-							$css[ $media_query ][ $element ][ '-moz-' . $property ]    = $value;
261
-							$css[ $media_query ][ $element ][ $property ]              = $value;
257
+						)) {
258
+							unset($css[$media_query][$element][$property]);
259
+							$css[$media_query][$element]['-webkit-' . $property] = $value;
260
+							$css[$media_query][$element]['-moz-' . $property]    = $value;
261
+							$css[$media_query][$element][$property]              = $value;
262 262
 						}
263 263
 
264 264
 						// Add -ms-* and -o-*.
265
-						if ( is_string( $property ) && in_array(
265
+						if (is_string($property) && in_array(
266 266
 							$property,
267 267
 							[
268 268
 								'transform',
@@ -271,11 +271,11 @@  discard block
 block discarded – undo
271 271
 								'transition-property',
272 272
 							],
273 273
 							true
274
-						) ) {
275
-							unset( $css[ $media_query ][ $element ][ $property ] );
276
-							$css[ $media_query ][ $element ][ '-ms-' . $property ] = $value;
277
-							$css[ $media_query ][ $element ][ '-o-' . $property ]  = $value;
278
-							$css[ $media_query ][ $element ][ $property ]          = $value;
274
+						)) {
275
+							unset($css[$media_query][$element][$property]);
276
+							$css[$media_query][$element]['-ms-' . $property] = $value;
277
+							$css[$media_query][$element]['-o-' . $property]  = $value;
278
+							$css[$media_query][$element][$property]          = $value;
279 279
 						}
280 280
 					}
281 281
 				}
Please login to merge, or discard this patch.
kirki-4.0.24/packages/kirki-framework/module-css/src/CSS/Output.php 1 patch
Spacing   +98 added lines, -98 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 	 * @param string|array $value     The value.
61 61
 	 * @param array        $field     The field.
62 62
 	 */
63
-	public function __construct( $config_id, $output, $value, $field ) {
63
+	public function __construct($config_id, $output, $value, $field) {
64 64
 		$this->value  = $value;
65 65
 		$this->output = $output;
66 66
 		$this->field  = $field;
@@ -76,14 +76,14 @@  discard block
 block discarded – undo
76 76
 	 *
77 77
 	 * @return string|array
78 78
 	 */
79
-	protected function apply_sanitize_callback( $output, $value ) {
80
-		if ( isset( $output['sanitize_callback'] ) && null !== $output['sanitize_callback'] ) {
79
+	protected function apply_sanitize_callback($output, $value) {
80
+		if (isset($output['sanitize_callback']) && null !== $output['sanitize_callback']) {
81 81
 
82 82
 			// If the sanitize_callback is invalid, return the value.
83
-			if ( ! is_callable( $output['sanitize_callback'] ) ) {
83
+			if (!is_callable($output['sanitize_callback'])) {
84 84
 				return $value;
85 85
 			}
86
-			return call_user_func( $output['sanitize_callback'], $this->value );
86
+			return call_user_func($output['sanitize_callback'], $this->value);
87 87
 		}
88 88
 		return $value;
89 89
 	}
@@ -95,26 +95,26 @@  discard block
 block discarded – undo
95 95
 	 * @param string|array $value  The value.
96 96
 	 * @return string|array
97 97
 	 */
98
-	protected function apply_value_pattern( $output, $value ) {
99
-		if ( isset( $output['value_pattern'] ) && is_string( $output['value_pattern'] ) ) {
100
-			if ( ! is_array( $value ) ) {
101
-				$value = str_replace( '$', $value, $output['value_pattern'] );
98
+	protected function apply_value_pattern($output, $value) {
99
+		if (isset($output['value_pattern']) && is_string($output['value_pattern'])) {
100
+			if (!is_array($value)) {
101
+				$value = str_replace('$', $value, $output['value_pattern']);
102 102
 			}
103
-			if ( is_array( $value ) ) {
104
-				foreach ( array_keys( $value ) as $value_k ) {
105
-					if ( is_array( $value[ $value_k ] ) ) {
103
+			if (is_array($value)) {
104
+				foreach (array_keys($value) as $value_k) {
105
+					if (is_array($value[$value_k])) {
106 106
 						continue;
107 107
 					}
108
-					if ( isset( $output['choice'] ) ) {
109
-						if ( $output['choice'] === $value_k ) {
110
-							$value[ $output['choice'] ] = str_replace( '$', $value[ $output['choice'] ], $output['value_pattern'] );
108
+					if (isset($output['choice'])) {
109
+						if ($output['choice'] === $value_k) {
110
+							$value[$output['choice']] = str_replace('$', $value[$output['choice']], $output['value_pattern']);
111 111
 						}
112 112
 						continue;
113 113
 					}
114
-					$value[ $value_k ] = str_replace( '$', $value[ $value_k ], $output['value_pattern'] );
114
+					$value[$value_k] = str_replace('$', $value[$value_k], $output['value_pattern']);
115 115
 				}
116 116
 			}
117
-			$value = $this->apply_pattern_replace( $output, $value );
117
+			$value = $this->apply_pattern_replace($output, $value);
118 118
 		}
119 119
 		return $value;
120 120
 	}
@@ -126,53 +126,53 @@  discard block
 block discarded – undo
126 126
 	 * @param string|array $value  The value.
127 127
 	 * @return string|array
128 128
 	 */
129
-	protected function apply_pattern_replace( $output, $value ) {
130
-		if ( isset( $output['pattern_replace'] ) && is_array( $output['pattern_replace'] ) ) {
131
-			$option_type = ( isset( $this->field['option_type'] ) ) ? $this->field['option_type'] : 'theme_mod';
132
-			$option_name = ( isset( $this->field['option_name'] ) ) ? $this->field['option_name'] : '';
129
+	protected function apply_pattern_replace($output, $value) {
130
+		if (isset($output['pattern_replace']) && is_array($output['pattern_replace'])) {
131
+			$option_type = (isset($this->field['option_type'])) ? $this->field['option_type'] : 'theme_mod';
132
+			$option_name = (isset($this->field['option_name'])) ? $this->field['option_name'] : '';
133 133
 			$options     = [];
134
-			if ( $option_name ) {
135
-				$options = ( 'site_option' === $option_type ) ? get_site_option( $option_name ) : get_option( $option_name );
134
+			if ($option_name) {
135
+				$options = ('site_option' === $option_type) ? get_site_option($option_name) : get_option($option_name);
136 136
 			}
137
-			foreach ( $output['pattern_replace'] as $search => $replace ) {
137
+			foreach ($output['pattern_replace'] as $search => $replace) {
138 138
 				$replacement = '';
139
-				switch ( $option_type ) {
139
+				switch ($option_type) {
140 140
 					case 'option':
141
-						if ( is_array( $options ) ) {
142
-							if ( $option_name ) {
143
-								$subkey      = str_replace( [ $option_name, '[', ']' ], '', $replace );
144
-								$replacement = ( isset( $options[ $subkey ] ) ) ? $options[ $subkey ] : '';
141
+						if (is_array($options)) {
142
+							if ($option_name) {
143
+								$subkey      = str_replace([$option_name, '[', ']'], '', $replace);
144
+								$replacement = (isset($options[$subkey])) ? $options[$subkey] : '';
145 145
 								break;
146 146
 							}
147
-							$replacement = ( isset( $options[ $replace ] ) ) ? $options[ $replace ] : '';
147
+							$replacement = (isset($options[$replace])) ? $options[$replace] : '';
148 148
 							break;
149 149
 						}
150
-						$replacement = get_option( $replace );
150
+						$replacement = get_option($replace);
151 151
 						break;
152 152
 					case 'site_option':
153
-						$replacement = ( is_array( $options ) && isset( $options[ $replace ] ) ) ? $options[ $replace ] : get_site_option( $replace );
153
+						$replacement = (is_array($options) && isset($options[$replace])) ? $options[$replace] : get_site_option($replace);
154 154
 						break;
155 155
 					case 'user_meta':
156 156
 						$user_id = get_current_user_id();
157
-						if ( $user_id ) {
158
-							$replacement = get_user_meta( $user_id, $replace, true );
157
+						if ($user_id) {
158
+							$replacement = get_user_meta($user_id, $replace, true);
159 159
 						}
160 160
 						break;
161 161
 					default:
162
-						$replacement = get_theme_mod( $replace );
163
-						if ( ! $replacement ) {
164
-							$replacement = Values::get_value( $this->field['kirki_config'], $replace );
162
+						$replacement = get_theme_mod($replace);
163
+						if (!$replacement) {
164
+							$replacement = Values::get_value($this->field['kirki_config'], $replace);
165 165
 						}
166 166
 				}
167
-				$replacement = ( false === $replacement ) ? '' : $replacement;
168
-				if ( is_array( $value ) ) {
169
-					foreach ( $value as $k => $v ) {
170
-						$_val        = ( isset( $value[ $v ] ) ) ? $value[ $v ] : $v;
171
-						$value[ $k ] = str_replace( $search, $replacement, $_val );
167
+				$replacement = (false === $replacement) ? '' : $replacement;
168
+				if (is_array($value)) {
169
+					foreach ($value as $k => $v) {
170
+						$_val        = (isset($value[$v])) ? $value[$v] : $v;
171
+						$value[$k] = str_replace($search, $replacement, $_val);
172 172
 					}
173 173
 					return $value;
174 174
 				}
175
-				$value = str_replace( $search, $replacement, $value );
175
+				$value = str_replace($search, $replacement, $value);
176 176
 			}
177 177
 		}
178 178
 		return $value;
@@ -185,68 +185,68 @@  discard block
 block discarded – undo
185 185
 	 * @access protected
186 186
 	 */
187 187
 	protected function parse_output() {
188
-		foreach ( $this->output as $output ) {
188
+		foreach ($this->output as $output) {
189 189
 			$skip = false;
190 190
 
191 191
 			// Apply any sanitization callbacks defined.
192
-			$value = $this->apply_sanitize_callback( $output, $this->value );
192
+			$value = $this->apply_sanitize_callback($output, $this->value);
193 193
 
194 194
 			// Skip if value is empty.
195
-			if ( '' === $this->value ) {
195
+			if ('' === $this->value) {
196 196
 				$skip = true;
197 197
 			}
198 198
 
199 199
 			// No need to proceed this if the current value is the same as in the "exclude" value.
200
-			if ( isset( $output['exclude'] ) && is_array( $output['exclude'] ) ) {
201
-				foreach ( $output['exclude'] as $exclude ) {
202
-					if ( is_array( $value ) ) {
203
-						if ( is_array( $exclude ) ) {
204
-							$diff1 = array_diff( $value, $exclude );
205
-							$diff2 = array_diff( $exclude, $value );
206
-
207
-							if ( empty( $diff1 ) && empty( $diff2 ) ) {
200
+			if (isset($output['exclude']) && is_array($output['exclude'])) {
201
+				foreach ($output['exclude'] as $exclude) {
202
+					if (is_array($value)) {
203
+						if (is_array($exclude)) {
204
+							$diff1 = array_diff($value, $exclude);
205
+							$diff2 = array_diff($exclude, $value);
206
+
207
+							if (empty($diff1) && empty($diff2)) {
208 208
 								$skip = true;
209 209
 							}
210 210
 						}
211 211
 						// If 'choice' is defined check for sub-values too.
212 212
 						// Fixes https://github.com/aristath/kirki/issues/1416.
213
-						if ( isset( $output['choice'] ) && isset( $value[ $output['choice'] ] ) && $exclude == $value[ $output['choice'] ] ) { // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
213
+						if (isset($output['choice']) && isset($value[$output['choice']]) && $exclude == $value[$output['choice']]) { // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
214 214
 							$skip = true;
215 215
 						}
216 216
 					}
217
-					if ( $skip ) {
217
+					if ($skip) {
218 218
 						continue;
219 219
 					}
220 220
 
221 221
 					// Skip if value is defined as excluded.
222
-					if ( $exclude === $value || ( '' === $exclude && empty( $value ) ) ) {
222
+					if ($exclude === $value || ('' === $exclude && empty($value))) {
223 223
 						$skip = true;
224 224
 					}
225 225
 				}
226 226
 			}
227
-			if ( $skip ) {
227
+			if ($skip) {
228 228
 				continue;
229 229
 			}
230 230
 
231 231
 			// Apply any value patterns defined.
232
-			$value = $this->apply_value_pattern( $output, $value );
232
+			$value = $this->apply_value_pattern($output, $value);
233 233
 
234
-			if ( isset( $output['element'] ) && is_array( $output['element'] ) ) {
235
-				$output['element'] = array_unique( $output['element'] );
236
-				sort( $output['element'] );
237
-				$output['element'] = implode( ',', $output['element'] );
234
+			if (isset($output['element']) && is_array($output['element'])) {
235
+				$output['element'] = array_unique($output['element']);
236
+				sort($output['element']);
237
+				$output['element'] = implode(',', $output['element']);
238 238
 			}
239 239
 
240
-			$value = $this->process_value( $value, $output );
240
+			$value = $this->process_value($value, $output);
241 241
 
242
-			if ( is_admin() ) {
242
+			if (is_admin()) {
243 243
 				// In admin area, only output kirki-styles/kirki-inline-styles inside editing screen.
244
-				if ( ! isset( $_GET['editor'] ) || 1 !== (int) $_GET['editor'] ) { // phpcs:ignore WordPress.Security.NonceVerification
244
+				if (!isset($_GET['editor']) || 1 !== (int) $_GET['editor']) { // phpcs:ignore WordPress.Security.NonceVerification
245 245
 					continue;
246 246
 				}
247 247
 			} else {
248 248
 				// Check if this is a frontend style.
249
-				if ( isset( $output['context'] ) && ! in_array( 'front', $output['context'], true ) ) {
249
+				if (isset($output['context']) && !in_array('front', $output['context'], true)) {
250 250
 					continue;
251 251
 				}
252 252
 			}
@@ -255,28 +255,28 @@  discard block
 block discarded – undo
255 255
 			 * Inside gutenberg editing screen, prepend `.editor-styles-wrapper` to the element
256 256
 			 * so that it doesn't polute elements other than inside the editing content.
257 257
 			 */
258
-			if ( isset( $_GET['editor'] ) && 1 === (int) $_GET['editor'] ) {
259
-				if ( isset( $output['element'] ) && ! empty( $output['element'] ) ) {
258
+			if (isset($_GET['editor']) && 1 === (int) $_GET['editor']) {
259
+				if (isset($output['element']) && !empty($output['element'])) {
260 260
 
261
-					if ( -1 < strpos( $output['element'], ',' ) ) {
262
-						$elms = explode( ',', $output['element'] );
261
+					if ( -1 < strpos($output['element'], ',') ) {
262
+						$elms = explode(',', $output['element']);
263 263
 
264
-						foreach ( $elms as $index => $elm ) {
265
-							if ( ! empty( $elm ) ) {
266
-								$elms[ $index ] = '.editor-styles-wrapper ' . $elm;
267
-								$elms[ $index ] = str_ireplace( '.editor-styles-wrapper :root', '.editor-styles-wrapper', $elms[ $index ] );
264
+						foreach ($elms as $index => $elm) {
265
+							if (!empty($elm)) {
266
+								$elms[$index] = '.editor-styles-wrapper ' . $elm;
267
+								$elms[$index] = str_ireplace('.editor-styles-wrapper :root', '.editor-styles-wrapper', $elms[$index]);
268 268
 							}
269 269
 						}
270 270
 
271
-						$output['element'] = implode( ',', $elms );
271
+						$output['element'] = implode(',', $elms);
272 272
 					} else {
273 273
 						$output['element'] = '.editor-styles-wrapper ' . $output['element'];
274
-						$output['element'] = str_ireplace( '.editor-styles-wrapper :root', '.editor-styles-wrapper', $output['element'] );
274
+						$output['element'] = str_ireplace('.editor-styles-wrapper :root', '.editor-styles-wrapper', $output['element']);
275 275
 					}
276 276
 				}
277 277
 			}
278 278
 
279
-			$this->process_output( $output, $value );
279
+			$this->process_output($output, $value);
280 280
 		}
281 281
 	}
282 282
 
@@ -289,17 +289,17 @@  discard block
 block discarded – undo
289 289
 	 *
290 290
 	 * @return null
291 291
 	 */
292
-	protected function process_output( $output, $value ) {
293
-		$output = apply_filters( 'kirki_output_item_args', $output, $value, $this->output, $this->field );
292
+	protected function process_output($output, $value) {
293
+		$output = apply_filters('kirki_output_item_args', $output, $value, $this->output, $this->field);
294 294
 
295
-		if ( ! isset( $output['element'] ) || ! isset( $output['property'] ) ) {
295
+		if (!isset($output['element']) || !isset($output['property'])) {
296 296
 			return;
297 297
 		}
298 298
 
299
-		$output['media_query'] = ( isset( $output['media_query'] ) ) ? $output['media_query'] : 'global';
300
-		$output['prefix']      = ( isset( $output['prefix'] ) ) ? $output['prefix'] : '';
301
-		$output['units']       = ( isset( $output['units'] ) ) ? $output['units'] : '';
302
-		$output['suffix']      = ( isset( $output['suffix'] ) ) ? $output['suffix'] : '';
299
+		$output['media_query'] = (isset($output['media_query'])) ? $output['media_query'] : 'global';
300
+		$output['prefix']      = (isset($output['prefix'])) ? $output['prefix'] : '';
301
+		$output['units']       = (isset($output['units'])) ? $output['units'] : '';
302
+		$output['suffix']      = (isset($output['suffix'])) ? $output['suffix'] : '';
303 303
 
304 304
 		// Properties that can accept multiple values.
305 305
 		// Useful for example for gradients where all browsers use the "background-image" property
@@ -309,17 +309,17 @@  discard block
 block discarded – undo
309 309
 			'background',
310 310
 		];
311 311
 
312
-		if ( in_array( $output['property'], $accepts_multiple, true ) ) {
313
-			if ( isset( $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] ) && ! is_array( $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] ) ) {
314
-				$this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = (array) $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ];
312
+		if (in_array($output['property'], $accepts_multiple, true)) {
313
+			if (isset($this->styles[$output['media_query']][$output['element']][$output['property']]) && !is_array($this->styles[$output['media_query']][$output['element']][$output['property']])) {
314
+				$this->styles[$output['media_query']][$output['element']][$output['property']] = (array) $this->styles[$output['media_query']][$output['element']][$output['property']];
315 315
 			}
316 316
 
317
-			$this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ][] = $output['prefix'] . $value . $output['units'] . $output['suffix'];
317
+			$this->styles[$output['media_query']][$output['element']][$output['property']][] = $output['prefix'] . $value . $output['units'] . $output['suffix'];
318 318
 			return;
319 319
 		}
320 320
 
321
-		if ( is_string( $value ) || is_numeric( $value ) ) {
322
-			$this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = $output['prefix'] . $this->process_property_value( $output['property'], $value ) . $output['units'] . $output['suffix'];
321
+		if (is_string($value) || is_numeric($value)) {
322
+			$this->styles[$output['media_query']][$output['element']][$output['property']] = $output['prefix'] . $this->process_property_value($output['property'], $value) . $output['units'] . $output['suffix'];
323 323
 		}
324 324
 	}
325 325
 
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
 	 *
334 334
 	 * @return array
335 335
 	 */
336
-	protected function process_property_value( $property, $value ) {
336
+	protected function process_property_value($property, $value) {
337 337
 		$properties = apply_filters(
338 338
 			'kirki_output_property_classnames',
339 339
 			[
@@ -342,9 +342,9 @@  discard block
 block discarded – undo
342 342
 				'background-position' => '\Kirki\Module\CSS\Property\Background_Position',
343 343
 			]
344 344
 		);
345
-		if ( array_key_exists( $property, $properties ) ) {
346
-			$classname = $properties[ $property ];
347
-			$obj       = new $classname( $property, $value );
345
+		if (array_key_exists($property, $properties)) {
346
+			$classname = $properties[$property];
347
+			$obj       = new $classname($property, $value);
348 348
 			return $obj->get_value();
349 349
 		}
350 350
 		return $value;
@@ -358,9 +358,9 @@  discard block
 block discarded – undo
358 358
 	 * @param array        $output The field "output".
359 359
 	 * @return string|array
360 360
 	 */
361
-	protected function process_value( $value, $output ) {
362
-		if ( isset( $output['property'] ) ) {
363
-			return $this->process_property_value( $output['property'], $value );
361
+	protected function process_value($value, $output) {
362
+		if (isset($output['property'])) {
363
+			return $this->process_property_value($output['property'], $value);
364 364
 		}
365 365
 		return $value;
366 366
 	}
Please login to merge, or discard this patch.
packages/kirki-framework/module-css/src/CSS/Property/Background_Image.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -24,17 +24,17 @@
 block discarded – undo
24 24
 	 * @access protected
25 25
 	 */
26 26
 	protected function process_value() {
27
-		if ( is_array( $this->value ) && isset( $this->value['url'] ) ) {
27
+		if (is_array($this->value) && isset($this->value['url'])) {
28 28
 			$this->value = $this->value['url'];
29 29
 		}
30
-		if ( false === strpos( $this->value, 'gradient' ) && false === strpos( $this->value, 'url(' ) ) {
31
-			if ( empty( $this->value ) ) {
30
+		if (false === strpos($this->value, 'gradient') && false === strpos($this->value, 'url(')) {
31
+			if (empty($this->value)) {
32 32
 				return;
33 33
 			}
34
-			if ( preg_match( '/^\d+$/', $this->value ) ) {
35
-				$this->value = 'url("' . set_url_scheme( wp_get_attachment_url( $this->value ) ) . '")';
34
+			if (preg_match('/^\d+$/', $this->value)) {
35
+				$this->value = 'url("' . set_url_scheme(wp_get_attachment_url($this->value)) . '")';
36 36
 			} else {
37
-				$this->value = 'url("' . set_url_scheme( $this->value ) . '")';
37
+				$this->value = 'url("' . set_url_scheme($this->value) . '")';
38 38
 			}
39 39
 		}
40 40
 	}
Please login to merge, or discard this patch.
kirki-framework/module-css/src/CSS/Property/Background_Position.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -24,49 +24,49 @@
 block discarded – undo
24 24
 	 * @access protected
25 25
 	 */
26 26
 	protected function process_value() {
27
-		$this->value = trim( $this->value );
27
+		$this->value = trim($this->value);
28 28
 
29 29
 		// If you use calc() there, I suppose you know what you're doing.
30 30
 		// No need to process this any further, just exit.
31
-		if ( false !== strpos( $this->value, 'calc' ) ) {
31
+		if (false !== strpos($this->value, 'calc')) {
32 32
 			return;
33 33
 		}
34 34
 
35 35
 		// If the value is initial or inherit, we don't need to do anything.
36 36
 		// Just exit.
37
-		if ( 'initial' === $this->value || 'inherit' === $this->value ) {
37
+		if ('initial' === $this->value || 'inherit' === $this->value) {
38 38
 			return;
39 39
 		}
40 40
 
41
-		$x_dimensions = [ 'left', 'center', 'right' ];
42
-		$y_dimensions = [ 'top', 'center', 'bottom' ];
41
+		$x_dimensions = ['left', 'center', 'right'];
42
+		$y_dimensions = ['top', 'center', 'bottom'];
43 43
 
44 44
 		// If there's a space, we have an X and a Y value.
45
-		if ( false !== strpos( $this->value, ' ' ) ) {
46
-			$xy = explode( ' ', $this->value );
45
+		if (false !== strpos($this->value, ' ')) {
46
+			$xy = explode(' ', $this->value);
47 47
 
48
-			$x = trim( $xy[0] );
49
-			$y = trim( $xy[1] );
48
+			$x = trim($xy[0]);
49
+			$y = trim($xy[1]);
50 50
 
51 51
 			// If x is not left/center/right, we need to sanitize it.
52
-			if ( ! in_array( $x, $x_dimensions, true ) ) {
53
-				$x = sanitize_text_field( $x );
52
+			if (!in_array($x, $x_dimensions, true)) {
53
+				$x = sanitize_text_field($x);
54 54
 			}
55
-			if ( ! in_array( $y, $y_dimensions, true ) ) {
56
-				$y = sanitize_text_field( $y );
55
+			if (!in_array($y, $y_dimensions, true)) {
56
+				$y = sanitize_text_field($y);
57 57
 			}
58 58
 			$this->value = $x . ' ' . $y;
59 59
 			return;
60 60
 		}
61 61
 		$x = 'center';
62
-		foreach ( $x_dimensions as $x_dimension ) {
63
-			if ( false !== strpos( $this->value, $x_dimension ) ) {
62
+		foreach ($x_dimensions as $x_dimension) {
63
+			if (false !== strpos($this->value, $x_dimension)) {
64 64
 				$x = $x_dimension;
65 65
 			}
66 66
 		}
67 67
 		$y = 'center';
68
-		foreach ( $y_dimensions as $y_dimension ) {
69
-			if ( false !== strpos( $this->value, $y_dimension ) ) {
68
+		foreach ($y_dimensions as $y_dimension) {
69
+			if (false !== strpos($this->value, $y_dimension)) {
70 70
 				$y = $y_dimension;
71 71
 			}
72 72
 		}
Please login to merge, or discard this patch.
packages/kirki-framework/module-css/src/CSS/Property/Font_Family.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -31,17 +31,17 @@
 block discarded – undo
31 31
 
32 32
 		// Make sure the value is a string.
33 33
 		// If not, then early exit.
34
-		if ( ! is_string( $family ) ) {
34
+		if (!is_string($family)) {
35 35
 			return;
36 36
 		}
37 37
 
38 38
 		// Hack for standard fonts.
39
-		$family = str_replace( '&quot;', '"', $family );
39
+		$family = str_replace('&quot;', '"', $family);
40 40
 
41 41
 		// Add double quotes if needed.
42
-		if ( false !== strpos( $family, ' ' ) && false === strpos( $family, '"' ) ) {
42
+		if (false !== strpos($family, ' ') && false === strpos($family, '"')) {
43 43
 			$this->value = '"' . $family . '"';
44 44
 		}
45
-		$this->value = html_entity_decode( $family, ENT_QUOTES );
45
+		$this->value = html_entity_decode($family, ENT_QUOTES);
46 46
 	}
47 47
 }
Please login to merge, or discard this patch.
includes/kirki-4.0.24/packages/kirki-framework/module-css/src/CSS.php 1 patch
Spacing   +85 added lines, -85 removed lines patch added patch discarded remove patch
@@ -79,8 +79,8 @@  discard block
 block discarded – undo
79 79
 	 */
80 80
 	public function __construct() {
81 81
 
82
-		add_action( 'kirki_field_init', array( $this, 'field_init' ), 10, 2 );
83
-		add_action( 'init', array( $this, 'init' ) );
82
+		add_action('kirki_field_init', array($this, 'field_init'), 10, 2);
83
+		add_action('init', array($this, 'init'));
84 84
 
85 85
 	}
86 86
 
@@ -93,19 +93,19 @@  discard block
 block discarded – undo
93 93
 
94 94
 		new \Kirki\Module\Webfonts();
95 95
 
96
-		add_action( 'wp', array( $this, 'print_styles_action' ) );
96
+		add_action('wp', array($this, 'print_styles_action'));
97 97
 
98
-		if ( ! apply_filters( 'kirki_output_inline_styles', true ) ) {
99
-			$config   = apply_filters( 'kirki_config', array() );
98
+		if (!apply_filters('kirki_output_inline_styles', true)) {
99
+			$config   = apply_filters('kirki_config', array());
100 100
 			$priority = 999;
101 101
 
102
-			if ( isset( $config['styles_priority'] ) ) {
103
-				$priority = absint( $config['styles_priority'] );
102
+			if (isset($config['styles_priority'])) {
103
+				$priority = absint($config['styles_priority']);
104 104
 			}
105 105
 
106
-			add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles' ), $priority );
106
+			add_action('wp_enqueue_scripts', array($this, 'enqueue_styles'), $priority);
107 107
 		} else {
108
-			add_action( 'wp_head', array( $this, 'print_styles_inline' ), 999 );
108
+			add_action('wp_head', array($this, 'print_styles_inline'), 999);
109 109
 		}
110 110
 
111 111
 	}
@@ -120,17 +120,17 @@  discard block
 block discarded – undo
120 120
 	 * @param Object $object The field object.
121 121
 	 * @return void
122 122
 	 */
123
-	public function field_init( $args, $object ) {
123
+	public function field_init($args, $object) {
124 124
 
125
-		if ( ! isset( $args['output'] ) ) {
125
+		if (!isset($args['output'])) {
126 126
 			$args['output'] = array();
127 127
 		}
128 128
 
129
-		self::$field_option_types[ $args['settings'] ] = isset( $args['option_type'] ) ? $args['option_type'] : 'theme_mod';
129
+		self::$field_option_types[$args['settings']] = isset($args['option_type']) ? $args['option_type'] : 'theme_mod';
130 130
 
131
-		if ( ! is_array( $args['output'] ) ) {
131
+		if (!is_array($args['output'])) {
132 132
 			/* translators: The field ID where the error occurs. */
133
-			_doing_it_wrong( __METHOD__, sprintf( esc_html__( '"output" invalid format in field %s. The "output" argument should be defined as an array of arrays.', 'kirki' ), esc_html( $args['settings'] ) ), '3.0.10' );
133
+			_doing_it_wrong(__METHOD__, sprintf(esc_html__('"output" invalid format in field %s. The "output" argument should be defined as an array of arrays.', 'kirki'), esc_html($args['settings'])), '3.0.10');
134 134
 			$args['output'] = array(
135 135
 				array(
136 136
 					'element' => $args['output'],
@@ -139,43 +139,43 @@  discard block
 block discarded – undo
139 139
 		}
140 140
 
141 141
 		// Convert to array of arrays if needed.
142
-		if ( isset( $args['output']['element'] ) ) {
142
+		if (isset($args['output']['element'])) {
143 143
 			/* translators: The field ID where the error occurs. */
144
-			_doing_it_wrong( __METHOD__, sprintf( esc_html__( '"output" invalid format in field %s. The "output" argument should be defined as an array of arrays.', 'kirki' ), esc_html( $args['settings'] ) ), '3.0.10' );
145
-			$args['output'] = array( $args['output'] );
144
+			_doing_it_wrong(__METHOD__, sprintf(esc_html__('"output" invalid format in field %s. The "output" argument should be defined as an array of arrays.', 'kirki'), esc_html($args['settings'])), '3.0.10');
145
+			$args['output'] = array($args['output']);
146 146
 		}
147 147
 
148
-		if ( empty( $args['output'] ) ) {
148
+		if (empty($args['output'])) {
149 149
 			return;
150 150
 		}
151 151
 
152
-		foreach ( $args['output'] as $key => $output ) {
153
-			if ( empty( $output ) || ! isset( $output['element'] ) ) {
154
-				unset( $args['output'][ $key ] );
152
+		foreach ($args['output'] as $key => $output) {
153
+			if (empty($output) || !isset($output['element'])) {
154
+				unset($args['output'][$key]);
155 155
 				continue;
156 156
 			}
157
-			if ( ! isset( $output['sanitize_callback'] ) && isset( $output['callback'] ) ) {
158
-				$args['output'][ $key ]['sanitize_callback'] = $output['callback'];
157
+			if (!isset($output['sanitize_callback']) && isset($output['callback'])) {
158
+				$args['output'][$key]['sanitize_callback'] = $output['callback'];
159 159
 			}
160 160
 
161 161
 			// Convert element arrays to strings.
162
-			if ( isset( $output['element'] ) && is_array( $output['element'] ) ) {
163
-				$args['output'][ $key ]['element'] = array_unique( $args['output'][ $key ]['element'] );
164
-				sort( $args['output'][ $key ]['element'] );
162
+			if (isset($output['element']) && is_array($output['element'])) {
163
+				$args['output'][$key]['element'] = array_unique($args['output'][$key]['element']);
164
+				sort($args['output'][$key]['element']);
165 165
 
166 166
 				// Trim each element in the array.
167
-				foreach ( $args['output'][ $key ]['element'] as $index => $element ) {
168
-					$args['output'][ $key ]['element'][ $index ] = trim( $element );
167
+				foreach ($args['output'][$key]['element'] as $index => $element) {
168
+					$args['output'][$key]['element'][$index] = trim($element);
169 169
 				}
170
-				$args['output'][ $key ]['element'] = implode( ',', $args['output'][ $key ]['element'] );
170
+				$args['output'][$key]['element'] = implode(',', $args['output'][$key]['element']);
171 171
 			}
172 172
 
173 173
 			// Fix for https://github.com/aristath/kirki/issues/1659#issuecomment-346229751.
174
-			$args['output'][ $key ]['element'] = str_replace( array( "\t", "\n", "\r", "\0", "\x0B" ), ' ', $args['output'][ $key ]['element'] );
175
-			$args['output'][ $key ]['element'] = trim( preg_replace( '/\s+/', ' ', $args['output'][ $key ]['element'] ) );
174
+			$args['output'][$key]['element'] = str_replace(array("\t", "\n", "\r", "\0", "\x0B"), ' ', $args['output'][$key]['element']);
175
+			$args['output'][$key]['element'] = trim(preg_replace('/\s+/', ' ', $args['output'][$key]['element']));
176 176
 		}
177 177
 
178
-		if ( ! isset( $args['type'] ) && isset( $object->type ) ) {
178
+		if (!isset($args['type']) && isset($object->type)) {
179 179
 			$args['type'] = $object->type;
180 180
 		}
181 181
 
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 
195 195
 		$should_print = true;
196 196
 
197
-		if ( defined( 'KIRKI_NO_OUTPUT' ) && true === KIRKI_NO_OUTPUT ) {
197
+		if (defined('KIRKI_NO_OUTPUT') && true === KIRKI_NO_OUTPUT) {
198 198
 			$should_print = false;
199 199
 		}
200 200
 
@@ -206,17 +206,17 @@  discard block
 block discarded – undo
206 206
 		 * If KIRKI_NO_OUTPUT constant is defined (and is true), but typography field is defined, then print it.
207 207
 		 * Otherwise, the typography field might be broken (missing font-family) if the font-face is not outputted.
208 208
 		 */
209
-		if ( ! $should_print && false !== stripos($inline_styles, '@font-face') ) {
209
+		if (!$should_print && false !== stripos($inline_styles, '@font-face')) {
210 210
 			$should_print = true;
211 211
 		}
212 212
 
213
-		if ( ! $should_print ) {
213
+		if (!$should_print) {
214 214
 			return;
215 215
 		}
216 216
 
217
-		$inline_styles_id = apply_filters( 'kirki_inline_styles_id', self::$inline_styles_id );
217
+		$inline_styles_id = apply_filters('kirki_inline_styles_id', self::$inline_styles_id);
218 218
 
219
-		echo '<style id="' . esc_attr( $inline_styles_id ) . '">';
219
+		echo '<style id="' . esc_attr($inline_styles_id) . '">';
220 220
 		echo $inline_styles;
221 221
 		echo '</style>';
222 222
 
@@ -232,10 +232,10 @@  discard block
 block discarded – undo
232 232
 	public function enqueue_styles() {
233 233
 
234 234
 		$args = array(
235
-			'action' => apply_filters( 'kirki_styles_action_handle', self::$css_handle ),
235
+			'action' => apply_filters('kirki_styles_action_handle', self::$css_handle),
236 236
 		);
237 237
 
238
-		if ( is_admin() ) {
238
+		if (is_admin()) {
239 239
 			global $current_screen;
240 240
 
241 241
 			/**
@@ -249,11 +249,11 @@  discard block
 block discarded – undo
249 249
 			 * Example of possibility:
250 250
 			 * In the future, Ultimate Dashboard Pro's admin page feature might supports Gutenberg.
251 251
 			 */
252
-			if ( is_object( $current_screen ) && property_exists( $current_screen, 'id' ) && 'customize' === $current_screen->id ) {
252
+			if (is_object($current_screen) && property_exists($current_screen, 'id') && 'customize' === $current_screen->id) {
253 253
 				return;
254 254
 			}
255 255
 
256
-			if ( property_exists( $current_screen, 'is_block_editor' ) && 1 === (int) $current_screen->is_block_editor ) {
256
+			if (property_exists($current_screen, 'is_block_editor') && 1 === (int) $current_screen->is_block_editor) {
257 257
 				$args['editor'] = '1';
258 258
 			}
259 259
 		}
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
 		// Enqueue the dynamic stylesheet.
262 262
 		wp_enqueue_style(
263 263
 			self::$css_handle,
264
-			add_query_arg( $args, home_url() ),
264
+			add_query_arg($args, home_url()),
265 265
 			array(),
266 266
 			'4.0'
267 267
 		);
@@ -283,12 +283,12 @@  discard block
 block discarded – undo
283 283
 		 */
284 284
 
285 285
 		// phpcs:ignore WordPress.Security.NonceVerification
286
-		if ( empty( $_GET['action'] ) || apply_filters( 'kirki_styles_action_handle', self::$css_handle ) !== $_GET['action'] ) {
286
+		if (empty($_GET['action']) || apply_filters('kirki_styles_action_handle', self::$css_handle) !== $_GET['action']) {
287 287
 			return;
288 288
 		}
289 289
 
290 290
 		// This is a stylesheet.
291
-		header( 'Content-type: text/css' );
291
+		header('Content-type: text/css');
292 292
 		$this->print_styles();
293 293
 		exit;
294 294
 
@@ -304,19 +304,19 @@  discard block
 block discarded – undo
304 304
 		// Go through all configs.
305 305
 		$configs = Kirki::$config;
306 306
 
307
-		foreach ( $configs as $config_id => $args ) {
308
-			if ( defined( 'KIRKI_NO_OUTPUT' ) && true === KIRKI_NO_OUTPUT ) {
307
+		foreach ($configs as $config_id => $args) {
308
+			if (defined('KIRKI_NO_OUTPUT') && true === KIRKI_NO_OUTPUT) {
309 309
 				continue;
310 310
 			}
311 311
 
312
-			if ( isset( $args['disable_output'] ) && true === $args['disable_output'] ) {
312
+			if (isset($args['disable_output']) && true === $args['disable_output']) {
313 313
 				continue;
314 314
 			}
315 315
 
316
-			$styles = self::loop_controls( $config_id );
317
-			$styles = apply_filters( "kirki_{$config_id}_dynamic_css", $styles );
316
+			$styles = self::loop_controls($config_id);
317
+			$styles = apply_filters("kirki_{$config_id}_dynamic_css", $styles);
318 318
 
319
-			if ( ! empty( $styles ) ) {
319
+			if (!empty($styles)) {
320 320
 				/**
321 321
 				 * Note to code reviewers:
322 322
 				 *
@@ -330,11 +330,11 @@  discard block
 block discarded – undo
330 330
 				 * it can only be interpreted by the browser as such.
331 331
 				 * wp_strip_all_tags() excludes the possibility of someone closing the <style> tag and then opening something else.
332 332
 				 */
333
-				echo wp_strip_all_tags( $styles ); // phpcs:ignore WordPress.Security.EscapeOutput
333
+				echo wp_strip_all_tags($styles); // phpcs:ignore WordPress.Security.EscapeOutput
334 334
 			}
335 335
 		}
336 336
 
337
-		do_action( 'kirki_dynamic_css' );
337
+		do_action('kirki_dynamic_css');
338 338
 
339 339
 	}
340 340
 
@@ -345,87 +345,87 @@  discard block
 block discarded – undo
345 345
 	 * @access public
346 346
 	 * @param string $config_id The configuration ID.
347 347
 	 */
348
-	public static function loop_controls( $config_id ) {
348
+	public static function loop_controls($config_id) {
349 349
 
350 350
 		// Get an instance of the Generator class.
351 351
 		// This will make sure google fonts and backup fonts are loaded.
352 352
 		Generator::get_instance();
353 353
 
354
-		$fields = self::get_fields_by_config( $config_id );
354
+		$fields = self::get_fields_by_config($config_id);
355 355
 
356 356
 		// Compatibility with v3 API.
357
-		if ( class_exists( '\Kirki\Compatibility\Kirki' ) ) {
358
-			$fields = array_merge( \Kirki\Compatibility\Kirki::$fields, $fields );
357
+		if (class_exists('\Kirki\Compatibility\Kirki')) {
358
+			$fields = array_merge(\Kirki\Compatibility\Kirki::$fields, $fields);
359 359
 		}
360 360
 
361 361
 		$css = array();
362 362
 
363 363
 		// Early exit if no fields are found.
364
-		if ( empty( $fields ) ) {
364
+		if (empty($fields)) {
365 365
 			return;
366 366
 		}
367 367
 
368
-		foreach ( $fields as $field ) {
368
+		foreach ($fields as $field) {
369 369
 
370 370
 			// Only process fields that belong to $config_id.
371
-			if ( isset( $field['kirki_config'] ) && $config_id !== $field['kirki_config'] ) {
371
+			if (isset($field['kirki_config']) && $config_id !== $field['kirki_config']) {
372 372
 				continue;
373 373
 			}
374 374
 
375
-			if ( true === apply_filters( "kirki_{$config_id}_css_skip_hidden", true ) ) {
375
+			if (true === apply_filters("kirki_{$config_id}_css_skip_hidden", true)) {
376 376
 
377 377
 				// Only continue if field dependencies are met.
378
-				if ( ( isset( $field['required'] ) && ! empty( $field['required'] ) ) || ( isset( $field['active_callback'] ) && ! empty( $field['active_callback'] ) ) ) {
378
+				if ((isset($field['required']) && !empty($field['required'])) || (isset($field['active_callback']) && !empty($field['active_callback']))) {
379 379
 					$valid = true;
380 380
 
381 381
 					// If $field is using active_callback instead of required.
382
-					if ( ! isset( $field['required'] ) || empty( $field['required'] ) ) {
383
-						if ( isset( $field['active_callback'] ) && ! empty( $field['active_callback'] ) ) {
382
+					if (!isset($field['required']) || empty($field['required'])) {
383
+						if (isset($field['active_callback']) && !empty($field['active_callback'])) {
384 384
 							// The "active_callback" or "required" accepts array or callable as the value.
385
-							if ( is_array( $field['active_callback'] ) || is_callable( $field['active_callback'] ) ) {
385
+							if (is_array($field['active_callback']) || is_callable($field['active_callback'])) {
386 386
 								$field['required'] = $field['active_callback'];
387 387
 							}
388 388
 						}
389 389
 					}
390 390
 
391 391
 					// At this point, we know that the "required" is set and is not empty.
392
-					if ( is_array( $field['required'] ) ) {
393
-						foreach ( $field['required'] as $requirement ) {
394
-							if ( isset( $requirement['setting'] ) && isset( $requirement['value'] ) && isset( $requirement['operator'] ) && isset( self::$field_option_types[ $requirement['setting'] ] ) ) {
395
-								$controller_value = Values::get_value( $config_id, $requirement['setting'] );
392
+					if (is_array($field['required'])) {
393
+						foreach ($field['required'] as $requirement) {
394
+							if (isset($requirement['setting']) && isset($requirement['value']) && isset($requirement['operator']) && isset(self::$field_option_types[$requirement['setting']])) {
395
+								$controller_value = Values::get_value($config_id, $requirement['setting']);
396 396
 
397
-								if ( ! Helper::compare_values( $controller_value, $requirement['value'], $requirement['operator'] ) ) {
397
+								if (!Helper::compare_values($controller_value, $requirement['value'], $requirement['operator'])) {
398 398
 									$valid = false;
399 399
 								}
400 400
 							}
401 401
 						}
402
-					} elseif ( is_string( $field['required'] ) ) {
402
+					} elseif (is_string($field['required'])) {
403 403
 						$valid = '__return_true' === $field['required'] ? true : false;
404
-					} elseif ( is_callable( $field['required'] ) ) {
405
-						$valid = call_user_func( $field['required'] );
404
+					} elseif (is_callable($field['required'])) {
405
+						$valid = call_user_func($field['required']);
406 406
 					}
407 407
 
408
-					if ( ! $valid ) {
408
+					if (!$valid) {
409 409
 						continue;
410 410
 					}
411 411
 				}
412 412
 			}
413 413
 
414 414
 			// Only continue if $field['output'] is set.
415
-			if ( isset( $field['output'] ) && ! empty( $field['output'] ) ) {
416
-				$css = Helper::array_replace_recursive( $css, Generator::css( $field ) );
415
+			if (isset($field['output']) && !empty($field['output'])) {
416
+				$css = Helper::array_replace_recursive($css, Generator::css($field));
417 417
 
418 418
 				// Add the globals.
419
-				if ( isset( self::$css_array[ $config_id ] ) && ! empty( self::$css_array[ $config_id ] ) ) {
420
-					Helper::array_replace_recursive( $css, self::$css_array[ $config_id ] );
419
+				if (isset(self::$css_array[$config_id]) && !empty(self::$css_array[$config_id])) {
420
+					Helper::array_replace_recursive($css, self::$css_array[$config_id]);
421 421
 				}
422 422
 			}
423 423
 		}
424 424
 
425
-		$css = apply_filters( "kirki_{$config_id}_styles", $css );
425
+		$css = apply_filters("kirki_{$config_id}_styles", $css);
426 426
 
427
-		if ( is_array( $css ) ) {
428
-			return Generator::styles_parse( Generator::add_prefixes( $css ) );
427
+		if (is_array($css)) {
428
+			return Generator::styles_parse(Generator::add_prefixes($css));
429 429
 		}
430 430
 
431 431
 	}
@@ -439,16 +439,16 @@  discard block
 block discarded – undo
439 439
 	 * @param string $config_id The config-ID.
440 440
 	 * @return array
441 441
 	 */
442
-	private static function get_fields_by_config( $config_id ) {
442
+	private static function get_fields_by_config($config_id) {
443 443
 
444 444
 		$fields = array();
445 445
 
446
-		foreach ( self::$fields as $field ) {
446
+		foreach (self::$fields as $field) {
447 447
 			if (
448
-				( isset( $field['kirki_config'] ) && $config_id === $field['kirki_config'] ) ||
448
+				(isset($field['kirki_config']) && $config_id === $field['kirki_config']) ||
449 449
 				(
450
-					( 'global' === $config_id || ! $config_id ) &&
451
-					( ! isset( $field['kirki_config'] ) || 'global' === $field['kirki_config'] || ! $field['kirki_config'] )
450
+					('global' === $config_id || !$config_id) &&
451
+					(!isset($field['kirki_config']) || 'global' === $field['kirki_config'] || !$field['kirki_config'])
452 452
 				)
453 453
 			) {
454 454
 				$fields[] = $field;
Please login to merge, or discard this patch.
packages/kirki-framework/field-fontawesome/src/Field/FontAwesome.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -26,21 +26,21 @@
 block discarded – undo
26 26
 	 * @param WP_Customize_Manager $wp_customize The customizer instance.
27 27
 	 * @return array
28 28
 	 */
29
-	public function filter_control_args( $args, $wp_customize ) {
30
-		if ( $args['settings'] === $this->args['settings'] ) {
31
-			$args = parent::filter_control_args( $args, $wp_customize );
29
+	public function filter_control_args($args, $wp_customize) {
30
+		if ($args['settings'] === $this->args['settings']) {
31
+			$args = parent::filter_control_args($args, $wp_customize);
32 32
 
33 33
 			ob_start();
34 34
 			include 'fontawesome.json'; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude
35 35
 			$font_awesome_json = ob_get_clean();
36 36
 
37
-			$fa_array        = (array) json_decode( $font_awesome_json, true );
37
+			$fa_array        = (array) json_decode($font_awesome_json, true);
38 38
 			$args['choices'] = [];
39
-			foreach ( $fa_array['icons'] as $icon ) {
40
-				if ( ! isset( $icon['id'] ) || ! isset( $icon['name'] ) ) {
39
+			foreach ($fa_array['icons'] as $icon) {
40
+				if (!isset($icon['id']) || !isset($icon['name'])) {
41 41
 					continue;
42 42
 				}
43
-				$args['choices'][ $icon['id'] ] = $icon['name'];
43
+				$args['choices'][$icon['id']] = $icon['name'];
44 44
 			}
45 45
 		}
46 46
 		return $args;
Please login to merge, or discard this patch.