Changeset 50764 for trunk/src/wp-admin/site-health.php
- Timestamp:
- 04/17/2021 01:12:25 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/site-health.php
r50131 r50764 7 7 */ 8 8 9 if ( isset( $_GET['tab'] ) && 'debug' === $_GET['tab'] ) {10 require_once __DIR__ . '/site-health-info.php';11 return;12 }13 14 9 /** WordPress Administration Bootstrap */ 15 10 require_once __DIR__ . '/admin.php'; … … 17 12 wp_reset_vars( array( 'action' ) ); 18 13 19 $title = __( 'Site Health Status' ); 14 $tabs = array( 15 /* translators: Tab heading for Site Health Status page. */ 16 '' => _x( 'Status', 'Site Health' ), 17 /* translators: Tab heading for Site Health Info page. */ 18 'debug' => _x( 'Info', 'Site Health' ), 19 ); 20 21 /** 22 * An associated array of extra tabs for the Site Health navigation bar. 23 * 24 * Add a custom page to the Site Health screen, based on a tab slug and label. 25 * The label you provide will also be used as part of the site title. 26 * 27 * @since 5.8.0 28 * 29 * @param array $tabs An associated array of tab slugs and their label. 30 */ 31 $tabs = apply_filters( 'site_health_navigation_tabs', $tabs ); 32 33 $wrapper_classes = array( 34 'health-check-tabs-wrapper', 35 'hide-if-no-js', 36 'tab-count-' . count( $tabs ), 37 ); 38 39 $title = sprintf( 40 // translators: %s: The currently displayed tab. 41 __( 'Site Health %s' ), 42 ( isset( $_GET['tab'] ) ? esc_html( $tabs[ $_GET['tab'] ] ) : esc_html( $tabs[0] ) ) 43 ); 20 44 21 45 if ( ! current_user_can( 'view_site_health_checks' ) ) { … … 87 111 </div> 88 112 89 <nav class="health-check-tabs-wrapper hide-if-no-js" aria-label="<?php esc_attr_e( 'Secondary menu' ); ?>"> 90 <a href="<?php echo esc_url( admin_url( 'site-health.php' ) ); ?>" class="health-check-tab active" aria-current="true"> 91 <?php 92 /* translators: Tab heading for Site Health Status page. */ 93 _ex( 'Status', 'Site Health' ); 94 ?> 95 </a> 96 97 <a href="<?php echo esc_url( admin_url( 'site-health.php?tab=debug' ) ); ?>" class="health-check-tab"> 98 <?php 99 /* translators: Tab heading for Site Health Info page. */ 100 _ex( 'Info', 'Site Health' ); 101 ?> 102 </a> 113 <nav class="<?php echo implode( ' ', $wrapper_classes ); ?>" aria-label="<?php esc_attr_e( 'Secondary menu' ); ?>"> 114 <?php 115 $tabs_slice = $tabs; 116 117 /* 118 * If there are more than 4 tabs, only output the first 3 inline, 119 * the remaining links will be added to a sub-navigation. 120 */ 121 if ( count( $tabs ) > 4 ) { 122 $tabs_slice = array_slice( $tabs, 0, 3 ); 123 } 124 125 foreach ( $tabs_slice as $slug => $label ) { 126 printf( 127 '<a href="%s" class="health-check-tab %s">%s</a>', 128 esc_url( 129 add_query_arg( 130 array( 131 'tab' => $slug, 132 ), 133 admin_url( 'site-health.php' ) 134 ) 135 ), 136 ( isset( $_GET['tab'] ) && $_GET['tab'] === $slug ? 'active' : '' ), 137 esc_html( $label ) 138 ); 139 } 140 ?> 141 142 <?php if ( count( $tabs ) > 4 ) : ?> 143 <button type="button" class="health-check-tab health-check-offscreen-nav-wrapper" aria-haspopup="true"> 144 <span class="dashicons dashicons-ellipsis"></span> 145 <span class="screen-reader-text"><?php _e( 'Toggle extra menu items' ); ?></span> 146 147 <div class="health-check-offscreen-nav"> 148 <?php 149 // Remove the first few entries from the array as being already output. 150 $tabs_slice = array_slice( $tabs, 3 ); 151 foreach ( $tabs_slice as $slug => $label ) { 152 printf( 153 '<a href="%s" class="health-check-tab %s">%s</a>', 154 esc_url( 155 add_query_arg( 156 array( 157 'tab' => $slug, 158 ), 159 admin_url( 'site-health.php' ) 160 ) 161 ), 162 ( isset( $_GET['tab'] ) && $_GET['tab'] === $slug ? 'active' : '' ), 163 esc_html( $label ) 164 ); 165 } 166 ?> 167 </div> 168 </button> 169 <?php endif; ?> 103 170 </nav> 104 171 </div> 105 172 106 173 <hr class="wp-header-end"> 174 175 <?php 176 if ( isset( $_GET['tab'] ) && ! empty( $_GET['tab'] ) ) { 177 /** 178 * Output content of a custom Site Health tab. 179 * 180 * This action fires right after the Site Health header, and users are still subject to 181 * the capability checks for the Site Health page to view any custom tabs and their contents. 182 * 183 * @since 5.8.0 184 * 185 * @param string $tab The slug of the tab that was requested. 186 */ 187 do_action( 'site_health_tab_content', $_GET['tab'] ); 188 189 require_once ABSPATH . 'wp-admin/admin-footer.php'; 190 return; 191 } else { 192 ?> 107 193 108 194 <div class="notice notice-error hide-if-js"> … … 194 280 </script> 195 281 196 <?php 282 <?php 283 } 197 284 require_once ABSPATH . 'wp-admin/admin-footer.php';
Note: See TracChangeset
for help on using the changeset viewer.