Changeset 37466
- Timestamp:
- 05/19/2016 09:47:06 PM (9 years ago)
- Location:
- trunk/src/wp-admin
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/ms.php
r37342 r37466 1029 1029 <?php 1030 1030 } 1031 1032 /** 1033 * Outputs the HTML for a network's "Edit Site" tabular interface 1034 * 1035 * @since 4.6.0 1036 * 1037 * @link https://core.trac.wordpress.org/ticket/15800 discussion 1038 * 1039 * @param $args { 1040 * Optional. Array or string of Query parameters. 1041 * 1042 * @type int $blog_id The site ID. Default is the current site. 1043 * @type array $links The tabs to include with (label|url|cap) keys 1044 * @type string $selected The ID of the selected link 1045 * } 1046 */ 1047 function network_edit_site_nav( $args = array() ) { 1048 1049 /** 1050 * Filter the links that appear on site-editing network pages 1051 * 1052 * Default links: 'site-info', 'site-users', 'site-themes', and 'site-settings' 1053 * 1054 * @since 4.6.0 1055 * 1056 * @param array Array of link data. 1057 */ 1058 $links = apply_filters( 'network_edit_site_nav_links', array( 1059 'site-info' => array( 'label' => __( 'Info' ), 'url' => 'site-info.php', 'cap' => 'manage_sites' ), 1060 'site-users' => array( 'label' => __( 'Users' ), 'url' => 'site-users.php', 'cap' => 'manage_sites' ), 1061 'site-themes' => array( 'label' => __( 'Themes' ), 'url' => 'site-themes.php', 'cap' => 'manage_sites' ), 1062 'site-settings' => array( 'label' => __( 'Settings' ), 'url' => 'site-settings.php', 'cap' => 'manage_sites' ) 1063 ) ); 1064 1065 // Parse arguments 1066 $r = wp_parse_args( $args, array( 1067 'blog_id' => isset( $_GET['blog_id'] ) ? (int) $_GET['blog_id'] : 0, 1068 'links' => $links, 1069 'selected' => 'site-info', 1070 ) ); 1071 1072 // Setup the links array 1073 $screen_links = array(); 1074 1075 // Loop through tabs 1076 foreach ( $r['links'] as $link_id => $link ) { 1077 1078 // Skip link if user can't access 1079 if ( ! current_user_can( $link['cap'], $r['blog_id'] ) ) { 1080 continue; 1081 } 1082 1083 // Link classes 1084 $classes = array( 'nav-tab' ); 1085 1086 // Selected is set by the parent OR assumed by the $pagenow global 1087 if ( $r['selected'] === $link_id || $link['url'] === $GLOBALS['pagenow'] ) { 1088 $classes[] = 'nav-tab-active'; 1089 } 1090 1091 // Escape each class 1092 $esc_classes = implode( ' ', array_map( 'esc_attr', $classes ) ); 1093 1094 // Get the URL for this link 1095 $url = add_query_arg( array( 'id' => $r['blog_id'] ), network_admin_url( $link['url'] ) ); 1096 1097 // Add link to nav links 1098 $screen_links[ $link_id ] = '<a href="' . esc_url( $url ) . '" id="' . esc_attr( $link_id ) . '" class="' . $esc_classes . '">' . esc_html( $link['label'] ) . '</a>'; 1099 } 1100 1101 // Start a buffer 1102 ob_start(); 1103 1104 // All done! 1105 echo '<h2 class="nav-tab-wrapper wp-clearfix">'; 1106 echo implode( '', $screen_links ); 1107 echo '</h2>'; 1108 1109 // Output the nav 1110 echo ob_get_clean(); 1111 } -
trunk/src/wp-admin/network/site-info.php
r36682 r37466 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 ) { -
trunk/src/wp-admin/network/site-settings.php
r36171 r37466 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 ) -
trunk/src/wp-admin/network/site-themes.php
r36171 r37466 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'] ) ) { -
trunk/src/wp-admin/network/site-users.php
r36171 r37466 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 <?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 207 <?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']) ) :
Note: See TracChangeset
for help on using the changeset viewer.