Changeset 54215
- Timestamp:
- 09/19/2022 09:06:08 PM (23 months ago)
- Location:
- trunk
- Files:
-
- 7 added
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/class-wp-comments-list-table.php
r54071 r54215 294 294 295 295 foreach ( $stati as $status => $label ) { 296 $current_link_attributes = '';297 298 if ( $status === $comment_status ) {299 $current_link_attributes = ' class="current" aria-current="page"';300 }301 302 296 if ( 'mine' === $status ) { 303 297 $current_user_id = get_current_user_id(); … … 330 324 */ 331 325 332 $status_links[ $status ] = "<a href='$link'$current_link_attributes>" . sprintf( 333 translate_nooped_plural( $label, $num_comments->$status ), 334 sprintf( 335 '<span class="%s-count">%s</span>', 336 ( 'moderated' === $status ) ? 'pending' : $status, 337 number_format_i18n( $num_comments->$status ) 338 ) 339 ) . '</a>'; 326 $status_links[ $status ] = array( 327 'url' => esc_url( $link ), 328 'label' => sprintf( 329 translate_nooped_plural( $label, $num_comments->$status ), 330 sprintf( 331 '<span class="%s-count">%s</span>', 332 ( 'moderated' === $status ) ? 'pending' : $status, 333 number_format_i18n( $num_comments->$status ) 334 ) 335 ), 336 'current' => $status === $comment_status, 337 ); 340 338 } 341 339 … … 349 347 * 'Pending', 'Approved', 'Spam', and 'Trash'. 350 348 */ 351 return apply_filters( 'comment_status_links', $ status_links);349 return apply_filters( 'comment_status_links', $ ); 352 350 } 353 351 -
trunk/src/wp-admin/includes/class-wp-list-table.php
r54133 r54215 1515 1515 1516 1516 /** 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1517 1589 * Sends required variables to JavaScript land. 1518 1590 * -
trunk/src/wp-admin/includes/class-wp-ms-sites-list-table.php
r54071 r54215 263 263 264 264 foreach ( $statuses as $status => $label_count ) { 265 $current_link_attributes = $requested_status === $status || ( '' === $requested_status && 'all' === $status )266 ? ' class="current" aria-current="page"'267 : '';268 265 if ( (int) $counts[ $status ] > 0 ) { 269 266 $label = sprintf( translate_nooped_plural( $label_count, $counts[ $status ] ), number_format_i18n( $counts[ $status ] ) ); 270 267 $full_url = 'all' === $status ? $url : add_query_arg( 'status', $status, $url ); 271 268 272 $view_links[ $status ] = sprintf( 273 '<a href="%1$s"%2$s>%3$s</a>', 274 esc_url( $full_url ), 275 $current_link_attributes, 276 $label 269 $view_links[ $status ] = array( 270 'url' => esc_url( $full_url ), 271 'label' => $label, 272 'current' => $requested_status === $status || ( '' === $requested_status && 'all' === $status ), 277 273 ); 278 274 } 279 275 } 280 276 281 return $ view_links;277 return $; 282 278 } 283 279 -
trunk/src/wp-admin/includes/class-wp-ms-themes-list-table.php
r51795 r54215 445 445 446 446 if ( 'search' !== $type ) { 447 $status_links[ $type ] = sprintf( 448 "<a href='%s'%s>%s</a>", 449 esc_url( add_query_arg( 'theme_status', $type, $url ) ), 450 ( $type === $status ) ? ' class="current" aria-current="page"' : '', 451 sprintf( $text, number_format_i18n( $count ) ) 447 $status_links[ $type ] = array( 448 'url' => esc_url( add_query_arg( 'theme_status', $type, $url ) ), 449 'label' => sprintf( $text, number_format_i18n( $count ) ), 450 'current' => $type === $status, 452 451 ); 453 452 } 454 453 } 455 454 456 return $ status_links;455 return $; 457 456 } 458 457 -
trunk/src/wp-admin/includes/class-wp-ms-users-list-table.php
r54071 r54215 138 138 $total_admins = count( $super_admins ); 139 139 140 $current_link_attributes = 'super' !== $role ? ' class="current" aria-current="page"' : ''; 141 $role_links = array(); 142 $role_links['all'] = sprintf( 143 '<a href="%s"%s>%s</a>', 144 network_admin_url( 'users.php' ), 145 $current_link_attributes, 146 sprintf( 140 $role_links = array(); 141 $role_links['all'] = array( 142 'url' => network_admin_url( 'users.php' ), 143 'label' => sprintf( 147 144 /* translators: Number of users. */ 148 145 _nx( … … 153 150 ), 154 151 number_format_i18n( $total_users ) 155 ) 156 ); 157 $current_link_attributes = 'super' === $role ? ' class="current" aria-current="page"' : ''; 158 $role_links['super'] = sprintf( 159 '<a href="%s"%s>%s</a>', 160 network_admin_url( 'users.php?role=super' ), 161 $current_link_attributes, 162 sprintf( 152 ), 153 'current' => 'super' !== $role, 154 ); 155 156 $role_links['super'] = array( 157 'url' => network_admin_url( 'users.php?role=super' ), 158 'label' => sprintf( 163 159 /* translators: Number of users. */ 164 160 _n( … … 168 164 ), 169 165 number_format_i18n( $total_admins ) 170 ) 171 ); 172 173 return $role_links; 166 ), 167 'current' => 'super' === $role, 168 ); 169 170 return $this->get_views_links( $role_links ); 174 171 } 175 172 -
trunk/src/wp-admin/includes/class-wp-plugin-install-list-table.php
r54063 r54215 311 311 $display_tabs = array(); 312 312 foreach ( (array) $tabs as $action => $text ) { 313 $current_link_attributes = ( $action === $tab ) ? ' class="current" aria-current="page"' : ''; 314 $href = self_admin_url( 'plugin-install.php?tab=' . $action ); 315 $display_tabs[ 'plugin-install-' . $action ] = "<a href='$href'$current_link_attributes>$text</a>"; 313 $display_tabs[ 'plugin-install-' . $action ] = array( 314 'url' => self_admin_url( 'plugin-install.php?tab=' . $action ), 315 'label' => $text, 316 'current' => $action === $tab, 317 ); 316 318 } 317 319 // No longer a real tab. 318 320 unset( $display_tabs['plugin-install-upload'] ); 319 321 320 return $ display_tabs;322 return $; 321 323 } 322 324 -
trunk/src/wp-admin/includes/class-wp-plugins-list-table.php
r54062 r54215 577 577 578 578 if ( 'search' !== $type ) { 579 $status_links[ $type ] = sprintf( 580 "<a href='%s'%s>%s</a>", 581 add_query_arg( 'plugin_status', $type, 'plugins.php' ), 582 ( $type === $status ) ? ' class="current" aria-current="page"' : '', 583 sprintf( $text, number_format_i18n( $count ) ) 579 $status_links[ $type ] = array( 580 'url' => add_query_arg( 'plugin_status', $type, 'plugins.php' ), 581 'label' => sprintf( $text, number_format_i18n( $count ) ), 582 'current' => $type === $status, 584 583 ); 585 584 } 586 585 } 587 586 588 return $ status_links;587 return $; 589 588 } 590 589 -
trunk/src/wp-admin/includes/class-wp-posts-list-table.php
r54099 r54215 332 332 ); 333 333 334 $mine = $this->get_edit_link( $mine_args, $mine_inner_html, $class ); 334 $mine = array( 335 'url' => esc_url( add_query_arg( $mine_args, 'edit.php' ) ), 336 'label' => $mine_inner_html, 337 'current' => isset( $_GET['author'] ) && ( $current_user_id === (int) $_GET['author'] ), 338 ); 335 339 336 340 $all_args['all_posts'] = 1; 337 341 $class = ''; 338 }339 340 if ( empty( $class ) && ( $this->is_base_request() || isset( $_REQUEST['all_posts'] ) ) ) {341 $class = 'current';342 342 } 343 343 … … 353 353 ); 354 354 355 $status_links['all'] = $this->get_edit_link( $all_args, $all_inner_html, $class ); 355 $status_links['all'] = array( 356 'url' => esc_url( add_query_arg( $all_args, 'edit.php' ) ), 357 'label' => $all_inner_html, 358 'current' => empty( $class ) && ( $this->is_base_request() || isset( $_REQUEST['all_posts'] ) ), 359 ); 356 360 357 361 if ( $mine ) { … … 382 386 ); 383 387 384 $status_links[ $status_name ] = $this->get_edit_link( $status_args, $status_label, $class ); 388 $status_links[ $status_name ] = array( 389 'url' => esc_url( add_query_arg( $status_args, 'edit.php' ) ), 390 'label' => $status_label, 391 'current' => isset( $_REQUEST['post_status'] ) && $status_name === $_REQUEST['post_status'], 392 ); 385 393 } 386 394 … … 405 413 406 414 $sticky_link = array( 407 'sticky' => $this->get_edit_link( $sticky_args, $sticky_inner_html, $class ), 415 'sticky' => array( 416 'url' => esc_url( add_query_arg( $sticky_args, 'edit.php' ) ), 417 'label' => $sticky_inner_html, 418 'current' => ! empty( $_REQUEST['show_sticky'] ), 419 ), 408 420 ); 409 421 … … 413 425 } 414 426 415 return $ status_links;427 return $; 416 428 } 417 429 -
trunk/src/wp-admin/includes/class-wp-privacy-requests-table.php
r52239 r54215 154 154 $admin_url = $this->get_admin_url(); 155 155 156 $current_link_attributes = empty( $current_status ) ? ' class="current" aria-current="page"' : ''; 157 $status_label = sprintf( 156 $status_label = sprintf( 158 157 /* translators: %s: Number of requests. */ 159 158 _nx( … … 166 165 ); 167 166 168 $views['all'] = sprintf( 169 '<a href="%s"%s>%s</a>', 170 esc_url( $admin_url ), 171 $current_link_attributes, 172 $status_label 167 $views['all'] = array( 168 'url' => esc_url( $admin_url ), 169 'label' => $status_label, 170 'current' => empty( $current_status ), 173 171 ); 174 172 … … 179 177 } 180 178 181 $current_link_attributes = $status === $current_status ? ' class="current" aria-current="page"' : ''; 182 $total_status_requests = absint( $counts->{$status} ); 179 $total_status_requests = absint( $counts->{$status} ); 183 180 184 181 if ( ! $total_status_requests ) { … … 193 190 $status_link = add_query_arg( 'filter-status', $status, $admin_url ); 194 191 195 $views[ $status ] = sprintf( 196 '<a href="%s"%s>%s</a>', 197 esc_url( $status_link ), 198 $current_link_attributes, 199 $status_label 192 $views[ $status ] = array( 193 'url' => esc_url( $status_link ), 194 'label' => $status_label, 195 'current' => $status === $current_status, 200 196 ); 201 197 } 202 198 203 return $ views;199 return $; 204 200 } 205 201 -
trunk/src/wp-admin/includes/class-wp-theme-install-list-table.php
r52947 r54215 187 187 $display_tabs = array(); 188 188 foreach ( (array) $tabs as $action => $text ) { 189 $current_link_attributes = ( $action === $tab ) ? ' class="current" aria-current="page"' : ''; 190 $href = self_admin_url( 'theme-install.php?tab=' . $action ); 191 $display_tabs[ 'theme-install-' . $action ] = "<a href='$href'$current_link_attributes>$text</a>"; 192 } 193 194 return $display_tabs; 189 $display_tabs[ 'theme-install-' . $action ] = array( 190 'url' => self_admin_url( 'theme-install.php?tab=' . $action ), 191 'label' => $text, 192 'current' => $action === $tab, 193 ); 194 } 195 196 return $this->get_views_links( $display_tabs ); 195 197 } 196 198 -
trunk/src/wp-admin/includes/class-wp-users-list-table.php
r54070 r54215 186 186 } 187 187 188 $role_links = array(); 189 $avail_roles = array(); 190 $all_text = __( 'All' ); 191 $current_link_attributes = empty( $role ) ? ' class="current" aria-current="page"' : ''; 188 $role_links = array(); 189 $avail_roles = array(); 190 $all_text = __( 'All' ); 192 191 193 192 if ( $count_users ) { … … 216 215 } 217 216 218 $role_links['all'] = sprintf( '<a href="%s"%s>%s</a>', $url, $current_link_attributes, $all_text ); 217 $role_links['all'] = array( 218 'url' => $url, 219 'label' => $all_text, 220 'current' => empty( $role ), 221 ); 219 222 220 223 foreach ( $wp_roles->get_names() as $this_role => $name ) { 221 224 if ( $count_users && ! isset( $avail_roles[ $this_role ] ) ) { 222 225 continue; 223 }224 225 $current_link_attributes = '';226 227 if ( $this_role === $role ) {228 $current_link_attributes = ' class="current" aria-current="page"';229 226 } 230 227 … … 239 236 } 240 237 241 $role_links[ $this_role ] = "<a href='" . esc_url( add_query_arg( 'role', $this_role, $url ) ) . "'$current_link_attributes>$name</a>"; 238 $role_links[ $this_role ] = array( 239 'url' => esc_url( add_query_arg( 'role', $this_role, $url ) ), 240 'label' => $name, 241 'current' => $this_role === $role, 242 ); 242 243 } 243 244 244 245 if ( ! empty( $avail_roles['none'] ) ) { 245 246 $current_link_attributes = '';247 248 if ( 'none' === $role ) {249 $current_link_attributes = ' class="current" aria-current="page"';250 }251 246 252 247 $name = __( 'No role' ); … … 258 253 ); 259 254 260 $role_links['none'] = "<a href='" . esc_url( add_query_arg( 'role', 'none', $url ) ) . "'$current_link_attributes>$name</a>"; 261 } 262 263 return $role_links; 255 $role_links['none'] = array( 256 'url' => esc_url( add_query_arg( 'role', 'none', $url ) ), 257 'label' => $name, 258 'current' => 'none' === $role, 259 ); 260 } 261 262 return $this->get_views_links( $role_links ); 264 263 } 265 264 -
trunk/tests/phpunit/tests/admin/wpCommentsListTable.php
r51998 r54215 196 196 } 197 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 198 217 } -
trunk/tests/phpunit/tests/admin/wpListTable.php
r53868 r54215 7 7 */ 8 8 class Tests_Admin_WpListTable extends WP_UnitTestCase { 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 9 27 10 28 /** … … 105 123 return $datasets; 106 124 } 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 107 347 } -
trunk/tests/phpunit/tests/admin/wpPostsListTable.php
r51997 r54215 320 320 } 321 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 322 344 } -
trunk/tests/phpunit/tests/admin/wpPrivacyRequestsTable.php
r53942 r54215 199 199 ); 200 200 } 201 202 203 204 205 206 207 208 209 210 211 212 213 201 214 } -
trunk/tests/phpunit/tests/multisite/wpMsSitesListTable.php
r52010 r54215 231 231 $this->assertSameSets( $expected, $items ); 232 232 } 233 234 235 236 237 238 239 240 241 242 243 244 233 245 } 234 246 endif;
Note: See TracChangeset
for help on using the changeset viewer.