]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-admin/custom-header.php
WordPress 4.1
[autoinstalls/wordpress.git] / wp-admin / custom-header.php
index 76f6f746d16afc4992ef0fffdbae2329199dc0b2..0e5ffa6b382310cbcb70aa683497172294b68984 100644 (file)
@@ -60,6 +60,11 @@ class Custom_Image_Header {
         */
        private $page = '';
 
+       /**
+        * @var bool
+        */
+       private $updated;
+
        /**
         * Constructor - Register administration header callback.
         *
@@ -300,9 +305,6 @@ class Custom_Image_Header {
        public function process_default_headers() {
                global $_wp_default_headers;
 
-               if ( !empty($this->headers) )
-                       return;
-
                if ( !isset($_wp_default_headers) )
                        return;
 
@@ -360,7 +362,7 @@ class Custom_Image_Header {
        }
 
        /**
-        * Execute Javascript depending on step.
+        * Execute JavaScript depending on step.
         *
         * @since 2.1.0
         */
@@ -373,7 +375,7 @@ class Custom_Image_Header {
        }
 
        /**
-        * Display Javascript based on Step 1 and 3.
+        * Display JavaScript based on Step 1 and 3.
         *
         * @since 2.6.0
         */
@@ -437,7 +439,7 @@ class Custom_Image_Header {
        }
 
        /**
-        * Display Javascript based on Step 2.
+        * Display JavaScript based on Step 2.
         *
         * @since 2.6.0
         */
@@ -522,6 +524,19 @@ class Custom_Image_Header {
 <div class="wrap">
 <h2><?php _e( 'Custom Header' ); ?></h2>
 
+<?php if ( current_user_can( 'customize' ) ) { ?>
+<div class="notice notice-info hide-if-no-customize">
+       <p>
+               <?php
+               printf(
+                       __( 'You can now manage and live-preview Custom Header in the <a href="%1$s">Customizer</a>.' ),
+                       admin_url( 'customize.php?autofocus[control]=header_image' )
+               );
+               ?>
+       </p>
+</div>
+<?php } ?>
+
 <?php if ( ! empty( $this->updated ) ) { ?>
 <div id="message" class="updated">
 <p><?php printf( __( 'Header updated. <a href="%s">Visit your site</a> to see how it looks.' ), home_url( '/' ) ); ?></p>
@@ -555,7 +570,7 @@ class Custom_Image_Header {
                else
                        $style = ' style="display:none;"';
                ?>
-               <h1><a id="name" class="displaying-header-text" <?php echo $style; ?> onclick="return false;" href="<?php bloginfo('url'); ?>"><?php bloginfo( 'name' ); ?></a></h1>
+               <h1><a id="name" class="displaying-header-text" <?php echo $style; ?> onclick="return false;" href="<?php bloginfo('url'); ?>" tabindex="-1"><?php bloginfo( 'name' ); ?></a></h1>
                <div id="desc" class="displaying-header-text" <?php echo $style; ?>><?php bloginfo( 'description' ); ?></div>
        </div>
        <?php } ?>
@@ -602,10 +617,10 @@ class Custom_Image_Header {
        ?>
        <p>
                <label for="choose-from-library-link"><?php _e( 'Or choose an image from your media library:' ); ?></label><br />
-               <a id="choose-from-library-link" class="button"
+               <button id="choose-from-library-link" class="button"
                        data-update-link="<?php echo esc_attr( $modal_update_href ); ?>"
                        data-choose="<?php esc_attr_e( 'Choose a Custom Header' ); ?>"
-                       data-update="<?php esc_attr_e( 'Set as header' ); ?>"><?php _e( 'Choose Image' ); ?></a>
+                       data-update="<?php esc_attr_e( 'Set as header' ); ?>"><?php _e( 'Choose Image' ); ?></button>
        </p>
        </form>
 </td>
@@ -615,6 +630,7 @@ class Custom_Image_Header {
 </table>
 
 <form method="post" action="<?php echo esc_url( add_query_arg( 'step', 1 ) ) ?>">
+<?php submit_button( null, 'screen-reader-text', 'save-header-options', false ); ?>
 <table class="form-table">
 <tbody>
        <?php if ( get_uploaded_header_images() ) : ?>
@@ -736,7 +752,7 @@ wp_nonce_field( 'custom-header-options', '_wpnonce-custom-header-options' ); ?>
        public function step_2() {
                check_admin_referer('custom-header-upload', '_wpnonce-custom-header-upload');
                if ( ! current_theme_supports( 'custom-header', 'uploads' ) )
-                       wp_die( __( 'Cheatin&#8217; uh?' ) );
+                       wp_die( __( 'Cheatin&#8217; uh?' ), 403 );
 
                if ( empty( $_POST ) && isset( $_GET['file'] ) ) {
                        $attachment_id = absint( $_GET['file'] );
@@ -748,7 +764,6 @@ wp_nonce_field( 'custom-header-options', '_wpnonce-custom-header-options' ); ?>
                        $attachment_id = $data['attachment_id'];
                        $file = $data['file'];
                        $url = $data['url'];
-                       $type = $data['type'];
                }
 
                if ( file_exists( $file ) ) {
@@ -888,10 +903,10 @@ wp_nonce_field( 'custom-header-options', '_wpnonce-custom-header-options' ); ?>
                check_admin_referer( 'custom-header-crop-image' );
 
                if ( ! current_theme_supports( 'custom-header', 'uploads' ) )
-                       wp_die( __( 'Cheatin&#8217; uh?' ) );
+                       wp_die( __( 'Cheatin&#8217; uh?' ), 403 );
 
                if ( ! empty( $_POST['skip-cropping'] ) && ! ( current_theme_supports( 'custom-header', 'flex-height' ) || current_theme_supports( 'custom-header', 'flex-width' ) ) )
-                       wp_die( __( 'Cheatin&#8217; uh?' ) );
+                       wp_die( __( 'Cheatin&#8217; uh?' ), 403 );
 
                if ( $_POST['oitar'] > 1 ) {
                        $_POST['x1'] = $_POST['x1'] * $_POST['oitar'];
@@ -1107,7 +1122,7 @@ wp_nonce_field( 'custom-header-options', '_wpnonce-custom-header-options' ); ?>
                $has_flex_width = current_theme_supports( 'custom-header', 'flex-width' );
                $has_flex_height = current_theme_supports( 'custom-header', 'flex-height' );
                $has_max_width = current_theme_supports( 'custom-header', 'max-width' ) ;
-               $dst = array( 'dst_height' => null, 'dst_height' => null );
+               $dst = array( 'dst_height' => null, 'dst_width' => null );
 
                // For flex, limit size of image displayed to 1500px unless theme says otherwise
                if ( $has_flex_width ) {