X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/41578db67d72562346e4dbb2a14889b23d522813..849f15aeed7a5e39314057bdc0064d8edd60dd7d:/wp-admin/custom-header.php diff --git a/wp-admin/custom-header.php b/wp-admin/custom-header.php index 2a6a2f30..0e5ffa6b 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; + 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,12 @@ class Custom_Image_Header { * @since 3.0.0 * @access private */ - var $page = ''; + private $page = ''; + + /** + * @var bool + */ + private $updated; /** * Constructor - Register administration header callback. @@ -68,7 +73,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 +85,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 +163,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 +205,7 @@ class Custom_Image_Header { * * @return int Current step */ - function step() { + public function step() { if ( ! isset( $_GET['step'] ) ) return 1; @@ -167,7 +224,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 +242,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 +256,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,16 +302,13 @@ 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) ) - return; - if ( !isset($_wp_default_headers) ) return; - if ( is_array( $this->default_headers ) ) { + if ( ! empty( $this->default_headers ) ) { return; } @@ -275,7 +329,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 { @@ -308,11 +362,11 @@ class Custom_Image_Header { } /** - * Execute Javascript depending on step. + * Execute JavaScript depending on step. * * @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(); @@ -321,15 +375,24 @@ class Custom_Image_Header { } /** - * Display Javascript based on Step 1 and 3. + * Display JavaScript based on Step 1 and 3. * * @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; + } + } + ?> +