Completed
Branch develop (288e61)
by Aristeides
02:45
created
includes/class-kirki-field.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -44,12 +44,12 @@  discard block
 block discarded – undo
44 44
 			$this->args = wp_parse_args( $this->args, $this->default_args );
45 45
 
46 46
 			// Get the config arguments
47
-			$config = Kirki::$config[ $this->args['kirki_config'] ];
47
+			$config = Kirki::$config[$this->args['kirki_config']];
48 48
 			// Get the 'disable_output' argument from the config
49 49
 			$this->args['disable_output'] = $config['disable_output'];
50 50
 
51 51
 			// Add the field to the static $fields variable properly indexed
52
-			Kirki::$fields[ $this->args['settings'] ] = $this->args;
52
+			Kirki::$fields[$this->args['settings']] = $this->args;
53 53
 
54 54
 			if ( 'background' == $this->args['type'] ) {
55 55
 				// Build the background fields
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 				$config_id = 'global';
78 78
 			}
79 79
 			// If the defined config does not exist, use global.
80
-			if ( ! isset( Kirki::$config[ $config_id ] ) ) {
80
+			if ( ! isset( Kirki::$config[$config_id] ) ) {
81 81
 				$config_id = 'global';
82 82
 			}
83 83
 			// Sanitize $config_id using the esc_attr() function
@@ -88,10 +88,10 @@  discard block
 block discarded – undo
88 88
 		 * Sets the setting name.
89 89
 		 */
90 90
 		private function option_name() {
91
-			if ( isset( Kirki::$config[ $this->args['kirki_config'] ]['option_name'] ) ) {
91
+			if ( isset( Kirki::$config[$this->args['kirki_config']]['option_name'] ) ) {
92 92
 				// use from config if not defined in the option
93 93
 				$defaults = array(
94
-					'option_name' => Kirki::$config[ $this->args['kirki_config'] ]['option_name'],
94
+					'option_name' => Kirki::$config[$this->args['kirki_config']]['option_name'],
95 95
 				);
96 96
 				$this->args = wp_parse_args( $this->args, $defaults );
97 97
 				// escape value
@@ -115,9 +115,9 @@  discard block
 block discarded – undo
115 115
 		private function capability() {
116 116
 			// If a capability has not been defined in the field itself,
117 117
 			// Then fallback to the capability from the field's config.
118
-			if ( isset( Kirki::$config[ $this->args['kirki_config'] ]['capability'] ) ) {
118
+			if ( isset( Kirki::$config[$this->args['kirki_config']]['capability'] ) ) {
119 119
 				$defaults = array(
120
-					'capability' => Kirki::$config[ $this->args['kirki_config'] ]['capability'],
120
+					'capability' => Kirki::$config[$this->args['kirki_config']]['capability'],
121 121
 				);
122 122
 				$this->args = wp_parse_args( $this->args, $defaults );
123 123
 			}
@@ -139,8 +139,8 @@  discard block
 block discarded – undo
139 139
 			// Then try to get it from the config.
140 140
 			// Fallback to "theme_mod"
141 141
 			$defaults = array( 'option_type' => 'theme_mod' );
142
-			if ( isset( Kirki::$config[ $this->args['kirki_config'] ]['option_type'] ) ) {
143
-				$defaults = array( 'option_type' => Kirki::$config[ $this->args['kirki_config'] ]['option_type'] );
142
+			if ( isset( Kirki::$config[$this->args['kirki_config']]['option_type'] ) ) {
143
+				$defaults = array( 'option_type' => Kirki::$config[$this->args['kirki_config']]['option_type'] );
144 144
 			}
145 145
 			$this->args = wp_parse_args( $this->args, $defaults );
146 146
 
@@ -168,10 +168,10 @@  discard block
 block discarded – undo
168 168
 			}
169 169
 			$settings = array();
170 170
 			foreach ( $this->args['settings'] as $setting_key => $setting_value ) {
171
-				$settings[ sanitize_key( $setting_key ) ] = esc_attr( $setting_value );
171
+				$settings[sanitize_key( $setting_key )] = esc_attr( $setting_value );
172 172
 				// If we're using serialized options then we need to spice this up
173 173
 				if ( 'option' == $this->args['option_type'] && '' != $this->args['option_name'] && ( false === strpos( $setting_key, '[' ) ) ) {
174
-					$settings[ sanitize_key( $setting_key ) ] = esc_attr( $this->args['option_name'] ).'['.esc_attr( $setting_value ).']';
174
+					$settings[sanitize_key( $setting_key )] = esc_attr( $this->args['option_name'] ) . '[' . esc_attr( $setting_value ) . ']';
175 175
 				}
176 176
 			}
177 177
 			$this->args['settings'] = $settings;
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
 			if ( ! isset( $this->args['sanitize_callback'] ) || empty( $this->args['sanitize_callback'] ) || ! is_callable( $this->args['sanitize_callback'] ) ) {
341 341
 				$this->args['sanitize_callback'] = array( 'Kirki_Sanitize_Values', 'unfiltered' );
342 342
 				if ( array_key_exists( $this->args['type'], $default_callbacks ) ) {
343
-					$this->args['sanitize_callback'] = $default_callbacks[ $this->args['type'] ];
343
+					$this->args['sanitize_callback'] = $default_callbacks[$this->args['type']];
344 344
 				}
345 345
 			}
346 346
 		}
@@ -361,19 +361,19 @@  discard block
 block discarded – undo
361 361
 					continue;
362 362
 				}
363 363
 				// Do we have units?
364
-				$this->args['output'][ $key ]['units'] = ( isset( $output['units'] ) ) ? $output['units'] : '';
364
+				$this->args['output'][$key]['units'] = ( isset( $output['units'] ) ) ? $output['units'] : '';
365 365
 				// Do we have a prefix?
366
-				$this->args['output'][ $key ]['prefix'] = ( isset( $output['prefix'] ) ) ? $output['prefix'] : '';
366
+				$this->args['output'][$key]['prefix'] = ( isset( $output['prefix'] ) ) ? $output['prefix'] : '';
367 367
 				// Do we have a suffix?
368
-				$this->args['output'][ $key ]['suffix'] = ( isset( $output['suffix'] ) ) ? $output['suffix'] : '';
368
+				$this->args['output'][$key]['suffix'] = ( isset( $output['suffix'] ) ) ? $output['suffix'] : '';
369 369
 				// Accept "callback" as short for "sanitize_callback".
370 370
 				if ( ! isset( $output['sanitize_callback'] ) && isset( $output['callback'] ) ) {
371
-					$this->args['output'][ $key ]['sanitize_callback'] = $output['callback'];
371
+					$this->args['output'][$key]['sanitize_callback'] = $output['callback'];
372 372
 				}
373 373
 				// Do we have a "media_query" defined?
374
-				$this->args['output'][ $key ]['media_query'] = ( isset( $output['media_query'] ) ) ? $output['media_query'] : 'global';
374
+				$this->args['output'][$key]['media_query'] = ( isset( $output['media_query'] ) ) ? $output['media_query'] : 'global';
375 375
 				// add the ability to exclude a value
376
-				$this->args['output'][ $key ]['exclude'] = ( isset( $output['exclude'] ) ) ? $output['exclude'] : false;
376
+				$this->args['output'][$key]['exclude'] = ( isset( $output['exclude'] ) ) ? $output['exclude'] : false;
377 377
 			}
378 378
 		}
379 379
 
Please login to merge, or discard this patch.
includes/output/property/class-kirki-output-property-font-family.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -9,13 +9,13 @@
 block discarded – undo
9 9
 		// Add backup font
10 10
 		if ( Kirki_Fonts::is_google_font( $this->value ) ) {
11 11
 
12
-			if ( isset( $google_fonts_array[ $this->value ] ) && isset( $google_fonts_array[ $this->value ]['category'] ) ) {
13
-				if ( isset( $backup_fonts[ $google_fonts_array[ $this->value ]['category'] ] ) ) {
12
+			if ( isset( $google_fonts_array[$this->value] ) && isset( $google_fonts_array[$this->value]['category'] ) ) {
13
+				if ( isset( $backup_fonts[$google_fonts_array[$this->value]['category']] ) ) {
14 14
 					// add double quotes if needed
15 15
 					if ( false !== strpos( $this->value, ' ' ) && false === strpos( $this->value, '"' ) ) {
16
-						$this->value = '"' . $this->value . '", ' . $backup_fonts[ $google_fonts_array[ $this->value ]['category'] ];
16
+						$this->value = '"' . $this->value . '", ' . $backup_fonts[$google_fonts_array[$this->value]['category']];
17 17
 					} else {
18
-						$this->value .= ', ' . $backup_fonts[ $google_fonts_array[ $this->value ]['category'] ];
18
+						$this->value .= ', ' . $backup_fonts[$google_fonts_array[$this->value]['category']];
19 19
 					}
20 20
 				}
21 21
 			}
Please login to merge, or discard this patch.
includes/output/control/class-kirki-output-control-typography.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
 
7 7
 		// Take care of font-families
8 8
 		if ( isset( $value['font-family'] ) ) {
9
-			$this->styles[ $output['media_query'] ][ $output['element'] ]['font-family'] = $this->process_property_value( 'font-family', $value['font-family'] );
9
+			$this->styles[$output['media_query']][$output['element']]['font-family'] = $this->process_property_value( 'font-family', $value['font-family'] );
10 10
 		}
11 11
 		// Add support for the older font-weight parameter.
12 12
 		// This has been deprecated so the code below is just
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 		// and make changes to their typography,
16 16
 		// new values are saved and this one is no longer used.
17 17
 		if ( isset( $value['font-weight'] ) && $value['font-weight'] ) {
18
-			$this->styles[ $output['media_query'] ][ $output['element'] ]['font-weight'] = $value['font-weight'];
18
+			$this->styles[$output['media_query']][$output['element']]['font-weight'] = $value['font-weight'];
19 19
 		}
20 20
 		// Take care of variants
21 21
 		if ( isset( $value['variant'] ) && $value['variant'] ) {
@@ -24,22 +24,22 @@  discard block
 block discarded – undo
24 24
 			$font_weight = ( in_array( $font_weight, array( '', 'regular' ) ) ) ? '400' : $font_weight;
25 25
 			// Is this italic?
26 26
 			$is_italic = ( false !== strpos( $value['variant'], 'italic' ) );
27
-			$this->styles[ $output['media_query'] ][ $output['element'] ]['font-weight'] = $font_weight;
27
+			$this->styles[$output['media_query']][$output['element']]['font-weight'] = $font_weight;
28 28
 			if ( $is_italic ) {
29
-				$this->styles[ $output['media_query'] ][ $output['element'] ]['font-style'] = 'italic';
29
+				$this->styles[$output['media_query']][$output['element']]['font-style'] = 'italic';
30 30
 			}
31 31
 		}
32 32
 		// Take care of font-size
33 33
 		if ( isset( $value['font-size'] ) ) {
34
-			$this->styles[ $output['media_query'] ][ $output['element'] ]['font-size'] = $value['font-size'];
34
+			$this->styles[$output['media_query']][$output['element']]['font-size'] = $value['font-size'];
35 35
 		}
36 36
 		// Take care of line-height
37 37
 		if ( isset( $value['line-height'] ) ) {
38
-			$this->styles[ $output['media_query'] ][ $output['element'] ]['line-height'] = $value['line-height'];
38
+			$this->styles[$output['media_query']][$output['element']]['line-height'] = $value['line-height'];
39 39
 		}
40 40
 		// Take care of letter-spacing
41 41
 		if ( isset( $value['letter-spacing'] ) ) {
42
-			$this->styles[ $output['media_query'] ][ $output['element'] ]['letter-spacing'] = $value['letter-spacing'];
42
+			$this->styles[$output['media_query']][$output['element']]['letter-spacing'] = $value['letter-spacing'];
43 43
 		}
44 44
 
45 45
 	}
Please login to merge, or discard this patch.
includes/output/class-kirki-output.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 			// escape the element
58 58
 			$output['element'] = esc_js( $output['element'] );
59 59
 
60
-			$this->output[ $key ]['element'] = $output['element'];
60
+			$this->output[$key]['element'] = $output['element'];
61 61
 		}
62 62
 	}
63 63
 
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 	 * @return void
100 100
 	 */
101 101
 	protected function process_output( $output, $value ) {
102
-		$this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = $output['prefix'] . $value . $output['units'] . $output['suffix'];
102
+		$this->styles[$output['media_query']][$output['element']][$output['property']] = $output['prefix'] . $value . $output['units'] . $output['suffix'];
103 103
 	}
104 104
 
105 105
 	/**
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 			'background-image' => 'Kirki_Output_Property_Background_Image',
116 116
 		) );
117 117
 		if ( array_key_exists( $property, $properties ) ) {
118
-			$classname = $properties[ $property ];
118
+			$classname = $properties[$property];
119 119
 			$obj = new $classname( $property, $value );
120 120
 			return $obj->get_value();
121 121
 		}
Please login to merge, or discard this patch.
includes/styles/class-kirki-styles-output-css.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 				'typography' => 'Kirki_Output_Control_Typography',
97 97
 			) );
98 98
 			if ( array_key_exists( self::$field_type, $field_output_classes ) ) {
99
-				$classname = $field_output_classes[ self::$field_type ];
99
+				$classname = $field_output_classes[self::$field_type];
100 100
 			}
101 101
 			$obj = new $classname( $field['kirki_config'], self::$output, self::$value );
102 102
 			return $obj->get_styles();
@@ -172,8 +172,8 @@  discard block
 block discarded – undo
172 172
 								'transition',
173 173
 								'transition-property',
174 174
 							) ) ) {
175
-								$css[ $media_query ][ $element ][ '-webkit-' . $property ] = $value;
176
-								$css[ $media_query ][ $element ][ '-moz-' . $property ]    = $value;
175
+								$css[$media_query][$element]['-webkit-' . $property] = $value;
176
+								$css[$media_query][$element]['-moz-' . $property]    = $value;
177 177
 							}
178 178
 							/**
179 179
 							 * Add -ms-* and -o-*
@@ -184,8 +184,8 @@  discard block
 block discarded – undo
184 184
 								'transition',
185 185
 								'transition-property',
186 186
 							) ) ) {
187
-								$css[ $media_query ][ $element ][ '-ms-' . $property ] = $value;
188
-								$css[ $media_query ][ $element ][ '-o-' . $property ]  = $value;
187
+								$css[$media_query][$element]['-ms-' . $property] = $value;
188
+								$css[$media_query][$element]['-o-' . $property]  = $value;
189 189
 							}
190 190
 						}
191 191
 					}
Please login to merge, or discard this patch.
includes/class-kirki-fonts-google.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -97,11 +97,11 @@  discard block
 block discarded – undo
97 97
 					}
98 98
 				}
99 99
 				// Add the requested google-font
100
-				if ( ! isset( $this->fonts[ $value['font-family'] ] ) ) {
101
-					$this->fonts[ $value['font-family'] ] = array();
100
+				if ( ! isset( $this->fonts[$value['font-family']] ) ) {
101
+					$this->fonts[$value['font-family']] = array();
102 102
 				}
103
-				if ( ! in_array( $value['variant'], $this->fonts[ $value['font-family'] ] ) ) {
104
-					$this->fonts[ $value['font-family'] ][] = $value['variant'];
103
+				if ( ! in_array( $value['variant'], $this->fonts[$value['font-family']] ) ) {
104
+					$this->fonts[$value['font-family']][] = $value['variant'];
105 105
 				}
106 106
 			}
107 107
 
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 				if ( isset( $args['output'] ) && is_array( $args['output'] ) ) {
113 113
 					foreach ( $args['output'] as $output ) {
114 114
 						// If we don't have a typography-related output argument we can skip this.
115
-						if ( ! isset( $output['property'] ) ||  ! in_array( $output['property'], array( 'font-family', 'font-weight', 'font-subset', 'subset' ) ) ) {
115
+						if ( ! isset( $output['property'] ) || ! in_array( $output['property'], array( 'font-family', 'font-weight', 'font-subset', 'subset' ) ) ) {
116 116
 							continue;
117 117
 						}
118 118
 						// Get the value
@@ -121,14 +121,14 @@  discard block
 block discarded – undo
121 121
 						// font-family
122 122
 						if ( 'font-family' == $output['property'] ) {
123 123
 							if ( ! array_key_exists( $value, $this->fonts ) ) {
124
-								$this->fonts[ $value ] = array();
124
+								$this->fonts[$value] = array();
125 125
 							}
126 126
 						}
127 127
 						// font-weight
128 128
 						elseif ( 'font-weight' == $output['property'] ) {
129 129
 							foreach ( $this->fonts as $font => $variants ) {
130 130
 								if ( ! in_array( $value, $variants ) ) {
131
-									$this->fonts[ $font ][] = $value;
131
+									$this->fonts[$font][] = $value;
132 132
 								}
133 133
 							}
134 134
 						}
@@ -165,27 +165,27 @@  discard block
 block discarded – undo
165 165
 				// Determine if this is indeed a google font or not.
166 166
 				// If it's not, then just remove it from the array.
167 167
 				if ( ! array_key_exists( $font, $google_fonts ) ) {
168
-					unset( $this->fonts[ $font ] );
168
+					unset( $this->fonts[$font] );
169 169
 					continue;
170 170
 				}
171 171
 				// Get all valid font variants for this font
172 172
 				$font_variants = array();
173
-				if ( isset( $google_fonts[ $font ]['variants'] ) ) {
174
-					$font_variants = $google_fonts[ $font ]['variants'];
173
+				if ( isset( $google_fonts[$font]['variants'] ) ) {
174
+					$font_variants = $google_fonts[$font]['variants'];
175 175
 				}
176 176
 				foreach ( $variants as $variant ) {
177 177
 					// If this is not a valid variant for this font-family
178 178
 					// then unset it and move on to the next one.
179 179
 					if ( ! in_array( $variant, $font_variants ) ) {
180
-						unset( $this->fonts[ $font ][ $variant ] );
180
+						unset( $this->fonts[$font][$variant] );
181 181
 						continue;
182 182
 					}
183 183
 				}
184 184
 				// Check if the selected subsets exist, even in one of the selected fonts.
185 185
 				// If they don't, then they have to be removed otherwise the link will fail.
186
-				if ( isset( $google_fonts[ $font ]['subsets'] ) ) {
186
+				if ( isset( $google_fonts[$font]['subsets'] ) ) {
187 187
 					foreach ( $this->subsets as $subset ) {
188
-						if ( in_array( $subset, $google_fonts[ $font ]['subsets'] ) ) {
188
+						if ( in_array( $subset, $google_fonts[$font]['subsets'] ) ) {
189 189
 							$valid_subsets[] = $subset;
190 190
 						}
191 191
 					}
Please login to merge, or discard this patch.
includes/output/control/class-kirki-output-control-spacing.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@
 block discarded – undo
10 10
 			} else {
11 11
 				$property = $output['property'] . '-' . $key;
12 12
 			}
13
-			$this->styles[ $output['media_query'] ][ $output['element'] ][ $property ] = $sub_value;
13
+			$this->styles[$output['media_query']][$output['element']][$property] = $sub_value;
14 14
 		}
15 15
 
16 16
 	}
Please login to merge, or discard this patch.