Passed
Push — main ( 137754...ffd9e1 )
by TARIQ
04:53
created
kirki-4.0.24/packages/kirki-framework/compatibility/src/Modules.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -45,8 +45,8 @@  discard block
 block discarded – undo
45 45
 	 */
46 46
 	public function __construct() {
47 47
 
48
-		add_action( 'after_setup_theme', [ $this, 'setup_default_modules' ], 10 );
49
-		add_action( 'after_setup_theme', [ $this, 'init' ], 11 );
48
+		add_action('after_setup_theme', [$this, 'setup_default_modules'], 10);
49
+		add_action('after_setup_theme', [$this, 'init'], 11);
50 50
 
51 51
 	}
52 52
 
@@ -87,8 +87,8 @@  discard block
 block discarded – undo
87 87
 	 */
88 88
 	public function init() {
89 89
 
90
-		foreach ( self::$modules as $module_class ) {
91
-			if ( class_exists( $module_class ) ) {
90
+		foreach (self::$modules as $module_class) {
91
+			if (class_exists($module_class)) {
92 92
 				new $module_class();
93 93
 			}
94 94
 		}
@@ -103,9 +103,9 @@  discard block
 block discarded – undo
103 103
 	 * @param string $module The classname of the module to add.
104 104
 	 * @since 3.0.0
105 105
 	 */
106
-	public static function add_module( $module ) {
106
+	public static function add_module($module) {
107 107
 
108
-		if ( ! in_array( $module, self::$modules, true ) ) {
108
+		if (!in_array($module, self::$modules, true)) {
109 109
 			self::$modules[] = $module;
110 110
 		}
111 111
 
@@ -119,12 +119,12 @@  discard block
 block discarded – undo
119 119
 	 * @param string $module The classname of the module to add.
120 120
 	 * @since 3.0.0
121 121
 	 */
122
-	public static function remove_module( $module ) {
122
+	public static function remove_module($module) {
123 123
 
124
-		$key = array_search( $module, self::$modules, true );
124
+		$key = array_search($module, self::$modules, true);
125 125
 
126
-		if ( false !== $key ) {
127
-			unset( self::$modules[ $key ] );
126
+		if (false !== $key) {
127
+			unset(self::$modules[$key]);
128 128
 		}
129 129
 
130 130
 	}
Please login to merge, or discard this patch.
includes/kirki-4.0.24/packages/kirki-framework/compatibility/src/Init.php 1 patch
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -40,13 +40,13 @@  discard block
 block discarded – undo
40 40
 	 * The class constructor.
41 41
 	 */
42 42
 	public function __construct() {
43
-		add_action( 'wp_loaded', [ $this, 'add_to_customizer' ], 1 );
44
-		add_filter( 'kirki_control_types', [ $this, 'default_control_types' ] );
43
+		add_action('wp_loaded', [$this, 'add_to_customizer'], 1);
44
+		add_filter('kirki_control_types', [$this, 'default_control_types']);
45 45
 
46
-		add_action( 'customize_register', [ $this, 'remove_controls' ], 99999 );
46
+		add_action('customize_register', [$this, 'remove_controls'], 99999);
47 47
 
48
-		add_action( 'admin_notices', [ $this, 'admin_notices' ] );
49
-		add_action( 'admin_init', [ $this, 'dismiss_nag' ] );
48
+		add_action('admin_notices', [$this, 'admin_notices']);
49
+		add_action('admin_init', [$this, 'dismiss_nag']);
50 50
 
51 51
 		// ? Bagus: is this necessary? The Values class doesn't have constructor, so this does nothing.
52 52
 		new Values();
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 	 * @param array $control_types The control types array.
61 61
 	 * @return array
62 62
 	 */
63
-	public function default_control_types( $control_types = [] ) {
63
+	public function default_control_types($control_types = []) {
64 64
 		$this->control_types = [
65 65
 			'kirki-composite'       => '\Kirki\Control\Composite',
66 66
 			'checkbox'              => '\Kirki\Control\Checkbox',
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 			'cropped_image'         => '\Kirki\Control\Cropped_Image',
92 92
 			'upload'                => '\Kirki\Control\Upload',
93 93
 		];
94
-		return array_merge( $this->control_types, $control_types );
94
+		return array_merge($this->control_types, $control_types);
95 95
 	}
96 96
 
97 97
 	/**
@@ -99,8 +99,8 @@  discard block
 block discarded – undo
99 99
 	 */
100 100
 	public function add_to_customizer() {
101 101
 		$this->fields_from_filters();
102
-		add_action( 'customize_register', [ $this, 'register_control_types' ] );
103
-		add_action( 'customize_register', [ $this, 'add_fields' ], 99 );
102
+		add_action('customize_register', [$this, 'register_control_types']);
103
+		add_action('customize_register', [$this, 'add_fields'], 99);
104 104
 	}
105 105
 
106 106
 	/**
@@ -110,12 +110,12 @@  discard block
 block discarded – undo
110 110
 		global $wp_customize;
111 111
 
112 112
 		$this->control_types = $this->default_control_types();
113
-		if ( ! class_exists( 'WP_Customize_Code_Editor_Control' ) ) {
114
-			unset( $this->control_types['code_editor'] );
113
+		if (!class_exists('WP_Customize_Code_Editor_Control')) {
114
+			unset($this->control_types['code_editor']);
115 115
 		}
116
-		foreach ( $this->control_types as $key => $classname ) {
117
-			if ( ! class_exists( $classname ) ) {
118
-				unset( $this->control_types[ $key ] );
116
+		foreach ($this->control_types as $key => $classname) {
117
+			if (!class_exists($classname)) {
118
+				unset($this->control_types[$key]);
119 119
 			}
120 120
 		}
121 121
 
@@ -127,9 +127,9 @@  discard block
 block discarded – undo
127 127
 			]
128 128
 		);
129 129
 
130
-		foreach ( $this->control_types as $control_type ) {
131
-			if ( ! in_array( $control_type, $skip_control_types, true ) && class_exists( $control_type ) ) {
132
-				$wp_customize->register_control_type( $control_type );
130
+		foreach ($this->control_types as $control_type) {
131
+			if (!in_array($control_type, $skip_control_types, true) && class_exists($control_type)) {
132
+				$wp_customize->register_control_type($control_type);
133 133
 			}
134 134
 		}
135 135
 	}
@@ -142,18 +142,18 @@  discard block
 block discarded – undo
142 142
 	public function add_fields() {
143 143
 		global $wp_customize;
144 144
 
145
-		foreach ( Kirki::$fields as $args ) {
145
+		foreach (Kirki::$fields as $args) {
146 146
 
147 147
 			// Create the settings.
148
-			new \Kirki\Compatibility\Settings( $args );
148
+			new \Kirki\Compatibility\Settings($args);
149 149
 
150 150
 			// Check if we're on the customizer.
151 151
 			// If we are, then we will create the controls, add the scripts needed for the customizer
152 152
 			// and any other tweaks that this field may require.
153
-			if ( $wp_customize ) {
153
+			if ($wp_customize) {
154 154
 
155 155
 				// Create the control.
156
-				new Control( $args );
156
+				new Control($args);
157 157
 
158 158
 			}
159 159
 		}
@@ -167,13 +167,13 @@  discard block
 block discarded – undo
167 167
 	 * @since 2.0.0
168 168
 	 */
169 169
 	private function fields_from_filters() {
170
-		$fields = apply_filters( 'kirki_controls', [] );
171
-		$fields = apply_filters( 'kirki_fields', $fields );
170
+		$fields = apply_filters('kirki_controls', []);
171
+		$fields = apply_filters('kirki_fields', $fields);
172 172
 
173
-		if ( ! empty( $fields ) ) {
174
-			foreach ( $fields as $field ) {
173
+		if (!empty($fields)) {
174
+			foreach ($fields as $field) {
175 175
 				$field['kirki_config'] = 'global';
176
-				Kirki::add_field( 'global', $field );
176
+				Kirki::add_field('global', $field);
177 177
 			}
178 178
 		}
179 179
 	}
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
 	public static function get_variables() {
204 204
 
205 205
 		// Log error for developers.
206
-		_doing_it_wrong( __METHOD__, esc_html__( 'We detected you\'re using Kirki\Compatibility\Init::get_variables(). Please use \Kirki\Util\Util::get_variables() instead.', 'kirki' ), '3.0.10' );
206
+		_doing_it_wrong(__METHOD__, esc_html__('We detected you\'re using Kirki\Compatibility\Init::get_variables(). Please use \Kirki\Util\Util::get_variables() instead.', 'kirki'), '3.0.10');
207 207
 
208 208
 		// ! This will be failed, because Util class is under Kirki\Util namespace.
209 209
 		return Util::get_variables();
@@ -216,9 +216,9 @@  discard block
 block discarded – undo
216 216
 	 * @param object $wp_customize The customizer object.
217 217
 	 * @return void
218 218
 	 */
219
-	public function remove_controls( $wp_customize ) {
220
-		foreach ( Kirki::$controls_to_remove as $control ) {
221
-			$wp_customize->remove_control( $control );
219
+	public function remove_controls($wp_customize) {
220
+		foreach (Kirki::$controls_to_remove as $control) {
221
+			$wp_customize->remove_control($control);
222 222
 		}
223 223
 	}
224 224
 
@@ -232,33 +232,33 @@  discard block
 block discarded – undo
232 232
 	public function admin_notices() {
233 233
 
234 234
 		// No need for a nag if we don't need to recommend installing the FA plugin.
235
-		if ( ! self::$show_fa_nag ) {
235
+		if (!self::$show_fa_nag) {
236 236
 			return;
237 237
 		}
238 238
 
239 239
 		// No need for a nag if FA plugin is already installed.
240
-		if ( defined( 'FONTAWESOME_DIR_PATH' ) ) {
240
+		if (defined('FONTAWESOME_DIR_PATH')) {
241 241
 			return;
242 242
 		}
243 243
 
244 244
 		// No need for a nag if current user can't install plugins.
245
-		if ( ! current_user_can( 'install_plugins' ) ) {
245
+		if (!current_user_can('install_plugins')) {
246 246
 			return;
247 247
 		}
248 248
 
249 249
 		// No need for a nag if user has dismissed it.
250
-		$dismissed = get_user_meta( get_current_user_id(), 'kirki_fa_nag_dismissed', true );
251
-		if ( true === $dismissed || 1 === $dismissed || '1' === $dismissed ) {
250
+		$dismissed = get_user_meta(get_current_user_id(), 'kirki_fa_nag_dismissed', true);
251
+		if (true === $dismissed || 1 === $dismissed || '1' === $dismissed) {
252 252
 			return;
253 253
 		}
254 254
 		?>
255 255
 		<div class="notice notice-info is-dismissible">
256 256
 			<p>
257
-				<?php esc_html_e( 'Your theme uses a Font Awesome field for icons. To avoid issues with missing icons on your frontend we recommend you install the official Font Awesome plugin.', 'kirki' ); ?>
257
+				<?php esc_html_e('Your theme uses a Font Awesome field for icons. To avoid issues with missing icons on your frontend we recommend you install the official Font Awesome plugin.', 'kirki'); ?>
258 258
 			</p>
259 259
 			<p>
260
-				<a class="button button-primary" href="<?php echo esc_url( admin_url( 'plugin-install.php?tab=plugin-information&plugin=font-awesome&TB_iframe=true&width=600&height=550' ) ); ?>"><?php esc_html_e( 'Install Plugin', 'kirki' ); ?></a>
261
-				<a class="button button-secondary" href="<?php echo esc_url( wp_nonce_url( admin_url( '?dismiss-nag=font-awesome-kirki' ), 'kirki-dismiss-nag', 'nonce' ) ); ?>"><?php esc_html_e( 'Don\'t show this again', 'kirki' ); ?></a>
260
+				<a class="button button-primary" href="<?php echo esc_url(admin_url('plugin-install.php?tab=plugin-information&plugin=font-awesome&TB_iframe=true&width=600&height=550')); ?>"><?php esc_html_e('Install Plugin', 'kirki'); ?></a>
261
+				<a class="button button-secondary" href="<?php echo esc_url(wp_nonce_url(admin_url('?dismiss-nag=font-awesome-kirki'), 'kirki-dismiss-nag', 'nonce')); ?>"><?php esc_html_e('Don\'t show this again', 'kirki'); ?></a>
262 262
 			</p>
263 263
 		</div>
264 264
 		<?php
@@ -272,9 +272,9 @@  discard block
 block discarded – undo
272 272
 	 * @return void
273 273
 	 */
274 274
 	public function dismiss_nag() {
275
-		if ( isset( $_GET['nonce'] ) && wp_verify_nonce( $_GET['nonce'], 'kirki-dismiss-nag' ) ) { // phpcs:ignore WordPress.Security.ValidatedSanitizedInput
276
-			if ( get_current_user_id() && isset( $_GET['dismiss-nag'] ) && 'font-awesome-kirki' === $_GET['dismiss-nag'] ) {
277
-				update_user_meta( get_current_user_id(), 'kirki_fa_nag_dismissed', true );
275
+		if (isset($_GET['nonce']) && wp_verify_nonce($_GET['nonce'], 'kirki-dismiss-nag')) { // phpcs:ignore WordPress.Security.ValidatedSanitizedInput
276
+			if (get_current_user_id() && isset($_GET['dismiss-nag']) && 'font-awesome-kirki' === $_GET['dismiss-nag']) {
277
+				update_user_meta(get_current_user_id(), 'kirki_fa_nag_dismissed', true);
278 278
 			}
279 279
 		}
280 280
 	}
@@ -288,18 +288,18 @@  discard block
 block discarded – undo
288 288
 	 * @param array $args The field arguments.
289 289
 	 * @return void
290 290
 	 */
291
-	protected static function maybe_show_fontawesome_nag( $args ) {
291
+	protected static function maybe_show_fontawesome_nag($args) {
292 292
 
293 293
 		// If we already know we want it, skip check.
294
-		if ( self::$show_fa_nag ) {
294
+		if (self::$show_fa_nag) {
295 295
 			return;
296 296
 		}
297 297
 
298 298
 		// Check if the field is fontawesome.
299
-		if ( isset( $args['type'] ) && in_array( $args['type'], [ 'fontawesome', 'kirki-fontawesome' ], true ) ) {
299
+		if (isset($args['type']) && in_array($args['type'], ['fontawesome', 'kirki-fontawesome'], true)) {
300 300
 
301 301
 			// Skip check if theme has disabled FA enqueueing via a filter.
302
-			if ( ! apply_filters( 'kirki_load_fontawesome', true ) ) {
302
+			if (!apply_filters('kirki_load_fontawesome', true)) {
303 303
 				return;
304 304
 			}
305 305
 
Please login to merge, or discard this patch.
kirki-4.0.24/packages/kirki-framework/compatibility/src/Sanitize_Values.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 use Kirki\Field\Checkbox;
17 17
 
18 18
 // Exit if accessed directly.
19
-if ( ! defined( 'ABSPATH' ) ) {
19
+if (!defined('ABSPATH')) {
20 20
 	exit;
21 21
 }
22 22
 
@@ -39,11 +39,11 @@  discard block
 block discarded – undo
39 39
 	 * @param bool|string $value Whether the checkbox is checked.
40 40
 	 * @return bool Whether the checkbox is checked.
41 41
 	 */
42
-	public static function checkbox( $value ) {
42
+	public static function checkbox($value) {
43 43
 		$obj = new Checkbox();
44 44
 
45 45
 		// ! This sanitize function doesn't exist. A method exists check should be used before actually calling it.
46
-		return (bool) $obj->sanitize( $value );
46
+		return (bool) $obj->sanitize($value);
47 47
 	}
48 48
 
49 49
 	/**
@@ -55,8 +55,8 @@  discard block
 block discarded – undo
55 55
 	 * @param int|float|double|string $value The value to be sanitized.
56 56
 	 * @return integer|double|string
57 57
 	 */
58
-	public static function number( $value ) {
59
-		return ( is_numeric( $value ) ) ? $value : intval( $value );
58
+	public static function number($value) {
59
+		return (is_numeric($value)) ? $value : intval($value);
60 60
 	}
61 61
 
62 62
 	/**
@@ -75,13 +75,13 @@  discard block
 block discarded – undo
75 75
 	 * @param WP_Customize_Setting $setting Setting instance.
76 76
 	 * @return int|string Page ID if the page is published; otherwise, the setting default.
77 77
 	 */
78
-	public static function dropdown_pages( $page_id, $setting ) {
78
+	public static function dropdown_pages($page_id, $setting) {
79 79
 
80 80
 		// Ensure $input is an absolute integer.
81
-		$page_id = absint( $page_id );
81
+		$page_id = absint($page_id);
82 82
 
83 83
 		// If $page_id is an ID of a published page, return it; otherwise, return the default.
84
-		return ( 'publish' === get_post_status( $page_id ) ? $page_id : $setting->default );
84
+		return ('publish' === get_post_status($page_id) ? $page_id : $setting->default);
85 85
 	}
86 86
 
87 87
 	/**
@@ -93,50 +93,50 @@  discard block
 block discarded – undo
93 93
 	 * @param string $value The value to be sanitized.
94 94
 	 * @return string
95 95
 	 */
96
-	public static function css_dimension( $value ) {
96
+	public static function css_dimension($value) {
97 97
 
98 98
 		// Trim it.
99
-		$value = trim( $value );
99
+		$value = trim($value);
100 100
 
101 101
 		// If the value is round, then return 50%.
102
-		if ( 'round' === $value ) {
102
+		if ('round' === $value) {
103 103
 			$value = '50%';
104 104
 		}
105 105
 
106 106
 		// If the value is empty, return empty.
107
-		if ( '' === $value ) {
107
+		if ('' === $value) {
108 108
 			return '';
109 109
 		}
110 110
 
111 111
 		// If auto, inherit or initial, return the value.
112
-		if ( 'auto' === $value || 'initial' === $value || 'inherit' === $value || 'normal' === $value ) {
112
+		if ('auto' === $value || 'initial' === $value || 'inherit' === $value || 'normal' === $value) {
113 113
 			return $value;
114 114
 		}
115 115
 
116 116
 		// Return empty if there are no numbers in the value.
117
-		if ( ! preg_match( '#[0-9]#', $value ) ) {
117
+		if (!preg_match('#[0-9]#', $value)) {
118 118
 			return '';
119 119
 		}
120 120
 
121 121
 		// If we're using calc() then return the value.
122
-		if ( false !== strpos( $value, 'calc(' ) ) {
122
+		if (false !== strpos($value, 'calc(')) {
123 123
 			return $value;
124 124
 		}
125 125
 
126 126
 		// The raw value without the units.
127
-		$raw_value = self::filter_number( $value );
127
+		$raw_value = self::filter_number($value);
128 128
 		$unit_used = '';
129 129
 
130 130
 		// An array of all valid CSS units. Their order was carefully chosen for this evaluation, don't mix it up!!!
131
-		$units = [ 'fr', 'rem', 'em', 'ex', '%', 'px', 'cm', 'mm', 'in', 'pt', 'pc', 'ch', 'vh', 'vw', 'vmin', 'vmax' ];
132
-		foreach ( $units as $unit ) {
133
-			if ( false !== strpos( $value, $unit ) ) {
131
+		$units = ['fr', 'rem', 'em', 'ex', '%', 'px', 'cm', 'mm', 'in', 'pt', 'pc', 'ch', 'vh', 'vw', 'vmin', 'vmax'];
132
+		foreach ($units as $unit) {
133
+			if (false !== strpos($value, $unit)) {
134 134
 				$unit_used = $unit;
135 135
 			}
136 136
 		}
137 137
 
138 138
 		// Hack for rem values.
139
-		if ( 'em' === $unit_used && false !== strpos( $value, 'rem' ) ) {
139
+		if ('em' === $unit_used && false !== strpos($value, 'rem')) {
140 140
 			$unit_used = 'rem';
141 141
 		}
142 142
 
@@ -151,8 +151,8 @@  discard block
 block discarded – undo
151 151
 	 * @param string $value The value to be sanitized.
152 152
 	 * @return int|float
153 153
 	 */
154
-	public static function filter_number( $value ) {
155
-		return filter_var( $value, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION );
154
+	public static function filter_number($value) {
155
+		return filter_var($value, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
156 156
 	}
157 157
 
158 158
 	/**
@@ -163,9 +163,9 @@  discard block
 block discarded – undo
163 163
 	 * @param string $value The value to be sanitized.
164 164
 	 * @return string
165 165
 	 */
166
-	public static function rgba( $value ) {
167
-		$color = \ariColor::newColor( $value );
168
-		return $color->toCSS( 'rgba' );
166
+	public static function rgba($value) {
167
+		$color = \ariColor::newColor($value);
168
+		return $color->toCSS('rgba');
169 169
 	}
170 170
 
171 171
 	/**
@@ -176,23 +176,23 @@  discard block
 block discarded – undo
176 176
 	 * @param string $value The value to be sanitized.
177 177
 	 * @return string
178 178
 	 */
179
-	public static function color( $value ) {
179
+	public static function color($value) {
180 180
 
181 181
 		// If the value is empty, then return empty.
182
-		if ( '' === $value ) {
182
+		if ('' === $value) {
183 183
 			return '';
184 184
 		}
185 185
 
186 186
 		// If transparent, then return 'transparent'.
187
-		if ( is_string( $value ) && 'transparent' === trim( $value ) ) {
187
+		if (is_string($value) && 'transparent' === trim($value)) {
188 188
 			return 'transparent';
189 189
 		}
190 190
 
191 191
 		// Instantiate the object.
192
-		$color = \ariColor::newColor( $value );
192
+		$color = \ariColor::newColor($value);
193 193
 
194 194
 		// Return a CSS value, using the auto-detected mode.
195
-		return $color->toCSS( $color->mode );
195
+		return $color->toCSS($color->mode);
196 196
 	}
197 197
 
198 198
 	/**
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
 	 * @param int|string|array $value The value to be sanitized.
204 204
 	 * @return int|string|array
205 205
 	 */
206
-	public static function unfiltered( $value ) {
206
+	public static function unfiltered($value) {
207 207
 		return $value;
208 208
 	}
209 209
 }
Please login to merge, or discard this patch.
includes/kirki-4.0.24/packages/kirki-framework/module-preset/src/Preset.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -35,8 +35,8 @@  discard block
 block discarded – undo
35 35
 	 * @since 1.0.0
36 36
 	 */
37 37
 	public function __construct() {
38
-		add_action( 'customize_controls_print_footer_scripts', [ $this, 'customize_controls_print_footer_scripts' ] );
39
-		add_filter( 'kirki_field_add_control_args', [ $this, 'field_add_control_args' ] );
38
+		add_action('customize_controls_print_footer_scripts', [$this, 'customize_controls_print_footer_scripts']);
39
+		add_filter('kirki_field_add_control_args', [$this, 'field_add_control_args']);
40 40
 	}
41 41
 
42 42
 	/**
@@ -47,9 +47,9 @@  discard block
 block discarded – undo
47 47
 	 * @param array $args The field arguments.
48 48
 	 * @return array
49 49
 	 */
50
-	public function field_add_control_args( $args ) {
51
-		if ( isset( $args['preset'] ) && is_array( $args['preset'] ) ) {
52
-			self::$preset_controls[ $args['settings'] ] = $args['preset'];
50
+	public function field_add_control_args($args) {
51
+		if (isset($args['preset']) && is_array($args['preset'])) {
52
+			self::$preset_controls[$args['settings']] = $args['preset'];
53 53
 		}
54 54
 		return $args;
55 55
 	}
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 	 * @since 1.0.0
62 62
 	 */
63 63
 	public function customize_controls_print_footer_scripts() {
64
-		wp_enqueue_script( 'kirki-preset', URL::get_from_path( __DIR__ . '/script.js' ), [ 'jquery' ], '1.0.0', false );
65
-		wp_localize_script( 'kirki-preset', 'kirkiPresetControls', self::$preset_controls );
64
+		wp_enqueue_script('kirki-preset', URL::get_from_path(__DIR__ . '/script.js'), ['jquery'], '1.0.0', false);
65
+		wp_localize_script('kirki-preset', 'kirkiPresetControls', self::$preset_controls);
66 66
 	}
67 67
 }
Please login to merge, or discard this patch.
packages/kirki-framework/field-multicolor/src/Field/CSS/Multicolor.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -25,33 +25,33 @@
 block discarded – undo
25 25
 	 * @param array $output The `output` item.
26 26
 	 * @param array $value  The field's value.
27 27
 	 */
28
-	protected function process_output( $output, $value ) {
28
+	protected function process_output($output, $value) {
29 29
 
30
-		foreach ( $value as $key => $sub_value ) {
30
+		foreach ($value as $key => $sub_value) {
31 31
 
32 32
 			// If "element" is not defined, there's no reason to continue.
33
-			if ( ! isset( $output['element'] ) ) {
33
+			if (!isset($output['element'])) {
34 34
 				continue;
35 35
 			}
36 36
 
37 37
 			// If the "choice" is not the same as the $key in our loop, there's no reason to proceed.
38
-			if ( isset( $output['choice'] ) && $key !== $output['choice'] ) {
38
+			if (isset($output['choice']) && $key !== $output['choice']) {
39 39
 				continue;
40 40
 			}
41 41
 
42 42
 			// If "property" is not defined, fallback to the $key.
43
-			$property = ( ! isset( $output['property'] ) || empty( $output['property'] ) ) ? $key : $output['property'];
43
+			$property = (!isset($output['property']) || empty($output['property'])) ? $key : $output['property'];
44 44
 
45 45
 			// If "media_query" is not defined, use "global".
46
-			if ( ! isset( $output['media_query'] ) || empty( $output['media_query'] ) ) {
46
+			if (!isset($output['media_query']) || empty($output['media_query'])) {
47 47
 				$output['media_query'] = 'global';
48 48
 			}
49 49
 
50 50
 			// If "suffix" is defined, add it to the value.
51
-			$output['suffix'] = ( isset( $output['suffix'] ) ) ? $output['suffix'] : '';
51
+			$output['suffix'] = (isset($output['suffix'])) ? $output['suffix'] : '';
52 52
 
53 53
 			// Create the styles.
54
-			$this->styles[ $output['media_query'] ][ $output['element'] ][ $property ] = $sub_value . $output['suffix'];
54
+			$this->styles[$output['media_query']][$output['element']][$property] = $sub_value . $output['suffix'];
55 55
 
56 56
 		}
57 57
 	}
Please login to merge, or discard this patch.
packages/kirki-framework/field-multicolor/src/Field/Multicolor.php 1 patch
Spacing   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -36,9 +36,9 @@  discard block
 block discarded – undo
36 36
 	 * @access public
37 37
 	 * @param array $args The arguments of the field.
38 38
 	 */
39
-	public function init( $args ) {
39
+	public function init($args) {
40 40
 
41
-		add_filter( 'kirki_output_control_classnames', [ $this, 'output_control_classnames' ] );
41
+		add_filter('kirki_output_control_classnames', [$this, 'output_control_classnames']);
42 42
 
43 43
 		$parent_control_args = wp_parse_args(
44 44
 			[
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 					'type'        => 'hidden',
53 53
 					'parent_type' => 'kirki-multicolor',
54 54
 				],
55
-				'sanitize_callback' => [ __CLASS__, 'sanitize' ],
55
+				'sanitize_callback' => [__CLASS__, 'sanitize'],
56 56
 			],
57 57
 			$args
58 58
 		);
@@ -60,30 +60,30 @@  discard block
 block discarded – undo
60 60
 		/**
61 61
 		 * Add a hidden field, the label & description.
62 62
 		 */
63
-		new \Kirki\Field\Generic( $parent_control_args );
63
+		new \Kirki\Field\Generic($parent_control_args);
64 64
 
65
-		$total_colors = count( $args['choices'] );
65
+		$total_colors = count($args['choices']);
66 66
 		$loop_index   = 0;
67 67
 
68
-		$use_alpha = $this->filter_preferred_choice_setting( 'alpha', null, $args ) ? true : false;
69
-		$swatches  = $this->filter_preferred_choice_setting( 'swatches', null, $args );
70
-		$swatches  = empty( $swatches ) ? $this->filter_preferred_choice_setting( 'palettes', null, $args ) : $swatches;
71
-		$swatches  = empty( $swatches ) ? [] : $swatches;
68
+		$use_alpha = $this->filter_preferred_choice_setting('alpha', null, $args) ? true : false;
69
+		$swatches  = $this->filter_preferred_choice_setting('swatches', null, $args);
70
+		$swatches  = empty($swatches) ? $this->filter_preferred_choice_setting('palettes', null, $args) : $swatches;
71
+		$swatches  = empty($swatches) ? [] : $swatches;
72 72
 
73
-		if ( empty( $swatches ) ) {
74
-			$swatches = isset( $args['palettes'] ) && ! empty( $args['palettes'] ) ? $args['palettes'] : [];
73
+		if (empty($swatches)) {
74
+			$swatches = isset($args['palettes']) && !empty($args['palettes']) ? $args['palettes'] : [];
75 75
 		}
76 76
 
77
-		foreach ( $args['choices'] as $choice => $choice_label ) {
77
+		foreach ($args['choices'] as $choice => $choice_label) {
78 78
 			$loop_index++;
79 79
 
80 80
 			$classnames  = '{default_class} kirki-group-item';
81
-			$classnames .= 1 === $loop_index ? ' kirki-group-start' : ( $loop_index === $total_colors ? ' kirki-group-end' : $classnames );
81
+			$classnames .= 1 === $loop_index ? ' kirki-group-start' : ($loop_index === $total_colors ? ' kirki-group-end' : $classnames);
82 82
 
83
-			$use_alpha_per_choice = $this->filter_preferred_choice_setting( 'alpha', $choice, $args ) ? true : $use_alpha;
84
-			$swatches_per_choice  = $this->filter_preferred_choice_setting( 'swatches', $choice, $args );
85
-			$swatches_per_choice  = empty( $swatches_per_choice ) ? $this->filter_preferred_choice_setting( 'palettes', $choice, $args ) : $swatches_per_choice;
86
-			$swatches_per_choice  = empty( $swatches_per_choice ) ? $swatches : $swatches_per_choice;
83
+			$use_alpha_per_choice = $this->filter_preferred_choice_setting('alpha', $choice, $args) ? true : $use_alpha;
84
+			$swatches_per_choice  = $this->filter_preferred_choice_setting('swatches', $choice, $args);
85
+			$swatches_per_choice  = empty($swatches_per_choice) ? $this->filter_preferred_choice_setting('palettes', $choice, $args) : $swatches_per_choice;
86
+			$swatches_per_choice  = empty($swatches_per_choice) ? $swatches : $swatches_per_choice;
87 87
 
88 88
 			$control_args = wp_parse_args(
89 89
 				[
@@ -91,12 +91,12 @@  discard block
 block discarded – undo
91 91
 					'parent_setting' => $args['settings'],
92 92
 					'label'          => $choice_label,
93 93
 					'description'    => '',
94
-					'default'        => $this->filter_preferred_choice_setting( 'default', $choice, $args ),
94
+					'default'        => $this->filter_preferred_choice_setting('default', $choice, $args),
95 95
 					'wrapper_attrs'  => [
96 96
 						'data-kirki-parent-control-type' => 'kirki-multicolor',
97 97
 						'class'                          => $classnames,
98 98
 					],
99
-					'input_attrs'    => $this->filter_preferred_choice_setting( 'input_attrs', $choice, $args ),
99
+					'input_attrs'    => $this->filter_preferred_choice_setting('input_attrs', $choice, $args),
100 100
 					'choices'        => [
101 101
 						'alpha'       => $use_alpha_per_choice,
102 102
 						'label_style' => 'tooltip',
@@ -108,23 +108,23 @@  discard block
 block discarded – undo
108 108
 				$args
109 109
 			);
110 110
 
111
-			foreach ( $control_args['choices'] as $control_choice_id => $control_choice_value ) {
112
-				if ( isset( $control_args[ $control_choice_id ] ) ) {
113
-					unset( $control_args[ $control_choice_id ] );
111
+			foreach ($control_args['choices'] as $control_choice_id => $control_choice_value) {
112
+				if (isset($control_args[$control_choice_id])) {
113
+					unset($control_args[$control_choice_id]);
114 114
 				} else {
115
-					if ( 'swatches' === $control_choice_id || 'palettes' === $control_choice_id ) {
116
-						if ( isset( $control_args['palettes'] ) ) {
117
-							unset( $control_args['palettes'] );
115
+					if ('swatches' === $control_choice_id || 'palettes' === $control_choice_id) {
116
+						if (isset($control_args['palettes'])) {
117
+							unset($control_args['palettes']);
118 118
 						}
119 119
 
120
-						if ( isset( $control_args['swatches'] ) ) {
121
-							unset( $control_args['swatches'] );
120
+						if (isset($control_args['swatches'])) {
121
+							unset($control_args['swatches']);
122 122
 						}
123 123
 					}
124 124
 				}
125 125
 			}
126 126
 
127
-			new \Kirki\Field\ReactColorful( $control_args );
127
+			new \Kirki\Field\ReactColorful($control_args);
128 128
 		}
129 129
 	}
130 130
 
@@ -140,45 +140,45 @@  discard block
 block discarded – undo
140 140
 	 *
141 141
 	 * @return string
142 142
 	 */
143
-	public function filter_preferred_choice_setting( $setting, $choice, $args ) {
143
+	public function filter_preferred_choice_setting($setting, $choice, $args) {
144 144
 
145 145
 		// Fail early.
146
-		if ( ! isset( $args[ $setting ] ) ) {
146
+		if (!isset($args[$setting])) {
147 147
 			return '';
148 148
 		}
149 149
 
150
-		if ( null === $choice ) {
150
+		if (null === $choice) {
151 151
 			$per_choice_found = false;
152 152
 
153
-			foreach ( $args['choices'] as $choice_id => $choice_label ) {
154
-				if ( isset( $args[ $setting ][ $choice_id ] ) ) {
153
+			foreach ($args['choices'] as $choice_id => $choice_label) {
154
+				if (isset($args[$setting][$choice_id])) {
155 155
 					$per_choice_found = true;
156 156
 					break;
157 157
 				}
158 158
 			}
159 159
 
160
-			if ( ! $per_choice_found ) {
161
-				return $args[ $setting ];
160
+			if (!$per_choice_found) {
161
+				return $args[$setting];
162 162
 			}
163 163
 
164 164
 			return '';
165 165
 		}
166 166
 
167 167
 		// If a specific field for the choice is set.
168
-		if ( isset( $args[ $setting ][ $choice ] ) ) {
169
-			return $args[ $setting ][ $choice ];
168
+		if (isset($args[$setting][$choice])) {
169
+			return $args[$setting][$choice];
170 170
 		}
171 171
 
172 172
 		// Unset all other choices.
173
-		foreach ( $args['choices'] as $id => $set ) {
174
-			if ( $id !== $choice && isset( $args[ $setting ][ $id ] ) ) {
175
-				unset( $args[ $setting ][ $id ] );
176
-			} elseif ( ! isset( $args[ $setting ][ $id ] ) ) {
177
-				$args[ $setting ] = '';
173
+		foreach ($args['choices'] as $id => $set) {
174
+			if ($id !== $choice && isset($args[$setting][$id])) {
175
+				unset($args[$setting][$id]);
176
+			} elseif (!isset($args[$setting][$id])) {
177
+				$args[$setting] = '';
178 178
 			}
179 179
 		}
180 180
 
181
-		return $args[ $setting ];
181
+		return $args[$setting];
182 182
 
183 183
 	}
184 184
 
@@ -191,15 +191,15 @@  discard block
 block discarded – undo
191 191
 	 * @param WP_Customize_Manager $wp_customize The customizer instance.
192 192
 	 * @return array
193 193
 	 */
194
-	public function filter_setting_args( $args, $wp_customize ) {
194
+	public function filter_setting_args($args, $wp_customize) {
195 195
 
196
-		if ( $args['settings'] !== $this->args['settings'] ) {
196
+		if ($args['settings'] !== $this->args['settings']) {
197 197
 			return $args;
198 198
 		}
199 199
 
200 200
 		// Set the sanitize-callback if none is defined.
201
-		if ( ! isset( $args['sanitize_callback'] ) || ! $args['sanitize_callback'] ) {
202
-			$args['sanitize_callback'] = [ __CLASS__, 'sanitize' ];
201
+		if (!isset($args['sanitize_callback']) || !$args['sanitize_callback']) {
202
+			$args['sanitize_callback'] = [__CLASS__, 'sanitize'];
203 203
 		}
204 204
 
205 205
 		return $args;
@@ -214,10 +214,10 @@  discard block
 block discarded – undo
214 214
 	 * @param array $value The value.
215 215
 	 * @return array
216 216
 	 */
217
-	public static function sanitize( $value ) {
217
+	public static function sanitize($value) {
218 218
 
219
-		foreach ( $value as $key => $subvalue ) {
220
-			$value[ $key ] = \Kirki\Field\Color::sanitize( $subvalue );
219
+		foreach ($value as $key => $subvalue) {
220
+			$value[$key] = \Kirki\Field\Color::sanitize($subvalue);
221 221
 		}
222 222
 
223 223
 		return $value;
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 	 * @param WP_Customize_Manager $wp_customize The customizer instance.
233 233
 	 * @return void
234 234
 	 */
235
-	public function add_setting( $wp_customize ) {}
235
+	public function add_setting($wp_customize) {}
236 236
 
237 237
 	/**
238 238
 	 * Override the parent method. No need for a control.
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 	 * @param WP_Customize_Manager $wp_customize The customizer instance.
243 243
 	 * @return void
244 244
 	 */
245
-	public function add_control( $wp_customize ) {}
245
+	public function add_control($wp_customize) {}
246 246
 
247 247
 	/**
248 248
 	 * Adds a custom output class for typography fields.
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 	 * @param array $classnames The array of classnames.
253 253
 	 * @return array
254 254
 	 */
255
-	public function output_control_classnames( $classnames ) {
255
+	public function output_control_classnames($classnames) {
256 256
 		$classnames['kirki-multicolor'] = '\Kirki\Field\CSS\Multicolor';
257 257
 		return $classnames;
258 258
 	}
Please login to merge, or discard this patch.
kirki-4.0.24/packages/kirki-framework/control-slider/src/Field/Slider.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -53,15 +53,15 @@  discard block
 block discarded – undo
53 53
 	 *
54 54
 	 * @return array $args The maybe-filtered arguments.
55 55
 	 */
56
-	public function filter_setting_args( $args, $wp_customize ) {
56
+	public function filter_setting_args($args, $wp_customize) {
57 57
 
58
-		if ( $args['settings'] === $this->args['settings'] ) {
59
-			$args = parent::filter_setting_args( $args, $wp_customize );
58
+		if ($args['settings'] === $this->args['settings']) {
59
+			$args = parent::filter_setting_args($args, $wp_customize);
60 60
 
61 61
 			// Set the sanitize_callback if none is defined.
62
-			if ( ! isset( $args['sanitize_callback'] ) || ! $args['sanitize_callback'] ) {
63
-				$args['sanitize_callback'] = function ( $value ) {
64
-					return filter_var( $value, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION );
62
+			if (!isset($args['sanitize_callback']) || !$args['sanitize_callback']) {
63
+				$args['sanitize_callback'] = function($value) {
64
+					return filter_var($value, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
65 65
 				};
66 66
 			}
67 67
 		}
@@ -78,10 +78,10 @@  discard block
 block discarded – undo
78 78
 	 *
79 79
 	 * @return array $args The maybe-filtered arguments.
80 80
 	 */
81
-	public function filter_control_args( $args, $wp_customize ) {
81
+	public function filter_control_args($args, $wp_customize) {
82 82
 
83
-		if ( $args['settings'] === $this->args['settings'] ) {
84
-			$args         = parent::filter_control_args( $args, $wp_customize );
83
+		if ($args['settings'] === $this->args['settings']) {
84
+			$args         = parent::filter_control_args($args, $wp_customize);
85 85
 			$args['type'] = 'kirki-slider';
86 86
 		}
87 87
 
Please login to merge, or discard this patch.
kirki-4.0.24/packages/kirki-framework/control-slider/src/Control/Slider.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -50,10 +50,10 @@  discard block
 block discarded – undo
50 50
 		parent::enqueue();
51 51
 
52 52
 		// Enqueue the style.
53
-		wp_enqueue_style( 'kirki-control-slider', URL::get_from_path( dirname( dirname( __DIR__ ) ) . '/dist/control.css' ), [], self::$control_ver );
53
+		wp_enqueue_style('kirki-control-slider', URL::get_from_path(dirname(dirname(__DIR__)) . '/dist/control.css'), [], self::$control_ver);
54 54
 
55 55
 		// Enqueue the script.
56
-		wp_enqueue_script( 'kirki-control-slider', URL::get_from_path( dirname( dirname( __DIR__ ) ) . '/dist/control.js' ), [ 'jquery', 'customize-controls', 'customize-base', 'react-dom' ], self::$control_ver, false );
56
+		wp_enqueue_script('kirki-control-slider', URL::get_from_path(dirname(dirname(__DIR__)) . '/dist/control.js'), ['jquery', 'customize-controls', 'customize-base', 'react-dom'], self::$control_ver, false);
57 57
 
58 58
 	}
59 59
 
@@ -78,12 +78,12 @@  discard block
 block discarded – undo
78 78
 			]
79 79
 		);
80 80
 
81
-		if ( isset( $this->json['label'] ) ) {
82
-			$this->json['label'] = html_entity_decode( $this->json['label'] );
81
+		if (isset($this->json['label'])) {
82
+			$this->json['label'] = html_entity_decode($this->json['label']);
83 83
 		}
84 84
 
85
-		if ( isset( $this->json['description'] ) ) {
86
-			$this->json['description'] = html_entity_decode( $this->json['description'] );
85
+		if (isset($this->json['description'])) {
86
+			$this->json['description'] = html_entity_decode($this->json['description']);
87 87
 		}
88 88
 
89 89
 		$this->json['choices']['min']  = (float) $this->json['choices']['min'];
Please login to merge, or discard this patch.
brighty-core/includes/kirki-4.0.24/packages/composer/platform_check.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,9 +14,9 @@
 block discarded – undo
14 14
     }
15 15
     if (!ini_get('display_errors')) {
16 16
         if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
17
-            fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL.PHP_EOL);
17
+            fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL . PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL . PHP_EOL);
18 18
         } elseif (!headers_sent()) {
19
-            echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL;
19
+            echo 'Composer detected issues in your platform:' . PHP_EOL . PHP_EOL . str_replace('You are running ' . PHP_VERSION . '.', '', implode(PHP_EOL, $issues)) . PHP_EOL . PHP_EOL;
20 20
         }
21 21
     }
22 22
     trigger_error(
Please login to merge, or discard this patch.