Completed
Branch develop (1becb4)
by Aristeides
05:50 queued 02:46
created
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/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.
includes/class-kirki-explode-background-field.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 				$key               = esc_attr( $key );
37 37
 				$setting           = $key;
38 38
 				$tooltip           = $field['tooltip'];
39
-				$description       = isset( $i18n[ 'background-' . $key ] ) ? $i18n[ 'background-' . $key ] : '';
39
+				$description       = isset( $i18n['background-' . $key] ) ? $i18n['background-' . $key] : '';
40 40
 				$output_property   = 'background-' . $key;
41 41
 				$label             = ( 0 === $i ) ? $field['label'] : '';
42 42
 				$type              = 'select';
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 				 * Build the field.
92 92
 				 * We're merging with the original field here, so any extra properties are inherited.
93 93
 				 */
94
-				$fields[ $property_setting ] = array_merge( $field, array(
94
+				$fields[$property_setting] = array_merge( $field, array(
95 95
 					'type'              => $type,
96 96
 					'label'             => $label,
97 97
 					'settings'          => $property_setting,
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 					'description'       => $description,
103 103
 					'default'           => $value,
104 104
 					'id'                => sanitize_key( str_replace( '[', '-', str_replace( ']', '', $property_setting ) ) ),
105
-					'choices'           => isset( $choices[ $key ] ) ? $choices[ $key ] : array(),
105
+					'choices'           => isset( $choices[$key] ) ? $choices[$key] : array(),
106 106
 					'sanitize_callback' => $sanitize_callback,
107 107
 					'output'            => ( ! empty( $field['output'] ) ) ? array(
108 108
 						array(
Please login to merge, or discard this patch.
includes/output/class-kirki-output.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -107,9 +107,9 @@  discard block
 block discarded – undo
107 107
 			return;
108 108
 		}
109 109
 		$output['media_query'] = ( isset( $output['media_query'] ) ) ? $output['media_query'] : 'global';
110
-		$output['prefix']      = ( isset( $output['prefix'] ) )      ? $output['prefix']      : '';
111
-		$output['units']       = ( isset( $output['units'] ) )       ? $output['units']       : '';
112
-		$output['suffix']      = ( isset( $output['suffix'] ) )      ? $output['suffix']      : '';
110
+		$output['prefix']      = ( isset( $output['prefix'] ) ) ? $output['prefix'] : '';
111
+		$output['units']       = ( isset( $output['units'] ) ) ? $output['units'] : '';
112
+		$output['suffix']      = ( isset( $output['suffix'] ) ) ? $output['suffix'] : '';
113 113
 
114 114
 		if ( is_array( $output['element'] ) ) {
115 115
 			$output['element'] = array_unique( $output['element'] );
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 			$output['element'] = implode( ',', $output['element'] );
118 118
 		}
119 119
 
120
-		$this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = $output['prefix'] . $value . $output['units'] . $output['suffix'];
120
+		$this->styles[$output['media_query']][$output['element']][$output['property']] = $output['prefix'] . $value . $output['units'] . $output['suffix'];
121 121
 	}
122 122
 
123 123
 	/**
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 			'background-position' => 'Kirki_Output_Property_Background_Position',
138 138
 		) );
139 139
 		if ( array_key_exists( $property, $properties ) ) {
140
-			$classname = $properties[ $property ];
140
+			$classname = $properties[$property];
141 141
 			$obj = new $classname( $property, $value );
142 142
 			return $obj->get_value();
143 143
 		}
Please login to merge, or discard this patch.