Completed
Branch develop (1becb4)
by Aristeides
05:50 queued 02:46
created
includes/class-kirki-init.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -172,9 +172,9 @@
 block discarded – undo
172 172
 							 * If no callback is defined (false) then just get the value.
173 173
 							 */
174 174
 							if ( $variable_callback ) {
175
-								$variables[ $variable_name ] = call_user_func( $field_variable['callback'], Kirki::get_option( $field['settings'] ) );
175
+								$variables[$variable_name] = call_user_func( $field_variable['callback'], Kirki::get_option( $field['settings'] ) );
176 176
 							} else {
177
-								$variables[ $variable_name ] = Kirki::get_option( $field['settings'] );
177
+								$variables[$variable_name] = Kirki::get_option( $field['settings'] );
178 178
 							}
179 179
 
180 180
 						}
Please login to merge, or discard this patch.
includes/class-kirki-enqueue.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -113,14 +113,14 @@
 block discarded – undo
113 113
 				$available_variants = array();
114 114
 				foreach ( $variants as $variant ) {
115 115
 					if ( array_key_exists( $variant, $all_variants ) ) {
116
-						$available_variants[] = array( 'id' => $variant, 'label' => $all_variants[ $variant ] );
116
+						$available_variants[] = array( 'id' => $variant, 'label' => $all_variants[$variant] );
117 117
 					}
118 118
 				}
119 119
 
120 120
 				$available_subsets = array();
121 121
 				foreach ( $subsets as $subset ) {
122 122
 					if ( array_key_exists( $subset, $all_subsets ) ) {
123
-						$available_subsets[] = array( 'id' => $subset, 'label' => $all_subsets[ $subset ] );
123
+						$available_subsets[] = array( 'id' => $subset, 'label' => $all_subsets[$subset] );
124 124
 					}
125 125
 				}
126 126
 
Please login to merge, or discard this patch.
includes/class-kirki-values.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -32,18 +32,18 @@  discard block
 block discarded – undo
32 32
 			/**
33 33
 			 * fallback to 'global' if $config_id is not found
34 34
 			 */
35
-			if ( ! isset( Kirki::$config[ $config_id ] ) ) {
35
+			if ( ! isset( Kirki::$config[$config_id] ) ) {
36 36
 				$config_id = 'global';
37 37
 			}
38 38
 
39
-			if ( 'theme_mod' == Kirki::$config[ $config_id ]['option_type'] ) {
39
+			if ( 'theme_mod' == Kirki::$config[$config_id]['option_type'] ) {
40 40
 				/**
41 41
 				 * We're using theme_mods.
42 42
 				 * so just get the value using get_theme_mod
43 43
 				 */
44 44
 				$default_value = null;
45
-				if ( isset( Kirki::$fields[ $field_id ] ) && isset( Kirki::$fields[ $field_id ]['default'] ) ) {
46
-					$default_value = Kirki::$fields[ $field_id ]['default'];
45
+				if ( isset( Kirki::$fields[$field_id] ) && isset( Kirki::$fields[$field_id]['default'] ) ) {
46
+					$default_value = Kirki::$fields[$field_id]['default'];
47 47
 				}
48 48
 				$value = get_theme_mod( $field_id, $default_value );
49 49
 
@@ -51,51 +51,51 @@  discard block
 block discarded – undo
51 51
 				 * If the field is a background field, then get the sub-fields
52 52
 				 * and return an array of the values.
53 53
 				 */
54
-				if ( isset( Kirki::$fields[ $field_id ] ) && isset( Kirki::$fields[ $field_id ]['type'] ) && 'background' == Kirki::$fields[ $field_id ]['type'] ) {
54
+				if ( isset( Kirki::$fields[$field_id] ) && isset( Kirki::$fields[$field_id]['type'] ) && 'background' == Kirki::$fields[$field_id]['type'] ) {
55 55
 					$value = array();
56 56
 					if ( null == $default_value ) {
57 57
 						$default_value = array();
58 58
 					}
59 59
 					foreach ( $default_value as $property_key => $property_default ) {
60
-						$value[ $property_key ] = get_theme_mod( $field_id . '_' . $property_key, $property_default );
60
+						$value[$property_key] = get_theme_mod( $field_id . '_' . $property_key, $property_default );
61 61
 					}
62 62
 				}
63 63
 
64
-			} elseif ( 'option' == Kirki::$config[ $config_id ]['option_type'] ) {
64
+			} elseif ( 'option' == Kirki::$config[$config_id]['option_type'] ) {
65 65
 				/**
66 66
 				 * We're using options.
67 67
 				 */
68
-				if ( '' != Kirki::$config[ $config_id ]['option_name'] ) {
68
+				if ( '' != Kirki::$config[$config_id]['option_name'] ) {
69 69
 					/**
70 70
 					 * Options are serialized as a single option in the db.
71 71
 					 * We'll have to get the option and then get the item from the array.
72 72
 					 */
73
-					$options = get_option( Kirki::$config[ $config_id ]['option_name'] );
73
+					$options = get_option( Kirki::$config[$config_id]['option_name'] );
74 74
 
75
-					if ( ! isset( Kirki::$fields[ $field_id ] ) && isset( Kirki::$fields[ Kirki::$config[ $config_id ]['option_name'] . '[' . $field_id . ']' ] ) ) {
76
-						$field_id = Kirki::$config[ $config_id ]['option_name'] . '[' . $field_id . ']';
75
+					if ( ! isset( Kirki::$fields[$field_id] ) && isset( Kirki::$fields[Kirki::$config[$config_id]['option_name'] . '[' . $field_id . ']'] ) ) {
76
+						$field_id = Kirki::$config[$config_id]['option_name'] . '[' . $field_id . ']';
77 77
 					}
78
-					$setting_modified = str_replace( ']', '', str_replace( Kirki::$config[ $config_id ]['option_name'] . '[', '', $field_id ) );
78
+					$setting_modified = str_replace( ']', '', str_replace( Kirki::$config[$config_id]['option_name'] . '[', '', $field_id ) );
79 79
 
80 80
 					/**
81 81
 					 * If this is a background field, get the individual sub-fields and return an array.
82 82
 					 */
83
-					if ( 'background' == Kirki::$fields[ $field_id ]['type'] ) {
83
+					if ( 'background' == Kirki::$fields[$field_id]['type'] ) {
84 84
 						$value = array();
85 85
 
86
-						foreach ( Kirki::$fields[ $field_id ]['default'] as $property => $property_default ) {
86
+						foreach ( Kirki::$fields[$field_id]['default'] as $property => $property_default ) {
87 87
 
88
-							if ( isset( $options[ $setting_modified . '_' . $property ] ) ) {
89
-								$value[ $property ] = $options[ $setting_modified . '_' . $property ];
88
+							if ( isset( $options[$setting_modified . '_' . $property] ) ) {
89
+								$value[$property] = $options[$setting_modified . '_' . $property];
90 90
 							} else {
91
-								$value[ $property ] = $property_default;
91
+								$value[$property] = $property_default;
92 92
 							}
93 93
 						}
94 94
 					} else {
95 95
 						/**
96 96
 						 * This is not a background field so continue and get the value.
97 97
 						 */
98
-						$value = ( isset( $options[ $setting_modified ] ) ) ? $options[ $setting_modified ] : Kirki::$fields[ $field_id ]['default'];
98
+						$value = ( isset( $options[$setting_modified] ) ) ? $options[$setting_modified] : Kirki::$fields[$field_id]['default'];
99 99
 						$value = maybe_unserialize( $value );
100 100
 					}
101 101
 
@@ -103,16 +103,16 @@  discard block
 block discarded – undo
103 103
 					/**
104 104
 					 * Each option separately saved in the db
105 105
 					 */
106
-					$value = get_option( $field_id, Kirki::$fields[ $field_id ]['default'] );
106
+					$value = get_option( $field_id, Kirki::$fields[$field_id]['default'] );
107 107
 
108 108
 					/**
109 109
 					 * If the field is a background field, then get the sub-fields
110 110
 					 * and return an array of the values.
111 111
 					 */
112
-					if ( 'background' == Kirki::$fields[ $field_id ]['type'] ) {
112
+					if ( 'background' == Kirki::$fields[$field_id]['type'] ) {
113 113
 						$value = array();
114
-						foreach ( Kirki::$fields[ $field_id ]['default'] as $property_key => $property_default ) {
115
-							$value[ $property_key ] = get_option( $field_id . '_' . $property_key, $property_default );
114
+						foreach ( Kirki::$fields[$field_id]['default'] as $property_key => $property_default ) {
115
+							$value[$property_key] = get_option( $field_id . '_' . $property_key, $property_default );
116 116
 						}
117 117
 					}
118 118
 
@@ -140,8 +140,8 @@  discard block
 block discarded – undo
140 140
 				if ( isset( $field['option_name'] ) && '' != $field['option_name'] ) {
141 141
 					$all_values = get_option( $field['option_name'], array() );
142 142
 					$sub_setting_id = str_replace( array( ']', $field['option_name'] . '[' ), '', $field['settings'] );
143
-					if ( isset( $all_values[ $sub_setting_id ] ) ) {
144
-						$value = $all_values[ $sub_setting_id ];
143
+					if ( isset( $all_values[$sub_setting_id] ) ) {
144
+						$value = $all_values[$sub_setting_id];
145 145
 					}
146 146
 				} else {
147 147
 					$value = get_option( $field['settings'], $field['default'] );
Please login to merge, or discard this patch.
includes/class-kirki-fonts.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 				$google_fonts = array();
101 101
 				if ( is_array( $fonts ) ) {
102 102
 					foreach ( $fonts['items'] as $font ) {
103
-						$google_fonts[ $font['family'] ] = array(
103
+						$google_fonts[$font['family']] = array(
104 104
 							'label'    => $font['family'],
105 105
 							'variants' => $font['variants'],
106 106
 							'subsets'  => $font['subsets'],
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 			$fonts = self::get_all_fonts();
176 176
 			$fonts_array = array();
177 177
 			foreach ( $fonts as $key => $args ) {
178
-				$fonts_array[ $key ] = $key;
178
+				$fonts_array[$key] = $key;
179 179
 			}
180 180
 			return $fonts_array;
181 181
 		}
Please login to merge, or discard this patch.
includes/lib/class-aricolor.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -82,10 +82,10 @@  discard block
 block discarded – undo
82 82
 			// get an md5 for this color
83 83
 			$color_md5 = ( is_array( $color ) ) ? md5( json_encode( $color ) . $mode ) : md5( $color . $mode );
84 84
 			// Set the instance if it does not already exist.
85
-			if ( ! isset( self::$instances[ $color_md5 ] ) ) {
86
-				self::$instances[ $color_md5 ] = new self( $color, $mode );
85
+			if ( ! isset( self::$instances[$color_md5] ) ) {
86
+				self::$instances[$color_md5] = new self( $color, $mode );
87 87
 			}
88
-			return self::$instances[ $color_md5 ];
88
+			return self::$instances[$color_md5];
89 89
 		}
90 90
 
91 91
 		/**
@@ -186,9 +186,9 @@  discard block
 block discarded – undo
186 186
 				);
187 187
 				$found = false;
188 188
 				foreach ( $finders_keepers as $finder => $keeper ) {
189
-					if ( isset( $color[ $finder ] ) ) {
189
+					if ( isset( $color[$finder] ) ) {
190 190
 						$found = true;
191
-						$this->$keeper = $color[ $finder ];
191
+						$this->$keeper = $color[$finder];
192 192
 					}
193 193
 				}
194 194
 				// We failed, return null.
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 			// Perhaps we're using a word like "orange"?
218 218
 			$wordcolors = $this->get_word_colors();
219 219
 			if ( array_key_exists( $color, $wordcolors ) ) {
220
-				$this->color = '#' . $wordcolors[ $color ];
220
+				$this->color = '#' . $wordcolors[$color];
221 221
 				return 'hex';
222 222
 			}
223 223
 			// fallback to hex.
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 			// Is this perhaps a word-color?
238 238
 			$word_colors = $this->get_word_colors();
239 239
 			if ( array_key_exists( $this->color, $word_colors ) ) {
240
-				$this->color = '#' . $word_colors[ $this->color ];
240
+				$this->color = '#' . $word_colors[$this->color];
241 241
 			}
242 242
 			// Sanitize color
243 243
 			$this->hex = sanitize_hex_color( maybe_hash_hex_color( $this->color ) );
Please login to merge, or discard this patch.
includes/lib/class-kirki-colourlovers.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,9 +31,9 @@
 block discarded – undo
31 31
 
32 32
 			$i = 0;
33 33
 			foreach ( $palettes as $palette ) {
34
-				$palettes[ $i ] = array();
34
+				$palettes[$i] = array();
35 35
 				foreach ( $palette as $key => $value ) {
36
-					$palettes[ $i ][ $key ] = Kirki_Color::sanitize_hex( $value );
36
+					$palettes[$i][$key] = Kirki_Color::sanitize_hex( $value );
37 37
 				}
38 38
 				$i++;
39 39
 			}
Please login to merge, or discard this patch.
includes/controls/class-kirki-controls-sortable-control.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@
 block discarded – undo
55 55
 			if ( is_array( $values ) && ! empty( $values ) ) {
56 56
 				foreach ( $values as $key => $value ) {
57 57
 					if ( array_key_exists( $value, $this->choices ) ) {
58
-						$filtered_values[ $key ] = $value;
58
+						$filtered_values[$key] = $value;
59 59
 					}
60 60
 				}
61 61
 			}
Please login to merge, or discard this patch.
includes/class-kirki-fonts-google.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -99,11 +99,11 @@  discard block
 block discarded – undo
99 99
 					}
100 100
 				}
101 101
 				// Add the requested google-font
102
-				if ( ! isset( $this->fonts[ $value['font-family'] ] ) ) {
103
-					$this->fonts[ $value['font-family'] ] = array();
102
+				if ( ! isset( $this->fonts[$value['font-family']] ) ) {
103
+					$this->fonts[$value['font-family']] = array();
104 104
 				}
105
-				if ( ! in_array( $value['variant'], $this->fonts[ $value['font-family'] ] ) ) {
106
-					$this->fonts[ $value['font-family'] ][] = $value['variant'];
105
+				if ( ! in_array( $value['variant'], $this->fonts[$value['font-family']] ) ) {
106
+					$this->fonts[$value['font-family']][] = $value['variant'];
107 107
 				}
108 108
 			}
109 109
 
@@ -123,14 +123,14 @@  discard block
 block discarded – undo
123 123
 						// font-family
124 124
 						if ( 'font-family' == $output['property'] ) {
125 125
 							if ( ! array_key_exists( $value, $this->fonts ) ) {
126
-								$this->fonts[ $value ] = array();
126
+								$this->fonts[$value] = array();
127 127
 							}
128 128
 						}
129 129
 						// font-weight
130 130
 						elseif ( 'font-weight' == $output['property'] ) {
131 131
 							foreach ( $this->fonts as $font => $variants ) {
132 132
 								if ( ! in_array( $value, $variants ) ) {
133
-									$this->fonts[ $font ][] = $value;
133
+									$this->fonts[$font][] = $value;
134 134
 								}
135 135
 							}
136 136
 						}
@@ -167,27 +167,27 @@  discard block
 block discarded – undo
167 167
 				// Determine if this is indeed a google font or not.
168 168
 				// If it's not, then just remove it from the array.
169 169
 				if ( ! array_key_exists( $font, $google_fonts ) ) {
170
-					unset( $this->fonts[ $font ] );
170
+					unset( $this->fonts[$font] );
171 171
 					continue;
172 172
 				}
173 173
 				// Get all valid font variants for this font
174 174
 				$font_variants = array();
175
-				if ( isset( $google_fonts[ $font ]['variants'] ) ) {
176
-					$font_variants = $google_fonts[ $font ]['variants'];
175
+				if ( isset( $google_fonts[$font]['variants'] ) ) {
176
+					$font_variants = $google_fonts[$font]['variants'];
177 177
 				}
178 178
 				foreach ( $variants as $variant ) {
179 179
 					// If this is not a valid variant for this font-family
180 180
 					// then unset it and move on to the next one.
181 181
 					if ( ! in_array( $variant, $font_variants ) ) {
182
-						unset( $this->fonts[ $font ][ $variant ] );
182
+						unset( $this->fonts[$font][$variant] );
183 183
 						continue;
184 184
 					}
185 185
 				}
186 186
 				// Check if the selected subsets exist, even in one of the selected fonts.
187 187
 				// If they don't, then they have to be removed otherwise the link will fail.
188
-				if ( isset( $google_fonts[ $font ]['subsets'] ) ) {
188
+				if ( isset( $google_fonts[$font]['subsets'] ) ) {
189 189
 					foreach ( $this->subsets as $subset ) {
190
-						if ( in_array( $subset, $google_fonts[ $font ]['subsets'] ) ) {
190
+						if ( in_array( $subset, $google_fonts[$font]['subsets'] ) ) {
191 191
 							$valid_subsets[] = $subset;
192 192
 						}
193 193
 					}
Please login to merge, or discard this patch.
includes/class-kirki-field.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -180,11 +180,11 @@  discard block
 block discarded – undo
180 180
 			// Get defaults from the class
181 181
 			$defaults = get_class_vars( __CLASS__ );
182 182
 			// Get the config arguments, and merge them with the defaults
183
-			$config_defaults = Kirki::$config[ $this->kirki_config ];
183
+			$config_defaults = Kirki::$config[$this->kirki_config];
184 184
 			foreach ( $config_defaults as $key => $value ) {
185
-				if ( isset( $defaults[ $key ] ) ) {
186
-					if ( ! empty( $value ) && $value != $defaults[ $key ] ) {
187
-						$defaults[ $key ] = $value;
185
+				if ( isset( $defaults[$key] ) ) {
186
+					if ( ! empty( $value ) && $value != $defaults[$key] ) {
187
+						$defaults[$key] = $value;
188 188
 					}
189 189
 				}
190 190
 			}
@@ -214,8 +214,8 @@  discard block
 block discarded – undo
214 214
 			// remove any whitelisted properties from above
215 215
 			// These will get a free pass, completely unfiltered.
216 216
 			foreach ( $whitelisted_properties as $key => $default_value ) {
217
-				if ( isset( $properties[ $key ] ) ) {
218
-					unset( $properties[ $key ] );
217
+				if ( isset( $properties[$key] ) ) {
218
+					unset( $properties[$key] );
219 219
 				}
220 220
 			}
221 221
 
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
 			// Get all arguments with their values
248 248
 			$args = get_class_vars( __CLASS__ );
249 249
 			foreach ( $args as $key => $default_value ) {
250
-				$args[ $key ] = $this->$key;
250
+				$args[$key] = $this->$key;
251 251
 			}
252 252
 
253 253
 			// add the whitelisted properties through the back door
@@ -255,11 +255,11 @@  discard block
 block discarded – undo
255 255
 				if ( ! isset( $this->$key ) ) {
256 256
 					$this->$key = $default_value;
257 257
 				}
258
-				$args[ $key ] = $this->$key;
258
+				$args[$key] = $this->$key;
259 259
 			}
260 260
 
261 261
 			// Add the field to the static $fields variable properly indexed
262
-			Kirki::$fields[ $this->settings ] = $args;
262
+			Kirki::$fields[$this->settings] = $args;
263 263
 
264 264
 			if ( 'background' == $this->type ) {
265 265
 				// Build the background fields
@@ -356,10 +356,10 @@  discard block
 block discarded – undo
356 356
 			}
357 357
 			$settings = array();
358 358
 			foreach ( $this->settings as $setting_key => $setting_value ) {
359
-				$settings[ sanitize_key( $setting_key ) ] = esc_attr( $setting_value );
359
+				$settings[sanitize_key( $setting_key )] = esc_attr( $setting_value );
360 360
 				// If we're using serialized options then we need to spice this up
361 361
 				if ( 'option' == $this->option_type && '' != $this->option_name && ( false === strpos( $setting_key, '[' ) ) ) {
362
-					$settings[ sanitize_key( $setting_key ) ] = esc_attr( $this->option_name ) . '[' . esc_attr( $setting_value ).']';
362
+					$settings[sanitize_key( $setting_key )] = esc_attr( $this->option_name ) . '[' . esc_attr( $setting_value ) . ']';
363 363
 				}
364 364
 			}
365 365
 			$this->settings = $settings;
@@ -542,7 +542,7 @@  discard block
 block discarded – undo
542 542
 			);
543 543
 
544 544
 			if ( array_key_exists( $this->type, $default_callbacks ) ) {
545
-				$this->sanitize_callback = $default_callbacks[ $this->type ];
545
+				$this->sanitize_callback = $default_callbacks[$this->type];
546 546
 			}
547 547
 
548 548
 		}
Please login to merge, or discard this patch.