screen_meta() and contextual help improvements from filosofo. fixes #8172

git-svn-id: https://develop.svn.wordpress.org/trunk@9636 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2008-11-12 17:11:49 +00:00
parent df9c82f867
commit 50eca62d0d
2 changed files with 32 additions and 46 deletions

View File

@ -32,39 +32,24 @@ addLoadEvent = function(func) {if (typeof jQuery != "undefined") jQuery(document
</script>
<?php
switch ( $pagenow ) {
case 'post.php':
add_action( 'admin_head-post.php', 'wp_tiny_mce' );
break;
case 'post-new.php':
add_action( 'admin_head-post-new.php', 'wp_tiny_mce' );
break;
case 'page.php':
add_action( 'admin_head-page.php', 'wp_tiny_mce' );
break;
case 'page-new.php':
add_action( 'admin_head-page-new.php', 'wp_tiny_mce' );
break;
if ( in_array( $pagenow, array('post.php', 'post-new.php', 'page.php', 'page-new.php') ) ) {
add_action( 'admin_head', 'wp_tiny_mce' );
}
$hook_suffixes = array();
$hook_suffix = '';
if ( isset($page_hook) )
$hook_suffixes[] = "-$page_hook";
$hook_suffix = "$page_hook";
else if ( isset($plugin_page) )
$hook_suffixes[] = "-$plugin_page";
$hook_suffix = "$plugin_page";
else if ( isset($pagenow) )
$hook_suffixes[] = "-$pagenow";
$hook_suffix = "$pagenow";
$hook_suffixes[] = '';
foreach ( $hook_suffixes as $hook_suffix )
do_action("admin_print_styles$hook_suffix"); // do_action( 'admin_print_styles-XXX' ); do_action( 'admin_print_styles' );
foreach ( $hook_suffixes as $hook_suffix )
do_action("admin_print_scripts$hook_suffix"); // do_action( 'admin_print_scripts-XXX' ); do_action( 'admin_print_scripts' );
foreach ( $hook_suffixes as $hook_suffix )
do_action("admin_head$hook_suffix"); // do_action( 'admin_head-XXX' ); do_action( 'admin_head' );
unset($hook_suffixes, $hook_suffix);
do_action("admin_print_styles-$hook_suffix");
do_action('admin_print_styles');
do_action("admin_print_scripts-$hook_suffix");
do_action('admin_print_scripts');
do_action("admin_head-$hook_suffix");
do_action('admin_head');
?>
</head>
@ -105,7 +90,8 @@ if ( function_exists('mb_strlen') ) {
<?php
do_action('admin_notices');
screen_meta($pagenow);
screen_meta($pagenow, $hook_suffix);
unset($hook_suffix);
if ( $parent_file == 'options-general.php' ) {
require(ABSPATH . 'wp-admin/options-head.php');

View File

@ -3174,7 +3174,7 @@ function _post_states($post) {
}
}
function screen_meta($screen) {
function screen_meta($screen, $suffix = '') {
global $wp_meta_boxes;
$screen = str_replace('.php', '', $screen);
@ -3221,25 +3221,25 @@ function screen_meta($screen) {
?>
<div id="contextual-help-wrap" class="hidden">
<?php
if ( !apply_filters('contextual_help', '', $screen) ) {
if ( isset($help[$screen]) ) {
if ( isset($title) )
echo '<h5>' . sprintf(__('Get help with "%s"'), $title) . '</h5>';
else
echo '<h5>' . __('Get help with this page') . '</h5>';
echo '<div class="metabox-prefs">' . $help[$screen] . "</div>\n";
echo '<h5>' . __('Other Help') . '</h5>';
} else {
echo '<h5>' . __('Help') . '</h5>';
}
$contextual_help = '';
if ( isset($help[$screen]) ) {
if ( isset($title) )
$contextual_help .= '<h5>' . sprintf(__('Get help with "%s"'), $title) . '</h5>';
else
$contextual_help .= '<h5>' . __('Get help with this page') . '</h5>';
$contextual_help .= '<div class="metabox-prefs">' . $help[$screen] . "</div>\n";
echo '<div class="metabox-prefs">';
_e('<a href="http://codex.wordpress.org/" target="_blank">Documentation</a>');
echo '<br />';
_e('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>');
echo "</div>\n";
$contextual_help .= '<h5>' . __('Other Help') . '</h5>';
} else {
$contextual_help .= '<h5>' . __('Help') . '</h5>';
}
$contextual_help .= '<div class="metabox-prefs">';
$contextual_help .= __('<a href="http://codex.wordpress.org/" target="_blank">Documentation</a>');
$contextual_help .= '<br />';
$contextual_help .= __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>');
$contextual_help .= "</div>\n";
echo apply_filters('contextual_help', $contextual_help, $screen, $suffix);
?>
</div>