Changeset 21354
- Timestamp:
- 07/26/2012 09:45:33 PM (12 years ago)
- Location:
- trunk/wp-includes
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/class-wp-customize-control.php
r21037 r21354 7 7 * @since 3.4.0 8 8 */ 9 10 9 class WP_Customize_Control { 10 /** 11 * @access public 12 * @var WP_Customize_Manager 13 */ 11 14 public $manager; 15 16 /** 17 * @access public 18 * @var string 19 */ 12 20 public $id; 13 21 14 // All settings tied to the control. 22 /** 23 * All settings tied to the control. 24 * 25 * @access public 26 * @var array 27 */ 15 28 public $settings; 16 29 17 // The primary setting for the control (if there is one). 30 /** 31 * The primary setting for the control (if there is one). 32 * 33 * @access public 34 * @var string 35 */ 18 36 public $setting = 'default'; 19 37 38 /** 39 * @access public 40 * @var int 41 */ 20 42 public $priority = 10; 43 44 /** 45 * @access public 46 * @var string 47 */ 21 48 public $section = ''; 49 50 /** 51 * @access public 52 * @var string 53 */ 22 54 public $label = ''; 23 // @todo: remove choices 55 56 /** 57 * @todo: Remove choices 58 * 59 * @access public 60 * @var array 61 */ 24 62 public $choices = array(); 25 63 64 /** 65 * @access public 66 * @var array 67 */ 26 68 public $json = array(); 27 69 70 /** 71 * @access public 72 * @var string 73 */ 28 74 public $type = 'text'; 29 75 … … 35 81 * 36 82 * @since 3.4.0 83 * 84 * @param WP_Customize_Manager $manager 85 * @param string $id 86 * @param array $args 37 87 */ 38 88 function __construct( $manager, $id, $args = array() ) { … … 76 126 * 77 127 * @since 3.4.0 128 * 129 * @param string $setting_key 130 * @return mixed The requested setting's value, if the setting exists. 78 131 */ 79 132 public final function value( $setting_key = 'default' ) { … … 120 173 * 121 174 * @since 3.4.0 175 * @uses WP_Customize_Control::render() 122 176 */ 123 177 public final function maybe_render() { … … 144 198 </li><?php 145 199 } 146 200 201 /** 202 * Get the data link parameter for a setting. 203 * 204 * @since 3.4.0 205 * 206 * @param string $setting_key 207 * @return string Data link parameter, if $setting_key is a valid setting, empty string otherwise. 208 */ 147 209 public function get_link( $setting_key = 'default' ) { 148 210 if ( ! isset( $this->settings[ $setting_key ] ) ) … … 151 213 return 'data-customize-setting-link="' . esc_attr( $this->settings[ $setting_key ]->id ) . '"'; 152 214 } 153 215 216 /** 217 * Render the data link parameter for a setting 218 * 219 * @since 3.4.0 220 * @uses WP_Customize_Control::get_link() 221 * 222 * @param string $setting_key 223 */ 154 224 public function link( $setting_key = 'default' ) { 155 225 echo $this->get_link( $setting_key ); … … 239 309 } 240 310 311 /** 312 * Customize Color Control Class 313 * 314 * @package WordPress 315 * @subpackage Customize 316 * @since 3.4.0 317 */ 241 318 class WP_Customize_Color_Control extends WP_Customize_Control { 319 /** 320 * @access public 321 * @var string 322 */ 242 323 public $type = 'color'; 324 325 /** 326 * @access public 327 * @var array 328 */ 243 329 public $statuses; 244 330 331 /** 332 * Constructor. 333 * 334 * If $args['settings'] is not defined, use the $id as the setting ID. 335 * 336 * @since 3.4.0 337 * @uses WP_Customize_Control::__construct() 338 * 339 * @param WP_Customize_Manager $manager 340 * @param string $id 341 * @param array $args 342 */ 245 343 public function __construct( $manager, $id, $args = array() ) { 246 344 $this->statuses = array( '' => __('Default') ); … … 248 346 } 249 347 348 /** 349 * Enqueue control related scripts/styles. 350 * 351 * @since 3.4.0 352 */ 250 353 public function enqueue() { 251 354 wp_enqueue_script( 'farbtastic' ); … … 253 356 } 254 357 358 /** 359 * Refresh the parameters passed to the JavaScript via JSON. 360 * 361 * @since 3.4.0 362 * @uses WP_Customize_Control::to_json() 363 */ 255 364 public function to_json() { 256 365 parent::to_json(); … … 258 367 } 259 368 369 /** 370 * Render the control's content. 371 * 372 * @since 3.4.0 373 */ 260 374 public function render_content() { 261 375 ?> … … 277 391 } 278 392 393 /** 394 * Customize Upload Control Class 395 * 396 * @package WordPress 397 * @subpackage Customize 398 * @since 3.4.0 399 */ 279 400 class WP_Customize_Upload_Control extends WP_Customize_Control { 280 401 public $type = 'upload'; … … 282 403 public $context; 283 404 405 /** 406 * Enqueue control related scripts/styles. 407 * 408 * @since 3.4.0 409 */ 284 410 public function enqueue() { 285 411 wp_enqueue_script( 'wp-plupload' ); 286 412 } 287 413 414 /** 415 * Refresh the parameters passed to the JavaScript via JSON. 416 * 417 * @since 3.4.0 418 * @uses WP_Customize_Control::to_json() 419 */ 288 420 public function to_json() { 289 421 parent::to_json(); … … 295 427 } 296 428 429 /** 430 * Render the control's content. 431 * 432 * @since 3.4.0 433 */ 297 434 public function render_content() { 298 435 ?> … … 308 445 } 309 446 447 /** 448 * Customize Image Control Class 449 * 450 * @package WordPress 451 * @subpackage Customize 452 * @since 3.4.0 453 */ 310 454 class WP_Customize_Image_Control extends WP_Customize_Upload_Control { 311 455 public $type = 'image'; … … 315 459 protected $tabs = array(); 316 460 461 /** 462 * Constructor. 463 * 464 * If $args['settings'] is not defined, use the $id as the setting ID. 465 * 466 * @since 3.4.0 467 * @uses WP_Customize_Upload_Control::__construct() 468 * 469 * @param WP_Customize_Manager $manager 470 * @param string $id 471 * @param array $args 472 */ 317 473 public function __construct( $manager, $id, $args ) { 318 474 $this->statuses = array( '' => __('No Image') ); … … 324 480 } 325 481 482 /** 483 * Refresh the parameters passed to the JavaScript via JSON. 484 * 485 * @since 3.4.0 486 * @uses WP_Customize_Upload_Control::to_json() 487 */ 326 488 public function to_json() { 327 489 parent::to_json(); … … 329 491 } 330 492 493 /** 494 * Render the control's content. 495 * 496 * @since 3.4.0 497 */ 331 498 public function render_content() { 332 499 $src = $this->value(); … … 373 540 <?php 374 541 } 375 542 543 /** 544 * Add a tab to the control. 545 * 546 * @since 3.4.0 547 * 548 * @param string $id 549 * @param string $label 550 * @param mixed $callback 551 */ 376 552 public function add_tab( $id, $label, $callback ) { 377 553 $this->tabs[ $id ] = array( … … 381 557 } 382 558 559 /** 560 * Remove a tab from the control. 561 * 562 * @since 3.4.0 563 * 564 * @param string $id 565 */ 383 566 public function remove_tab( $id ) { 384 567 unset( $this->tabs[ $id ] ); 385 568 } 386 569 570 /** 571 * @since 3.4.0 572 */ 387 573 public function tab_upload_new() { 388 574 if ( ! _device_can_upload() ) { … … 401 587 } 402 588 } 403 589 590 /** 591 * @since 3.4.0 592 */ 404 593 public function tab_uploaded() { 405 594 ?> … … 408 597 } 409 598 599 /** 600 * @since 3.4.0 601 * 602 * @param string $url 603 * @param string $thumbnail_url 604 */ 410 605 public function print_tab_image( $url, $thumbnail_url = null ) { 411 606 $url = set_url_scheme( $url ); … … 419 614 } 420 615 616 /** 617 * Customize Background Image Control Class 618 * 619 * @package WordPress 620 * @subpackage Customize 621 * @since 3.4.0 622 */ 421 623 class WP_Customize_Background_Image_Control extends WP_Customize_Image_Control { 624 625 /** 626 * Constructor. 627 * 628 * @since 3.4.0 629 * @uses WP_Customize_Image_Control::__construct() 630 * 631 * @param WP_Customize_Manager $manager 632 */ 422 633 public function __construct( $manager ) { 423 634 parent::__construct( $manager, 'background_image', array( … … 432 643 } 433 644 645 /** 646 * @since 3.4.0 647 */ 434 648 public function tab_uploaded() { 435 649 $backgrounds = get_posts( array( … … 449 663 $this->print_tab_image( esc_url_raw( $background->guid ) ); 450 664 } 451 665 666 /** 667 * @since 3.4.0 668 * @uses WP_Customize_Image_Control::print_tab_image() 669 */ 452 670 public function tab_default_background() { 453 671 $this->print_tab_image( $this->setting->default ); … … 455 673 } 456 674 675 /** 676 * Customize Header Image Control Class 677 * 678 * @package WordPress 679 * @subpackage Customize 680 * @since 3.4.0 681 */ 457 682 class WP_Customize_Header_Image_Control extends WP_Customize_Image_Control { 683 684 /** 685 * Constructor. 686 * 687 * @since 3.4.0 688 * @uses WP_Customize_Image_Control::__construct() 689 * @uses WP_Customize_Image_Control::add_tab() 690 * 691 * @param WP_Customize_Manager $manager 692 */ 458 693 public function __construct( $manager ) { 459 694 parent::__construct( $manager, 'header_image', array( … … 478 713 } 479 714 715 /** 716 * @since 3.4.0 717 * 718 * @param mixed $choice Which header image to select. (@see Custom_Image_Header::get_header_image() ) 719 * @param array $header 720 */ 480 721 public function print_header_image( $choice, $header ) { 481 722 $header['url'] = set_url_scheme( $header['url'] ); … … 497 738 <?php 498 739 } 499 740 741 /** 742 * @since 3.4.0 743 */ 500 744 public function tab_uploaded() { 501 745 $headers = get_uploaded_header_images(); … … 507 751 } 508 752 753 /** 754 * @since 3.4.0 755 */ 509 756 public function tab_default_headers() { 510 757 global $custom_image_header; -
trunk/wp-includes/class-wp-customize-manager.php
r21135 r21354 1 1 <?php 2 2 /** 3 * Customize 3 * Customize Manager. 4 4 * 5 5 * @package WordPress … … 7 7 * @since 3.4.0 8 8 */ 9 10 9 final class WP_Customize_Manager { 11 10 protected $theme; … … 57 56 } 58 57 59 58 /** 60 59 * Return true if it's an AJAX request. 61 60 * 62 61 * @since 3.4.0 62 * 63 * @return bool 63 64 */ 64 65 public function doing_ajax() { … … 70 71 * or the AJAX message. 71 72 * 72 * @ param mixed $ajax_message AJAX return73 * @param mixed $message UI message74 * 75 * @ since 3.4.073 * @since 3.4.0 74 * 75 * @param mixed $ajax_message AJAX return 76 * @param mixed $message UI message 76 77 */ 77 78 protected function wp_die( $ajax_message, $message = null ) { … … 89 90 * 90 91 * @since 3.4.0 92 * 93 * @return string 91 94 */ 92 95 public function wp_die_handler() { … … 96 99 return '_default_wp_die_handler'; 97 100 } 98 /** 99 * Start preview and customize theme. 100 * 101 * Check if customize query variable exist. Init filters to filter the current theme. 101 102 /** 103 * Start preview and customize theme. 104 * 105 * Check if customize query variable exist. Init filters to filter the current theme. 102 106 * 103 107 * @since 3.4.0 … … 137 141 $this->start_previewing_theme(); 138 142 } 139 143 144 /** 145 * Callback to validate a theme once it is loaded 146 * 147 * @since 3.4.0 148 */ 140 149 function after_setup_theme() { 141 150 if ( ! $this->doing_ajax() && ! validate_current_theme() ) { … … 280 289 * 281 290 * @since 3.4.0 291 * 292 * @param $status 293 * @return int 282 294 */ 283 295 public function wp_redirect_status( $status ) { … … 292 304 * 293 305 * @since 3.4.0 306 * 307 * @param mixed $setting A WP_Customize_Setting derived object 308 * @return string Sanitized attribute 294 309 */ 295 310 public function post_value( $setting ) { … … 368 383 369 384 if ( 2 == $this->nonce_tick ) { 370 371 372 373 374 385 $settings['nonce'] = array( 386 'save' => wp_create_nonce( 'save-customize_' . $this->get_stylesheet() ), 387 'preview' => wp_create_nonce( 'preview-customize_' . $this->get_stylesheet() ) 388 ); 389 } 375 390 376 391 foreach ( $this->settings as $id => $setting ) { … … 465 480 * @since 3.4.0 466 481 * 482 * @param $current_theme {@internal Parameter is not used} 467 483 * @return string Theme name. 468 484 */ … … 631 647 * @param object $a Object A. 632 648 * @param object $b Object B. 649 * @return int 633 650 */ 634 651 protected final function _cmp_priority( $a, $b ) { … … 961 978 * 962 979 * @since 3.4.0 980 * 981 * @param string $color 982 * @return string 963 983 */ 964 984 public function _sanitize_header_textcolor( $color ) { … … 974 994 * 975 995 * @since 3.4.0 996 * 997 * @param string $color 998 * @return string|null 976 999 */ 977 1000 function sanitize_hex_color( $color ) { … … 996 1019 * 997 1020 * @since 3.4.0 1021 * @uses sanitize_hex_color() 1022 * 1023 * @param string $color 1024 * @return string|null 998 1025 */ 999 1026 function sanitize_hex_color_no_hash( $color ) { … … 1013 1040 * 1014 1041 * @since 3.4.0 1042 * 1043 * @param string $color 1044 * @return string 1015 1045 */ 1016 1046 function maybe_hash_hex_color( $color ) { -
trunk/wp-includes/class-wp-customize-section.php
r20349 r21354 1 1 <?php 2 2 /** 3 * Customize Section Class 3 * Customize Section Class. 4 4 * 5 5 * @package WordPress … … 7 7 * @since 3.4.0 8 8 */ 9 10 9 class WP_Customize_Section { 11 10 public $manager; … … 23 22 * @since 3.4.0 24 23 * 24 * @param WP_Customize_Manager $manager 25 25 * @param string $id An specific ID of the section. 26 26 * @param array $args Section arguments. … … 73 73 } 74 74 75 76 75 /** 77 76 * Render the section. -
trunk/wp-includes/class-wp-customize-setting.php
r21053 r21354 1 1 <?php 2 2 /** 3 * Customize Setting Class 3 * Customize Setting Class. 4 4 * 5 5 * @package WordPress … … 7 7 * @since 3.4.0 8 8 */ 9 10 9 class WP_Customize_Setting { 11 10 public $manager; … … 29 28 * @since 3.4.0 30 29 * 30 * @param WP_Customize_Manager $manager 31 31 * @param string $id An specific ID of the setting. Can be a 32 32 * theme mod or option name. 33 33 * @param array $args Setting arguments. 34 * @return WP_Customize_Setting 34 35 */ 35 36 function __construct( $manager, $id, $args = array() ) { … … 88 89 * 89 90 * @since 3.4.0 90 * 91 * @param mixed Old value. 91 * @uses WP_Customize_Setting::multidimensional_replace() 92 * 93 * @param mixed $original Old value. 92 94 * @return mixed New or old value. 93 95 */ … … 119 121 * @since 3.4.0 120 122 * 121 * @param $default mixedA default value which is used as a fallback. Default is null.122 * @return mixed Either the default value on failure orsanitized value.123 * @param mixed $default A default value which is used as a fallback. Default is null. 124 * @return mixed The default value on failure, otherwise the sanitized value. 123 125 */ 124 126 public final function post_value( $default = null ) { … … 139 141 * @since 3.4.0 140 142 * 141 * @param $value mixedThe value to sanitize.143 * @param mixed $value The value to sanitize. 142 144 * @return mixed Null if an input isn't valid, otherwise the sanitized value. 143 145 */ … … 152 154 * @since 3.4.0 153 155 * 154 * @param $value mixedThe value to update.156 * @param mixed $value The value to update. 155 157 * @return mixed The result of saving the value. 156 158 */ … … 173 175 * @since 3.4.0 174 176 * 175 * @param $value mixedThe value to update.177 * @param mixed $value The value to update. 176 178 * @return mixed The result of saving the value. 177 179 */ … … 193 195 * @since 3.4.0 194 196 * 195 * @param $value mixedThe value to update.197 * @param mixed $value The value to update. 196 198 * @return mixed The result of saving the value. 197 199 */ … … 277 279 * @param $keys 278 280 * @param bool $create Default is false. 279 * @return null|array 281 * @return null|array Keys are 'root', 'node', and 'key'. 280 282 */ 281 283 final protected function multidimensional( &$root, $keys, $create = false ) { … … 373 375 * 374 376 * Results should be properly handled using another setting or callback. 377 * 378 * @package WordPress 379 * @subpackage Customize 380 * @since 3.4.0 375 381 */ 376 382 class WP_Customize_Filter_Setting extends WP_Customize_Setting { 383 384 /** 385 * @since 3.4.0 386 */ 377 387 public function update() {} 378 388 } … … 382 392 * 383 393 * Results should be properly handled using another setting or callback. 394 * 395 * @package WordPress 396 * @subpackage Customize 397 * @since 3.4.0 384 398 */ 385 399 final class WP_Customize_Header_Image_Setting extends WP_Customize_Setting { 386 400 public $id = 'header_image_data'; 387 401 402 /** 403 * @since 3.4.0 404 * 405 * @param $value 406 */ 388 407 public function update( $value ) { 389 408 global $custom_image_header; … … 401 420 } 402 421 422 /** 423 * @package WordPress 424 * @subpackage Customize 425 * @since 3.4.0 426 */ 403 427 final class WP_Customize_Background_Image_Setting extends WP_Customize_Setting { 404 428 public $id = 'background_image_thumb'; 405 429 430 /** 431 * @since 3.4.0 432 * @uses remove_theme_mod() 433 * 434 * @param $value 435 */ 406 436 public function update( $value ) { 407 437 remove_theme_mod( 'background_image_thumb' );
Note: See TracChangeset
for help on using the changeset viewer.