Make WordPress Core


Ignore:
Timestamp:
09/05/2010 04:53:59 PM (14 years ago)
Author:
scribu
Message:

Introduce WP_List_Table::row_actions(). See #14579

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/default-list-tables.php

    r15569 r15571  
    456456
    457457                $actions = apply_filters( $this->hierarchical_display ? 'page_row_actions' : 'post_row_actions', $actions, $post );
    458                 $action_count = count( $actions );
    459                 $i = 0;
    460                 echo '<div class="row-actions">';
    461                 foreach ( $actions as $action => $link ) {
    462                     ++$i;
    463                     ( $i == $action_count ) ? $sep = '' : $sep = ' | ';
    464                     echo "<span class='$action'>$link$sep</span>";
    465                 }
    466                 echo '</div>';
     458                echo $this->row_actions( $actions );
    467459
    468460                get_inline_data( $post );
     
    11161108        }
    11171109        $actions = apply_filters( 'media_row_actions', $actions, $post );
    1118         $action_count = count( $actions );
    1119         $i = 0;
    1120         echo '<div class="row-actions">';
    1121         foreach ( $actions as $action => $link ) {
    1122             $sep = ( ++$i == $action_count ) ? '' : ' | ';
    1123             echo "<span class='$action'>$link$sep</span>";
    1124         }
    1125         echo '</div>';
     1110        echo $this->row_actions( $actions );
    11261111?>
    11271112        </td>
     
    12691254                echo strtoupper( str_replace( 'image/', '', get_post_mime_type() ) );
    12701255?>
    1271             <div class="row-actions">
    12721256<?php
    12731257            $actions = array();
     
    12861270            $actions = apply_filters( 'media_row_actions', $actions, $post );
    12871271
    1288             $action_count = count( $actions );
    1289             $i = 0;
    1290             foreach ( $actions as $action => $link ) {
    1291                 $sep = ( ++$i == $action_count ) ? '' : ' | ';
    1292                 echo "<span class='$action'>$link$sep</span>";
    1293             }
    1294 ?>
    1295             </div>
     1272            echo $this->row_actions( $actions );
     1273?>
    12961274        </td>
    12971275        <td class="author column-author">
     
    15651543                case 'name':
    15661544                    $out .= '<td ' . $attributes . '><strong><a class="row-title" href="' . $edit_link . '" title="' . esc_attr( sprintf( __( 'Edit &#8220;%s&#8221;' ), $name ) ) . '">' . $name . '</a></strong><br />';
     1545
    15671546                    $actions = array();
    15681547                    if ( current_user_can( $tax->cap->edit_terms ) ) {
     
    15761555                    $actions = apply_filters( "${taxonomy}_row_actions", $actions, $tag );
    15771556
    1578                     $action_count = count( $actions );
    1579                     $i = 0;
    1580                     $out .= '<div class="row-actions">';
    1581                     foreach ( $actions as $action => $link ) {
    1582                         ++$i;
    1583                         ( $i == $action_count ) ? $sep = '' : $sep = ' | ';
    1584                         $out .= "<span class='$action'>$link$sep</span>";
    1585                     }
    1586                     $out .= '</div>';
     1557                    $out .= $this->row_actions( $actions );
    15871558                    $out .= '<div class="hidden" id="inline_' . $qe_data->term_id . '">';
    15881559                    $out .= '<div class="name">' . $qe_data->name . '</div>';
     
    18451816                $actions['remove'] = "<a class='submitdelete' href='" . wp_nonce_url( "users.php?action=remove&amp;user=$user_object->ID", 'bulk-users' ) . "'>" . __( 'Remove' ) . "</a>";
    18461817            $actions = apply_filters( 'user_row_actions', $actions, $user_object );
    1847             $action_count = count( $actions );
    1848             $i = 0;
    1849             $edit .= '<div class="row-actions">';
    1850             foreach ( $actions as $action => $link ) {
    1851                 ++$i;
    1852                 ( $i == $action_count ) ? $sep = '' : $sep = ' | ';
    1853                 $edit .= "<span class='$action'>$link$sep</span>";
    1854             }
    1855             $edit .= '</div>';
     1818            $edit .= $this->row_actions( $actions );
    18561819
    18571820            // Set up the checkbox ( because the user is editable, otherwise its empty )
     
    24612424                    case 'name':
    24622425                        echo "<td $attributes><strong><a class='row-title' href='$edit_link' title='" . esc_attr( sprintf( __( 'Edit &#8220;%s&#8221;' ), $link->link_name ) ) . "'>$link->link_name</a></strong><br />";
     2426
    24632427                        $actions = array();
    24642428                        $actions['edit'] = '<a href="' . $edit_link . '">' . __( 'Edit' ) . '</a>';
    24652429                        $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url( "link.php?action=delete&amp;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>";
    2466                         $action_count = count( $actions );
    2467                         $i = 0;
    2468                         echo '<div class="row-actions">';
    2469                         foreach ( $actions as $action => $linkaction ) {
    2470                             ++$i;
    2471                             ( $i == $action_count ) ? $sep = '' : $sep = ' | ';
    2472                             echo "<span class='$action'>$linkaction$sep</span>";
    2473                         }
    2474                         echo '</div>';
     2430                        echo $this->row_actions( $actions );
     2431
    24752432                        echo '</td>';
    24762433                        break;
     
    27282685                            $actions['visit']   = "<span class='view'><a href='" . esc_url( get_home_url( $blog['blog_id'] ) ) . "' rel='permalink'>" . __( 'Visit' ) . '</a></span>';
    27292686                            $actions = array_filter( $actions );
    2730                             if ( count( $actions ) ) : ?>
    2731                             <div class="row-actions">
    2732                                 <?php echo implode( ' | ', $actions ); ?>
    2733                             </div>
    2734                             <?php endif; ?>
     2687                            echo $this->row_actions( $actions );
     2688                    ?>
    27352689                        </td>
    27362690                    <?php
     
    29652919                            ?></strong>
    29662920                            <br/>
    2967                             <div class="row-actions">
    2968                                 <span class="edit"><a href="<?php echo esc_url( admin_url( $edit_link ) ); ?>"><?php _e( 'Edit' ); ?></a></span>
    2969                                 <?php if ( ! in_array( $user['user_login'], $super_admins ) ) { ?>
    2970                                 | <span class="delete"><a href="<?php echo $delete  = esc_url( network_admin_url( add_query_arg( '_wp_http_referer', urlencode( stripslashes( $_SERVER['REQUEST_URI'] ) ), wp_nonce_url( 'edit.php', 'deleteuser' ) . '&amp;action=deleteuser&amp;id=' . $user['ID'] ) ) ); ?>" class="delete"><?php _e( 'Delete' ); ?></a></span>
    2971                                 <?php } ?>
     2921                            <?php
     2922                                $actions = array();
     2923                                $actions['edit'] = '<a href="' . esc_url( admin_url( $edit_link ) ) . '">' . __( 'Edit' ) . '</a>';
     2924
     2925                                if ( ! in_array( $user['user_login'], $super_admins ) ) {
     2926                                    $actions['delete'] = '<a href="' . $delete = esc_url( network_admin_url( add_query_arg( '_wp_http_referer', urlencode( stripslashes( $_SERVER['REQUEST_URI'] ) ), wp_nonce_url( 'edit.php', 'deleteuser' ) . '&amp;action=deleteuser&amp;id=' . $user['ID'] ) ) ) . '" class="delete">' . __( 'Delete' ) . '</a>';
     2927                                }
     2928
     2929                                echo $this->row_actions( $actions );
     2930                            ?>
    29722931                            </div>
    29732932                        </td>
Note: See TracChangeset for help on using the changeset viewer.