Completed
Push — trunk ( 972cb3...3e2b5c )
by
unknown
896:19 queued 880:55
created
includes/CMB2_Types.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 
54 54
 		// Check for methods to be proxied to the CMB2_Type_Base object.
55 55
 		if ( $exists = $this->maybe_proxy_method( $fieldtype, $arguments ) ) {
56
-			return $exists['value'];
56
+			return $exists[ 'value' ];
57 57
 		}
58 58
 
59 59
 		// Check for custom field type class.
@@ -481,8 +481,8 @@  discard block
 block discarded – undo
481 481
 			'class' => 'cmb2-hidden',
482 482
 		);
483 483
 		if ( $this->field->group ) {
484
-			$args['data-groupid'] = $this->field->group->id();
485
-			$args['data-iterator'] = $this->iterator;
484
+			$args[ 'data-groupid' ] = $this->field->group->id();
485
+			$args[ 'data-iterator' ] = $this->iterator;
486 486
 		}
487 487
 
488 488
 		return $this->get_new_render_type( __FUNCTION__, 'CMB2_Type_Text', $args, 'input' )->render();
Please login to merge, or discard this patch.
includes/types/CMB2_Type_Select_Timezone.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
 
15 15
 	public function render() {
16 16
 
17
-		$this->field->args['default'] = $this->field->get_default()
17
+		$this->field->args[ 'default' ] = $this->field->get_default()
18 18
 			? $this->field->get_default()
19 19
 			: CMB2_Utils::timezone_string();
20 20
 
Please login to merge, or discard this patch.
includes/types/CMB2_Type_Taxonomy_Multicheck.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@
 block discarded – undo
36 36
 				);
37 37
 
38 38
 				if ( is_array( $saved_terms ) && in_array( $term->slug, $saved_terms ) ) {
39
-					$args['checked'] = 'checked';
39
+					$args[ 'checked' ] = 'checked';
40 40
 				}
41 41
 				$options .= $this->list_input( $args, $i );
42 42
 				$i++;
Please login to merge, or discard this patch.
includes/types/CMB2_Type_File_Base.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -55,11 +55,11 @@  discard block
 block discarded – undo
55 55
 	 */
56 56
 	public function img_status_output( $args ) {
57 57
 		return sprintf( '<%1$s class="img-status cmb2-media-item">%2$s<p class="cmb2-remove-wrapper"><a href="#" class="cmb2-remove-file-button"%3$s>%4$s</a></p>%5$s</%1$s>',
58
-			$args['tag'],
59
-			$args['image'],
60
-			isset( $args['cached_id'] ) ? ' rel="' . $args['cached_id'] . '"' : '',
58
+			$args[ 'tag' ],
59
+			$args[ 'image' ],
60
+			isset( $args[ 'cached_id' ] ) ? ' rel="' . $args[ 'cached_id' ] . '"' : '',
61 61
 			esc_html( $this->_text( 'remove_image_text', esc_html__( 'Remove Image', 'cmb2' ) ) ),
62
-			isset( $args['id_input'] ) ? $args['id_input'] : ''
62
+			isset( $args[ 'id_input' ] ) ? $args[ 'id_input' ] : ''
63 63
 		);
64 64
 	}
65 65
 
@@ -71,14 +71,14 @@  discard block
 block discarded – undo
71 71
 	 */
72 72
 	public function file_status_output( $args ) {
73 73
 		return sprintf( '<%1$s class="file-status cmb2-media-item"><span>%2$s <strong>%3$s</strong></span>&nbsp;&nbsp; (<a href="%4$s" target="_blank" rel="external">%5$s</a> / <a href="#" class="cmb2-remove-file-button"%6$s>%7$s</a>)%8$s</%1$s>',
74
-			$args['tag'],
74
+			$args[ 'tag' ],
75 75
 			esc_html( $this->_text( 'file_text', esc_html__( 'File:', 'cmb2' ) ) ),
76
-			CMB2_Utils::get_file_name_from_path( $args['value'] ),
77
-			$args['value'],
76
+			CMB2_Utils::get_file_name_from_path( $args[ 'value' ] ),
77
+			$args[ 'value' ],
78 78
 			esc_html( $this->_text( 'file_download_text', esc_html__( 'Download', 'cmb2' ) ) ),
79
-			isset( $args['cached_id'] ) ? ' rel="' . $args['cached_id'] . '"' : '',
79
+			isset( $args[ 'cached_id' ] ) ? ' rel="' . $args[ 'cached_id' ] . '"' : '',
80 80
 			esc_html( $this->_text( 'remove_text', esc_html__( 'Remove', 'cmb2' ) ) ),
81
-			isset( $args['id_input'] ) ? $args['id_input'] : ''
81
+			isset( $args[ 'id_input' ] ) ? $args[ 'id_input' ] : ''
82 82
 		);
83 83
 	}
84 84
 
@@ -103,13 +103,13 @@  discard block
 block discarded – undo
103 103
 		$data = array();
104 104
 
105 105
 		if ( is_array( $img_size ) ) {
106
-			$data['width']  = intval( $img_size[0] );
107
-			$data['height'] = intval( $img_size[1] );
108
-			$data['name']   = '';
106
+			$data[ 'width' ]  = intval( $img_size[ 0 ] );
107
+			$data[ 'height' ] = intval( $img_size[ 1 ] );
108
+			$data[ 'name' ]   = '';
109 109
 
110 110
 			// Try and get the closest named size from our array of dimensions
111 111
 			if ( $named_size = CMB2_Utils::get_named_size( $img_size ) ) {
112
-				$data['name'] = $named_size;
112
+				$data[ 'name' ] = $named_size;
113 113
 			}
114 114
 		} else {
115 115
 
@@ -126,9 +126,9 @@  discard block
 block discarded – undo
126 126
 			}
127 127
 
128 128
 			// Get image dimensions from named sizes
129
-			$data['width']  = intval( $image_sizes[ $img_size ]['width'] );
130
-			$data['height'] = intval( $image_sizes[ $img_size ]['height'] );
131
-			$data['name']   = $img_size;
129
+			$data[ 'width' ]  = intval( $image_sizes[ $img_size ][ 'width' ] );
130
+			$data[ 'height' ] = intval( $image_sizes[ $img_size ][ 'height' ] );
131
+			$data[ 'name' ]   = $img_size;
132 132
 		}
133 133
 
134 134
 		return $data;
@@ -150,17 +150,17 @@  discard block
 block discarded – undo
150 150
 		foreach ( CMB2_Utils::get_available_image_sizes() as $size => $info ) {
151 151
 
152 152
 			// registered image size exists for this attachment
153
-			if ( isset( $meta['sizes'][ $size ] ) ) {
153
+			if ( isset( $meta[ 'sizes' ][ $size ] ) ) {
154 154
 
155 155
 				$attachment_url = wp_get_attachment_url( $attachment->ID );
156 156
 				$base_url = str_replace( wp_basename( $attachment_url ), '', $attachment_url );
157
-				$size_meta = $meta['sizes'][ $size ];
157
+				$size_meta = $meta[ 'sizes' ][ $size ];
158 158
 
159
-				$response['sizes'][ $size ] = array(
160
-					'url'         => $base_url . $size_meta['file'],
161
-					'height'      => $size_meta['height'],
162
-					'width'       => $size_meta['width'],
163
-					'orientation' => $size_meta['height'] > $size_meta['width'] ? 'portrait' : 'landscape',
159
+				$response[ 'sizes' ][ $size ] = array(
160
+					'url'         => $base_url . $size_meta[ 'file' ],
161
+					'height'      => $size_meta[ 'height' ],
162
+					'width'       => $size_meta[ 'width' ],
163
+					'orientation' => $size_meta[ 'height' ] > $size_meta[ 'width' ] ? 'portrait' : 'landscape',
164 164
 				);
165 165
 			}
166 166
 		}
Please login to merge, or discard this patch.
includes/CMB2_JS.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -56,24 +56,24 @@
 block discarded – undo
56 56
 		$min = $debug ? '' : '.min';
57 57
 
58 58
 		// if colorpicker
59
-		if ( ! is_admin() && isset( $dependencies['wp-color-picker'] ) ) {
59
+		if ( ! is_admin() && isset( $dependencies[ 'wp-color-picker' ] ) ) {
60 60
 			self::colorpicker_frontend();
61 61
 		}
62 62
 
63 63
 		// if file/file_list
64
-		if ( isset( $dependencies['media-editor'] ) ) {
64
+		if ( isset( $dependencies[ 'media-editor' ] ) ) {
65 65
 			wp_enqueue_media();
66 66
 			CMB2_Type_File_Base::output_js_underscore_templates();
67 67
 		}
68 68
 
69 69
 		// if timepicker
70
-		if ( isset( $dependencies['jquery-ui-datetimepicker'] ) ) {
70
+		if ( isset( $dependencies[ 'jquery-ui-datetimepicker' ] ) ) {
71 71
 			wp_register_script( 'jquery-ui-datetimepicker', CMB2_Utils::url( 'js/jquery-ui-timepicker-addon.min.js' ), array( 'jquery-ui-slider' ), CMB2_VERSION );
72 72
 		}
73 73
 
74 74
 		// if cmb2-wysiwyg
75
-		$enqueue_wysiwyg = isset( $dependencies['cmb2-wysiwyg'] ) && $debug;
76
-		unset( $dependencies['cmb2-wysiwyg'] );
75
+		$enqueue_wysiwyg = isset( $dependencies[ 'cmb2-wysiwyg' ] ) && $debug;
76
+		unset( $dependencies[ 'cmb2-wysiwyg' ] );
77 77
 
78 78
 		// Enqueue cmb JS
79 79
 		wp_enqueue_script( self::$handle, CMB2_Utils::url( "js/cmb2{$min}.js" ), $dependencies, CMB2_VERSION, true );
Please login to merge, or discard this patch.
includes/rest-api/CMB2_REST.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -154,30 +154,30 @@  discard block
 block discarded – undo
154 154
 		foreach ( self::$boxes as $cmb_id => $rest_box ) {
155 155
 			$types = array_flip( $rest_box->cmb->box_types() );
156 156
 
157
-			if ( isset( $types['user'] ) ) {
158
-				unset( $types['user'] );
159
-				self::$type_boxes['user'][ $cmb_id ] = $cmb_id;
157
+			if ( isset( $types[ 'user' ] ) ) {
158
+				unset( $types[ 'user' ] );
159
+				self::$type_boxes[ 'user' ][ $cmb_id ] = $cmb_id;
160 160
 			}
161 161
 
162
-			if ( isset( $types['comment'] ) ) {
163
-				unset( $types['comment'] );
164
-				self::$type_boxes['comment'][ $cmb_id ] = $cmb_id;
162
+			if ( isset( $types[ 'comment' ] ) ) {
163
+				unset( $types[ 'comment' ] );
164
+				self::$type_boxes[ 'comment' ][ $cmb_id ] = $cmb_id;
165 165
 			}
166 166
 
167
-			if ( isset( $types['term'] ) ) {
168
-				unset( $types['term'] );
167
+			if ( isset( $types[ 'term' ] ) ) {
168
+				unset( $types[ 'term' ] );
169 169
 
170 170
 				$taxonomies = array_merge(
171 171
 					$taxonomies,
172 172
 					CMB2_Utils::ensure_array( $rest_box->cmb->prop( 'taxonomies' ) )
173 173
 				);
174 174
 
175
-				self::$type_boxes['term'][ $cmb_id ] = $cmb_id;
175
+				self::$type_boxes[ 'term' ][ $cmb_id ] = $cmb_id;
176 176
 			}
177 177
 
178 178
 			if ( ! empty( $types ) ) {
179 179
 				$alltypes = array_merge( $alltypes, array_flip( $types ) );
180
-				self::$type_boxes['post'][ $cmb_id ] = $cmb_id;
180
+				self::$type_boxes[ 'post' ][ $cmb_id ] = $cmb_id;
181 181
 			}
182 182
 		}
183 183
 
@@ -187,15 +187,15 @@  discard block
 block discarded – undo
187 187
 			self::register_rest_field( $alltypes, 'post' );
188 188
 		}
189 189
 
190
-		if ( ! empty( self::$type_boxes['user'] ) ) {
190
+		if ( ! empty( self::$type_boxes[ 'user' ] ) ) {
191 191
 			self::register_rest_field( 'user', 'user' );
192 192
 		}
193 193
 
194
-		if ( ! empty( self::$type_boxes['comment'] ) ) {
194
+		if ( ! empty( self::$type_boxes[ 'comment' ] ) ) {
195 195
 			self::register_rest_field( 'comment', 'comment' );
196 196
 		}
197 197
 
198
-		if ( ! empty( self::$type_boxes['term'] ) ) {
198
+		if ( ! empty( self::$type_boxes[ 'term' ] ) ) {
199 199
 			self::register_rest_field( $taxonomies, 'term' );
200 200
 		}
201 201
 	}
@@ -228,18 +228,18 @@  discard block
 block discarded – undo
228 228
 	 */
229 229
 	protected function declare_read_edit_fields() {
230 230
 		foreach ( $this->cmb->prop( 'fields' ) as $field ) {
231
-			$show_in_rest = isset( $field['show_in_rest'] ) ? $field['show_in_rest'] : null;
231
+			$show_in_rest = isset( $field[ 'show_in_rest' ] ) ? $field[ 'show_in_rest' ] : null;
232 232
 
233 233
 			if ( false === $show_in_rest ) {
234 234
 				continue;
235 235
 			}
236 236
 
237 237
 			if ( $this->can_read( $show_in_rest ) ) {
238
-				$this->read_fields[] = $field['id'];
238
+				$this->read_fields[ ] = $field[ 'id' ];
239 239
 			}
240 240
 
241 241
 			if ( $this->can_edit( $show_in_rest ) ) {
242
-				$this->edit_fields[] = $field['id'];
242
+				$this->edit_fields[ ] = $field[ 'id' ];
243 243
 			}
244 244
 		}
245 245
 	}
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
 	 * @return mixed
370 370
 	 */
371 371
 	protected static function get_rest_values( $object, $request, $object_type, $main_object_type = 'post' ) {
372
-		if ( ! isset( $object['id'] ) ) {
372
+		if ( ! isset( $object[ 'id' ] ) ) {
373 373
 			return;
374 374
 		}
375 375
 
@@ -380,12 +380,12 @@  discard block
 block discarded – undo
380 380
 				$rest_box = self::$boxes[ $cmb_id ];
381 381
 
382 382
 				foreach ( $rest_box->read_fields as $field_id ) {
383
-					$rest_box->cmb->object_id( $object['id'] );
383
+					$rest_box->cmb->object_id( $object[ 'id' ] );
384 384
 					$rest_box->cmb->object_type( $main_object_type );
385 385
 
386 386
 					$field = $rest_box->cmb->get_field( $field_id );
387 387
 
388
-					$field->object_id( $object['id'] );
388
+					$field->object_id( $object[ 'id' ] );
389 389
 					$field->object_type( $main_object_type );
390 390
 
391 391
 					$values[ $cmb_id ][ $field->id( true ) ] = $field->get_data();
@@ -619,8 +619,8 @@  discard block
 block discarded – undo
619 619
 					return intval( $object->comment_ID );
620 620
 				}
621 621
 			case 'term':
622
-				if ( is_array( $object ) && isset( $object['term_id'] ) ) {
623
-					return intval( $object['term_id'] );
622
+				if ( is_array( $object ) && isset( $object[ 'term_id' ] ) ) {
623
+					return intval( $object[ 'term_id' ] );
624 624
 				} elseif ( isset( $object->term_id ) ) {
625 625
 					return intval( $object->term_id );
626 626
 				}
Please login to merge, or discard this patch.
includes/CMB2_Utils.php 1 patch
Spacing   +33 added lines, -34 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.
@@ -260,8 +260,7 @@  discard block
 block discarded – undo
260 260
 		}
261 261
 
262 262
 		return self::is_valid_time_stamp( $string )
263
-			? (int) $string :
264
-			strtotime( (string) $string );
263
+			? (int) $string : strtotime( (string) $string );
265 264
 	}
266 265
 
267 266
 	/**
@@ -457,25 +456,25 @@  discard block
 block discarded – undo
457 456
 
458 457
 		// order is relevant here, since the replacement will be done sequentially.
459 458
 		$supported_options = array(
460
-			'd' => 'dd',  // Day, leading 0
461
-			'j' => 'd',   // Day, no 0
462
-			'z' => 'o',   // Day of the year, no leading zeroes,
459
+			'd' => 'dd', // Day, leading 0
460
+			'j' => 'd', // Day, no 0
461
+			'z' => 'o', // Day of the year, no leading zeroes,
463 462
 			// 'D' => 'D',   // Day name short, not sure how it'll work with translations
464 463
 			// 'l' => 'DD',  // Day name full, idem before
465
-			'm' => 'mm',  // Month of the year, leading 0
466
-			'n' => 'm',   // Month of the year, no leading 0
464
+			'm' => 'mm', // Month of the year, leading 0
465
+			'n' => 'm', // Month of the year, no leading 0
467 466
 			// 'M' => 'M',   // Month, Short name
468 467
 			// 'F' => 'MM',  // Month, full name,
469
-			'y' => 'y',   // Year, two digit
470
-			'Y' => 'yy',  // Year, full
471
-			'H' => 'HH',  // Hour with leading 0 (24 hour)
472
-			'G' => 'H',   // Hour with no leading 0 (24 hour)
473
-			'h' => 'hh',  // Hour with leading 0 (12 hour)
474
-			'g' => 'h',   // Hour with no leading 0 (12 hour),
475
-			'i' => 'mm',  // Minute with leading 0,
476
-			's' => 'ss',  // Second with leading 0,
477
-			'a' => 'tt',  // am/pm
478
-			'A' => 'TT',// AM/PM
468
+			'y' => 'y', // Year, two digit
469
+			'Y' => 'yy', // Year, full
470
+			'H' => 'HH', // Hour with leading 0 (24 hour)
471
+			'G' => 'H', // Hour with no leading 0 (24 hour)
472
+			'h' => 'hh', // Hour with leading 0 (12 hour)
473
+			'g' => 'h', // Hour with no leading 0 (12 hour),
474
+			'i' => 'mm', // Minute with leading 0,
475
+			's' => 'ss', // Second with leading 0,
476
+			'a' => 'tt', // am/pm
477
+			'A' => 'TT', // AM/PM
479 478
 		);
480 479
 
481 480
 		foreach ( $supported_options as $php => $js ) {
@@ -496,7 +495,7 @@  discard block
 block discarded – undo
496 495
 	 * @return string Modified value
497 496
 	 */
498 497
 	public static function wrap_escaped_chars( $value ) {
499
-		return '&#39;' . str_replace( '\\', '', $value[0] ) . '&#39;';
498
+		return '&#39;' . str_replace( '\\', '', $value[ 0 ] ) . '&#39;';
500 499
 	}
501 500
 
502 501
 	/**
@@ -559,7 +558,7 @@  discard block
 block discarded – undo
559 558
 	 * @return string               String of attributes for form element.
560 559
 	 */
561 560
 	public static function concat_attrs( $attrs, $attr_exclude = array() ) {
562
-		$attr_exclude[] = 'rendered';
561
+		$attr_exclude[ ] = 'rendered';
563 562
 		$attributes = '';
564 563
 		foreach ( $attrs as $attr => $val ) {
565 564
 			$excluded = in_array( $attr, (array) $attr_exclude, true );
Please login to merge, or discard this patch.
includes/helper-functions.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -96,18 +96,18 @@  discard block
 block discarded – undo
96 96
 	$oembed = cmb2_ajax()->get_oembed_no_edit( $args );
97 97
 
98 98
 	// Send back our embed
99
-	if ( $oembed['embed'] && $oembed['embed'] != $oembed['fallback'] ) {
100
-		return '<div class="cmb2-oembed">' . $oembed['embed'] . '</div>';
99
+	if ( $oembed[ 'embed' ] && $oembed[ 'embed' ] != $oembed[ 'fallback' ] ) {
100
+		return '<div class="cmb2-oembed">' . $oembed[ 'embed' ] . '</div>';
101 101
 	}
102 102
 
103 103
 	$error = sprintf(
104 104
 		/* translators: 1: results for. 2: link to codex.wordpress.org/Embeds */
105 105
 		esc_html__( 'No oEmbed Results Found for %1$s. View more info at %2$s.', 'cmb2' ),
106
-		$oembed['fallback'],
106
+		$oembed[ 'fallback' ],
107 107
 		'<a href="https://codex.wordpress.org/Embeds" target="_blank">codex.wordpress.org/Embeds</a>'
108 108
 	);
109 109
 
110
-	if ( isset( $args['wp_error'] ) && $args['wp_error'] ) {
110
+	if ( isset( $args[ 'wp_error' ] ) && $args[ 'wp_error' ] ) {
111 111
 		return new WP_Error( 'cmb2_get_oembed_result', $error, compact( 'oembed', 'args' ) );
112 112
 	}
113 113
 
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 		$cmb = CMB2_Boxes::get( $meta_box );
230 230
 	} else {
231 231
 		// See if we already have an instance of this metabox
232
-		$cmb = CMB2_Boxes::get( $meta_box['id'] );
232
+		$cmb = CMB2_Boxes::get( $meta_box[ 'id' ] );
233 233
 		// If not, we'll initate a new metabox
234 234
 		$cmb = $cmb ? $cmb : new CMB2( $meta_box, $object_id );
235 235
 	}
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
 	) );
308 308
 
309 309
 	// Set object type explicitly (rather than trying to guess from context)
310
-	$cmb->object_type( $args['object_type'] );
310
+	$cmb->object_type( $args[ 'object_type' ] );
311 311
 
312 312
 	// Save the metabox if it's been submitted
313 313
 	// check permissions
@@ -315,32 +315,32 @@  discard block
 block discarded – undo
315 315
 	if (
316 316
 		$cmb->prop( 'save_fields' )
317 317
 		// check nonce
318
-		&& isset( $_POST['submit-cmb'], $_POST['object_id'], $_POST[ $cmb->nonce() ] )
318
+		&& isset( $_POST[ 'submit-cmb' ], $_POST[ 'object_id' ], $_POST[ $cmb->nonce() ] )
319 319
 		&& wp_verify_nonce( $_POST[ $cmb->nonce() ], $cmb->nonce() )
320
-		&& $object_id && $_POST['object_id'] == $object_id
320
+		&& $object_id && $_POST[ 'object_id' ] == $object_id
321 321
 	) {
322 322
 		$cmb->save_fields( $object_id, $cmb->object_type(), $_POST );
323 323
 	}
324 324
 
325 325
 	// Enqueue JS/CSS
326
-	if ( $args['cmb_styles'] ) {
326
+	if ( $args[ 'cmb_styles' ] ) {
327 327
 		CMB2_hookup::enqueue_cmb_css();
328 328
 	}
329 329
 
330
-	if ( $args['enqueue_js'] ) {
330
+	if ( $args[ 'enqueue_js' ] ) {
331 331
 		CMB2_hookup::enqueue_cmb_js();
332 332
 	}
333 333
 
334
-	$form_format = apply_filters( 'cmb2_get_metabox_form_format', $args['form_format'], $object_id, $cmb );
334
+	$form_format = apply_filters( 'cmb2_get_metabox_form_format', $args[ 'form_format' ], $object_id, $cmb );
335 335
 
336 336
 	$format_parts = explode( '%3$s', $form_format );
337 337
 
338 338
 	// Show cmb form
339
-	printf( $format_parts[0], $cmb->cmb_id, $object_id );
339
+	printf( $format_parts[ 0 ], $cmb->cmb_id, $object_id );
340 340
 	$cmb->show_form();
341 341
 
342
-	if ( isset( $format_parts[1] ) && $format_parts[1] ) {
343
-		printf( str_ireplace( '%4$s', '%1$s', $format_parts[1] ), $args['save_button'] );
342
+	if ( isset( $format_parts[ 1 ] ) && $format_parts[ 1 ] ) {
343
+		printf( str_ireplace( '%4$s', '%1$s', $format_parts[ 1 ] ), $args[ 'save_button' ] );
344 344
 	}
345 345
 
346 346
 }
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
  * @param  array $args      Optional arguments array
355 355
  */
356 356
 function cmb2_metabox_form( $meta_box, $object_id = 0, $args = array() ) {
357
-	if ( ! isset( $args['echo'] ) || $args['echo'] ) {
357
+	if ( ! isset( $args[ 'echo' ] ) || $args[ 'echo' ] ) {
358 358
 		cmb2_print_metabox_form( $meta_box, $object_id, $args );
359 359
 	} else {
360 360
 		return cmb2_get_metabox_form( $meta_box, $object_id, $args );
@@ -393,12 +393,12 @@  discard block
 block discarded – undo
393 393
 			 * 4 or 2 characters, as needed
394 394
 			 */
395 395
 			'%04d-%02d-%02d %02d:%02d:%02d',
396
-			$parsed_time['tm_year'] + 1900,  // This will be "111", so we need to add 1900.
397
-			$parsed_time['tm_mon'] + 1,      // This will be the month minus one, so we add one.
398
-			$parsed_time['tm_mday'],
399
-			$parsed_time['tm_hour'],
400
-			$parsed_time['tm_min'],
401
-			$parsed_time['tm_sec']
396
+			$parsed_time[ 'tm_year' ] + 1900, // This will be "111", so we need to add 1900.
397
+			$parsed_time[ 'tm_mon' ] + 1, // This will be the month minus one, so we add one.
398
+			$parsed_time[ 'tm_mday' ],
399
+			$parsed_time[ 'tm_hour' ],
400
+			$parsed_time[ 'tm_min' ],
401
+			$parsed_time[ 'tm_sec' ]
402 402
 		);
403 403
 
404 404
 		return new DateTime( $ymd );
Please login to merge, or discard this patch.
includes/types/CMB2_Type_Multi_Base.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 	 * @return string       Generated option element html
21 21
 	 */
22 22
 	public function select_option( $args = array() ) {
23
-		return sprintf( "\t" . '<option value="%s" %s>%s</option>', $args['value'], selected( isset( $args['checked'] ) && $args['checked'], true, false ), $args['label'] ) . "\n";
23
+		return sprintf( "\t" . '<option value="%s" %s>%s</option>', $args[ 'value' ], selected( isset( $args[ 'checked' ] ) && $args[ 'checked' ], true, false ), $args[ 'label' ] ) . "\n";
24 24
 	}
25 25
 
26 26
 	/**
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 			'label' => '',
42 42
 		), $args );
43 43
 
44
-		return sprintf( "\t" . '<li><input%s/> <label for="%s">%s</label></li>' . "\n", $this->concat_attrs( $a, array( 'label' ) ), $a['id'], $a['label'] );
44
+		return sprintf( "\t" . '<li><input%s/> <label for="%s">%s</label></li>' . "\n", $this->concat_attrs( $a, array( 'label' ) ), $a[ 'id' ], $a[ 'label' ] );
45 45
 	}
46 46
 
47 47
 	/**
@@ -54,10 +54,10 @@  discard block
 block discarded – undo
54 54
 	 */
55 55
 	public function list_input_checkbox( $args, $i ) {
56 56
 		$saved_value = $this->field->escaped_value();
57
-		if ( is_array( $saved_value ) && in_array( $args['value'], $saved_value ) ) {
58
-			$args['checked'] = 'checked';
57
+		if ( is_array( $saved_value ) && in_array( $args[ 'value' ], $saved_value ) ) {
58
+			$args[ 'checked' ] = 'checked';
59 59
 		}
60
-		$args['type'] = 'checkbox';
60
+		$args[ 'type' ] = 'checkbox';
61 61
 		return $this->list_input( $args, $i );
62 62
 	}
63 63
 
@@ -71,8 +71,8 @@  discard block
 block discarded – undo
71 71
 	public function concat_items( $args = array() ) {
72 72
 		$field = $this->field;
73 73
 
74
-		$method = isset( $args['method'] ) ? $args['method'] : 'select_option';
75
-		unset( $args['method'] );
74
+		$method = isset( $args[ 'method' ] ) ? $args[ 'method' ] : 'select_option';
75
+		unset( $args[ 'method' ] );
76 76
 
77 77
 		$value = null !== $field->escaped_value()
78 78
 			? $field->escaped_value()
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 
88 88
 		$options = array();
89 89
 		if ( $option_none = $field->args( 'show_option_none' ) ) {
90
-			$options[''] = $option_none;
90
+			$options[ '' ] = $option_none;
91 91
 		}
92 92
 		$options = $options + (array) $field->options();
93 93
 		foreach ( $options as $opt_value => $opt_label ) {
@@ -95,12 +95,12 @@  discard block
 block discarded – undo
95 95
 			// Clone args & modify for just this item
96 96
 			$a = $args;
97 97
 
98
-			$a['value'] = $opt_value;
99
-			$a['label'] = $opt_label;
98
+			$a[ 'value' ] = $opt_value;
99
+			$a[ 'label' ] = $opt_label;
100 100
 
101 101
 			// Check if this option is the value of the input
102 102
 			if ( $value === $opt_value ) {
103
-				$a['checked'] = 'checked';
103
+				$a[ 'checked' ] = 'checked';
104 104
 			}
105 105
 
106 106
 			$concatenated_items .= $this->$method( $a, $i++ );
Please login to merge, or discard this patch.