Passed
Push — develop ( d44a36...35a5e4 )
by Aristeides
03:17
created
core/class-kirki.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 	public static function add_config( $config_id, $args = array() ) {
143 143
 		$config                             = Kirki_Config::get_instance( $config_id, $args );
144 144
 		$config_args                        = $config->get_config();
145
-		self::$config[ $config_args['id'] ] = $config_args;
145
+		self::$config[ $config_args[ 'id' ] ] = $config_args;
146 146
 	}
147 147
 
148 148
 	/**
@@ -154,18 +154,18 @@  discard block
 block discarded – undo
154 154
 	 * @param array  $args The panel arguments.
155 155
 	 */
156 156
 	public static function add_panel( $id = '', $args = array() ) {
157
-		$args['id'] = $id;
158
-		if ( ! isset( $args['description'] ) ) {
159
-			$args['description'] = '';
157
+		$args[ 'id' ] = $id;
158
+		if ( ! isset( $args[ 'description' ] ) ) {
159
+			$args[ 'description' ] = '';
160 160
 		}
161
-		if ( ! isset( $args['priority'] ) ) {
162
-			$args['priority'] = 10;
161
+		if ( ! isset( $args[ 'priority' ] ) ) {
162
+			$args[ 'priority' ] = 10;
163 163
 		}
164
-		if ( ! isset( $args['type'] ) ) {
165
-			$args['type'] = 'default';
164
+		if ( ! isset( $args[ 'type' ] ) ) {
165
+			$args[ 'type' ] = 'default';
166 166
 		}
167
-		if ( false === strpos( $args['type'], 'kirki-' ) ) {
168
-			$args['type'] = 'kirki-' . $args['type'];
167
+		if ( false === strpos( $args[ 'type' ], 'kirki-' ) ) {
168
+			$args[ 'type' ] = 'kirki-' . $args[ 'type' ];
169 169
 		}
170 170
 		self::$panels[ $id ] = $args;
171 171
 	}
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 	 */
181 181
 	public static function remove_panel( $id = '' ) {
182 182
 		if ( ! in_array( $id, self::$panels_to_remove, true ) ) {
183
-			self::$panels_to_remove[] = $id;
183
+			self::$panels_to_remove[ ] = $id;
184 184
 		}
185 185
 	}
186 186
 
@@ -193,18 +193,18 @@  discard block
 block discarded – undo
193 193
 	 * @param array  $args The section arguments.
194 194
 	 */
195 195
 	public static function add_section( $id, $args ) {
196
-		$args['id'] = $id;
197
-		if ( ! isset( $args['description'] ) ) {
198
-			$args['description'] = '';
196
+		$args[ 'id' ] = $id;
197
+		if ( ! isset( $args[ 'description' ] ) ) {
198
+			$args[ 'description' ] = '';
199 199
 		}
200
-		if ( ! isset( $args['priority'] ) ) {
201
-			$args['priority'] = 10;
200
+		if ( ! isset( $args[ 'priority' ] ) ) {
201
+			$args[ 'priority' ] = 10;
202 202
 		}
203
-		if ( ! isset( $args['type'] ) ) {
204
-			$args['type'] = 'default';
203
+		if ( ! isset( $args[ 'type' ] ) ) {
204
+			$args[ 'type' ] = 'default';
205 205
 		}
206
-		if ( false === strpos( $args['type'], 'kirki-' ) ) {
207
-			$args['type'] = 'kirki-' . $args['type'];
206
+		if ( false === strpos( $args[ 'type' ], 'kirki-' ) ) {
207
+			$args[ 'type' ] = 'kirki-' . $args[ 'type' ];
208 208
 		}
209 209
 
210 210
 		self::$sections[ $id ] = $args;
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 	 */
221 221
 	public static function remove_section( $id = '' ) {
222 222
 		if ( ! in_array( $id, self::$sections_to_remove, true ) ) {
223
-			self::$sections_to_remove[] = $id;
223
+			self::$sections_to_remove[ ] = $id;
224 224
 		}
225 225
 	}
226 226
 
@@ -238,16 +238,16 @@  discard block
 block discarded – undo
238 238
 		}
239 239
 
240 240
 		// Early exit if 'type' is not defined.
241
-		if ( ! isset( $args['type'] ) ) {
241
+		if ( ! isset( $args[ 'type' ] ) ) {
242 242
 			return;
243 243
 		}
244 244
 
245 245
 		// If the field is font-awesome, enqueue the icons on the frontend.
246
-		if ( class_exists( 'Kirki_Modules_CSS' ) && ( 'fontawesome' === $args['type'] || 'kirki-fontawesome' === $args['type'] ) ) {
246
+		if ( class_exists( 'Kirki_Modules_CSS' ) && ( 'fontawesome' === $args[ 'type' ] || 'kirki-fontawesome' === $args[ 'type' ] ) ) {
247 247
 			Kirki_Modules_CSS::add_fontawesome_script();
248 248
 		}
249 249
 
250
-		$str       = str_replace( array( '-', '_' ), ' ', $args['type'] );
250
+		$str       = str_replace( array( '-', '_' ), ' ', $args[ 'type' ] );
251 251
 		$classname = 'Kirki_Field_' . str_replace( ' ', '_', ucwords( $str ) );
252 252
 		if ( class_exists( $classname ) ) {
253 253
 			new $classname( $config_id, $args );
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 	 */
274 274
 	public static function remove_control( $id ) {
275 275
 		if ( ! in_array( $id, self::$controls_to_remove, true ) ) {
276
-			self::$controls_to_remove[] = $id;
276
+			self::$controls_to_remove[ ] = $id;
277 277
 		}
278 278
 	}
279 279
 
Please login to merge, or discard this patch.
core/class-kirki-l10n.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -110,7 +110,7 @@
 block discarded – undo
110 110
 	public function override_load_textdomain( $override, $domain, $mofile ) {
111 111
 		global $l10n;
112 112
 		if ( isset( $l10n[ $this->get_theme_textdomain() ] ) ) {
113
-			$l10n['kirki'] = $l10n[ $this->get_theme_textdomain() ]; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.OverrideProhibited
113
+			$l10n[ 'kirki' ] = $l10n[ $this->get_theme_textdomain() ]; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.OverrideProhibited
114 114
 		}
115 115
 
116 116
 		// Check if the domain is "kirki".
Please login to merge, or discard this patch.
core/class-kirki-modules.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -99,7 +99,7 @@
 block discarded – undo
99 99
 	 */
100 100
 	public static function add_module( $module ) {
101 101
 		if ( ! in_array( $module, self::$modules, true ) ) {
102
-			self::$modules[] = $module;
102
+			self::$modules[ ] = $module;
103 103
 		}
104 104
 	}
105 105
 
Please login to merge, or discard this patch.
core/class-kirki-control.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -68,8 +68,8 @@  discard block
 block discarded – undo
68 68
 		$class_name = 'WP_Customize_Control';
69 69
 
70 70
 		// Get the classname from the array of control classnames.
71
-		if ( array_key_exists( $args['type'], self::$control_types ) ) {
72
-			$class_name = self::$control_types[ $args['type'] ];
71
+		if ( array_key_exists( $args[ 'type' ], self::$control_types ) ) {
72
+			$class_name = self::$control_types[ $args[ 'type' ] ];
73 73
 		}
74 74
 		return $class_name;
75 75
 	}
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 		$class_name = $this->get_control_class_name( $args );
87 87
 
88 88
 		// Add the control.
89
-		$this->wp_customize->add_control( new $class_name( $this->wp_customize, $args['settings'], $args ) );
89
+		$this->wp_customize->add_control( new $class_name( $this->wp_customize, $args[ 'settings' ], $args ) );
90 90
 
91 91
 	}
92 92
 
Please login to merge, or discard this patch.
core/class-kirki-util.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 		$plugins = get_plugins();
44 44
 		$_plugin = '';
45 45
 		foreach ( $plugins as $plugin => $args ) {
46
-			if ( ! $is_plugin && isset( $args['Name'] ) && ( 'Kirki' === $args['Name'] || 'Kirki Toolkit' === $args['Name'] ) ) {
46
+			if ( ! $is_plugin && isset( $args[ 'Name' ] ) && ( 'Kirki' === $args[ 'Name' ] || 'Kirki Toolkit' === $args[ 'Name' ] ) ) {
47 47
 				$is_plugin = true;
48 48
 				$_plugin   = $plugin;
49 49
 			}
@@ -80,23 +80,23 @@  discard block
 block discarded – undo
80 80
 		foreach ( Kirki::$fields as $field ) {
81 81
 
82 82
 			// Check if we have variables for this field.
83
-			if ( isset( $field['variables'] ) && $field['variables'] && ! empty( $field['variables'] ) ) {
83
+			if ( isset( $field[ 'variables' ] ) && $field[ 'variables' ] && ! empty( $field[ 'variables' ] ) ) {
84 84
 
85 85
 				// Loop through the array of variables.
86
-				foreach ( $field['variables'] as $field_variable ) {
86
+				foreach ( $field[ 'variables' ] as $field_variable ) {
87 87
 
88 88
 					// Is the variable ['name'] defined? If yes, then we can proceed.
89
-					if ( isset( $field_variable['name'] ) ) {
89
+					if ( isset( $field_variable[ 'name' ] ) ) {
90 90
 
91 91
 						// Do we have a callback function defined? If not then set $variable_callback to false.
92
-						$variable_callback = ( isset( $field_variable['callback'] ) && is_callable( $field_variable['callback'] ) ) ? $field_variable['callback'] : false;
92
+						$variable_callback = ( isset( $field_variable[ 'callback' ] ) && is_callable( $field_variable[ 'callback' ] ) ) ? $field_variable[ 'callback' ] : false;
93 93
 
94 94
 						// If we have a variable_callback defined then get the value of the option
95 95
 						// and run it through the callback function.
96 96
 						// If no callback is defined (false) then just get the value.
97
-						$variables[ $field_variable['name'] ] = Kirki_Values::get_value( $field['settings'] );
97
+						$variables[ $field_variable[ 'name' ] ] = Kirki_Values::get_value( $field[ 'settings' ] );
98 98
 						if ( $variable_callback ) {
99
-							$variables[ $field_variable['name'] ] = call_user_func( $field_variable['callback'], Kirki_Values::get_value( $field['settings'] ) );
99
+							$variables[ $field_variable[ 'name' ] ] = call_user_func( $field_variable[ 'callback' ], Kirki_Values::get_value( $field[ 'settings' ] ) );
100 100
 						}
101 101
 					}
102 102
 				}
@@ -123,31 +123,31 @@  discard block
 block discarded – undo
123 123
 		if (
124 124
 			self::is_plugin() ||
125 125
 			false === strpos( $url, 'wordpress.org' ) || (
126
-				! isset( $request['body'] ) ||
127
-				! isset( $request['body']['plugins'] ) ||
128
-				! isset( $request['body']['translations'] ) ||
129
-				! isset( $request['body']['locale'] ) ||
130
-				! isset( $request['body']['all'] )
126
+				! isset( $request[ 'body' ] ) ||
127
+				! isset( $request[ 'body' ][ 'plugins' ] ) ||
128
+				! isset( $request[ 'body' ][ 'translations' ] ) ||
129
+				! isset( $request[ 'body' ][ 'locale' ] ) ||
130
+				! isset( $request[ 'body' ][ 'all' ] )
131 131
 			)
132 132
 		) {
133 133
 			return $request;
134 134
 		}
135 135
 
136
-		$plugins = json_decode( $request['body']['plugins'], true );
137
-		if ( ! isset( $plugins['plugins'] ) ) {
136
+		$plugins = json_decode( $request[ 'body' ][ 'plugins' ], true );
137
+		if ( ! isset( $plugins[ 'plugins' ] ) ) {
138 138
 			return $request;
139 139
 		}
140 140
 		$exists = false;
141
-		foreach ( $plugins['plugins'] as $plugin ) {
142
-			if ( isset( $plugin['Name'] ) && 'Kirki Toolkit' === $plugin['Name'] ) {
141
+		foreach ( $plugins[ 'plugins' ] as $plugin ) {
142
+			if ( isset( $plugin[ 'Name' ] ) && 'Kirki Toolkit' === $plugin[ 'Name' ] ) {
143 143
 				$exists = true;
144 144
 			}
145 145
 		}
146 146
 		// Inject data.
147 147
 		if ( ! $exists && defined( 'KIRKI_PLUGIN_FILE' ) ) {
148
-			$plugins['plugins']['kirki/kirki.php'] = get_plugin_data( KIRKI_PLUGIN_FILE );
148
+			$plugins[ 'plugins' ][ 'kirki/kirki.php' ] = get_plugin_data( KIRKI_PLUGIN_FILE );
149 149
 		}
150
-		$request['body']['plugins'] = wp_json_encode( $plugins );
150
+		$request[ 'body' ][ 'plugins' ] = wp_json_encode( $plugins );
151 151
 		return $request;
152 152
 	}
153 153
 
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 		// We only need the major version.
168 168
 		if ( 'major' === $context ) {
169 169
 			$version_parts = explode( '.', $wp_version );
170
-			return $version_parts[0];
170
+			return $version_parts[ 0 ];
171 171
 		}
172 172
 
173 173
 		return $wp_version;
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 		// We only need the major version.
191 191
 		if ( 'major' === $context ) {
192 192
 			$version_parts = explode( '.', $wp_version );
193
-			return absint( $version_parts[0] );
193
+			return absint( $version_parts[ 0 ] );
194 194
 		}
195 195
 
196 196
 		// If we got this far, we want the full monty.
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 		if ( false !== strpos( $wp_version, '-' ) ) {
199 199
 			// We're on a dev version.
200 200
 			$version_parts = explode( '-', $wp_version );
201
-			return floatval( $version_parts[0] );
201
+			return floatval( $version_parts[ 0 ] );
202 202
 		}
203 203
 		return floatval( $wp_version );
204 204
 	}
Please login to merge, or discard this patch.
field/class-kirki-field-url.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,8 +23,8 @@
 block discarded – undo
23 23
 		if ( ! is_array( $this->choices ) ) {
24 24
 			$this->choices = array();
25 25
 		}
26
-		$this->choices['element'] = 'input';
27
-		$this->choices['type']    = 'text';
26
+		$this->choices[ 'element' ] = 'input';
27
+		$this->choices[ 'type' ]    = 'text';
28 28
 	}
29 29
 
30 30
 	/**
Please login to merge, or discard this patch.
modules/gutenberg/class-kirki-modules-gutenberg.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 		$styles = $this->get_styles();
169 169
 
170 170
 		if ( ! empty( $styles ) ) {
171
-			$settings['styles'][] = array( 'css' => $styles );
171
+			$settings[ 'styles' ][ ] = array( 'css' => $styles );
172 172
 		}
173 173
 
174 174
 		return $settings;
@@ -220,11 +220,11 @@  discard block
 block discarded – undo
220 220
 		}
221 221
 
222 222
 		if ( ! empty( $args ) ) {
223
-			if ( isset( $args['disable_output'] ) && true === $args['disable_output'] ) {
223
+			if ( isset( $args[ 'disable_output' ] ) && true === $args[ 'disable_output' ] ) {
224 224
 				return true;
225 225
 			}
226 226
 
227
-			if ( ! isset( $args['gutenberg_support'] ) || true !== $args['gutenberg_support'] ) {
227
+			if ( ! isset( $args[ 'gutenberg_support' ] ) || true !== $args[ 'gutenberg_support' ] ) {
228 228
 				return true;
229 229
 			}
230 230
 		}
Please login to merge, or discard this patch.
modules/css-vars/class-kirki-modules-css-vars.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -86,15 +86,15 @@  discard block
 block discarded – undo
86 86
 		// Get an array of all fields.
87 87
 		$fields = Kirki::$fields;
88 88
 		foreach ( $fields as $id => $args ) {
89
-			if ( ! isset( $args['css_vars'] ) || empty( $args['css_vars'] ) ) {
89
+			if ( ! isset( $args[ 'css_vars' ] ) || empty( $args[ 'css_vars' ] ) ) {
90 90
 				continue;
91 91
 			}
92
-			$val = Kirki_Values::get_value( $args['kirki_config'], $id );
93
-			foreach ( $args['css_vars'] as $css_var ) {
94
-				if ( isset( $css_var[2] ) && is_array( $val ) && isset( $val[ $css_var[2] ] ) ) {
95
-					$this->vars[ $css_var[0] ] = str_replace( '$', $val[ $css_var[2] ], $css_var[1] );
92
+			$val = Kirki_Values::get_value( $args[ 'kirki_config' ], $id );
93
+			foreach ( $args[ 'css_vars' ] as $css_var ) {
94
+				if ( isset( $css_var[ 2 ] ) && is_array( $val ) && isset( $val[ $css_var[ 2 ] ] ) ) {
95
+					$this->vars[ $css_var[ 0 ] ] = str_replace( '$', $val[ $css_var[ 2 ] ], $css_var[ 1 ] );
96 96
 				} else {
97
-					$this->vars[ $css_var[0] ] = str_replace( '$', $val, $css_var[1] );
97
+					$this->vars[ $css_var[ 0 ] ] = str_replace( '$', $val, $css_var[ 1 ] );
98 98
 				}
99 99
 			}
100 100
 		}
@@ -147,8 +147,8 @@  discard block
 block discarded – undo
147 147
 		$fields = Kirki::$fields;
148 148
 		$data   = array();
149 149
 		foreach ( $fields as $field ) {
150
-			if ( isset( $field['transport'] ) && 'postMessage' === $field['transport'] && isset( $field['css_vars'] ) && ! empty( $field['css_vars'] ) ) {
151
-				$data[] = $field;
150
+			if ( isset( $field[ 'transport' ] ) && 'postMessage' === $field[ 'transport' ] && isset( $field[ 'css_vars' ] ) && ! empty( $field[ 'css_vars' ] ) ) {
151
+				$data[ ] = $field;
152 152
 			}
153 153
 		}
154 154
 		wp_localize_script( 'kirki_auto_css_vars', 'kirkiCssVarFields', $data );
Please login to merge, or discard this patch.