@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | $dir = wp_upload_dir(); |
| 38 | 38 | |
| 39 | 39 | // Is URL in uploads directory? |
| 40 | - if ( false === strpos( $img_url, $dir['baseurl'] . '/' ) ) { |
|
| 40 | + if ( false === strpos( $img_url, $dir[ 'baseurl' ] . '/' ) ) { |
|
| 41 | 41 | return false; |
| 42 | 42 | } |
| 43 | 43 | |
@@ -62,8 +62,8 @@ discard block |
||
| 62 | 62 | |
| 63 | 63 | foreach ( $query->posts as $post_id ) { |
| 64 | 64 | $meta = wp_get_attachment_metadata( $post_id ); |
| 65 | - $original_file = basename( $meta['file'] ); |
|
| 66 | - $cropped_image_files = isset( $meta['sizes'] ) ? wp_list_pluck( $meta['sizes'], 'file' ) : array(); |
|
| 65 | + $original_file = basename( $meta[ 'file' ] ); |
|
| 66 | + $cropped_image_files = isset( $meta[ 'sizes' ] ) ? wp_list_pluck( $meta[ 'sizes' ], 'file' ) : array(); |
|
| 67 | 67 | if ( $original_file === $file || in_array( $file, $cropped_image_files ) ) { |
| 68 | 68 | $attachment_id = $post_id; |
| 69 | 69 | break; |
@@ -147,8 +147,7 @@ discard block |
||
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | return self::is_valid_time_stamp( $string ) |
| 150 | - ? (int) $string : |
|
| 151 | - strtotime( (string) $string ); |
|
| 150 | + ? (int) $string : strtotime( (string) $string ); |
|
| 152 | 151 | } |
| 153 | 152 | |
| 154 | 153 | /** |
@@ -179,7 +178,7 @@ discard block |
||
| 179 | 178 | * @param mixed $value Value to check |
| 180 | 179 | * @return bool True or false |
| 181 | 180 | */ |
| 182 | - public static function notempty( $value ){ |
|
| 181 | + public static function notempty( $value ) { |
|
| 183 | 182 | return null !== $value && '' !== $value && false !== $value; |
| 184 | 183 | } |
| 185 | 184 | |
@@ -337,24 +336,24 @@ discard block |
||
| 337 | 336 | |
| 338 | 337 | // order is relevant here, since the replacement will be done sequentially. |
| 339 | 338 | $supported_options = array( |
| 340 | - 'd' => 'dd', // Day, leading 0 |
|
| 341 | - 'j' => 'd', // Day, no 0 |
|
| 342 | - 'z' => 'o', // Day of the year, no leading zeroes, |
|
| 339 | + 'd' => 'dd', // Day, leading 0 |
|
| 340 | + 'j' => 'd', // Day, no 0 |
|
| 341 | + 'z' => 'o', // Day of the year, no leading zeroes, |
|
| 343 | 342 | // 'D' => 'D', // Day name short, not sure how it'll work with translations |
| 344 | 343 | // 'l' => 'DD', // Day name full, idem before |
| 345 | - 'm' => 'mm', // Month of the year, leading 0 |
|
| 346 | - 'n' => 'm', // Month of the year, no leading 0 |
|
| 344 | + 'm' => 'mm', // Month of the year, leading 0 |
|
| 345 | + 'n' => 'm', // Month of the year, no leading 0 |
|
| 347 | 346 | // 'M' => 'M', // Month, Short name |
| 348 | 347 | // 'F' => 'MM', // Month, full name, |
| 349 | - 'y' => 'y', // Year, two digit |
|
| 350 | - 'Y' => 'yy', // Year, full |
|
| 351 | - 'H' => 'HH', // Hour with leading 0 (24 hour) |
|
| 352 | - 'G' => 'H', // Hour with no leading 0 (24 hour) |
|
| 353 | - 'h' => 'hh', // Hour with leading 0 (12 hour) |
|
| 354 | - 'g' => 'h', // Hour with no leading 0 (12 hour), |
|
| 355 | - 'i' => 'mm', // Minute with leading 0, |
|
| 356 | - 's' => 'ss', // Second with leading 0, |
|
| 357 | - 'a' => 'tt', // am/pm |
|
| 348 | + 'y' => 'y', // Year, two digit |
|
| 349 | + 'Y' => 'yy', // Year, full |
|
| 350 | + 'H' => 'HH', // Hour with leading 0 (24 hour) |
|
| 351 | + 'G' => 'H', // Hour with no leading 0 (24 hour) |
|
| 352 | + 'h' => 'hh', // Hour with leading 0 (12 hour) |
|
| 353 | + 'g' => 'h', // Hour with no leading 0 (12 hour), |
|
| 354 | + 'i' => 'mm', // Minute with leading 0, |
|
| 355 | + 's' => 'ss', // Second with leading 0, |
|
| 356 | + 'a' => 'tt', // am/pm |
|
| 358 | 357 | 'A' => 'TT' // AM/PM |
| 359 | 358 | ); |
| 360 | 359 | |
@@ -375,7 +374,7 @@ discard block |
||
| 375 | 374 | * @return string Modified value |
| 376 | 375 | */ |
| 377 | 376 | public static function wrap_escaped_chars( $value ) { |
| 378 | - return "'" . str_replace( '\\', '', $value[0] ) . "'"; |
|
| 377 | + return "'" . str_replace( '\\', '', $value[ 0 ] ) . "'"; |
|
| 379 | 378 | } |
| 380 | 379 | |
| 381 | 380 | /** |
@@ -435,7 +434,7 @@ discard block |
||
| 435 | 434 | * @return string String of attributes for form element. |
| 436 | 435 | */ |
| 437 | 436 | public static function concat_attrs( $attrs, $attr_exclude = array() ) { |
| 438 | - $attr_exclude[] = 'rendered'; |
|
| 437 | + $attr_exclude[ ] = 'rendered'; |
|
| 439 | 438 | $attributes = ''; |
| 440 | 439 | foreach ( $attrs as $attr => $val ) { |
| 441 | 440 | $excluded = in_array( $attr, (array) $attr_exclude, true ); |
@@ -55,11 +55,11 @@ discard block |
||
| 55 | 55 | */ |
| 56 | 56 | public function img_status_output( $args ) { |
| 57 | 57 | return sprintf( '<%1$s class="img-status">%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 |
||
| 71 | 71 | */ |
| 72 | 72 | public function file_status_output( $args ) { |
| 73 | 73 | return sprintf( '<%1$s class="file-status"><span>%2$s <strong>%3$s</strong></span> (<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 | |
@@ -170,11 +170,11 @@ discard block |
||
| 170 | 170 | |
| 171 | 171 | $message = array( sprintf( esc_html__( 'Custom field types require a Type object instantiation to use this method. This method was called by the \'%s\' field type.' ), $this->field->type() ) ); |
| 172 | 172 | |
| 173 | - $message[] = is_object( $this->type ) |
|
| 173 | + $message[ ] = is_object( $this->type ) |
|
| 174 | 174 | ? esc_html__( 'That field type may not work as expected.', 'cmb2' ) |
| 175 | 175 | : esc_html__( 'That field type will not work as expected.', 'cmb2' ); |
| 176 | 176 | |
| 177 | - $message[] = esc_html__( 'For more information about this change see: https://github.com/mustardBees/cmb-field-select2/pull/34w', 'cmb2' ); |
|
| 177 | + $message[ ] = esc_html__( 'For more information about this change see: https://github.com/mustardBees/cmb-field-select2/pull/34w', 'cmb2' ); |
|
| 178 | 178 | |
| 179 | 179 | _doing_it_wrong( __CLASS__ . '::' . $method, implode( ' ', $message ), '2.2.2' ); |
| 180 | 180 | } |
@@ -394,8 +394,8 @@ discard block |
||
| 394 | 394 | 'class' => 'cmb2-hidden', |
| 395 | 395 | ); |
| 396 | 396 | if ( $this->field->group ) { |
| 397 | - $args['data-groupid'] = $this->field->group->id(); |
|
| 398 | - $args['data-iterator'] = $this->iterator; |
|
| 397 | + $args[ 'data-groupid' ] = $this->field->group->id(); |
|
| 398 | + $args[ 'data-iterator' ] = $this->iterator; |
|
| 399 | 399 | } |
| 400 | 400 | return $this->input( $args ); |
| 401 | 401 | } |
@@ -22,16 +22,16 @@ discard block |
||
| 22 | 22 | 'timepicker' => array(), |
| 23 | 23 | ) ); |
| 24 | 24 | |
| 25 | - if ( empty( $args['value'] ) ) { |
|
| 26 | - $args['value'] = $field->escaped_value(); |
|
| 25 | + if ( empty( $args[ 'value' ] ) ) { |
|
| 26 | + $args[ 'value' ] = $field->escaped_value(); |
|
| 27 | 27 | // This will be used if there is a select_timezone set for this field |
| 28 | - $tz_offset = $field->field_timezone_offset( $args['value'] ); |
|
| 28 | + $tz_offset = $field->field_timezone_offset( $args[ 'value' ] ); |
|
| 29 | 29 | if ( ! empty( $tz_offset ) ) { |
| 30 | - $args['value'] -= $tz_offset; |
|
| 30 | + $args[ 'value' ] -= $tz_offset; |
|
| 31 | 31 | } |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - $has_good_value = ! empty( $args['value'] ) && ! is_array( $args['value'] ); |
|
| 34 | + $has_good_value = ! empty( $args[ 'value' ] ) && ! is_array( $args[ 'value' ] ); |
|
| 35 | 35 | |
| 36 | 36 | $date_input = parent::render( $this->date_args( $args, $has_good_value ) ); |
| 37 | 37 | $time_input = parent::render( $this->time_args( $args, $has_good_value ) ); |
@@ -40,31 +40,31 @@ discard block |
||
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | public function date_args( $args, $has_good_value ) { |
| 43 | - $date_args = wp_parse_args( $args['datepicker'], array( |
|
| 43 | + $date_args = wp_parse_args( $args[ 'datepicker' ], array( |
|
| 44 | 44 | 'class' => 'cmb2-text-small cmb2-datepicker', |
| 45 | 45 | 'name' => $this->_name( '[date]' ), |
| 46 | 46 | 'id' => $this->_id( '_date' ), |
| 47 | - 'value' => $has_good_value ? $this->field->get_timestamp_format( 'date_format', $args['value'] ) : '', |
|
| 47 | + 'value' => $has_good_value ? $this->field->get_timestamp_format( 'date_format', $args[ 'value' ] ) : '', |
|
| 48 | 48 | 'desc' => '', |
| 49 | 49 | ) ); |
| 50 | 50 | |
| 51 | - $date_args['rendered'] = true; |
|
| 51 | + $date_args[ 'rendered' ] = true; |
|
| 52 | 52 | |
| 53 | 53 | // Let's get the date-format, and set it up as a data attr for the field. |
| 54 | 54 | return $this->parse_picker_options( 'date', $date_args ); |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | public function time_args( $args, $has_good_value ) { |
| 58 | - $time_args = wp_parse_args( $args['timepicker'], array( |
|
| 58 | + $time_args = wp_parse_args( $args[ 'timepicker' ], array( |
|
| 59 | 59 | 'class' => 'cmb2-timepicker text-time', |
| 60 | 60 | 'name' => $this->_name( '[time]' ), |
| 61 | 61 | 'id' => $this->_id( '_time' ), |
| 62 | - 'value' => $has_good_value ? $this->field->get_timestamp_format( 'time_format', $args['value'] ) : '', |
|
| 63 | - 'desc' => $args['desc'], |
|
| 62 | + 'value' => $has_good_value ? $this->field->get_timestamp_format( 'time_format', $args[ 'value' ] ) : '', |
|
| 63 | + 'desc' => $args[ 'desc' ], |
|
| 64 | 64 | 'js_dependencies' => array( 'jquery-ui-core', 'jquery-ui-datepicker', 'jquery-ui-datetimepicker' ), |
| 65 | 65 | ) ); |
| 66 | 66 | |
| 67 | - $time_args['rendered'] = true; |
|
| 67 | + $time_args[ 'rendered' ] = true; |
|
| 68 | 68 | |
| 69 | 69 | // Let's get the time-format, and set it up as a data attr for the field. |
| 70 | 70 | return $this->parse_picker_options( 'time', $time_args ); |