@@ -13,13 +13,13 @@ discard block |
||
| 13 | 13 | |
| 14 | 14 | ?> |
| 15 | 15 | <label> |
| 16 | - <?php if ( ! empty( $this->label ) ) : ?> |
|
| 17 | - <span class="fields-control-title"><?php echo esc_html( $this->label ); ?></span> |
|
| 16 | + <?php if ( ! empty($this->label)) : ?> |
|
| 17 | + <span class="fields-control-title"><?php echo esc_html($this->label); ?></span> |
|
| 18 | 18 | <?php endif; |
| 19 | - if ( ! empty( $this->description ) ) : ?> |
|
| 19 | + if ( ! empty($this->description)) : ?> |
|
| 20 | 20 | <span class="description fields-control-description"><?php echo $this->description; ?></span> |
| 21 | 21 | <?php endif; ?> |
| 22 | - <input type="<?php echo esc_attr( $this->type ); ?>" <?php $this->input_attrs(); ?> value="<?php echo esc_attr( $this->value() ); ?>" <?php $this->link(); ?> /> |
|
| 22 | + <input type="<?php echo esc_attr($this->type); ?>" <?php $this->input_attrs(); ?> value="<?php echo esc_attr($this->value()); ?>" <?php $this->link(); ?> /> |
|
| 23 | 23 | </label> |
| 24 | 24 | <?php |
| 25 | 25 | |
@@ -53,9 +53,9 @@ discard block |
||
| 53 | 53 | $checkbox_value = $this->checkbox_value(); |
| 54 | 54 | ?> |
| 55 | 55 | <label> |
| 56 | - <input type="checkbox" value="<?php echo esc_attr( $checkbox_value ); ?>" <?php $this->link(); checked( $checkbox_value, $this->value() ); ?> /> |
|
| 57 | - <?php echo esc_html( $this->label ); ?> |
|
| 58 | - <?php if ( ! empty( $this->description ) ) : ?> |
|
| 56 | + <input type="checkbox" value="<?php echo esc_attr($checkbox_value); ?>" <?php $this->link(); checked($checkbox_value, $this->value()); ?> /> |
|
| 57 | + <?php echo esc_html($this->label); ?> |
|
| 58 | + <?php if ( ! empty($this->description)) : ?> |
|
| 59 | 59 | <span class="description fields-control-description"><?php echo $this->description; ?></span> |
| 60 | 60 | <?php endif; ?> |
| 61 | 61 | </label> |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | |
| 73 | 73 | $value = $this->value(); |
| 74 | 74 | |
| 75 | - if ( isset( $this->checkbox_value ) ) { |
|
| 75 | + if (isset($this->checkbox_value)) { |
|
| 76 | 76 | $value = $this->checkbox_value; |
| 77 | 77 | } |
| 78 | 78 | |
@@ -94,24 +94,24 @@ discard block |
||
| 94 | 94 | */ |
| 95 | 95 | public function render_content() { |
| 96 | 96 | |
| 97 | - if ( empty( $this->choices ) ) { |
|
| 97 | + if (empty($this->choices)) { |
|
| 98 | 98 | return; |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | - $name = '_fields-checkbox-' . $this->id; |
|
| 101 | + $name = '_fields-checkbox-'.$this->id; |
|
| 102 | 102 | |
| 103 | - if ( ! empty( $this->label ) ) : ?> |
|
| 104 | - <span class="fields-control-title"><?php echo esc_html( $this->label ); ?></span> |
|
| 103 | + if ( ! empty($this->label)) : ?> |
|
| 104 | + <span class="fields-control-title"><?php echo esc_html($this->label); ?></span> |
|
| 105 | 105 | <?php endif; |
| 106 | - if ( ! empty( $this->description ) ) : ?> |
|
| 107 | - <span class="description fields-control-description"><?php echo $this->description ; ?></span> |
|
| 106 | + if ( ! empty($this->description)) : ?> |
|
| 107 | + <span class="description fields-control-description"><?php echo $this->description; ?></span> |
|
| 108 | 108 | <?php endif; |
| 109 | 109 | |
| 110 | - foreach ( $this->choices as $value => $label ) : |
|
| 110 | + foreach ($this->choices as $value => $label) : |
|
| 111 | 111 | ?> |
| 112 | 112 | <label> |
| 113 | - <input type="checkbox" value="<?php echo esc_attr( $value ); ?>" name="<?php echo esc_attr( $name ); ?>" <?php $this->link(); checked( $this->value(), $value ); ?> /> |
|
| 114 | - <?php echo esc_html( $label ); ?><br/> |
|
| 113 | + <input type="checkbox" value="<?php echo esc_attr($value); ?>" name="<?php echo esc_attr($name); ?>" <?php $this->link(); checked($this->value(), $value); ?> /> |
|
| 114 | + <?php echo esc_html($label); ?><br/> |
|
| 115 | 115 | </label> |
| 116 | 116 | <?php |
| 117 | 117 | endforeach; |
@@ -132,24 +132,24 @@ discard block |
||
| 132 | 132 | */ |
| 133 | 133 | public function render_content() { |
| 134 | 134 | |
| 135 | - if ( empty( $this->choices ) ) { |
|
| 135 | + if (empty($this->choices)) { |
|
| 136 | 136 | return; |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | - $name = '_fields-radio-' . $this->id; |
|
| 139 | + $name = '_fields-radio-'.$this->id; |
|
| 140 | 140 | |
| 141 | - if ( ! empty( $this->label ) ) : ?> |
|
| 142 | - <span class="fields-control-title"><?php echo esc_html( $this->label ); ?></span> |
|
| 141 | + if ( ! empty($this->label)) : ?> |
|
| 142 | + <span class="fields-control-title"><?php echo esc_html($this->label); ?></span> |
|
| 143 | 143 | <?php endif; |
| 144 | - if ( ! empty( $this->description ) ) : ?> |
|
| 145 | - <span class="description fields-control-description"><?php echo $this->description ; ?></span> |
|
| 144 | + if ( ! empty($this->description)) : ?> |
|
| 145 | + <span class="description fields-control-description"><?php echo $this->description; ?></span> |
|
| 146 | 146 | <?php endif; |
| 147 | 147 | |
| 148 | - foreach ( $this->choices as $value => $label ) : |
|
| 148 | + foreach ($this->choices as $value => $label) : |
|
| 149 | 149 | ?> |
| 150 | 150 | <label> |
| 151 | - <input type="radio" value="<?php echo esc_attr( $value ); ?>" name="<?php echo esc_attr( $name ); ?>" <?php $this->link(); checked( $this->value(), $value ); ?> /> |
|
| 152 | - <?php echo esc_html( $label ); ?><br/> |
|
| 151 | + <input type="radio" value="<?php echo esc_attr($value); ?>" name="<?php echo esc_attr($name); ?>" <?php $this->link(); checked($this->value(), $value); ?> /> |
|
| 152 | + <?php echo esc_html($label); ?><br/> |
|
| 153 | 153 | </label> |
| 154 | 154 | <?php |
| 155 | 155 | endforeach; |
@@ -170,22 +170,22 @@ discard block |
||
| 170 | 170 | */ |
| 171 | 171 | public function render_content() { |
| 172 | 172 | |
| 173 | - if ( empty( $this->choices ) ) { |
|
| 173 | + if (empty($this->choices)) { |
|
| 174 | 174 | return; |
| 175 | 175 | } |
| 176 | 176 | ?> |
| 177 | 177 | <label> |
| 178 | - <?php if ( ! empty( $this->label ) ) : ?> |
|
| 179 | - <span class="fields-control-title"><?php echo esc_html( $this->label ); ?></span> |
|
| 178 | + <?php if ( ! empty($this->label)) : ?> |
|
| 179 | + <span class="fields-control-title"><?php echo esc_html($this->label); ?></span> |
|
| 180 | 180 | <?php endif; |
| 181 | - if ( ! empty( $this->description ) ) : ?> |
|
| 181 | + if ( ! empty($this->description)) : ?> |
|
| 182 | 182 | <span class="description fields-control-description"><?php echo $this->description; ?></span> |
| 183 | 183 | <?php endif; ?> |
| 184 | 184 | |
| 185 | 185 | <select <?php $this->link(); ?>> |
| 186 | 186 | <?php |
| 187 | - foreach ( $this->choices as $value => $label ) |
|
| 188 | - echo '<option value="' . esc_attr( $value ) . '"' . selected( $this->value(), $value, false ) . '>' . $label . '</option>'; |
|
| 187 | + foreach ($this->choices as $value => $label) |
|
| 188 | + echo '<option value="'.esc_attr($value).'"'.selected($this->value(), $value, false).'>'.$label.'</option>'; |
|
| 189 | 189 | ?> |
| 190 | 190 | </select> |
| 191 | 191 | </label> |
@@ -210,12 +210,12 @@ discard block |
||
| 210 | 210 | public function choices() { |
| 211 | 211 | |
| 212 | 212 | $choices = array( |
| 213 | - '0' => __( '— Select —' ), |
|
| 213 | + '0' => __('— Select —'), |
|
| 214 | 214 | ); |
| 215 | 215 | |
| 216 | 216 | $pages = get_pages(); |
| 217 | 217 | |
| 218 | - $choices = $this->get_page_choices_recurse( $choices, $pages ); |
|
| 218 | + $choices = $this->get_page_choices_recurse($choices, $pages); |
|
| 219 | 219 | |
| 220 | 220 | return $choices; |
| 221 | 221 | |
@@ -231,17 +231,17 @@ discard block |
||
| 231 | 231 | * |
| 232 | 232 | * @return array |
| 233 | 233 | */ |
| 234 | - public function get_page_choices_recurse( $choices, $pages, $depth = 0, $parent = 0 ) { |
|
| 234 | + public function get_page_choices_recurse($choices, $pages, $depth = 0, $parent = 0) { |
|
| 235 | 235 | |
| 236 | - $pad = str_repeat( ' ', $depth * 3 ); |
|
| 236 | + $pad = str_repeat(' ', $depth * 3); |
|
| 237 | 237 | |
| 238 | - foreach ( $pages as $page ) { |
|
| 239 | - if ( $parent == $page->post_parent ) { |
|
| 238 | + foreach ($pages as $page) { |
|
| 239 | + if ($parent == $page->post_parent) { |
|
| 240 | 240 | $title = $page->post_title; |
| 241 | 241 | |
| 242 | - if ( '' === $title ) { |
|
| 242 | + if ('' === $title) { |
|
| 243 | 243 | /* translators: %d: ID of a post */ |
| 244 | - $title = sprintf( __( '#%d (no title)' ), $page->ID ); |
|
| 244 | + $title = sprintf(__('#%d (no title)'), $page->ID); |
|
| 245 | 245 | } |
| 246 | 246 | |
| 247 | 247 | /** |
@@ -252,11 +252,11 @@ discard block |
||
| 252 | 252 | * @param string $title Page title. |
| 253 | 253 | * @param object $page Page data object. |
| 254 | 254 | */ |
| 255 | - $title = apply_filters( 'list_pages', $title, $page ); |
|
| 255 | + $title = apply_filters('list_pages', $title, $page); |
|
| 256 | 256 | |
| 257 | - $choices[ $page->ID ] = $pad . $title; |
|
| 257 | + $choices[$page->ID] = $pad.$title; |
|
| 258 | 258 | |
| 259 | - $choices = $this->get_page_choices_recurse( $choices, $pages, $depth + 1, $page->ID ); |
|
| 259 | + $choices = $this->get_page_choices_recurse($choices, $pages, $depth + 1, $page->ID); |
|
| 260 | 260 | } |
| 261 | 261 | } |
| 262 | 262 | |
@@ -295,13 +295,13 @@ discard block |
||
| 295 | 295 | * @param string $id Control ID. |
| 296 | 296 | * @param array $args Optional. Arguments to override class property defaults. |
| 297 | 297 | */ |
| 298 | - public function __construct( $manager, $id, $args = array() ) { |
|
| 298 | + public function __construct($manager, $id, $args = array()) { |
|
| 299 | 299 | |
| 300 | 300 | $this->statuses = array( |
| 301 | - '' => __( 'Default' ), |
|
| 301 | + '' => __('Default'), |
|
| 302 | 302 | ); |
| 303 | 303 | |
| 304 | - parent::__construct( $manager, $id, $args ); |
|
| 304 | + parent::__construct($manager, $id, $args); |
|
| 305 | 305 | |
| 306 | 306 | } |
| 307 | 307 | |
@@ -311,8 +311,8 @@ discard block |
||
| 311 | 311 | * @since 3.4.0 |
| 312 | 312 | */ |
| 313 | 313 | public function enqueue() { |
| 314 | - wp_enqueue_script( 'wp-color-picker' ); |
|
| 315 | - wp_enqueue_style( 'wp-color-picker' ); |
|
| 314 | + wp_enqueue_script('wp-color-picker'); |
|
| 315 | + wp_enqueue_style('wp-color-picker'); |
|
| 316 | 316 | } |
| 317 | 317 | |
| 318 | 318 | /** |
@@ -364,7 +364,7 @@ discard block |
||
| 364 | 364 | <span class="description customize-control-description">{{{ data.description }}}</span> |
| 365 | 365 | <# } #> |
| 366 | 366 | <div class="customize-control-content"> |
| 367 | - <input class="color-picker-hex" type="text" maxlength="7" placeholder="<?php esc_attr_e( 'Hex Value' ); ?>" {{ defaultValue }} /> |
|
| 367 | + <input class="color-picker-hex" type="text" maxlength="7" placeholder="<?php esc_attr_e('Hex Value'); ?>" {{ defaultValue }} /> |
|
| 368 | 368 | </div> |
| 369 | 369 | </label> |
| 370 | 370 | <?php |
@@ -416,17 +416,17 @@ discard block |
||
| 416 | 416 | * @param string $id Control ID. |
| 417 | 417 | * @param array $args Optional. Arguments to override class property defaults. |
| 418 | 418 | */ |
| 419 | - public function __construct( $manager, $id, $args = array() ) { |
|
| 420 | - parent::__construct( $manager, $id, $args ); |
|
| 419 | + public function __construct($manager, $id, $args = array()) { |
|
| 420 | + parent::__construct($manager, $id, $args); |
|
| 421 | 421 | |
| 422 | 422 | $this->button_labels = array( |
| 423 | - 'select' => __( 'Select File' ), |
|
| 424 | - 'change' => __( 'Change File' ), |
|
| 425 | - 'default' => __( 'Default' ), |
|
| 426 | - 'remove' => __( 'Remove' ), |
|
| 427 | - 'placeholder' => __( 'No file selected' ), |
|
| 428 | - 'frame_title' => __( 'Select File' ), |
|
| 429 | - 'frame_button' => __( 'Choose File' ), |
|
| 423 | + 'select' => __('Select File'), |
|
| 424 | + 'change' => __('Change File'), |
|
| 425 | + 'default' => __('Default'), |
|
| 426 | + 'remove' => __('Remove'), |
|
| 427 | + 'placeholder' => __('No file selected'), |
|
| 428 | + 'frame_title' => __('Select File'), |
|
| 429 | + 'frame_button' => __('Choose File'), |
|
| 430 | 430 | ); |
| 431 | 431 | } |
| 432 | 432 | |
@@ -450,40 +450,40 @@ discard block |
||
| 450 | 450 | */ |
| 451 | 451 | public function to_json() { |
| 452 | 452 | parent::to_json(); |
| 453 | - $this->json['label'] = html_entity_decode( $this->label, ENT_QUOTES, get_bloginfo( 'charset' ) ); |
|
| 453 | + $this->json['label'] = html_entity_decode($this->label, ENT_QUOTES, get_bloginfo('charset')); |
|
| 454 | 454 | $this->json['mime_type'] = $this->mime_type; |
| 455 | 455 | $this->json['button_labels'] = $this->button_labels; |
| 456 | - $this->json['canUpload'] = current_user_can( 'upload_files' ); |
|
| 456 | + $this->json['canUpload'] = current_user_can('upload_files'); |
|
| 457 | 457 | |
| 458 | 458 | $value = $this->value(); |
| 459 | 459 | |
| 460 | - if ( is_object( $this->setting ) ) { |
|
| 461 | - if ( $this->setting->default ) { |
|
| 460 | + if (is_object($this->setting)) { |
|
| 461 | + if ($this->setting->default) { |
|
| 462 | 462 | // Fake an attachment model - needs all fields used by template. |
| 463 | 463 | // Note that the default value must be a URL, NOT an attachment ID. |
| 464 | - $type = in_array( substr( $this->setting->default, -3 ), array( 'jpg', 'png', 'gif', 'bmp' ) ) ? 'image' : 'document'; |
|
| 464 | + $type = in_array(substr($this->setting->default, -3), array('jpg', 'png', 'gif', 'bmp')) ? 'image' : 'document'; |
|
| 465 | 465 | $default_attachment = array( |
| 466 | 466 | 'id' => 1, |
| 467 | 467 | 'url' => $this->setting->default, |
| 468 | 468 | 'type' => $type, |
| 469 | - 'icon' => wp_mime_type_icon( $type ), |
|
| 470 | - 'title' => basename( $this->setting->default ), |
|
| 469 | + 'icon' => wp_mime_type_icon($type), |
|
| 470 | + 'title' => basename($this->setting->default), |
|
| 471 | 471 | ); |
| 472 | 472 | |
| 473 | - if ( 'image' === $type ) { |
|
| 473 | + if ('image' === $type) { |
|
| 474 | 474 | $default_attachment['sizes'] = array( |
| 475 | - 'full' => array( 'url' => $this->setting->default ), |
|
| 475 | + 'full' => array('url' => $this->setting->default), |
|
| 476 | 476 | ); |
| 477 | 477 | } |
| 478 | 478 | |
| 479 | 479 | $this->json['defaultAttachment'] = $default_attachment; |
| 480 | 480 | } |
| 481 | 481 | |
| 482 | - if ( $value && $this->setting->default && $value === $this->setting->default ) { |
|
| 482 | + if ($value && $this->setting->default && $value === $this->setting->default) { |
|
| 483 | 483 | // Set the default as the attachment. |
| 484 | 484 | $this->json['attachment'] = $this->json['defaultAttachment']; |
| 485 | - } elseif ( $value ) { |
|
| 486 | - $this->json['attachment'] = wp_prepare_attachment_for_js( $value ); |
|
| 485 | + } elseif ($value) { |
|
| 486 | + $this->json['attachment'] = wp_prepare_attachment_for_js($value); |
|
| 487 | 487 | } |
| 488 | 488 | } |
| 489 | 489 | } |
@@ -613,11 +613,11 @@ discard block |
||
| 613 | 613 | parent::to_json(); |
| 614 | 614 | |
| 615 | 615 | $value = $this->value(); |
| 616 | - if ( $value ) { |
|
| 616 | + if ($value) { |
|
| 617 | 617 | // Get the attachment model for the existing file. |
| 618 | - $attachment_id = attachment_url_to_postid( $value ); |
|
| 619 | - if ( $attachment_id ) { |
|
| 620 | - $this->json['attachment'] = wp_prepare_attachment_for_js( $attachment_id ); |
|
| 618 | + $attachment_id = attachment_url_to_postid($value); |
|
| 619 | + if ($attachment_id) { |
|
| 620 | + $this->json['attachment'] = wp_prepare_attachment_for_js($attachment_id); |
|
| 621 | 621 | } |
| 622 | 622 | } |
| 623 | 623 | } |