Ticket #9657: ticket.9657.2.diff
File ticket.9657.2.diff, 16.2 KB (added by , 13 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 $screen Id of the screen to add tab to. 1698 * @param string $capability capability required to view this tab. Viewable by all by default. 1699 * @param int $priority which one first. 1700 * @param string $screens Which page to add the tab to. 1701 */ 1702 function add_screen_meta_tab( $id, $label, $screen, $capability = 'read', $priority = 10 ) { 1703 global $wp_screen_meta; 1680 1704 1705 if ( !isset($wp_screen_meta) ) 1706 $wp_screen_meta = array(); 1707 if ( !isset( $wp_screen_meta[$screen] ) ) 1708 $wp_screen_meta[$screen] = array(); 1709 1710 if ( !$label ) 1711 $label = $id; 1712 1713 $args = array( 1714 'id' => $id, 1715 'label' => $label, 1716 'capability' => $capability, 1717 'priority' => $priority, 1718 ); 1719 1720 $wp_screen_meta[$screen][$priority][$id] = $args; 1721 } 1722 1723 /** 1724 * Adds a new section to a screen tab. 1725 * 1726 * @since 3.2.0 1727 * 1728 * @param string $id Identifier for the content. 1729 * @param string $callback Callback function used to output the content. 1730 * @param string $tab A string or array of tabs to add the content to. 1731 * @param string $priority Priority to display this content. 1732 * @param string $callback_args Optional. Additional arguments to pass to the callback. 1733 */ 1734 function add_screen_meta_section( $id, $callback, $tab, $priority = 10, $callback_args = null ) { 1735 global $wp_screen_meta_data; 1736 1737 if ( !isset($wp_screen_meta_data) ) 1738 $wp_screen_meta_data = array(); 1739 1740 $args = array( 1741 'id' => $id, 1742 'callback' => $callback, 1743 'tab' => $tab, 1744 'priority' => $priority, 1745 'callback_args' => $callback_args, 1746 ); 1747 1748 $wp_screen_meta_data[$tab][$priority][$id] = $args; 1749 } 1750 1751 /** 1752 * Displays the screen meta tabs and their content based on the current screen. 1753 * 1754 * @since 3.2.0 1755 * 1756 * @param string $screen Identifier of the screen. 1757 */ 1758 function do_screen_meta( $screen ) { 1759 global $wp_screen_meta, $wp_screen_meta_data; 1760 1761 add_screen_meta_tab( 'screen-options', __( 'Screen Options' ), 'global', 'read' ); 1762 add_screen_meta_tab( 'contextual-help', __( 'Help' ), 'global', 'read', 1 ); 1763 1764 add_screen_meta_section( 'contextual-help', 'wp_screen_meta_contextual_help', 'contextual-help' ); 1765 add_screen_meta_section( 'screen-settings', 'wp_screen_meta_screen_settings', 'screen-options' ); 1766 1767 do_action( 'screen_meta', $screen ); 1768 do_action( 'screen_meta_' . $screen ); 1769 1770 // Get the registered tabs from the global and $screen scope. 1771 $the_tabs = !empty( $wp_screen_meta['global'] ) ? $wp_screen_meta['global'] : array(); 1772 1773 if ( !empty( $wp_screen_meta[$screen] ) ) { 1774 foreach ( $wp_screen_meta[$screen] as $priority => $tabs ) { 1775 1776 if ( isset($the_tabs[$priority]) ) 1777 $the_tabs[$priority] = array_merge( $the_tabs[$priority], $tabs ); 1778 else 1779 $the_tabs[$priority] = $tabs; 1780 } 1781 } 1782 1783 // Bail if no tabs are registered 1784 if ( empty( $the_tabs ) ) 1785 return; 1786 1787 // Sort tabs by priority 1788 ksort( $the_tabs ); 1789 1790 $screen_meta = array(); 1791 foreach ( $the_tabs as $priority => $tab ) { 1792 foreach ( $tab as $tab_id => $tab_info ) { 1793 1794 // Check for permissions 1795 if ( !current_user_can( $tab_info['capability'] ) ) 1796 continue; 1797 1798 // Check to see if the tab has any data 1799 // Uncomment the following lines to remove tabs that don't have any sections registered to it. 1800 // if ( empty( $wp_screen_meta_data[ $tab_id ] ) ) 1801 // continue; 1802 1803 // Store all the tab data in $screen_meta 1804 $screen_meta[$priority] = $tab; 1805 1806 // Sort the content by priority 1807 if ( isset( $wp_screen_meta_data[$tab_id] ) ) 1808 ksort( $wp_screen_meta_data[$tab_id] ); 1809 } 1810 } 1811 ?> 1812 <div id="screen-meta" class="screen-meta"> 1813 <?php 1814 foreach ( $screen_meta as $priority => $tabs ) { 1815 foreach ( $tabs as $tab_id => $tab ) { 1816 ?> 1817 <div id="<?php echo esc_attr( $tab_id ); ?>-wrap" class="hidden screen-meta-section"> 1818 <?php 1819 if ( isset( $wp_screen_meta_data[$tab_id] ) ) { 1820 foreach ( $wp_screen_meta_data[$tab_id] as $priority => $_tab_data ) { 1821 foreach ( $_tab_data as $tab_data_id => $tab_data ) { 1822 call_user_func( $tab_data['callback'], $screen, $tab_data['callback_args'] ); 1823 } 1824 } 1825 } 1826 ?> 1827 </div><!-- .screen-meta-section --> 1828 <?php 1829 } 1830 } 1831 ?> 1832 <div id="screen-meta-links"> 1833 <?php 1834 foreach ( $screen_meta as $priority => $tab ) { 1835 foreach ($tab as $tab_id => $tab_info ) { 1836 ?> 1837 <div id="<?php echo esc_attr( $tab_id ); ?>-link-wrap" class="hide-if-no-js screen-meta-toggle"> 1838 <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> 1839 </div><!-- .screen-meta-toggle --> 1840 <?php 1841 } 1842 } 1843 ?> 1844 </div><!-- #screen-meta-links --> 1845 </div><!-- #screen-meta --> 1846 <?php 1847 } 1848 1849 /** 1850 * Outputs various screen settings for the current page. 1851 * 1852 * @since 3.2.0 1853 * 1854 * @param string $screen The current page's screen. 1855 */ 1856 function wp_screen_meta_screen_settings( $screen ) { 1857 global $wp_meta_boxes, $wp_current_screen_options; 1858 1859 $screen = convert_to_screen( $screen ); 1681 1860 $columns = get_column_headers( $screen ); 1682 1861 $hidden = get_hidden_columns( $screen ); 1683 1862 1684 $meta_screens = array( 'index' => 'dashboard');1863 $meta_screens = array( 'index' => 'dashboard' ); 1685 1864 1686 1865 if ( isset($meta_screens[$screen->id]) ) { 1687 1866 $screen->id = $meta_screens[$screen->id]; … … 1692 1871 if ( !empty($wp_meta_boxes[$screen->id]) || !empty($columns) ) 1693 1872 $show_screen = true; 1694 1873 1695 $screen_options = screen_options( $screen);1874 $screen_options = screen_options( $screen ); 1696 1875 if ( $screen_options ) 1697 1876 $show_screen = true; 1698 1877 1699 if ( !isset($_wp_contextual_help) ) 1700 $_wp_contextual_help = array(); 1878 $settings = apply_filters( 'screen_settings', '', $screen ); 1701 1879 1702 $settings = apply_filters('screen_settings', '', $screen);1703 1704 1880 switch ( $screen->id ) { 1705 1881 case 'widgets': 1706 1882 $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 1883 $show_screen = true; 1708 1884 break; 1709 1885 } 1886 1710 1887 if ( ! empty( $settings ) ) 1711 1888 $show_screen = true; 1712 1889 1713 1890 if ( !empty($wp_current_screen_options) ) 1714 1891 $show_screen = true; 1892 ?> 1893 <form id="adv-settings" action="" method="post"> 1894 <?php if ( isset($wp_meta_boxes[$screen->id]) ) : ?> 1895 <h5><?php _ex( 'Show on screen', 'Metaboxes' ); ?></h5> 1896 <div class="metabox-prefs"> 1897 <?php meta_box_prefs( $screen ); ?> 1898 <br class="clear" /> 1899 </div> 1900 <?php endif; 1901 if ( ! empty($columns) ) : ?> 1902 <h5><?php echo ( isset( $columns['_title'] ) ? $columns['_title'] : _x('Show on screen', 'Columns') ) ?></h5> 1903 <div class="metabox-prefs"> 1904 <?php 1905 $special = array('_title', 'cb', 'comment', 'media', 'name', 'title', 'username', 'blogname'); 1715 1906 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> 1907 foreach ( $columns as $column => $title ) { 1908 // Can't hide these for they are special 1909 if ( in_array( $column, $special ) ) 1910 continue; 1911 if ( empty( $title ) ) 1912 continue; 1913 1914 if ( 'comments' == $column ) 1915 $title = __( 'Comments' ); 1916 $id = "$column-hide"; 1917 echo '<label for="' . $id . '">'; 1918 echo '<input class="hide-column-tog" name="' . $id . '" type="checkbox" id="' . $id . '" value="' . $column . '"' . checked( !in_array($column, $hidden), true, false ) . ' />'; 1919 echo "$title</label>\n"; 1920 } 1921 ?> 1922 <br class="clear" /> 1923 </div> 1727 1924 <?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'); 1925 echo screen_layout( $screen ); 1733 1926 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; 1927 if ( !empty( $screen_options ) ) { 1928 ?> 1929 <h5><?php _ex('Show on screen', 'Screen Options') ?></h5> 1930 <?php 1931 } 1740 1932 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); 1933 echo $screen_options; 1934 echo $settings; ?> 1935 <div><?php wp_nonce_field( 'screen-options-nonce', 'screenoptionnonce', false ); ?></div> 1936 </form><!-- #adv-settings --> 1937 <?php 1938 } 1753 1939 1754 if ( !empty( $screen_options ) ) { 1755 ?> 1756 <h5><?php _ex('Show on screen', 'Screen Options') ?></h5> 1757 <?php 1758 } 1940 /** 1941 * Outputs the contextual help content. 1942 * 1943 * @since 3.2.0 1944 * 1945 * @param string $screen The current page's screen. 1946 */ 1947 function wp_screen_meta_contextual_help( $screen ) { 1948 global $_wp_contextual_help; 1759 1949 1760 echo $screen_options; 1761 echo $settings; ?> 1762 <div><?php wp_nonce_field( 'screen-options-nonce', 'screenoptionnonce', false ); ?></div> 1763 </form> 1764 </div> 1950 if ( !isset($_wp_contextual_help) ) 1951 $_wp_contextual_help = array(); 1765 1952 1766 <?php endif; // $show_screen 1953 $_wp_contextual_help = apply_filters( 'contextual_help_list', $_wp_contextual_help, $screen ); 1954 1955 $contextual_help = ''; 1767 1956 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"; 1957 if ( isset($_wp_contextual_help[$screen]) ) { 1958 $contextual_help .= '<div class="metabox-prefs">' . $_wp_contextual_help[$screen] . "</div>\n"; 1775 1959 } else { 1776 1960 $contextual_help .= '<div class="metabox-prefs">'; 1777 $default_help = __( '<a href="http://codex.wordpress.org/" target="_blank">Documentation</a>');1961 $default_help = __( '<a href="http://codex.wordpress.org/" target="_blank">Documentation</a>' ); 1778 1962 $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);1963 $default_help .= __( '<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>' ); 1964 $contextual_help .= apply_filters( 'default_contextual_help', $default_help ); 1781 1965 $contextual_help .= "</div>\n"; 1782 1966 } 1967 1968 // Backwards compat. 1969 $screen_object = convert_to_screen( $screen ); 1783 1970 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 1971 echo apply_filters( 'contextual_help', $contextual_help, $screen, $screen_object ); 1800 1972 } 1801 1973 1802 1974 /** -
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-section, 1282 1283 #screen-options-wrap, 1283 1284 #contextual-help-wrap { 1284 1285 background-color: #F8F7F3; -
wp-admin/css/colors-fresh.dev.css
1276 1276 color: #D54E21; 1277 1277 } 1278 1278 1279 .screen-meta-section, 1279 1280 #screen-options-wrap, 1280 1281 #contextual-help-wrap { 1281 1282 background-color: #f1f1f1; -
wp-admin/css/wp-admin.dev.css
729 729 visibility: hidden; 730 730 } 731 731 732 .screen-meta-toggle, 732 733 #screen-options-link-wrap, 733 734 #contextual-help-link-wrap { 734 735 float: right; … … 776 777 text-decoration: none; 777 778 } 778 779 780 .screen-meta-section h5, 779 781 #screen-options-wrap h5, 780 782 #contextual-help-wrap h5 { 781 783 margin: 8px 0; 782 784 font-size: 13px; 783 785 } 784 786 787 .screen-meta-section, 785 788 #screen-options-wrap, 786 789 #contextual-help-wrap { 787 790 border-style: none solid solid;