Ticket #17324: h2-to-h1.diff

File h2-to-h1.diff, 6.1 KB (added by ryan, 2 years ago)
Line 
1Index: wp-admin/includes/template.php
2===================================================================
3--- wp-admin/includes/template.php      (revision 17843)
4+++ wp-admin/includes/template.php      (working copy)
5@@ -2141,6 +2141,20 @@
6 }
7 
8 /**
9+ * Set an attribute for the current screen object
10+ *
11+ * @since 3.2.0
12+ *
13+ * @param string $key An attribute name
14+ * @param mixed $value Attribute value
15+ */
16+function set_screen_attribute( $key, $value ) {
17+       global $current_screen;
18+
19+       $current_screen->$key = $value;
20+}
21+
22+/**
23  * Echos a submit button, with provided text and appropriate class
24  *
25  * @since 3.1.0
26Index: wp-admin/edit-tags.php
27===================================================================
28--- wp-admin/edit-tags.php      (revision 17843)
29+++ wp-admin/edit-tags.php      (working copy)
30@@ -221,6 +221,11 @@
31        unset($help);
32 }
33 
34+set_screen_attribute( 'title', $title );
35+
36+if ( !empty($_REQUEST['s']) )
37+       set_screen_attribute( 'sub_title', sprintf( __( 'Search results for “%s”' ), esc_html( stripslashes($_REQUEST['s']) ) ) );
38+
39 require_once ('admin-header.php');
40 
41 if ( !current_user_can($tax->cap->edit_terms) )
42@@ -236,11 +241,6 @@
43 ?>
44 
45 <div class="wrap nosubsub">
46-<?php screen_icon(); ?>
47-<h2><?php echo esc_html( $title );
48-if ( !empty($_REQUEST['s']) )
49-       printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', esc_html( stripslashes($_REQUEST['s']) ) ); ?>
50-</h2>
51 
52 <?php if ( isset($_REQUEST['message']) && ( $msg = (int) $_REQUEST['message'] ) ) : ?>
53 <div id="message" class="updated"><p><?php echo $messages[$msg]; ?></p></div>
54Index: wp-admin/options-general.php
55===================================================================
56--- wp-admin/options-general.php        (revision 17843)
57+++ wp-admin/options-general.php        (working copy)
58@@ -74,8 +74,6 @@
59 ?>
60 
61 <div class="wrap">
62-<?php screen_icon(); ?>
63-<h2><?php echo esc_html( $title ); ?></h2>
64 
65 <form method="post" action="options.php">
66 <?php settings_fields('general'); ?>
67Index: wp-admin/index.php
68===================================================================
69--- wp-admin/index.php  (revision 17843)
70+++ wp-admin/index.php  (working copy)
71@@ -55,11 +55,6 @@
72 ?>
73 
74 <div class="wrap">
75-<?php screen_icon(); ?>
76-<h2><?php
77-echo esc_html( $title );
78-favorite_actions( $current_screen ); ?>
79-</h2>
80 
81 <div id="dashboard-widgets-wrap">
82 
83Index: wp-admin/edit-form-advanced.php
84===================================================================
85--- wp-admin/edit-form-advanced.php     (revision 17843)
86+++ wp-admin/edit-form-advanced.php     (working copy)
87@@ -194,8 +194,6 @@
88 ?>
89 
90 <div class="wrap">
91-<?php screen_icon(); ?>
92-<h2><?php echo esc_html( $title ); ?></h2>
93 <?php if ( $notice ) : ?>
94 <div id="notice" class="error"><p><?php echo $notice ?></p></div>
95 <?php endif; ?>
96Index: wp-admin/admin-header.php
97===================================================================
98--- wp-admin/admin-header.php   (revision 17843)
99+++ wp-admin/admin-header.php   (working copy)
100@@ -10,6 +10,10 @@
101 if ( ! defined( 'WP_ADMIN' ) )
102        require_once( './admin.php' );
103 
104+$current_screen->parent_file = $parent_file;
105+$current_screen->parent_base = preg_replace('/\?.*$/', '', $parent_file);
106+$current_screen->parent_base = str_replace('.php', '', $current_screen->parent_base);
107+
108 get_admin_page_title();
109 $title = esc_html( strip_tags( $title ) );
110 
111@@ -129,13 +133,18 @@
112        if ( strlen($blog_name) > 30 )
113                $title_class = 'class="long-title"';
114 }
115+
116+$screen_icon = !empty( $current_screen->icon ) ? sanitize_key( $current_screen->icon ) : '';
117+screen_icon();
118+
119+if ( !empty( $current_screen->title ) )
120+       $title = esc_html( strip_tags( $current_screen->title ) );
121 ?>
122-
123-<img id="header-logo" src="<?php echo esc_url( includes_url( 'images/blank.gif' ) ); ?>" alt="" width="16" height="16" />
124 <h1 id="site-heading" <?php echo $title_class ?>>
125-       <a href="<?php echo trailingslashit( get_bloginfo( 'url' ) ); ?>" title="<?php esc_attr_e('Visit Site') ?>">
126-               <span id="site-title"><?php echo $blog_name ?></span>
127-       </a>
128+       <?php echo $title;
129+       if ( ! empty( $current_screen->sub_title ) )
130+               echo '<span class="subtitle">' . esc_html( strip_tags( $current_screen->sub_title ) ) . '</span>';
131+       ?>
132 </h1>
133 
134 <?php
135@@ -161,6 +170,12 @@
136 $links = array_map( 'trim', $links, array_fill( 0, count( $links ), " |\n\t" ) );
137 $links = '<li>' . implode( '</li><li>', $links ) . '</li>';
138 
139+// Site greeting
140+$welcome = home_url();
141+$welcome = preg_replace( '#^https?://#', '', $welcome );
142+untrailingslashit( $welcome );
143+
144+$welcome = sprintf( __( 'Welcome to %s' ), '<a href="'. get_home_url() . '">' . esc_html( $welcome ) . '</a>' );
145 ?>
146 
147 <div id="wphead-info">
148@@ -171,6 +186,7 @@
149                <ul><?php echo $links; ?></ul>
150        </div></div>
151 </div>
152+<p><?php echo $welcome; ?></p>
153 </div>
154 </div>
155 
156@@ -178,11 +194,8 @@
157 
158 <div id="wpbody">
159 <?php
160-unset($title_class, $blog_name, $total_update_count, $update_title);
161+unset($title_class, $blog_name, $total_update_count, $update_title, $howdy, $welcome);
162 
163-$current_screen->parent_file = $parent_file;
164-$current_screen->parent_base = preg_replace('/\?.*$/', '', $parent_file);
165-$current_screen->parent_base = str_replace('.php', '', $current_screen->parent_base);
166 ?>
167 
168 <div id="wpbody-content">
169Index: wp-admin/edit.php
170===================================================================
171--- wp-admin/edit.php   (revision 17843)
172+++ wp-admin/edit.php   (working copy)
173@@ -186,16 +186,14 @@
174 
175 add_screen_option( 'per_page', array('label' => $title, 'default' => 20) );
176 
177+set_screen_attribute( 'title', $title );
178+
179+if ( isset($_REQUEST['s']) && $_REQUEST['s'] )
180+       set_screen_attribute( 'sub_title', sprintf( __( 'Search results for &#8220;%s&#8221;' ), get_search_query() ) );
181+
182 require_once('./admin-header.php');
183 ?>
184 <div class="wrap">
185-<?php screen_icon(); ?>
186-<h2><?php
187-echo esc_html( $post_type_object->labels->name );
188-favorite_actions( $current_screen );
189-if ( isset($_REQUEST['s']) && $_REQUEST['s'] )
190-       printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', get_search_query() ); ?>
191-</h2>
192 
193 <?php
194 if ( isset($_REQUEST['posted']) && $_REQUEST['posted'] ) : $_REQUEST['posted'] = (int) $_REQUEST['posted']; ?>