Ticket #9657: ticket.9657.diff
| File ticket.9657.diff, 15.1 KB (added by ptahdunbar, 2 years ago) |
|---|
-
wp-admin/includes/template.php
1672 1672 return $screen; 1673 1673 } 1674 1674 1675 function screen_meta($screen) { 1676 global $wp_meta_boxes, $_wp_contextual_help, $wp_list_table, $wp_current_screen_options; 1675 /** 1676 * Displays the screen meta for the current page. 1677 * 1678 * @uses do_screen_meta() 1679 * 1680 * @param string $screen The name of the screen 1681 */ 1682 function screen_meta( $screen ) { 1683 ?> 1684 <div id="screen-meta"> 1685 <?php do_screen_meta( $screen->id ); ?> 1686 </div><!-- #screen-meta --> 1687 <?php 1688 } 1677 1689 1678 if ( is_string($screen) ) 1679 $screen = convert_to_screen($screen); 1690 /** 1691 * Adds a new screen meta tab. 1692 * 1693 * @since 3.2.0 1694 * 1695 * @param string $id Identifier. 1696 * @param string $label Label used for the tab's display name. 1697 * @param string $capability capability required to view this tab 1698 * @param int $priority which one first. 1699 * @param string $screens Which page to add the tab to. 1700 */ 1701 function add_screen_meta_tab( $id, $label, $capability, $screen, $priority = 10 ) { 1702 global $wp_screen_meta; 1680 1703 1704 if ( !isset($wp_screen_meta) ) 1705 $wp_screen_meta = array(); 1706 if ( !isset( $wp_screen_meta[$screen] ) ) 1707 $wp_screen_meta[$screen] = array(); 1708 1709 if ( !$label ) 1710 $label = $id; 1711 1712 $args = array( 1713 'id' => $id, 1714 'label' => $label, 1715 'capability' => $capability, 1716 ); 1717 1718 $wp_screen_meta[$screen][$priority][$id] = $args; 1719 } 1720 1721 /** 1722 * Adds a new section to a screen tab. 1723 * 1724 * @since 3.2.0 1725 * 1726 * @param string $id Identifier for the content. 1727 * @param string $callback Callback function used to output the content. 1728 * @param string $tab A string or array of tabs to add the content to. 1729 * @param string $priority Priority to display this content. 1730 * @param string $callback_args Optional. Additional arguments to pass to the callback. 1731 */ 1732 function add_screen_meta_section( $id, $callback, $tab, $priority = 10, $callback_args = null ) { 1733 global $wp_screen_meta_data; 1734 1735 if ( !isset($wp_screen_meta_data) ) 1736 $wp_screen_meta_data = array(); 1737 1738 $args = array( 1739 'id' => $id, 1740 'callback' => $callback, 1741 'tab' => $tab, 1742 'priority' => $priority, 1743 'callback_args' => $callback_args, 1744 ); 1745 1746 $wp_screen_meta_data[$tab][$priority][$id] = $args; 1747 } 1748 1749 /** 1750 * Displays the screen meta tabs and their content based on the current screen. 1751 * 1752 * @since 3.2.0 1753 * 1754 * @param string $screen Identifier of the screen. 1755 */ 1756 function do_screen_meta( $screen ) { 1757 global $wp_screen_meta, $wp_screen_meta_data; 1758 1759 add_screen_meta_tab( 'screen-options', __( 'Screen Options' ), 'read', 'global' ); 1760 add_screen_meta_tab( 'contextual-help', __( 'Help' ), 'read', 'global', 1 ); 1761 1762 add_screen_meta_section( 'contextual-help', 'wp_screen_meta_contextual_help', 'contextual-help' ); 1763 add_screen_meta_section( 'screen-settings', 'wp_screen_meta_screen_settings', 'screen-options' ); 1764 1765 do_action( 'screen_meta', $screen ); 1766 do_action( 'screen_meta_' . $screen ); 1767 1768 // Get the registered tabs from the global and $screen scope. 1769 $tabs = !empty( $wp_screen_meta['global'] ) ? $wp_screen_meta['global'] : array(); 1770 $tabs = !empty( $wp_screen_meta[$screen] ) ? $wp_screen_meta[$screen] + $tabs : $tabs; 1771 1772 // Bail if no tabs are registered 1773 if ( empty( $tabs ) ) 1774 return; 1775 1776 // Sort tabs by priority 1777 ksort( $tabs ); 1778 1779 $screen_meta = array(); 1780 foreach ( $tabs as $priority => $tab ) { 1781 foreach ( $tab as $tab_id => $tab_info ) { 1782 1783 // Check for permissions 1784 if ( !current_user_can( $tab_info['capability'] ) ) 1785 continue; 1786 1787 // Check to see if the tab has any data 1788 if ( empty( $wp_screen_meta_data[ $tab_id ] ) ) 1789 continue; 1790 1791 // Store all the tab data in $screen_meta 1792 $screen_meta[$priority] = $tab; 1793 1794 // Sort the content by priority 1795 if ( isset( $wp_screen_meta_data[$tab_id] ) ) 1796 ksort( $wp_screen_meta_data[$tab_id] ); 1797 } 1798 } 1799 ?> 1800 <div id="screen-meta" class="screen-meta"> 1801 <?php 1802 foreach ( $screen_meta as $priority => $tabs ) { 1803 foreach ( $tabs as $tab_id => $tab ) { 1804 ?> 1805 <div id="<?php echo esc_attr( $tab_id ); ?>-wrap" class="hidden screen-meta-tab-wrap"> 1806 <?php 1807 foreach ( $wp_screen_meta_data[$tab_id] as $priority => $_tab_data ) { 1808 foreach ( $_tab_data as $tab_data_id => $tab_data ) { 1809 call_user_func( $tab_data['callback'], $screen, $tab_data['callback_args'] ); 1810 } 1811 } 1812 ?> 1813 </div><!-- .screen-meta-tab-wrap --> 1814 <?php 1815 } 1816 } 1817 ?> 1818 <div id="screen-meta-links"> 1819 <?php 1820 foreach ( $screen_meta as $priority => $tab ) { 1821 foreach ($tab as $tab_id => $tab_info ) { 1822 ?> 1823 <div id="<?php echo esc_attr( $tab_id ); ?>-link-wrap" class="hide-if-no-js screen-meta-toggle"> 1824 <a href="#<?php echo esc_attr( $tab_id ); ?>-wrap" id="<?php echo esc_attr( $tab_id ); ?>-link" class="show-settings"><?php echo esc_html( $tab_info['label'] ); ?></a> 1825 </div><!-- .screen-meta-toggle --> 1826 <?php 1827 } 1828 } 1829 ?> 1830 </div><!-- #screen-meta-links --> 1831 </div><!-- #screen-meta --> 1832 <?php 1833 } 1834 1835 /** 1836 * Outputs various screen settings for the current page. 1837 * 1838 * @since 3.2.0 1839 * 1840 * @param string $screen The current page's screen. 1841 */ 1842 function wp_screen_meta_screen_settings( $screen ) { 1843 global $wp_meta_boxes, $wp_current_screen_options; 1844 1845 $screen = convert_to_screen( $screen ); 1681 1846 $columns = get_column_headers( $screen ); 1682 1847 $hidden = get_hidden_columns( $screen ); 1683 1848 1684 $meta_screens = array( 'index' => 'dashboard');1849 $meta_screens = array( 'index' => 'dashboard' ); 1685 1850 1686 1851 if ( isset($meta_screens[$screen->id]) ) { 1687 1852 $screen->id = $meta_screens[$screen->id]; … … 1692 1857 if ( !empty($wp_meta_boxes[$screen->id]) || !empty($columns) ) 1693 1858 $show_screen = true; 1694 1859 1695 $screen_options = screen_options( $screen);1860 $screen_options = screen_options( $screen ); 1696 1861 if ( $screen_options ) 1697 1862 $show_screen = true; 1698 1863 1699 if ( !isset($_wp_contextual_help) ) 1700 $_wp_contextual_help = array(); 1864 $settings = apply_filters( 'screen_settings', '', $screen ); 1701 1865 1702 $settings = apply_filters('screen_settings', '', $screen);1703 1704 1866 switch ( $screen->id ) { 1705 1867 case 'widgets': 1706 1868 $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"; 1707 1869 $show_screen = true; 1708 1870 break; 1709 1871 } 1872 1710 1873 if ( ! empty( $settings ) ) 1711 1874 $show_screen = true; 1712 1875 1713 1876 if ( !empty($wp_current_screen_options) ) 1714 1877 $show_screen = true; 1878 ?> 1879 <form id="adv-settings" action="" method="post"> 1880 <?php if ( isset($wp_meta_boxes[$screen->id]) ) : ?> 1881 <h5><?php _ex( 'Show on screen', 'Metaboxes' ); ?></h5> 1882 <div class="metabox-prefs"> 1883 <?php meta_box_prefs( $screen ); ?> 1884 <br class="clear" /> 1885 </div> 1886 <?php endif; 1887 if ( ! empty($columns) ) : ?> 1888 <h5><?php echo ( isset( $columns['_title'] ) ? $columns['_title'] : _x('Show on screen', 'Columns') ) ?></h5> 1889 <div class="metabox-prefs"> 1890 <?php 1891 $special = array('_title', 'cb', 'comment', 'media', 'name', 'title', 'username', 'blogname'); 1715 1892 1716 ?> 1717 <div id="screen-meta"> 1718 <?php if ( $show_screen ) : ?> 1719 <div id="screen-options-wrap" class="hidden"> 1720 <form id="adv-settings" action="" method="post"> 1721 <?php if ( isset($wp_meta_boxes[$screen->id]) ) : ?> 1722 <h5><?php _ex('Show on screen', 'Metaboxes') ?></h5> 1723 <div class="metabox-prefs"> 1724 <?php meta_box_prefs($screen); ?> 1725 <br class="clear" /> 1726 </div> 1893 foreach ( $columns as $column => $title ) { 1894 // Can't hide these for they are special 1895 if ( in_array( $column, $special ) ) 1896 continue; 1897 if ( empty( $title ) ) 1898 continue; 1899 1900 if ( 'comments' == $column ) 1901 $title = __( 'Comments' ); 1902 $id = "$column-hide"; 1903 echo '<label for="' . $id . '">'; 1904 echo '<input class="hide-column-tog" name="' . $id . '" type="checkbox" id="' . $id . '" value="' . $column . '"' . checked( !in_array($column, $hidden), true, false ) . ' />'; 1905 echo "$title</label>\n"; 1906 } 1907 ?> 1908 <br class="clear" /> 1909 </div> 1727 1910 <?php endif; 1728 if ( ! empty($columns) ) : ?> 1729 <h5><?php echo ( isset( $columns['_title'] ) ? $columns['_title'] : _x('Show on screen', 'Columns') ) ?></h5> 1730 <div class="metabox-prefs"> 1731 <?php 1732 $special = array('_title', 'cb', 'comment', 'media', 'name', 'title', 'username', 'blogname'); 1911 echo screen_layout( $screen ); 1733 1912 1734 foreach ( $columns as $column => $title ) { 1735 // Can't hide these for they are special 1736 if ( in_array( $column, $special ) ) 1737 continue; 1738 if ( empty( $title ) ) 1739 continue; 1913 if ( !empty( $screen_options ) ) { 1914 ?> 1915 <h5><?php _ex('Show on screen', 'Screen Options') ?></h5> 1916 <?php 1917 } 1740 1918 1741 if ( 'comments' == $column ) 1742 $title = __( 'Comments' ); 1743 $id = "$column-hide"; 1744 echo '<label for="' . $id . '">'; 1745 echo '<input class="hide-column-tog" name="' . $id . '" type="checkbox" id="' . $id . '" value="' . $column . '"' . checked( !in_array($column, $hidden), true, false ) . ' />'; 1746 echo "$title</label>\n"; 1747 } 1748 ?> 1749 <br class="clear" /> 1750 </div> 1751 <?php endif; 1752 echo screen_layout($screen); 1919 echo $screen_options; 1920 echo $settings; ?> 1921 <div><?php wp_nonce_field( 'screen-options-nonce', 'screenoptionnonce', false ); ?></div> 1922 </form><!-- #adv-settings --> 1923 <?php 1924 } 1753 1925 1754 if ( !empty( $screen_options ) ) { 1755 ?> 1756 <h5><?php _ex('Show on screen', 'Screen Options') ?></h5> 1757 <?php 1758 } 1926 /** 1927 * Outputs the contextual help content. 1928 * 1929 * @since 3.2.0 1930 * 1931 * @param string $screen The current page's screen. 1932 */ 1933 function wp_screen_meta_contextual_help( $screen ) { 1934 global $_wp_contextual_help; 1759 1935 1760 echo $screen_options; 1761 echo $settings; ?> 1762 <div><?php wp_nonce_field( 'screen-options-nonce', 'screenoptionnonce', false ); ?></div> 1763 </form> 1764 </div> 1936 if ( !isset($_wp_contextual_help) ) 1937 $_wp_contextual_help = array(); 1765 1938 1766 <?php endif; // $show_screen 1939 $_wp_contextual_help = apply_filters( 'contextual_help_list', $_wp_contextual_help, $screen ); 1940 1941 $contextual_help = ''; 1767 1942 1768 $_wp_contextual_help = apply_filters('contextual_help_list', $_wp_contextual_help, $screen); 1769 ?> 1770 <div id="contextual-help-wrap" class="hidden"> 1771 <?php 1772 $contextual_help = ''; 1773 if ( isset($_wp_contextual_help[$screen->id]) ) { 1774 $contextual_help .= '<div class="metabox-prefs">' . $_wp_contextual_help[$screen->id] . "</div>\n"; 1943 if ( isset($_wp_contextual_help[$screen]) ) { 1944 $contextual_help .= '<div class="metabox-prefs">' . $_wp_contextual_help[$screen] . "</div>\n"; 1775 1945 } else { 1776 1946 $contextual_help .= '<div class="metabox-prefs">'; 1777 $default_help = __( '<a href="http://codex.wordpress.org/" target="_blank">Documentation</a>');1947 $default_help = __( '<a href="http://codex.wordpress.org/" target="_blank">Documentation</a>' ); 1778 1948 $default_help .= '<br />'; 1779 $default_help .= __( '<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>');1780 $contextual_help .= apply_filters( 'default_contextual_help', $default_help);1949 $default_help .= __( '<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>' ); 1950 $contextual_help .= apply_filters( 'default_contextual_help', $default_help ); 1781 1951 $contextual_help .= "</div>\n"; 1782 1952 } 1953 1954 // Backwards compat. 1955 $screen_object = convert_to_screen( $screen ); 1783 1956 1784 echo apply_filters('contextual_help', $contextual_help, $screen->id, $screen); 1785 ?> 1786 </div> 1787 1788 <div id="screen-meta-links"> 1789 <div id="contextual-help-link-wrap" class="hide-if-no-js screen-meta-toggle"> 1790 <a href="#contextual-help" id="contextual-help-link" class="show-settings"><?php _e('Help') ?></a> 1791 </div> 1792 <?php if ( $show_screen ) { ?> 1793 <div id="screen-options-link-wrap" class="hide-if-no-js screen-meta-toggle"> 1794 <a href="#screen-options" id="show-settings-link" class="show-settings"><?php _e('Screen Options') ?></a> 1795 </div> 1796 <?php } ?> 1797 </div> 1798 </div> 1799 <?php 1957 echo apply_filters( 'contextual_help', $contextual_help, $screen, $screen_object ); 1800 1958 } 1801 1959 1802 1960 /** -
wp-admin/js/common.dev.js
207 207 $('div.wrap h2:first').nextAll('div.updated, div.error').addClass('below-h2'); 208 208 $('div.updated, div.error').not('.below-h2, .inline').insertAfter( $('div.wrap h2:first') ); 209 209 210 // screen settings tab211 $(' #show-settings-link').click(function () {212 if ( ! $('#screen-options-wrap').hasClass('screen-options-open') )213 $('#contextual-help-link-wrap').css('visibility', 'hidden');210 // screen meta tabs 211 $('.screen-meta a.show-settings').click(function(e) { 212 var id = $(e.target).attr('href'); 213 id = id.substring( 0, id.length - 5 ); // remove the -wrap 214 214 215 $('#screen-options-wrap').slideToggle('fast', function(){ 216 if ( $(this).hasClass('screen-options-open') ) { 217 $('#show-settings-link').css({'backgroundPosition':'top '+bgx}); 218 $('#contextual-help-link-wrap').css('visibility', ''); 219 $(this).removeClass('screen-options-open'); 220 } else { 221 $('#show-settings-link').css({'backgroundPosition':'bottom '+bgx}); 222 $(this).addClass('screen-options-open'); 223 } 224 }); 225 return false; 226 }); 215 // Maybe hide all other tabs if we're closing. 216 if ( ! $(id + '-wrap' ).hasClass('screen-tab-open') ) 217 $('.screen-meta-toggle').not( id + '-link-wrap').css( 'visibility', 'hidden' ); 227 218 228 // help tab 229 $('#contextual-help-link').click(function () { 230 if ( ! $('#contextual-help-wrap').hasClass('contextual-help-open') ) 231 $('#screen-options-link-wrap').css('visibility', 'hidden'); 232 233 $('#contextual-help-wrap').slideToggle('fast', function() { 234 if ( $(this).hasClass('contextual-help-open') ) { 235 $('#contextual-help-link').css({'backgroundPosition':'top '+bgx}); 236 $('#screen-options-link-wrap').css('visibility', ''); 237 $(this).removeClass('contextual-help-open'); 219 // Open the clicked tab. 220 $(id + '-wrap').slideToggle('fast', function(e) { 221 // If a tab is open, close it and make the other tabs visible. 222 if ( $(this).hasClass( 'screen-tab-open' ) ) { 223 $(id + '-link').css( { 'backgroundPosition' : 'top ' + bgx } ); 224 $('.screen-meta-toggle').not( id +'-link-wrap' ).css( 'visibility', '' ); 225 $(this).removeClass( 'screen-tab-open' ); 226 // Open a tab. 238 227 } else { 239 $( '#contextual-help-link').css({'backgroundPosition':'bottom '+bgx});240 $(this).addClass( 'contextual-help-open');228 $(id + '-link').css( { 'backgroundPosition' : 'bottom ' + bgx } ); 229 $(this).addClass( 'screen-tab-open' ); 241 230 } 242 231 }); 243 232 return false; -
wp-admin/css/colors-classic.dev.css
1279 1279 color: #D54E21; 1280 1280 } 1281 1281 1282 .screen-meta-tab-wrap, 1282 1283 #screen-options-wrap, 1283 1284 #contextual-help-wrap { 1284 1285 background-color: #F8F7F3; -
wp-admin/css/wp-admin.dev.css
776 776 text-decoration: none; 777 777 } 778 778 779 .screen-meta-tab-wrap h5, 779 780 #screen-options-wrap h5, 780 781 #contextual-help-wrap h5 { 781 782 margin: 8px 0;
