@@ -15,7 +15,7 @@ |
||
| 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' ); |
@@ -29,7 +29,7 @@ |
||
| 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 | |
@@ -113,8 +113,6 @@ |
||
| 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 |
@@ -124,7 +124,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | |
@@ -170,11 +170,11 @@ discard block |
||
| 170 | 170 | |
| 171 | 171 | $message = array( sprintf( __( '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 | ? __( 'That field type may not work as expected.', 'cmb2' ) |
| 175 | 175 | : __( 'That field type will not work as expected.', 'cmb2' ); |
| 176 | 176 | |
| 177 | - $message[] = __( 'See: https://github.com/mustardBees/cmb-field-select2/pull/34w for more information about this change.', 'cmb2' ); |
|
| 177 | + $message[ ] = __( 'See: https://github.com/mustardBees/cmb-field-select2/pull/34w for more information about this change.', 'cmb2' ); |
|
| 178 | 178 | |
| 179 | 179 | _doing_it_wrong( __CLASS__ . '::' . $method, implode( ' ', $message ), '2.2.2' ); |
| 180 | 180 | } |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | * @return string String of attributes for form element |
| 219 | 219 | */ |
| 220 | 220 | public function concat_attrs( $attrs, $attr_exclude = array() ) { |
| 221 | - $attr_exclude[] = 'rendered'; |
|
| 221 | + $attr_exclude[ ] = 'rendered'; |
|
| 222 | 222 | $attributes = ''; |
| 223 | 223 | foreach ( $attrs as $attr => $val ) { |
| 224 | 224 | $excluded = in_array( $attr, (array) $attr_exclude, true ); |
@@ -405,7 +405,7 @@ discard block |
||
| 405 | 405 | 'class' => 'cmb2-hidden', |
| 406 | 406 | ); |
| 407 | 407 | if ( $this->field->group ) { |
| 408 | - $args['data-groupid'] = $this->field->group->id(); |
|
| 408 | + $args[ 'data-groupid' ] = $this->field->group->id(); |
|
| 409 | 409 | } |
| 410 | 410 | return $this->input( $args ); |
| 411 | 411 | } |