Changeset 30885
- Timestamp:
- 12/15/2014 11:27:17 PM (10 years ago)
- Location:
- trunk/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/css/customize-controls.css
r30849 r30885 582 582 .customize-control-upload .current, 583 583 .customize-control-image .current, 584 .customize-control-background .current, 584 585 .customize-control-header .current { 585 586 margin-bottom: 8px; … … 611 612 .customize-control-image .default-button, 612 613 .customize-control-image .upload-button, 614 .customize-control-background .remove-button, 615 .customize-control-background .default-button, 616 .customize-control-background .upload-button, 613 617 .customize-control-header button.new, 614 618 .customize-control-header button.remove { … … 620 624 .customize-control-upload .current .container, 621 625 .customize-control-image .current .container, 626 .customize-control-background .current .container, 622 627 .customize-control-header .current .container { 623 628 overflow: hidden; … … 629 634 630 635 .customize-control-upload .current .container, 636 .customize-control-background .current .container, 631 637 .customize-control-image .current .container { 632 638 min-height: 40px; … … 635 641 .customize-control-upload .placeholder, 636 642 .customize-control-image .placeholder, 643 .customize-control-background .placeholder, 637 644 .customize-control-header .placeholder { 638 645 width: 100%; … … 644 651 .customize-control-upload .inner, 645 652 .customize-control-image .inner, 653 .customize-control-background .inner, 646 654 .customize-control-header .inner { 647 655 display: none; … … 655 663 656 664 .customize-control-upload .inner, 665 .customize-control-background .inner, 657 666 .customize-control-image .inner { 658 667 display: block; … … 662 671 .customize-control-upload .inner, 663 672 .customize-control-image .inner, 673 .customize-control-background .inner, 664 674 .customize-control-header .inner, 665 675 .customize-control-header .inner .dashicons { … … 778 788 .customize-control-upload .actions, 779 789 .customize-control-image .actions, 790 .customize-control-background .actions, 780 791 .customize-control-header .actions { 781 792 margin-bottom: 32px; … … 794 805 .customize-control-upload img, 795 806 .customize-control-image img, 807 .customize-control-background img, 796 808 .customize-control-header img { 797 809 width: 100%; … … 804 816 .customize-control-image .remove-button, 805 817 .customize-control-image .default-button, 818 .customize-control-background .remove-button, 819 .customize-control-background .default-button, 806 820 .customize-control-header .remove { 807 821 float: left; … … 811 825 .customize-control-upload .upload-button, 812 826 .customize-control-image .upload-button, 827 .customize-control-background .upload-button, 813 828 .customize-control-header .new { 814 829 float: right; -
trunk/src/wp-admin/custom-background.php
r30657 r30885 61 61 62 62 add_action( 'admin_menu', array( $this, 'init' ) ); 63 64 add_action( 'wp_ajax_custom-background-add', array( $this, 'ajax_background_add' ) ); 65 66 // Unused since 3.5.0. 63 67 add_action( 'wp_ajax_set-background-image', array( $this, 'wp_set_background_image' ) ); 64 68 } … … 465 469 466 470 /** 467 * Unused since 3.5.0. 471 * AJAX handler for adding custom background context to an attachment. 472 * 473 * Triggered when the user adds a new background image from the 474 * Media Manager. 475 * 476 * @since 4.1.0 477 */ 478 public function ajax_background_add() { 479 check_ajax_referer( 'background-add', 'nonce' ); 480 481 if ( ! current_user_can( 'edit_theme_options' ) ) { 482 wp_send_json_error(); 483 } 484 485 $attachment_id = absint( $_POST['attachment_id'] ); 486 if ( $attachment_id < 1 ) { 487 wp_send_json_error(); 488 } 489 490 update_post_meta( $attachment_id, '_wp_attachment_is_custom_background', get_stylesheet() ); 491 492 wp_send_json_success(); 493 } 494 495 /** 468 496 * 469 497 * @since 3.4.0 498 * @deprecated 3.5.0 470 499 */ 471 500 public function attachment_fields_to_edit( $form_fields ) { … … 474 503 475 504 /** 476 * Unused since 3.5.0.477 505 * 478 506 * @since 3.4.0 507 * @deprecated 3.5.0 479 508 */ 480 509 public function filter_upload_tabs( $tabs ) { … … 482 511 } 483 512 513 /** 514 * 515 * @since 3.4.0 516 * @deprecated 3.5.0 517 */ 484 518 public function wp_set_background_image() { 485 519 if ( ! current_user_can('edit_theme_options') || ! isset( $_POST['attachment_id'] ) ) exit; -
trunk/src/wp-admin/js/customize-controls.js
r30872 r30885 1 /* globals _wpCustomizeHeader, _wp MediaViewsL10n */1 /* globals _wpCustomizeHeader, _wpCustomizeBackground, _wpMediaViewsL10n */ 2 2 (function( exports, $ ){ 3 3 var Container, focus, api = wp.customize; … … 1145 1145 1146 1146 /** 1147 * A control for uploading background images. 1148 * 1149 * @class 1150 * @augments wp.customize.UploadControl 1151 * @augments wp.customize.Control 1152 * @augments wp.customize.Class 1153 */ 1154 api.BackgroundControl = api.UploadControl.extend({ 1155 1156 /** 1157 * When the control's DOM structure is ready, 1158 * set up internal event bindings. 1159 */ 1160 ready: function() { 1161 api.UploadControl.prototype.ready.apply( this, arguments ); 1162 }, 1163 1164 /** 1165 * Callback handler for when an attachment is selected in the media modal. 1166 * Does an additional AJAX request for setting the background context. 1167 */ 1168 select: function() { 1169 api.UploadControl.prototype.select.apply( this, arguments ); 1170 1171 wp.ajax.post( 'custom-background-add', { 1172 nonce: _wpCustomizeBackground.nonces.add, 1173 wp_customize: 'on', 1174 theme: api.settings.theme.stylesheet, 1175 attachment_id: this.params.attachment.id 1176 } ); 1177 } 1178 }); 1179 1180 /** 1147 1181 * @class 1148 1182 * @augments wp.customize.Control … … 1823 1857 upload: api.UploadControl, 1824 1858 image: api.ImageControl, 1825 header: api.HeaderControl 1859 header: api.HeaderControl, 1860 background: api.BackgroundControl 1826 1861 }; 1827 1862 api.panelConstructor = {}; -
trunk/src/wp-includes/class-wp-customize-control.php
r30849 r30885 880 880 */ 881 881 class WP_Customize_Background_Image_Control extends WP_Customize_Image_Control { 882 public $type = 'background'; 882 883 883 884 /** … … 893 894 'label' => __( 'Background Image' ), 894 895 'section' => 'background_image', 896 ) ); 897 } 898 899 /** 900 * Enqueue control related scripts/styles. 901 * 902 * @since 4.1.0 903 */ 904 public function enqueue() { 905 parent::enqueue(); 906 907 wp_localize_script( 'customize-controls', '_wpCustomizeBackground', array( 908 'nonces' => array( 909 'add' => wp_create_nonce( 'background-add' ), 910 ), 895 911 ) ); 896 912 } … … 913 929 ), 914 930 'section' => 'header_image', 915 'context' => 'custom-header',916 931 'removed' => 'remove-header', 917 932 'get_url' => 'get_header_image', -
trunk/src/wp-includes/class-wp-customize-manager.php
r30695 r30885 975 975 $this->register_control_type( 'WP_Customize_Upload_Control' ); 976 976 $this->register_control_type( 'WP_Customize_Image_Control' ); 977 $this->register_control_type( 'WP_Customize_Background_Image_Control' ); 977 978 978 979 /* Site Title & Tagline */
Note: See TracChangeset
for help on using the changeset viewer.