Changeset 20545 for trunk/wp-includes/class-wp-customize-control.php
- Timestamp:
- 04/20/2012 02:39:55 AM (14 years ago)
- File:
-
- 1 edited
-
trunk/wp-includes/class-wp-customize-control.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/class-wp-customize-control.php
r20527 r20545 181 181 <label> 182 182 <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span> 183 < a href="#" class="color-picker-toggle">184 <div class=" color-picker-spot"></div>185 <div class=" color-picker-dropdown"></div>186 </ a>183 <div class="dropdown color-picker-toggle"> 184 <div class="dropdown-content color-picker-spot"></div> 185 <div class="dropdown-arrow"></div> 186 </div> 187 187 <div class="color-picker-control color-picker-hex"> 188 188 <span>#</span> … … 292 292 class WP_Customize_Image_Control extends WP_Customize_Upload_Control { 293 293 public $type = 'image'; 294 public $tabs = array();295 294 public $get_url; 295 296 protected $tabs = array(); 297 298 public function __construct( $manager, $id, $args ) { 299 parent::__construct( $manager, $id, $args ); 300 301 $this->add_tab( 'upload-new', __('Upload New'), array( $this, 'tab_upload_new' ) ); 302 $this->add_tab( 'uploaded', __('Uploaded'), array( $this, 'tab_uploaded' ) ); 303 } 296 304 297 305 public function render_content() { … … 304 312 <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span> 305 313 306 <div class="thumbnail"> 307 <?php if ( empty( $src ) ): ?> 308 <img style="display:none;" /> 309 <?php else: ?> 310 <img src="<?php echo esc_url( $src ); ?>" /> 311 <?php endif; ?> 312 </div> 313 314 <div class="actions"> 315 <a href="#" class="upload"><?php _e( 'Upload New' ); ?></a> 316 <a href="#" class="change"><?php _e( 'Change Image' ); ?></a> 317 <a href="#" class="remove"><?php _e( 'Remove Image' ); ?></a> 314 315 <div class="dropdown preview-thumbnail"> 316 <div class="dropdown-content"> 317 <?php if ( empty( $src ) ): ?> 318 <img style="display:none;" /> 319 <?php else: ?> 320 <img src="<?php echo esc_url( $src ); ?>" /> 321 <?php endif; ?> 322 </div> 323 <div class="dropdown-arrow"></div> 318 324 </div> 319 325 320 326 <div class="library"> 321 327 <ul> 322 <?php foreach ( $this->tabs as $ tab ): ?>323 <li data-customize-tab='<?php echo esc_attr( $ tab[0]); ?>'>324 <?php echo esc_html( $tab[ 1] ); ?>328 <?php foreach ( $this->tabs as $id => $tab ): ?> 329 <li data-customize-tab='<?php echo esc_attr( $id ); ?>'> 330 <?php echo esc_html( $tab['label'] ); ?> 325 331 </li> 326 332 <?php endforeach; ?> 327 333 </ul> 328 <?php foreach ( $this->tabs as $ tab ): ?>329 <div class="library-content" data-customize-tab='<?php echo esc_attr( $ tab[0]); ?>'>330 <?php call_user_func( $tab[ 2] ); ?>334 <?php foreach ( $this->tabs as $id => $tab ): ?> 335 <div class="library-content" data-customize-tab='<?php echo esc_attr( $id ); ?>'> 336 <?php call_user_func( $tab['callback'] ); ?> 331 337 </div> 332 338 <?php endforeach; ?> 333 339 </div> 340 341 <div class="actions"> 342 <a href="#" class="remove"><?php _e( 'Remove Image' ); ?></a> 343 </div> 334 344 </label> 335 345 <?php 336 346 } 347 348 public function add_tab( $id, $label, $callback ) { 349 $this->tabs[ $id ] = array( 350 'label' => $label, 351 'callback' => $callback, 352 ); 353 } 354 355 public function remove_tab( $id ) { 356 unset( $this->tabs[ $id ] ); 357 } 358 359 public function tab_upload_new() { 360 ?> 361 <div class="upload-dropzone"> 362 <?php _e('Drop a file here or <a href="#" class="upload">select a file</a>.'); ?> 363 </div> 364 <?php 365 } 366 367 public function tab_uploaded() { 368 ?> 369 <div class="uploaded-target"></div> 370 <?php 371 } 337 372 } 373 374 class WP_Customize_Header_Image_Control extends WP_Customize_Image_Control { 375 public function __construct( $manager ) { 376 parent::__construct( $manager, 'header_image', array( 377 'label' => __( 'Header Image' ), 378 'section' => 'header', 379 'context' => 'custom-header', 380 'removed' => 'remove-header', 381 'get_url' => 'get_header_image', 382 ) ); 383 384 $this->add_tab( 'default', __('Default'), array( $this, 'tab_default_headers' ) ); 385 } 386 387 public function tab_uploaded() { 388 $headers = get_uploaded_header_images(); 389 390 ?><div class="uploaded-target"></div><?php 391 392 foreach ( $headers as $header ) : ?> 393 <a href="#" class="thumbnail" data-customize-image-value="<?php echo esc_url( $header['url'] ); ?>"> 394 <img src="<?php echo esc_url( $header['thumbnail_url'] ); ?>" /> 395 </a> 396 <?php endforeach; 397 } 398 399 public function tab_default_headers() { 400 global $custom_image_header; 401 $custom_image_header->process_default_headers(); 402 403 foreach ( $custom_image_header->default_headers as $header ) : ?> 404 <a href="#" class="thumbnail" data-customize-image-value="<?php echo esc_url( $header['url'] ); ?>"> 405 <img src="<?php echo esc_url( $header['thumbnail_url'] ); ?>" /> 406 </a> 407 <?php endforeach; 408 } 409 }
Note: See TracChangeset
for help on using the changeset viewer.