Changeset 20598 for trunk/wp-includes/class-wp-customize-control.php
- Timestamp:
- 04/25/2012 09:03:29 PM (14 years ago)
- File:
-
- 1 edited
-
trunk/wp-includes/class-wp-customize-control.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/class-wp-customize-control.php
r20545 r20598 65 65 * @since 3.4.0 66 66 */ 67 public function enqueue() { 68 switch( $this->type ) { 69 case 'color': 70 wp_enqueue_script( 'farbtastic' ); 71 wp_enqueue_style( 'farbtastic' ); 72 break; 73 } 74 } 67 public function enqueue() {} 75 68 76 69 … … 177 170 <?php 178 171 break; 179 case 'color':180 ?>181 <label>182 <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>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 <div class="color-picker-control color-picker-hex">188 <span>#</span>189 <input type="text" <?php $this->link(); ?> />190 </div>191 <div class="color-picker-control farbtastic-placeholder"></div>192 </label>193 <?php194 break;195 172 case 'checkbox': 196 173 ?> 197 174 <label> 198 175 <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span> 199 <input type="checkbox" value="<?php echo esc_attr( $this->value() ); ?>" <?php $this->link(); checked( $this->value() ); ?> class="customize-control-content"/>176 <input type="checkbox" value="<?php echo esc_attr( $this->value() ); ?>" <?php $this->link(); checked( $this->value() ); ?> /> 200 177 </label> 201 178 <?php … … 226 203 <label> 227 204 <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span> 228 <select <?php $this->link(); ?> class="customize-control-content">205 <select <?php $this->link(); ?>> 229 206 <?php 230 207 foreach ( $this->choices as $value => $label ) … … 259 236 } 260 237 238 class WP_Customize_Color_Control extends WP_Customize_Control { 239 public $type = 'color'; 240 public $statuses; 241 242 public function __construct( $manager, $id, $args = array() ) { 243 $this->statuses = array( '' => __('Default') ); 244 parent::__construct( $manager, $id, $args ); 245 } 246 247 public function enqueue() { 248 wp_enqueue_script( 'farbtastic' ); 249 wp_enqueue_style( 'farbtastic' ); 250 } 251 252 public function to_json() { 253 parent::to_json(); 254 $this->json['statuses'] = $this->statuses; 255 } 256 257 public function render_content() { 258 ?> 259 <label> 260 <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span> 261 <div class="customize-control-content"> 262 <div class="dropdown"> 263 <div class="dropdown-content"> 264 <div class="dropdown-status"></div> 265 </div> 266 <div class="dropdown-arrow"></div> 267 </div> 268 <div class="color-picker-hex"> 269 <span>#</span> 270 <input type="text" <?php $this->link(); ?> /> 271 </div> 272 </div> 273 <div class="farbtastic-placeholder"></div> 274 </label> 275 <?php 276 } 277 } 278 261 279 class WP_Customize_Upload_Control extends WP_Customize_Control { 262 280 public $type = 'upload'; … … 293 311 public $type = 'image'; 294 312 public $get_url; 313 public $statuses; 295 314 296 315 protected $tabs = array(); 297 316 298 317 public function __construct( $manager, $id, $args ) { 318 $this->statuses = array( '' => __('No Image') ); 319 299 320 parent::__construct( $manager, $id, $args ); 300 321 301 322 $this->add_tab( 'upload-new', __('Upload New'), array( $this, 'tab_upload_new' ) ); 302 323 $this->add_tab( 'uploaded', __('Uploaded'), array( $this, 'tab_uploaded' ) ); 324 } 325 326 public function to_json() { 327 parent::to_json(); 328 $this->json['statuses'] = $this->statuses; 303 329 } 304 330 … … 312 338 <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span> 313 339 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; ?> 340 <div class="customize-control-content"> 341 <div class="dropdown preview-thumbnail"> 342 <div class="dropdown-content"> 343 <?php if ( empty( $src ) ): ?> 344 <img style="display:none;" /> 345 <?php else: ?> 346 <img src="<?php echo esc_url( $src ); ?>" /> 347 <?php endif; ?> 348 <div class="dropdown-status"></div> 349 </div> 350 <div class="dropdown-arrow"></div> 322 351 </div> 323 <div class="dropdown-arrow"></div>324 352 </div> 325 353 … … 375 403 public function __construct( $manager ) { 376 404 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', 405 'label' => __( 'Header Image' ), 406 'section' => 'header', 407 'context' => 'custom-header', 408 'removed' => 'remove-header', 409 'get_url' => 'get_header_image', 410 'statuses' => array( 411 '' => __('Default'), 412 'remove-header' => __('No Image'), 413 'random-default-image' => __('Random Default Image'), 414 'random-uploaded-image' => __('Random Uploaded Image'), 415 ) 382 416 ) ); 383 417
Note: See TracChangeset
for help on using the changeset viewer.