Passed
Push — trunk ( 4f92ea...77f588 )
by Justin
03:19
created
includes/types/CMB2_Type_Textarea.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
 		), $args );
33 33
 
34 34
 		return $this->rendered(
35
-			sprintf( '<textarea%s>%s</textarea>%s', $this->concat_attrs( $a, array( 'desc', 'value' ) ), $a['value'], $a['desc'] )
35
+			sprintf( '<textarea%s>%s</textarea>%s', $this->concat_attrs( $a, array( 'desc', 'value' ) ), $a[ 'value' ], $a[ 'desc' ] )
36 36
 		);
37 37
 	}
38 38
 }
Please login to merge, or discard this patch.
includes/types/CMB2_Type_Base.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 	 */
43 43
 	public function __construct( CMB2_Types $types, $args = array() ) {
44 44
 		$this->types = $types;
45
-		$args['rendered'] = isset( $args['rendered'] ) ? (bool) $args['rendered'] : true;
45
+		$args[ 'rendered' ] = isset( $args[ 'rendered' ] ) ? (bool) $args[ 'rendered' ] : true;
46 46
 		$this->args = $args;
47 47
 	}
48 48
 
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	public function rendered( $rendered ) {
65 65
 		$this->field->register_js_data();
66 66
 
67
-		if ( $this->args['rendered'] ) {
67
+		if ( $this->args[ 'rendered' ] ) {
68 68
 			return is_a( $rendered, __CLASS__ ) ? $rendered->rendered : $rendered;
69 69
 		}
70 70
 
@@ -109,8 +109,8 @@  discard block
 block discarded – undo
109 109
 
110 110
 		$args = wp_parse_args( $args, $type_defaults );
111 111
 
112
-		if ( ! empty( $args['js_dependencies'] ) ) {
113
-			$this->field->add_js_dependencies( $args['js_dependencies'] );
112
+		if ( ! empty( $args[ 'js_dependencies' ] ) ) {
113
+			$this->field->add_js_dependencies( $args[ 'js_dependencies' ] );
114 114
 		}
115 115
 
116 116
 		return $args;
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 		$type_overrides = empty( $type_overrides ) ? $this->args : $type_overrides;
128 128
 
129 129
 		if ( true !== $this->field->args( 'disable_hash_data_attribute' ) ) {
130
-			$type_overrides['data-hash'] = $this->field->hash_id();
130
+			$type_overrides[ 'data-hash' ] = $this->field->hash_id();
131 131
 		}
132 132
 
133 133
 		$field_overrides = $this->field->args( 'attributes' );
Please login to merge, or discard this patch.
includes/types/CMB2_Type_Text.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@
 block discarded – undo
52 52
 		), $args );
53 53
 
54 54
 		return $this->rendered(
55
-			sprintf( '<input%s/>%s', $this->concat_attrs( $a, array( 'desc' ) ), $a['desc'] )
55
+			sprintf( '<input%s/>%s', $this->concat_attrs( $a, array( 'desc' ) ), $a[ 'desc' ] )
56 56
 		);
57 57
 	}
58 58
 }
Please login to merge, or discard this patch.
includes/CMB2_Utils.php 1 patch
Spacing   +40 added lines, -41 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 		$dir = wp_upload_dir();
41 41
 
42 42
 		// Is URL in uploads directory?
43
-		if ( false === strpos( $img_url, $dir['baseurl'] . '/' ) ) {
43
+		if ( false === strpos( $img_url, $dir[ 'baseurl' ] . '/' ) ) {
44 44
 			return false;
45 45
 		}
46 46
 
@@ -65,8 +65,8 @@  discard block
 block discarded – undo
65 65
 
66 66
 			foreach ( $query->posts as $post_id ) {
67 67
 				$meta = wp_get_attachment_metadata( $post_id );
68
-				$original_file       = basename( $meta['file'] );
69
-				$cropped_image_files = isset( $meta['sizes'] ) ? wp_list_pluck( $meta['sizes'], 'file' ) : array();
68
+				$original_file       = basename( $meta[ 'file' ] );
69
+				$cropped_image_files = isset( $meta[ 'sizes' ] ) ? wp_list_pluck( $meta[ 'sizes' ], 'file' ) : array();
70 70
 				if ( $original_file === $file || in_array( $file, $cropped_image_files ) ) {
71 71
 					$attachment_id = $post_id;
72 72
 					break;
@@ -128,31 +128,31 @@  discard block
 block discarded – undo
128 128
 			foreach ( $image_sizes as $_size => $data ) {
129 129
 
130 130
 				// If there's an exact match to an existing image size, short circuit.
131
-				if ( $data['width'] == $size[0] && $data['height'] == $size[1] ) {
132
-					$candidates[ $data['width'] * $data['height'] ] = array( $_size, $data );
131
+				if ( $data[ 'width' ] == $size[ 0 ] && $data[ 'height' ] == $size[ 1 ] ) {
132
+					$candidates[ $data[ 'width' ] * $data[ 'height' ] ] = array( $_size, $data );
133 133
 					break;
134 134
 				}
135 135
 
136 136
 				// If it's not an exact match, consider larger sizes with the same aspect ratio.
137
-				if ( $data['width'] >= $size[0] && $data['height'] >= $size[1] ) {
137
+				if ( $data[ 'width' ] >= $size[ 0 ] && $data[ 'height' ] >= $size[ 1 ] ) {
138 138
 
139 139
 					/*
140 140
 					 * To test for varying crops, we constrain the dimensions of the larger image
141 141
 					 * to the dimensions of the smaller image and see if they match.
142 142
 					 */
143
-					if ( $data['width'] > $size[0] ) {
144
-						$constrained_size = wp_constrain_dimensions( $data['width'], $data['height'], $size[0] );
145
-						$expected_size = array( $size[0], $size[1] );
143
+					if ( $data[ 'width' ] > $size[ 0 ] ) {
144
+						$constrained_size = wp_constrain_dimensions( $data[ 'width' ], $data[ 'height' ], $size[ 0 ] );
145
+						$expected_size = array( $size[ 0 ], $size[ 1 ] );
146 146
 					} else {
147
-						$constrained_size = wp_constrain_dimensions( $size[0], $size[1], $data['width'] );
148
-						$expected_size = array( $data['width'], $data['height'] );
147
+						$constrained_size = wp_constrain_dimensions( $size[ 0 ], $size[ 1 ], $data[ 'width' ] );
148
+						$expected_size = array( $data[ 'width' ], $data[ 'height' ] );
149 149
 					}
150 150
 
151 151
 					// If the image dimensions are within 1px of the expected size, we consider it a match.
152
-					$matched = ( abs( $constrained_size[0] - $expected_size[0] ) <= 1 && abs( $constrained_size[1] - $expected_size[1] ) <= 1 );
152
+					$matched = ( abs( $constrained_size[ 0 ] - $expected_size[ 0 ] ) <= 1 && abs( $constrained_size[ 1 ] - $expected_size[ 1 ] ) <= 1 );
153 153
 
154 154
 					if ( $matched ) {
155
-						$candidates[ $data['width'] * $data['height'] ] = array( $_size, $data );
155
+						$candidates[ $data[ 'width' ] * $data[ 'height' ] ] = array( $_size, $data );
156 156
 					}
157 157
 				}
158 158
 			}
@@ -164,8 +164,8 @@  discard block
 block discarded – undo
164 164
 				}
165 165
 
166 166
 				$data = array_shift( $candidates );
167
-				$data = $data[0];
168
-			} elseif ( ! empty( $image_sizes['thumbnail'] ) && $image_sizes['thumbnail']['width'] >= $size[0] && $image_sizes['thumbnail']['width'] >= $size[1] ) {
167
+				$data = $data[ 0 ];
168
+			} elseif ( ! empty( $image_sizes[ 'thumbnail' ] ) && $image_sizes[ 'thumbnail' ][ 'width' ] >= $size[ 0 ] && $image_sizes[ 'thumbnail' ][ 'width' ] >= $size[ 1 ] ) {
169 169
 				/*
170 170
 				 * When the size requested is smaller than the thumbnail dimensions, we
171 171
 				 * fall back to the thumbnail size.
@@ -259,8 +259,7 @@  discard block
 block discarded – undo
259 259
 		}
260 260
 
261 261
 		return self::is_valid_time_stamp( $string )
262
-			? (int) $string :
263
-			strtotime( (string) $string );
262
+			? (int) $string : strtotime( (string) $string );
264 263
 	}
265 264
 
266 265
 	/**
@@ -467,27 +466,27 @@  discard block
 block discarded – undo
467 466
 
468 467
 		// order is relevant here, since the replacement will be done sequentially.
469 468
 		$supported_options = array(
470
-			'd'    => 'dd',  // Day, leading 0
471
-			'j'    => 'd',   // Day, no 0
472
-			'z'    => 'o',   // Day of the year, no leading zeroes,
469
+			'd'    => 'dd', // Day, leading 0
470
+			'j'    => 'd', // Day, no 0
471
+			'z'    => 'o', // Day of the year, no leading zeroes,
473 472
 			// 'D' => 'D',   // Day name short, not sure how it'll work with translations
474
-			'l '   => 'DD ',  // Day name full, idem before
475
-			'l, '  => 'DD, ',  // Day name full, idem before
476
-			'm'    => 'mm',  // Month of the year, leading 0
477
-			'n'    => 'm',   // Month of the year, no leading 0
473
+			'l '   => 'DD ', // Day name full, idem before
474
+			'l, '  => 'DD, ', // Day name full, idem before
475
+			'm'    => 'mm', // Month of the year, leading 0
476
+			'n'    => 'm', // Month of the year, no leading 0
478 477
 			// 'M' => 'M',   // Month, Short name
479
-			'F '   => 'MM ',  // Month, full name,
480
-			'F, '  => 'MM, ',  // Month, full name,
481
-			'y'    => 'y',   // Year, two digit
482
-			'Y'    => 'yy',  // Year, full
483
-			'H'    => 'HH',  // Hour with leading 0 (24 hour)
484
-			'G'    => 'H',   // Hour with no leading 0 (24 hour)
485
-			'h'    => 'hh',  // Hour with leading 0 (12 hour)
486
-			'g'    => 'h',   // Hour with no leading 0 (12 hour),
487
-			'i'    => 'mm',  // Minute with leading 0,
488
-			's'    => 'ss',  // Second with leading 0,
489
-			'a'    => 'tt',  // am/pm
490
-			'A'    => 'TT',// AM/PM
478
+			'F '   => 'MM ', // Month, full name,
479
+			'F, '  => 'MM, ', // Month, full name,
480
+			'y'    => 'y', // Year, two digit
481
+			'Y'    => 'yy', // Year, full
482
+			'H'    => 'HH', // Hour with leading 0 (24 hour)
483
+			'G'    => 'H', // Hour with no leading 0 (24 hour)
484
+			'h'    => 'hh', // Hour with leading 0 (12 hour)
485
+			'g'    => 'h', // Hour with no leading 0 (12 hour),
486
+			'i'    => 'mm', // Minute with leading 0,
487
+			's'    => 'ss', // Second with leading 0,
488
+			'a'    => 'tt', // am/pm
489
+			'A'    => 'TT', // AM/PM
491 490
 		);
492 491
 
493 492
 		foreach ( $supported_options as $php => $js ) {
@@ -496,8 +495,8 @@  discard block
 block discarded – undo
496 495
 		}
497 496
 
498 497
 		$supported_options = array(
499
-			'l' => 'DD',  // Day name full, idem before
500
-			'F' => 'MM',  // Month, full name,
498
+			'l' => 'DD', // Day name full, idem before
499
+			'F' => 'MM', // Month, full name,
501 500
 		);
502 501
 
503 502
 		if ( isset( $supported_options[ $format ] ) ) {
@@ -517,7 +516,7 @@  discard block
 block discarded – undo
517 516
 	 * @return string Modified value
518 517
 	 */
519 518
 	public static function wrap_escaped_chars( $value ) {
520
-		return '&#39;' . str_replace( '\\', '', $value[0] ) . '&#39;';
519
+		return '&#39;' . str_replace( '\\', '', $value[ 0 ] ) . '&#39;';
521 520
 	}
522 521
 
523 522
 	/**
@@ -580,8 +579,8 @@  discard block
 block discarded – undo
580 579
 	 * @return string               String of attributes for form element.
581 580
 	 */
582 581
 	public static function concat_attrs( $attrs, $attr_exclude = array() ) {
583
-		$attr_exclude[] = 'rendered';
584
-		$attr_exclude[] = 'js_dependencies';
582
+		$attr_exclude[ ] = 'rendered';
583
+		$attr_exclude[ ] = 'js_dependencies';
585 584
 
586 585
 		$attributes = '';
587 586
 		foreach ( $attrs as $attr => $val ) {
Please login to merge, or discard this patch.