Completed
Pull Request — develop (#1893)
by Aristeides
04:21
created
core/class-kirki-helper.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 
38 38
 		// Handle the arguments, merge one by one.
39 39
 		$args  = func_get_args();
40
-		$array = $args[0];
40
+		$array = $args[ 0 ];
41 41
 		if ( ! is_array( $array ) ) {
42 42
 			return $array;
43 43
 		}
@@ -93,27 +93,27 @@  discard block
 block discarded – undo
93 93
 
94 94
 		if ( 'ftpext' === $method ) {
95 95
 			// If defined, set it to that, Else, set to NULL.
96
-			$credentials['hostname'] = defined( 'FTP_HOST' ) ? preg_replace( '|\w+://|', '', FTP_HOST ) : null;
97
-			$credentials['username'] = defined( 'FTP_USER' ) ? FTP_USER : null;
98
-			$credentials['password'] = defined( 'FTP_PASS' ) ? FTP_PASS : null;
96
+			$credentials[ 'hostname' ] = defined( 'FTP_HOST' ) ? preg_replace( '|\w+://|', '', FTP_HOST ) : null;
97
+			$credentials[ 'username' ] = defined( 'FTP_USER' ) ? FTP_USER : null;
98
+			$credentials[ 'password' ] = defined( 'FTP_PASS' ) ? FTP_PASS : null;
99 99
 
100 100
 			// Set FTP port.
101
-			if ( strpos( $credentials['hostname'], ':' ) && null !== $credentials['hostname'] ) {
102
-				list( $credentials['hostname'], $credentials['port'] ) = explode( ':', $credentials['hostname'], 2 );
103
-				if ( ! is_numeric( $credentials['port'] ) ) {
104
-					unset( $credentials['port'] );
101
+			if ( strpos( $credentials[ 'hostname' ], ':' ) && null !== $credentials[ 'hostname' ] ) {
102
+				list( $credentials[ 'hostname' ], $credentials[ 'port' ] ) = explode( ':', $credentials[ 'hostname' ], 2 );
103
+				if ( ! is_numeric( $credentials[ 'port' ] ) ) {
104
+					unset( $credentials[ 'port' ] );
105 105
 				}
106 106
 			} else {
107
-				unset( $credentials['port'] );
107
+				unset( $credentials[ 'port' ] );
108 108
 			}
109 109
 
110 110
 			// Set connection type.
111 111
 			if ( ( defined( 'FTP_SSL' ) && FTP_SSL ) && 'ftpext' === $method ) {
112
-				$credentials['connection_type'] = 'ftps';
112
+				$credentials[ 'connection_type' ] = 'ftps';
113 113
 			} elseif ( ! array_filter( $credentials ) ) {
114
-				$credentials['connection_type'] = null;
114
+				$credentials[ 'connection_type' ] = null;
115 115
 			} else {
116
-				$credentials['connection_type'] = 'ftp';
116
+				$credentials[ 'connection_type' ] = 'ftp';
117 117
 			}
118 118
 		}
119 119
 
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 		}
152 152
 
153 153
 		if ( ! empty( $attachment ) ) {
154
-			return $attachment[0];
154
+			return $attachment[ 0 ];
155 155
 		}
156 156
 		return 0;
157 157
 	}
@@ -168,10 +168,10 @@  discard block
 block discarded – undo
168 168
 		$image    = wp_get_attachment_image_src( $image_id, 'full' );
169 169
 
170 170
 		return array(
171
-			'url'       => $image[0],
172
-			'width'     => $image[1],
173
-			'height'    => $image[2],
174
-			'thumbnail' => $image[3],
171
+			'url'       => $image[ 0 ],
172
+			'width'     => $image[ 1 ],
173
+			'height'    => $image[ 2 ],
174
+			'thumbnail' => $image[ 3 ],
175 175
 		);
176 176
 
177 177
 	}
@@ -192,8 +192,8 @@  discard block
 block discarded – undo
192 192
 					'suppress_filters' => false,
193 193
 				)
194 194
 			);
195
-		} elseif ( is_array( $args ) && ! isset( $args['suppress_filters'] ) ) {
196
-			$args['suppress_filters'] = false;
195
+		} elseif ( is_array( $args ) && ! isset( $args[ 'suppress_filters' ] ) ) {
196
+			$args[ 'suppress_filters' ] = false;
197 197
 		}
198 198
 
199 199
 		// Get the posts.
@@ -343,41 +343,41 @@  discard block
 block discarded – undo
343 343
 				$key = absint( $context ) / 100;
344 344
 				if ( 'A100' === $context ) {
345 345
 					$key = 10;
346
-					unset( $colors['grey'] );
346
+					unset( $colors[ 'grey' ] );
347 347
 				} elseif ( 'A200' === $context ) {
348 348
 					$key = 11;
349
-					unset( $colors['grey'] );
349
+					unset( $colors[ 'grey' ] );
350 350
 				} elseif ( 'A400' === $context ) {
351 351
 					$key = 12;
352
-					unset( $colors['grey'] );
352
+					unset( $colors[ 'grey' ] );
353 353
 				} elseif ( 'A700' === $context ) {
354 354
 					$key = 13;
355
-					unset( $colors['grey'] );
355
+					unset( $colors[ 'grey' ] );
356 356
 				}
357
-				unset( $colors['primary'] );
357
+				unset( $colors[ 'primary' ] );
358 358
 				$position_colors = array();
359 359
 				foreach ( $colors as $color_family ) {
360 360
 					if ( isset( $color_family[ $key ] ) ) {
361
-						$position_colors[] = $color_family[ $key ];
361
+						$position_colors[ ] = $color_family[ $key ];
362 362
 					}
363 363
 				}
364 364
 				return $position_colors;
365 365
 			case 'all':
366
-				unset( $colors['primary'] );
366
+				unset( $colors[ 'primary' ] );
367 367
 				$all_colors = array();
368 368
 				foreach ( $colors as $color_family ) {
369 369
 					foreach ( $color_family as $color ) {
370
-						$all_colors[] = $color;
370
+						$all_colors[ ] = $color;
371 371
 					}
372 372
 				}
373 373
 				return $all_colors;
374 374
 			case 'primary':
375
-				return $colors['primary'];
375
+				return $colors[ 'primary' ];
376 376
 			default:
377 377
 				if ( isset( $colors[ $context ] ) ) {
378 378
 					return $colors[ $context ];
379 379
 				}
380
-				return $colors['primary'];
380
+				return $colors[ 'primary' ];
381 381
 		} // End switch().
382 382
 	}
383 383
 
Please login to merge, or discard this patch.
modules/webfonts/class-kirki-fonts-google-local.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 		$key               = sanitize_key( $this->family );
101 101
 		$this->folder_path = $this->get_root_path() . "/$key";
102 102
 		$this->folder_url  = $this->get_root_url() . "/$key";
103
-		$this->files        = $this->get_font_family();
103
+		$this->files = $this->get_font_family();
104 104
 	}
105 105
 
106 106
 	/**
@@ -193,13 +193,13 @@  discard block
 block discarded – undo
193 193
 		}
194 194
 
195 195
 		// Return regular if the one we want could not be found.
196
-		if ( isset( $local_urls['regular'] ) ) {
197
-			return $local_urls['regular'];
196
+		if ( isset( $local_urls[ 'regular' ] ) ) {
197
+			return $local_urls[ 'regular' ];
198 198
 		}
199 199
 
200 200
 		// Return the first available if all else failed.
201 201
 		$vals = array_values( $local_urls );
202
-		return $vals[0];
202
+		return $vals[ 0 ];
203 203
 	}
204 204
 
205 205
 	/**
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
 	public function get_root_path() {
392 392
 		// Get the upload directory for this site.
393 393
 		$upload_dir = wp_upload_dir();
394
-		$path       = untrailingslashit( wp_normalize_path( $upload_dir['basedir'] ) ) . '/webfonts';
394
+		$path       = untrailingslashit( wp_normalize_path( $upload_dir[ 'basedir' ] ) ) . '/webfonts';
395 395
 
396 396
 		// If the folder doesn't exist, create it.
397 397
 		if ( ! file_exists( $path ) ) {
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
 		$upload_dir = wp_upload_dir();
417 417
 
418 418
 		// The URL.
419
-		$url = trailingslashit( $upload_dir['baseurl'] );
419
+		$url = trailingslashit( $upload_dir[ 'baseurl' ] );
420 420
 		// Take care of domain mapping.
421 421
 		// When using domain mapping we have to make sure that the URL to the file
422 422
 		// does not include the original domain but instead the mapped domain.
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -80,8 +80,10 @@
 block discarded – undo
80 80
 	 * @param string $family The font-family name.
81 81
 	 * @return Kirki_Fonts_Google_Local
82 82
 	 */
83
-	public static function do( $family ) {
83
+	public static function do {
84
+		( $family ) {
84 85
 		$key = sanitize_key( $family );
86
+	}
85 87
 		if ( ! isset( self::$instances[ $key ] ) ) {
86 88
 			self::$instances[ $key ] = new self( $family );
87 89
 		}
Please login to merge, or discard this patch.
modules/webfonts/class-kirki-modules-webfonts-local.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -91,7 +91,9 @@
 block discarded – undo
91 91
 		$fonts = array_keys( $this->googlefonts->fonts );
92 92
 		$fonts = array_unique( $fonts );
93 93
 		foreach ( $fonts as $family ) {
94
-			$css .= Kirki_Fonts_Google_Local::do( $family )->get_css();
94
+			$css .= Kirki_Fonts_Google_Local::do {
95
+				( $family )->get_css();
96
+			}
95 97
 		}
96 98
 		if ( $css ) {
97 99
 			echo '<style id="kirki-local-webfonts-' . esc_attr( sanitize_key( $this->config_id ) ) . '">' . $css . '</style>'; // WPCS: XSS ok.
Please login to merge, or discard this patch.