X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/0f684a09c03e547d3132bddc970cbeafcd1102f4..refs/tags/wordpress-4.3:/wp-admin/custom-header.php diff --git a/wp-admin/custom-header.php b/wp-admin/custom-header.php index 1c9971f5..e61feb78 100644 --- a/wp-admin/custom-header.php +++ b/wp-admin/custom-header.php @@ -20,18 +20,16 @@ class Custom_Image_Header { * * @var callback * @since 2.1.0 - * @access private */ - var $admin_header_callback; + public $admin_header_callback; /** * Callback for header div. * * @var callback * @since 3.0.0 - * @access private */ - var $admin_image_div_callback; + public $admin_image_div_callback; /** * Holds default headers. @@ -40,25 +38,12 @@ class Custom_Image_Header { * @since 3.0.0 * @access private */ - var $default_headers = array(); + public $default_headers = array(); /** - * Holds custom headers uploaded by the user. - * - * @var array - * @since 3.2.0 - * @access private + * @var bool */ - var $uploaded_headers = array(); - - /** - * Holds the page menu hook. - * - * @var string - * @since 3.0.0 - * @access private - */ - var $page = ''; + private $updated; /** * Constructor - Register administration header callback. @@ -66,9 +51,8 @@ class Custom_Image_Header { * @since 2.1.0 * @param callback $admin_header_callback * @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; @@ -85,20 +69,20 @@ class Custom_Image_Header { * * @since 2.1.0 */ - function init() { - if ( ! current_user_can('edit_theme_options') ) + public function init() { + $page = add_theme_page( __( 'Header' ), __( 'Header' ), 'edit_theme_options', 'custom-header', array( $this, 'admin_page' ) ); + if ( ! $page ) { return; + } - $this->page = $page = add_theme_page(__('Header'), __('Header'), 'edit_theme_options', 'custom-header', array($this, 'admin_page')); - - add_action("admin_print_scripts-$page", array($this, 'js_includes')); - add_action("admin_print_styles-$page", array($this, 'css_includes')); - add_action("admin_head-$page", array($this, 'help') ); - add_action("admin_head-$page", array($this, 'take_action'), 50); - add_action("admin_head-$page", array($this, 'js'), 50); - if ( $this->admin_header_callback ) - add_action("admin_head-$page", $this->admin_header_callback, 51); - + add_action( "admin_print_scripts-$page", array( $this, 'js_includes' ) ); + add_action( "admin_print_styles-$page", array( $this, 'css_includes' ) ); + add_action( "admin_head-$page", array( $this, 'help' ) ); + add_action( "admin_head-$page", array( $this, 'take_action' ), 50 ); + add_action( "admin_head-$page", array( $this, 'js' ), 50 ); + if ( $this->admin_header_callback ) { + add_action( "admin_head-$page", $this->admin_header_callback, 51 ); + } } /** @@ -106,7 +90,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'), @@ -136,7 +120,7 @@ class Custom_Image_Header { get_current_screen()->set_help_sidebar( '
' . __( 'For more information:' ) . '
' . - '' . __( 'Documentation on Custom Header' ) . '
' . + '' . __( 'Documentation on Custom Header' ) . '
' . '' . __( 'Support Forums' ) . '
' ); } @@ -148,7 +132,7 @@ class Custom_Image_Header { * * @return int Current step */ - function step() { + public function step() { if ( ! isset( $_GET['step'] ) ) return 1; @@ -167,7 +151,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 +169,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 +183,7 @@ class Custom_Image_Header { * * @since 2.6.0 */ - function take_action() { + public function take_action() { if ( ! current_user_can('edit_theme_options') ) return; @@ -244,13 +228,12 @@ class Custom_Image_Header { * Process the default headers * * @since 3.0.0 + * + * @global array $_wp_default_headers */ - function process_default_headers() { + public function process_default_headers() { global $_wp_default_headers; - if ( !empty($this->headers) ) - return; - if ( !isset($_wp_default_headers) ) return; @@ -275,7 +258,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 { @@ -286,7 +269,7 @@ class Custom_Image_Header { if ( 1 < count( $headers ) ) { echo '