Completed
Pull Request — trunk (#674)
by
unknown
24:14 queued 10:31
created
includes/CMB2_Utils.php 2 patches
Spacing   +20 added lines, -21 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 		$dir = wp_upload_dir();
31 31
 
32 32
 		// Is URL in uploads directory?
33
-		if ( false === strpos( $img_url, $dir['baseurl'] . '/' ) ) {
33
+		if ( false === strpos( $img_url, $dir[ 'baseurl' ] . '/' ) ) {
34 34
 			return false;
35 35
 		}
36 36
 
@@ -55,8 +55,8 @@  discard block
 block discarded – undo
55 55
 
56 56
 			foreach ( $query->posts as $post_id ) {
57 57
 				$meta = wp_get_attachment_metadata( $post_id );
58
-				$original_file       = basename( $meta['file'] );
59
-				$cropped_image_files = isset( $meta['sizes'] ) ? wp_list_pluck( $meta['sizes'], 'file' ) : array();
58
+				$original_file       = basename( $meta[ 'file' ] );
59
+				$cropped_image_files = isset( $meta[ 'sizes' ] ) ? wp_list_pluck( $meta[ 'sizes' ], 'file' ) : array();
60 60
 				if ( $original_file === $file || in_array( $file, $cropped_image_files ) ) {
61 61
 					$attachment_id = $post_id;
62 62
 					break;
@@ -140,8 +140,7 @@  discard block
 block discarded – undo
140 140
 		}
141 141
 
142 142
 		return $this->is_valid_time_stamp( $string )
143
-			? (int) $string :
144
-			strtotime( (string) $string );
143
+			? (int) $string : strtotime( (string) $string );
145 144
 	}
146 145
 
147 146
 	/**
@@ -172,7 +171,7 @@  discard block
 block discarded – undo
172 171
 	 * @param  mixed $value Value to check
173 172
 	 * @return bool         True or false
174 173
 	 */
175
-	public function notempty( $value ){
174
+	public function notempty( $value ) {
176 175
 		return null !== $value && '' !== $value && false !== $value;
177 176
 	}
178 177
 
@@ -322,24 +321,24 @@  discard block
 block discarded – undo
322 321
 
323 322
 		// order is relevant here, since the replacement will be done sequentially.
324 323
 		$supported_options = array(
325
-			'd' => 'dd',  // Day, leading 0
326
-			'j' => 'd',   // Day, no 0
327
-			'z' => 'o',   // Day of the year, no leading zeroes,
324
+			'd' => 'dd', // Day, leading 0
325
+			'j' => 'd', // Day, no 0
326
+			'z' => 'o', // Day of the year, no leading zeroes,
328 327
 			// 'D' => 'D',   // Day name short, not sure how it'll work with translations
329 328
 			// 'l' => 'DD',  // Day name full, idem before
330
-			'm' => 'mm',  // Month of the year, leading 0
331
-			'n' => 'm',   // Month of the year, no leading 0
329
+			'm' => 'mm', // Month of the year, leading 0
330
+			'n' => 'm', // Month of the year, no leading 0
332 331
 			// 'M' => 'M',   // Month, Short name
333 332
 			// 'F' => 'MM',  // Month, full name,
334
-			'y' => 'y',   // Year, two digit
335
-			'Y' => 'yy',  // Year, full
336
-			'H' => 'HH',  // Hour with leading 0 (24 hour)
337
-			'G' => 'H',   // Hour with no leading 0 (24 hour)
338
-			'h' => 'hh',  // Hour with leading 0 (12 hour)
339
-			'g' => 'h',   // Hour with no leading 0 (12 hour),
340
-			'i' => 'mm',  // Minute with leading 0,
341
-			's' => 'ss',  // Second with leading 0,
342
-			'a' => 'tt',  // am/pm
333
+			'y' => 'y', // Year, two digit
334
+			'Y' => 'yy', // Year, full
335
+			'H' => 'HH', // Hour with leading 0 (24 hour)
336
+			'G' => 'H', // Hour with no leading 0 (24 hour)
337
+			'h' => 'hh', // Hour with leading 0 (12 hour)
338
+			'g' => 'h', // Hour with no leading 0 (12 hour),
339
+			'i' => 'mm', // Minute with leading 0,
340
+			's' => 'ss', // Second with leading 0,
341
+			'a' => 'tt', // am/pm
343 342
 			'A' => 'TT'   // AM/PM
344 343
 		);
345 344
 
@@ -360,7 +359,7 @@  discard block
 block discarded – undo
360 359
 	 * @return string Modified value
361 360
 	 */
362 361
 	public function wrap_escaped_chars( $value ) {
363
-		return "'" . str_replace( '\\', '', $value[0] ) . "'";
362
+		return "'" . str_replace( '\\', '', $value[ 0 ] ) . "'";
364 363
 	}
365 364
 
366 365
 	/**
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -115,7 +115,8 @@  discard block
 block discarded – undo
115 115
 			$tzstring = '';
116 116
 		}
117 117
 
118
-		if ( empty( $tzstring ) ) { // Create a UTC+- zone if no timezone string exists
118
+		if ( empty( $tzstring ) ) {
119
+// Create a UTC+- zone if no timezone string exists
119 120
 			if ( 0 == $current_offset ) {
120 121
 				$tzstring = 'UTC+0';
121 122
 			} elseif ( $current_offset < 0 ) {
@@ -172,7 +173,7 @@  discard block
 block discarded – undo
172 173
 	 * @param  mixed $value Value to check
173 174
 	 * @return bool         True or false
174 175
 	 */
175
-	public function notempty( $value ){
176
+	public function notempty( $value ) {
176 177
 		return null !== $value && '' !== $value && false !== $value;
177 178
 	}
178 179
 
Please login to merge, or discard this patch.
includes/types/CMB2_Type_Taxonomy_Select.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
 	public function render() {
16 16
 		$names = $this->get_object_terms();
17 17
 
18
-		$saved_term  = is_wp_error( $names ) || empty( $names ) ? $this->field->get_default() : $names[key( $names )]->slug;
18
+		$saved_term  = is_wp_error( $names ) || empty( $names ) ? $this->field->get_default() : $names[ key( $names ) ]->slug;
19 19
 		$terms       = $this->get_terms();
20 20
 		$options     = '';
21 21
 		$option_none = $this->field->args( 'show_option_none' );
Please login to merge, or discard this patch.
includes/types/CMB2_Type_Title.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
 		), $this->args );
30 30
 
31 31
 		return $this->rendered(
32
-			sprintf( '<%1$s %2$s>%3$s</%1$s>%4$s', $a['tag'], $this->concat_attrs( $a, array( 'tag', 'name', 'desc' ) ), $a['name'], $a['desc'] )
32
+			sprintf( '<%1$s %2$s>%3$s</%1$s>%4$s', $a[ 'tag' ], $this->concat_attrs( $a, array( 'tag', 'name', 'desc' ) ), $a[ 'name' ], $a[ 'desc' ] )
33 33
 		);
34 34
 	}
35 35
 
Please login to merge, or discard this patch.
includes/CMB2_Field_Display.php 2 patches
Doc Comments   -2 removed lines patch added patch discarded remove patch
@@ -113,8 +113,6 @@
 block discarded – undo
113 113
 	 * Catchall method if field's 'display_cb' is NOT defined, or field type does
114 114
 	 * not have a corresponding display method
115 115
 	 * @since 2.2.2
116
-	 * @param  string $method    Non-existent method name
117
-	 * @param  array  $arguments All arguments passed to the method
118 116
 	 */
119 117
 	public function display() {
120 118
 		// If repeatable
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 			if ( is_array( $this->field->value ) ) {
125 125
 
126 126
 				// Then loop and output.
127
-				echo '<ul class="cmb2-'. str_replace( '_', '-', $this->field->type() ) .'">';
127
+				echo '<ul class="cmb2-' . str_replace( '_', '-', $this->field->type() ) . '">';
128 128
 				foreach ( $this->field->value as $val ) {
129 129
 					$this->value = $val;
130 130
 					echo '<li>', $this->_display(), '</li>';
@@ -197,8 +197,8 @@  discard block
 block discarded – undo
197 197
 		$options = $this->field->options();
198 198
 
199 199
 		$fallback = $this->field->args( 'show_option_none' );
200
-		if ( ! $fallback && isset( $options[''] ) ) {
201
-			$fallback = $options[''];
200
+		if ( ! $fallback && isset( $options[ '' ] ) ) {
201
+			$fallback = $options[ '' ];
202 202
 		}
203 203
 		if ( ! $this->value && $fallback ) {
204 204
 			echo $fallback;
@@ -225,9 +225,9 @@  discard block
 block discarded – undo
225 225
 		$output = array();
226 226
 		foreach ( $this->value as $val ) {
227 227
 			if ( isset( $options[ $val ] ) ) {
228
-				$output[] = $options[ $val ];
228
+				$output[ ] = $options[ $val ];
229 229
 			} else {
230
-				$output[] = esc_attr( $val );
230
+				$output[ ] = esc_attr( $val );
231 231
 			}
232 232
 		}
233 233
 
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 	 * @since 2.2.2
252 252
 	 */
253 253
 	protected function _display() {
254
-		echo '<xmp class="cmb2-code">'. print_r( $this->value, true ) .'</xmp>';
254
+		echo '<xmp class="cmb2-code">' . print_r( $this->value, true ) . '</xmp>';
255 255
 	}
256 256
 }
257 257
 
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
 		if ( $datetime && $datetime instanceof DateTime ) {
294 294
 			$tz       = $datetime->getTimezone();
295 295
 			$tzstring = $tz->getName();
296
-			$this->value    = $datetime->getTimestamp();
296
+			$this->value = $datetime->getTimestamp();
297 297
 		}
298 298
 
299 299
 		$date = $this->field->get_timestamp_format( 'date_format', $this->value );
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
 		if ( is_wp_error( $terms ) || empty( $terms ) && ( $default = $this->field->get_default() ) ) {
318 318
 			$term = get_term_by( 'slug', $default, $taxonomy );
319 319
 		} elseif ( ! empty( $terms ) ) {
320
-			$term = $terms[key( $terms )];
320
+			$term = $terms[ key( $terms ) ];
321 321
 		}
322 322
 
323 323
 		if ( $term ) {
@@ -341,10 +341,10 @@  discard block
 block discarded – undo
341 341
 			$terms = array();
342 342
 			if ( is_array( $default ) ) {
343 343
 				foreach ( $default as $slug ) {
344
-					$terms[] = get_term_by( 'slug', $slug, $taxonomy );
344
+					$terms[ ] = get_term_by( 'slug', $slug, $taxonomy );
345 345
 				}
346 346
 			} else {
347
-				$terms[] = get_term_by( 'slug', $default, $taxonomy );
347
+				$terms[ ] = get_term_by( 'slug', $default, $taxonomy );
348 348
 			}
349 349
 		}
350 350
 
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
 			$links = array();
354 354
 			foreach ( $terms as $term ) {
355 355
 				$link = get_edit_term_link( $term->term_id, $taxonomy );
356
-				$links[] = '<a href="'. esc_url( $link ) .'">'. esc_html( $term->name ) .'</a>';
356
+				$links[ ] = '<a href="' . esc_url( $link ) . '">' . esc_html( $term->name ) . '</a>';
357 357
 			}
358 358
 			// Then loop and output.
359 359
 			echo '<div class="cmb2-taxonomy-terms-', esc_attr( $taxonomy ), '">';
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
 			if ( $id ) {
397 397
 				$image = wp_get_attachment_image( $id, $img_size, null, array( 'class' => 'cmb-image-display' ) );
398 398
 			} else {
399
-				$size = is_array( $img_size ) ? $img_size[0] : 200;
399
+				$size = is_array( $img_size ) ? $img_size[ 0 ] : 200;
400 400
 				$image = '<img class="cmb-image-display" style="max-width: ' . absint( $size ) . 'px; width: 100%; height: auto;" src="' . $url_value . '" alt="" />';
401 401
 			}
402 402
 
Please login to merge, or discard this patch.