WordPress.org

Make WordPress Core

Changeset 9636


Ignore:
Timestamp:
11/12/2008 05:11:49 PM (10 years ago)
Author:
ryan
Message:

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

Location:
trunk/wp-admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/admin-header.php

    r9620 r9636  
    3333<?php
    3434
    35 switch ( $pagenow ) {
    36     case 'post.php':
    37         add_action( 'admin_head-post.php', 'wp_tiny_mce' );
    38         break;
    39     case 'post-new.php':
    40         add_action( 'admin_head-post-new.php', 'wp_tiny_mce' );
    41         break;
    42     case 'page.php':
    43         add_action( 'admin_head-page.php', 'wp_tiny_mce' );
    44         break;
    45     case 'page-new.php':
    46         add_action( 'admin_head-page-new.php', 'wp_tiny_mce' );
    47         break;
     35if ( in_array( $pagenow, array('post.php', 'post-new.php', 'page.php', 'page-new.php') ) ) {
     36    add_action( 'admin_head', 'wp_tiny_mce' );
    4837}
    4938
    50 $hook_suffixes = array();
     39$hook_suffix = '';
     40if ( isset($page_hook) )
     41    $hook_suffix = "$page_hook";
     42else if ( isset($plugin_page) )
     43    $hook_suffix = "$plugin_page";
     44else if ( isset($pagenow) )
     45    $hook_suffix = "$pagenow";
    5146
    52 if ( isset($page_hook) )
    53     $hook_suffixes[] = "-$page_hook";
    54 else if ( isset($plugin_page) )
    55     $hook_suffixes[] = "-$plugin_page";
    56 else if ( isset($pagenow) )
    57     $hook_suffixes[] = "-$pagenow";
    58 
    59 $hook_suffixes[] = '';
    60 
    61 foreach ( $hook_suffixes as $hook_suffix )
    62     do_action("admin_print_styles$hook_suffix"); // do_action( 'admin_print_styles-XXX' ); do_action( 'admin_print_styles' );
    63 foreach ( $hook_suffixes as $hook_suffix )
    64     do_action("admin_print_scripts$hook_suffix"); // do_action( 'admin_print_scripts-XXX' ); do_action( 'admin_print_scripts' );
    65 foreach ( $hook_suffixes as $hook_suffix )
    66     do_action("admin_head$hook_suffix"); // do_action( 'admin_head-XXX' ); do_action( 'admin_head' );
    67 unset($hook_suffixes, $hook_suffix);
     47do_action("admin_print_styles-$hook_suffix");
     48do_action('admin_print_styles');
     49do_action("admin_print_scripts-$hook_suffix");
     50do_action('admin_print_scripts');
     51do_action("admin_head-$hook_suffix");
     52do_action('admin_head');
    6853
    6954?>
     
    10691do_action('admin_notices');
    10792
    108 screen_meta($pagenow);
     93screen_meta($pagenow, $hook_suffix);
     94unset($hook_suffix);
    10995
    11096if ( $parent_file == 'options-general.php' ) {
  • trunk/wp-admin/includes/template.php

    r9634 r9636  
    31753175}
    31763176
    3177 function screen_meta($screen) {
     3177function screen_meta($screen, $suffix = '') {
    31783178    global $wp_meta_boxes;
    31793179
     
    32223222    <div id="contextual-help-wrap" class="hidden">
    32233223    <?php
    3224     if ( !apply_filters('contextual_help', '', $screen) ) {
    3225         if ( isset($help[$screen]) ) {
    3226             if ( isset($title) )
    3227                 echo '<h5>' . sprintf(__('Get help with "%s"'), $title) . '</h5>';
    3228             else
    3229                 echo '<h5>' . __('Get help with this page') . '</h5>';
    3230             echo '<div class="metabox-prefs">' . $help[$screen] . "</div>\n";
    3231    
    3232             echo '<h5>' . __('Other Help') . '</h5>';
    3233         } else {
    3234             echo '<h5>' . __('Help') . '</h5>';
    3235         }
    3236 
    3237         echo '<div class="metabox-prefs">';
    3238         _e('<a href="http://codex.wordpress.org/" target="_blank">Documentation</a>');
    3239         echo '<br />';
    3240         _e('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>');
    3241         echo "</div>\n";
    3242     }
     3224    $contextual_help = '';
     3225    if ( isset($help[$screen]) ) {
     3226        if ( isset($title) )
     3227            $contextual_help .= '<h5>' . sprintf(__('Get help with "%s"'), $title) . '</h5>';
     3228        else
     3229            $contextual_help .= '<h5>' . __('Get help with this page') . '</h5>';
     3230        $contextual_help .= '<div class="metabox-prefs">' . $help[$screen] . "</div>\n";
     3231
     3232        $contextual_help .= '<h5>' . __('Other Help') . '</h5>';
     3233    } else {
     3234        $contextual_help .= '<h5>' . __('Help') . '</h5>';
     3235    }
     3236
     3237    $contextual_help .= '<div class="metabox-prefs">';
     3238    $contextual_help .= __('<a href="http://codex.wordpress.org/" target="_blank">Documentation</a>');
     3239    $contextual_help .= '<br />';
     3240    $contextual_help .= __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>');
     3241    $contextual_help .= "</div>\n";
     3242    echo apply_filters('contextual_help', $contextual_help, $screen, $suffix);
    32433243    ?>
    32443244    </div>
Note: See TracChangeset for help on using the changeset viewer.