Changeset 32756
- Timestamp:
- 06/13/2015 04:53:06 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/class-wp-ms-themes-list-table.php
r32724 r32756 337 337 338 338 /** 339 * @since 4.3.0 340 * 341 * @param WP_Theme $theme 342 */ 343 public function column_cb( $theme ) { 344 $checkbox_id = 'checkbox_' . md5( $theme->get('Name') ); 345 ?> 346 <input type="checkbox" name="checked[]" value="<?php echo esc_attr( $theme->get_stylesheet() ) ?>" id="<?php echo $checkbox_id ?>" /> 347 <label class="screen-reader-text" for="<?php echo $checkbox_id ?>" ><?php _e( 'Select' ) ?> <?php echo $theme->display( 'Name' ) ?></label> 348 <?php 349 } 350 351 /** 352 * @since 4.3.0 353 * 339 354 * @global string $status 340 * @global int $page355 * @global int $page 341 356 * @global string $s 342 * @global array $totals343 357 * 344 358 * @param WP_Theme $theme 345 359 */ 346 public function single_row( $theme ) {347 global $status, $page, $s , $totals;360 public function column_name( $theme ) { 361 global $status, $page, $s; 348 362 349 363 $context = $status; … … 369 383 370 384 if ( ! $allowed ) { 371 if ( ! $theme->errors() ) 385 if ( ! $theme->errors() ) { 372 386 $actions['enable'] = '<a href="' . esc_url( wp_nonce_url($url . 'action=enable&theme=' . $theme_key . '&paged=' . $page . '&s=' . $s, 'enable-theme_' . $stylesheet ) ) . '" title="' . esc_attr__('Enable this theme') . '" class="edit">' . ( $this->is_site_themes ? __( 'Enable' ) : __( 'Network Enable' ) ) . '</a>'; 387 } 373 388 } else { 374 389 $actions['disable'] = '<a href="' . esc_url( wp_nonce_url($url . 'action=disable&theme=' . $theme_key . '&paged=' . $page . '&s=' . $s, 'disable-theme_' . $stylesheet ) ) . '" title="' . esc_attr__('Disable this theme') . '">' . ( $this->is_site_themes ? __( 'Disable' ) : __( 'Network Disable' ) ) . '</a>'; 375 390 } 376 391 377 if ( current_user_can('edit_themes') ) 392 if ( current_user_can('edit_themes') ) { 378 393 $actions['edit'] = '<a href="' . esc_url('theme-editor.php?theme=' . $theme_key ) . '" title="' . esc_attr__('Open this theme in the Theme Editor') . '" class="edit">' . __('Edit') . '</a>'; 379 380 if ( ! $allowed && current_user_can( 'delete_themes' ) && ! $this->is_site_themes && $stylesheet != get_option( 'stylesheet' ) && $stylesheet != get_option( 'template' ) ) 394 } 395 396 if ( ! $allowed && current_user_can( 'delete_themes' ) && ! $this->is_site_themes && $stylesheet != get_option( 'stylesheet' ) && $stylesheet != get_option( 'template' ) ) { 381 397 $actions['delete'] = '<a href="' . esc_url( wp_nonce_url( 'themes.php?action=delete-selected&checked[]=' . $theme_key . '&theme_status=' . $context . '&paged=' . $page . '&s=' . $s, 'bulk-themes' ) ) . '" title="' . esc_attr__( 'Delete this theme' ) . '" class="delete">' . __( 'Delete' ) . '</a>'; 382 398 } 383 399 /** 384 400 * Filter the action links displayed for each theme in the Multisite … … 421 437 $actions = apply_filters( "theme_action_links_$stylesheet", $actions, $theme, $context ); 422 438 439 echo $this->row_actions( $actions, true ); 440 } 441 442 /** 443 * @since 4.3.0 444 * 445 * @global string $status 446 * @global array $totals 447 * 448 * @param WP_Theme $theme 449 */ 450 public function column_description( $theme ) { 451 global $status, $totals; 452 if ( $theme->errors() ) { 453 $pre = $status == 'broken' ? __( 'Broken Theme:' ) . ' ' : ''; 454 echo '<p><strong class="attention">' . $pre . $theme->errors()->get_error_message() . '</strong></p>'; 455 } 456 457 if ( $this->is_site_themes ) { 458 $allowed = $theme->is_allowed( 'site', $this->site_id ); 459 } else { 460 $allowed = $theme->is_allowed( 'network' ); 461 } 462 423 463 $class = ! $allowed ? 'inactive' : 'active'; 424 $checkbox_id = "checkbox_" . md5( $theme->get('Name') );425 $checkbox = "<input type='checkbox' name='checked[]' value='" . esc_attr( $stylesheet ) . "' id='" . $checkbox_id . "' /><label class='screen-reader-text' for='" . $checkbox_id . "' >" . __('Select') . " " . $theme->display('Name') . "</label>";426 427 $id = sanitize_html_class( $theme->get_stylesheet() );428 429 464 if ( ! empty( $totals['upgrade'] ) && ! empty( $theme->update ) ) 430 465 $class .= ' update'; 431 466 432 echo "<tr id='$id' class='$class'>"; 433 467 echo "<div class='theme-description'><p>" . $theme->display( 'Description' ) . "</p></div> 468 <div class='$class second theme-version-author-uri'>"; 469 470 $stylesheet = $theme->get_stylesheet(); 471 $theme_meta = array(); 472 473 if ( $theme->get('Version') ) { 474 $theme_meta[] = sprintf( __( 'Version %s' ), $theme->display('Version') ); 475 } 476 $theme_meta[] = sprintf( __( 'By %s' ), $theme->display('Author') ); 477 478 if ( $theme->get('ThemeURI') ) { 479 $theme_meta[] = '<a href="' . $theme->display('ThemeURI') . '" title="' . esc_attr__( 'Visit theme homepage' ) . '">' . __( 'Visit Theme Site' ) . '</a>'; 480 } 481 /** 482 * Filter the array of row meta for each theme in the Multisite themes 483 * list table. 484 * 485 * @since 3.1.0 486 * 487 * @param array $theme_meta An array of the theme's metadata, 488 * including the version, author, and 489 * theme URI. 490 * @param string $stylesheet Directory name of the theme. 491 * @param WP_Theme $theme WP_Theme object. 492 * @param string $status Status of the theme. 493 */ 494 $theme_meta = apply_filters( 'theme_row_meta', $theme_meta, $stylesheet, $theme, $status ); 495 echo implode( ' | ', $theme_meta ); 496 497 echo '</div>'; 498 } 499 500 /** 501 * @since 4.3.0 502 * 503 * @param WP_Theme $theme 504 * @param string $column_name 505 */ 506 public function column_default( $theme, $column_name ) { 507 $stylesheet = $theme->get_stylesheet(); 508 /** 509 * Fires inside each custom column of the Multisite themes list table. 510 * 511 * @since 3.1.0 512 * 513 * @param string $column_name Name of the column. 514 * @param string $stylesheet Directory name of the theme. 515 * @param WP_Theme $theme Current WP_Theme object. 516 */ 517 do_action( 'manage_themes_custom_column', $column_name, $stylesheet, $theme ); 518 } 519 520 /** 521 * @since 4.3.0 522 * 523 * @param WP_Theme $item 524 */ 525 public function single_row_columns( $item ) { 434 526 list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info(); 435 527 … … 442 534 switch ( $column_name ) { 443 535 case 'cb': 444 echo "<th scope='row' class='check-column'>$checkbox</th>"; 445 break; 536 echo '<th scope="row" class="check-column">'; 537 538 $this->column_cb( $item ); 539 540 echo '</th>'; 541 break; 542 446 543 case 'name': 447 echo "<td class='theme-title column-primary{$extra_classes}'><strong>" . $theme->display('Name') . "</strong>"; 448 echo $this->row_actions($actions, true); 544 echo "<td class='theme-title column-primary{$extra_classes}'><strong>" . $item->display('Name') . "</strong>"; 545 546 $this->column_name( $item ); 547 449 548 echo "</td>"; 450 549 break; 550 451 551 case 'description': 452 552 echo "<td class='column-description desc{$extra_classes}'>"; 453 if ( $theme->errors() ) { 454 $pre = $status == 'broken' ? __( 'Broken Theme:' ) . ' ' : ''; 455 echo '<p><strong class="attention">' . $pre . $theme->errors()->get_error_message() . '</strong></p>'; 456 } 457 echo "<div class='theme-description'><p>" . $theme->display( 'Description' ) . "</p></div> 458 <div class='$class second theme-version-author-uri'>"; 459 460 $theme_meta = array(); 461 462 if ( $theme->get('Version') ) 463 $theme_meta[] = sprintf( __( 'Version %s' ), $theme->display('Version') ); 464 465 $theme_meta[] = sprintf( __( 'By %s' ), $theme->display('Author') ); 466 467 if ( $theme->get('ThemeURI') ) 468 $theme_meta[] = '<a href="' . $theme->display('ThemeURI') . '" title="' . esc_attr__( 'Visit theme homepage' ) . '">' . __( 'Visit Theme Site' ) . '</a>'; 469 470 /** 471 * Filter the array of row meta for each theme in the Multisite themes 472 * list table. 473 * 474 * @since 3.1.0 475 * 476 * @param array $theme_meta An array of the theme's metadata, 477 * including the version, author, and 478 * theme URI. 479 * @param string $stylesheet Directory name of the theme. 480 * @param WP_Theme $theme WP_Theme object. 481 * @param string $status Status of the theme. 482 */ 483 $theme_meta = apply_filters( 'theme_row_meta', $theme_meta, $stylesheet, $theme, $status ); 484 echo implode( ' | ', $theme_meta ); 485 486 echo '</div>'; 553 554 $this->column_description( $item ); 555 487 556 echo '</td>'; 488 557 break; … … 491 560 echo "<td class='$column_name column-$column_name{$extra_classes}'>"; 492 561 493 /** 494 * Fires inside each custom column of the Multisite themes list table. 495 * 496 * @since 3.1.0 497 * 498 * @param string $column_name Name of the column. 499 * @param string $stylesheet Directory name of the theme. 500 * @param WP_Theme $theme Current WP_Theme object. 501 */ 502 do_action( 'manage_themes_custom_column', $column_name, $stylesheet, $theme ); 562 $this->column_default( $item, $column_name ); 503 563 504 564 echo "</td>"; 505 } 506 } 565 break; 566 } 567 } 568 } 569 570 /** 571 * @global string $status 572 * @global array $totals 573 * 574 * @param WP_Theme $theme 575 */ 576 public function single_row( $theme ) { 577 global $status, $totals; 578 579 if ( $this->is_site_themes ) { 580 $allowed = $theme->is_allowed( 'site', $this->site_id ); 581 } else { 582 $allowed = $theme->is_allowed( 'network' ); 583 } 584 585 $stylesheet = $theme->get_stylesheet(); 586 587 $class = ! $allowed ? 'inactive' : 'active'; 588 589 $id = sanitize_html_class( $theme->get_stylesheet() ); 590 591 if ( ! empty( $totals['upgrade'] ) && ! empty( $theme->update ) ) { 592 $class .= ' update'; 593 } 594 595 echo "<tr id='$id' class='$class'>"; 596 597 $this->single_row_columns( $theme ); 507 598 508 599 echo "</tr>";
Note: See TracChangeset
for help on using the changeset viewer.