Ticket #29881: 29881.4.diff
File 29881.4.diff, 31.8 KB (added by , 9 years ago) |
---|
-
src/wp-admin/includes/class-wp-comments-list-table.php
462 462 protected function handle_row_actions( $comment, $column_name, $primary ) { 463 463 global $comment_status; 464 464 465 if ( $primary !== $column_name ) { 466 return ''; 467 } 468 465 469 if ( ! $this->user_can ) { 466 470 return; 467 471 } 468 472 469 if ( $primary !== $column_name ) {470 return '';471 }472 473 473 $post = get_post(); 474 474 475 475 $the_comment_status = wp_get_comment_status( $comment->comment_ID ); -
src/wp-admin/includes/class-wp-links-list-table.php
310 310 * @return string Row action output for links. 311 311 */ 312 312 protected function handle_row_actions( $link, $column_name, $primary ) { 313 if ( $primary === $column_name ) { 314 $edit_link = get_edit_bookmark_link( $link ); 313 if ( $primary !== $column_name ) { 314 return ''; 315 } 315 316 316 $actions = array(); 317 $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>'; 318 $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("link.php?action=delete&link_id=$link->link_id", 'delete-bookmark_' . $link->link_id) . "' onclick=\"if ( confirm( '" . esc_js(sprintf(__("You are about to delete this link '%s'\n 'Cancel' to stop, 'OK' to delete."), $link->link_name)) . "' ) ) { return true;}return false;\">" . __('Delete') . "</a>"; 319 return $this->row_actions($actions); 320 } 317 $edit_link = get_edit_bookmark_link( $link ); 318 319 $actions = array(); 320 $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>'; 321 $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("link.php?action=delete&link_id=$link->link_id", 'delete-bookmark_' . $link->link_id) . "' onclick=\"if ( confirm( '" . esc_js(sprintf(__("You are about to delete this link '%s'\n 'Cancel' to stop, 'OK' to delete."), $link->link_name)) . "' ) ) { return true;}return false;\">" . __('Delete') . "</a>"; 322 return $this->row_actions( $actions ); 321 323 } 322 324 } -
src/wp-admin/includes/class-wp-list-table.php
1218 1218 echo '<th scope="row" class="check-column">'; 1219 1219 echo $this->column_cb( $item ); 1220 1220 echo '</th>'; 1221 } 1222 elseif ( method_exists( $this, 'column_' . $column_name ) ) { 1221 } elseif ( method_exists( $this, '_column_' . $column_name ) ) { 1222 echo call_user_func( 1223 array( $this, '_column_' . $column_name ), 1224 $item, 1225 $classes, 1226 $data, 1227 $primary 1228 ); 1229 } elseif ( method_exists( $this, 'column_' . $column_name ) ) { 1223 1230 echo "<td $attributes>"; 1224 1231 echo call_user_func( array( $this, 'column_' . $column_name ), $item ); 1225 1232 echo $this->handle_row_actions( $item, $column_name, $primary ); 1226 1233 echo "</td>"; 1227 } 1228 else { 1234 } else { 1229 1235 echo "<td $attributes>"; 1230 1236 echo $this->column_default( $item, $column_name ); 1231 1237 echo $this->handle_row_actions( $item, $column_name, $primary ); -
src/wp-admin/includes/class-wp-media-list-table.php
657 657 * @return string Row actions output for media attachments. 658 658 */ 659 659 protected function handle_row_actions( $post, $column_name, $primary ) { 660 if ( $primary === $column_name ) { 661 $att_title = _draft_or_post_title(); 662 return $this->row_actions( $this->_get_row_actions( $post, $att_title ) ); 660 if ( $primary !== $column_name ) { 661 return ''; 663 662 } 663 664 $att_title = _draft_or_post_title(); 665 return $this->row_actions( $this->_get_row_actions( $post, $att_title ) ); 664 666 } 665 667 } -
src/wp-admin/includes/class-wp-ms-sites-list-table.php
409 409 } 410 410 411 411 /** 412 * Handles columns output for a single row.413 412 * 414 * @since 4.3.0415 * @access public416 *417 * @param array $item Current site.418 */419 public function single_row_columns( $item ) {420 list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info();421 422 foreach ( $columns as $column_name => $column_display_name ) {423 $classes = "$column_name column-$column_name";424 if ( $primary === $column_name ) {425 $classes .= ' has-row-actions column-primary';426 }427 428 if ( in_array( $column_name, $hidden ) ) {429 $classes .= ' hidden';430 }431 432 $data = 'data-colname="' . wp_strip_all_tags( $column_display_name ) . '"';433 434 $attributes = "class='$classes' $data";435 436 if ( 'cb' === $column_name ) {437 echo '<th scope="row" class="check-column">';438 439 $this->column_cb( $item );440 441 echo '</th>';442 } elseif ( 'id' === $column_name ) {443 ?>444 <th scope="row">445 <?php echo $item['blog_id'] ?>446 </th>447 <?php448 } elseif ( method_exists( $this, 'column_' . $column_name ) ) {449 echo "<td $attributes>";450 451 echo call_user_func( array( $this, 'column_' . $column_name ), $item );452 453 echo $this->handle_row_actions( $item, $column_name, $primary );454 echo "</td>";455 } else {456 echo "<td $attributes>";457 458 echo $this->column_default( $item, $column_name );459 460 echo $this->handle_row_actions( $item, $column_name, $primary );461 echo "</td>";462 }463 }464 }465 466 /**467 *468 413 * @global string $mode 469 414 */ 470 415 public function display_rows() { … … 510 455 * @return string Row actions output. 511 456 */ 512 457 protected function handle_row_actions( $blog, $column_name, $primary ) { 513 if ( $primary === $column_name ) { 514 $blogname = untrailingslashit( $blog['domain'] . $blog['path'] ); 458 if ( $primary !== $column_name ) { 459 return; 460 } 515 461 516 // Preordered. 517 $actions = array( 518 'edit' => '', 'backend' => '', 519 'activate' => '', 'deactivate' => '', 520 'archive' => '', 'unarchive' => '', 521 'spam' => '', 'unspam' => '', 522 'delete' => '', 523 'visit' => '', 524 ); 462 $blogname = untrailingslashit( $blog['domain'] . $blog['path'] ); 525 463 526 $actions['edit'] = '<span class="edit"><a href="' . esc_url( network_admin_url( 'site-info.php?id=' . $blog['blog_id'] ) ) . '">' . __( 'Edit' ) . '</a></span>'; 527 $actions['backend'] = "<span class='backend'><a href='" . esc_url( get_admin_url( $blog['blog_id'] ) ) . "' class='edit'>" . __( 'Dashboard' ) . '</a></span>'; 528 if ( get_current_site()->blog_id != $blog['blog_id'] ) { 529 if ( $blog['deleted'] == '1' ) { 530 $actions['activate'] = '<span class="activate"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=activateblog&id=' . $blog['blog_id'] ), 'activateblog_' . $blog['blog_id'] ) ) . '">' . __( 'Activate' ) . '</a></span>'; 531 } else { 532 $actions['deactivate'] = '<span class="activate"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=deactivateblog&id=' . $blog['blog_id'] ), 'deactivateblog_' . $blog['blog_id'] ) ) . '">' . __( 'Deactivate' ) . '</a></span>'; 533 } 464 // Preordered. 465 $actions = array( 466 'edit' => '', 'backend' => '', 467 'activate' => '', 'deactivate' => '', 468 'archive' => '', 'unarchive' => '', 469 'spam' => '', 'unspam' => '', 470 'delete' => '', 471 'visit' => '', 472 ); 534 473 535 if ( $blog['archived'] == '1' ) { 536 $actions['unarchive'] = '<span class="archive"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=unarchiveblog&id=' . $blog['blog_id'] ), 'unarchiveblog_' . $blog['blog_id'] ) ) . '">' . __( 'Unarchive' ) . '</a></span>'; 537 } else { 538 $actions['archive'] = '<span class="archive"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=archiveblog&id=' . $blog['blog_id'] ), 'archiveblog_' . $blog['blog_id'] ) ) . '">' . _x( 'Archive', 'verb; site' ) . '</a></span>'; 539 } 474 $actions['edit'] = '<span class="edit"><a href="' . esc_url( network_admin_url( 'site-info.php?id=' . $blog['blog_id'] ) ) . '">' . __( 'Edit' ) . '</a></span>'; 475 $actions['backend'] = "<span class='backend'><a href='" . esc_url( get_admin_url( $blog['blog_id'] ) ) . "' class='edit'>" . __( 'Dashboard' ) . '</a></span>'; 476 if ( get_current_site()->blog_id != $blog['blog_id'] ) { 477 if ( $blog['deleted'] == '1' ) { 478 $actions['activate'] = '<span class="activate"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=activateblog&id=' . $blog['blog_id'] ), 'activateblog_' . $blog['blog_id'] ) ) . '">' . __( 'Activate' ) . '</a></span>'; 479 } else { 480 $actions['deactivate'] = '<span class="activate"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=deactivateblog&id=' . $blog['blog_id'] ), 'deactivateblog_' . $blog['blog_id'] ) ) . '">' . __( 'Deactivate' ) . '</a></span>'; 481 } 540 482 541 if ( $blog['spam'] == '1' ) {542 $actions['unspam'] = '<span class="spam"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=unspamblog&id=' . $blog['blog_id'] ), 'unspamblog_' . $blog['blog_id'] ) ) . '">' . _x( 'Not Spam', 'site' ) . '</a></span>';543 544 $actions['spam'] = '<span class="spam"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=spamblog&id=' . $blog['blog_id'] ), 'spamblog_' . $blog['blog_id'] ) ) . '">' . _x( 'Spam', 'site' ) . '</a></span>';545 483 if ( $blog['archived'] == '1' ) { 484 $actions['unarchive'] = '<span class="archive"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=unarchiveblog&id=' . $blog['blog_id'] ), 'unarchiveblog_' . $blog['blog_id'] ) ) . '">' . __( 'Unarchive' ) . '</a></span>'; 485 } else { 486 $actions['archive'] = '<span class="archive"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=archiveblog&id=' . $blog['blog_id'] ), 'archiveblog_' . $blog['blog_id'] ) ) . '">' . _x( 'Archive', 'verb; site' ) . '</a></span>'; 487 } 546 488 547 if ( current_user_can( 'delete_site', $blog['blog_id'] ) ) { 548 $actions['delete'] = '<span class="delete"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=deleteblog&id=' . $blog['blog_id'] ), 'deleteblog_' . $blog['blog_id'] ) ) . '">' . __( 'Delete' ) . '</a></span>'; 549 } 489 if ( $blog['spam'] == '1' ) { 490 $actions['unspam'] = '<span class="spam"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=unspamblog&id=' . $blog['blog_id'] ), 'unspamblog_' . $blog['blog_id'] ) ) . '">' . _x( 'Not Spam', 'site' ) . '</a></span>'; 491 } else { 492 $actions['spam'] = '<span class="spam"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=spamblog&id=' . $blog['blog_id'] ), 'spamblog_' . $blog['blog_id'] ) ) . '">' . _x( 'Spam', 'site' ) . '</a></span>'; 550 493 } 551 494 552 $actions['visit'] = "<span class='view'><a href='" . esc_url( get_home_url( $blog['blog_id'], '/' ) ) . "' rel='permalink'>" . __( 'Visit' ) . '</a></span>'; 495 if ( current_user_can( 'delete_site', $blog['blog_id'] ) ) { 496 $actions['delete'] = '<span class="delete"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=deleteblog&id=' . $blog['blog_id'] ), 'deleteblog_' . $blog['blog_id'] ) ) . '">' . __( 'Delete' ) . '</a></span>'; 497 } 498 } 553 499 554 /** 555 * Filter the action links displayed for each site in the Sites list table. 556 * 557 * The 'Edit', 'Dashboard', 'Delete', and 'Visit' links are displayed by 558 * default for each site. The site's status determines whether to show the 559 * 'Activate' or 'Deactivate' link, 'Unarchive' or 'Archive' links, and 560 * 'Not Spam' or 'Spam' link for each site. 561 * 562 * @since 3.1.0 563 * 564 * @param array $actions An array of action links to be displayed. 565 * @param int $blog_id The site ID. 566 * @param string $blogname Site path, formatted depending on whether it is a sub-domain 567 * or subdirectory multisite install. 568 */ 569 $actions = apply_filters( 'manage_sites_action_links', array_filter( $actions ), $blog['blog_id'], $blogname ); 570 return $this->row_actions( $actions ); 571 } 500 $actions['visit'] = "<span class='view'><a href='" . esc_url( get_home_url( $blog['blog_id'], '/' ) ) . "' rel='permalink'>" . __( 'Visit' ) . '</a></span>'; 501 502 /** 503 * Filter the action links displayed for each site in the Sites list table. 504 * 505 * The 'Edit', 'Dashboard', 'Delete', and 'Visit' links are displayed by 506 * default for each site. The site's status determines whether to show the 507 * 'Activate' or 'Deactivate' link, 'Unarchive' or 'Archive' links, and 508 * 'Not Spam' or 'Spam' link for each site. 509 * 510 * @since 3.1.0 511 * 512 * @param array $actions An array of action links to be displayed. 513 * @param int $blog_id The site ID. 514 * @param string $blogname Site path, formatted depending on whether it is a sub-domain 515 * or subdirectory multisite install. 516 */ 517 $actions = apply_filters( 'manage_sites_action_links', array_filter( $actions ), $blog['blog_id'], $blogname ); 518 return $this->row_actions( $actions ); 572 519 } 573 520 } -
src/wp-admin/includes/class-wp-ms-users-list-table.php
257 257 } 258 258 259 259 /** 260 * 261 * @param WP_User $user 262 * @param string $classes 263 * @param string $data 264 * @param string $primary 265 */ 266 public function _column_blogs( $user, $classes, $data, $primary ) { 267 echo '<td class="', $classes, ' has-row-actions" ', $data, '>'; 268 echo $this->column_blogs( $user ); 269 echo $this->handle_row_actions( $user, 'blogs', $primary ); 270 echo '</td>'; 271 } 272 273 /** 260 274 * Handles the blogs/sites column output. 261 275 * 262 276 * @since 4.3.0 … … 335 349 echo apply_filters( 'manage_users_custom_column', '', $column_name, $user->ID ); 336 350 } 337 351 338 /**339 * Handles columns output for a single row in the table.340 *341 * @since 4.3.0342 * @access public343 *344 * @param WP_User $item The current WP_User object.345 */346 public function single_row_columns( $item ) {347 list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info();348 349 foreach ( $columns as $column_name => $column_display_name ) {350 $classes = "$column_name column-$column_name";351 if ( $primary === $column_name || 'blogs' === $column_name ) {352 $classes .= ' has-row-actions';353 }354 355 if ( $primary === $column_name ) {356 $classes .= ' column-primary';357 }358 359 if ( in_array( $column_name, $hidden ) ) {360 $classes .= ' hidden';361 }362 363 $data = 'data-colname="' . wp_strip_all_tags( $column_display_name ) . '"';364 365 $attributes = "class='$classes' $data";366 367 if ( 'cb' === $column_name ) {368 echo '<th scope="row" class="check-column">';369 370 $this->column_cb( $item );371 372 echo '</th>';373 } elseif ( method_exists( $this, 'column_' . $column_name ) ) {374 echo "<td $attributes>";375 376 call_user_func( array( $this, 'column_' . $column_name ), $item );377 378 echo $this->handle_row_actions( $item, $column_name, $primary );379 echo "</td>";380 } else {381 echo "<td $attributes>";382 383 $this->column_default( $item, $column_name );384 385 echo $this->handle_row_actions( $item, $column_name, $primary );386 echo "</td>";387 }388 }389 }390 391 352 public function display_rows() { 392 353 foreach ( $this->items as $user ) { 393 354 $class = ''; … … 432 393 * @return string Row actions output for users in Multisite. 433 394 */ 434 395 protected function handle_row_actions( $user, $column_name, $primary ) { 396 if ( $primary !== $column_name ) { 397 return ''; 398 } 399 435 400 $super_admins = get_super_admins(); 436 401 $edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), get_edit_user_link( $user->ID ) ) ); 437 402 438 if ( $primary === $column_name ) { 439 $actions = array(); 440 $actions['edit'] = '<a href="' . $edit_link . '">' . __( 'Edit' ) . '</a>'; 403 $actions = array(); 404 $actions['edit'] = '<a href="' . $edit_link . '">' . __( 'Edit' ) . '</a>'; 441 405 442 443 444 406 if ( current_user_can( 'delete_user', $user->ID ) && ! in_array( $user->user_login, $super_admins ) ) { 407 $actions['delete'] = '<a href="' . $delete = esc_url( network_admin_url( add_query_arg( '_wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), wp_nonce_url( 'users.php', 'deleteuser' ) . '&action=deleteuser&id=' . $user->ID ) ) ) . '" class="delete">' . __( 'Delete' ) . '</a>'; 408 } 445 409 446 /** 447 * Filter the action links displayed under each user in the Network Admin Users list table. 448 * 449 * @since 3.2.0 450 * 451 * @param array $actions An array of action links to be displayed. 452 * Default 'Edit', 'Delete'. 453 * @param WP_User $user WP_User object. 454 */ 455 $actions = apply_filters( 'ms_user_row_actions', $actions, $user ); 456 return $this->row_actions( $actions ); 457 } 410 /** 411 * Filter the action links displayed under each user in the Network Admin Users list table. 412 * 413 * @since 3.2.0 414 * 415 * @param array $actions An array of action links to be displayed. 416 * Default 'Edit', 'Delete'. 417 * @param WP_User $user WP_User object. 418 */ 419 $actions = apply_filters( 'ms_user_row_actions', $actions, $user ); 420 return $this->row_actions( $actions ); 458 421 } 459 422 } -
src/wp-admin/includes/class-wp-posts-list-table.php
698 698 } 699 699 700 700 /** 701 * @since 4.3.0 702 * @access protected 703 * 704 * @param WP_Post $post 705 * @param string $classes 706 */ 707 protected function _column_title( $post, $classes ) { 708 echo '<td class="' . $classes . ' page-title">'; 709 echo $this->column_title( $post ); 710 echo $this->handle_row_actions( $post, 'title', 'title' ); 711 echo '</td>'; 712 } 713 714 /** 701 715 * Handles the title column output. 702 716 * 703 717 * @since 4.3.0 … … 973 987 } 974 988 975 989 /** 976 * Handles columns output for a single row in the table.977 *978 * @since 4.3.0979 * @access public980 *981 * @param WP_Post $item The current WP_Post object.982 */983 public function single_row_columns( $item ) {984 list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info();985 986 foreach ( $columns as $column_name => $column_display_name ) {987 $classes = "$column_name column-$column_name";988 if ( $primary === $column_name ) {989 $classes .= ' has-row-actions column-primary';990 }991 992 if ( 'title' === $column_name ) {993 $classes .= ' page-title'; // Special addition for title column994 }995 996 if ( in_array( $column_name, $hidden ) ) {997 $classes .= ' hidden';998 }999 1000 // Comments column uses HTML in the display name with screen reader text.1001 // Instead of using esc_attr(), we strip tags to get closer to a user-friendly string.1002 $data = 'data-colname="' . wp_strip_all_tags( $column_display_name ) . '"';1003 1004 $attributes = "class='$classes' $data";1005 1006 if ( 'cb' === $column_name ) {1007 echo '<th scope="row" class="check-column">';1008 1009 $this->column_cb( $item );1010 1011 echo '</th>';1012 } else {1013 echo "<td $attributes>";1014 1015 if ( method_exists( $this, 'column_' . $column_name ) ) {1016 call_user_func( array( $this, 'column_' . $column_name ), $item );1017 } else {1018 $this->column_default( $item, $column_name );1019 }1020 1021 echo $this->handle_row_actions( $item, $column_name, $primary );1022 echo '</td>';1023 }1024 }1025 }1026 1027 /**1028 990 * @global WP_Post $post 1029 991 * 1030 992 * @param int|WP_Post $post … … 1084 1046 * @return string Row actions output for posts. 1085 1047 */ 1086 1048 protected function handle_row_actions( $post, $column_name, $primary ) { 1087 $title = _draft_or_post_title(); 1049 if ( $primary !== $column_name ) { 1050 return ''; 1051 } 1088 1052 1089 if ( $primary === $column_name ) { 1090 $post_type_object = get_post_type_object( $post->post_type ); 1091 $can_edit_post = current_user_can( 'edit_post', $post->ID ); 1092 $actions = array(); 1053 $post_type_object = get_post_type_object( $post->post_type ); 1054 $can_edit_post = current_user_can( 'edit_post', $post->ID ); 1055 $actions = array(); 1093 1056 1094 1095 1096 1097 1057 if ( $can_edit_post && 'trash' != $post->post_status ) { 1058 $actions['edit'] = '<a href="' . get_edit_post_link( $post->ID ) . '" title="' . esc_attr__( 'Edit this item' ) . '">' . __( 'Edit' ) . '</a>'; 1059 $actions['inline hide-if-no-js'] = '<a href="#" class="editinline" title="' . esc_attr__( 'Edit this item inline' ) . '">' . __( 'Quick Edit' ) . '</a>'; 1060 } 1098 1061 1099 1100 1101 1102 1103 1104 1105 1106 1062 if ( current_user_can( 'delete_post', $post->ID ) ) { 1063 if ( 'trash' == $post->post_status ) 1064 $actions['untrash'] = "<a title='" . esc_attr__( 'Restore this item from the Trash' ) . "' href='" . wp_nonce_url( admin_url( sprintf( $post_type_object->_edit_link . '&action=untrash', $post->ID ) ), 'untrash-post_' . $post->ID ) . "'>" . __( 'Restore' ) . "</a>"; 1065 elseif ( EMPTY_TRASH_DAYS ) 1066 $actions['trash'] = "<a class='submitdelete' title='" . esc_attr__( 'Move this item to the Trash' ) . "' href='" . get_delete_post_link( $post->ID ) . "'>" . __( 'Trash' ) . "</a>"; 1067 if ( 'trash' == $post->post_status || !EMPTY_TRASH_DAYS ) 1068 $actions['delete'] = "<a class='submitdelete' title='" . esc_attr__( 'Delete this item permanently' ) . "' href='" . get_delete_post_link( $post->ID, '', true ) . "'>" . __( 'Delete Permanently' ) . "</a>"; 1069 } 1107 1070 1108 if ( $post_type_object->public ) { 1109 if ( in_array( $post->post_status, array( 'pending', 'draft', 'future' ) ) ) { 1110 if ( $can_edit_post ) { 1111 $preview_link = set_url_scheme( get_permalink( $post->ID ) ); 1112 /** This filter is documented in wp-admin/includes/meta-boxes.php */ 1113 $preview_link = apply_filters( 'preview_post_link', add_query_arg( 'preview', 'true', $preview_link ), $post ); 1114 $actions['view'] = '<a href="' . esc_url( $preview_link ) . '" title="' . esc_attr( sprintf( __( 'Preview “%s”' ), $title ) ) . '" rel="permalink">' . __( 'Preview' ) . '</a>'; 1115 } 1116 } elseif ( 'trash' != $post->post_status ) { 1117 $actions['view'] = '<a href="' . get_permalink( $post->ID ) . '" title="' . esc_attr( sprintf( __( 'View “%s”' ), $title ) ) . '" rel="permalink">' . __( 'View' ) . '</a>'; 1071 if ( $post_type_object->public ) { 1072 $title = _draft_or_post_title(); 1073 if ( in_array( $post->post_status, array( 'pending', 'draft', 'future' ) ) ) { 1074 if ( $can_edit_post ) { 1075 $preview_link = set_url_scheme( get_permalink( $post->ID ) ); 1076 /** This filter is documented in wp-admin/includes/meta-boxes.php */ 1077 $preview_link = apply_filters( 'preview_post_link', add_query_arg( 'preview', 'true', $preview_link ), $post ); 1078 $actions['view'] = '<a href="' . esc_url( $preview_link ) . '" title="' . esc_attr( sprintf( __( 'Preview “%s”' ), $title ) ) . '" rel="permalink">' . __( 'Preview' ) . '</a>'; 1118 1079 } 1080 } elseif ( 'trash' != $post->post_status ) { 1081 $actions['view'] = '<a href="' . get_permalink( $post->ID ) . '" title="' . esc_attr( sprintf( __( 'View “%s”' ), $title ) ) . '" rel="permalink">' . __( 'View' ) . '</a>'; 1119 1082 } 1083 } 1120 1084 1121 1085 if ( is_post_type_hierarchical( $post->post_type ) ) { 1122 1086 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1087 /** 1088 * Filter the array of row action links on the Pages list table. 1089 * 1090 * The filter is evaluated only for hierarchical post types. 1091 * 1092 * @since 2.8.0 1093 * 1094 * @param array $actions An array of row action links. Defaults are 1095 * 'Edit', 'Quick Edit', 'Restore, 'Trash', 1096 * 'Delete Permanently', 'Preview', and 'View'. 1097 * @param WP_Post $post The post object. 1098 */ 1099 $actions = apply_filters( 'page_row_actions', $actions, $post ); 1100 } else { 1137 1101 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1102 /** 1103 * Filter the array of row action links on the Posts list table. 1104 * 1105 * The filter is evaluated only for non-hierarchical post types. 1106 * 1107 * @since 2.8.0 1108 * 1109 * @param array $actions An array of row action links. Defaults are 1110 * 'Edit', 'Quick Edit', 'Restore, 'Trash', 1111 * 'Delete Permanently', 'Preview', and 'View'. 1112 * @param WP_Post $post The post object. 1113 */ 1114 $actions = apply_filters( 'post_row_actions', $actions, $post ); 1115 } 1152 1116 1153 return $this->row_actions( $actions ); 1154 } 1117 return $this->row_actions( $actions ); 1155 1118 } 1156 1119 1157 1120 /** -
src/wp-admin/includes/class-wp-terms-list-table.php
396 396 * @return string Row actions output for terms. 397 397 */ 398 398 protected function handle_row_actions( $tag, $column_name, $primary ) { 399 if ( $primary !== $column_name ) { 400 return ''; 401 } 402 399 403 $taxonomy = $this->screen->taxonomy; 400 404 $tax = get_taxonomy( $taxonomy ); 401 405 $default_term = get_option( 'default_' . $taxonomy ); … … 402 406 403 407 $edit_link = esc_url( get_edit_term_link( $tag->term_id, $taxonomy, $this->screen->post_type ) ); 404 408 405 if ( $primary === $column_name ) { 406 $actions = array(); 407 if ( current_user_can( $tax->cap->edit_terms ) ) { 408 $actions['edit'] = '<a href="' . $edit_link . '">' . __( 'Edit' ) . '</a>'; 409 $actions['inline hide-if-no-js'] = '<a href="#" class="editinline">' . __( 'Quick Edit' ) . '</a>'; 410 } 411 if ( current_user_can( $tax->cap->delete_terms ) && $tag->term_id != $default_term ) 412 $actions['delete'] = "<a class='delete-tag' href='" . wp_nonce_url( "edit-tags.php?action=delete&taxonomy=$taxonomy&tag_ID=$tag->term_id", 'delete-tag_' . $tag->term_id ) . "'>" . __( 'Delete' ) . "</a>"; 413 if ( $tax->public ) 414 $actions['view'] = '<a href="' . get_term_link( $tag ) . '">' . __( 'View' ) . '</a>'; 409 $actions = array(); 410 if ( current_user_can( $tax->cap->edit_terms ) ) { 411 $actions['edit'] = '<a href="' . $edit_link . '">' . __( 'Edit' ) . '</a>'; 412 $actions['inline hide-if-no-js'] = '<a href="#" class="editinline">' . __( 'Quick Edit' ) . '</a>'; 413 } 414 if ( current_user_can( $tax->cap->delete_terms ) && $tag->term_id != $default_term ) 415 $actions['delete'] = "<a class='delete-tag' href='" . wp_nonce_url( "edit-tags.php?action=delete&taxonomy=$taxonomy&tag_ID=$tag->term_id", 'delete-tag_' . $tag->term_id ) . "'>" . __( 'Delete' ) . "</a>"; 416 if ( $tax->public ) 417 $actions['view'] = '<a href="' . get_term_link( $tag ) . '">' . __( 'View' ) . '</a>'; 415 418 416 417 418 419 420 421 422 423 424 425 426 419 /** 420 * Filter the action links displayed for each term in the Tags list table. 421 * 422 * @since 2.8.0 423 * @deprecated 3.0.0 Use {$taxonomy}_row_actions instead. 424 * 425 * @param array $actions An array of action links to be displayed. Default 426 * 'Edit', 'Quick Edit', 'Delete', and 'View'. 427 * @param object $tag Term object. 428 */ 429 $actions = apply_filters( 'tag_row_actions', $actions, $tag ); 427 430 428 429 430 431 432 433 434 435 436 437 438 439 431 /** 432 * Filter the action links displayed for each term in the terms list table. 433 * 434 * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug. 435 * 436 * @since 3.0.0 437 * 438 * @param array $actions An array of action links to be displayed. Default 439 * 'Edit', 'Quick Edit', 'Delete', and 'View'. 440 * @param object $tag Term object. 441 */ 442 $actions = apply_filters( "{$taxonomy}_row_actions", $actions, $tag ); 440 443 441 return $this->row_actions( $actions ); 442 } 444 return $this->row_actions( $actions ); 443 445 } 444 446 445 447 /**