From 248e0fd2c9e7fd495d12b045e4eb93522e7c6c21 Mon Sep 17 00:00:00 2001 From: scribu Date: Sun, 5 Sep 2010 16:53:59 +0000 Subject: [PATCH] Introduce WP_List_Table::row_actions(). See #14579 git-svn-id: https://develop.svn.wordpress.org/trunk@15571 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/includes/default-list-tables.php | 83 ++++++----------------- wp-admin/includes/list-table.php | 27 ++++++++ 2 files changed, 48 insertions(+), 62 deletions(-) diff --git a/wp-admin/includes/default-list-tables.php b/wp-admin/includes/default-list-tables.php index 85a6f68c30..973fe3de35 100644 --- a/wp-admin/includes/default-list-tables.php +++ b/wp-admin/includes/default-list-tables.php @@ -455,15 +455,7 @@ class WP_Posts_Table extends WP_List_Table { } $actions = apply_filters( $this->hierarchical_display ? 'page_row_actions' : 'post_row_actions', $actions, $post ); - $action_count = count( $actions ); - $i = 0; - echo '
'; - foreach ( $actions as $action => $link ) { - ++$i; - ( $i == $action_count ) ? $sep = '' : $sep = ' | '; - echo "$link$sep"; - } - echo '
'; + echo $this->row_actions( $actions ); get_inline_data( $post ); break; @@ -1115,14 +1107,7 @@ foreach ( $columns as $column_name => $column_display_name ) { $actions['view'] = '' . __( 'View' ) . ''; } $actions = apply_filters( 'media_row_actions', $actions, $post ); - $action_count = count( $actions ); - $i = 0; - echo '
'; - foreach ( $actions as $action => $link ) { - $sep = ( ++$i == $action_count ) ? '' : ' | '; - echo "$link$sep"; - } - echo '
'; + echo $this->row_actions( $actions ); ?> $column_display_name ) { else echo strtoupper( str_replace( 'image/', '', get_post_mime_type() ) ); ?> -
ID ) ) @@ -1285,14 +1269,8 @@ foreach ( $columns as $column_name => $column_display_name ) { $actions['attach'] = ''.__( 'Attach' ).''; $actions = apply_filters( 'media_row_actions', $actions, $post ); - $action_count = count( $actions ); - $i = 0; - foreach ( $actions as $action => $link ) { - $sep = ( ++$i == $action_count ) ? '' : ' | '; - echo "$link$sep"; - } + echo $this->row_actions( $actions ); ?> -
post_author ); echo $author->display_name; ?> @@ -1564,6 +1542,7 @@ class WP_Terms_Table extends WP_List_Table { break; case 'name': $out .= '' . $name . '
'; + $actions = array(); if ( current_user_can( $tax->cap->edit_terms ) ) { $actions['edit'] = '' . __( 'Edit' ) . ''; @@ -1575,15 +1554,7 @@ class WP_Terms_Table extends WP_List_Table { $actions = apply_filters( 'tag_row_actions', $actions, $tag ); $actions = apply_filters( "${taxonomy}_row_actions", $actions, $tag ); - $action_count = count( $actions ); - $i = 0; - $out .= '
'; - foreach ( $actions as $action => $link ) { - ++$i; - ( $i == $action_count ) ? $sep = '' : $sep = ' | '; - $out .= "$link$sep"; - } - $out .= '
'; + $out .= $this->row_actions( $actions ); $out .= '