Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 42 additions & 8 deletions src/wp-admin/includes/class-wp-media-list-table.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,20 @@ class WP_Media_List_Table extends WP_List_Table {
* @var array
*/
protected $comment_pending_count = array();

/**
* Whether the list table is for detached media.
*
* @since 3.1.0
* @var bool
*/
private $detached;

/**
* Whether the list table is for trash.
*
* @since 3.1.0
* @var bool
*/
private $is_trash;

/**
Expand Down Expand Up @@ -53,17 +64,25 @@ public function __construct( $args = array() ) {
}

/**
* Checks if the current user has permissions to upload files.
*
* @since 3.1.0
*
* @return bool Whether the user can upload files.
*/
public function ajax_user_can() {
return current_user_can( 'upload_files' );
}

/**
* Prepares the list of items for displaying.
*
* @since 3.1.0
*
* @global string $mode List table view mode.
* @global WP_Query $wp_query WordPress Query object.
* @global array $post_mime_types
* @global array $avail_post_mime_types
* @global array $post_mime_types An array of post mime types.
* @global array $avail_post_mime_types An array of available post mime types.
*/
public function prepare_items() {
global $mode, $wp_query, $post_mime_types, $avail_post_mime_types;
Expand Down Expand Up @@ -117,8 +136,12 @@ public function prepare_items() {
}

/**
* @global array $post_mime_types
* @global array $avail_post_mime_types
* Gets an array of links for the available views on this table.
*
* @since 3.1.0
*
* @global array $post_mime_types An array of post mime types.
* @global array $avail_post_mime_types An array of available post mime types.
* @return array<string, string> An array of links for the available views.
*/
protected function get_views() {
Expand Down Expand Up @@ -198,7 +221,11 @@ protected function get_bulk_actions() {
}

/**
* @param string $which
* Displays extra controls between bulk actions and pagination.
*
* @since 3.1.0
*
* @param string $which The location of the extra table nav: 'top' or 'bottom'.
*/
protected function extra_tablenav( $which ) {
if ( 'bar' !== $which ) {
Expand Down Expand Up @@ -253,6 +280,9 @@ public function has_items() {
}

/**
* Displays a message when no media items are found.
*
* @since 3.1.0
*/
public function no_items() {
if ( $this->is_trash ) {
Expand Down Expand Up @@ -762,8 +792,12 @@ protected function get_default_primary_column_name() {
}

/**
* @param WP_Post $post
* @param string $att_title
* Gets the row actions for a media item.
*
* @since 3.1.0
*
* @param WP_Post $post The current WP_Post object.
* @param string $att_title The attachment title.
* @return array<string, string> An array of row actions.
*/
private function _get_row_actions( $post, $att_title ) {
Expand Down
33 changes: 28 additions & 5 deletions src/wp-admin/includes/class-wp-ms-sites-list-table.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@ public function __construct( $args = array() ) {
}

/**
* @return bool
* Checks if the current user has permissions to manage sites.
*
* @since 3.1.0
*
* @return bool Whether the user can manage sites.
*/
public function ajax_user_can() {
return current_user_can( 'manage_sites' );
Expand All @@ -62,7 +66,7 @@ public function ajax_user_can() {
* @since 3.1.0
*
* @global string $mode List table view mode.
* @global string $s
* @global string $s Search string.
* @global wpdb $wpdb WordPress database abstraction object.
*/
public function prepare_items() {
Expand Down Expand Up @@ -206,6 +210,9 @@ public function prepare_items() {
}

/**
* Displays a message when no sites are found.
*
* @since 3.1.0
*/
public function no_items() {
_e( 'No sites found.' );
Expand Down Expand Up @@ -286,7 +293,11 @@ protected function get_views() {
}

/**
* @return array
* Gets an associative array of bulk actions for this table.
*
* @since 3.1.0
*
* @return array An associative array of bulk actions.
*/
protected function get_bulk_actions() {
$actions = array();
Expand All @@ -300,6 +311,10 @@ protected function get_bulk_actions() {
}

/**
* Displays the pagination.
*
* @since 3.1.0
*
* @global string $mode List table view mode.
*
* @param string $which The location of the pagination nav markup: Either 'top' or 'bottom'.
Expand Down Expand Up @@ -359,6 +374,10 @@ protected function extra_tablenav( $which ) {
}

/**
* Gets an array of column titles keyed by their column name.
*
* @since 3.1.0
*
* @return string[] Array of column titles keyed by their column name.
*/
public function get_columns() {
Expand Down Expand Up @@ -386,7 +405,11 @@ public function get_columns() {
}

/**
* @return array
* Gets an array of sortable columns.
*
* @since 3.1.0
*
* @return array An array of sortable columns.
*/
protected function get_sortable_columns() {

Expand Down Expand Up @@ -640,7 +663,7 @@ public function display_rows() {
*
* @since 5.3.0
*
* @param array $site
* @param array $site The site to get states for.
*/
protected function site_states( $site ) {
$site_states = array();
Expand Down
Loading