Completed
Pull Request — master (#1653)
by Aristeides
05:59 queued 03:54
created
modules/css/class-kirki-css-to-file.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -53,15 +53,15 @@  discard block
 block discarded – undo
53 53
 		$upload_dir = wp_upload_dir();
54 54
 
55 55
 		$paths = array(
56
-			'file'   => wp_normalize_path( $upload_dir['basedir'] . '/kirki-css/styles.css' ),
57
-			'folder' => wp_normalize_path( $upload_dir['basedir'] . '/kirki-css' ),
56
+			'file'   => wp_normalize_path( $upload_dir[ 'basedir' ] . '/kirki-css/styles.css' ),
57
+			'folder' => wp_normalize_path( $upload_dir[ 'basedir' ] . '/kirki-css' ),
58 58
 		);
59 59
 
60 60
 		if ( 'file' === $context ) {
61
-			return $paths['file'];
61
+			return $paths[ 'file' ];
62 62
 		}
63 63
 		if ( 'folder' === $context ) {
64
-			return $paths['folder'];
64
+			return $paths[ 'folder' ];
65 65
 		}
66 66
 		return $paths;
67 67
 
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 	public function get_url() {
78 78
 
79 79
 		$upload_dir = wp_upload_dir();
80
-		return esc_url_raw( $upload_dir['baseurl'] . '/kirki-css/styles.css' );
80
+		return esc_url_raw( $upload_dir[ 'baseurl' ] . '/kirki-css/styles.css' );
81 81
 
82 82
 	}
83 83
 
Please login to merge, or discard this patch.
modules/webfonts/class-kirki-modules-webfonts-embed.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -145,7 +145,7 @@
 block discarded – undo
145 145
 				return false;
146 146
 			}
147 147
 
148
-			if ( ! isset( $response['response'] ) || ! is_array( $response['response'] ) || ! isset( $response['response']['code'] ) || 200 !== $response['response']['code'] ) {
148
+			if ( ! isset( $response[ 'response' ] ) || ! is_array( $response[ 'response' ] ) || ! isset( $response[ 'response' ][ 'code' ] ) || 200 !== $response[ 'response' ][ 'code' ] ) {
149 149
 				return false;
150 150
 			}
151 151
 
Please login to merge, or discard this patch.
modules/webfonts/class-kirki-modules-webfonts.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -164,17 +164,17 @@
 block discarded – undo
164 164
 	 */
165 165
 	public function loop_fields( $config_id ) {
166 166
 		foreach ( Kirki::$fields as $field ) {
167
-			if ( isset( $field['kirki_config'] ) && $config_id !== $field['kirki_config'] ) {
167
+			if ( isset( $field[ 'kirki_config' ] ) && $config_id !== $field[ 'kirki_config' ] ) {
168 168
 				continue;
169 169
 			}
170 170
 			// Only continue if field dependencies are met.
171
-			if ( ! empty( $field['required'] ) ) {
171
+			if ( ! empty( $field[ 'required' ] ) ) {
172 172
 				$valid = true;
173 173
 
174
-				foreach ( $field['required'] as $requirement ) {
175
-					if ( isset( $requirement['setting'] ) && isset( $requirement['value'] ) && isset( $requirement['operator'] ) ) {
176
-						$controller_value = Kirki_Values::get_value( $config_id, $requirement['setting'] );
177
-						if ( ! Kirki_Helper::compare_values( $controller_value, $requirement['value'], $requirement['operator'] ) ) {
174
+				foreach ( $field[ 'required' ] as $requirement ) {
175
+					if ( isset( $requirement[ 'setting' ] ) && isset( $requirement[ 'value' ] ) && isset( $requirement[ 'operator' ] ) ) {
176
+						$controller_value = Kirki_Values::get_value( $config_id, $requirement[ 'setting' ] );
177
+						if ( ! Kirki_Helper::compare_values( $controller_value, $requirement[ 'value' ], $requirement[ 'operator' ] ) ) {
178 178
 							$valid = false;
179 179
 						}
180 180
 					}
Please login to merge, or discard this patch.
modules/webfonts/class-kirki-fonts-google.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 		$config = apply_filters( 'kirki/config', array() );
77 77
 
78 78
 		// If we have set $config['disable_google_fonts'] to true then do not proceed any further.
79
-		if ( isset( $config['disable_google_fonts'] ) && true === $config['disable_google_fonts'] ) {
79
+		if ( isset( $config[ 'disable_google_fonts' ] ) && true === $config[ 'disable_google_fonts' ] ) {
80 80
 			return;
81 81
 		}
82 82
 
@@ -113,64 +113,64 @@  discard block
 block discarded – undo
113 113
 	public function generate_google_font( $args ) {
114 114
 
115 115
 		// Process typography fields.
116
-		if ( isset( $args['type'] ) && 'kirki-typography' === $args['type'] ) {
116
+		if ( isset( $args[ 'type' ] ) && 'kirki-typography' === $args[ 'type' ] ) {
117 117
 
118 118
 			// Get the value.
119 119
 			$value = Kirki_Values::get_sanitized_field_value( $args );
120 120
 
121 121
 			// If we don't have a font-family then we can skip this.
122
-			if ( ! isset( $value['font-family'] ) ) {
122
+			if ( ! isset( $value[ 'font-family' ] ) ) {
123 123
 				return;
124 124
 			}
125 125
 
126 126
 			// If not a google-font, then we can skip this.
127
-			if ( ! Kirki_Fonts::is_google_font( $value['font-family'] ) ) {
127
+			if ( ! Kirki_Fonts::is_google_font( $value[ 'font-family' ] ) ) {
128 128
 				return;
129 129
 			}
130 130
 
131 131
 			// Set a default value for variants.
132
-			if ( ! isset( $value['variant'] ) ) {
133
-				$value['variant'] = 'regular';
132
+			if ( ! isset( $value[ 'variant' ] ) ) {
133
+				$value[ 'variant' ] = 'regular';
134 134
 			}
135
-			if ( isset( $value['subsets'] ) ) {
135
+			if ( isset( $value[ 'subsets' ] ) ) {
136 136
 
137 137
 				// Add the subset directly to the array of subsets in the Kirki_GoogleFonts_Manager object.
138 138
 				// Subsets must be applied to ALL fonts if possible.
139
-				if ( ! is_array( $value['subsets'] ) ) {
140
-					$this->subsets[] = $value['subsets'];
139
+				if ( ! is_array( $value[ 'subsets' ] ) ) {
140
+					$this->subsets[ ] = $value[ 'subsets' ];
141 141
 				} else {
142
-					foreach ( $value['subsets'] as $subset ) {
143
-						$this->subsets[] = $subset;
142
+					foreach ( $value[ 'subsets' ] as $subset ) {
143
+						$this->subsets[ ] = $subset;
144 144
 					}
145 145
 				}
146 146
 			}
147 147
 
148 148
 			// Add the requested google-font.
149
-			if ( ! isset( $this->fonts[ $value['font-family'] ] ) ) {
150
-				$this->fonts[ $value['font-family'] ] = array();
149
+			if ( ! isset( $this->fonts[ $value[ 'font-family' ] ] ) ) {
150
+				$this->fonts[ $value[ 'font-family' ] ] = array();
151 151
 			}
152
-			if ( ! in_array( $value['variant'], $this->fonts[ $value['font-family'] ], true ) ) {
153
-				$this->fonts[ $value['font-family'] ][] = $value['variant'];
152
+			if ( ! in_array( $value[ 'variant' ], $this->fonts[ $value[ 'font-family' ] ], true ) ) {
153
+				$this->fonts[ $value[ 'font-family' ] ][ ] = $value[ 'variant' ];
154 154
 			}
155 155
 			// Are we force-loading all variants?
156 156
 			if ( true === self::$force_load_all_variants ) {
157 157
 				$all_variants = Kirki_Fonts::get_all_variants();
158
-				$args['choices']['variant'] = array_keys( $all_variants );
158
+				$args[ 'choices' ][ 'variant' ] = array_keys( $all_variants );
159 159
 			}
160 160
 
161
-			if ( ! empty( $args['choices']['variant'] ) && is_array( $args['choices']['variant'] ) ) {
162
-				foreach ( $args['choices']['variant'] as $extra_variant ) {
163
-					$this->fonts[ $value['font-family'] ][] = $extra_variant;
161
+			if ( ! empty( $args[ 'choices' ][ 'variant' ] ) && is_array( $args[ 'choices' ][ 'variant' ] ) ) {
162
+				foreach ( $args[ 'choices' ][ 'variant' ] as $extra_variant ) {
163
+					$this->fonts[ $value[ 'font-family' ] ][ ] = $extra_variant;
164 164
 				}
165 165
 			}
166 166
 		} else {
167 167
 
168 168
 			// Process non-typography fields.
169
-			if ( isset( $args['output'] ) && is_array( $args['output'] ) ) {
170
-				foreach ( $args['output'] as $output ) {
169
+			if ( isset( $args[ 'output' ] ) && is_array( $args[ 'output' ] ) ) {
170
+				foreach ( $args[ 'output' ] as $output ) {
171 171
 
172 172
 					// If we don't have a typography-related output argument we can skip this.
173
-					if ( ! isset( $output['property'] ) || ! in_array( $output['property'], array( 'font-family', 'font-weight', 'font-subset', 'subset', 'subsets' ), true ) ) {
173
+					if ( ! isset( $output[ 'property' ] ) || ! in_array( $output[ 'property' ], array( 'font-family', 'font-weight', 'font-subset', 'subset', 'subsets' ), true ) ) {
174 174
 						continue;
175 175
 					}
176 176
 
@@ -178,25 +178,25 @@  discard block
 block discarded – undo
178 178
 					$value = Kirki_Values::get_sanitized_field_value( $args );
179 179
 
180 180
 					if ( is_string( $value ) ) {
181
-						if ( 'font-family' === $output['property'] ) {
181
+						if ( 'font-family' === $output[ 'property' ] ) {
182 182
 							if ( ! array_key_exists( $value, $this->fonts ) ) {
183 183
 								$this->fonts[ $value ] = array();
184 184
 							}
185
-						} elseif ( 'font-weight' === $output['property'] ) {
185
+						} elseif ( 'font-weight' === $output[ 'property' ] ) {
186 186
 							foreach ( $this->fonts as $font => $variants ) {
187 187
 								if ( ! in_array( $value, $variants, true ) ) {
188
-									$this->fonts[ $font ][] = $value;
188
+									$this->fonts[ $font ][ ] = $value;
189 189
 								}
190 190
 							}
191
-						} elseif ( 'font-subset' === $output['property'] || 'subset' === $output['property'] || 'subsets' === $output['property'] ) {
191
+						} elseif ( 'font-subset' === $output[ 'property' ] || 'subset' === $output[ 'property' ] || 'subsets' === $output[ 'property' ] ) {
192 192
 							if ( ! is_array( $value ) ) {
193 193
 								if ( ! in_array( $value, $this->subsets, true ) ) {
194
-									$this->subsets[] = $value;
194
+									$this->subsets[ ] = $value;
195 195
 								}
196 196
 							} else {
197 197
 								foreach ( $value as $subset ) {
198 198
 									if ( ! in_array( $subset, $this->subsets, true ) ) {
199
-										$this->subsets[] = $subset;
199
+										$this->subsets[ ] = $subset;
200 200
 									}
201 201
 								}
202 202
 							}
@@ -231,8 +231,8 @@  discard block
 block discarded – undo
231 231
 
232 232
 			// Get all valid font variants for this font.
233 233
 			$font_variants = array();
234
-			if ( isset( $this->google_fonts[ $font ]['variants'] ) ) {
235
-				$font_variants = $this->google_fonts[ $font ]['variants'];
234
+			if ( isset( $this->google_fonts[ $font ][ 'variants' ] ) ) {
235
+				$font_variants = $this->google_fonts[ $font ][ 'variants' ];
236 236
 			}
237 237
 			foreach ( $variants as $variant ) {
238 238
 
@@ -247,10 +247,10 @@  discard block
 block discarded – undo
247 247
 
248 248
 			// Check if the selected subsets exist, even in one of the selected fonts.
249 249
 			// If they don't, then they have to be removed otherwise the link will fail.
250
-			if ( isset( $this->google_fonts[ $font ]['subsets'] ) ) {
250
+			if ( isset( $this->google_fonts[ $font ][ 'subsets' ] ) ) {
251 251
 				foreach ( $this->subsets as $subset ) {
252
-					if ( in_array( $subset, $this->google_fonts[ $font ]['subsets'], true ) ) {
253
-						$valid_subsets[] = $subset;
252
+					if ( in_array( $subset, $this->google_fonts[ $font ][ 'subsets' ], true ) ) {
253
+						$valid_subsets[ ] = $subset;
254 254
 					}
255 255
 				}
256 256
 			}
Please login to merge, or discard this patch.
modules/webfonts/class-kirki-modules-webfonts-async.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -85,7 +85,7 @@
 block discarded – undo
85 85
 					$weights[ $key ] = '400i';
86 86
 				}
87 87
 			}
88
-			$fonts_to_load[] = $font . ':' . join( ',', $weights );
88
+			$fonts_to_load[ ] = $font . ':' . join( ',', $weights );
89 89
 		}
90 90
 		wp_enqueue_script( 'webfont-loader', 'https://ajax.googleapis.com/ajax/libs/webfont/1.6.26/webfont.js', array(), KIRKI_VERSION );
91 91
 		if ( empty( $fonts_to_load ) ) {
Please login to merge, or discard this patch.
modules/webfonts/class-kirki-fonts.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -126,12 +126,12 @@
 block discarded – undo
126 126
 
127 127
 			$google_fonts = array();
128 128
 			if ( is_array( $fonts ) ) {
129
-				foreach ( $fonts['items'] as $font ) {
130
-					$google_fonts[ $font['family'] ] = array(
131
-						'label'    => $font['family'],
132
-						'variants' => $font['variants'],
133
-						'subsets'  => $font['subsets'],
134
-						'category' => $font['category'],
129
+				foreach ( $fonts[ 'items' ] as $font ) {
130
+					$google_fonts[ $font[ 'family' ] ] = array(
131
+						'label'    => $font[ 'family' ],
132
+						'variants' => $font[ 'variants' ],
133
+						'subsets'  => $font[ 'subsets' ],
134
+						'category' => $font[ 'category' ],
135 135
 					);
136 136
 				}
137 137
 			}
Please login to merge, or discard this patch.
modules/webfonts/class-kirki-modules-webfonts-link.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 		$this->webfonts    = $webfonts;
75 75
 		$this->googlefonts = $googlefonts;
76 76
 
77
-		if ( ! isset( $args['enqueue'] ) || false !== $args['enqueue'] ) {
77
+		if ( ! isset( $args[ 'enqueue' ] ) || false !== $args[ 'enqueue' ] ) {
78 78
 			add_action( 'wp_enqueue_scripts', array( $this, 'enqueue' ), 105 );
79 79
 		}
80 80
 	}
@@ -124,15 +124,15 @@  discard block
 block discarded – undo
124 124
 			if ( ! empty( $variants ) ) {
125 125
 				$link_font .= ':' . $variants;
126 126
 			}
127
-			$link_fonts[] = $link_font;
127
+			$link_fonts[ ] = $link_font;
128 128
 		}
129 129
 
130 130
 		// Are we force-loading all subsets?
131 131
 		if ( true === Kirki_Fonts_Google::$force_load_all_subsets ) {
132 132
 
133
-			if ( isset( $this->googlefonts->fonts[ $font ]['subsets'] ) ) {
134
-				foreach ( $this->googlefonts->fonts[ $font ]['subsets'] as $subset ) {
135
-					$this->subsets[] = $subset;
133
+			if ( isset( $this->googlefonts->fonts[ $font ][ 'subsets' ] ) ) {
134
+				foreach ( $this->googlefonts->fonts[ $font ][ 'subsets' ] as $subset ) {
135
+					$this->subsets[ ] = $subset;
136 136
 				}
137 137
 			}
138 138
 		}
Please login to merge, or discard this patch.
modules/loading/class-kirki-modules-loading.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@
 block discarded – undo
63 63
 		}
64 64
 		// Allow disabling the custom loader using the kirki/config filter.
65 65
 		$config = apply_filters( 'kirki/config', array() );
66
-		if ( isset( $config['disable_loader'] ) && true === $config['disable_loader'] ) {
66
+		if ( isset( $config[ 'disable_loader' ] ) && true === $config[ 'disable_loader' ] ) {
67 67
 			return;
68 68
 		}
69 69
 		// Add the "loading" icon.
Please login to merge, or discard this patch.
modules/collapsible/class-kirki-modules-collapsible.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -72,8 +72,8 @@
 block discarded – undo
72 72
 		$collapsible_fields = array();
73 73
 		$fields = Kirki::$fields;
74 74
 		foreach ( $fields as $field ) {
75
-			if ( isset( $field['collapsible'] ) && true === $field['collapsible'] && isset( $field['settings'] ) && isset( $field['label'] ) ) {
76
-				$collapsible_fields[ $field['settings'] ] = $field['label'];
75
+			if ( isset( $field[ 'collapsible' ] ) && true === $field[ 'collapsible' ] && isset( $field[ 'settings' ] ) && isset( $field[ 'label' ] ) ) {
76
+				$collapsible_fields[ $field[ 'settings' ] ] = $field[ 'label' ];
77 77
 			}
78 78
 		}
79 79
 		$collapsible_fields = array_unique( $collapsible_fields );
Please login to merge, or discard this patch.