Ticket #18690: 18690-wp-screen.diff
| File 18690-wp-screen.diff, 10.1 KB (added by , 15 years ago) |
|---|
-
wp-admin/includes/template.php
2077 2077 * @param string $id Screen id, optional. 2078 2078 */ 2079 2079 function set_current_screen( $id = '' ) { 2080 global $current_screen , $hook_suffix, $typenow, $taxnow;2080 global $current_screen; 2081 2081 2082 $ action = '';2082 $current_screen = new WP_Screen( $id ); 2083 2083 2084 if ( empty($id) ) {2085 $current_screen = $hook_suffix;2086 $current_screen = str_replace('.php', '', $current_screen);2087 if ( preg_match('/-add|-new$/', $current_screen) )2088 $action = 'add';2089 $current_screen = str_replace('-new', '', $current_screen);2090 $current_screen = str_replace('-add', '', $current_screen);2091 $current_screen = array('id' => $current_screen, 'base' => $current_screen);2092 } else {2093 $id = sanitize_key($id);2094 if ( false !== strpos($id, '-') ) {2095 list( $id, $typenow ) = explode('-', $id, 2);2096 if ( taxonomy_exists( $typenow ) ) {2097 $id = 'edit-tags';2098 $taxnow = $typenow;2099 $typenow = '';2100 }2101 }2102 $current_screen = array('id' => $id, 'base' => $id);2103 }2104 2105 $current_screen = (object) $current_screen;2106 2107 $current_screen->action = $action;2108 2109 // Map index to dashboard2110 if ( 'index' == $current_screen->base )2111 $current_screen->base = 'dashboard';2112 if ( 'index' == $current_screen->id )2113 $current_screen->id = 'dashboard';2114 2115 if ( 'edit' == $current_screen->id ) {2116 if ( empty($typenow) )2117 $typenow = 'post';2118 $current_screen->id .= '-' . $typenow;2119 $current_screen->post_type = $typenow;2120 } elseif ( 'post' == $current_screen->id ) {2121 if ( empty($typenow) )2122 $typenow = 'post';2123 $current_screen->id = $typenow;2124 $current_screen->post_type = $typenow;2125 } elseif ( 'edit-tags' == $current_screen->id ) {2126 if ( empty($taxnow) )2127 $taxnow = 'post_tag';2128 $current_screen->id = 'edit-' . $taxnow;2129 $current_screen->taxonomy = $taxnow;2130 }2131 2132 $current_screen->is_network = is_network_admin();2133 $current_screen->is_user = is_user_admin();2134 2135 if ( $current_screen->is_network ) {2136 $current_screen->base .= '-network';2137 $current_screen->id .= '-network';2138 } elseif ( $current_screen->is_user ) {2139 $current_screen->base .= '-user';2140 $current_screen->id .= '-user';2141 }2142 2143 2084 $current_screen = apply_filters('current_screen', $current_screen); 2144 2085 } 2145 2086 … … 2271 2212 </script> 2272 2213 <?php 2273 2214 } 2215 2216 class WP_Screen { 2217 var $action = ''; 2218 var $base; 2219 var $id; 2220 var $is_network; 2221 var $is_user; 2222 var $parent_base; 2223 var $parent_file; 2224 var $post_type; 2225 var $taxonomy; 2226 2227 function __construct( $id = '' ) { 2228 global $hook_suffix, $typenow, $taxnow; 2229 2230 $action = ''; 2231 2232 if ( empty( $id ) ) { 2233 $screen = $hook_suffix; 2234 $screen = str_replace('.php', '', $screen); 2235 if ( preg_match('/-add|-new$/', $screen) ) 2236 $action = 'add'; 2237 $screen = str_replace('-new', '', $screen); 2238 $screen = str_replace('-add', '', $screen); 2239 $this->id = $this->base = $screen; 2240 } else { 2241 $id = sanitize_key( $id ); 2242 if ( false !== strpos($id, '-') ) { 2243 list( $id, $typenow ) = explode('-', $id, 2); 2244 if ( taxonomy_exists( $typenow ) ) { 2245 $id = 'edit-tags'; 2246 $taxnow = $typenow; 2247 $typenow = ''; 2248 } 2249 } 2250 $this->id = $this->base = $id; 2251 } 2252 2253 $this->action = $action; 2254 2255 // Map index to dashboard 2256 if ( 'index' == $this->base ) 2257 $this->base = 'dashboard'; 2258 if ( 'index' == $this->id ) 2259 $this->id = 'dashboard'; 2260 2261 if ( 'edit' == $this->id ) { 2262 if ( empty($typenow) ) 2263 $typenow = 'post'; 2264 $this->id .= '-' . $typenow; 2265 $this->post_type = $typenow; 2266 } elseif ( 'post' == $this->id ) { 2267 if ( empty($typenow) ) 2268 $typenow = 'post'; 2269 $this->id = $typenow; 2270 $this->post_type = $typenow; 2271 } elseif ( 'edit-tags' == $this->id ) { 2272 if ( empty($taxnow) ) 2273 $taxnow = 'post_tag'; 2274 $this->id = 'edit-' . $taxnow; 2275 $this->taxonomy = $taxnow; 2276 } 2277 2278 $this->is_network = is_network_admin(); 2279 $this->is_user = is_user_admin(); 2280 2281 if ( $this->is_network ) { 2282 $this->base .= '-network'; 2283 $this->id .= '-network'; 2284 } elseif ( $this->is_user ) { 2285 $this->base .= '-user'; 2286 $this->id .= '-user'; 2287 } 2288 } 2289 2290 function set_parentage( $parent_file ) { 2291 $current_screen->parent_file = $parent_file; 2292 $current_screen->parent_base = preg_replace('/\?.*$/', '', $parent_file); 2293 $current_screen->parent_base = str_replace('.php', '', $current_screen->parent_base); 2294 } 2295 2296 function add_option( $option, $args = array() ) { 2297 return add_screen_option( $option, $args ); 2298 } 2299 2300 function add_help_tab( $title, $content) { 2301 // @todo update to use tabs code 2302 add_contextual_help( $this, $content ); 2303 } 2304 2305 function add_help_sidebar( $content ) { 2306 // @todo help links stuff 2307 } 2308 } 2309 No newline at end of file -
wp-admin/edit-form-advanced.php
160 160 do_action('do_meta_boxes', $post_type, 'advanced', $post); 161 161 do_action('do_meta_boxes', $post_type, 'side', $post); 162 162 163 add_screen_option('layout_columns', array('max' => 2, 'default' => 'auto') );163 $current_screen->add_option('layout_columns', array('max' => 2, 'default' => 'auto') ); 164 164 165 165 if ( 'post' == $post_type ) { 166 add_contextual_help($current_screen, 167 '<p>' . __('The title field and the big Post Editing Area are fixed in place, but you can reposition all the other boxes using drag and drop, and can minimize or expand them by clicking the title bar of each box. Use the Screen Options tab to unhide more boxes (Excerpt, Send Trackbacks, Custom Fields, Discussion, Slug, Author) or to choose a 1- or 2-column layout for this screen.') . '</p>' . 166 $current_screen->add_help_tab(__('Tab title'), '<p>' . __('The title field and the big Post Editing Area are fixed in place, but you can reposition all the other boxes using drag and drop, and can minimize or expand them by clicking the title bar of each box. Use the Screen Options tab to unhide more boxes (Excerpt, Send Trackbacks, Custom Fields, Discussion, Slug, Author) or to choose a 1- or 2-column layout for this screen.') . '</p>' . 168 167 '<p>' . __('<strong>Title</strong> - Enter a title for your post. After you enter a title, you’ll see the permalink below, which you can edit.') . '</p>' . 169 168 '<p>' . __('<strong>Post editor</strong> - Enter the text for your post. There are two modes of editing: Visual and HTML. Choose the mode by clicking on the appropriate tab. Visual mode gives you a WYSIWYG editor. Click the last icon in the row to get a second row of controls. The HTML mode allows you to enter raw HTML along with your post text. You can insert media files by clicking the icons above the post editor and following the directions. You can go the distraction-free writing screen, new in 3.2, via the Fullscreen icon in Visual mode (second to last in the top row) or the Fullscreen button in HTML mode (last in the row). Once there, you can make buttons visible by hovering over the top area. Exit Fullscreen back to the regular post editor.') . '</p>' . 170 169 '<p>' . __('<strong>Publish</strong> - You can set the terms of publishing your post in the Publish box. For Status, Visibility, and Publish (immediately), click on the Edit link to reveal more options. Visibility includes options for password-protecting a post or making it stay at the top of your blog indefinitely (sticky). Publish (immediately) allows you to set a future or past date and time, so you can schedule a post to be published in the future or backdate a post.') . '</p>' . … … 178 177 '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' 179 178 ); 180 179 } elseif ( 'page' == $post_type ) { 181 add_contextual_help($current_screen, '<p>' . __('Pages are similar to Posts in that they have a title, body text, and associated metadata, but they are different in that they are not part of the chronological blog stream, kind of like permanent posts. Pages are not categorized or tagged, but can have a hierarchy. You can nest Pages under other Pages by making one the “Parent” of the other, creating a group of Pages.') . '</p>' .180 $current_screen->add_help_tab(__('Tab title'), '<p>' . __('Pages are similar to Posts in that they have a title, body text, and associated metadata, but they are different in that they are not part of the chronological blog stream, kind of like permanent posts. Pages are not categorized or tagged, but can have a hierarchy. You can nest Pages under other Pages by making one the “Parent” of the other, creating a group of Pages.') . '</p>' . 182 181 '<p>' . __('Creating a Page is very similar to creating a Post, and the screens can be customized in the same way using drag and drop, the Screen Options tab, and expanding/collapsing boxes as you choose. This screen also has the new in 3.2 distraction-free writing space, available in both the Visual and HTML modes via the Fullscreen buttons. The Page editor mostly works the same as the Post editor, but there are some Page-specific features in the Page Attributes box:') . '</p>' . 183 182 '<p>' . __('<strong>Parent</strong> - You can arrange your pages in hierarchies. For example, you could have an “About” page that has “Life Story” and “My Dog” pages under it. There are no limits to how many levels you can nest pages.') . '</p>' . 184 183 '<p>' . __('<strong>Template</strong> - Some themes have custom templates you can use for certain pages that might have additional features or custom layouts. If so, you’ll see them in this dropdown menu.') . '</p>' . -
wp-admin/admin-header.php
111 111 <?php 112 112 unset($title_class, $blog_name, $total_update_count, $update_title); 113 113 114 $current_screen->parent_file = $parent_file; 115 $current_screen->parent_base = preg_replace('/\?.*$/', '', $parent_file); 116 $current_screen->parent_base = str_replace('.php', '', $current_screen->parent_base); 114 $current_screen->set_parentage( $parent_file ); 115 117 116 ?> 118 117 119 118 <div id="wpbody-content">
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)