WordPress.org

Make WordPress Core

Changeset 18911


Ignore:
Timestamp:
10/07/2011 04:57:12 AM (10 years ago)
Author:
nacin
Message:

Revert [18861], [18862], [18864], [18874], [18879], and [18880]. see #18785.

Location:
trunk/wp-admin
Files:
22 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/css/wp-admin.dev.css

    r18910 r18911  
    15141514#screen-options-wrap h5,
    15151515#contextual-help-wrap h5 {
    1516     margin: 12px 0 2px;
     1516    margin: 8px 0;
    15171517    font-size: 13px;
    15181518}
    15191519
    15201520.metabox-prefs label {
     1521    display: inline-block;
    15211522    padding-right: 15px;
    15221523    white-space: nowrap;
     1524    line-height: 30px;
    15231525}
    15241526
  • trunk/wp-admin/edit-comments.php

    r18867 r18911  
    110110    $title = __('Comments');
    111111
    112 $current_screen->add_option( 'per_page', array('label' => _x( 'Comments', 'comments per page (screen options)' )) );
    113 $current_screen->add_option_context( '<p>test</p>' );
     112add_screen_option( 'per_page', array('label' => _x( 'Comments', 'comments per page (screen options)' )) );
    114113
    115114add_contextual_help( $current_screen, '<p>' . __( 'You can manage comments made on your site similar to the way you manage Posts and other content. This screen is customizable in the same ways as other management screens, and you can act on comments using the on-hover action links or the Bulk Actions.' ) . '</p>' .
  • trunk/wp-admin/edit-form-advanced.php

    r18892 r18911  
    159159do_action('do_meta_boxes', $post_type, 'side', $post);
    160160
    161 $current_screen->add_option('layout_columns', array('max' => 2, 'default' => 2) );
    162 
    163 $current_screen->add_option_context(
    164 '<p>test</p>'
    165 );
     161add_screen_option('layout_columns', array('max' => 2, 'default' => 2) );
    166162
    167163if ( 'post' == $post_type ) {
     
    171167        'id'      => 'customize-display',
    172168        'title'   => __('Customizing This Display'),
    173         'content' => $customize_display
     169        'content' => $customize_display,
    174170    ) );
    175171
  • trunk/wp-admin/edit-link-form.php

    r18889 r18911  
    3838do_action('do_meta_boxes', 'link', 'side', $link);
    3939
    40 $current_screen->add_option('layout_columns', array('max' => 2, 'default' => 2) );
     40add_screen_option('layout_columns', array('max' => 2, 'default' => 2) );
    4141
    42 $current_screen->add_option_context(
    43 '<p>test</p>'
     42add_contextual_help($current_screen,
     43    '<p>' . __( 'You can add or edit links on this screen by entering information in each of the boxes. Only the link&#8217;s web address and name (the text you want to display on your site as the link) are required fields.' ) . '</p>' .
     44    '<p>' . __( 'The boxes for link name, web address, and description have fixed positions, while the others may be repositioned using drag and drop. You can also hide boxes you don&#8217;t use in the Screen Options tab, or minimize boxes by clicking on the title bar of the box.' ) . '</p>' .
     45    '<p>' . __( 'XFN stands for <a href="http://gmpg.org/xfn/" target="_blank">XHTML Friends Network</a>, which is optional. WordPress allows the generation of XFN attributes to show how you are related to the authors/owners of the site to which you are linking.' ) . '</p>' .
     46    '<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
     47    '<p>' . __( '<a href="http://codex.wordpress.org/Links_Add_New_Screen" target="_blank">Documentation on Creating Links</a>' ) . '</p>' .
     48    '<p>' . __( '<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>'
    4449);
    45 
    46 add_contextual_help( $current_screen, '
    47 <p>' . __( 'You can add or edit links on this screen by entering information in each of the boxes. Only the link&#8217;s web address and name (the text you want to display on your site as the link) are required fields.' ) . '</p>
    48 <p>' . __( 'The boxes for link name, web address, and description have fixed positions, while the others may be repositioned using drag and drop. You can also hide boxes you don&#8217;t use in the Screen Options tab, or minimize boxes by clicking on the title bar of the box.' ) . '</p>
    49 <p>' . __( 'XFN stands for <a href="http://gmpg.org/xfn/" target="_blank">XHTML Friends Network</a>, which is optional. WordPress allows the generation of XFN attributes to show how you are related to the authors/owners of the site to which you are linking.' ) . '</p>
    50 <p><strong>' . __( 'For more information:' ) . '</strong></p>
    51 <p>' . __( '<a href="http://codex.wordpress.org/Links_Add_New_Screen" target="_blank">Documentation on Creating Links</a>' ) . '</p>
    52 <p>' . __( '<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>' );
    5350
    5451require_once ('admin-header.php');
  • trunk/wp-admin/edit-tags.php

    r18867 r18911  
    2929}
    3030
    31 $current_screen->add_option( 'per_page', array('label' => $title, 'default' => 20, 'option' => 'edit_' . $tax->name . '_per_page') );
    32 
    33 $current_screen->add_option_context(
    34 '<p>test</p>'
    35 );
     31add_screen_option( 'per_page', array('label' => $title, 'default' => 20, 'option' => 'edit_' . $tax->name . '_per_page') );
    3632
    3733switch ( $wp_list_table->current_action() ) {
  • trunk/wp-admin/edit.php

    r18867 r18911  
    148148
    149149$title = $post_type_object->labels->name;
    150 
    151 $current_screen->add_option( 'per_page', array('label' => $title, 'default' => 20) );
    152 $current_screen->add_option_context( '<p>test</p>' );
    153150
    154151if ( 'post' == $post_type ) {
     
    184181}
    185182
     183add_screen_option( 'per_page', array('label' => $title, 'default' => 20) );
     184
    186185require_once('./admin-header.php');
    187186?>
  • trunk/wp-admin/includes/deprecated.php

    r18904 r18911  
    802802 */
    803803function screen_meta( $screen ) {
    804     _deprecated_function( __FUNCTION__, '3.3', '$current_screen->render_screen_meta()' );
    805 
    806804    $current_screen = get_current_screen();
    807805    $current_screen->render_screen_meta();
    808806}
    809 
    810 /**
    811  * {@internal Missing Short Description}}
    812  *
    813  * @since 2.7.0
    814  * @deprecated 3.3.0
    815  */
    816 function favorite_actions() {
    817     _deprecated_function( __FUNCTION__, '3.3' );
    818 }
    819 
    820 /**
    821  * Old way of adding contextual help text for a page. Use:
    822  * $current_screen->add_help_tab( array(
    823  *      'id'      => 'my-id', // required
    824  *      'title'   => __('My Tab'), // required
    825  *      'content' => 'help html'
    826  * ));
    827  *
    828  * Creates a 'Screen Info' help tab.
    829  *
    830  * @since 2.7.0
    831  * @deprecated 3.3.0
    832  *
    833  * @param string    $screen The handle for the screen to add help to.  This is usually the hook name returned by the add_*_page() functions.
    834  * @param string    $help   The content of a 'Screen Info' help tab.
    835  */
    836 function add_contextual_help($screen, $help) {
    837     //_deprecated_function( __FUNCTION__, '3.3', '$current_screen->add_help_tab()' );
    838 
    839     global $_wp_contextual_help;
    840 
    841     if ( is_string($screen) )
    842         $screen = convert_to_screen($screen);
    843 
    844     if ( !isset($_wp_contextual_help) )
    845         $_wp_contextual_help = array();
    846 
    847     $_wp_contextual_help[$screen->id] = $help;
    848 }
    849 
    850 /**
    851  * Old way of registering and configuring an admin screen option. Use $current_screen->add_option().
    852  *
    853  * @since 3.1.0
    854  * @deprecated 3.3.0
    855  *
    856  * @param string $option An option name.
    857  * @param mixed $args Option dependent arguments
    858  * @return void
    859  */
    860 function add_screen_option( $option, $args = array() ) {
    861     //_deprecated_function( __FUNCTION__, '3.3', '$current_screen->add_option()' );
    862 
    863     $current_screen = get_current_screen();
    864 
    865     if ( ! $current_screen )
    866         return;
    867 
    868     return $current_screen->add_option( $option, $args );
    869 }
    870 
    871 /**
    872  * Output the HTML for hiding metaboxes on the page, use $current_screen->render_metabox_prefs().
    873  *
    874  * Note that the outputted HTML contains the H5 heading and the DIV class="metabox-prefs".
    875  *
    876  * @since 2.7.0
    877  * @deprecated 3.3.0
    878  *
    879  * @param mixed $screen
    880  */
    881 function meta_box_prefs($screen) {
    882     //_deprecated_function( __FUNCTION__, '3.3', '$current_screen->render_metabox_prefs()' );
    883 
    884     $current_screen = get_current_screen();
    885 
    886     if ( ! $current_screen )
    887         return;
    888 
    889     return $current_screen->render_metabox_prefs();
    890 }
    891 
    892 function get_screen_icon( $screen = '' ) {
    893     //_deprecated_function( __FUNCTION__, '3.3', '$current_screen->get_screen_icon()' );
    894 
    895     $current_screen = get_current_screen();
    896 
    897     if ( ! $current_screen )
    898         return;
    899 
    900     return $current_screen->get_screen_icon($screen);
    901 }
    902 
    903 
  • trunk/wp-admin/includes/screen.php

    r18896 r18911  
    1515 * @return array Containing the headers in the format id => UI String
    1616 */
    17 function get_column_headers( $screen ) { // TODO: fold into WP_Screen?
     17function get_column_headers( $screen ) {
    1818    if ( is_string( $screen ) )
    1919        $screen = convert_to_screen( $screen );
     
    3636 * @return array
    3737 */
    38 function get_hidden_columns( $screen ) { // TODO: fold into WP_Screen
     38function get_hidden_columns( $screen ) {
    3939    if ( is_string( $screen ) )
    4040        $screen = convert_to_screen( $screen );
     
    4444
    4545/**
     46 * {@internal Missing Short Description}}
     47 *
     48 * @since 2.7.0
     49 *
     50 * @param unknown_type $screen
     51 */
     52function meta_box_prefs($screen) {
     53    global $wp_meta_boxes;
     54
     55    if ( is_string($screen) )
     56        $screen = convert_to_screen($screen);
     57
     58    if ( empty($wp_meta_boxes[$screen->id]) )
     59        return;
     60
     61    $hidden = get_hidden_meta_boxes($screen);
     62
     63    foreach ( array_keys($wp_meta_boxes[$screen->id]) as $context ) {
     64        foreach ( array_keys($wp_meta_boxes[$screen->id][$context]) as $priority ) {
     65            foreach ( $wp_meta_boxes[$screen->id][$context][$priority] as $box ) {
     66                if ( false == $box || ! $box['title'] )
     67                    continue;
     68                // Submit box cannot be hidden
     69                if ( 'submitdiv' == $box['id'] || 'linksubmitdiv' == $box['id'] )
     70                    continue;
     71                $box_id = $box['id'];
     72                echo '<label for="' . $box_id . '-hide">';
     73                echo '<input class="hide-postbox-tog" name="' . $box_id . '-hide" type="checkbox" id="' . $box_id . '-hide" value="' . $box_id . '"' . (! in_array($box_id, $hidden) ? ' checked="checked"' : '') . ' />';
     74                echo "{$box['title']}</label>\n";
     75            }
     76        }
     77    }
     78}
     79
     80/**
    4681 * Get Hidden Meta Boxes
    4782 *
     
    5186 * @return array Hidden Meta Boxes
    5287 */
    53 function get_hidden_meta_boxes( $screen ) { // TODO: fold into WP_Screen
     88function get_hidden_meta_boxes( $screen ) {
    5489    if ( is_string( $screen ) )
    5590        $screen = convert_to_screen( $screen );
     
    6398        else
    6499            $hidden = array( 'slugdiv' );
    65 
    66100        $hidden = apply_filters('default_hidden_meta_boxes', $hidden, $screen);
    67101    }
    68102
    69103    return $hidden;
     104}
     105
     106/**
     107 * {@internal Missing Short Description}}
     108 *
     109 * @since 2.7.0
     110 */
     111function favorite_actions( $screen = null ) {
     112    $default_action = false;
     113
     114    if ( is_string($screen) )
     115        $screen = convert_to_screen($screen);
     116
     117    if ( $screen->is_user )
     118        return;
     119
     120    if ( isset($screen->post_type) ) {
     121        $post_type_object = get_post_type_object($screen->post_type);
     122        if ( 'add' != $screen->action )
     123            $default_action = array('post-new.php?post_type=' . $post_type_object->name => array($post_type_object->labels->new_item, $post_type_object->cap->edit_posts));
     124        else
     125            $default_action = array('edit.php?post_type=' . $post_type_object->name => array($post_type_object->labels->name, $post_type_object->cap->edit_posts));
     126    }
     127
     128    if ( !$default_action ) {
     129        if ( $screen->is_network ) {
     130            $default_action = array('sites.php' => array( __('Sites'), 'manage_sites'));
     131        } else {
     132            switch ( $screen->id ) {
     133                case 'upload':
     134                    $default_action = array('media-new.php' => array(__('New Media'), 'upload_files'));
     135                    break;
     136                case 'media':
     137                    $default_action = array('upload.php' => array(__('Edit Media'), 'upload_files'));
     138                    break;
     139                case 'link-manager':
     140                case 'link':
     141                    if ( 'add' != $screen->action )
     142                        $default_action = array('link-add.php' => array(__('New Link'), 'manage_links'));
     143                    else
     144                        $default_action = array('link-manager.php' => array(__('Edit Links'), 'manage_links'));
     145                    break;
     146                case 'users':
     147                    $default_action = array('user-new.php' => array(__('New User'), 'create_users'));
     148                    break;
     149                case 'user':
     150                    $default_action = array('users.php' => array(__('Edit Users'), 'edit_users'));
     151                    break;
     152                case 'plugins':
     153                    $default_action = array('plugin-install.php' => array(__('Install Plugins'), 'install_plugins'));
     154                    break;
     155                case 'plugin-install':
     156                    $default_action = array('plugins.php' => array(__('Manage Plugins'), 'activate_plugins'));
     157                    break;
     158                case 'themes':
     159                    $default_action = array('theme-install.php' => array(__('Install Themes'), 'install_themes'));
     160                    break;
     161                case 'theme-install':
     162                    $default_action = array('themes.php' => array(__('Manage Themes'), 'switch_themes'));
     163                    break;
     164                default:
     165                    $default_action = array('post-new.php' => array(__('New Post'), 'edit_posts'));
     166                    break;
     167            }
     168        }
     169    }
     170
     171    if ( !$screen->is_network ) {
     172        $actions = array(
     173            'post-new.php' => array(__('New Post'), 'edit_posts'),
     174            'edit.php?post_status=draft' => array(__('Drafts'), 'edit_posts'),
     175            'post-new.php?post_type=page' => array(__('New Page'), 'edit_pages'),
     176            'media-new.php' => array(__('Upload'), 'upload_files'),
     177            'edit-comments.php' => array(__('Comments'), 'moderate_comments')
     178            );
     179    } else {
     180        $actions = array(
     181            'sites.php' => array( __('Sites'), 'manage_sites'),
     182            'users.php' => array( __('Users'), 'manage_network_users')
     183        );
     184    }
     185
     186    $default_key = array_keys($default_action);
     187    $default_key = $default_key[0];
     188    if ( isset($actions[$default_key]) )
     189        unset($actions[$default_key]);
     190    $actions = array_merge($default_action, $actions);
     191    $actions = apply_filters( 'favorite_actions', $actions, $screen );
     192
     193    $allowed_actions = array();
     194    foreach ( $actions as $action => $data ) {
     195        if ( current_user_can($data[1]) )
     196            $allowed_actions[$action] = $data[0];
     197    }
     198
     199    if ( empty($allowed_actions) )
     200        return;
     201
     202    $first = array_keys($allowed_actions);
     203    $first = $first[0];
     204    echo '<div id="favorite-actions">';
     205    echo '<div id="favorite-first"><a href="' . $first . '">' . $allowed_actions[$first] . '</a></div><div id="favorite-toggle"><br /></div>';
     206    echo '<div id="favorite-inside">';
     207
     208    array_shift($allowed_actions);
     209
     210    foreach ( $allowed_actions as $action => $label) {
     211        echo "<div class='favorite-action'><a href='$action'>";
     212        echo $label;
     213        echo "</a></div>\n";
     214    }
     215    echo "</div></div>\n";
    70216}
    71217
     
    78224 * @return object An object containing the safe screen name and id
    79225 */
    80 function convert_to_screen( $screen ) { // TODO: fold into WP_Screen?
     226function convert_to_screen( $screen ) {
    81227    $screen = str_replace( array('.php', '-new', '-add', '-network', '-user' ), '', $screen);
    82228
     
    86232        $screen .= '-user';
    87233
    88     // why do we need this? $screen = (string) apply_filters( 'screen_meta_screen', $screen );
     234    $screen = (string) apply_filters( 'screen_meta_screen', $screen );
    89235    $screen = (object) array('id' => $screen, 'base' => $screen);
    90236    return $screen;
    91237}
    92238
    93 function screen_icon( $for = '' ) { // TODO: fold into WP_Screen?
    94     global $current_screen;
    95 
    96     if ( !isset($current_screen) )
     239/**
     240 * Add contextual help text for a page.
     241 *
     242 * Creates a 'Screen Info' help tab.
     243 *
     244 * @since 2.7.0
     245 *
     246 * @param string    $screen The handle for the screen to add help to.  This is usually the hook name returned by the add_*_page() functions.
     247 * @param string    $help   The content of a 'Screen Info' help tab.
     248 *
     249 * @todo: deprecate?
     250 */
     251function add_contextual_help($screen, $help) {
     252    global $_wp_contextual_help;
     253
     254    if ( is_string($screen) )
     255        $screen = convert_to_screen($screen);
     256
     257    if ( !isset($_wp_contextual_help) )
     258        $_wp_contextual_help = array();
     259
     260    $_wp_contextual_help[$screen->id] = $help;
     261}
     262
     263/**
     264 * Register and configure an admin screen option
     265 *
     266 * @since 3.1.0
     267 *
     268 * @param string $option An option name.
     269 * @param mixed $args Option dependent arguments
     270 * @return void
     271 */
     272function add_screen_option( $option, $args = array() ) {
     273    $current_screen = get_current_screen();
     274
     275    if ( ! $current_screen )
    97276        return;
    98277
    99     echo $current_screen->get_screen_icon( $for );
     278    return $current_screen->add_option( $option, $args );
     279}
     280
     281function screen_icon( $screen = '' ) {
     282    echo get_screen_icon( $screen );
     283}
     284
     285function get_screen_icon( $screen = '' ) {
     286    global $current_screen, $typenow;
     287
     288    if ( empty($screen) )
     289        $screen = $current_screen;
     290    elseif ( is_string($screen) )
     291        $name = $screen;
     292
     293    $class = 'icon32';
     294
     295    if ( empty($name) ) {
     296        if ( !empty($screen->parent_base) )
     297            $name = $screen->parent_base;
     298        else
     299            $name = $screen->base;
     300
     301        if ( 'edit' == $name && isset($screen->post_type) && 'page' == $screen->post_type )
     302            $name = 'edit-pages';
     303
     304        $post_type = '';
     305        if ( isset( $screen->post_type ) )
     306            $post_type = $screen->post_type;
     307        elseif ( $current_screen == $screen )
     308            $post_type = $typenow;
     309        if ( $post_type )
     310            $class .= ' ' . sanitize_html_class( 'icon32-posts-' . $post_type );
     311    }
     312
     313    return '<div id="icon-' . esc_attr( $name ) . '" class="' . $class . '"><br /></div>';
    100314}
    101315
     
    125339 * @param string $id Screen id, optional.
    126340 */
    127 function set_current_screen( $id = '' ) {
     341function set_current_screen( $id =  '' ) {
    128342    global $current_screen;
    129343
    130     if ( !is_a( $current_screen, 'WP_Screen' ) )
    131         $current_screen = new WP_Screen( $id );
    132 
    133     // why do we need this? $current_screen = apply_filters('current_screen', $current_screen);
     344    $current_screen = new WP_Screen( $id );
     345
     346    $current_screen = apply_filters('current_screen', $current_screen);
    134347}
    135348
     
    252465     * @access private
    253466     */
    254     private $_options = array(
    255         '_context' => '',
    256         '_screen_settings' => ''
    257     );
    258 
    259     /**
    260      * Show screen options if any.
     467    private $_options = array();
     468
     469
     470    /**
     471     * Stores the result of the public show_screen_options function.
    261472     *
    262473     * @since 3.3.0
     
    264475     * @access private
    265476     */
    266     private $_show_options = false;
     477    private $_show_screen_options;
     478
     479    /**
     480     * Stores the 'screen_settings' section of screen options.
     481     *
     482     * @since 3.3.0
     483     * @var string
     484     * @access private
     485     */
     486    private $_screen_settings;
    267487
    268488    /**
     
    281501            $screen = $hook_suffix;
    282502            $screen = str_replace('.php', '', $screen);
    283 
    284503            if ( preg_match('/-add|-new$/', $screen) )
    285504                $action = 'add';
    286 
    287505            $screen = str_replace('-new', '', $screen);
    288506            $screen = str_replace('-add', '', $screen);
     
    290508        } else {
    291509            $id = sanitize_key( $id );
    292 
    293510            if ( false !== strpos($id, '-') ) {
    294511                list( $id, $typenow ) = explode('-', $id, 2);
    295 
    296512                if ( taxonomy_exists( $typenow ) ) {
    297513                    $id = 'edit-tags';
     
    308524        if ( 'index' == $this->base )
    309525            $this->base = 'dashboard';
    310 
    311526        if ( 'index' == $this->id )
    312527            $this->id = 'dashboard';
     
    315530            if ( empty($typenow) )
    316531                $typenow = 'post';
    317 
    318532            $this->id .= '-' . $typenow;
    319533            $this->post_type = $typenow;
     
    321535            if ( empty($typenow) )
    322536                $typenow = 'post';
    323 
    324537            $this->id = $typenow;
    325538            $this->post_type = $typenow;
     
    327540            if ( empty($taxnow) )
    328541                $taxnow = 'post_tag';
    329 
    330542            $this->id = 'edit-' . $taxnow;
    331543            $this->taxonomy = $taxnow;
     
    360572    /**
    361573     * Adds an option for the screen.
    362      * Use the 'add_screen_help_and_options' action to add screen options.
     574     * Call this in template files after admin.php is loaded and before admin-header.php is loaded to add screen options.
    363575     *
    364576     * @since 3.3.0
    365577     *
    366578     * @param string $option Option ID
    367      * @param mixed $args Associative array of arguments particular to the default $option or the HTML string to be printed in the Screen Options tab.
    368      */
    369     public function add_option( $option, $args = null ) {
    370         if ( is_array($args) && !empty($option) )
    371             $this->_options[ $option ] = $args;
    372         elseif ( is_string($option) )
    373             $this->_options['_screen_settings'] .= $option;
    374         else
    375             return false;
    376 
    377         $this->_show_options = true;
    378         return true;
    379     }
    380    
    381     /**
    382      * Adds option context.
    383      * Use the 'add_screen_help_and_options' action to add it. Will not be shown if there aren't any screen options.
    384      *
    385      * @since 3.3.0
    386      *
    387      * @param string $text
    388      */
    389     public function add_option_context( $text ) {
    390         $this->_options['_context'] .= $text;
     579     * @param array $args Associative array of arguments particular to the given $option.
     580     */
     581    public function add_option( $option, $args = array() ) {
     582        $this->_options[ $option ] = $args;
    391583    }
    392584
    393585    /**
    394586     * Add a help tab to the contextual help for the screen.
    395      * Use the 'add_screen_help_and_options' action to add contextual help tabs.
     587     * Call this in template files after admin.php is loaded and before admin-header.php is loaded to add contextual help tabs.
    396588     *
    397589     * @since 3.3.0
     
    399591     * @param array $args
    400592     * - string   - title    - Title for the tab.
    401      * - string   - id       - Tab ID.
    402      * - string   - section  - Section title for the tab. Optional.
     593     * - string   - id       - Tab ID. Optional.
    403594     * - string   - content  - Help tab content in plain text or HTML. Optional.
    404595     * - callback - callback - A callback to generate the tab content. Optional.
     
    409600            'title'    => false,
    410601            'id'       => false,
    411             'section'  => false,
    412602            'content'  => '',
    413             'callback' => false
     603            'callback' => false,
    414604        );
    415605        $args = wp_parse_args( $args, $defaults );
    416606
    417         // Ensure we have title and ID.
    418         if ( ! $args['title'] || ! $args['id'] )
    419             return false;
     607        // Ensure we have a title.
     608        if ( ! $args['title'] )
     609            return;
     610
     611        // Create an id from the title if one is not provided.
     612        if ( ! $args['id'] )
     613            $args['id'] = sanitize_html_class( $args['title'] );
    420614
    421615        $this->_help_tabs[] = $args;
    422         return true;
    423616    }
    424617
    425618    /**
    426619     * Add a sidebar to the contextual help for the screen.
    427      * Use the 'add_screen_help_and_options' action to add a sidebar to the contextual help.
     620     * Call this in template files after admin.php is loaded and before admin-header.php is loaded to add a sidebar to the contextual help.
    428621     *
    429622     * @since 3.3.0
     
    432625     */
    433626    public function add_help_sidebar( $content ) {
    434         if ( empty($this->_help_sidebar) ) // add only one
    435             $this->_help_sidebar = $content;
     627        $this->_help_sidebar = $content;
    436628    }
    437629
     
    445637    public function render_screen_meta() {
    446638        global $_wp_contextual_help;
    447 
    448         // Intended for adding Help and Screen Options.
    449         do_action('add_screen_help_and_options', $this);
    450639
    451640        // Call old contextual_help_list filter.
    452641        if ( ! isset( $_wp_contextual_help ) )
    453642            $_wp_contextual_help = array();
    454 
    455         // why are we filtering a global? $_wp_contextual_help = apply_filters( 'contextual_help_list', $_wp_contextual_help, $this );
     643        $_wp_contextual_help = apply_filters( 'contextual_help_list', $_wp_contextual_help, $this );
    456644
    457645        if ( isset( $_wp_contextual_help[ $this->id ] ) ) {
    458646            // Call old contextual_help filter.
    459             // why are we filtering the same global second time??
    460647            $contextual_help = apply_filters( 'contextual_help', $_wp_contextual_help[ $this->id ], $this->id, $this );
    461648
    462649            $this->add_help_tab( array(
    463                 'title'     => __('Screen Info'),
    464                 'id'        => 'screen-info',
    465                 'content'   => $_wp_contextual_help[ $this->id ]
     650                'title'   => __('Screen Info'),
     651                'content' => $contextual_help,
     652            ) );
     653        }
     654
     655        // Add screen options tab
     656        if ( $this->show_screen_options() ) {
     657            $this->add_help_tab( array(
     658                'title'    => __('Screen Options'),
     659                'callback' => array( $this, 'render_screen_options' ),
    466660            ) );
    467661        }
     
    474668                <div class="contextual-help-tabs">
    475669                    <ul>
    476                     <?php
    477 
    478                     if ( $this->_show_options ) {
    479                         $class = true;
     670                    <?php foreach ( $this->_help_tabs as $i => $tab ):
     671                        $link_id  = "tab-link-{$tab['id']}";
     672                        $panel_id = "tab-panel-{$tab['id']}";
     673                        $classes  = ( $i == 0 ) ? 'active' : '';
    480674                        ?>
    481                         <li id="tab-link-screen-options" class="active">
    482                             <a href="#tab-panel-screen-options">
    483                                 <?php _e('Screen Options'); ?>
    484                             </a>
    485                         </li>
    486                         <?php
    487                     }
    488 
    489                     foreach ( $this->_help_tabs as $i => $tab ) {
    490                         $id = esc_attr($tab['id']);
    491                         $class = empty($class) && $i == 0 ? ' class="active"' : '';
    492                         ?>
    493                         <li id="<?php echo "tab-link-$id"; ?>"<?php echo $class; ?>>
    494                             <a href="<?php echo "#tab-panel-$id"; ?>">
     675
     676                        <li id="<?php echo esc_attr( $link_id ); ?>" class="<?php echo esc_attr( $classes ); ?>">
     677                            <a href="<?php echo esc_url( "#$panel_id" ); ?>">
    495678                                <?php echo esc_html( $tab['title'] ); ?>
    496679                            </a>
    497680                        </li>
    498                     <?php } ?>
     681                    <?php endforeach; ?>
    499682                    </ul>
    500683                </div>
    501                 <?php
    502 
    503                 if ( $this->_help_sidebar )
    504                     echo '<div class="contextual-help-sidebar">' . $this->_help_sidebar . '</div>';
    505 
    506                 ?>
     684
     685                <div class="contextual-help-sidebar">
     686                    <?php echo $this->_help_sidebar; ?>
     687                </div>
     688
    507689                <div class="contextual-help-tabs-wrap">
    508                     <?php
    509 
    510                     if ( $this->_show_options ) {
    511                         $class2 = true;
    512                         echo '<div id="tab-panel-screen-options" class="help-tab-content active">';
    513 
    514                         if ( !empty($this->_options['_context']) )
    515                             echo $this->_options['_context'];
    516 
    517                         $this->render_screen_options();
    518                         echo '</div>';
    519                     }
    520 
    521                     foreach ( $this->_help_tabs as $i => $tab ) {
    522                         $class2 = empty($class2) && $i == 0 ? ' active' : '';
     690                    <?php foreach ( $this->_help_tabs as $i => $tab ):
     691                        $panel_id = "tab-panel-{$tab['id']}";
     692                        $classes  = ( $i == 0 ) ? 'active' : '';
     693                        $classes .= ' help-tab-content';
    523694                        ?>
    524695
    525                         <div id="<?php echo esc_attr( "tab-panel-{$tab['id']}" ); ?>" class="help-tab-content<?php echo $class2; ?>">
     696                        <div id="<?php echo esc_attr( $panel_id ); ?>" class="<?php echo esc_attr( $classes ); ?>">
     697                            <h3><?php echo esc_html( $tab['title'] ); ?></h3>
    526698                            <?php
    527                             if ( $tab['section'] )
    528                                 echo '<h3>' . esc_html( $tab['section'] ) . '</h3>';
    529 
    530699                            // Print tab content.
    531700                            echo $tab['content'];
     
    536705                            ?>
    537706                        </div>
    538                     <?php } ?>
     707                    <?php endforeach; ?>
    539708                </div>
    540709            </div>
     
    543712    }
    544713
    545     /**
    546      * Render the screen options tab.
    547      *
    548      * @since 3.3.0
    549      */
    550     public function render_screen_options() {
    551 
    552         $screen_settings = $this->_options['_screen_settings'];
    553 
    554         // Default screen_settings for various screens.
    555         // TODO: should probably be set on these screens, not here.
     714    public function show_screen_options() {
     715        global $wp_meta_boxes, $wp_list_table;
     716
     717        if ( is_bool( $this->_show_screen_options ) )
     718            return $this->_show_screen_options;
     719
     720        $columns = get_column_headers( $this );
     721
     722        $show_screen = false;
     723        if ( ! empty( $wp_meta_boxes[ $this->id ] ) || ! empty( $columns ) )
     724            $show_screen = true;
     725
     726        // Check if there are per-page options.
     727        $show_screen = $show_screen || isset( $this->_options['per_page'] );
     728
     729        $this->_screen_settings = apply_filters( 'screen_settings', '', $this );
     730
    556731        switch ( $this->id ) {
    557732            case 'widgets':
    558                 $screen_settings .= '<p><a id="access-on" href="widgets.php?widgets-access=on">' . __('Enable accessibility mode') . '</a><a id="access-off" href="widgets.php?widgets-access=off">' . __('Disable accessibility mode') . "</a></p>\n";
     733                $this->_screen_settings = '<p><a id="access-on" href="widgets.php?widgets-access=on">' . __('Enable accessibility mode') . '</a><a id="access-off" href="widgets.php?widgets-access=off">' . __('Disable accessibility mode') . "</a></p>\n";
     734                $show_screen = true;
    559735                break;
    560736        }
    561737
    562         // TODO: deprecate
    563         $screen_settings = apply_filters( 'screen_settings', $screen_settings, $this );
    564 
    565         echo '<form id="adv-settings" action="" method="post">';
    566 
    567         $this->render_table_columns_prefs();
    568         $this->render_metabox_prefs();
    569         $this->render_screen_layout();
    570         $this->render_per_page_options();
    571         echo $screen_settings;
    572 
    573         wp_nonce_field( 'screen-options-nonce', 'screenoptionnonce', false );
    574         echo '</form>';
    575 
    576     }
    577 
    578     /**
    579      * Render the option for hiding table columns on the page
    580      *
    581      * @since 3.3.0
    582      */
    583     function render_table_columns_prefs() {
     738        if ( ! empty( $this->_screen_settings ) )
     739            $show_screen = true;
     740
     741        if ( ! empty( $this->_options ) )
     742            $show_screen = true;
     743
     744        $this->_show_screen_options = apply_filters( 'screen_options_show_screen', $show_screen, $this );
     745        return $this->_show_screen_options;
     746    }
     747
     748    /**
     749     * Render the screen options tab.
     750     *
     751     * @since 3.3.0
     752     */
     753    public function render_screen_options() {
     754        global $wp_meta_boxes, $wp_list_table;
     755
    584756        $columns = get_column_headers( $this );
    585 
    586         if ( ! empty( $columns ) ) {
    587             $hidden = get_hidden_columns( $this );
    588             ?>
     757        $hidden  = get_hidden_columns( $this );
     758
     759        ?>
     760        <form id="adv-settings" action="" method="post">
     761        <?php if ( isset( $wp_meta_boxes[ $this->id ] ) ) : ?>
     762            <h5><?php _ex('Show on screen', 'Metaboxes') ?></h5>
     763            <div class="metabox-prefs">
     764                <?php meta_box_prefs( $this ); ?>
     765                <br class="clear" />
     766            </div>
     767            <?php endif;
     768            if ( ! empty( $columns ) ) : ?>
    589769            <h5><?php echo ( isset( $columns['_title'] ) ?  $columns['_title'] :  _x('Show on screen', 'Columns') ) ?></h5>
    590770            <div class="metabox-prefs">
     
    601781                    if ( 'comments' == $column )
    602782                        $title = __( 'Comments' );
    603 
    604783                    $id = "$column-hide";
    605784                    echo '<label for="' . $id . '">';
     
    610789                <br class="clear" />
    611790            </div>
    612         <?php }
    613     }
    614 
    615     /**
    616      * Render the option for hiding metaboxes on the page
    617      *
    618      * @since 3.3.0
    619      */
    620     function render_metabox_prefs() {
    621         global $wp_meta_boxes;
    622 
    623         if ( !empty( $wp_meta_boxes[ $this->id ] ) ) {
    624             $hidden = get_hidden_meta_boxes($this);
    625             ?>
    626             <h5><?php _ex('Show on screen', 'Metaboxes') ?></h5>
    627             <div class="metabox-prefs">
    628                 <?php
    629 
    630                 foreach ( array_keys($wp_meta_boxes[$this->id]) as $context ) {
    631                     foreach ( array_keys($wp_meta_boxes[$this->id][$context]) as $priority ) {
    632                         foreach ( $wp_meta_boxes[$this->id][$context][$priority] as $box ) {
    633                             if ( false == $box || ! $box['title'] )
    634                                 continue;
    635                             // Submit box cannot be hidden
    636                             if ( 'submitdiv' == $box['id'] || 'linksubmitdiv' == $box['id'] )
    637                                 continue;
    638                             $box_id = $box['id'];
    639                             echo '<label for="' . $box_id . '-hide">';
    640                             echo '<input class="hide-postbox-tog" name="' . $box_id . '-hide" type="checkbox" id="' . $box_id . '-hide" value="' . $box_id . '"' . (! in_array($box_id, $hidden) ? ' checked="checked"' : '') . ' />';
    641                             echo "{$box['title']}</label>\n";
    642                         }
    643                     }
    644                 }
    645 
    646                 ?>
    647                 <br class="clear" />
    648             </div>
    649             <?php
    650         }
     791        <?php endif;
     792
     793        $this->render_screen_layout();
     794        $this->render_per_page_options();
     795        echo $this->_screen_settings;
     796
     797        ?>
     798        <div><?php wp_nonce_field( 'screen-options-nonce', 'screenoptionnonce', false ); ?></div>
     799        </form>
     800        <?php
    651801    }
    652802
     
    660810
    661811        // Back compat for plugins using the filter instead of add_screen_option()
    662         // TODO: deprecate it
    663812        $columns = apply_filters( 'screen_layout_columns', array(), $this->id, $this );
    664813
    665814        if ( ! empty( $columns ) && isset( $columns[ $this->id ] ) )
    666             $this->add_option( 'layout_columns', array('max' => $columns[ $this->id ] ) );
     815            add_screen_option( 'layout_columns', array('max' => $columns[ $this->id ] ) );
    667816
    668817        if ( ! isset( $this->_options['layout_columns'] ) ) {
     
    702851     */
    703852    function render_per_page_options() {
    704         if ( empty( $this->_options['per_page'] ) )
     853        if ( ! isset( $this->_options['per_page'] ) )
    705854            return;
    706855
     
    751900        <?php
    752901    }
    753    
    754     function get_screen_icon( $for = '' ) {
    755 
    756         if ( !empty($for) && is_string($for) ) {
    757             $name = $for;
    758         } else {
    759             if ( !empty($this->parent_base) )
    760                 $name = $this->parent_base;
    761             else
    762                 $name = $this->base;
    763         }
    764 
    765         if ( 'edit' == $name && isset($this->post_type) && 'page' == $this->post_type )
    766             $name = 'edit-pages';
    767 
    768         $class = '';
    769         if ( !empty( $this->post_type ) )
    770             $class = ' ' . sanitize_html_class( 'icon32-posts-' . $this->post_type );
    771 
    772         return '<div id="icon-' . esc_attr( $name ) . '" class="icon32' . $class . '"><br /></div>';
    773     }
    774 }
    775 
     902}
  • trunk/wp-admin/index.php

    r18889 r18911  
    2424
    2525if ( is_user_admin() )
    26     $current_screen->add_option('layout_columns', array('max' => 4, 'default' => 1) );
     26    add_screen_option('layout_columns', array('max' => 4, 'default' => 1) );
    2727else
    28     $current_screen->add_option('layout_columns', array('max' => 4, 'default' => 2) );
     28    add_screen_option('layout_columns', array('max' => 4, 'default' => 2) );
    2929
    30 $current_screen->add_option_context(
    31 '<p>test</p>'
    32 );
    3330
    3431// Help tabs
    3532
    36 $help = '<p>' . __('Welcome to your WordPress Dashboard! This is the screen you will see when you log in to your site, and gives you access to all the site management features of WordPress. You can get help for any screen by clicking the Help tab in the top bar.') . '</p>';
     33$help_overview = '<p>' . __('Welcome to your WordPress Dashboard! This is the screen you will see when you log in to your site, and gives you access to all the site management features of WordPress. You can get help for any screen by clicking the Help tab in the top bar.') . '</p>';
    3734
    3835$current_screen->add_help_tab( array(
    3936    'title'   => __('Overview'),
    40     'id' => 'overview',
    41     'content' => $help
     37    'content' => $help_overview,
    4238) );
    4339
    44 $help = '<p>' . __('The left-hand navigation menu provides links to all of the WordPress administration screens, with submenu items displayed on hover. You can minimize this menu to a narrow icon strip by clicking on the Collapse Menu arrow at the bottom.') . '</p>
    45 <p>' . __('Links in the &#8220;admin bar&#8221; at the top of the screen connect your dashboard and the front end of your site, and provide access to your profile and helpful WordPress information.') . '</p>';
     40$help_navigation  = '<p>' . __('The left-hand navigation menu provides links to all of the WordPress administration screens, with submenu items displayed on hover. You can minimize this menu to a narrow icon strip by clicking on the Collapse Menu arrow at the bottom.') . '</p>';
     41$help_navigation .= '<p>' . __('Links in the &#8220;admin bar&#8221; at the top of the screen connect your dashboard and the front end of your site, and provide access to your profile and helpful WordPress information.') . '</p>';
    4642
    4743$current_screen->add_help_tab( array(
    4844    'title'   => __('Navigation'),
    49     'id' => 'navigation',
    50     'content' => $help
     45    'content' => $help_navigation,
    5146) );
    5247
    53 $help = '<p>' . __('You can use the following controls to arrange your Dashboard screen to suit your workflow. This is true on most other administration screens as well.') . '</p>
    54 <p>' . __('<strong>Screen Options</strong> - Use the Screen Options tab to choose which Dashboard boxes to show, and how many columns to display.') . '</p>
    55 <p>' . __('<strong>Drag and Drop</strong> - To rearrange the boxes, drag and drop by clicking on the title bar of the selected box and releasing when you see a gray dotted-line rectangle appear in the location you want to place the box.') . '</p>
    56 <p>' . __('<strong>Box Controls</strong> - Click the title bar of the box to expand or collapse it. In addition, some box have configurable content, and will show a &#8220;Configure&#8221; link in the title bar if you hover over it.') . '</p>';
     48$help_layout  = '<p>' . __('You can use the following controls to arrange your Dashboard screen to suit your workflow. This is true on most other administration screens as well.') . '</p>';
     49$help_layout .= '<p>' . __('<strong>Screen Options</strong> - Use the Screen Options tab to choose which Dashboard boxes to show, and how many columns to display.') . '</p>';
     50$help_layout .= '<p>' . __('<strong>Drag and Drop</strong> - To rearrange the boxes, drag and drop by clicking on the title bar of the selected box and releasing when you see a gray dotted-line rectangle appear in the location you want to place the box.') . '</p>';
     51$help_layout .= '<p>' . __('<strong>Box Controls</strong> - Click the title bar of the box to expand or collapse it. In addition, some box have configurable content, and will show a &#8220;Configure&#8221; link in the title bar if you hover over it.') . '</p>';
    5752
    5853$current_screen->add_help_tab( array(
    5954    'title'   => __('Layout'),
    60     'id' => 'layout',
    61     'content' => $help
     55    'content' => $help_layout,
    6256) );
    6357
    64 $help  = '<p>' . __('The boxes on your Dashboard screen are:') . '</p>
    65 <p>' . __('<strong>Right Now</strong> - Displays a summary of the content on your site and identifies which theme and version of WordPress you are using.') . '</p>
    66 <p>' . __('<strong>Recent Comments</strong> - Shows the most recent comments on your posts (configurable, up to 30) and allows you to moderate them.') . '</p>
    67 <p>' . __('<strong>Incoming Links</strong> - Shows links to your site found by Google Blog Search.') . '</p>
    68 <p>' . __('<strong>QuickPress</strong> - Allows you to create a new post and either publish it or save it as a draft.') . '</p>
    69 <p>' . __('<strong>Recent Drafts</strong> - Displays links to the 5 most recent draft posts you&#8217;ve started.') . '</p>
    70 <p>' . __('<strong>WordPress Blog</strong> - Latest news from the official WordPress project.') . '</p>
    71 <p>' . __('<strong>Other WordPress News</strong> - Shows the <a href="http://planet.wordpress.org" target="_blank">WordPress Planet</a> feed. You can configure it to show a different feed of your choosing.') . '</p>
    72 <p>' . __('<strong>Plugins</strong> - Features the most popular, newest, and recently updated plugins from the WordPress.org Plugin Directory.') . '</p>';
     58$help_content  = '<p>' . __('The boxes on your Dashboard screen are:') . '</p>';
     59$help_content .= '<p>' . __('<strong>Right Now</strong> - Displays a summary of the content on your site and identifies which theme and version of WordPress you are using.') . '</p>';
     60$help_content .= '<p>' . __('<strong>Recent Comments</strong> - Shows the most recent comments on your posts (configurable, up to 30) and allows you to moderate them.') . '</p>';
     61$help_content .= '<p>' . __('<strong>Incoming Links</strong> - Shows links to your site found by Google Blog Search.') . '</p>';
     62$help_content .= '<p>' . __('<strong>QuickPress</strong> - Allows you to create a new post and either publish it or save it as a draft.') . '</p>';
     63$help_content .= '<p>' . __('<strong>Recent Drafts</strong> - Displays links to the 5 most recent draft posts you&#8217;ve started.') . '</p>';
     64$help_content .= '<p>' . __('<strong>WordPress Blog</strong> - Latest news from the official WordPress project.') . '</p>';
     65$help_content .= '<p>' . __('<strong>Other WordPress News</strong> - Shows the <a href="http://planet.wordpress.org" target="_blank">WordPress Planet</a> feed. You can configure it to show a different feed of your choosing.') . '</p>';
     66$help_content .= '<p>' . __('<strong>Plugins</strong> - Features the most popular, newest, and recently updated plugins from the WordPress.org Plugin Directory.') . '</p>';
    7367
    7468$current_screen->add_help_tab( array(
    7569    'title'   => __('Content'),
    76     'id' => 'content',
    77     'content' => $help
     70    'content' => $help_content,
    7871) );
    7972
    80 $current_screen->add_help_sidebar('
    81 <p><strong>' . __( 'For more information:' ) . '</strong></p>
    82 <p>' . __( '<a href="http://codex.wordpress.org/Dashboard_Screen" target="_blank">Documentation on Dashboard</a>' ) . '</p>
    83 <p>' . __( '<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>
    84 ');
     73$current_screen->add_help_sidebar(
     74    '<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
     75    '<p>' . __( '<a href="http://codex.wordpress.org/Dashboard_Screen" target="_blank">Documentation on Dashboard</a>' ) . '</p>' .
     76    '<p>' . __( '<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>'
     77);
    8578
    8679
  • trunk/wp-admin/link-manager.php

    r18867 r18911  
    4040$title = __('Links');
    4141$this_file = $parent_file = 'link-manager.php';
    42 
    43 $current_screen->add_option_context(
    44 '<p>test</p>'
    45 );
    4642
    4743add_contextual_help( $current_screen,
  • trunk/wp-admin/nav-menus.php

    r18882 r18911  
    446446    $messages[] = '<div id="message" class="updated"><p>' . __('The current theme does not natively support menus, but you can use the &#8220;Custom Menu&#8221; widget to add any menus you create here to the theme&#8217;s sidebar.') . '</p></div>';
    447447
    448 $current_screen->add_option_context(
    449 '<p>test</p>'
    450 );
    451 
    452 add_contextual_help( $current_screen, '
    453 <p>' . __('This feature allows you to use a custom menu in place of your theme&#8217;s default menus. If your theme does not support the custom menus feature yet (the new and old default themes, Twenty Eleven and Twenty Ten, do), you can learn about adding this support by following the Documentation link in this tab. You can still use the &#8220;Custom Menu&#8221; widget to add menus to a sidebar.') . '</p>
    454 <p>' . __('You can create custom menus for your site. These menus may contain links to pages, categories, custom links or other content types (use the Screen Options tab to decide which ones to show on the screen). You can specify a different navigation label for a menu item as well as other attributes. You can create multiple menus. If your theme includes more than one menu, you can choose which custom menu to associate with each. You can also use custom menus in conjunction with the Custom Menus widget.') . '</p>
    455 <p>' . __('To create a new custom menu, click on the + tab, give the menu a name, and click Create Menu. Next, add menu items from the appropriate boxes. You&#8217;ll be able to edit the information for each menu item, and can drag and drop to put them in order. You can also drag a menu item a little to the right to make it a submenu, to create menus with hierarchy. Drop the item into its new nested placement when the dotted rectangle target shifts over, also a little to the right. Don&#8217;t forget to click Save when you&#8217;re finished.') . '</p>
    456 <p><strong>' . __('For more information:') . '</strong></p>
    457 <p>' . __('<a href="http://codex.wordpress.org/Appearance_Menus_Screen" target="_blank">Documentation on Menus</a>') . '</p>
    458 <p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' );
     448$help =  '<p>' . __('This feature allows you to use a custom menu in place of your theme&#8217;s default menus. If your theme does not support the custom menus feature yet (the new and old default themes, Twenty Eleven and Twenty Ten, do), you can learn about adding this support by following the Documentation link in this tab. You can still use the &#8220;Custom Menu&#8221; widget to add menus to a sidebar.') . '</p>';
     449$help .= '<p>' . __('You can create custom menus for your site. These menus may contain links to pages, categories, custom links or other content types (use the Screen Options tab to decide which ones to show on the screen). You can specify a different navigation label for a menu item as well as other attributes. You can create multiple menus. If your theme includes more than one menu, you can choose which custom menu to associate with each. You can also use custom menus in conjunction with the Custom Menus widget.') . '</p>';
     450$help .= '<p>' . __('To create a new custom menu, click on the + tab, give the menu a name, and click Create Menu. Next, add menu items from the appropriate boxes. You&#8217;ll be able to edit the information for each menu item, and can drag and drop to put them in order. You can also drag a menu item a little to the right to make it a submenu, to create menus with hierarchy. Drop the item into its new nested placement when the dotted rectangle target shifts over, also a little to the right. Don&#8217;t forget to click Save when you&#8217;re finished.') . '</p>';
     451$help .= '<p><strong>' . __('For more information:') . '</strong></p>';
     452$help .= '<p>' . __('<a href="http://codex.wordpress.org/Appearance_Menus_Screen" target="_blank">Documentation on Menus</a>') . '</p>';
     453$help .= '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>';
     454
     455add_contextual_help($current_screen, $help);
    459456
    460457// Get the admin header
  • trunk/wp-admin/network/index.php

    r18889 r18911  
    3939add_thickbox();
    4040
    41 $current_screen->add_option('layout_columns', array('max' => 4, 'default' => 2) );
    42 
    43 $current_screen->add_option_context(
    44 '<p>test</p>'
    45 );
     41add_screen_option('layout_columns', array('max' => 4, 'default' => 2) );
    4642
    4743require_once( '../admin-header.php' );
  • trunk/wp-admin/network/site-themes.php

    r18867 r18911  
    123123
    124124add_thickbox();
    125 $current_screen->add_option( 'per_page', array( 'label' => _x( 'Themes', 'themes per page (screen options)' ) ) );
    126 
    127 $current_screen->add_option_context(
    128 '<p>test</p>'
    129 );
     125add_screen_option( 'per_page', array( 'label' => _x( 'Themes', 'themes per page (screen options)' ) ) );
    130126
    131127$site_url_no_http = preg_replace( '#^http(s)?://#', '', get_blogaddress_by_id( $id ) );
  • trunk/wp-admin/network/site-users.php

    r18867 r18911  
    154154}
    155155
    156 $current_screen->add_option( 'per_page', array( 'label' => _x( 'Users', 'users per page (screen options)' ) ) );
    157 
    158 $current_screen->add_option_context(
    159 '<p>test</p>'
    160 );
     156add_screen_option( 'per_page', array( 'label' => _x( 'Users', 'users per page (screen options)' ) ) );
    161157
    162158$site_url_no_http = preg_replace( '#^http(s)?://#', '', get_blogaddress_by_id( $id ) );
  • trunk/wp-admin/network/sites.php

    r18867 r18911  
    2323$parent_file = 'sites.php';
    2424
    25 $current_screen->add_option( 'per_page', array('label' => _x( 'Sites', 'sites per page (screen options)' )) );
    26 
    27 $current_screen->add_option_context(
    28 '<p>test</p>'
    29 );
     25add_screen_option( 'per_page', array('label' => _x( 'Sites', 'sites per page (screen options)' )) );
    3026
    3127add_contextual_help($current_screen,
  • trunk/wp-admin/network/themes.php

    r18869 r18911  
    202202add_thickbox();
    203203
    204 $current_screen->add_option( 'per_page', array('label' => _x( 'Themes', 'themes per page (screen options)' )) );
    205 
    206 $current_screen->add_option_context(
    207 '<p>test</p>'
    208 );
     204add_screen_option( 'per_page', array('label' => _x( 'Themes', 'themes per page (screen options)' )) );
    209205
    210206add_contextual_help($current_screen,
  • trunk/wp-admin/network/users.php

    r18867 r18911  
    228228$parent_file = 'users.php';
    229229
    230 $current_screen->add_option( 'per_page', array('label' => _x( 'Users', 'users per page (screen options)' )) );
    231 
    232 $current_screen->add_option_context(
    233 '<p>test</p>'
    234 );
     230add_screen_option( 'per_page', array('label' => _x( 'Users', 'users per page (screen options)' )) );
    235231
    236232add_contextual_help($current_screen,
  • trunk/wp-admin/plugin-install.php

    r18867 r18911  
    3636do_action('install_plugins_pre_' . $tab); //Used to override the general interface, Eg, install or plugin information.
    3737
    38 $current_screen->add_option_context(
    39 '<p>test</p>'
     38add_contextual_help($current_screen,
     39    '<p>' . sprintf(__('Plugins hook into WordPress to extend its functionality with custom features. Plugins are developed independently from WordPress core by thousands of developers all over the world. All plugins in the official <a href="%s" target="_blank">WordPress.org Plugin Directory</a> are compatible with the license WordPress uses. You can find new plugins to install by searching or browsing the Directory right here in your own Plugins section.'), 'http://wordpress.org/extend/plugins/') . '</p>' .
     40    '<p>' . __('If you know what you&#8217;re looking for, Search is your best bet. The Search screen has options to search the WordPress.org Plugin Directory for a particular Term, Author, or Tag. You can also search the directory by selecting a popular tags. Tags in larger type mean more plugins have been labeled with that tag.') . '</p>' .
     41    '<p>' . __('If you just want to get an idea of what&#8217;s available, you can browse Featured, Popular, Newest, and Recently Updated plugins by using the links in the upper left of the screen. These sections rotate regularly.') . '</p>' .
     42    '<p>' . __('If you want to install a plugin that you&#8217;ve downloaded elsewhere, click Upload in the upper left. You will be prompted to upload the .zip package, and once uploaded, you can activate the new plugin.') . '</p>' .
     43    '<p><strong>' . __('For more information:') . '</strong></p>' .
     44    '<p>' . __('<a href="http://codex.wordpress.org/Plugins_Add_New_Screen" target="_blank">Documentation on Installing Plugins</a>') . '</p>' .
     45    '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
    4046);
    41 
    42 add_contextual_help( $current_screen, '
    43 <p>' . sprintf(__('Plugins hook into WordPress to extend its functionality with custom features. Plugins are developed independently from WordPress core by thousands of developers all over the world. All plugins in the official <a href="%s" target="_blank">WordPress.org Plugin Directory</a> are compatible with the license WordPress uses. You can find new plugins to install by searching or browsing the Directory right here in your own Plugins section.'), 'http://wordpress.org/extend/plugins/') . '</p>
    44 <p>' . __('If you know what you&#8217;re looking for, Search is your best bet. The Search screen has options to search the WordPress.org Plugin Directory for a particular Term, Author, or Tag. You can also search the directory by selecting a popular tags. Tags in larger type mean more plugins have been labeled with that tag.') . '</p>
    45 <p>' . __('If you just want to get an idea of what&#8217;s available, you can browse Featured, Popular, Newest, and Recently Updated plugins by using the links in the upper left of the screen. These sections rotate regularly.') . '</p>
    46 <p>' . __('If you want to install a plugin that you&#8217;ve downloaded elsewhere, click Upload in the upper left. You will be prompted to upload the .zip package, and once uploaded, you can activate the new plugin.') . '</p>
    47 <p><strong>' . __('For more information:') . '</strong></p>
    48 <p>' . __('<a href="http://codex.wordpress.org/Plugins_Add_New_Screen" target="_blank">Documentation on Installing Plugins</a>') . '</p>
    49 <p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' );
    5047
    5148include(ABSPATH . 'wp-admin/admin-header.php');
  • trunk/wp-admin/plugins.php

    r18908 r18911  
    317317add_thickbox();
    318318
    319 $current_screen->add_option( 'per_page', array('label' => _x( 'Plugins', 'plugins per page (screen options)' ), 'default' => 999 ) );
    320 
    321 $current_screen->add_option_context(
    322 '<p>test</p>'
     319add_screen_option( 'per_page', array('label' => _x( 'Plugins', 'plugins per page (screen options)' ), 'default' => 999 ) );
     320
     321add_contextual_help($current_screen,
     322    '<p>' . __('Plugins extend and expand the functionality of WordPress. Once a plugin is installed, you may activate it or deactivate it here.') . '</p>' .
     323    '<p>' . sprintf(__('You can find additional plugins for your site by using the <a href="%1$s">Plugin Browser/Installer</a> functionality or by browsing the <a href="%2$s" target="_blank">WordPress Plugin Directory</a> directly and installing new plugins manually. To manually install a plugin you generally just need to upload the plugin file into your <code>/wp-content/plugins</code> directory. Once a plugin has been installed, you can activate it here.'), 'plugin-install.php', 'http://wordpress.org/extend/plugins/') . '</p>' .
     324    '<p>' . __('Most of the time, plugins play nicely with the core of WordPress and with other plugins. Sometimes, though, a plugin&#8217;s code will get in the way of another plugin, causing compatibility issues. If your site starts doing strange things, this may be the problem. Try deactivating all your plugins and re-activating them in various combinations until you isolate which one(s) caused the issue.') . '</p>' .
     325    '<p>' . sprintf( __('If something goes wrong with a plugin and you can&#8217;t use WordPress, delete or rename that file in the <code>%s</code> directory and it will be automatically deactivated.'), WP_PLUGIN_DIR) . '</p>' .
     326    '<p><strong>' . __('For more information:') . '</strong></p>' .
     327    '<p>' . __('<a href="http://codex.wordpress.org/Managing_Plugins#Plugin_Management" target="_blank">Documentation on Managing Plugins</a>') . '</p>' .
     328    '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
    323329);
    324 
    325 add_contextual_help( $current_screen, '
    326 <p>' . __('Plugins extend and expand the functionality of WordPress. Once a plugin is installed, you may activate it or deactivate it here.') . '</p>
    327 <p>' . sprintf(__('You can find additional plugins for your site by using the <a href="%1$s">Plugin Browser/Installer</a> functionality or by browsing the <a href="%2$s" target="_blank">WordPress Plugin Directory</a> directly and installing new plugins manually. To manually install a plugin you generally just need to upload the plugin file into your <code>/wp-content/plugins</code> directory. Once a plugin has been installed, you can activate it here.'), 'plugin-install.php', 'http://wordpress.org/extend/plugins/') . '</p>
    328 <p>' . __('Most of the time, plugins play nicely with the core of WordPress and with other plugins. Sometimes, though, a plugin&#8217;s code will get in the way of another plugin, causing compatibility issues. If your site starts doing strange things, this may be the problem. Try deactivating all your plugins and re-activating them in various combinations until you isolate which one(s) caused the issue.') . '</p>
    329 <p>' . sprintf( __('If something goes wrong with a plugin and you can&#8217;t use WordPress, delete or rename that file in the <code>%s</code> directory and it will be automatically deactivated.'), WP_PLUGIN_DIR) . '</p>
    330 <p><strong>' . __('For more information:') . '</strong></p>
    331 <p>' . __('<a href="http://codex.wordpress.org/Managing_Plugins#Plugin_Management" target="_blank">Documentation on Managing Plugins</a>') . '</p>
    332 <p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' );
    333330
    334331$title = __('Plugins');
  • trunk/wp-admin/upload.php

    r18876 r18911  
    144144wp_enqueue_script( 'media' );
    145145
    146 $current_screen->add_option( 'per_page', array('label' => _x( 'Media items', 'items per page (screen options)' )) );
    147 
    148 $current_screen->add_option_context(
    149 '<p>test</p>'
     146add_screen_option( 'per_page', array('label' => _x( 'Media items', 'items per page (screen options)' )) );
     147
     148add_contextual_help( $current_screen,
     149    '<p>' . __( 'All the files you&#8217;ve uploaded are listed in the Media Library, with the most recent uploads listed first. You can use the <em>Screen Options</em> tab to customize the display of this screen.' ) . '</p>' .
     150    '<p>' . __( 'You can narrow the list by file type/status using the text link filters at the top of the screen. You also can refine the list by date using the dropdown menu above the media table.' ) . '</p>' .
     151    '<p>' . __( 'Hovering over a row reveals action links: <em>Edit</em>, <em>Delete Permanently</em>, and <em>View</em>. Clicking <em>Edit</em> or on the media file&#8217;s name displays a simple screen to edit that individual file&#8217;s metadata. Clicking <em>Delete Permanently</em> will delete the file from the media library (as well as from any posts to which it is currently attached). <em>View</em> will take you to the display page for that file.' ) . '</p>' .
     152    '<p>' . __( 'If a media file has not been attached to any post, you will see that in the <em>Attached To</em> column, and can click on <em>Attach File</em> to launch a small popup that will allow you to search for a post and attach the file.' ) . '</p>' .
     153    '<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
     154    '<p>' . __( '<a href="http://codex.wordpress.org/Media_Library_Screen" target="_blank">Documentation on Media Library</a>' ) . '</p>' .
     155    '<p>' . __( '<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>'
    150156);
    151 
    152 add_contextual_help( $current_screen, '
    153 <p>' . __( 'All the files you&#8217;ve uploaded are listed in the Media Library, with the most recent uploads listed first. You can use the <em>Screen Options</em> tab to customize the display of this screen.' ) . '</p>
    154 <p>' . __( 'You can narrow the list by file type/status using the text link filters at the top of the screen. You also can refine the list by date using the dropdown menu above the media table.' ) . '</p>
    155 <p>' . __( 'Hovering over a row reveals action links: <em>Edit</em>, <em>Delete Permanently</em>, and <em>View</em>. Clicking <em>Edit</em> or on the media file&#8217;s name displays a simple screen to edit that individual file&#8217;s metadata. Clicking <em>Delete Permanently</em> will delete the file from the media library (as well as from any posts to which it is currently attached). <em>View</em> will take you to the display page for that file.' ) . '</p>
    156 <p>' . __( 'If a media file has not been attached to any post, you will see that in the <em>Attached To</em> column, and can click on <em>Attach File</em> to launch a small popup that will allow you to search for a post and attach the file.' ) . '</p>
    157 <p><strong>' . __( 'For more information:' ) . '</strong></p>
    158 <p>' . __( '<a href="http://codex.wordpress.org/Media_Library_Screen" target="_blank">Documentation on Media Library</a>' ) . '</p>
    159 <p>' . __( '<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>' );
    160157
    161158require_once('./admin-header.php');
  • trunk/wp-admin/users.php

    r18867 r18911  
    1818$parent_file = 'users.php';
    1919
    20 $current_screen->add_option( 'per_page', array('label' => _x( 'Users', 'users per page (screen options)' )) );
    21 
    22 $current_screen->add_option_context(
    23 '<p>test</p>'
     20add_screen_option( 'per_page', array('label' => _x( 'Users', 'users per page (screen options)' )) );
     21
     22// contextual help - choose Help on the top right of admin panel to preview this.
     23add_contextual_help($current_screen,
     24    '<p>' . __('This screen lists all the existing users for your site. Each user has one of five defined roles as set by the site admin: Site Administrator, Editor, Author, Contributor, or Subscriber. Users with roles other than Administrator will see fewer options in the dashboard navigation when they are logged in, based on their role.') . '</p>' .
     25    '<p>' . __('You can customize the display of information on this screen as you can on other screens, by using the Screen Options tab and the on-screen filters.') . '</p>' .
     26    '<p>' . __('To add a new user for your site, click the Add New button at the top of the screen or Add New in the Users menu section.') . '</p>' .
     27    '<p><strong>' . __('For more information:') . '</strong></p>' .
     28    '<p>' . __('<a href="http://codex.wordpress.org/Users_Screen" target="_blank">Documentation on Managing Users</a>') . '</p>' .
     29    '<p>' . __('<a href="http://codex.wordpress.org/Roles_and_Capabilities" target="_blank">Descriptions of Roles and Capabilities</a>') . '</p>' .
     30    '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
    2431);
    25 
    26 add_contextual_help( $current_screen, '
    27 <p>' . __('This screen lists all the existing users for your site. Each user has one of five defined roles as set by the site admin: Site Administrator, Editor, Author, Contributor, or Subscriber. Users with roles other than Administrator will see fewer options in the dashboard navigation when they are logged in, based on their role.') . '</p>
    28 <p>' . __('You can customize the display of information on this screen as you can on other screens, by using the Screen Options tab and the on-screen filters.') . '</p>
    29 <p>' . __('To add a new user for your site, click the Add New button at the top of the screen or Add New in the Users menu section.') . '</p>
    30 <p><strong>' . __('For more information:') . '</strong></p>
    31 <p>' . __('<a href="http://codex.wordpress.org/Users_Screen" target="_blank">Documentation on Managing Users</a>') . '</p>
    32 <p>' . __('<a href="http://codex.wordpress.org/Roles_and_Capabilities" target="_blank">Descriptions of Roles and Capabilities</a>') . '</p>
    33 <p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' );
    3432
    3533if ( empty($_REQUEST) ) {
  • trunk/wp-admin/widgets.php

    r18882 r18911  
    3636$parent_file = 'themes.php';
    3737
    38 $current_screen->add_option_context(
    39 '<p>test</p>'
    40 );
    41 
    42 add_contextual_help( $current_screen, '
    43 <p>' . __('Widgets are independent sections of content that can be placed into any widgetized area provided by your theme (commonly called sidebars). To populate your sidebars/widget areas with individual widgets, drag and drop the title bars into the desired area. By default, only the first widget area is expanded. To populate additional widget areas, click on their title bars to expand them.') . '</p>
    44 <p>' . __('The Available Widgets section contains all the widgets you can choose from. Once you drag a widget into a sidebar, it will open to allow you to configure its settings. When you are happy with the widget settings, click the Save button and the widget will go live on your site. If you click Delete, it will remove the widget.') . '</p>
    45 <p>' . __('If you want to remove the widget but save its setting for possible future use, just drag it into the Inactive Widgets area. You can add them back anytime from there. This is especially helpful when you switch to a theme with fewer or different widget areas.') . '</p>
    46 <p>' . __('Widgets may be used multiple times. You can give each widget a title, to display on your site, but it&#8217;s not required.') . '</p>
    47 <p>' . __('Enabling Accessibility Mode, via Screen Options, allows you to use Add and Edit buttons instead of using drag and drop.') . '</p>
    48 <p>' . __('Many themes show some sidebar widgets by default until you edit your sidebars, but they are not automatically displayed in your sidebar management tool. After you make your first widget change, you can re-add the default widgets by adding them from the Available Widgets area.') . '</p>
    49 <p><strong>' . __('For more information:') . '</strong></p>
    50 <p>' . __('<a href="http://codex.wordpress.org/Appearance_Widgets_Screen" target="_blank">Documentation on Widgets</a>') . '</p>
    51 <p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' );
     38$help = '
     39    <p>' . __('Widgets are independent sections of content that can be placed into any widgetized area provided by your theme (commonly called sidebars). To populate your sidebars/widget areas with individual widgets, drag and drop the title bars into the desired area. By default, only the first widget area is expanded. To populate additional widget areas, click on their title bars to expand them.') . '</p>
     40    <p>' . __('The Available Widgets section contains all the widgets you can choose from. Once you drag a widget into a sidebar, it will open to allow you to configure its settings. When you are happy with the widget settings, click the Save button and the widget will go live on your site. If you click Delete, it will remove the widget.') . '</p>
     41    <p>' . __('If you want to remove the widget but save its setting for possible future use, just drag it into the Inactive Widgets area. You can add them back anytime from there. This is especially helpful when you switch to a theme with fewer or different widget areas.') . '</p>
     42    <p>' . __('Widgets may be used multiple times. You can give each widget a title, to display on your site, but it&#8217;s not required.') . '</p>
     43    <p>' . __('Enabling Accessibility Mode, via Screen Options, allows you to use Add and Edit buttons instead of using drag and drop.') . '</p>
     44    <p>' . __('Many themes show some sidebar widgets by default until you edit your sidebars, but they are not automatically displayed in your sidebar management tool. After you make your first widget change, you can re-add the default widgets by adding them from the Available Widgets area.') . '</p>
     45';
     46$help .= '<p><strong>' . __('For more information:') . '</strong></p>';
     47$help .= '<p>' . __('<a href="http://codex.wordpress.org/Appearance_Widgets_Screen" target="_blank">Documentation on Widgets</a>') . '</p>';
     48$help .= '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>';
     49add_contextual_help($current_screen, $help);
    5250
    5351// These are the widgets grouped by sidebar
Note: See TracChangeset for help on using the changeset viewer.