X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/0f684a09c03e547d3132bddc970cbeafcd1102f4..refs/tags/wordpress-4.0:/wp-admin/custom-header.php?ds=sidebyside diff --git a/wp-admin/custom-header.php b/wp-admin/custom-header.php index 1c9971f5..76f6f746 100644 --- a/wp-admin/custom-header.php +++ b/wp-admin/custom-header.php @@ -22,7 +22,7 @@ class Custom_Image_Header { * @since 2.1.0 * @access private */ - var $admin_header_callback; + private $admin_header_callback; /** * Callback for header div. @@ -31,7 +31,7 @@ class Custom_Image_Header { * @since 3.0.0 * @access private */ - var $admin_image_div_callback; + private $admin_image_div_callback; /** * Holds default headers. @@ -40,7 +40,7 @@ class Custom_Image_Header { * @since 3.0.0 * @access private */ - var $default_headers = array(); + private $default_headers = array(); /** * Holds custom headers uploaded by the user. @@ -49,7 +49,7 @@ class Custom_Image_Header { * @since 3.2.0 * @access private */ - var $uploaded_headers = array(); + private $uploaded_headers = array(); /** * Holds the page menu hook. @@ -58,7 +58,7 @@ class Custom_Image_Header { * @since 3.0.0 * @access private */ - var $page = ''; + private $page = ''; /** * Constructor - Register administration header callback. @@ -68,7 +68,7 @@ class Custom_Image_Header { * @param callback $admin_image_div_callback Optional custom image div output callback. * @return Custom_Image_Header */ - function __construct($admin_header_callback, $admin_image_div_callback = '') { + public function __construct($admin_header_callback, $admin_image_div_callback = '') { $this->admin_header_callback = $admin_header_callback; $this->admin_image_div_callback = $admin_image_div_callback; @@ -80,12 +80,64 @@ class Custom_Image_Header { add_action( 'wp_ajax_custom-header-remove', array( $this, 'ajax_header_remove' ) ); } + /** + * Make private properties readable for backwards compatibility. + * + * @since 4.0.0 + * @access public + * + * @param string $name Property to get. + * @return mixed Property. + */ + public function __get( $name ) { + return $this->$name; + } + + /** + * Make private properties settable for backwards compatibility. + * + * @since 4.0.0 + * @access public + * + * @param string $name Property to set. + * @param mixed $value Property value. + * @return mixed Newly-set property. + */ + public function __set( $name, $value ) { + return $this->$name = $value; + } + + /** + * Make private properties checkable for backwards compatibility. + * + * @since 4.0.0 + * @access public + * + * @param string $name Property to check if set. + * @return bool Whether the property is set. + */ + public function __isset( $name ) { + return isset( $this->$name ); + } + + /** + * Make private properties un-settable for backwards compatibility. + * + * @since 4.0.0 + * @access public + * + * @param string $name Property to unset. + */ + public function __unset( $name ) { + unset( $this->$name ); + } + /** * Set up the hooks for the Custom Header admin page. * * @since 2.1.0 */ - function init() { + public function init() { if ( ! current_user_can('edit_theme_options') ) return; @@ -106,7 +158,7 @@ class Custom_Image_Header { * * @since 3.0.0 */ - function help() { + public function help() { get_current_screen()->add_help_tab( array( 'id' => 'overview', 'title' => __('Overview'), @@ -148,7 +200,7 @@ class Custom_Image_Header { * * @return int Current step */ - function step() { + public function step() { if ( ! isset( $_GET['step'] ) ) return 1; @@ -167,7 +219,7 @@ class Custom_Image_Header { * * @since 2.1.0 */ - function js_includes() { + public function js_includes() { $step = $this->step(); if ( ( 1 == $step || 3 == $step ) ) { @@ -185,7 +237,7 @@ class Custom_Image_Header { * * @since 2.7.0 */ - function css_includes() { + public function css_includes() { $step = $this->step(); if ( ( 1 == $step || 3 == $step ) && current_theme_supports( 'custom-header', 'header-text' ) ) @@ -199,7 +251,7 @@ class Custom_Image_Header { * * @since 2.6.0 */ - function take_action() { + public function take_action() { if ( ! current_user_can('edit_theme_options') ) return; @@ -245,7 +297,7 @@ class Custom_Image_Header { * * @since 3.0.0 */ - function process_default_headers() { + public function process_default_headers() { global $_wp_default_headers; if ( !empty($this->headers) ) @@ -275,7 +327,7 @@ class Custom_Image_Header { * * @since 3.0.0 */ - function show_header_selector( $type = 'default' ) { + public function show_header_selector( $type = 'default' ) { if ( 'default' == $type ) { $headers = $this->default_headers; } else { @@ -312,7 +364,7 @@ class Custom_Image_Header { * * @since 2.1.0 */ - function js() { + public function js() { $step = $this->step(); if ( ( 1 == $step || 3 == $step ) && current_theme_supports( 'custom-header', 'header-text' ) ) $this->js_1(); @@ -325,11 +377,20 @@ class Custom_Image_Header { * * @since 2.6.0 */ - function js_1() { ?> + public function js_1() { + $default_color = ''; + if ( current_theme_supports( 'custom-header', 'default-text-color' ) ) { + $default_color = get_theme_support( 'custom-header', 'default-text-color' ); + if ( $default_color && false === strpos( $default_color, '#' ) ) { + $default_color = '#' . $default_color; + } + } + ?> +