Changeset 36837
- Timestamp:
- 03/03/2016 07:55:15 PM (9 years ago)
- Location:
- trunk/src
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/css/customize-controls.css
r36804 r36837 722 722 .customize-control-cropped_image .current, 723 723 .customize-control-site_icon .current, 724 .customize-control- site_logo .current,724 .customize-control-custom_logo .current, 725 725 .customize-control-header .current { 726 726 margin-bottom: 8px; … … 764 764 .customize-control-site_icon .default-button, 765 765 .customize-control-site_icon .upload-button, 766 .customize-control- site_logo .remove-button,767 .customize-control- site_logo .default-button,768 .customize-control- site_logo .upload-button,766 .customize-control-custom_logo .remove-button, 767 .customize-control-custom_logo .default-button, 768 .customize-control-custom_logo .upload-button, 769 769 .customize-control-header button.new, 770 770 .customize-control-header button.remove { … … 780 780 .customize-control-cropped_image .current .container, 781 781 .customize-control-site_icon .current .container, 782 .customize-control- site_logo .current .container,782 .customize-control-custom_logo .current .container, 783 783 .customize-control-header .current .container { 784 784 overflow: hidden; … … 794 794 .customize-control-cropped_image .current .container, 795 795 .customize-control-site_icon .current .container, 796 .customize-control- site_logo .current .container,796 .customize-control-custom_logo .current .container, 797 797 .customize-control-image .current .container { 798 798 min-height: 40px; … … 823 823 .customize-control-cropped_image .inner, 824 824 .customize-control-site_icon .inner, 825 .customize-control- site_logo .inner,825 .customize-control-custom_logo .inner, 826 826 .customize-control-header .inner { 827 827 display: none; … … 839 839 .customize-control-cropped_image .inner, 840 840 .customize-control-site_icon .inner, 841 .customize-control- site_logo .inner,841 .customize-control-custom_logo .inner, 842 842 .customize-control-image .inner { 843 843 display: block; … … 851 851 .customize-control-cropped_image .inner, 852 852 .customize-control-site_icon .inner, 853 .customize-control- site_logo.inner,853 .customize-control-custom_logo.inner, 854 854 .customize-control-header .inner, 855 855 .customize-control-header .inner .dashicons { … … 995 995 .customize-control-site_icon .remove-button, 996 996 .customize-control-site_icon .default-button, 997 .customize-control- site_logo .remove-button,998 .customize-control- site_logo .default-button,997 .customize-control-custom_logo .remove-button, 998 .customize-control-custom_logo .default-button, 999 999 .customize-control-header .remove { 1000 1000 float: left; … … 1008 1008 .customize-control-cropped_image .upload-button, 1009 1009 .customize-control-site_icon .upload-button, 1010 .customize-control- site_logo .upload-button,1010 .customize-control-custom_logo .upload-button, 1011 1011 .customize-control-header .new { 1012 1012 float: right; -
trunk/src/wp-admin/includes/admin.php
r36698 r36837 73 73 require_once(ABSPATH . 'wp-admin/includes/class-wp-site-icon.php'); 74 74 75 /** WordPress SiteLogo API */75 /** WordPress Custom Logo API */ 76 76 require_once(ABSPATH . 'wp-admin/includes/class-wp-site-logo.php'); 77 77 -
trunk/src/wp-admin/includes/class-wp-site-logo.php
r36820 r36837 1 1 <?php 2 2 /** 3 * Administration API: WP_ Site_Logo class3 * Administration API: WP_Custom_Logo class 4 4 * 5 5 * @package WordPress … … 9 9 10 10 /** 11 * Core class used to implement sitelogo functionality.11 * Core class used to implement custom logo functionality. 12 12 * 13 13 * @since 4.5.0 14 14 */ 15 class WP_ Site_Logo {15 class WP_Custom_Logo { 16 16 17 17 /** … … 35 35 public function head_text_styles() { 36 36 // Bail if our theme supports custom headers. 37 if ( current_theme_supports( 'custom-header' ) || get_theme_mod( ' site_logo_header_text', true ) ) {37 if ( current_theme_supports( 'custom-header' ) || get_theme_mod( 'custom_logo_header_text', true ) ) { 38 38 return; 39 39 } … … 41 41 // Is Display Header Text unchecked? If so, hide the header text. 42 42 ?> 43 <!-- SiteLogo: hide header text -->43 <!-- Custom Logo: hide header text --> 44 44 <style type="text/css"> 45 45 <?php echo sanitize_html_class( $this->header_text_classes() ); ?> { … … 52 52 53 53 /** 54 * Reset s the sitelogo if the current logo is deleted in the media manager.54 * Reset the custom logo if the current logo is deleted in the media manager. 55 55 * 56 56 * @since 4.5.0 … … 60 60 */ 61 61 public function delete_attachment_data( $post_id ) { 62 $ site_logo_id = get_theme_mod( 'site_logo' );62 $custom_logo_id = get_theme_mod( 'custom_logo' ); 63 63 64 if ( $ site_logo_id && $site_logo_id == $post_id ) {65 remove_theme_mod( ' site_logo' );64 if ( $custom_logo_id && $custom_logo_id == $post_id ) { 65 remove_theme_mod( 'custom_logo' ); 66 66 } 67 67 } … … 106 106 */ 107 107 protected function header_text_classes() { 108 $args = get_theme_support( ' site-logo' );108 $args = get_theme_support( 'custom-logo' ); 109 109 110 110 if ( isset( $args[0]['header-text'] ) ) { … … 132 132 133 133 /** 134 * WP_ Site_Logo instance.134 * WP_Custom_Logo instance. 135 135 * 136 * @global WP_ Site_Logo $wp_site_logo136 * @global WP_Custom_Logo $wp_custom_logo 137 137 */ 138 $GLOBALS['wp_ site_logo'] = new WP_Site_Logo;138 $GLOBALS['wp_custom_logo'] = new WP_Custom_Logo; -
trunk/src/wp-admin/js/customize-controls.js
r36805 r36837 2304 2304 2305 2305 /** 2306 * A control for selecting Site Logos.2306 * A control for selecting custom logos. 2307 2307 * 2308 2308 * @class … … 2311 2311 * @augments wp.customize.Class 2312 2312 */ 2313 api. SiteLogoControl = api.MediaControl.extend({2313 api.CustomLogoControl = api.MediaControl.extend({ 2314 2314 2315 2315 /** … … 2331 2331 control.setting.bind( function( attachmentId ) { 2332 2332 wp.media.attachment( attachmentId ).fetch().done( function() { 2333 wp.customize.previewer.send( ' site-logo-attachment-data', this.attributes );2333 wp.customize.previewer.send( 'custom-logo-attachment-data', this.attributes ); 2334 2334 } ); 2335 2335 … … 3246 3246 cropped_image: api.CroppedImageControl, 3247 3247 site_icon: api.SiteIconControl, 3248 site_logo: api.SiteLogoControl,3248 custom_logo: api.CustomLogoControl, 3249 3249 header: api.HeaderControl, 3250 3250 background: api.BackgroundControl, -
trunk/src/wp-includes/class-wp-customize-manager.php
r36796 r36837 1849 1849 $this->register_control_type( 'WP_Customize_Cropped_Image_Control' ); 1850 1850 $this->register_control_type( 'WP_Customize_Site_Icon_Control' ); 1851 $this->register_control_type( 'WP_Customize_ Site_Logo_Control' );1851 $this->register_control_type( 'WP_Customize_Custom_Logo_Control' ); 1852 1852 $this->register_control_type( 'WP_Customize_Theme_Control' ); 1853 1853 … … 1961 1961 ) ) ); 1962 1962 1963 $this->add_setting( ' site_logo', array(1964 'theme_supports' => array( ' site-logo' ),1963 $this->add_setting( 'custom_logo', array( 1964 'theme_supports' => array( 'custom-logo' ), 1965 1965 'transport' => 'postMessage', 1966 1966 ) ); 1967 1967 1968 $this->add_control( new WP_Customize_ Site_Logo_Control( $this, 'site_logo', array(1968 $this->add_control( new WP_Customize_Custom_Logo_Control( $this, 'custom_logo', array( 1969 1969 'label' => __( 'Logo' ), 1970 1970 'section' => 'title_tagline', … … 1973 1973 1974 1974 if ( isset( $this->selective_refresh ) ) { 1975 $this->selective_refresh->add_partial( ' site_logo', array(1976 'settings' => array( ' site_logo' ),1977 'selector' => '. site-logo-link',1978 'render_callback' => array( $this, '_render_ site_logo_partial' ),1975 $this->selective_refresh->add_partial( 'custom_logo', array( 1976 'settings' => array( 'custom_logo' ), 1977 'selector' => '.custom-logo-link', 1978 'render_callback' => array( $this, '_render_custom_logo_partial' ), 1979 1979 'container_inclusive' => true, 1980 1980 ) ); … … 2212 2212 2213 2213 /** 2214 * Callback for rendering the site logo, used in the site_logo partial.2214 * Callback for rendering the custom logo, used in the custom_logo partial. 2215 2215 * 2216 2216 * This method exists because the partial object and context data are passed 2217 * into a partial's render_callback so we cannot use get_ the_site_logo() as2217 * into a partial's render_callback so we cannot use get_custom_logo() as 2218 2218 * the render_callback directly since it expects a blog ID as the first 2219 2219 * argument. When WP no longer supports PHP 5.3, this method can be removed … … 2225 2225 * @access private 2226 2226 * 2227 * @return string Sitelogo.2228 */ 2229 public function _render_ site_logo_partial() {2230 return get_ the_site_logo();2227 * @return string Custom logo. 2228 */ 2229 public function _render_custom_logo_partial() { 2230 return get_custom_logo(); 2231 2231 } 2232 2232 } -
trunk/src/wp-includes/customize/class-wp-customize-site-logo-control.php
r36698 r36837 1 1 <?php 2 2 /** 3 * Customize API: WP_Customize_ Site_Logo_Control class3 * Customize API: WP_Customize_Custom_Logo_Control class 4 4 * 5 5 * @package WordPress … … 9 9 10 10 /** 11 * Customize Site Logo control class.11 * Customize custom logo control class. 12 12 * 13 13 * Used only for custom functionality in JavaScript. … … 17 17 * @see WP_Customize_Image_Control 18 18 */ 19 class WP_Customize_ Site_Logo_Control extends WP_Customize_Image_Control {19 class WP_Customize_Custom_Logo_Control extends WP_Customize_Image_Control { 20 20 21 21 /** … … 26 26 * @var string 27 27 */ 28 public $type = ' site_logo';28 public $type = 'custom_logo'; 29 29 30 30 /** -
trunk/src/wp-includes/general-template.php
r36802 r36837 840 840 841 841 /** 842 * Whether the site has a Site Logo.842 * Whether the site has a custom logo. 843 843 * 844 844 * @since 4.5.0 845 845 * 846 846 * @param int $blog_id Optional. ID of the blog in question. Default current blog. 847 * @return bool Whether the site has a sitelogo or not.848 */ 849 function has_ site_logo( $blog_id = 0 ) {847 * @return bool Whether the site has a custom logo or not. 848 */ 849 function has_custom_logo( $blog_id = 0 ) { 850 850 if ( is_multisite() && (int) $blog_id !== get_current_blog_id() ) { 851 851 switch_to_blog( $blog_id ); 852 852 } 853 853 854 $ site_logo_id = get_theme_mod( 'site_logo' );854 $custom_logo_id = get_theme_mod( 'custom_logo' ); 855 855 856 856 if ( is_multisite() && ms_is_switched() ) { … … 858 858 } 859 859 860 return (bool) $ site_logo_id;861 } 862 863 /** 864 * Returns a Site Logo, linked to home.860 return (bool) $custom_logo_id; 861 } 862 863 /** 864 * Returns a custom logo, linked to home. 865 865 * 866 866 * @since 4.5.0 867 867 * 868 868 * @param int $blog_id Optional. ID of the blog in question. Default current blog. 869 * @return string Sitelogo markup.870 */ 871 function get_ the_site_logo( $blog_id = 0 ) {869 * @return string Custom logo markup. 870 */ 871 function get_custom_logo( $blog_id = 0 ) { 872 872 $html = ''; 873 873 … … 876 876 } 877 877 878 $ site_logo_id = get_theme_mod( 'site_logo' );878 $custom_logo_id = get_theme_mod( 'custom_logo' ); 879 879 880 880 if ( is_multisite() && ms_is_switched() ) { 881 881 restore_current_blog(); 882 882 } 883 $size = get_theme_support( ' site-logo' );883 $size = get_theme_support( 'custom-logo' ); 884 884 $size = $size[0]['size']; 885 885 886 886 // We have a logo. Logo is go. 887 if ( $ site_logo_id ) {888 $html = sprintf( '<a href="%1$s" class=" site-logo-link" rel="home" itemprop="url">%2$s</a>',887 if ( $custom_logo_id ) { 888 $html = sprintf( '<a href="%1$s" class="custom-logo-link" rel="home" itemprop="url">%2$s</a>', 889 889 esc_url( home_url( '/' ) ), 890 wp_get_attachment_image( $ site_logo_id, $size, false, array(891 'class' => " site-logo attachment-$size",890 wp_get_attachment_image( $custom_logo_id, $size, false, array( 891 'class' => "custom-logo attachment-$size", 892 892 'data-size' => $size, 893 893 'itemprop' => 'logo', … … 898 898 // If no logo is set but we're in the Customizer, leave a placeholder (needed for the live preview). 899 899 elseif ( is_customize_preview() ) { 900 $html = sprintf( '<a href="%1$s" class=" site-logo-link" style="display:none;"><img class="site-logo" data-size="%2$s" /></a>',900 $html = sprintf( '<a href="%1$s" class="custom-logo-link" style="display:none;"><img class="custom-logo" data-size="%2$s" /></a>', 901 901 esc_url( home_url( '/' ) ), 902 902 esc_attr( $size ) … … 905 905 906 906 /** 907 * Filter the Site Logo output.907 * Filter the custom logo output. 908 908 * 909 909 * @since 4.5.0 910 910 * 911 * @param string $html Site Logo HTML output.911 * @param string $html Custom logo HTML output. 912 912 * @param string $size Size specified in add_theme_support declaration, or 'thumbnail' default. 913 913 */ 914 return apply_filters( 'get_ the_site_logo', $html, $size );915 } 916 917 /** 918 * Displays a Site Logo, linked to home.914 return apply_filters( 'get_custom_logo', $html, $size ); 915 } 916 917 /** 918 * Displays a custom logo, linked to home. 919 919 * 920 920 * @since 4.5.0 … … 922 922 * @param int $blog_id Optional. ID of the blog in question. Default current blog. 923 923 */ 924 function the_ site_logo( $blog_id = 0 ) {925 echo get_ the_site_logo( $blog_id );924 function the_custom_logo( $blog_id = 0 ) { 925 echo get_custom_logo( $blog_id ); 926 926 } 927 927 -
trunk/src/wp-includes/js/customize-preview.js
r36698 r36837 225 225 226 226 /** 227 * SiteLogo228 * 229 * The sitelogo setting only contains the attachment ID. To avoid having to send an AJAX request to get more227 * Custom Logo 228 * 229 * The custom logo setting only contains the attachment ID. To avoid having to send an AJAX request to get more 230 230 * data, we send a separate message with the attachment data we get from the Customizer's media modal. 231 231 * Therefore first callback handles only the event of a new logo being selected. … … 235 235 * @since 4.5.0 236 236 */ 237 api.preview.bind( ' site-logo-attachment-data', function( attachment ) {238 var $logo = $( '. site-logo' ),237 api.preview.bind( 'custom-logo-attachment-data', function( attachment ) { 238 var $logo = $( '.custom-logo' ), 239 239 size = $logo.data( 'size' ), 240 240 srcset = []; … … 256 256 } ); 257 257 258 $( '.site-logo-link' ).show(); 259 $( 'body' ).addClass( 'wp-site-logo' ); 260 } ); 261 262 api( 'site_logo', function( setting ) { 258 $( '.custom-logo-link' ).show(); 259 } ); 260 261 api( 'custom_logo', function( setting ) { 263 262 setting.bind( function( newValue ) { 264 263 if ( ! newValue ) { 265 $( '.site-logo-link' ).hide(); 266 $( 'body' ).removeClass( 'wp-site-logo' ); 267 } 268 } ); 269 270 // Focus on the control when the logo is clicked, if there is no site_logo partial. 271 if ( ! api.selectiveRefresh || ! api.selectiveRefresh.partial.has( 'site_logo' ) ) { 272 $( document.body ).on( 'click', '.site-logo-link', function( e ) { 264 $( '.custom-logo-link' ).hide(); 265 } 266 } ); 267 268 // Focus on the control when the logo is clicked, if there is no custom_logo partial. 269 if ( ! api.selectiveRefresh || ! api.selectiveRefresh.partial.has( 'custom_logo' ) ) { 270 $( document.body ).on( 'click', '.custom-logo-link', function( e ) { 273 271 if ( ! e.shiftKey ) { 274 272 return; 275 273 } 276 api.preview.send( 'focus-control-for-setting', ' site_logo' );274 api.preview.send( 'focus-control-for-setting', 'custom_logo' ); 277 275 } ); 278 $( '. site-logo-link' ).attr( 'title', api.settings.l10n.shiftClickToEdit );276 $( '.custom-logo-link' ).attr( 'title', api.settings.l10n.shiftClickToEdit ); 279 277 } 280 278 } ); -
trunk/src/wp-includes/post-template.php
r36698 r36837 706 706 if ( get_background_color() !== get_theme_support( 'custom-background', 'default-color' ) || get_background_image() ) 707 707 $classes[] = 'custom-background'; 708 709 if ( has_site_logo() ) {710 $classes[] = 'wp-site-logo';711 }712 708 713 709 $page = $wp_query->get( 'page' );
Note: See TracChangeset
for help on using the changeset viewer.