Ticket #15800: 0001-Enhance-tabs-15800.patch
File 0001-Enhance-tabs-15800.patch, 7.3 KB (added by , 11 years ago) |
---|
-
wp-admin/includes/ms.php
From 09c947f374377dc1c07dec8f39dd80676c1bc0ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20B=C3=BCltge?= <frank@bueltge.de> Date: Wed, 5 Mar 2014 15:13:12 +0100 Subject: [PATCH] Enhance tabs #15800 --- wp-admin/includes/ms.php | 54 ++++++++++++++++++++++++++++++++++++++ wp-admin/network/site-info.php | 15 ++--------- wp-admin/network/site-settings.php | 15 ++--------- wp-admin/network/site-themes.php | 15 ++--------- wp-admin/network/site-users.php | 15 ++--------- 5 files changed, 62 insertions(+), 52 deletions(-) diff --git wp-admin/includes/ms.php wp-admin/includes/ms.php index f048417..75ec3d8 100644
function revoke_super_admin( $user_id ) { 769 769 return false; 770 770 } 771 771 772 /** 773 * Output the html for the network Edit Site page tabs 774 * 775 * @since 3.9.0 776 * 777 * @uses apply_filters() Calls 'network_edit_site_tabs' on 'info', 'users', 'themes', and settings tabs. 778 * @uses apply_filters() Calls 'network_edit_site_tab_html' on 'tab_html 779 * 780 * @param int $id The blog_id of the current site being edited. 781 */ 782 function network_edit_site_tabs( $id ) { 783 global $pagenow; 784 785 $default = array( 786 'site-info' => array( 'label' => __( 'Info' ), 'url' => 'site-info.php' ), 787 'site-users' => array( 'label' => __( 'Users' ), 'url' => 'site-users.php' ), 788 'site-themes' => array( 'label' => __( 'Themes' ), 'url' => 'site-themes.php' ), 789 'site-settings' => array( 'label' => __( 'Settings' ), 'url' => 'site-settings.php' ), 790 ); 791 $tabs = apply_filters( 'network_edit_site_tabs', $default, $id, $pagenow ); 792 793 foreach ( $tabs as $tab_id => $tab ) { 794 795 if ( isset( $tab[ 'menu-slug' ] ) && isset( $tab[ 'callback-function' ] ) ) { 796 797 $menu_slug = plugin_basename( $tab[ 'menu-slug' ] ); 798 799 $html = sprintf( 800 '<a href="%s" class="nav-tab %s">%s</a>', 801 add_query_arg( array( 'id' => $id ), network_admin_url( 'admin.php?page=' . $tab[ 'menu-slug' ] ) ), 802 isset( $_GET[ 'page' ] ) && $menu_slug == $_GET[ 'page' ] ? ' nav-tab-active' : '', 803 esc_html( $tab[ 'label' ] ) 804 ); 805 806 echo $html; 807 808 $admin_page_hooks[ $menu_slug ] = sanitize_title( $tab[ 'label' ] ); 809 } else { 810 811 // Set class for stylesheet 812 $class = ( $tab[ 'url' ] == $pagenow ) ? ' nav-tab-active' : ''; 813 // Adds aria-selected to each of the tabs 814 $selected = ( $tab[ 'url' ] == $pagenow ) ? 'true' : 'false'; 815 // Markup for each tab 816 $tab_html = '<a href="' . $tab['url'] . '?id=' . $id . '" class="nav-tab' 817 . $class . '" role="tab" aria-controls="' . sanitize_title( $tab_id ) . '" aria-selected="' 818 . $selected . '">' . esc_html( $tab[ 'label' ] ) . '</a>'; 819 820 echo apply_filters( 'network_edit_site_tab_html', $tab_html, $tab, $class, $id ); 821 } 822 } 823 } 824 825 772 826 /** 773 827 * Whether or not we can edit this network from this page 774 828 * -
wp-admin/network/site-info.php
diff --git wp-admin/network/site-info.php wp-admin/network/site-info.php index 6607b8f..44017c0 100644
require( ABSPATH . 'wp-admin/admin-header.php' ); 97 97 98 98 <div class="wrap"> 99 99 <h2 id="edit-site"><?php echo $title_site_url_linked ?></h2> 100 <h3 class="nav-tab-wrapper"> 101 <?php 102 $tabs = array( 103 'site-info' => array( 'label' => __( 'Info' ), 'url' => 'site-info.php' ), 104 'site-users' => array( 'label' => __( 'Users' ), 'url' => 'site-users.php' ), 105 'site-themes' => array( 'label' => __( 'Themes' ), 'url' => 'site-themes.php' ), 106 'site-settings' => array( 'label' => __( 'Settings' ), 'url' => 'site-settings.php' ), 107 ); 108 foreach ( $tabs as $tab_id => $tab ) { 109 $class = ( $tab['url'] == $pagenow ) ? ' nav-tab-active' : ''; 110 echo '<a href="' . $tab['url'] . '?id=' . $id .'" class="nav-tab' . $class . '">' . esc_html( $tab['label'] ) . '</a>'; 111 } 112 ?> 100 <h3 class="nav-tab-wrapper" role="tablist"> 101 <?php network_edit_site_tabs( $id ); ?> 113 102 </h3> 114 103 <?php 115 104 if ( ! empty( $messages ) ) { -
wp-admin/network/site-settings.php
diff --git wp-admin/network/site-settings.php wp-admin/network/site-settings.php index 5e1ffdd..4243c64 100644
require( ABSPATH . 'wp-admin/admin-header.php' ); 88 88 89 89 <div class="wrap"> 90 90 <h2 id="edit-site"><?php echo $title_site_url_linked ?></h2> 91 <h3 class="nav-tab-wrapper"> 92 <?php 93 $tabs = array( 94 'site-info' => array( 'label' => __( 'Info' ), 'url' => 'site-info.php' ), 95 'site-users' => array( 'label' => __( 'Users' ), 'url' => 'site-users.php' ), 96 'site-themes' => array( 'label' => __( 'Themes' ), 'url' => 'site-themes.php' ), 97 'site-settings' => array( 'label' => __( 'Settings' ), 'url' => 'site-settings.php' ), 98 ); 99 foreach ( $tabs as $tab_id => $tab ) { 100 $class = ( $tab['url'] == $pagenow ) ? ' nav-tab-active' : ''; 101 echo '<a href="' . $tab['url'] . '?id=' . $id .'" class="nav-tab' . $class . '">' . esc_html( $tab['label'] ) . '</a>'; 102 } 103 ?> 91 <h3 class="nav-tab-wrapper" role="tablist"> 92 <?php network_edit_site_tabs( $id ); ?> 104 93 </h3> 105 94 <?php 106 95 if ( ! empty( $messages ) ) { -
wp-admin/network/site-themes.php
diff --git wp-admin/network/site-themes.php wp-admin/network/site-themes.php index 646eb08..fec2b3c 100644
require( ABSPATH . 'wp-admin/admin-header.php' ); ?> 136 136 137 137 <div class="wrap"> 138 138 <h2 id="edit-site"><?php echo $title_site_url_linked ?></h2> 139 <h3 class="nav-tab-wrapper"> 140 <?php 141 $tabs = array( 142 'site-info' => array( 'label' => __( 'Info' ), 'url' => 'site-info.php' ), 143 'site-users' => array( 'label' => __( 'Users' ), 'url' => 'site-users.php' ), 144 'site-themes' => array( 'label' => __( 'Themes' ), 'url' => 'site-themes.php' ), 145 'site-settings' => array( 'label' => __( 'Settings' ), 'url' => 'site-settings.php' ), 146 ); 147 foreach ( $tabs as $tab_id => $tab ) { 148 $class = ( $tab['url'] == $pagenow ) ? ' nav-tab-active' : ''; 149 echo '<a href="' . $tab['url'] . '?id=' . $id .'" class="nav-tab' . $class . '">' . esc_html( $tab['label'] ) . '</a>'; 150 } 151 ?> 139 <h3 class="nav-tab-wrapper" role="tablist"> 140 <?php network_edit_site_tabs( $id ); ?> 152 141 </h3><?php 153 142 154 143 if ( isset( $_GET['enabled'] ) ) { -
wp-admin/network/site-users.php
diff --git wp-admin/network/site-users.php wp-admin/network/site-users.php index 322400b..7184100 100644
var current_site_id = <?php echo $id; ?>; 181 181 182 182 <div class="wrap"> 183 183 <h2 id="edit-site"><?php echo $title_site_url_linked ?></h2> 184 <h3 class="nav-tab-wrapper"> 185 <?php 186 $tabs = array( 187 'site-info' => array( 'label' => __( 'Info' ), 'url' => 'site-info.php' ), 188 'site-users' => array( 'label' => __( 'Users' ), 'url' => 'site-users.php' ), 189 'site-themes' => array( 'label' => __( 'Themes' ), 'url' => 'site-themes.php' ), 190 'site-settings' => array( 'label' => __( 'Settings' ), 'url' => 'site-settings.php' ), 191 ); 192 foreach ( $tabs as $tab_id => $tab ) { 193 $class = ( $tab['url'] == $pagenow ) ? ' nav-tab-active' : ''; 194 echo '<a href="' . $tab['url'] . '?id=' . $id .'" class="nav-tab' . $class . '">' . esc_html( $tab['label'] ) . '</a>'; 195 } 196 ?> 184 <h3 class="nav-tab-wrapper" role="tablist"> 185 <?php network_edit_site_tabs( $id ); ?> 197 186 </h3><?php 198 187 199 188 if ( isset($_GET['update']) ) :