WordPress.org

Make WordPress Core

Ticket #18690: 18690.3.patch.diff

File 18690.3.patch.diff, 20.0 KB (added by natebedortha, 4 years ago)

Includes CSS & JS, and @goldenapple's last patch (with one slight markup change)

  • wp-admin/includes/template.php

     
    18101810        <div id="contextual-help-wrap" class="hidden"> 
    18111811        <?php 
    18121812        $contextual_help = ''; 
    1813         if ( isset($_wp_contextual_help[$screen->id]) ) { 
     1813        if ( isset($_wp_contextual_help[$screen->id]) && is_array($_wp_contextual_help[$screen->id]) ) { 
     1814                $contextual_help .= '<div class="metabox-prefs">' . "\n"; 
     1815                 
     1816                /* 
     1817                 * Loop through ['contextual-help-tabs'] 
     1818                 *   - It's a nested array where $key=>$value >> $title=>$content 
     1819                 * Has no output so can only loop the array once 
     1820                 */ 
     1821                $contextual_help_tabs = ''; // store looped content for later 
     1822                $contextual_help_panels = ''; // store looped content for later 
     1823 
     1824                $contextual_help_tabs_array = apply_filters( 'contextual_help_tabs', $_wp_contextual_help[$screen->id]['contextual-help-tabs']); 
     1825                $contextual_help_tabs_array = apply_filters( "contextual_help_tabs-{$screen->id}", $contextual_help_tabs_array); 
     1826                $contextual_help_links = apply_filters( 'contextual_help_links', $_wp_contextual_help[$screen->id]['contextual-help-links']); 
     1827                $contextual_help_links = apply_filters( "contextual-help-links-{$screen->id}", $contextual_help_links); 
     1828 
     1829                $tab_active = true; 
     1830 
     1831                foreach( $contextual_help_tabs_array as $tab_title => $tab_content ) { 
     1832                        $tabname_slug = sanitize_title($tab_title, '', 'save'); 
     1833                         
     1834                        $contextual_help_tabs .= '<li class="tab-' . $tabname_slug . ( ($tab_active) ? ' active' : '' ) . '">'; 
     1835                        $contextual_help_tabs .= '<a href="#' . $tabname_slug . '">' . $tab_title . '</a>'; 
     1836                        $contextual_help_tabs .= '</li>' ."\n"; 
     1837                         
     1838                        $contextual_help_panels .= '<div id="' . $tabname_slug . '" class="help-tab-content' . ( ($tab_active) ? ' active' : '' ) . '">'; 
     1839                        $contextual_help_panels .= $tab_content; 
     1840                        $contextual_help_panels .= "</div>\n"; 
     1841 
     1842                        $tab_active = false; 
     1843                } 
     1844 
     1845                 
     1846                // Start output from loop: Tabbed help content 
     1847                $contextual_help .= '<ul class="contextual-help-tabs">' . "\n"; 
     1848                $contextual_help .= $contextual_help_tabs; 
     1849                $contextual_help .= '</ul>' ."\n"; 
     1850                $contextual_help .= '<div class="contextual-help-tabs-wrap">' . "\n"; 
     1851                $contextual_help .= $contextual_help_panels; 
     1852                $contextual_help .= "</div>\n"; 
     1853                // END: Tabbed help content 
     1854                 
     1855                // Links to right of tabs 
     1856                $contextual_help .= '<div class="contextual-help-links">' . "\n"; 
     1857                $contextual_help .= $contextual_help_links; 
     1858                $contextual_help .= "</div>\n"; 
     1859                 
     1860                $contextual_help .= "</div>\n"; // end metabox 
     1861                 
     1862        } elseif ( isset($_wp_contextual_help[$screen->id]) ) { 
    18141863                $contextual_help .= '<div class="metabox-prefs">' . $_wp_contextual_help[$screen->id] . "</div>\n"; 
    18151864        } else { 
    18161865                $contextual_help .= '<div class="metabox-prefs">'; 
    1817                 $default_help = __('<a href="http://codex.wordpress.org/" target="_blank">Documentation</a>'); 
     1866                $default_help  = __('<a href="http://codex.wordpress.org/" target="_blank">Documentation</a>'); 
    18181867                $default_help .= '<br />'; 
    18191868                $default_help .= __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>'); 
    18201869                $contextual_help .= apply_filters('default_contextual_help', $default_help); 
    1821                 $contextual_help .= "</div>\n"; 
     1870                $contextual_help .= '</div>' . "\n"; 
    18221871        } 
    18231872 
    18241873        echo apply_filters('contextual_help', $contextual_help, $screen->id, $screen); 
     
    18311880/** 
    18321881 * Add contextual help text for a page 
    18331882 * 
     1883 * The array $help takes the following format: 
     1884 *      array( 'contextual-help-tabs'   => array( $tab1_title => $tab1_value [, $tab2_title => $tab2_value, ...] ), 
     1885 *              'contextual-help-links' => $help_links_as_string ) 
     1886 * 
     1887 * For backwards compatability, a string is also accepted. 
     1888 * 
    18341889 * @since 2.7.0 
    18351890 * 
    1836  * @param string $screen The handle for the screen to add help to.  This is usually the hook name returned by the add_*_page() functions. 
    1837  * @param string $help Arbitrary help text 
     1891 * @param string        $screen The handle for the screen to add help to.  This is usually the hook name returned by the add_*_page() functions. 
     1892 * @param array|string  $help   Creates tabs & links columns within help text in array. 
     1893 * 
    18381894 */ 
    18391895function add_contextual_help($screen, $help) { 
    18401896        global $_wp_contextual_help; 
     
    22672323//]]> 
    22682324</script> 
    22692325<?php 
    2270 } 
    2271  No newline at end of file 
     2326} 
  • wp-admin/js/common.dev.js

     
    238238        } 
    239239}; 
    240240 
     241// help tabs 
     242$('.contextual-help-tabs').delegate('a', 'click focus', function(e) { 
     243  var newTab; 
    241244 
     245  e.preventDefault(); 
     246 
     247  // don't do anything if the click is for the tab already showing. 
     248  if ( $(this).is('.active a') ) 
     249    return false; 
     250   
     251  // tab triggers 
     252  $('.contextual-help-tabs .active').removeClass('active'); 
     253  $(this).parent('li').addClass('active'); 
     254 
     255  newTab = $( $(this).attr('href') );   
     256 
     257  //tabs 
     258  $('.help-tab-content').not( newTab ).removeClass('active').hide(); 
     259  newTab.addClass('active').show(); 
     260   
     261}); 
     262 
     263// click the first contextual help tab (should happen when this screenMeta is opened) 
     264$('.contextual-help-tabs a:first').click(); 
     265 
    242266$(document).ready( function() { 
    243267        var lastClicked = false, checks, first, last, checked, dropdown, 
    244268                pageInput = $('input.current-page'), currentPage = pageInput.val(); 
  • wp-admin/edit-form-advanced.php

     
    163163add_screen_option('layout_columns', array('max' => 2) ); 
    164164 
    165165if ( 'post' == $post_type ) { 
    166         add_contextual_help($current_screen, 
    167         '<p>' . __('The title field and the big Post Editing Area are fixed in place, but you can reposition all the other boxes using drag and drop, and can minimize or expand them by clicking the title bar of each box. Use the Screen Options tab to unhide more boxes (Excerpt, Send Trackbacks, Custom Fields, Discussion, Slug, Author) or to choose a 1- or 2-column layout for this screen.') . '</p>' . 
    168         '<p>' . __('<strong>Title</strong> - Enter a title for your post. After you enter a title, you&#8217;ll see the permalink below, which you can edit.') . '</p>' . 
    169         '<p>' . __('<strong>Post editor</strong> - Enter the text for your post. There are two modes of editing: Visual and HTML. Choose the mode by clicking on the appropriate tab. Visual mode gives you a WYSIWYG editor. Click the last icon in the row to get a second row of controls. The HTML mode allows you to enter raw HTML along with your post text. You can insert media files by clicking the icons above the post editor and following the directions. You can go the distraction-free writing screen, new in 3.2, via the Fullscreen icon in Visual mode (second to last in the top row) or the Fullscreen button in HTML mode (last in the row). Once there, you can make buttons visible by hovering over the top area. Exit Fullscreen back to the regular post editor.') . '</p>' . 
    170         '<p>' . __('<strong>Publish</strong> - You can set the terms of publishing your post in the Publish box. For Status, Visibility, and Publish (immediately), click on the Edit link to reveal more options. Visibility includes options for password-protecting a post or making it stay at the top of your blog indefinitely (sticky). Publish (immediately) allows you to set a future or past date and time, so you can schedule a post to be published in the future or backdate a post.') . '</p>' . 
    171         ( ( current_theme_supports( 'post-formats' ) && post_type_supports( 'post', 'post-formats' ) ) ? '<p>' . __( '<strong>Post Format</strong> - This designates how your theme will display a specific post. For example, you could have a <em>standard</em> blog post with a title and paragraphs, or a short <em>aside</em> that omits the title and contains a short text blurb. Please refer to the Codex for <a href="http://codex.wordpress.org/Post_Formats#Supported_Formats">descriptions of each post format</a>. Your theme could enable all or some of 10 possible formats.' ) . '</p>' : '' ) . 
    172         '<p>' . __('<strong>Featured Image</strong> - This allows you to associate an image with your post without inserting it. This is usually useful only if your theme makes use of the featured image as a post thumbnail on the home page, a custom header, etc.') . '</p>' . 
    173         '<p>' . __('<strong>Send Trackbacks</strong> - Trackbacks are a way to notify legacy blog systems that you&#8217;ve linked to them. Enter the URL(s) you want to send trackbacks. If you link to other WordPress sites they&#8217;ll be notified automatically using pingbacks, and this field is unnecessary.') . '</p>' . 
    174         '<p>' . __('<strong>Discussion</strong> - You can turn comments and pings on or off, and if there are comments on the post, you can see them here and moderate them.') . '</p>' . 
    175         '<p>' . sprintf(__('You can also create posts with the <a href="%s">Press This bookmarklet</a>.'), 'options-writing.php') . '</p>' . 
    176         '<p><strong>' . __('For more information:') . '</strong></p>' . 
    177         '<p>' . __('<a href="http://codex.wordpress.org/Posts_Add_New_Screen" target="_blank">Documentation on Writing and Editing Posts</a>') . '</p>' . 
    178         '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' 
    179         ); 
     166        add_contextual_help($current_screen, array( 
     167                'contextual-help-tabs' => array( 
     168                        __('Customizing this display') => 
     169                                '<p>' . __('The title field and the big Post Editing Area are fixed in place, but you can reposition all the other boxes using drag and drop, and can minimize or expand them by clicking the title bar of each box. Use the Screen Options tab to unhide more boxes (Excerpt, Send Trackbacks, Custom Fields, Discussion, Slug, Author) or to choose a 1- or 2-column layout for this screen.') . '</p>', 
     170                        __('Title and post editor') => 
     171                                '<p>' . __('<strong>Title</strong> - Enter a title for your post. After you enter a title, you&#8217;ll see the permalink below, which you can edit.') . '</p>' . 
     172                                '<p>' . __('<strong>Post editor</strong> - Enter the text for your post. There are two modes of editing: Visual and HTML. Choose the mode by clicking on the appropriate tab. Visual mode gives you a WYSIWYG editor. Click the last icon in the row to get a second row of controls. The HTML mode allows you to enter raw HTML along with your post text. You can insert media files by clicking the icons above the post editor and following the directions. You can go the distraction-free writing screen, new in 3.2, via the Fullscreen icon in Visual mode (second to last in the top row) or the Fullscreen button in HTML mode (last in the row). Once there, you can make buttons visible by hovering over the top area. Exit Fullscreen back to the regular post editor.') . '</p>', 
     173                        __('Publish box') => 
     174                                '<p>' . __('<strong>Publish</strong> - You can set the terms of publishing your post in the Publish box. For Status, Visibility, and Publish (immediately), click on the Edit link to reveal more options. Visibility includes options for password-protecting a post or making it stay at the top of your blog indefinitely (sticky). Publish (immediately) allows you to set a future or past date and time, so you can schedule a post to be published in the future or backdate a post.') . '</p>' . 
     175                                ( ( current_theme_supports( 'post-formats' ) && post_type_supports( 'post', 'post-formats' ) ) ? '<p>' . __( '<strong>Post Format</strong> - This designates how your theme will display a specific post. For example, you could have a <em>standard</em> blog post with a title and paragraphs, or a short <em>aside</em> that omits the title and contains a short text blurb. Please refer to the Codex for <a href="http://codex.wordpress.org/Post_Formats#Supported_Formats">descriptions of each post format</a>. Your theme could enable all or some of 10 possible formats.' ) . '</p>' : '' ) . 
     176                                ( ( current_theme_supports( 'post-thumbnails' ) && post_type_supports( 'post', 'thumbnail' ) ) ? '<p>' . __('<strong>Featured Image</strong> - This allows you to associate an image with your post without inserting it. This is usually useful only if your theme makes use of the featured image as a post thumbnail on the home page, a custom header, etc.') . '</p>' : '' ), 
     177                        __('Discussion Settings') => 
     178                                '<p>' . __('<strong>Send Trackbacks</strong> - Trackbacks are a way to notify legacy blog systems that you&#8217;ve linked to them. Enter the URL(s) you want to send trackbacks. If you link to other WordPress sites they&#8217;ll be notified automatically using pingbacks, and this field is unnecessary.') . '</p>' . 
     179                                '<p>' . __('<strong>Discussion</strong> - You can turn comments and pings on or off, and if there are comments on the post, you can see them here and moderate them.') . '</p>' 
     180                ), 'contextual-help-links' =>  
     181                        '<p>' . sprintf(__('You can also create posts with the <a href="%s">Press This bookmarklet</a>.'), 'options-writing.php') . '</p>' . 
     182                        '<p><strong>' . __('For more information:') . '</strong></p>' . 
     183                        '<p>' . __('<a href="http://codex.wordpress.org/Posts_Add_New_Screen" target="_blank">Documentation on Writing and Editing Posts</a>') . '</p>' . 
     184                        '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' 
     185        ) ); 
    180186} elseif ( 'page' == $post_type ) { 
    181         add_contextual_help($current_screen, '<p>' . __('Pages are similar to Posts in that they have a title, body text, and associated metadata, but they are different in that they are not part of the chronological blog stream, kind of like permanent posts. Pages are not categorized or tagged, but can have a hierarchy. You can nest Pages under other Pages by making one the &#8220;Parent&#8221; of the other, creating a group of Pages.') . '</p>' . 
    182         '<p>' . __('Creating a Page is very similar to creating a Post, and the screens can be customized in the same way using drag and drop, the Screen Options tab, and expanding/collapsing boxes as you choose. This screen also has the new in 3.2 distraction-free writing space, available in both the Visual and HTML modes via the Fullscreen buttons. The Page editor mostly works the same as the Post editor, but there are some Page-specific features in the Page Attributes box:') . '</p>' . 
    183         '<p>' . __('<strong>Parent</strong> - You can arrange your pages in hierarchies. For example, you could have an &#8220;About&#8221; page that has &#8220;Life Story&#8221; and &#8220;My Dog&#8221; pages under it. There are no limits to how many levels you can nest pages.') . '</p>' . 
    184         '<p>' . __('<strong>Template</strong> - Some themes have custom templates you can use for certain pages that might have additional features or custom layouts. If so, you&#8217;ll see them in this dropdown menu.') . '</p>' . 
    185         '<p>' . __('<strong>Order</strong> - Pages are usually ordered alphabetically, but you can choose your own order by entering a number (1 for first, etc.) in this field.') . '</p>' . 
    186         '<p><strong>' . __('For more information:') . '</strong></p>' . 
    187         '<p>' . __('<a href="http://codex.wordpress.org/Pages_Add_New_Screen" target="_blank">Documentation on Adding New Pages</a>') . '</p>' . 
    188         '<p>' . __('<a href="http://codex.wordpress.org/Pages_Screen#Editing_Individual_Pages" target="_blank">Documentation on Editing Pages</a>') . '</p>' . 
    189         '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' 
    190         ); 
     187        add_contextual_help($current_screen, array( 
     188                'contextual-help-tabs' => array( 
     189                        __('About Pages') =>  
     190                                '<p>' . __('Pages are similar to Posts in that they have a title, body text, and associated metadata, but they are different in that they are not part of the chronological blog stream, kind of like permanent posts. Pages are not categorized or tagged, but can have a hierarchy. You can nest Pages under other Pages by making one the &#8220;Parent&#8221; of the other, creating a group of Pages.') . '</p>' .  
     191                                '<p>' . __('Creating a Page is very similar to creating a Post, and the screens can be customized in the same way using drag and drop, the Screen Options tab, and expanding/collapsing boxes as you choose. This screen also has the new in 3.2 distraction-free writing space, available in both the Visual and HTML modes via the Fullscreen buttons. The Page editor mostly works the same as the Post editor, but there are some Page-specific features in the Page Attributes box:') . '</p>', 
     192                        __('Page Attributes') => 
     193                                '<p>' . __('<strong>Parent</strong> - You can arrange your pages in hierarchies. For example, you could have an &#8220;About&#8221; page that has &#8220;Life Story&#8221; and &#8220;My Dog&#8221; pages under it. There are no limits to how many levels you can nest pages.') . '</p>' . 
     194                                '<p>' . __('<strong>Template</strong> - Some themes have custom templates you can use for certain pages that might have additional features or custom layouts. If so, you&#8217;ll see them in this dropdown menu.') . '</p>' . 
     195                                '<p>' . __('<strong>Order</strong> - Pages are usually ordered alphabetically, but you can choose your own order by entering a number (1 for first, etc.) in this field.') . '</p>' 
     196                ), 'contextual-help-links' =>  
     197                        '<p><strong>' . __('For more information:') . '</strong></p>' . 
     198                        '<p>' . __('<a href="http://codex.wordpress.org/Pages_Add_New_Screen" target="_blank">Documentation on Adding New Pages</a>') . '</p>' . 
     199                        '<p>' . __('<a href="http://codex.wordpress.org/Pages_Screen#Editing_Individual_Pages" target="_blank">Documentation on Editing Pages</a>') . '</p>' . 
     200                        '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' 
     201        )); 
    191202} 
    192203 
    193204require_once('./admin-header.php'); 
  • wp-admin/css/wp-admin.dev.css

     
    1515 6.0 - Admin Header 
    1616        6.1 - Favorites Menu 
    1717        6.2 - Screen Options Tabs 
     18        6.3 - Help Menu 
    1819 7.0 - Main Navigation 
    1920 8.0 - Layout Blocks 
    2021 9.0 - Dashboard 
     
    16081609        visibility: hidden; 
    16091610} 
    16101611 
    1611 #contextual-help-wrap li { 
    1612         list-style-type: disc; 
    1613         margin-left: 18px; 
    1614 } 
    16151612.toggle-arrow { 
    16161613        background-repeat: no-repeat; 
    16171614        background-position: top left; 
     
    16451642        display: none; 
    16461643} 
    16471644 
     1645/*------------------------------------------------------------------------------ 
     1646  6.3 - Help Menu 
     1647------------------------------------------------------------------------------*/ 
    16481648 
     1649#contextual-help-wrap { 
     1650  position: relative; 
     1651  padding: 0; 
     1652  overflow: hidden; 
     1653} 
     1654 
     1655#contextual-help-wrap > .metabox-prefs { 
     1656  padding: 8px 20px 12px; 
     1657  max-height: 200px; 
     1658  overflow: auto; 
     1659} 
     1660 
     1661.contextual-help-tabs { 
     1662  position: absolute; 
     1663  top: 0; 
     1664  left: 0; 
     1665  bottom: 0; 
     1666  width: 150px; 
     1667  max-height: 220px; 
     1668  margin: 0; 
     1669  overflow: auto; 
     1670   
     1671  border-right: 1px solid #dfdfdf; 
     1672} 
     1673 
     1674.contextual-help-tabs li { 
     1675  margin-bottom: 0; 
     1676 
     1677  list-style-type: none; 
     1678} 
     1679 
     1680.contextual-help-tabs a { 
     1681  display: block; 
     1682  padding: 5px 5px 5px 12px; 
     1683   
     1684  font-weight: bold; 
     1685  line-height: 18px; 
     1686  text-decoration: none; 
     1687   
     1688  border-width: 1px 0; 
     1689  border-style: solid; 
     1690  border-top-color: #f9f9f9; 
     1691  border-bottom-color: #dfdfdf; 
     1692} 
     1693 
     1694.contextual-help-tabs a:hover { 
     1695  background-color: #EAF2FA; 
     1696  color: #333; 
     1697} 
     1698 
     1699.contextual-help-tabs .active a, 
     1700.contextual-help-tabs .active a:hover { 
     1701  background: #ffffff; 
     1702  color: #000000; 
     1703} 
     1704 
     1705.contextual-help-tabs-wrap { 
     1706  position: relative; 
     1707  display: block; 
     1708  margin: 0 152px 0 150px; 
     1709  height: 188px; 
     1710  overflow: auto; 
     1711} 
     1712 
     1713.help-tab-content { 
     1714  display: none; 
     1715  margin: 0 22px 12px 0; 
     1716  padding-right: 20px; 
     1717} 
     1718 
     1719.help-tab-content.active { 
     1720  display: block; 
     1721} 
     1722 
     1723.help-tab-content li { 
     1724        list-style-type: disc; 
     1725        margin-left: 18px; 
     1726} 
     1727 
     1728.contextual-help-links { 
     1729  position: absolute; 
     1730  width: 150px; 
     1731  top: 0; 
     1732  right: 0; 
     1733  bottom: 0; 
     1734  padding: 0 8px 0 12px; 
     1735  overflow: auto; 
     1736   
     1737  background-color: #ffffff; 
     1738   
     1739  border-left: 1px solid #dfdfdf; 
     1740} 
     1741 
     1742 
    16491743/*------------------------------------------------------------------------------ 
    16501744  7.0 - Main Navigation (Left Menu) 
    16511745------------------------------------------------------------------------------*/