wp/wp-admin/includes/class-wp-posts-list-table.php
changeset 21 48c4eec2b7e6
parent 19 3d72ae0968f4
child 22 8c2e4d02f4ef
equal deleted inserted replaced
20:7b1b88e27a20 21:48c4eec2b7e6
     9 
     9 
    10 /**
    10 /**
    11  * Core class used to implement displaying posts in a list table.
    11  * Core class used to implement displaying posts in a list table.
    12  *
    12  *
    13  * @since 3.1.0
    13  * @since 3.1.0
    14  * @access private
       
    15  *
    14  *
    16  * @see WP_List_Table
    15  * @see WP_List_Table
    17  */
    16  */
    18 class WP_Posts_List_Table extends WP_List_Table {
    17 class WP_Posts_List_Table extends WP_List_Table {
    19 
    18 
    64 	 *
    63 	 *
    65 	 * @since 3.1.0
    64 	 * @since 3.1.0
    66 	 *
    65 	 *
    67 	 * @see WP_List_Table::__construct() for more information on default arguments.
    66 	 * @see WP_List_Table::__construct() for more information on default arguments.
    68 	 *
    67 	 *
    69 	 * @global WP_Post_Type $post_type_object
    68 	 * @global WP_Post_Type $post_type_object Global post type object.
    70 	 * @global wpdb         $wpdb             WordPress database abstraction object.
    69 	 * @global wpdb         $wpdb             WordPress database abstraction object.
    71 	 *
    70 	 *
    72 	 * @param array $args An associative array of arguments.
    71 	 * @param array $args An associative array of arguments.
    73 	 */
    72 	 */
    74 	public function __construct( $args = array() ) {
    73 	public function __construct( $args = array() ) {
   225 			echo get_post_type_object( $this->screen->post_type )->labels->not_found;
   224 			echo get_post_type_object( $this->screen->post_type )->labels->not_found;
   226 		}
   225 		}
   227 	}
   226 	}
   228 
   227 
   229 	/**
   228 	/**
   230 	 * Determine if the current view is the "All" view.
   229 	 * Determines if the current view is the "All" view.
   231 	 *
   230 	 *
   232 	 * @since 4.2.0
   231 	 * @since 4.2.0
   233 	 *
   232 	 *
   234 	 * @return bool Whether the current view is the "All" view.
   233 	 * @return bool Whether the current view is the "All" view.
   235 	 */
   234 	 */
   245 
   244 
   246 		return 1 === count( $vars ) && ! empty( $vars['mode'] );
   245 		return 1 === count( $vars ) && ! empty( $vars['mode'] );
   247 	}
   246 	}
   248 
   247 
   249 	/**
   248 	/**
   250 	 * Helper to create links to edit.php with params.
   249 	 * Creates a link to edit.php with params.
   251 	 *
   250 	 *
   252 	 * @since 4.4.0
   251 	 * @since 4.4.0
   253 	 *
   252 	 *
   254 	 * @param string[] $args      Associative array of URL parameters for the link.
   253 	 * @param string[] $args      Associative array of URL parameters for the link.
   255 	 * @param string   $link_text Link text.
   254 	 * @param string   $link_text Link text.
   329 					'posts'
   328 					'posts'
   330 				),
   329 				),
   331 				number_format_i18n( $this->user_posts_count )
   330 				number_format_i18n( $this->user_posts_count )
   332 			);
   331 			);
   333 
   332 
   334 			$mine = $this->get_edit_link( $mine_args, $mine_inner_html, $class );
   333 			$mine = array(
       
   334 				'url'     => esc_url( add_query_arg( $mine_args, 'edit.php' ) ),
       
   335 				'label'   => $mine_inner_html,
       
   336 				'current' => isset( $_GET['author'] ) && ( $current_user_id === (int) $_GET['author'] ),
       
   337 			);
   335 
   338 
   336 			$all_args['all_posts'] = 1;
   339 			$all_args['all_posts'] = 1;
   337 			$class                 = '';
   340 			$class                 = '';
   338 		}
       
   339 
       
   340 		if ( empty( $class ) && ( $this->is_base_request() || isset( $_REQUEST['all_posts'] ) ) ) {
       
   341 			$class = 'current';
       
   342 		}
   341 		}
   343 
   342 
   344 		$all_inner_html = sprintf(
   343 		$all_inner_html = sprintf(
   345 			/* translators: %s: Number of posts. */
   344 			/* translators: %s: Number of posts. */
   346 			_nx(
   345 			_nx(
   350 				'posts'
   349 				'posts'
   351 			),
   350 			),
   352 			number_format_i18n( $total_posts )
   351 			number_format_i18n( $total_posts )
   353 		);
   352 		);
   354 
   353 
   355 		$status_links['all'] = $this->get_edit_link( $all_args, $all_inner_html, $class );
   354 		$status_links['all'] = array(
       
   355 			'url'     => esc_url( add_query_arg( $all_args, 'edit.php' ) ),
       
   356 			'label'   => $all_inner_html,
       
   357 			'current' => empty( $class ) && ( $this->is_base_request() || isset( $_REQUEST['all_posts'] ) ),
       
   358 		);
   356 
   359 
   357 		if ( $mine ) {
   360 		if ( $mine ) {
   358 			$status_links['mine'] = $mine;
   361 			$status_links['mine'] = $mine;
   359 		}
   362 		}
   360 
   363 
   379 			$status_label = sprintf(
   382 			$status_label = sprintf(
   380 				translate_nooped_plural( $status->label_count, $num_posts->$status_name ),
   383 				translate_nooped_plural( $status->label_count, $num_posts->$status_name ),
   381 				number_format_i18n( $num_posts->$status_name )
   384 				number_format_i18n( $num_posts->$status_name )
   382 			);
   385 			);
   383 
   386 
   384 			$status_links[ $status_name ] = $this->get_edit_link( $status_args, $status_label, $class );
   387 			$status_links[ $status_name ] = array(
       
   388 				'url'     => esc_url( add_query_arg( $status_args, 'edit.php' ) ),
       
   389 				'label'   => $status_label,
       
   390 				'current' => isset( $_REQUEST['post_status'] ) && $status_name === $_REQUEST['post_status'],
       
   391 			);
   385 		}
   392 		}
   386 
   393 
   387 		if ( ! empty( $this->sticky_posts_count ) ) {
   394 		if ( ! empty( $this->sticky_posts_count ) ) {
   388 			$class = ! empty( $_REQUEST['show_sticky'] ) ? 'current' : '';
   395 			$class = ! empty( $_REQUEST['show_sticky'] ) ? 'current' : '';
   389 
   396 
   402 				),
   409 				),
   403 				number_format_i18n( $this->sticky_posts_count )
   410 				number_format_i18n( $this->sticky_posts_count )
   404 			);
   411 			);
   405 
   412 
   406 			$sticky_link = array(
   413 			$sticky_link = array(
   407 				'sticky' => $this->get_edit_link( $sticky_args, $sticky_inner_html, $class ),
   414 				'sticky' => array(
       
   415 					'url'     => esc_url( add_query_arg( $sticky_args, 'edit.php' ) ),
       
   416 					'label'   => $sticky_inner_html,
       
   417 					'current' => ! empty( $_REQUEST['show_sticky'] ),
       
   418 				),
   408 			);
   419 			);
   409 
   420 
   410 			// Sticky comes after Publish, or if not listed, after All.
   421 			// Sticky comes after Publish, or if not listed, after All.
   411 			$split        = 1 + array_search( ( isset( $status_links['publish'] ) ? 'publish' : 'all' ), array_keys( $status_links ), true );
   422 			$split        = 1 + array_search( ( isset( $status_links['publish'] ) ? 'publish' : 'all' ), array_keys( $status_links ), true );
   412 			$status_links = array_merge( array_slice( $status_links, 0, $split ), $sticky_link, array_slice( $status_links, $split ) );
   423 			$status_links = array_merge( array_slice( $status_links, 0, $split ), $sticky_link, array_slice( $status_links, $split ) );
   413 		}
   424 		}
   414 
   425 
   415 		return $status_links;
   426 		return $this->get_views_links( $status_links );
   416 	}
   427 	}
   417 
   428 
   418 	/**
   429 	/**
   419 	 * @return array
   430 	 * @return array
   420 	 */
   431 	 */
   521 			return;
   532 			return;
   522 		}
   533 		}
   523 
   534 
   524 		$displayed_post_format = isset( $_GET['post_format'] ) ? $_GET['post_format'] : '';
   535 		$displayed_post_format = isset( $_GET['post_format'] ) ? $_GET['post_format'] : '';
   525 		?>
   536 		?>
   526 		<label for="filter-by-format" class="screen-reader-text"><?php _e( 'Filter by post format' ); ?></label>
   537 		<label for="filter-by-format" class="screen-reader-text">
       
   538 			<?php
       
   539 			/* translators: Hidden accessibility text. */
       
   540 			_e( 'Filter by post format' );
       
   541 			?>
       
   542 		</label>
   527 		<select name="post_format" id="filter-by-format">
   543 		<select name="post_format" id="filter-by-format">
   528 			<option<?php selected( $displayed_post_format, '' ); ?> value=""><?php _e( 'All formats' ); ?></option>
   544 			<option<?php selected( $displayed_post_format, '' ); ?> value=""><?php _e( 'All formats' ); ?></option>
   529 			<?php
   545 			<?php
   530 			foreach ( $used_post_formats as $used_post_format ) {
   546 			foreach ( $used_post_formats as $used_post_format ) {
   531 				// Post format slug.
   547 				// Post format slug.
   633 			is_post_type_hierarchical( $this->screen->post_type ) ? 'pages' : 'posts',
   649 			is_post_type_hierarchical( $this->screen->post_type ) ? 'pages' : 'posts',
   634 		);
   650 		);
   635 	}
   651 	}
   636 
   652 
   637 	/**
   653 	/**
   638 	 * @return array
   654 	 * @return string[] Array of column titles keyed by their column name.
   639 	 */
   655 	 */
   640 	public function get_columns() {
   656 	public function get_columns() {
   641 		$post_type = $this->screen->post_type;
   657 		$post_type = $this->screen->post_type;
   642 
   658 
   643 		$posts_columns = array();
   659 		$posts_columns = array();
   689 
   705 
   690 		if ( post_type_supports( $post_type, 'comments' )
   706 		if ( post_type_supports( $post_type, 'comments' )
   691 			&& ! in_array( $post_status, array( 'pending', 'draft', 'future' ), true )
   707 			&& ! in_array( $post_status, array( 'pending', 'draft', 'future' ), true )
   692 		) {
   708 		) {
   693 			$posts_columns['comments'] = sprintf(
   709 			$posts_columns['comments'] = sprintf(
   694 				'<span class="vers comment-grey-bubble" title="%1$s"><span class="screen-reader-text">%2$s</span></span>',
   710 				'<span class="vers comment-grey-bubble" title="%1$s" aria-hidden="true"></span><span class="screen-reader-text">%2$s</span>',
   695 				esc_attr__( 'Comments' ),
   711 				esc_attr__( 'Comments' ),
       
   712 				/* translators: Hidden accessibility text. */
   696 				__( 'Comments' )
   713 				__( 'Comments' )
   697 			);
   714 			);
   698 		}
   715 		}
   699 
   716 
   700 		$posts_columns['date'] = __( 'Date' );
   717 		$posts_columns['date'] = __( 'Date' );
   741 
   758 
   742 	/**
   759 	/**
   743 	 * @return array
   760 	 * @return array
   744 	 */
   761 	 */
   745 	protected function get_sortable_columns() {
   762 	protected function get_sortable_columns() {
   746 		return array(
   763 
   747 			'title'    => 'title',
   764 		$post_type = $this->screen->post_type;
   748 			'parent'   => 'parent',
   765 
   749 			'comments' => 'comment_count',
   766 		if ( 'page' === $post_type ) {
   750 			'date'     => array( 'date', true ),
   767 			if ( isset( $_GET['orderby'] ) ) {
   751 		);
   768 				$title_orderby_text = __( 'Table ordered by Title.' );
       
   769 			} else {
       
   770 				$title_orderby_text = __( 'Table ordered by Hierarchical Menu Order and Title.' );
       
   771 			}
       
   772 
       
   773 			$sortables = array(
       
   774 				'title'    => array( 'title', false, __( 'Title' ), $title_orderby_text, 'asc' ),
       
   775 				'parent'   => array( 'parent', false ),
       
   776 				'comments' => array( 'comment_count', false, __( 'Comments' ), __( 'Table ordered by Comments.' ) ),
       
   777 				'date'     => array( 'date', true, __( 'Date' ), __( 'Table ordered by Date.' ) ),
       
   778 			);
       
   779 		} else {
       
   780 			$sortables = array(
       
   781 				'title'    => array( 'title', false, __( 'Title' ), __( 'Table ordered by Title.' ) ),
       
   782 				'parent'   => array( 'parent', false ),
       
   783 				'comments' => array( 'comment_count', false, __( 'Comments' ), __( 'Table ordered by Comments.' ) ),
       
   784 				'date'     => array( 'date', true, __( 'Date' ), __( 'Table ordered by Date.' ), 'desc' ),
       
   785 			);
       
   786 		}
       
   787 		// Custom Post Types: there's a filter for that, see get_column_info().
       
   788 
       
   789 		return $sortables;
   752 	}
   790 	}
   753 
   791 
   754 	/**
   792 	/**
   755 	 * @global WP_Query $wp_query WordPress Query object.
   793 	 * @global WP_Query $wp_query WordPress Query object.
   756 	 * @global int $per_page
   794 	 * @global int $per_page
   788 		}
   826 		}
   789 
   827 
   790 		if ( post_type_supports( $post_type, 'comments' ) ) {
   828 		if ( post_type_supports( $post_type, 'comments' ) ) {
   791 			$this->comment_pending_count = get_pending_comments_num( $post_ids );
   829 			$this->comment_pending_count = get_pending_comments_num( $post_ids );
   792 		}
   830 		}
       
   831 		update_post_author_caches( $posts );
   793 
   832 
   794 		foreach ( $posts as $post ) {
   833 		foreach ( $posts as $post ) {
   795 			$this->single_row( $post, $level );
   834 			$this->single_row( $post, $level );
   796 		}
   835 		}
   797 	}
   836 	}
   857 
   896 
   858 			if ( $count >= $start ) {
   897 			if ( $count >= $start ) {
   859 				$to_display[ $page->ID ] = $level;
   898 				$to_display[ $page->ID ] = $level;
   860 			}
   899 			}
   861 
   900 
   862 			$count++;
   901 			++$count;
   863 
   902 
   864 			if ( isset( $children_pages ) ) {
   903 			if ( isset( $children_pages ) ) {
   865 				$this->_page_rows( $children_pages, $count, $page->ID, $level + 1, $pagenum, $per_page, $to_display );
   904 				$this->_page_rows( $children_pages, $count, $page->ID, $level + 1, $pagenum, $per_page, $to_display );
   866 			}
   905 			}
   867 		}
   906 		}
   876 
   915 
   877 					if ( $count >= $start ) {
   916 					if ( $count >= $start ) {
   878 						$to_display[ $op->ID ] = 0;
   917 						$to_display[ $op->ID ] = 0;
   879 					}
   918 					}
   880 
   919 
   881 					$count++;
   920 					++$count;
   882 				}
   921 				}
   883 			}
   922 			}
   884 		}
   923 		}
   885 
   924 
   886 		$ids = array_keys( $to_display );
   925 		$ids = array_keys( $to_display );
   887 		_prime_post_caches( $ids );
   926 		_prime_post_caches( $ids );
       
   927 		$_posts = array_map( 'get_post', $ids );
       
   928 		update_post_author_caches( $_posts );
   888 
   929 
   889 		if ( ! isset( $GLOBALS['post'] ) ) {
   930 		if ( ! isset( $GLOBALS['post'] ) ) {
   890 			$GLOBALS['post'] = reset( $ids );
   931 			$GLOBALS['post'] = reset( $ids );
   891 		}
   932 		}
   892 
   933 
   895 			$this->single_row( $page_id, $level );
   936 			$this->single_row( $page_id, $level );
   896 		}
   937 		}
   897 	}
   938 	}
   898 
   939 
   899 	/**
   940 	/**
   900 	 * Given a top level page ID, display the nested hierarchy of sub-pages
   941 	 * Displays the nested hierarchy of sub-pages together with paging
   901 	 * together with paging support
   942 	 * support, based on a top level page ID.
   902 	 *
   943 	 *
   903 	 * @since 3.1.0 (Standalone function exists since 2.6.0)
   944 	 * @since 3.1.0 (Standalone function exists since 2.6.0)
   904 	 * @since 4.2.0 Added the `$to_display` parameter.
   945 	 * @since 4.2.0 Added the `$to_display` parameter.
   905 	 *
   946 	 *
   906 	 * @param array $children_pages
   947 	 * @param array $children_pages
   949 
   990 
   950 				$num_parents = count( $my_parents );
   991 				$num_parents = count( $my_parents );
   951 
   992 
   952 				while ( $my_parent = array_pop( $my_parents ) ) {
   993 				while ( $my_parent = array_pop( $my_parents ) ) {
   953 					$to_display[ $my_parent->ID ] = $level - $num_parents;
   994 					$to_display[ $my_parent->ID ] = $level - $num_parents;
   954 					$num_parents--;
   995 					--$num_parents;
   955 				}
   996 				}
   956 			}
   997 			}
   957 
   998 
   958 			if ( $count >= $start ) {
   999 			if ( $count >= $start ) {
   959 				$to_display[ $page->ID ] = $level;
  1000 				$to_display[ $page->ID ] = $level;
   960 			}
  1001 			}
   961 
  1002 
   962 			$count++;
  1003 			++$count;
   963 
  1004 
   964 			$this->_page_rows( $children_pages, $count, $page->ID, $level + 1, $pagenum, $per_page, $to_display );
  1005 			$this->_page_rows( $children_pages, $count, $page->ID, $level + 1, $pagenum, $per_page, $to_display );
   965 		}
  1006 		}
   966 
  1007 
   967 		unset( $children_pages[ $parent_page ] ); // Required in order to keep track of orphans.
  1008 		unset( $children_pages[ $parent_page ] ); // Required in order to keep track of orphans.
   976 	 * @param WP_Post $item The current WP_Post object.
  1017 	 * @param WP_Post $item The current WP_Post object.
   977 	 */
  1018 	 */
   978 	public function column_cb( $item ) {
  1019 	public function column_cb( $item ) {
   979 		// Restores the more descriptive, specific name for use within this method.
  1020 		// Restores the more descriptive, specific name for use within this method.
   980 		$post = $item;
  1021 		$post = $item;
       
  1022 
   981 		$show = current_user_can( 'edit_post', $post->ID );
  1023 		$show = current_user_can( 'edit_post', $post->ID );
   982 
  1024 
   983 		/**
  1025 		/**
   984 		 * Filters whether to show the bulk edit checkbox for a post in its list table.
  1026 		 * Filters whether to show the bulk edit checkbox for a post in its list table.
   985 		 *
  1027 		 *
   990 		 * @param bool    $show Whether to show the checkbox.
  1032 		 * @param bool    $show Whether to show the checkbox.
   991 		 * @param WP_Post $post The current WP_Post object.
  1033 		 * @param WP_Post $post The current WP_Post object.
   992 		 */
  1034 		 */
   993 		if ( apply_filters( 'wp_list_table_show_post_checkbox', $show, $post ) ) :
  1035 		if ( apply_filters( 'wp_list_table_show_post_checkbox', $show, $post ) ) :
   994 			?>
  1036 			?>
   995 			<label class="screen-reader-text" for="cb-select-<?php the_ID(); ?>">
  1037 			<input id="cb-select-<?php the_ID(); ?>" type="checkbox" name="post[]" value="<?php the_ID(); ?>" />
       
  1038 			<label for="cb-select-<?php the_ID(); ?>">
       
  1039 				<span class="screen-reader-text">
   996 				<?php
  1040 				<?php
   997 					/* translators: %s: Post title. */
  1041 					/* translators: %s: Post title. */
   998 					printf( __( 'Select %s' ), _draft_or_post_title() );
  1042 					printf( __( 'Select %s' ), _draft_or_post_title() );
   999 				?>
  1043 				?>
       
  1044 				</span>
  1000 			</label>
  1045 			</label>
  1001 			<input id="cb-select-<?php the_ID(); ?>" type="checkbox" name="post[]" value="<?php the_ID(); ?>" />
       
  1002 			<div class="locked-indicator">
  1046 			<div class="locked-indicator">
  1003 				<span class="locked-indicator-icon" aria-hidden="true"></span>
  1047 				<span class="locked-indicator-icon" aria-hidden="true"></span>
  1004 				<span class="screen-reader-text">
  1048 				<span class="screen-reader-text">
  1005 				<?php
  1049 				<?php
  1006 				printf(
  1050 				printf(
  1007 					/* translators: %s: Post title. */
  1051 					/* translators: Hidden accessibility text. %s: Post title. */
  1008 					__( '&#8220;%s&#8221; is locked' ),
  1052 					__( '&#8220;%s&#8221; is locked' ),
  1009 					_draft_or_post_title()
  1053 					_draft_or_post_title()
  1010 				);
  1054 				);
  1011 				?>
  1055 				?>
  1012 				</span>
  1056 				</span>
  1052 
  1096 
  1053 					if ( is_null( $parent ) ) {
  1097 					if ( is_null( $parent ) ) {
  1054 						break;
  1098 						break;
  1055 					}
  1099 					}
  1056 
  1100 
  1057 					$this->current_level++;
  1101 					++$this->current_level;
  1058 					$find_main_page = (int) $parent->post_parent;
  1102 					$find_main_page = (int) $parent->post_parent;
  1059 
  1103 
  1060 					if ( ! isset( $parent_name ) ) {
  1104 					if ( ! isset( $parent_name ) ) {
  1061 						/** This filter is documented in wp-includes/post-template.php */
  1105 						/** This filter is documented in wp-includes/post-template.php */
  1062 						$parent_name = apply_filters( 'the_title', $parent->post_title, $parent->ID );
  1106 						$parent_name = apply_filters( 'the_title', $parent->post_title, $parent->ID );
  1122 			} else {
  1166 			} else {
  1123 				echo esc_html( get_the_excerpt() );
  1167 				echo esc_html( get_the_excerpt() );
  1124 			}
  1168 			}
  1125 		}
  1169 		}
  1126 
  1170 
  1127 		get_inline_data( $post );
  1171 		/** This filter is documented in wp-admin/includes/class-wp-posts-list-table.php */
       
  1172 		$quick_edit_enabled = apply_filters( 'quick_edit_enabled_for_post_type', true, $post->post_type );
       
  1173 
       
  1174 		if ( $quick_edit_enabled ) {
       
  1175 			get_inline_data( $post );
       
  1176 		}
  1128 	}
  1177 	}
  1129 
  1178 
  1130 	/**
  1179 	/**
  1131 	 * Handles the post date column output.
  1180 	 * Handles the post date column output.
  1132 	 *
  1181 	 *
  1183 		if ( $status ) {
  1232 		if ( $status ) {
  1184 			echo $status . '<br />';
  1233 			echo $status . '<br />';
  1185 		}
  1234 		}
  1186 
  1235 
  1187 		/**
  1236 		/**
  1188 		 * Filters the published time of the post.
  1237 		 * Filters the published, scheduled, or unpublished time of the post.
  1189 		 *
  1238 		 *
  1190 		 * @since 2.5.1
  1239 		 * @since 2.5.1
  1191 		 * @since 5.5.0 Removed the difference between 'excerpt' and 'list' modes.
  1240 		 * @since 5.5.0 Removed the difference between 'excerpt' and 'list' modes.
  1192 		 *              The published time and date are both displayed now,
  1241 		 *              The published time and date are both displayed now,
  1193 		 *              which is equivalent to the previous 'excerpt' mode.
  1242 		 *              which is equivalent to the previous 'excerpt' mode.
  1249 
  1298 
  1250 		if ( 'categories' === $column_name ) {
  1299 		if ( 'categories' === $column_name ) {
  1251 			$taxonomy = 'category';
  1300 			$taxonomy = 'category';
  1252 		} elseif ( 'tags' === $column_name ) {
  1301 		} elseif ( 'tags' === $column_name ) {
  1253 			$taxonomy = 'post_tag';
  1302 			$taxonomy = 'post_tag';
  1254 		} elseif ( 0 === strpos( $column_name, 'taxonomy-' ) ) {
  1303 		} elseif ( str_starts_with( $column_name, 'taxonomy-' ) ) {
  1255 			$taxonomy = substr( $column_name, 9 );
  1304 			$taxonomy = substr( $column_name, 9 );
  1256 		} else {
  1305 		} else {
  1257 			$taxonomy = false;
  1306 			$taxonomy = false;
  1258 		}
  1307 		}
  1259 
  1308 
  1413 		if ( $primary !== $column_name ) {
  1462 		if ( $primary !== $column_name ) {
  1414 			return '';
  1463 			return '';
  1415 		}
  1464 		}
  1416 
  1465 
  1417 		// Restores the more descriptive, specific name for use within this method.
  1466 		// Restores the more descriptive, specific name for use within this method.
  1418 		$post             = $item;
  1467 		$post = $item;
       
  1468 
  1419 		$post_type_object = get_post_type_object( $post->post_type );
  1469 		$post_type_object = get_post_type_object( $post->post_type );
  1420 		$can_edit_post    = current_user_can( 'edit_post', $post->ID );
  1470 		$can_edit_post    = current_user_can( 'edit_post', $post->ID );
  1421 		$actions          = array();
  1471 		$actions          = array();
  1422 		$title            = _draft_or_post_title();
  1472 		$title            = _draft_or_post_title();
  1423 
  1473 
  1428 				/* translators: %s: Post title. */
  1478 				/* translators: %s: Post title. */
  1429 				esc_attr( sprintf( __( 'Edit &#8220;%s&#8221;' ), $title ) ),
  1479 				esc_attr( sprintf( __( 'Edit &#8220;%s&#8221;' ), $title ) ),
  1430 				__( 'Edit' )
  1480 				__( 'Edit' )
  1431 			);
  1481 			);
  1432 
  1482 
  1433 			if ( 'wp_block' !== $post->post_type ) {
  1483 			/**
       
  1484 			 * Filters whether Quick Edit should be enabled for the given post type.
       
  1485 			 *
       
  1486 			 * @since 6.4.0
       
  1487 			 *
       
  1488 			 * @param bool   $enable    Whether to enable the Quick Edit functionality. Default true.
       
  1489 			 * @param string $post_type Post type name.
       
  1490 			 */
       
  1491 			$quick_edit_enabled = apply_filters( 'quick_edit_enabled_for_post_type', true, $post->post_type );
       
  1492 
       
  1493 			if ( $quick_edit_enabled && 'wp_block' !== $post->post_type ) {
  1434 				$actions['inline hide-if-no-js'] = sprintf(
  1494 				$actions['inline hide-if-no-js'] = sprintf(
  1435 					'<button type="button" class="button-link editinline" aria-label="%s" aria-expanded="false">%s</button>',
  1495 					'<button type="button" class="button-link editinline" aria-label="%s" aria-expanded="false">%s</button>',
  1436 					/* translators: %s: Post title. */
  1496 					/* translators: %s: Post title. */
  1437 					esc_attr( sprintf( __( 'Quick edit &#8220;%s&#8221; inline' ), $title ) ),
  1497 					esc_attr( sprintf( __( 'Quick edit &#8220;%s&#8221; inline' ), $title ) ),
  1438 					__( 'Quick&nbsp;Edit' )
  1498 					__( 'Quick&nbsp;Edit' )
  2031 				<input type="hidden" name="screen" value="<?php echo esc_attr( $screen->id ); ?>" />
  2091 				<input type="hidden" name="screen" value="<?php echo esc_attr( $screen->id ); ?>" />
  2032 				<?php if ( ! $bulk && ! post_type_supports( $screen->post_type, 'author' ) ) : ?>
  2092 				<?php if ( ! $bulk && ! post_type_supports( $screen->post_type, 'author' ) ) : ?>
  2033 					<input type="hidden" name="post_author" value="<?php echo esc_attr( $post->post_author ); ?>" />
  2093 					<input type="hidden" name="post_author" value="<?php echo esc_attr( $post->post_author ); ?>" />
  2034 				<?php endif; ?>
  2094 				<?php endif; ?>
  2035 
  2095 
  2036 				<div class="notice notice-error notice-alt inline hidden">
  2096 				<?php
  2037 					<p class="error"></p>
  2097 				wp_admin_notice(
  2038 				</div>
  2098 					'<p class="error"></p>',
       
  2099 					array(
       
  2100 						'type'               => 'error',
       
  2101 						'additional_classes' => array( 'notice-alt', 'inline', 'hidden' ),
       
  2102 						'paragraph_wrap'     => false,
       
  2103 					)
       
  2104 				);
       
  2105 				?>
  2039 			</div>
  2106 			</div>
  2040 		</div> <!-- end of .inline-edit-wrapper -->
  2107 		</div> <!-- end of .inline-edit-wrapper -->
  2041 
  2108 
  2042 			</td></tr>
  2109 			</td></tr>
  2043 
  2110 
  2044 			<?php
  2111 			<?php
  2045 			$bulk++;
  2112 			++$bulk;
  2046 		endwhile;
  2113 		endwhile;
  2047 		?>
  2114 		?>
  2048 		</tbody></table>
  2115 		</tbody></table>
  2049 		</form>
  2116 		</form>
  2050 		<?php
  2117 		<?php