WordPress.org

Make WordPress Core

Changeset 18867


Ignore:
Timestamp:
10/03/11 04:00:57 (4 years ago)
Author:
azaozz
Message:

Use add_option() method, introduce add_option_context() method for adding specific text above the screen options, see #18690

Location:
trunk/wp-admin
Files:
21 edited

Legend:

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

    r18866 r18867  
    15071507#screen-options-wrap h5, 
    15081508#contextual-help-wrap h5 { 
    1509     margin: 8px 0; 
     1509    margin: 12px 0 2px; 
    15101510    font-size: 13px; 
    15111511} 
    15121512 
    15131513.metabox-prefs label { 
    1514     display: inline-block; 
    15151514    padding-right: 15px; 
    15161515    white-space: nowrap; 
    1517     line-height: 30px; 
    15181516} 
    15191517 
  • trunk/wp-admin/edit-comments.php

    r18864 r18867  
    110110    $title = __('Comments'); 
    111111 
    112 add_screen_option( 'per_page', array('label' => _x( 'Comments', 'comments per page (screen options)' )) ); 
    113  
    114 $current_screen->add_screen_options(  
    115 '<p>test</p>' 
    116 ); 
     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>' ); 
    117114 
    118115add_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

    r18864 r18867  
    162162$current_screen->add_option('layout_columns', array('max' => 2, 'default' => 'auto') ); 
    163163 
    164 $current_screen->add_screen_options(  
     164$current_screen->add_option_context(  
    165165'<p>test</p>' 
    166166); 
  • trunk/wp-admin/edit-link-form.php

    r18864 r18867  
    3838do_action('do_meta_boxes', 'link', 'side', $link); 
    3939 
    40 add_screen_option('layout_columns', array('max' => 2, 'default' => 'auto') ); 
     40$current_screen->add_option('layout_columns', array('max' => 2, 'default' => 'auto') ); 
    4141 
    42 $current_screen->add_screen_options(  
     42$current_screen->add_option_context(  
    4343'<p>test</p>' 
    4444); 
  • trunk/wp-admin/edit-tags.php

    r18864 r18867  
    2929} 
    3030 
    31 add_screen_option( 'per_page', array('label' => $title, 'default' => 20, 'option' => 'edit_' . $tax->name . '_per_page') ); 
    32  
    33 $current_screen->add_screen_options(  
     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(  
    3434'<p>test</p>' 
    3535); 
  • trunk/wp-admin/edit.php

    r18864 r18867  
    149149$title = $post_type_object->labels->name; 
    150150 
    151 add_screen_option( 'per_page', array('label' => $title, 'default' => 20) ); 
    152  
    153 $current_screen->add_screen_options(  
    154 '<p>test</p>' 
    155 ); 
     151$current_screen->add_option( 'per_page', array('label' => $title, 'default' => 20) ); 
     152$current_screen->add_option_context( '<p>test</p>' ); 
    156153 
    157154if ( 'post' == $post_type ) { 
  • trunk/wp-admin/includes/screen.php

    r18866 r18867  
    1515 * @return array Containing the headers in the format id => UI String 
    1616 */ 
    17 function get_column_headers( $screen ) { 
     17function get_column_headers( $screen ) { // TODO: fold into WP_Screen 
    1818    if ( is_string( $screen ) ) 
    1919        $screen = convert_to_screen( $screen ); 
     
    3636 * @return array 
    3737 */ 
    38 function get_hidden_columns( $screen ) { 
     38function get_hidden_columns( $screen ) { // TODO: fold into WP_Screen 
    3939    if ( is_string( $screen ) ) 
    4040        $screen = convert_to_screen( $screen ); 
     
    5050 * @param unknown_type $screen 
    5151 */ 
    52 function meta_box_prefs($screen) { 
     52function meta_box_prefs($screen) { // TODO: fold into WP_Screen 
    5353    global $wp_meta_boxes; 
    5454 
     
    8686 * @return array Hidden Meta Boxes 
    8787 */ 
    88 function get_hidden_meta_boxes( $screen ) { 
     88function get_hidden_meta_boxes( $screen ) { // TODO: fold into WP_Screen 
    8989    if ( is_string( $screen ) ) 
    9090        $screen = convert_to_screen( $screen ); 
     
    109109 * @since 2.7.0 
    110110 */ 
    111 function favorite_actions( $screen = null ) { 
     111function favorite_actions( $screen = null ) { // TODO: deprecate and remove? 
    112112    $default_action = false; 
    113113 
     
    224224 * @return object An object containing the safe screen name and id 
    225225 */ 
    226 function convert_to_screen( $screen ) { 
     226function convert_to_screen( $screen ) { // TODO: fold into WP_Screen 
    227227    $screen = str_replace( array('.php', '-new', '-add', '-network', '-user' ), '', $screen); 
    228228 
     
    232232        $screen .= '-user'; 
    233233 
    234     $screen = (string) apply_filters( 'screen_meta_screen', $screen ); 
     234    // why do we need this? $screen = (string) apply_filters( 'screen_meta_screen', $screen ); 
    235235    $screen = (object) array('id' => $screen, 'base' => $screen); 
    236236    return $screen; 
     
    246246 * @param string    $screen The handle for the screen to add help to.  This is usually the hook name returned by the add_*_page() functions. 
    247247 * @param string    $help   The content of a 'Screen Info' help tab. 
    248  * 
    249  * @todo: deprecate? 
    250  */ 
    251 function add_contextual_help($screen, $help) { 
     248 */ 
     249function add_contextual_help($screen, $help) { // TODO: deprecate 
    252250    global $_wp_contextual_help; 
    253251 
     
    270268 * @return void 
    271269 */ 
    272 function add_screen_option( $option, $args = array() ) { 
     270function add_screen_option( $option, $args = array() ) { // TODO: set deprecated 
    273271    $current_screen = get_current_screen(); 
    274272 
     
    279277} 
    280278 
    281 function screen_icon( $screen = '' ) { 
     279function screen_icon( $screen = '' ) { // TODO: fold into WP_Screen 
    282280    echo get_screen_icon( $screen ); 
    283281} 
    284282 
    285 function get_screen_icon( $screen = '' ) { 
     283function get_screen_icon( $screen = '' ) { // TODO: fold into WP_Screen 
    286284    global $current_screen, $typenow; 
    287285 
     
    339337 * @param string $id Screen id, optional. 
    340338 */ 
    341 function set_current_screen( $id =  '' ) { 
     339function set_current_screen( $id = '' ) { 
    342340    global $current_screen; 
    343341 
     342    if ( is_a( $current_screen, 'WP_Screen' ) ) 
     343        return; 
     344 
    344345    $current_screen = new WP_Screen( $id ); 
    345346 
    346     $current_screen = apply_filters('current_screen', $current_screen); 
     347    // why do we need this? $current_screen = apply_filters('current_screen', $current_screen); 
    347348} 
    348349 
     
    465466     * @access private 
    466467     */ 
    467     private $_options = array(); 
    468  
    469  
    470     /** 
    471      * Stores the result of the public show_screen_options function. 
     468    private $_options = array( 
     469        '_context' => '', 
     470        '_screen_settings' => '' 
     471    ); 
     472 
     473    /** 
     474     * Show screen options if any. 
    472475     * 
    473476     * @since 3.3.0 
     
    475478     * @access private 
    476479     */ 
    477     private $_show_screen_options; 
     480    private $_show_options = false; 
    478481 
    479482    /** 
     
    484487     * @access private 
    485488     */ 
    486     private $_screen_settings; 
     489    private $_screen_settings = ''; 
    487490 
    488491    /** 
     
    501504            $screen = $hook_suffix; 
    502505            $screen = str_replace('.php', '', $screen); 
     506 
    503507            if ( preg_match('/-add|-new$/', $screen) ) 
    504508                $action = 'add'; 
     509 
    505510            $screen = str_replace('-new', '', $screen); 
    506511            $screen = str_replace('-add', '', $screen); 
     
    508513        } else { 
    509514            $id = sanitize_key( $id ); 
     515 
    510516            if ( false !== strpos($id, '-') ) { 
    511517                list( $id, $typenow ) = explode('-', $id, 2); 
     518 
    512519                if ( taxonomy_exists( $typenow ) ) { 
    513520                    $id = 'edit-tags'; 
     
    524531        if ( 'index' == $this->base ) 
    525532            $this->base = 'dashboard'; 
     533 
    526534        if ( 'index' == $this->id ) 
    527535            $this->id = 'dashboard'; 
     
    530538            if ( empty($typenow) ) 
    531539                $typenow = 'post'; 
     540 
    532541            $this->id .= '-' . $typenow; 
    533542            $this->post_type = $typenow; 
     
    535544            if ( empty($typenow) ) 
    536545                $typenow = 'post'; 
     546 
    537547            $this->id = $typenow; 
    538548            $this->post_type = $typenow; 
     
    540550            if ( empty($taxnow) ) 
    541551                $taxnow = 'post_tag'; 
     552 
    542553            $this->id = 'edit-' . $taxnow; 
    543554            $this->taxonomy = $taxnow; 
     
    572583    /** 
    573584     * Adds an option for the screen. 
    574      * Call this in template files after admin.php is loaded and before admin-header.php is loaded to add screen options. 
     585     * Use the 'add_screen_help_and_options' action to add screen options. 
    575586     * 
    576587     * @since 3.3.0 
    577588     * 
    578589     * @param string $option Option ID 
    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; 
     590     * @param mixed $args Associative array of arguments particular to the default $option or the HTML string to be printed in the Screen Options tab. 
     591     */ 
     592    public function add_option( $option = false, $args ) { 
     593        if ( is_array($args) && !empty($option) ) 
     594            $this->_options[ $option ] = $args; 
     595        elseif ( is_string($args) ) 
     596            $this->_options['_screen_settings'] .= $args; 
     597 
     598        $this->_show_options = true; 
     599    } 
     600     
     601    /** 
     602     * Adds option context. 
     603     * Use the 'add_screen_help_and_options' action to add it. Will not be shown if there aren't any screen options. 
     604     * 
     605     * @since 3.3.0 
     606     * 
     607     * @param string $text 
     608     */ 
     609    public function add_option_context( $text ) { 
     610        $this->_options['_context'] .= $text; 
    583611    } 
    584612 
    585613    /** 
    586614     * Add a help tab to the contextual help for the screen. 
    587      * Call this in template files after admin.php is loaded and before admin-header.php is loaded to add contextual help tabs. 
     615     * Use the 'add_screen_help_and_options' action to add contextual help tabs. 
    588616     * 
    589617     * @since 3.3.0 
     
    591619     * @param array $args 
    592620     * - string   - title    - Title for the tab. 
     621     * - string   - id       - Tab ID. 
    593622     * - string   - section  - Section title for the tab. Optional. 
    594      * - string   - id       - Tab ID. Optional. 
    595623     * - string   - content  - Help tab content in plain text or HTML. Optional. 
    596624     * - callback - callback - A callback to generate the tab content. Optional. 
     
    600628        $defaults = array( 
    601629            'title'    => false, 
     630            'id'       => false, 
    602631            'section'  => false, 
    603             'id'       => false, 
    604632            'content'  => '', 
    605             'callback' => false, 
     633            'callback' => false 
    606634        ); 
    607635        $args = wp_parse_args( $args, $defaults ); 
    608636 
    609         // Ensure we have a title. 
    610         if ( ! $args['title'] ) 
     637        // Ensure we have title and ID. 
     638        if ( ! $args['title'] || ! $args['id'] ) 
    611639            return; 
    612640 
    613         // Create an id from the title if one is not provided. 
    614         if ( ! $args['id'] ) 
    615             $args['id'] = sanitize_html_class( $args['title'] ); 
    616  
    617641        $this->_help_tabs[] = $args; 
    618642    } 
     
    620644    /** 
    621645     * Add a sidebar to the contextual help for the screen. 
    622      * 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. 
     646     * Use the 'add_screen_help_and_options' action to add a sidebar to the contextual help. 
    623647     * 
    624648     * @since 3.3.0 
     
    627651     */ 
    628652    public function add_help_sidebar( $content ) { 
    629         $this->_help_sidebar = $content; 
     653        if ( empty($this->_help_sidebar) ) // add only one 
     654            $this->_help_sidebar = $content; 
    630655    } 
    631656 
     
    639664    public function render_screen_meta() { 
    640665        global $_wp_contextual_help; 
     666 
     667        do_action('add_screen_help_and_options'); 
    641668 
    642669        // Call old contextual_help_list filter. 
     
    644671            $_wp_contextual_help = array(); 
    645672 
    646         $_wp_contextual_help = apply_filters( 'contextual_help_list', $_wp_contextual_help, $this ); 
     673        // why are we filtering a global? $_wp_contextual_help = apply_filters( 'contextual_help_list', $_wp_contextual_help, $this ); 
    647674 
    648675        if ( isset( $_wp_contextual_help[ $this->id ] ) ) { 
    649676            // Call old contextual_help filter. 
     677            // why are we filtering the same global second time?? 
    650678            $contextual_help = apply_filters( 'contextual_help', $_wp_contextual_help[ $this->id ], $this->id, $this ); 
    651679 
    652680            $this->add_help_tab( array( 
    653                 'title'   => __('Screen Info'), 
    654                 'content' => $contextual_help, 
     681                'title'     => __('Screen Info'), 
     682                'id'        => 'screen-info', 
     683                'content'   => $_wp_contextual_help[ $this->id ] 
    655684            ) ); 
    656685        } 
     
    662691                <div class="contextual-help-tabs"> 
    663692                    <ul> 
    664                     <?php foreach ( $this->_help_tabs as $i => $tab ): 
    665                         $link_id  = "tab-link-{$tab['id']}"; 
    666                         $panel_id = "tab-panel-{$tab['id']}"; 
    667                         $classes  = ( $i == 0 ) ? 'active' : ''; 
     693                    <?php 
     694 
     695                    if ( $this->_show_options ) { 
     696                        $class = true; 
    668697                        ?> 
    669  
    670                         <li id="<?php echo esc_attr( $link_id ); ?>" class="<?php echo esc_attr( $classes ); ?>"> 
    671                             <a href="<?php echo esc_url( "#$panel_id" ); ?>"> 
     698                        <li id="tab-link-screen-options" class="active"> 
     699                            <a href="#tab-panel-screen-options"> 
     700                                <?php _e('Screen Options'); ?> 
     701                            </a> 
     702                        </li> 
     703                        <?php 
     704                    } 
     705 
     706                    foreach ( $this->_help_tabs as $i => $tab ) { 
     707                        $id = esc_attr($tab['id']); 
     708                        $class = empty($class) && $i == 0 ? ' class="active"' : ''; 
     709                        ?> 
     710                        <li id="<?php echo "tab-link-$id"; ?>"<?php echo $class; ?>> 
     711                            <a href="<?php echo "#tab-panel-$id"; ?>"> 
    672712                                <?php echo esc_html( $tab['title'] ); ?> 
    673713                            </a> 
    674714                        </li> 
    675                     <?php endforeach; ?> 
     715                    <?php } ?> 
    676716                    </ul> 
    677717                </div> 
    678  
    679                 <div class="contextual-help-sidebar"> 
    680                     <?php echo $this->_help_sidebar; ?> 
    681                 </div> 
    682  
     718                <?php 
     719 
     720                if ( $this->_help_sidebar ) 
     721                    echo '<div class="contextual-help-sidebar">' . $this->_help_sidebar . '</div>'; 
     722 
     723                ?> 
    683724                <div class="contextual-help-tabs-wrap"> 
    684                     <?php foreach ( $this->_help_tabs as $i => $tab ): 
    685                         $panel_id = "tab-panel-{$tab['id']}"; 
    686                         $classes  = ( $i == 0 ) ? 'active' : ''; 
    687                         $classes .= ' help-tab-content'; 
     725                    <?php 
     726 
     727                    if ( $this->_show_options ) { 
     728                        $class2 = true; 
     729                        echo '<div id="tab-panel-screen-options" class="help-tab-content active">'; 
     730 
     731                        if ( !empty($this->_options['_context']) ) 
     732                            echo $this->_options['_context']; 
     733 
     734                        $this->render_screen_options(); 
     735                        echo '</div>'; 
     736                    } 
     737 
     738                    foreach ( $this->_help_tabs as $i => $tab ) { 
     739                        $class2 = empty($class2) && $i == 0 ? ' active' : ''; 
    688740                        ?> 
    689741 
    690                         <div id="<?php echo esc_attr( $panel_id ); ?>" class="<?php echo esc_attr( $classes ); ?>"> 
     742                        <div id="<?php echo esc_attr( "tab-panel-{$tab['id']}" ); ?>" class="help-tab-content<?php echo $class2; ?>"> 
    691743                            <?php 
    692744                            if ( $tab['section'] ) 
     
    701753                            ?> 
    702754                        </div> 
    703                     <?php endforeach; ?> 
     755                    <?php } ?> 
    704756                </div> 
    705757            </div> 
     
    708760    } 
    709761 
    710     public function show_screen_options() { // not needed? 
    711         global $wp_meta_boxes, $wp_list_table; 
    712  
    713         if ( is_bool( $this->_show_screen_options ) ) 
    714             return $this->_show_screen_options; 
    715  
    716         $columns = get_column_headers( $this ); 
    717  
    718         $show_screen = false; 
    719         if ( ! empty( $wp_meta_boxes[ $this->id ] ) || ! empty( $columns ) ) 
    720             $show_screen = true; 
    721  
    722         // Check if there are per-page options. 
    723         $show_screen = $show_screen || isset( $this->_options['per_page'] ); 
    724  
    725         $this->_screen_settings = apply_filters( 'screen_settings', '', $this ); 
    726  
     762    /** 
     763     * Render the screen options tab. 
     764     * 
     765     * @since 3.3.0 
     766     */ 
     767    public function render_screen_options() { 
     768 
     769        $screen_settings = $this->_options['_screen_settings']; 
     770 
     771        // Default screen_settings for various screens. 
     772        // TODO: should probably be set on these screens, not here. 
    727773        switch ( $this->id ) { 
    728774            case 'widgets': 
    729                 $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"; 
    730                 $show_screen = true; 
     775                $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"; 
    731776                break; 
    732777        } 
    733778 
    734         if ( ! empty( $this->_screen_settings ) ) 
    735             $show_screen = true; 
    736  
    737         if ( ! empty( $this->_options ) ) 
    738             $show_screen = true; 
    739  
    740         $this->_show_screen_options = apply_filters( 'screen_options_show_screen', $show_screen, $this ); 
    741         return $this->_show_screen_options; 
    742     } 
    743  
    744     public function add_screen_options($before = '') { 
    745         $this->add_help_tab( array( 
    746             'title'    => __('Screen Options'), 
    747             'id'       => 'screen-options', 
    748             'callback' => array( $this, 'render_screen_options' ), 
    749             'content'  => $before 
    750         )); 
    751     } 
    752  
    753     /** 
    754      * Render the screen options tab. 
    755      * 
    756      * @since 3.3.0 
    757      */ 
    758     public function render_screen_options() { 
    759         global $wp_meta_boxes, $wp_list_table; 
    760  
    761         $columns = get_column_headers( $this ); 
    762         $hidden  = get_hidden_columns( $this ); 
    763         $this->_screen_settings = apply_filters( 'screen_settings', '', $this ); 
    764  
    765         switch ( $this->id ) { 
    766             case 'widgets': 
    767                 $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"; 
    768                 break; 
    769         } 
     779        // TODO: deprecate 
     780        $screen_settings = apply_filters( 'screen_settings', $screen_settings, $this ); 
    770781 
    771782        ?> 
    772783        <form id="adv-settings" action="" method="post"> 
    773         <?php if ( isset( $wp_meta_boxes[ $this->id ] ) ) : ?> 
    774             <h5><?php _ex('Show on screen', 'Metaboxes') ?></h5> 
    775             <div class="metabox-prefs"> 
    776                 <?php meta_box_prefs( $this ); ?> 
    777                 <br class="clear" /> 
    778             </div> 
    779             <?php endif; 
    780             if ( ! empty( $columns ) ) : ?> 
     784        <?php 
     785 
     786        $this->render_table_columns_prefs(); 
     787        $this->render_metabox_prefs(); 
     788        $this->render_screen_layout(); 
     789        $this->render_per_page_options(); 
     790        echo $screen_settings; 
     791 
     792        wp_nonce_field( 'screen-options-nonce', 'screenoptionnonce', false ); ?> 
     793        </form> 
     794        <?php 
     795    } 
     796 
     797    /** 
     798     * Render the option for hiding table columns on the page 
     799     * 
     800     * @since 3.3.0 
     801     */ 
     802    function render_table_columns_prefs() { 
     803        $columns = get_column_headers( $this ); 
     804 
     805        if ( ! empty( $columns ) ) { 
     806            $hidden = get_hidden_columns( $this ); 
     807            ?> 
    781808            <h5><?php echo ( isset( $columns['_title'] ) ?  $columns['_title'] :  _x('Show on screen', 'Columns') ) ?></h5> 
    782809            <div class="metabox-prefs"> 
     
    793820                    if ( 'comments' == $column ) 
    794821                        $title = __( 'Comments' ); 
     822 
    795823                    $id = "$column-hide"; 
    796824                    echo '<label for="' . $id . '">'; 
     
    801829                <br class="clear" /> 
    802830            </div> 
    803         <?php endif; 
    804  
    805         $this->render_screen_layout(); 
    806         $this->render_per_page_options(); 
    807         echo $this->_screen_settings; 
    808  
    809         ?> 
    810         <div><?php wp_nonce_field( 'screen-options-nonce', 'screenoptionnonce', false ); ?></div> 
    811         </form> 
    812         <?php 
     831        <?php } 
     832    } 
     833 
     834    /** 
     835     * Render the option for hiding metaboxes on the page 
     836     * 
     837     * @since 3.3.0 
     838     */ 
     839    function render_metabox_prefs() { 
     840        global $wp_meta_boxes; 
     841 
     842        if ( isset( $wp_meta_boxes[ $this->id ] ) ) { 
     843            ?> 
     844            <h5><?php _ex('Show on screen', 'Metaboxes') ?></h5> 
     845            <div class="metabox-prefs"> 
     846                <?php meta_box_prefs( $this ); ?> 
     847                <br class="clear" /> 
     848            </div> 
     849            <?php 
     850        } 
    813851    } 
    814852 
     
    822860 
    823861        // Back compat for plugins using the filter instead of add_screen_option() 
     862        // TODO: deprecate it 
    824863        $columns = apply_filters( 'screen_layout_columns', array(), $this->id, $this ); 
    825864 
    826865        if ( ! empty( $columns ) && isset( $columns[ $this->id ] ) ) 
    827             add_screen_option( 'layout_columns', array('max' => $columns[ $this->id ] ) ); 
     866            $this->add_option( 'layout_columns', array('max' => $columns[ $this->id ] ) ); 
    828867 
    829868        if ( ! isset( $this->_options['layout_columns'] ) ) { 
     
    870909     */ 
    871910    function render_per_page_options() { 
    872         if ( ! isset( $this->_options['per_page'] ) ) 
     911        if ( empty( $this->_options['per_page'] ) ) 
    873912            return; 
    874913 
     
    920959    } 
    921960} 
     961 
  • trunk/wp-admin/index.php

    r18864 r18867  
    2424 
    2525if ( is_user_admin() ) 
    26     add_screen_option('layout_columns', array('max' => 4, 'default' => 1) ); 
     26    $current_screen->add_option('layout_columns', array('max' => 4, 'default' => 1) ); 
    2727else 
    28     add_screen_option('layout_columns', array('max' => 4, 'default' => 'auto') ); 
     28    $current_screen->add_option('layout_columns', array('max' => 4, 'default' => 'auto') ); 
    2929 
    30 $current_screen->add_screen_options(  
     30$current_screen->add_option_context(  
    3131'<p>test</p>' 
    3232); 
     
    3434// Help tabs 
    3535 
    36 $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>'; 
     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>'; 
    3737 
    3838$current_screen->add_help_tab( array( 
    3939    'title'   => __('Overview'), 
    40     'content' => $help_overview, 
     40    'id' => 'overview', 
     41    'content' => $help 
    4142) ); 
    4243 
    43 $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>'; 
    44 $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>'; 
     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>'; 
    4546 
    4647$current_screen->add_help_tab( array( 
    4748    'title'   => __('Navigation'), 
    48     'content' => $help_navigation, 
     49    'id' => 'navigation', 
     50    'content' => $help 
    4951) ); 
    5052 
    51 $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>'; 
    52 $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>'; 
    53 $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>'; 
    54 $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>'; 
     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>'; 
    5557 
    5658$current_screen->add_help_tab( array( 
    5759    'title'   => __('Layout'), 
    58     'content' => $help_layout, 
     60    'id' => 'layout', 
     61    'content' => $help 
    5962) ); 
    6063 
    61 $help_content  = '<p>' . __('The boxes on your Dashboard screen are:') . '</p>'; 
    62 $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>'; 
    63 $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>'; 
    64 $help_content .= '<p>' . __('<strong>Incoming Links</strong> - Shows links to your site found by Google Blog Search.') . '</p>'; 
    65 $help_content .= '<p>' . __('<strong>QuickPress</strong> - Allows you to create a new post and either publish it or save it as a draft.') . '</p>'; 
    66 $help_content .= '<p>' . __('<strong>Recent Drafts</strong> - Displays links to the 5 most recent draft posts you&#8217;ve started.') . '</p>'; 
    67 $help_content .= '<p>' . __('<strong>WordPress Blog</strong> - Latest news from the official WordPress project.') . '</p>'; 
    68 $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>'; 
    69 $help_content .= '<p>' . __('<strong>Plugins</strong> - Features the most popular, newest, and recently updated plugins from the WordPress.org Plugin Directory.') . '</p>'; 
     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>'; 
    7073 
    7174$current_screen->add_help_tab( array( 
    7275    'title'   => __('Content'), 
    73     'content' => $help_content, 
     76    'id' => 'content', 
     77    'content' => $help 
    7478) ); 
    7579 
    76 $current_screen->add_help_sidebar( 
    77     '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . 
    78     '<p>' . __( '<a href="http://codex.wordpress.org/Dashboard_Screen" target="_blank">Documentation on Dashboard</a>' ) . '</p>' . 
    79     '<p>' . __( '<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>' 
    80 ); 
     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'); 
    8185 
    8286 
  • trunk/wp-admin/link-manager.php

    r18864 r18867  
    4141$this_file = $parent_file = 'link-manager.php'; 
    4242 
    43 $current_screen->add_screen_options(  
     43$current_screen->add_option_context(  
    4444'<p>test</p>' 
    4545); 
  • trunk/wp-admin/nav-menus.php

    r18864 r18867  
    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_screen_options(  
     448$current_screen->add_option_context(  
    449449'<p>test</p>' 
    450450); 
  • trunk/wp-admin/network/index.php

    r18864 r18867  
    3939add_thickbox(); 
    4040 
    41 add_screen_option('layout_columns', array('max' => 4, 'default' => 'auto') ); 
     41$current_screen->add_option('layout_columns', array('max' => 4, 'default' => 'auto') ); 
    4242 
    43 $current_screen->add_screen_options(  
     43$current_screen->add_option_context(  
    4444'<p>test</p>' 
    4545); 
  • trunk/wp-admin/network/site-themes.php

    r18864 r18867  
    123123 
    124124add_thickbox(); 
    125 add_screen_option( 'per_page', array( 'label' => _x( 'Themes', 'themes per page (screen options)' ) ) ); 
     125$current_screen->add_option( 'per_page', array( 'label' => _x( 'Themes', 'themes per page (screen options)' ) ) ); 
    126126 
    127 $current_screen->add_screen_options(  
     127$current_screen->add_option_context(  
    128128'<p>test</p>' 
    129129); 
  • trunk/wp-admin/network/site-users.php

    r18864 r18867  
    154154} 
    155155 
    156 add_screen_option( 'per_page', array( 'label' => _x( 'Users', 'users per page (screen options)' ) ) ); 
    157  
    158 $current_screen->add_screen_options(  
     156$current_screen->add_option( 'per_page', array( 'label' => _x( 'Users', 'users per page (screen options)' ) ) ); 
     157 
     158$current_screen->add_option_context(  
    159159'<p>test</p>' 
    160160); 
  • trunk/wp-admin/network/sites.php

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

    r18864 r18867  
    174174add_thickbox(); 
    175175 
    176 add_screen_option( 'per_page', array('label' => _x( 'Themes', 'themes per page (screen options)' )) ); 
    177  
    178 $current_screen->add_screen_options(  
     176$current_screen->add_option( 'per_page', array('label' => _x( 'Themes', 'themes per page (screen options)' )) ); 
     177 
     178$current_screen->add_option_context(  
    179179'<p>test</p>' 
    180180); 
  • trunk/wp-admin/network/users.php

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

    r18864 r18867  
    3636do_action('install_plugins_pre_' . $tab); //Used to override the general interface, Eg, install or plugin information. 
    3737 
    38 $current_screen->add_screen_options(  
     38$current_screen->add_option_context(  
    3939'<p>test</p>' 
    4040); 
  • trunk/wp-admin/plugins.php

    r18864 r18867  
    317317add_thickbox(); 
    318318 
    319 add_screen_option( 'per_page', array('label' => _x( 'Plugins', 'plugins per page (screen options)' )) ); 
    320  
    321 $current_screen->add_screen_options(  
     319$current_screen->add_option( 'per_page', array('label' => _x( 'Plugins', 'plugins per page (screen options)' )) ); 
     320 
     321$current_screen->add_option_context(  
    322322'<p>test</p>' 
    323323); 
  • trunk/wp-admin/upload.php

    r18864 r18867  
    138138wp_enqueue_script( 'media' ); 
    139139 
    140 add_screen_option( 'per_page', array('label' => _x( 'Media items', 'items per page (screen options)' )) ); 
    141  
    142 $current_screen->add_screen_options(  
     140$current_screen->add_option( 'per_page', array('label' => _x( 'Media items', 'items per page (screen options)' )) ); 
     141 
     142$current_screen->add_option_context(  
    143143'<p>test</p>' 
    144144); 
  • trunk/wp-admin/users.php

    r18864 r18867  
    1818$parent_file = 'users.php'; 
    1919 
    20 add_screen_option( 'per_page', array('label' => _x( 'Users', 'users per page (screen options)' )) ); 
    21  
    22 $current_screen->add_screen_options(  
     20$current_screen->add_option( 'per_page', array('label' => _x( 'Users', 'users per page (screen options)' )) ); 
     21 
     22$current_screen->add_option_context(  
    2323'<p>test</p>' 
    2424); 
  • trunk/wp-admin/widgets.php

    r18864 r18867  
    3232$parent_file = 'themes.php'; 
    3333 
    34 $current_screen->add_screen_options(  
     34$current_screen->add_option_context(  
    3535'<p>test</p>' 
    3636); 
Note: See TracChangeset for help on using the changeset viewer.