Ticket #15800: 15800.4.patch
File 15800.4.patch, 8.9 KB (added by , 9 years ago) |
---|
-
src/wp-admin/includes/ms.php
diff --git a/src/wp-admin/includes/ms.php b/src/wp-admin/includes/ms.php index 5464b61..acb0c1d 100644
a b 1028 1028 </script> 1029 1029 <?php 1030 1030 } 1031 1032 1033 /** 1034 * Output the HTML for a network's "Edit Site" tabular interface 1035 * 1036 * @since 4.6.0 1037 * 1038 * @link https://core.trac.wordpress.org/ticket/15800 discussion 1039 * 1040 * @param $args { 1041 * Optional. Array or string of Query parameters. 1042 * 1043 * @type int $blog_id The site ID. Default is the current site. 1044 * @type string|array $before The HTML to echo before the tabs 1045 * @type string|array $after The HTML to echo after the tabs 1046 * @type array $tabs The tabs to include with (label|url|cap) keys 1047 * @type array $screen_tabs Pre-rendered HTML tabs if you wish to own their output 1048 * } 1049 */ 1050 function network_edit_site_nav( $args = array() ) { 1051 1052 /** 1053 * Filter the links that appear on site-editing network pages 1054 * 1055 * Default tabs: 'site-info', 'site-users', 'site-themes', and 'site-settings' 1056 * 1057 * @since 4.6.0 1058 * 1059 * @param array Array of links 1060 */ 1061 $tabs = apply_filters( 'network_edit_site_links', array( 1062 'site-info' => array( 'label' => __( 'Info' ), 'url' => 'site-info.php', 'cap' => 'manage_sites' ), 1063 'site-users' => array( 'label' => __( 'Users' ), 'url' => 'site-users.php', 'cap' => 'manage_sites' ), 1064 'site-themes' => array( 'label' => __( 'Themes' ), 'url' => 'site-themes.php', 'cap' => 'manage_sites' ), 1065 'site-settings' => array( 'label' => __( 'Settings' ), 'url' => 'site-settings.php', 'cap' => 'manage_sites' ) 1066 ) ); 1067 1068 // Parse arguments 1069 $r = wp_parse_args( $args, array( 1070 'blog_id' => isset( $_GET['blog_id'] ) ? (int) $_GET['blog_id'] : 0, 1071 'tabs' => $tabs, 1072 'selected' => 'site-info', 1073 'screen_tabs' => array() 1074 ) ); 1075 1076 /** 1077 * Filter the arguments used to output tabs that appear on site-editing 1078 * network pages 1079 * 1080 * @since 4.6.0 1081 * 1082 * @param array $r Parsed arguments 1083 * @param array $args Original arguments 1084 */ 1085 $r = apply_filters( 'network_edit_site_nav_args', $r, $args ); 1086 1087 // Loop through tabs 1088 foreach ( $r['tabs'] as $tab_id => $tab ) { 1089 1090 // Skip tab if user can't access 1091 if ( ! current_user_can( $tab['cap'], $r['blog_id'] ) ) { 1092 continue; 1093 } 1094 1095 // Skip if tab is pre-loaded 1096 if ( isset( $r['screen_tabs'][ $tab_id ] ) ) { 1097 continue; 1098 } 1099 1100 // Tab class and selected values 1101 $classes = array( 'nav-tab' ); 1102 $selected = 'false'; 1103 if ( 1104 1105 // Selected is set by parent 1106 ( $r['selected'] === $tab_id ) 1107 1108 || 1109 1110 // Selected is assumed by $pagenow global 1111 ( $tab['url'] === $GLOBALS['pagenow'] ) 1112 ) { 1113 $classes[] = 'nav-tab-active'; 1114 $selected = 'true'; 1115 } 1116 1117 // Escape each class 1118 $esc_classes = implode( ' ', array_map( 'esc_attr', $classes ) ); 1119 1120 // Get the URL for this tab 1121 $url = add_query_arg( array( 'id' => $r['blog_id'] ), network_admin_url( $tab['url'] ) ); 1122 1123 // Add tab to screen tabs 1124 $r['screen_tabs'][ $tab_id ] = '<a href="' . esc_url( $url ) . '" id="' . esc_attr( $tab_id ) . '" class="' . $esc_classes . '">' . esc_html( $tab['label'] ) . '</a>'; 1125 } 1126 1127 // Start a buffer 1128 ob_start(); 1129 1130 // All done! 1131 echo '<h2 class="nav-tab-wrapper wp-clearfix" role="tablist">'; 1132 echo implode( '', $r['screen_tabs'] ); 1133 echo '</h2>'; 1134 1135 // Output the nav 1136 echo ob_get_clean(); 1137 } -
src/wp-admin/network/site-info.php
diff --git a/src/wp-admin/network/site-info.php b/src/wp-admin/network/site-info.php index b18d804..868e88c 100644
a b 143 143 <div class="wrap"> 144 144 <h1 id="edit-site"><?php echo $title; ?></h1> 145 145 <p class="edit-site-actions"><a href="<?php echo esc_url( get_home_url( $id, '/' ) ); ?>"><?php _e( 'Visit' ); ?></a> | <a href="<?php echo esc_url( get_admin_url( $id ) ); ?>"><?php _e( 'Dashboard' ); ?></a></p> 146 <h2 class="nav-tab-wrapper nav-tab-small wp-clearfix">147 146 <?php 148 $tabs = array( 149 'site-info' => array( 'label' => __( 'Info' ), 'url' => 'site-info.php' ), 150 'site-users' => array( 'label' => __( 'Users' ), 'url' => 'site-users.php' ), 151 'site-themes' => array( 'label' => __( 'Themes' ), 'url' => 'site-themes.php' ), 152 'site-settings' => array( 'label' => __( 'Settings' ), 'url' => 'site-settings.php' ), 153 ); 154 foreach ( $tabs as $tab_id => $tab ) { 155 $class = ( $tab['url'] == $pagenow ) ? ' nav-tab-active' : ''; 156 echo '<a href="' . $tab['url'] . '?id=' . $id .'" class="nav-tab' . $class . '">' . esc_html( $tab['label'] ) . '</a>'; 157 } 158 ?> 159 </h2> 160 <?php 147 148 network_edit_site_nav( array( 149 'blog_id' => $id, 150 'selected' => 'site-info' 151 ) ); 152 161 153 if ( ! empty( $messages ) ) { 162 154 foreach ( $messages as $msg ) { 163 155 echo '<div id="message" class="updated notice is-dismissible"><p>' . $msg . '</p></div>'; -
src/wp-admin/network/site-settings.php
diff --git a/src/wp-admin/network/site-settings.php b/src/wp-admin/network/site-settings.php index b945ea7..a5cdc6d 100644
a b 95 95 <div class="wrap"> 96 96 <h1 id="edit-site"><?php echo $title; ?></h1> 97 97 <p class="edit-site-actions"><a href="<?php echo esc_url( get_home_url( $id, '/' ) ); ?>"><?php _e( 'Visit' ); ?></a> | <a href="<?php echo esc_url( get_admin_url( $id ) ); ?>"><?php _e( 'Dashboard' ); ?></a></p> 98 <h2 class="nav-tab-wrapper nav-tab-small wp-clearfix"> 98 99 99 <?php 100 $tabs = array( 101 'site-info' => array( 'label' => __( 'Info' ), 'url' => 'site-info.php' ), 102 'site-users' => array( 'label' => __( 'Users' ), 'url' => 'site-users.php' ), 103 'site-themes' => array( 'label' => __( 'Themes' ), 'url' => 'site-themes.php' ), 104 'site-settings' => array( 'label' => __( 'Settings' ), 'url' => 'site-settings.php' ), 105 ); 106 foreach ( $tabs as $tab_id => $tab ) { 107 $class = ( $tab['url'] == $pagenow ) ? ' nav-tab-active' : ''; 108 echo '<a href="' . $tab['url'] . '?id=' . $id .'" class="nav-tab' . $class . '">' . esc_html( $tab['label'] ) . '</a>'; 109 } 110 ?> 111 </h2> 112 <?php 100 101 network_edit_site_nav( array( 102 'blog_id' => $id, 103 'selected' => 'site-settings' 104 ) ); 105 113 106 if ( ! empty( $messages ) ) { 114 107 foreach ( $messages as $msg ) 115 108 echo '<div id="message" class="updated notice is-dismissible"><p>' . $msg . '</p></div>'; -
src/wp-admin/network/site-themes.php
diff --git a/src/wp-admin/network/site-themes.php b/src/wp-admin/network/site-themes.php index d48e2ca..6d13fb2 100644
a b 149 149 <div class="wrap"> 150 150 <h1 id="edit-site"><?php echo $title; ?></h1> 151 151 <p class="edit-site-actions"><a href="<?php echo esc_url( get_home_url( $id, '/' ) ); ?>"><?php _e( 'Visit' ); ?></a> | <a href="<?php echo esc_url( get_admin_url( $id ) ); ?>"><?php _e( 'Dashboard' ); ?></a></p> 152 <h2 class="nav-tab-wrapper nav-tab-small wp-clearfix">153 152 <?php 154 $tabs = array( 155 'site-info' => array( 'label' => __( 'Info' ), 'url' => 'site-info.php' ), 156 'site-users' => array( 'label' => __( 'Users' ), 'url' => 'site-users.php' ), 157 'site-themes' => array( 'label' => __( 'Themes' ), 'url' => 'site-themes.php' ), 158 'site-settings' => array( 'label' => __( 'Settings' ), 'url' => 'site-settings.php' ), 159 ); 160 foreach ( $tabs as $tab_id => $tab ) { 161 $class = ( $tab['url'] == $pagenow ) ? ' nav-tab-active' : ''; 162 echo '<a href="' . $tab['url'] . '?id=' . $id .'" class="nav-tab' . $class . '">' . esc_html( $tab['label'] ) . '</a>'; 163 } 164 ?> 165 </h2><?php 153 154 network_edit_site_nav( array( 155 'blog_id' => $id, 156 'selected' => 'site-themes' 157 ) ); 166 158 167 159 if ( isset( $_GET['enabled'] ) ) { 168 160 $enabled = absint( $_GET['enabled'] ); -
src/wp-admin/network/site-users.php
diff --git a/src/wp-admin/network/site-users.php b/src/wp-admin/network/site-users.php index 77122e8..cced8a4 100644
a b 204 204 <div class="wrap"> 205 205 <h1 id="edit-site"><?php echo $title; ?></h1> 206 206 <p class="edit-site-actions"><a href="<?php echo esc_url( get_home_url( $id, '/' ) ); ?>"><?php _e( 'Visit' ); ?></a> | <a href="<?php echo esc_url( get_admin_url( $id ) ); ?>"><?php _e( 'Dashboard' ); ?></a></p> 207 <h2 class="nav-tab-wrapper nav-tab-small wp-clearfix">208 207 <?php 209 $tabs = array( 210 'site-info' => array( 'label' => __( 'Info' ), 'url' => 'site-info.php' ), 211 'site-users' => array( 'label' => __( 'Users' ), 'url' => 'site-users.php' ), 212 'site-themes' => array( 'label' => __( 'Themes' ), 'url' => 'site-themes.php' ), 213 'site-settings' => array( 'label' => __( 'Settings' ), 'url' => 'site-settings.php' ), 214 ); 215 foreach ( $tabs as $tab_id => $tab ) { 216 $class = ( $tab['url'] == $pagenow ) ? ' nav-tab-active' : ''; 217 echo '<a href="' . $tab['url'] . '?id=' . $id .'" class="nav-tab' . $class . '">' . esc_html( $tab['label'] ) . '</a>'; 218 } 219 ?> 220 </h2><?php 208 209 network_edit_site_nav( array( 210 'blog_id' => $id, 211 'selected' => 'site-users' 212 ) ); 221 213 222 214 if ( isset($_GET['update']) ) : 223 215 switch($_GET['update']) {