Completed
Push — develop ( 87ee00...da5642 )
by Aristeides
16:37 queued 10:32
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/postmessage/class-kirki-modules-postmessage.php 1 patch
Spacing   +88 added lines, -88 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 		wp_enqueue_script( 'kirki_auto_postmessage', trailingslashit( Kirki::$url ) . 'modules/postmessage/postmessage.js', array( 'jquery', 'customize-preview' ), KIRKI_VERSION, true );
75 75
 		$fields = Kirki::$fields;
76 76
 		foreach ( $fields as $field ) {
77
-			if ( isset( $field['transport'] ) && 'postMessage' === $field['transport'] && isset( $field['js_vars'] ) && ! empty( $field['js_vars'] ) && is_array( $field['js_vars'] ) && isset( $field['settings'] ) ) {
77
+			if ( isset( $field[ 'transport' ] ) && 'postMessage' === $field[ 'transport' ] && isset( $field[ 'js_vars' ] ) && ! empty( $field[ 'js_vars' ] ) && is_array( $field[ 'js_vars' ] ) && isset( $field[ 'settings' ] ) ) {
78 78
 				$this->script .= $this->script( $field );
79 79
 			}
80 80
 		}
@@ -90,14 +90,14 @@  discard block
 block discarded – undo
90 90
 	 * @param array $args The arguments.
91 91
 	 */
92 92
 	protected function script( $args ) {
93
-		$script = 'wp.customize(\'' . $args['settings'] . '\',function(value){value.bind(function(newval){';
93
+		$script = 'wp.customize(\'' . $args[ 'settings' ] . '\',function(value){value.bind(function(newval){';
94 94
 
95 95
 		$add_css = false;
96
-		foreach ( $args['js_vars'] as $js_var ) {
97
-			if ( ! isset( $js_var['function'] ) || 'html' !== $js_var['function'] ) {
96
+		foreach ( $args[ 'js_vars' ] as $js_var ) {
97
+			if ( ! isset( $js_var[ 'function' ] ) || 'html' !== $js_var[ 'function' ] ) {
98 98
 				$add_css = true;
99 99
 			}
100
-			if ( isset( $js_var['context'] ) && ! in_array( 'front', $js_var['context'] ) ) {
100
+			if ( isset( $js_var[ 'context' ] ) && ! in_array( 'front', $js_var[ 'context' ] ) ) {
101 101
 				$add_css = false;
102 102
 			}
103 103
 		}
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 
107 107
 			// append unique style tag if not exist
108 108
 			// The style ID.
109
-			$style_id = 'kirki-postmessage-' . str_replace( array( '[', ']' ), '', $args['settings'] );
109
+			$style_id = 'kirki-postmessage-' . str_replace( array( '[', ']' ), '', $args[ 'settings' ] );
110 110
 			$script  .= 'if(null===document.getElementById(\'' . $style_id . '\')||\'undefined\'===typeof document.getElementById(\'' . $style_id . '\')){jQuery(\'head\').append(\'<style id="' . $style_id . '"></style>\');}';
111 111
 		}
112 112
 
@@ -118,48 +118,48 @@  discard block
 block discarded – undo
118 118
 		);
119 119
 
120 120
 		// Loop through the js_vars and generate the script.
121
-		foreach ( $args['js_vars'] as $key => $js_var ) {
121
+		foreach ( $args[ 'js_vars' ] as $key => $js_var ) {
122 122
 
123 123
 			// Skip styles if "exclude" is defined and value is excluded.
124
-			if ( isset( $js_var['exclude'] ) ) {
125
-				$js_var['exclude'] = (array) $js_var['exclude'];
124
+			if ( isset( $js_var[ 'exclude' ] ) ) {
125
+				$js_var[ 'exclude' ] = (array) $js_var[ 'exclude' ];
126 126
 				$script           .= 'exclude=false;';
127
-				foreach ( $js_var['exclude'] as $exclussion ) {
127
+				foreach ( $js_var[ 'exclude' ] as $exclussion ) {
128 128
 					$script .= "if(newval=='{$exclussion}'||(''==='{$exclussion}'&&_.isObject(newval)&&_.isEmpty(newval))){exclude=true;}";
129 129
 				}
130 130
 			}
131
-			if ( isset( $js_var['element'] ) ) {
131
+			if ( isset( $js_var[ 'element' ] ) ) {
132 132
 
133 133
 				// Array to string.
134
-				if ( is_array( $js_var['element'] ) ) {
135
-					$js_var['element'] = implode( ',', $js_var['element'] );
134
+				if ( is_array( $js_var[ 'element' ] ) ) {
135
+					$js_var[ 'element' ] = implode( ',', $js_var[ 'element' ] );
136 136
 				}
137 137
 
138 138
 				// Replace single quotes with double quotes to avoid issues with the compiled JS.
139
-				$js_var['element'] = str_replace( '\'', '"', $js_var['element'] );
139
+				$js_var[ 'element' ] = str_replace( '\'', '"', $js_var[ 'element' ] );
140 140
 			}
141
-			if ( isset( $js_var['function'] ) && 'html' === $js_var['function'] ) {
141
+			if ( isset( $js_var[ 'function' ] ) && 'html' === $js_var[ 'function' ] ) {
142 142
 				$script .= $this->script_html_var( $js_var );
143 143
 				continue;
144 144
 			}
145
-			$js_var['index_key'] = $key;
145
+			$js_var[ 'index_key' ] = $key;
146 146
 			$callback            = $this->get_callback( $args );
147 147
 			if ( is_callable( $callback ) ) {
148
-				$field['scripts'][ $key ] = call_user_func_array( $callback, array( $js_var, $args ) );
148
+				$field[ 'scripts' ][ $key ] = call_user_func_array( $callback, array( $js_var, $args ) );
149 149
 				continue;
150 150
 			}
151
-			$field['scripts'][ $key ] = $this->script_var( $js_var );
151
+			$field[ 'scripts' ][ $key ] = $this->script_var( $js_var );
152 152
 		}
153 153
 		$combo_extra_script = '';
154 154
 		$combo_css_script   = '';
155
-		foreach ( $field['scripts'] as $script_array ) {
156
-			$combo_extra_script .= $script_array['script'];
157
-			$combo_css_script   .= ( 'css' !== $combo_css_script ) ? $script_array['css'] : '';
155
+		foreach ( $field[ 'scripts' ] as $script_array ) {
156
+			$combo_extra_script .= $script_array[ 'script' ];
157
+			$combo_css_script   .= ( 'css' !== $combo_css_script ) ? $script_array[ 'css' ] : '';
158 158
 		}
159 159
 		$text = ( 'css' === $combo_css_script ) ? 'css' : '\'' . $combo_css_script . '\'';
160 160
 
161 161
 		$script .= $combo_extra_script . "var cssContent={$text};";
162
-		if ( isset( $js_var['exclude'] ) ) {
162
+		if ( isset( $js_var[ 'exclude' ] ) ) {
163 163
 			$script .= 'if(true===exclude){cssContent="";}';
164 164
 		}
165 165
 		if ( $add_css ) {
@@ -177,18 +177,18 @@  discard block
 block discarded – undo
177 177
 	 * @param array $args  The arguments for this js_var.
178 178
 	 */
179 179
 	protected function script_html_var( $args ) {
180
-		$script = ( isset( $args['choice'] ) ) ? "newval=newval['{$args['choice']}'];" : '';
180
+		$script = ( isset( $args[ 'choice' ] ) ) ? "newval=newval['{$args[ 'choice' ]}'];" : '';
181 181
 
182 182
 		// Apply the value_pattern.
183
-		if ( isset( $args['value_pattern'] ) && '' !== $args['value_pattern'] ) {
183
+		if ( isset( $args[ 'value_pattern' ] ) && '' !== $args[ 'value_pattern' ] ) {
184 184
 			$script .= $this->value_pattern_replacements( 'newval', $args );
185 185
 		}
186 186
 
187
-		if ( isset( $args['attr'] ) ) {
188
-			$script .= "jQuery('{$args['element']}').attr('{$args['attr']}',newval);";
187
+		if ( isset( $args[ 'attr' ] ) ) {
188
+			$script .= "jQuery('{$args[ 'element' ]}').attr('{$args[ 'attr' ]}',newval);";
189 189
 			return $script;
190 190
 		}
191
-		$script .= "jQuery('{$args['element']}').html(newval);";
191
+		$script .= "jQuery('{$args[ 'element' ]}').html(newval);";
192 192
 		return $script;
193 193
 	}
194 194
 
@@ -203,34 +203,34 @@  discard block
 block discarded – undo
203 203
 		$script          = '';
204 204
 		$property_script = '';
205 205
 
206
-		$value_key        = 'newval' . $args['index_key'];
206
+		$value_key        = 'newval' . $args[ 'index_key' ];
207 207
 		$property_script .= $value_key . '=newval;';
208 208
 
209 209
 		$args = $this->get_args( $args );
210 210
 
211 211
 		// Apply callback to the value if a callback is defined.
212
-		if ( ! empty( $args['js_callback'] ) && is_array( $args['js_callback'] ) && isset( $args['js_callback'][0] ) && ! empty( $args['js_callback'][0] ) ) {
213
-			$script .= $value_key . '=' . $args['js_callback'][0] . '(' . $value_key . ',' . $args['js_callback'][1] . ');';
212
+		if ( ! empty( $args[ 'js_callback' ] ) && is_array( $args[ 'js_callback' ] ) && isset( $args[ 'js_callback' ][ 0 ] ) && ! empty( $args[ 'js_callback' ][ 0 ] ) ) {
213
+			$script .= $value_key . '=' . $args[ 'js_callback' ][ 0 ] . '(' . $value_key . ',' . $args[ 'js_callback' ][ 1 ] . ');';
214 214
 		}
215 215
 
216 216
 		// Apply the value_pattern.
217
-		if ( '' !== $args['value_pattern'] ) {
217
+		if ( '' !== $args[ 'value_pattern' ] ) {
218 218
 			$script .= $this->value_pattern_replacements( $value_key, $args );
219 219
 		}
220 220
 
221 221
 		// Tweak to add url() for background-images.
222
-		if ( 'background-image' === $args['property'] && ( ! isset( $args['value_pattern'] ) || false === strpos( $args['value_pattern'], 'gradient' ) ) ) {
222
+		if ( 'background-image' === $args[ 'property' ] && ( ! isset( $args[ 'value_pattern' ] ) || false === strpos( $args[ 'value_pattern' ], 'gradient' ) ) ) {
223 223
 			$script .= 'if(-1===' . $value_key . '.indexOf(\'url(\')){' . $value_key . '=\'url("\'+' . $value_key . '+\'")\';}';
224 224
 		}
225 225
 
226 226
 		// Apply prefix.
227 227
 		$value = $value_key;
228
-		if ( '' !== $args['prefix'] ) {
229
-			$value = "'" . $args['prefix'] . "'+" . $value_key;
228
+		if ( '' !== $args[ 'prefix' ] ) {
229
+			$value = "'" . $args[ 'prefix' ] . "'+" . $value_key;
230 230
 		}
231
-		$css = $args['element'] . '{' . $args['property'] . ':\'+' . $value . '+\'' . $args['units'] . $args['suffix'] . ';}';
232
-		if ( isset( $args['media_query'] ) ) {
233
-			$css = $args['media_query'] . '{' . $css . '}';
231
+		$css = $args[ 'element' ] . '{' . $args[ 'property' ] . ':\'+' . $value . '+\'' . $args[ 'units' ] . $args[ 'suffix' ] . ';}';
232
+		if ( isset( $args[ 'media_query' ] ) ) {
233
+			$css = $args[ 'media_query' ] . '{' . $css . '}';
234 234
 		}
235 235
 		return array(
236 236
 			'script' => $property_script . $script,
@@ -246,42 +246,42 @@  discard block
 block discarded – undo
246 246
 	 * @param array $args  The arguments for this js_var.
247 247
 	 */
248 248
 	protected function script_var_array( $args ) {
249
-		$script          = ( 0 === $args['index_key'] ) ? 'css=\'\';' : '';
249
+		$script          = ( 0 === $args[ 'index_key' ] ) ? 'css=\'\';' : '';
250 250
 		$property_script = '';
251 251
 
252 252
 		// Define choice.
253
-		$choice = ( isset( $args['choice'] ) && '' !== $args['choice'] ) ? $args['choice'] : '';
253
+		$choice = ( isset( $args[ 'choice' ] ) && '' !== $args[ 'choice' ] ) ? $args[ 'choice' ] : '';
254 254
 
255
-		$value_key        = 'newval' . $args['index_key'];
255
+		$value_key        = 'newval' . $args[ 'index_key' ];
256 256
 		$property_script .= $value_key . '=newval;';
257 257
 
258 258
 		$args = $this->get_args( $args );
259 259
 
260 260
 		// Apply callback to the value if a callback is defined.
261
-		if ( ! empty( $args['js_callback'] ) && is_array( $args['js_callback'] ) && isset( $args['js_callback'][0] ) && ! empty( $args['js_callback'][0] ) ) {
262
-			$script .= $value_key . '=' . $args['js_callback'][0] . '(' . $value_key . ',' . $args['js_callback'][1] . ');';
261
+		if ( ! empty( $args[ 'js_callback' ] ) && is_array( $args[ 'js_callback' ] ) && isset( $args[ 'js_callback' ][ 0 ] ) && ! empty( $args[ 'js_callback' ][ 0 ] ) ) {
262
+			$script .= $value_key . '=' . $args[ 'js_callback' ][ 0 ] . '(' . $value_key . ',' . $args[ 'js_callback' ][ 1 ] . ');';
263 263
 		}
264 264
 		$script .= '_.each(' . $value_key . ', function(subValue,subKey){';
265 265
 
266 266
 		// Apply the value_pattern.
267
-		if ( '' !== $args['value_pattern'] ) {
267
+		if ( '' !== $args[ 'value_pattern' ] ) {
268 268
 			$script .= $this->value_pattern_replacements( 'subValue', $args );
269 269
 		}
270 270
 
271 271
 		// Tweak to add url() for background-images.
272 272
 		if ( '' === $choice || 'background-image' === $choice ) {
273
-			$script .= 'if(\'background-image\'===\'' . $args['property'] . '\'||\'background-image\'===subKey){if(-1===subValue.indexOf(\'url(\')){subValue=\'url("\'+subValue+\'")\';}}';
273
+			$script .= 'if(\'background-image\'===\'' . $args[ 'property' ] . '\'||\'background-image\'===subKey){if(-1===subValue.indexOf(\'url(\')){subValue=\'url("\'+subValue+\'")\';}}';
274 274
 		}
275 275
 
276 276
 		// Apply prefix.
277 277
 		$value = $value_key;
278
-		if ( '' !== $args['prefix'] ) {
279
-			$value = '\'' . $args['prefix'] . '\'+subValue';
278
+		if ( '' !== $args[ 'prefix' ] ) {
279
+			$value = '\'' . $args[ 'prefix' ] . '\'+subValue';
280 280
 		}
281 281
 
282 282
 		// Mostly used for padding, margin & position properties.
283 283
 		$direction_script  = 'if(_.contains([\'top\',\'bottom\',\'left\',\'right\'],subKey)){';
284
-		$direction_script .= 'css+=\'' . $args['element'] . '{' . $args['property'] . '-\'+subKey+\':\'+subValue+\'' . $args['units'] . $args['suffix'] . ';}\';}';
284
+		$direction_script .= 'css+=\'' . $args[ 'element' ] . '{' . $args[ 'property' ] . '-\'+subKey+\':\'+subValue+\'' . $args[ 'units' ] . $args[ 'suffix' ] . ';}\';}';
285 285
 
286 286
 		// Allows us to apply this just for a specific choice in the array of the values.
287 287
 		if ( '' !== $choice ) {
@@ -290,18 +290,18 @@  discard block
 block discarded – undo
290 290
 			// The script.
291 291
 			$script .= 'if(\'' . $choice . '\'===subKey){';
292 292
 			$script .= ( $choice_is_direction ) ? $direction_script . 'else{' : '';
293
-			$script .= 'css+=\'' . $args['element'] . '{' . $args['property'] . ':\'+subValue+\';}\';';
293
+			$script .= 'css+=\'' . $args[ 'element' ] . '{' . $args[ 'property' ] . ':\'+subValue+\';}\';';
294 294
 			$script .= ( $choice_is_direction ) ? '}' : '';
295 295
 			$script .= '}';
296 296
 		} else {
297 297
 
298 298
 			// This is where most object-based fields will go.
299
-			$script .= $direction_script . 'else{css+=\'' . $args['element'] . '{\'+subKey+\':\'+subValue+\'' . $args['units'] . $args['suffix'] . ';}\';}';
299
+			$script .= $direction_script . 'else{css+=\'' . $args[ 'element' ] . '{\'+subKey+\':\'+subValue+\'' . $args[ 'units' ] . $args[ 'suffix' ] . ';}\';}';
300 300
 		}
301 301
 		$script .= '});';
302 302
 
303
-		if ( isset( $args['media_query'] ) ) {
304
-			$script .= 'css=\'' . $args['media_query'] . '{\'+css+\'}\';';
303
+		if ( isset( $args[ 'media_query' ] ) ) {
304
+			$script .= 'css=\'' . $args[ 'media_query' ] . '{\'+css+\'}\';';
305 305
 		}
306 306
 
307 307
 		return array(
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
 		$webfont_loader = 'sc=\'a\';jQuery(\'head\').append(sc.replace(\'a\',\'<\')+\'script>if(!_.isUndefined(WebFont)&&fontFamily){WebFont.load({google:{families:["\'+fontFamily.replace( /\"/g, \'&quot;\' )+\':\'+variant+\'cyrillic,cyrillic-ext,devanagari,greek,greek-ext,khmer,latin,latin-ext,vietnamese,hebrew,arabic,bengali,gujarati,tamil,telugu,thai"]}});}\'+sc.replace(\'a\',\'<\')+\'/script>\');';
330 330
 
331 331
 		// Add the css.
332
-		$css_build_array  = array(
332
+		$css_build_array = array(
333 333
 			'font-family'     => 'fontFamily',
334 334
 			'font-size'       => 'fontSize',
335 335
 			'line-height'     => 'lineHeight',
@@ -342,41 +342,41 @@  discard block
 block discarded – undo
342 342
 			'font-weight'     => 'fontWeight',
343 343
 			'font-style'      => 'fontStyle',
344 344
 		);
345
-		$choice_condition = ( isset( $args['choice'] ) && '' !== $args['choice'] && isset( $css_build_array[ $args['choice'] ] ) );
345
+		$choice_condition = ( isset( $args[ 'choice' ] ) && '' !== $args[ 'choice' ] && isset( $css_build_array[ $args[ 'choice' ] ] ) );
346 346
 		$script          .= ( ! $choice_condition ) ? $webfont_loader : '';
347 347
 		foreach ( $css_build_array as $property => $var ) {
348
-			if ( $choice_condition && $property !== $args['choice'] ) {
348
+			if ( $choice_condition && $property !== $args[ 'choice' ] ) {
349 349
 				continue;
350 350
 			}
351 351
 			// Fixes https://github.com/aristath/kirki/issues/1436.
352
-			if ( ! isset( $field['default'] ) || (
353
-				( 'font-family' === $property && ! isset( $field['default']['font-family'] ) ) ||
354
-				( 'font-size' === $property && ! isset( $field['default']['font-size'] ) ) ||
355
-				( 'line-height' === $property && ! isset( $field['default']['line-height'] ) ) ||
356
-				( 'letter-spacing' === $property && ! isset( $field['default']['letter-spacing'] ) ) ||
357
-				( 'word-spacing' === $property && ! isset( $field['default']['word-spacing'] ) ) ||
358
-				( 'text-align' === $property && ! isset( $field['default']['text-align'] ) ) ||
359
-				( 'text-transform' === $property && ! isset( $field['default']['text-transform'] ) ) ||
360
-				( 'text-decoration' === $property && ! isset( $field['default']['text-decoration'] ) ) ||
361
-				( 'color' === $property && ! isset( $field['default']['color'] ) ) ||
362
-				( 'font-weight' === $property && ! isset( $field['default']['variant'] ) && ! isset( $field['default']['font-weight'] ) ) ||
363
-				( 'font-style' === $property && ! isset( $field['default']['variant'] ) && ! isset( $field['default']['font-style'] ) )
352
+			if ( ! isset( $field[ 'default' ] ) || (
353
+				( 'font-family' === $property && ! isset( $field[ 'default' ][ 'font-family' ] ) ) ||
354
+				( 'font-size' === $property && ! isset( $field[ 'default' ][ 'font-size' ] ) ) ||
355
+				( 'line-height' === $property && ! isset( $field[ 'default' ][ 'line-height' ] ) ) ||
356
+				( 'letter-spacing' === $property && ! isset( $field[ 'default' ][ 'letter-spacing' ] ) ) ||
357
+				( 'word-spacing' === $property && ! isset( $field[ 'default' ][ 'word-spacing' ] ) ) ||
358
+				( 'text-align' === $property && ! isset( $field[ 'default' ][ 'text-align' ] ) ) ||
359
+				( 'text-transform' === $property && ! isset( $field[ 'default' ][ 'text-transform' ] ) ) ||
360
+				( 'text-decoration' === $property && ! isset( $field[ 'default' ][ 'text-decoration' ] ) ) ||
361
+				( 'color' === $property && ! isset( $field[ 'default' ][ 'color' ] ) ) ||
362
+				( 'font-weight' === $property && ! isset( $field[ 'default' ][ 'variant' ] ) && ! isset( $field[ 'default' ][ 'font-weight' ] ) ) ||
363
+				( 'font-style' === $property && ! isset( $field[ 'default' ][ 'variant' ] ) && ! isset( $field[ 'default' ][ 'font-style' ] ) )
364 364
 				) ) {
365 365
 				continue;
366 366
 			}
367
-			$script .= ( $choice_condition && 'font-family' === $args['choice'] ) ? $webfont_loader : '';
367
+			$script .= ( $choice_condition && 'font-family' === $args[ 'choice' ] ) ? $webfont_loader : '';
368 368
 
369
-			if ( 'font-family' === $property || ( isset( $args['choice'] ) && 'font-family' === $args['choice'] ) ) {
369
+			if ( 'font-family' === $property || ( isset( $args[ 'choice' ] ) && 'font-family' === $args[ 'choice' ] ) ) {
370 370
 				$css .= 'fontFamilyCSS=fontFamily;if(0<fontFamily.indexOf(\' \')&&-1===fontFamily.indexOf(\'"\')){fontFamilyCSS=\'"\'+fontFamily+\'"\';}';
371 371
 				$var  = 'fontFamilyCSS';
372 372
 			}
373
-			$var  = ( ( empty( $args['prefix'] ) ) ? '' : '\'' . $args['prefix'] . '\'+' ) . $var . ( ( empty( $args['units'] ) ) ? '' : '+\'' . $args['units'] . '\'' ) . ( ( empty( $args['suffix'] ) ) ? '' : '+\'' . $args['suffix'] . '\'' );
374
-			$css .= 'css+=(\'\'!==' . $var . ')?\'' . $args['element'] . '\'+\'{' . $property . ':\'+' . $var . '+\';}\':\'\';';
373
+			$var  = ( ( empty( $args[ 'prefix' ] ) ) ? '' : '\'' . $args[ 'prefix' ] . '\'+' ) . $var . ( ( empty( $args[ 'units' ] ) ) ? '' : '+\'' . $args[ 'units' ] . '\'' ) . ( ( empty( $args[ 'suffix' ] ) ) ? '' : '+\'' . $args[ 'suffix' ] . '\'' );
374
+			$css .= 'css+=(\'\'!==' . $var . ')?\'' . $args[ 'element' ] . '\'+\'{' . $property . ':\'+' . $var . '+\';}\':\'\';';
375 375
 		}
376 376
 
377 377
 		$script .= $css;
378
-		if ( isset( $args['media_query'] ) ) {
379
-			$script .= 'css=\'' . $args['media_query'] . '{\'+css+\'}\';';
378
+		if ( isset( $args[ 'media_query' ] ) ) {
379
+			$script .= 'css=\'' . $args[ 'media_query' ] . '{\'+css+\'}\';';
380 380
 		}
381 381
 		return array(
382 382
 			'script' => $script,
@@ -394,8 +394,8 @@  discard block
 block discarded – undo
394 394
 	protected function script_var_image( $args ) {
395 395
 		$return = $this->script_var( $args );
396 396
 		return array(
397
-			'script' => 'newval=(!_.isUndefined(newval.url))?newval.url:newval;' . $return['script'],
398
-			'css'    => $return['css'],
397
+			'script' => 'newval=(!_.isUndefined(newval.url))?newval.url:newval;' . $return[ 'script' ],
398
+			'css'    => $return[ 'css' ],
399 399
 		);
400 400
 	}
401 401
 
@@ -409,8 +409,8 @@  discard block
 block discarded – undo
409 409
 	 */
410 410
 	private function before_script( $args ) {
411 411
 		$script = '';
412
-		if ( isset( $args['type'] ) ) {
413
-			switch ( $args['type'] ) {
412
+		if ( isset( $args[ 'type' ] ) ) {
413
+			switch ( $args[ 'type' ] ) {
414 414
 				case 'kirki-typography':
415 415
 					$script .= 'fontFamily=(_.isUndefined(newval[\'font-family\']))?\'\':newval[\'font-family\'];variant=(_.isUndefined(newval.variant))?\'400\':newval.variant;fontSize=(_.isUndefined(newval[\'font-size\']))?\'\':newval[\'font-size\'];lineHeight=(_.isUndefined(newval[\'line-height\']))?\'\':newval[\'line-height\'];letterSpacing=(_.isUndefined(newval[\'letter-spacing\']))?\'\':newval[\'letter-spacing\'];wordSpacing=(_.isUndefined(newval[\'word-spacing\']))?\'\':newval[\'word-spacing\'];textAlign=(_.isUndefined(newval[\'text-align\']))?\'\':newval[\'text-align\'];textTransform=(_.isUndefined(newval[\'text-transform\']))?\'\':newval[\'text-transform\'];textDecoration=(_.isUndefined(newval[\'text-decoration\']))?\'\':newval[\'text-decoration\'];color=(_.isUndefined(newval.color))?\'\':newval.color;fw=(!_.isString(newval.variant))?\'400\':newval.variant.match(/\d/g);fontWeight=(!_.isObject(fw))?400:fw.join(\'\');fontStyle=(variant&&-1!==variant.indexOf(\'italic\'))?\'italic\':\'normal\';css=\'\';';
416 416
 					break;
@@ -443,17 +443,17 @@  discard block
 block discarded – undo
443 443
 		);
444 444
 
445 445
 		// Element should be a string.
446
-		if ( is_array( $args['element'] ) ) {
447
-			$args['element'] = implode( ',', $args['element'] );
446
+		if ( is_array( $args[ 'element' ] ) ) {
447
+			$args[ 'element' ] = implode( ',', $args[ 'element' ] );
448 448
 		}
449 449
 
450 450
 		// Make sure arguments that are passed-on to callbacks are strings.
451
-		if ( is_array( $args['js_callback'] ) && isset( $args['js_callback'][1] ) && is_array( $args['js_callback'][1] ) ) {
452
-			$args['js_callback'][1] = wp_json_encode( $args['js_callback'][1] );
451
+		if ( is_array( $args[ 'js_callback' ] ) && isset( $args[ 'js_callback' ][ 1 ] ) && is_array( $args[ 'js_callback' ][ 1 ] ) ) {
452
+			$args[ 'js_callback' ][ 1 ] = wp_json_encode( $args[ 'js_callback' ][ 1 ] );
453 453
 		}
454 454
 
455
-		if ( ! isset( $args['js_callback'][1] ) ) {
456
-			$args['js_callback'][1] = '';
455
+		if ( ! isset( $args[ 'js_callback' ][ 1 ] ) ) {
456
+			$args[ 'js_callback' ][ 1 ] = '';
457 457
 		}
458 458
 		return $args;
459 459
 	}
@@ -470,15 +470,15 @@  discard block
 block discarded – undo
470 470
 	private function value_pattern_replacements( $value, $js_vars ) {
471 471
 		$script = '';
472 472
 		$alias  = $value;
473
-		if ( ! isset( $js_vars['value_pattern'] ) ) {
473
+		if ( ! isset( $js_vars[ 'value_pattern' ] ) ) {
474 474
 			return $value;
475 475
 		}
476
-		$value = $js_vars['value_pattern'];
477
-		if ( isset( $js_vars['pattern_replace'] ) ) {
476
+		$value = $js_vars[ 'value_pattern' ];
477
+		if ( isset( $js_vars[ 'pattern_replace' ] ) ) {
478 478
 			$script .= 'settings=window.wp.customize.get();';
479
-			foreach ( $js_vars['pattern_replace'] as $search => $replace ) {
479
+			foreach ( $js_vars[ 'pattern_replace' ] as $search => $replace ) {
480 480
 				$replace = '\'+settings["' . $replace . '"]+\'';
481
-				$value   = str_replace( $search, $replace, $js_vars['value_pattern'] );
481
+				$value   = str_replace( $search, $replace, $js_vars[ 'value_pattern' ] );
482 482
 				$value   = trim( $value, '+' );
483 483
 			}
484 484
 		}
@@ -497,7 +497,7 @@  discard block
 block discarded – undo
497 497
 	 * @return string|array A callable function or method.
498 498
 	 */
499 499
 	protected function get_callback( $args ) {
500
-		switch ( $args['type'] ) {
500
+		switch ( $args[ 'type' ] ) {
501 501
 			case 'kirki-background':
502 502
 			case 'kirki-dimensions':
503 503
 			case 'kirki-multicolor':
Please login to merge, or discard this patch.