wp/wp-admin/includes/class-wp-posts-list-table.php
changeset 16 a86126ab1dd4
parent 9 177826044cd9
child 18 be944660c56a
equal deleted inserted replaced
15:3d4e9c994f10 16:a86126ab1dd4
    65 	 * @since 3.1.0
    65 	 * @since 3.1.0
    66 	 *
    66 	 *
    67 	 * @see WP_List_Table::__construct() for more information on default arguments.
    67 	 * @see WP_List_Table::__construct() for more information on default arguments.
    68 	 *
    68 	 *
    69 	 * @global WP_Post_Type $post_type_object
    69 	 * @global WP_Post_Type $post_type_object
    70 	 * @global wpdb         $wpdb
    70 	 * @global wpdb         $wpdb             WordPress database abstraction object.
    71 	 *
    71 	 *
    72 	 * @param array $args An associative array of arguments.
    72 	 * @param array $args An associative array of arguments.
    73 	 */
    73 	 */
    74 	public function __construct( $args = array() ) {
    74 	public function __construct( $args = array() ) {
    75 		global $post_type_object, $wpdb;
    75 		global $post_type_object, $wpdb;
   107 
   107 
   108 		if ( $this->user_posts_count && ! current_user_can( $post_type_object->cap->edit_others_posts ) && empty( $_REQUEST['post_status'] ) && empty( $_REQUEST['all_posts'] ) && empty( $_REQUEST['author'] ) && empty( $_REQUEST['show_sticky'] ) ) {
   108 		if ( $this->user_posts_count && ! current_user_can( $post_type_object->cap->edit_others_posts ) && empty( $_REQUEST['post_status'] ) && empty( $_REQUEST['all_posts'] ) && empty( $_REQUEST['author'] ) && empty( $_REQUEST['show_sticky'] ) ) {
   109 			$_GET['author'] = get_current_user_id();
   109 			$_GET['author'] = get_current_user_id();
   110 		}
   110 		}
   111 
   111 
   112 		if ( 'post' === $post_type && $sticky_posts = get_option( 'sticky_posts' ) ) {
   112 		$sticky_posts = get_option( 'sticky_posts' );
       
   113 		if ( 'post' === $post_type && $sticky_posts ) {
   113 			$sticky_posts             = implode( ', ', array_map( 'absint', (array) $sticky_posts ) );
   114 			$sticky_posts             = implode( ', ', array_map( 'absint', (array) $sticky_posts ) );
   114 			$this->sticky_posts_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT( 1 ) FROM $wpdb->posts WHERE post_type = %s AND post_status NOT IN ('trash', 'auto-draft') AND ID IN ($sticky_posts)", $post_type ) );
   115 			$this->sticky_posts_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT( 1 ) FROM $wpdb->posts WHERE post_type = %s AND post_status NOT IN ('trash', 'auto-draft') AND ID IN ($sticky_posts)", $post_type ) );
   115 		}
   116 		}
   116 	}
   117 	}
   117 
   118 
   132 	public function ajax_user_can() {
   133 	public function ajax_user_can() {
   133 		return current_user_can( get_post_type_object( $this->screen->post_type )->cap->edit_posts );
   134 		return current_user_can( get_post_type_object( $this->screen->post_type )->cap->edit_posts );
   134 	}
   135 	}
   135 
   136 
   136 	/**
   137 	/**
       
   138 	 * @global string   $mode             List table view mode.
   137 	 * @global array    $avail_post_stati
   139 	 * @global array    $avail_post_stati
   138 	 * @global WP_Query $wp_query
   140 	 * @global WP_Query $wp_query         WordPress Query object.
   139 	 * @global int      $per_page
   141 	 * @global int      $per_page
   140 	 * @global string   $mode
       
   141 	 */
   142 	 */
   142 	public function prepare_items() {
   143 	public function prepare_items() {
   143 		global $avail_post_stati, $wp_query, $per_page, $mode;
   144 		global $mode, $avail_post_stati, $wp_query, $per_page;
   144 
   145 
   145 		// is going to call wp()
   146 		if ( ! empty( $_REQUEST['mode'] ) ) {
       
   147 			$mode = 'excerpt' === $_REQUEST['mode'] ? 'excerpt' : 'list';
       
   148 			set_user_setting( 'posts_list_mode', $mode );
       
   149 		} else {
       
   150 			$mode = get_user_setting( 'posts_list_mode', 'list' );
       
   151 		}
       
   152 
       
   153 		// Is going to call wp().
   146 		$avail_post_stati = wp_edit_posts_query();
   154 		$avail_post_stati = wp_edit_posts_query();
   147 
   155 
   148 		$this->set_hierarchical_display( is_post_type_hierarchical( $this->screen->post_type ) && 'menu_order title' === $wp_query->query['orderby'] );
   156 		$this->set_hierarchical_display( is_post_type_hierarchical( $this->screen->post_type ) && 'menu_order title' === $wp_query->query['orderby'] );
   149 
   157 
   150 		$post_type = $this->screen->post_type;
   158 		$post_type = $this->screen->post_type;
   158 		} elseif ( $wp_query->found_posts || $this->get_pagenum() === 1 ) {
   166 		} elseif ( $wp_query->found_posts || $this->get_pagenum() === 1 ) {
   159 			$total_items = $wp_query->found_posts;
   167 			$total_items = $wp_query->found_posts;
   160 		} else {
   168 		} else {
   161 			$post_counts = (array) wp_count_posts( $post_type, 'readable' );
   169 			$post_counts = (array) wp_count_posts( $post_type, 'readable' );
   162 
   170 
   163 			if ( isset( $_REQUEST['post_status'] ) && in_array( $_REQUEST['post_status'], $avail_post_stati ) ) {
   171 			if ( isset( $_REQUEST['post_status'] ) && in_array( $_REQUEST['post_status'], $avail_post_stati, true ) ) {
   164 				$total_items = $post_counts[ $_REQUEST['post_status'] ];
   172 				$total_items = $post_counts[ $_REQUEST['post_status'] ];
   165 			} elseif ( isset( $_REQUEST['show_sticky'] ) && $_REQUEST['show_sticky'] ) {
   173 			} elseif ( isset( $_REQUEST['show_sticky'] ) && $_REQUEST['show_sticky'] ) {
   166 				$total_items = $this->sticky_posts_count;
   174 				$total_items = $this->sticky_posts_count;
   167 			} elseif ( isset( $_GET['author'] ) && $_GET['author'] == get_current_user_id() ) {
   175 			} elseif ( isset( $_GET['author'] ) && get_current_user_id() == $_GET['author'] ) {
   168 				$total_items = $this->user_posts_count;
   176 				$total_items = $this->user_posts_count;
   169 			} else {
   177 			} else {
   170 				$total_items = array_sum( $post_counts );
   178 				$total_items = array_sum( $post_counts );
   171 
   179 
   172 				// Subtract post types that are not included in the admin all list.
   180 				// Subtract post types that are not included in the admin all list.
   174 					$total_items -= $post_counts[ $state ];
   182 					$total_items -= $post_counts[ $state ];
   175 				}
   183 				}
   176 			}
   184 			}
   177 		}
   185 		}
   178 
   186 
   179 		if ( ! empty( $_REQUEST['mode'] ) ) {
   187 		$this->is_trash = isset( $_REQUEST['post_status'] ) && 'trash' === $_REQUEST['post_status'];
   180 			$mode = $_REQUEST['mode'] === 'excerpt' ? 'excerpt' : 'list';
       
   181 			set_user_setting( 'posts_list_mode', $mode );
       
   182 		} else {
       
   183 			$mode = get_user_setting( 'posts_list_mode', 'list' );
       
   184 		}
       
   185 
       
   186 		$this->is_trash = isset( $_REQUEST['post_status'] ) && $_REQUEST['post_status'] === 'trash';
       
   187 
   188 
   188 		$this->set_pagination_args(
   189 		$this->set_pagination_args(
   189 			array(
   190 			array(
   190 				'total_items' => $total_items,
   191 				'total_items' => $total_items,
   191 				'per_page'    => $per_page,
   192 				'per_page'    => $per_page,
   241 	 * @return string The formatted link string.
   242 	 * @return string The formatted link string.
   242 	 */
   243 	 */
   243 	protected function get_edit_link( $args, $label, $class = '' ) {
   244 	protected function get_edit_link( $args, $label, $class = '' ) {
   244 		$url = add_query_arg( $args, 'edit.php' );
   245 		$url = add_query_arg( $args, 'edit.php' );
   245 
   246 
   246 		$class_html = $aria_current = '';
   247 		$class_html   = '';
       
   248 		$aria_current = '';
   247 		if ( ! empty( $class ) ) {
   249 		if ( ! empty( $class ) ) {
   248 			$class_html = sprintf(
   250 			$class_html = sprintf(
   249 				' class="%s"',
   251 				' class="%s"',
   250 				esc_attr( $class )
   252 				esc_attr( $class )
   251 			);
   253 			);
   301 				'post_type' => $post_type,
   303 				'post_type' => $post_type,
   302 				'author'    => $current_user_id,
   304 				'author'    => $current_user_id,
   303 			);
   305 			);
   304 
   306 
   305 			$mine_inner_html = sprintf(
   307 			$mine_inner_html = sprintf(
       
   308 				/* translators: %s: Number of posts. */
   306 				_nx(
   309 				_nx(
   307 					'Mine <span class="count">(%s)</span>',
   310 					'Mine <span class="count">(%s)</span>',
   308 					'Mine <span class="count">(%s)</span>',
   311 					'Mine <span class="count">(%s)</span>',
   309 					$this->user_posts_count,
   312 					$this->user_posts_count,
   310 					'posts'
   313 					'posts'
   321 		if ( empty( $class ) && ( $this->is_base_request() || isset( $_REQUEST['all_posts'] ) ) ) {
   324 		if ( empty( $class ) && ( $this->is_base_request() || isset( $_REQUEST['all_posts'] ) ) ) {
   322 			$class = 'current';
   325 			$class = 'current';
   323 		}
   326 		}
   324 
   327 
   325 		$all_inner_html = sprintf(
   328 		$all_inner_html = sprintf(
       
   329 			/* translators: %s: Number of posts. */
   326 			_nx(
   330 			_nx(
   327 				'All <span class="count">(%s)</span>',
   331 				'All <span class="count">(%s)</span>',
   328 				'All <span class="count">(%s)</span>',
   332 				'All <span class="count">(%s)</span>',
   329 				$total_posts,
   333 				$total_posts,
   330 				'posts'
   334 				'posts'
   340 		foreach ( get_post_stati( array( 'show_in_admin_status_list' => true ), 'objects' ) as $status ) {
   344 		foreach ( get_post_stati( array( 'show_in_admin_status_list' => true ), 'objects' ) as $status ) {
   341 			$class = '';
   345 			$class = '';
   342 
   346 
   343 			$status_name = $status->name;
   347 			$status_name = $status->name;
   344 
   348 
   345 			if ( ! in_array( $status_name, $avail_post_stati ) || empty( $num_posts->$status_name ) ) {
   349 			if ( ! in_array( $status_name, $avail_post_stati, true ) || empty( $num_posts->$status_name ) ) {
   346 				continue;
   350 				continue;
   347 			}
   351 			}
   348 
   352 
   349 			if ( isset( $_REQUEST['post_status'] ) && $status_name === $_REQUEST['post_status'] ) {
   353 			if ( isset( $_REQUEST['post_status'] ) && $status_name === $_REQUEST['post_status'] ) {
   350 				$class = 'current';
   354 				$class = 'current';
   370 				'post_type'   => $post_type,
   374 				'post_type'   => $post_type,
   371 				'show_sticky' => 1,
   375 				'show_sticky' => 1,
   372 			);
   376 			);
   373 
   377 
   374 			$sticky_inner_html = sprintf(
   378 			$sticky_inner_html = sprintf(
       
   379 				/* translators: %s: Number of posts. */
   375 				_nx(
   380 				_nx(
   376 					'Sticky <span class="count">(%s)</span>',
   381 					'Sticky <span class="count">(%s)</span>',
   377 					'Sticky <span class="count">(%s)</span>',
   382 					'Sticky <span class="count">(%s)</span>',
   378 					$this->sticky_posts_count,
   383 					$this->sticky_posts_count,
   379 					'posts'
   384 					'posts'
   384 			$sticky_link = array(
   389 			$sticky_link = array(
   385 				'sticky' => $this->get_edit_link( $sticky_args, $sticky_inner_html, $class ),
   390 				'sticky' => $this->get_edit_link( $sticky_args, $sticky_inner_html, $class ),
   386 			);
   391 			);
   387 
   392 
   388 			// Sticky comes after Publish, or if not listed, after All.
   393 			// Sticky comes after Publish, or if not listed, after All.
   389 			$split        = 1 + array_search( ( isset( $status_links['publish'] ) ? 'publish' : 'all' ), array_keys( $status_links ) );
   394 			$split        = 1 + array_search( ( isset( $status_links['publish'] ) ? 'publish' : 'all' ), array_keys( $status_links ), true );
   390 			$status_links = array_merge( array_slice( $status_links, 0, $split ), $sticky_link, array_slice( $status_links, $split ) );
   395 			$status_links = array_merge( array_slice( $status_links, 0, $split ), $sticky_link, array_slice( $status_links, $split ) );
   391 		}
   396 		}
   392 
   397 
   393 		return $status_links;
   398 		return $status_links;
   394 	}
   399 	}
   408 			}
   413 			}
   409 		}
   414 		}
   410 
   415 
   411 		if ( current_user_can( $post_type_obj->cap->delete_posts ) ) {
   416 		if ( current_user_can( $post_type_obj->cap->delete_posts ) ) {
   412 			if ( $this->is_trash || ! EMPTY_TRASH_DAYS ) {
   417 			if ( $this->is_trash || ! EMPTY_TRASH_DAYS ) {
   413 				$actions['delete'] = __( 'Delete Permanently' );
   418 				$actions['delete'] = __( 'Delete permanently' );
   414 			} else {
   419 			} else {
   415 				$actions['trash'] = __( 'Move to Trash' );
   420 				$actions['trash'] = __( 'Move to Trash' );
   416 			}
   421 			}
   417 		}
   422 		}
   418 
   423 
   462 	 * Displays a formats drop-down for filtering items.
   467 	 * Displays a formats drop-down for filtering items.
   463 	 *
   468 	 *
   464 	 * @since 5.2.0
   469 	 * @since 5.2.0
   465 	 * @access protected
   470 	 * @access protected
   466 	 *
   471 	 *
   467 	 * @param string $post_type Post type key.
   472 	 * @param string $post_type Post type slug.
   468 	 */
   473 	 */
   469 	protected function formats_dropdown( $post_type ) {
   474 	protected function formats_dropdown( $post_type ) {
   470 		/**
   475 		/**
   471 		 * Filters whether to remove the 'Formats' drop-down from the post list table.
   476 		 * Filters whether to remove the 'Formats' drop-down from the post list table.
   472 		 *
   477 		 *
   473 		 * @since 5.2.0
   478 		 * @since 5.2.0
       
   479 		 * @since 5.5.0 The `$post_type` parameter was added.
   474 		 *
   480 		 *
   475 		 * @param bool $disable Whether to disable the drop-down. Default false.
   481 		 * @param bool   $disable   Whether to disable the drop-down. Default false.
       
   482 		 * @param string $post_type Post type slug.
   476 		 */
   483 		 */
   477 		if ( apply_filters( 'disable_formats_dropdown', false ) ) {
   484 		if ( apply_filters( 'disable_formats_dropdown', false, $post_type ) ) {
       
   485 			return;
       
   486 		}
       
   487 
       
   488 		// Return if the post type doesn't have post formats or if we're in the Trash.
       
   489 		if ( ! is_object_in_taxonomy( $post_type, 'post_format' ) || $this->is_trash ) {
   478 			return;
   490 			return;
   479 		}
   491 		}
   480 
   492 
   481 		// Make sure the dropdown shows only formats with a post count greater than 0.
   493 		// Make sure the dropdown shows only formats with a post count greater than 0.
   482 		$used_post_formats = get_terms(
   494 		$used_post_formats = get_terms(
   484 				'taxonomy'   => 'post_format',
   496 				'taxonomy'   => 'post_format',
   485 				'hide_empty' => true,
   497 				'hide_empty' => true,
   486 			)
   498 			)
   487 		);
   499 		);
   488 
   500 
   489 		/*
   501 		// Return if there are no posts using formats.
   490 		 * Return if the post type doesn't have post formats, or there are no posts using formats,
   502 		if ( ! $used_post_formats ) {
   491 		 * or if we're in the trash.
       
   492 		 */
       
   493 		if ( ! is_object_in_taxonomy( $post_type, 'post_format' ) || ! $used_post_formats || $this->is_trash ) {
       
   494 			return;
   503 			return;
   495 		}
   504 		}
   496 
   505 
   497 		$displayed_post_format = isset( $_GET['post_format'] ) ? $_GET['post_format'] : '';
   506 		$displayed_post_format = isset( $_GET['post_format'] ) ? $_GET['post_format'] : '';
   498 		?>
   507 		?>
   523 	 */
   532 	 */
   524 	protected function extra_tablenav( $which ) {
   533 	protected function extra_tablenav( $which ) {
   525 		?>
   534 		?>
   526 		<div class="alignleft actions">
   535 		<div class="alignleft actions">
   527 		<?php
   536 		<?php
   528 		if ( 'top' === $which && ! is_singular() ) {
   537 		if ( 'top' === $which ) {
   529 			ob_start();
   538 			ob_start();
   530 
   539 
   531 			$this->months_dropdown( $this->screen->post_type );
   540 			$this->months_dropdown( $this->screen->post_type );
   532 			$this->categories_dropdown( $this->screen->post_type );
   541 			$this->categories_dropdown( $this->screen->post_type );
   533 			$this->formats_dropdown( $this->screen->post_type );
   542 			$this->formats_dropdown( $this->screen->post_type );
   584 
   593 
   585 		return parent::current_action();
   594 		return parent::current_action();
   586 	}
   595 	}
   587 
   596 
   588 	/**
   597 	/**
       
   598 	 * @global string $mode List table view mode.
       
   599 	 *
   589 	 * @return array
   600 	 * @return array
   590 	 */
   601 	 */
   591 	protected function get_table_classes() {
   602 	protected function get_table_classes() {
   592 		return array( 'widefat', 'fixed', 'striped', is_post_type_hierarchical( $this->screen->post_type ) ? 'pages' : 'posts' );
   603 		global $mode;
       
   604 
       
   605 		$mode_class = esc_attr( 'table-view-' . $mode );
       
   606 
       
   607 		return array( 'widefat', 'fixed', 'striped', $mode_class, is_post_type_hierarchical( $this->screen->post_type ) ? 'pages' : 'posts' );
   593 	}
   608 	}
   594 
   609 
   595 	/**
   610 	/**
   596 	 * @return array
   611 	 * @return array
   597 	 */
   612 	 */
   600 
   615 
   601 		$posts_columns = array();
   616 		$posts_columns = array();
   602 
   617 
   603 		$posts_columns['cb'] = '<input type="checkbox" />';
   618 		$posts_columns['cb'] = '<input type="checkbox" />';
   604 
   619 
   605 		/* translators: manage posts column name */
   620 		/* translators: Posts screen column name. */
   606 		$posts_columns['title'] = _x( 'Title', 'column name' );
   621 		$posts_columns['title'] = _x( 'Title', 'column name' );
   607 
   622 
   608 		if ( post_type_supports( $post_type, 'author' ) ) {
   623 		if ( post_type_supports( $post_type, 'author' ) ) {
   609 			$posts_columns['author'] = __( 'Author' );
   624 			$posts_columns['author'] = __( 'Author' );
   610 		}
   625 		}
   637 
   652 
   638 			$posts_columns[ $column_key ] = get_taxonomy( $taxonomy )->labels->name;
   653 			$posts_columns[ $column_key ] = get_taxonomy( $taxonomy )->labels->name;
   639 		}
   654 		}
   640 
   655 
   641 		$post_status = ! empty( $_REQUEST['post_status'] ) ? $_REQUEST['post_status'] : 'all';
   656 		$post_status = ! empty( $_REQUEST['post_status'] ) ? $_REQUEST['post_status'] : 'all';
   642 		if ( post_type_supports( $post_type, 'comments' ) && ! in_array( $post_status, array( 'pending', 'draft', 'future' ) ) ) {
   657 		if ( post_type_supports( $post_type, 'comments' ) && ! in_array( $post_status, array( 'pending', 'draft', 'future' ), true ) ) {
   643 			$posts_columns['comments'] = '<span class="vers comment-grey-bubble" title="' . esc_attr__( 'Comments' ) . '"><span class="screen-reader-text">' . __( 'Comments' ) . '</span></span>';
   658 			$posts_columns['comments'] = '<span class="vers comment-grey-bubble" title="' . esc_attr__( 'Comments' ) . '"><span class="screen-reader-text">' . __( 'Comments' ) . '</span></span>';
   644 		}
   659 		}
   645 
   660 
   646 		$posts_columns['date'] = __( 'Date' );
   661 		$posts_columns['date'] = __( 'Date' );
   647 
   662 
   691 			'date'     => array( 'date', true ),
   706 			'date'     => array( 'date', true ),
   692 		);
   707 		);
   693 	}
   708 	}
   694 
   709 
   695 	/**
   710 	/**
   696 	 * @global WP_Query $wp_query
   711 	 * @global WP_Query $wp_query WordPress Query object.
   697 	 * @global int $per_page
   712 	 * @global int $per_page
   698 	 * @param array $posts
   713 	 * @param array $posts
   699 	 * @param int $level
   714 	 * @param int   $level
   700 	 */
   715 	 */
   701 	public function display_rows( $posts = array(), $level = 0 ) {
   716 	public function display_rows( $posts = array(), $level = 0 ) {
   702 		global $wp_query, $per_page;
   717 		global $wp_query, $per_page;
   703 
   718 
   704 		if ( empty( $posts ) ) {
   719 		if ( empty( $posts ) ) {
   714 		}
   729 		}
   715 	}
   730 	}
   716 
   731 
   717 	/**
   732 	/**
   718 	 * @param array $posts
   733 	 * @param array $posts
   719 	 * @param int $level
   734 	 * @param int   $level
   720 	 */
   735 	 */
   721 	private function _display_rows( $posts, $level = 0 ) {
   736 	private function _display_rows( $posts, $level = 0 ) {
   722 		$post_type = $this->screen->post_type;
   737 		$post_type = $this->screen->post_type;
   723 
   738 
   724 		// Create array of post IDs.
   739 		// Create array of post IDs.
   736 			$this->single_row( $post, $level );
   751 			$this->single_row( $post, $level );
   737 		}
   752 		}
   738 	}
   753 	}
   739 
   754 
   740 	/**
   755 	/**
   741 	 * @global wpdb    $wpdb
   756 	 * @global wpdb    $wpdb WordPress database abstraction object.
   742 	 * @global WP_Post $post
   757 	 * @global WP_Post $post Global post object.
   743 	 * @param array $pages
   758 	 * @param array $pages
   744 	 * @param int $pagenum
   759 	 * @param int   $pagenum
   745 	 * @param int $per_page
   760 	 * @param int   $per_page
   746 	 */
   761 	 */
   747 	private function _display_rows_hierarchical( $pages, $pagenum = 1, $per_page = 20 ) {
   762 	private function _display_rows_hierarchical( $pages, $pagenum = 1, $per_page = 20 ) {
   748 		global $wpdb;
   763 		global $wpdb;
   749 
   764 
   750 		$level = 0;
   765 		$level = 0;
   845 	 *
   860 	 *
   846 	 * @since 3.1.0 (Standalone function exists since 2.6.0)
   861 	 * @since 3.1.0 (Standalone function exists since 2.6.0)
   847 	 * @since 4.2.0 Added the `$to_display` parameter.
   862 	 * @since 4.2.0 Added the `$to_display` parameter.
   848 	 *
   863 	 *
   849 	 * @param array $children_pages
   864 	 * @param array $children_pages
   850 	 * @param int $count
   865 	 * @param int   $count
   851 	 * @param int $parent
   866 	 * @param int   $parent
   852 	 * @param int $level
   867 	 * @param int   $level
   853 	 * @param int $pagenum
   868 	 * @param int   $pagenum
   854 	 * @param int $per_page
   869 	 * @param int   $per_page
   855 	 * @param array $to_display List of pages to be displayed. Passed by reference.
   870 	 * @param array $to_display List of pages to be displayed. Passed by reference.
   856 	 */
   871 	 */
   857 	private function _page_rows( &$children_pages, &$count, $parent, $level, $pagenum, $per_page, &$to_display ) {
   872 	private function _page_rows( &$children_pages, &$count, $parent, $level, $pagenum, $per_page, &$to_display ) {
   858 		if ( ! isset( $children_pages[ $parent ] ) ) {
   873 		if ( ! isset( $children_pages[ $parent ] ) ) {
   859 			return;
   874 			return;
   870 			// If the page starts in a subtree, print the parents.
   885 			// If the page starts in a subtree, print the parents.
   871 			if ( $count == $start && $page->post_parent > 0 ) {
   886 			if ( $count == $start && $page->post_parent > 0 ) {
   872 				$my_parents = array();
   887 				$my_parents = array();
   873 				$my_parent  = $page->post_parent;
   888 				$my_parent  = $page->post_parent;
   874 				while ( $my_parent ) {
   889 				while ( $my_parent ) {
   875 					// Get the ID from the list or the attribute if my_parent is an object
   890 					// Get the ID from the list or the attribute if my_parent is an object.
   876 					$parent_id = $my_parent;
   891 					$parent_id = $my_parent;
   877 					if ( is_object( $my_parent ) ) {
   892 					if ( is_object( $my_parent ) ) {
   878 						$parent_id = $my_parent->ID;
   893 						$parent_id = $my_parent->ID;
   879 					}
   894 					}
   880 
   895 
   899 			$count++;
   914 			$count++;
   900 
   915 
   901 			$this->_page_rows( $children_pages, $count, $page->ID, $level + 1, $pagenum, $per_page, $to_display );
   916 			$this->_page_rows( $children_pages, $count, $page->ID, $level + 1, $pagenum, $per_page, $to_display );
   902 		}
   917 		}
   903 
   918 
   904 		unset( $children_pages[ $parent ] ); //required in order to keep track of orphans
   919 		unset( $children_pages[ $parent ] ); // Required in order to keep track of orphans.
   905 	}
   920 	}
   906 
   921 
   907 	/**
   922 	/**
   908 	 * Handles the checkbox column output.
   923 	 * Handles the checkbox column output.
   909 	 *
   924 	 *
   913 	 */
   928 	 */
   914 	public function column_cb( $post ) {
   929 	public function column_cb( $post ) {
   915 		if ( current_user_can( 'edit_post', $post->ID ) ) :
   930 		if ( current_user_can( 'edit_post', $post->ID ) ) :
   916 			?>
   931 			?>
   917 			<label class="screen-reader-text" for="cb-select-<?php the_ID(); ?>">
   932 			<label class="screen-reader-text" for="cb-select-<?php the_ID(); ?>">
   918 																				<?php
   933 				<?php
   919 																				printf( __( 'Select %s' ), _draft_or_post_title() );
   934 					/* translators: %s: Post title. */
   920 																				?>
   935 					printf( __( 'Select %s' ), _draft_or_post_title() );
       
   936 				?>
   921 			</label>
   937 			</label>
   922 			<input id="cb-select-<?php the_ID(); ?>" type="checkbox" name="post[]" value="<?php the_ID(); ?>" />
   938 			<input id="cb-select-<?php the_ID(); ?>" type="checkbox" name="post[]" value="<?php the_ID(); ?>" />
   923 			<div class="locked-indicator">
   939 			<div class="locked-indicator">
   924 				<span class="locked-indicator-icon" aria-hidden="true"></span>
   940 				<span class="locked-indicator-icon" aria-hidden="true"></span>
   925 				<span class="screen-reader-text">
   941 				<span class="screen-reader-text">
   926 				<?php
   942 				<?php
   927 				printf(
   943 				printf(
   928 					/* translators: %s: post title */
   944 					/* translators: %s: Post title. */
   929 					__( '&#8220;%s&#8221; is locked' ),
   945 					__( '&#8220;%s&#8221; is locked' ),
   930 					_draft_or_post_title()
   946 					_draft_or_post_title()
   931 				);
   947 				);
   932 				?>
   948 				?>
   933 				</span>
   949 				</span>
   985 			}
  1001 			}
   986 		}
  1002 		}
   987 
  1003 
   988 		$can_edit_post = current_user_can( 'edit_post', $post->ID );
  1004 		$can_edit_post = current_user_can( 'edit_post', $post->ID );
   989 
  1005 
   990 		if ( $can_edit_post && $post->post_status != 'trash' ) {
  1006 		if ( $can_edit_post && 'trash' !== $post->post_status ) {
   991 			$lock_holder = wp_check_post_lock( $post->ID );
  1007 			$lock_holder = wp_check_post_lock( $post->ID );
   992 
  1008 
   993 			if ( $lock_holder ) {
  1009 			if ( $lock_holder ) {
   994 				$lock_holder   = get_userdata( $lock_holder );
  1010 				$lock_holder   = get_userdata( $lock_holder );
   995 				$locked_avatar = get_avatar( $lock_holder->ID, 18 );
  1011 				$locked_avatar = get_avatar( $lock_holder->ID, 18 );
   996 				$locked_text   = esc_html( sprintf( __( '%s is currently editing' ), $lock_holder->display_name ) );
  1012 				/* translators: %s: User's display name. */
       
  1013 				$locked_text = esc_html( sprintf( __( '%s is currently editing' ), $lock_holder->display_name ) );
   997 			} else {
  1014 			} else {
   998 				$locked_avatar = $locked_text = '';
  1015 				$locked_avatar = '';
       
  1016 				$locked_text   = '';
   999 			}
  1017 			}
  1000 
  1018 
  1001 			echo '<div class="locked-info"><span class="locked-avatar">' . $locked_avatar . '</span> <span class="locked-text">' . $locked_text . "</span></div>\n";
  1019 			echo '<div class="locked-info"><span class="locked-avatar">' . $locked_avatar . '</span> <span class="locked-text">' . $locked_text . "</span></div>\n";
  1002 		}
  1020 		}
  1003 
  1021 
  1004 		$pad = str_repeat( '&#8212; ', $this->current_level );
  1022 		$pad = str_repeat( '&#8212; ', $this->current_level );
  1005 		echo '<strong>';
  1023 		echo '<strong>';
  1006 
  1024 
  1007 		$title = _draft_or_post_title();
  1025 		$title = _draft_or_post_title();
  1008 
  1026 
  1009 		if ( $can_edit_post && $post->post_status != 'trash' ) {
  1027 		if ( $can_edit_post && 'trash' !== $post->post_status ) {
  1010 			printf(
  1028 			printf(
  1011 				'<a class="row-title" href="%s" aria-label="%s">%s%s</a>',
  1029 				'<a class="row-title" href="%s" aria-label="%s">%s%s</a>',
  1012 				get_edit_post_link( $post->ID ),
  1030 				get_edit_post_link( $post->ID ),
  1013 				/* translators: %s: post title */
  1031 				/* translators: %s: Post title. */
  1014 				esc_attr( sprintf( __( '&#8220;%s&#8221; (Edit)' ), $title ) ),
  1032 				esc_attr( sprintf( __( '&#8220;%s&#8221; (Edit)' ), $title ) ),
  1015 				$pad,
  1033 				$pad,
  1016 				$title
  1034 				$title
  1017 			);
  1035 			);
  1018 		} else {
  1036 		} else {
  1028 			$post_type_object = get_post_type_object( $post->post_type );
  1046 			$post_type_object = get_post_type_object( $post->post_type );
  1029 			echo ' | ' . $post_type_object->labels->parent_item_colon . ' ' . esc_html( $parent_name );
  1047 			echo ' | ' . $post_type_object->labels->parent_item_colon . ' ' . esc_html( $parent_name );
  1030 		}
  1048 		}
  1031 		echo "</strong>\n";
  1049 		echo "</strong>\n";
  1032 
  1050 
  1033 		if ( ! is_post_type_hierarchical( $this->screen->post_type ) && 'excerpt' === $mode && current_user_can( 'read_post', $post->ID ) ) {
  1051 		if ( 'excerpt' === $mode
       
  1052 			&& ! is_post_type_hierarchical( $this->screen->post_type )
       
  1053 			&& current_user_can( 'read_post', $post->ID )
       
  1054 		) {
  1034 			if ( post_password_required( $post ) ) {
  1055 			if ( post_password_required( $post ) ) {
  1035 				echo '<span class="protected-post-excerpt">' . esc_html( get_the_excerpt() ) . '</span>';
  1056 				echo '<span class="protected-post-excerpt">' . esc_html( get_the_excerpt() ) . '</span>';
  1036 			} else {
  1057 			} else {
  1037 				echo esc_html( get_the_excerpt() );
  1058 				echo esc_html( get_the_excerpt() );
  1038 			}
  1059 			}
  1052 	 */
  1073 	 */
  1053 	public function column_date( $post ) {
  1074 	public function column_date( $post ) {
  1054 		global $mode;
  1075 		global $mode;
  1055 
  1076 
  1056 		if ( '0000-00-00 00:00:00' === $post->post_date ) {
  1077 		if ( '0000-00-00 00:00:00' === $post->post_date ) {
  1057 			$t_time    = $h_time = __( 'Unpublished' );
  1078 			$t_time    = __( 'Unpublished' );
  1058 			$time_diff = 0;
  1079 			$time_diff = 0;
  1059 		} else {
  1080 		} else {
  1060 			$t_time = get_the_time( __( 'Y/m/d g:i:s a' ) );
  1081 			$t_time = sprintf(
  1061 			$m_time = $post->post_date;
  1082 				/* translators: 1: Post date, 2: Post time. */
  1062 			$time   = get_post_time( 'G', true, $post );
  1083 				__( '%1$s at %2$s' ),
  1063 
  1084 				/* translators: Post date format. See https://www.php.net/date */
       
  1085 				get_the_time( __( 'Y/m/d' ), $post ),
       
  1086 				/* translators: Post time format. See https://www.php.net/date */
       
  1087 				get_the_time( __( 'g:i a' ), $post )
       
  1088 			);
       
  1089 
       
  1090 			$time      = get_post_timestamp( $post );
  1064 			$time_diff = time() - $time;
  1091 			$time_diff = time() - $time;
  1065 
       
  1066 			if ( $time_diff > 0 && $time_diff < DAY_IN_SECONDS ) {
       
  1067 				$h_time = sprintf( __( '%s ago' ), human_time_diff( $time ) );
       
  1068 			} else {
       
  1069 				$h_time = mysql2date( __( 'Y/m/d' ), $m_time );
       
  1070 			}
       
  1071 		}
  1092 		}
  1072 
  1093 
  1073 		if ( 'publish' === $post->post_status ) {
  1094 		if ( 'publish' === $post->post_status ) {
  1074 			$status = __( 'Published' );
  1095 			$status = __( 'Published' );
  1075 		} elseif ( 'future' === $post->post_status ) {
  1096 		} elseif ( 'future' === $post->post_status ) {
  1096 
  1117 
  1097 		if ( $status ) {
  1118 		if ( $status ) {
  1098 			echo $status . '<br />';
  1119 			echo $status . '<br />';
  1099 		}
  1120 		}
  1100 
  1121 
  1101 		if ( 'excerpt' === $mode ) {
  1122 		/**
  1102 			/**
  1123 		 * Filters the published time of the post.
  1103 			 * Filters the published time of the post.
  1124 		 *
  1104 			 *
  1125 		 * @since 2.5.1
  1105 			 * If `$mode` equals 'excerpt', the published time and date are both displayed.
  1126 		 * @since 5.5.0 Removed the difference between 'excerpt' and 'list' modes.
  1106 			 * If `$mode` equals 'list' (default), the publish date is displayed, with the
  1127 		 *              The published time and date are both displayed now,
  1107 			 * time and date together available as an abbreviation definition.
  1128 		 *              which is equivalent to the previous 'excerpt' mode.
  1108 			 *
  1129 		 *
  1109 			 * @since 2.5.1
  1130 		 * @param string  $t_time      The published time.
  1110 			 *
  1131 		 * @param WP_Post $post        Post object.
  1111 			 * @param string  $t_time      The published time.
  1132 		 * @param string  $column_name The column name.
  1112 			 * @param WP_Post $post        Post object.
  1133 		 * @param string  $mode        The list display mode ('excerpt' or 'list').
  1113 			 * @param string  $column_name The column name.
  1134 		 */
  1114 			 * @param string  $mode        The list display mode ('excerpt' or 'list').
  1135 		echo apply_filters( 'post_date_column_time', $t_time, $post, 'date', $mode );
  1115 			 */
       
  1116 			echo apply_filters( 'post_date_column_time', $t_time, $post, 'date', $mode );
       
  1117 		} else {
       
  1118 
       
  1119 			/** This filter is documented in wp-admin/includes/class-wp-posts-list-table.php */
       
  1120 			echo '<abbr title="' . $t_time . '">' . apply_filters( 'post_date_column_time', $h_time, $post, 'date', $mode ) . '</abbr>';
       
  1121 		}
       
  1122 	}
  1136 	}
  1123 
  1137 
  1124 	/**
  1138 	/**
  1125 	 * Handles the comments column output.
  1139 	 * Handles the comments column output.
  1126 	 *
  1140 	 *
  1178 			$terms           = get_the_terms( $post->ID, $taxonomy );
  1192 			$terms           = get_the_terms( $post->ID, $taxonomy );
  1179 			if ( is_array( $terms ) ) {
  1193 			if ( is_array( $terms ) ) {
  1180 				$term_links = array();
  1194 				$term_links = array();
  1181 				foreach ( $terms as $t ) {
  1195 				foreach ( $terms as $t ) {
  1182 					$posts_in_term_qv = array();
  1196 					$posts_in_term_qv = array();
  1183 					if ( 'post' != $post->post_type ) {
  1197 					if ( 'post' !== $post->post_type ) {
  1184 						$posts_in_term_qv['post_type'] = $post->post_type;
  1198 						$posts_in_term_qv['post_type'] = $post->post_type;
  1185 					}
  1199 					}
  1186 					if ( $taxonomy_object->query_var ) {
  1200 					if ( $taxonomy_object->query_var ) {
  1187 						$posts_in_term_qv[ $taxonomy_object->query_var ] = $t->slug;
  1201 						$posts_in_term_qv[ $taxonomy_object->query_var ] = $t->slug;
  1188 					} else {
  1202 					} else {
  1198 				/**
  1212 				/**
  1199 				 * Filters the links in `$taxonomy` column of edit.php.
  1213 				 * Filters the links in `$taxonomy` column of edit.php.
  1200 				 *
  1214 				 *
  1201 				 * @since 5.2.0
  1215 				 * @since 5.2.0
  1202 				 *
  1216 				 *
  1203 				 * @param array  $term_links List of links to edit.php, filtered by the taxonomy term.
  1217 				 * @param string[]  $term_links Array of term editing links.
  1204 				 * @param string $taxonomy   Taxonomy name.
  1218 				 * @param string    $taxonomy   Taxonomy name.
  1205 				 * @param array  $terms      Array of terms appearing in the post row.
  1219 				 * @param WP_Term[] $terms      Array of term objects appearing in the post row.
  1206 				 */
  1220 				 */
  1207 				$term_links = apply_filters( 'post_column_taxonomy_links', $term_links, $taxonomy, $terms );
  1221 				$term_links = apply_filters( 'post_column_taxonomy_links', $term_links, $taxonomy, $terms );
  1208 
  1222 
  1209 				/* translators: used between list items, there is a space after the comma */
  1223 				/* translators: Used between list items, there is a space after the comma. */
  1210 				echo join( __( ', ' ), $term_links );
  1224 				echo join( __( ', ' ), $term_links );
  1211 			} else {
  1225 			} else {
  1212 				echo '<span aria-hidden="true">&#8212;</span><span class="screen-reader-text">' . $taxonomy_object->labels->no_terms . '</span>';
  1226 				echo '<span aria-hidden="true">&#8212;</span><span class="screen-reader-text">' . $taxonomy_object->labels->no_terms . '</span>';
  1213 			}
  1227 			}
  1214 			return;
  1228 			return;
  1256 		 */
  1270 		 */
  1257 		do_action( "manage_{$post->post_type}_posts_custom_column", $column_name, $post->ID );
  1271 		do_action( "manage_{$post->post_type}_posts_custom_column", $column_name, $post->ID );
  1258 	}
  1272 	}
  1259 
  1273 
  1260 	/**
  1274 	/**
  1261 	 * @global WP_Post $post
  1275 	 * @global WP_Post $post Global post object.
  1262 	 *
  1276 	 *
  1263 	 * @param int|WP_Post $post
  1277 	 * @param int|WP_Post $post
  1264 	 * @param int         $level
  1278 	 * @param int         $level
  1265 	 */
  1279 	 */
  1266 	public function single_row( $post, $level = 0 ) {
  1280 	public function single_row( $post, $level = 0 ) {
  1310 	 * @since 4.3.0
  1324 	 * @since 4.3.0
  1311 	 *
  1325 	 *
  1312 	 * @param object $post        Post being acted upon.
  1326 	 * @param object $post        Post being acted upon.
  1313 	 * @param string $column_name Current column name.
  1327 	 * @param string $column_name Current column name.
  1314 	 * @param string $primary     Primary column name.
  1328 	 * @param string $primary     Primary column name.
  1315 	 * @return string Row actions output for posts.
  1329 	 * @return string Row actions output for posts, or an empty string
       
  1330 	 *                if the current column is not the primary column.
  1316 	 */
  1331 	 */
  1317 	protected function handle_row_actions( $post, $column_name, $primary ) {
  1332 	protected function handle_row_actions( $post, $column_name, $primary ) {
  1318 		if ( $primary !== $column_name ) {
  1333 		if ( $primary !== $column_name ) {
  1319 			return '';
  1334 			return '';
  1320 		}
  1335 		}
  1322 		$post_type_object = get_post_type_object( $post->post_type );
  1337 		$post_type_object = get_post_type_object( $post->post_type );
  1323 		$can_edit_post    = current_user_can( 'edit_post', $post->ID );
  1338 		$can_edit_post    = current_user_can( 'edit_post', $post->ID );
  1324 		$actions          = array();
  1339 		$actions          = array();
  1325 		$title            = _draft_or_post_title();
  1340 		$title            = _draft_or_post_title();
  1326 
  1341 
  1327 		if ( $can_edit_post && 'trash' != $post->post_status ) {
  1342 		if ( $can_edit_post && 'trash' !== $post->post_status ) {
  1328 			$actions['edit'] = sprintf(
  1343 			$actions['edit'] = sprintf(
  1329 				'<a href="%s" aria-label="%s">%s</a>',
  1344 				'<a href="%s" aria-label="%s">%s</a>',
  1330 				get_edit_post_link( $post->ID ),
  1345 				get_edit_post_link( $post->ID ),
  1331 				/* translators: %s: post title */
  1346 				/* translators: %s: Post title. */
  1332 				esc_attr( sprintf( __( 'Edit &#8220;%s&#8221;' ), $title ) ),
  1347 				esc_attr( sprintf( __( 'Edit &#8220;%s&#8221;' ), $title ) ),
  1333 				__( 'Edit' )
  1348 				__( 'Edit' )
  1334 			);
  1349 			);
  1335 
  1350 
  1336 			if ( 'wp_block' !== $post->post_type ) {
  1351 			if ( 'wp_block' !== $post->post_type ) {
  1337 				$actions['inline hide-if-no-js'] = sprintf(
  1352 				$actions['inline hide-if-no-js'] = sprintf(
  1338 					'<button type="button" class="button-link editinline" aria-label="%s" aria-expanded="false">%s</button>',
  1353 					'<button type="button" class="button-link editinline" aria-label="%s" aria-expanded="false">%s</button>',
  1339 					/* translators: %s: post title */
  1354 					/* translators: %s: Post title. */
  1340 					esc_attr( sprintf( __( 'Quick edit &#8220;%s&#8221; inline' ), $title ) ),
  1355 					esc_attr( sprintf( __( 'Quick edit &#8220;%s&#8221; inline' ), $title ) ),
  1341 					__( 'Quick&nbsp;Edit' )
  1356 					__( 'Quick&nbsp;Edit' )
  1342 				);
  1357 				);
  1343 			}
  1358 			}
  1344 		}
  1359 		}
  1346 		if ( current_user_can( 'delete_post', $post->ID ) ) {
  1361 		if ( current_user_can( 'delete_post', $post->ID ) ) {
  1347 			if ( 'trash' === $post->post_status ) {
  1362 			if ( 'trash' === $post->post_status ) {
  1348 				$actions['untrash'] = sprintf(
  1363 				$actions['untrash'] = sprintf(
  1349 					'<a href="%s" aria-label="%s">%s</a>',
  1364 					'<a href="%s" aria-label="%s">%s</a>',
  1350 					wp_nonce_url( admin_url( sprintf( $post_type_object->_edit_link . '&amp;action=untrash', $post->ID ) ), 'untrash-post_' . $post->ID ),
  1365 					wp_nonce_url( admin_url( sprintf( $post_type_object->_edit_link . '&amp;action=untrash', $post->ID ) ), 'untrash-post_' . $post->ID ),
  1351 					/* translators: %s: post title */
  1366 					/* translators: %s: Post title. */
  1352 					esc_attr( sprintf( __( 'Restore &#8220;%s&#8221; from the Trash' ), $title ) ),
  1367 					esc_attr( sprintf( __( 'Restore &#8220;%s&#8221; from the Trash' ), $title ) ),
  1353 					__( 'Restore' )
  1368 					__( 'Restore' )
  1354 				);
  1369 				);
  1355 			} elseif ( EMPTY_TRASH_DAYS ) {
  1370 			} elseif ( EMPTY_TRASH_DAYS ) {
  1356 				$actions['trash'] = sprintf(
  1371 				$actions['trash'] = sprintf(
  1357 					'<a href="%s" class="submitdelete" aria-label="%s">%s</a>',
  1372 					'<a href="%s" class="submitdelete" aria-label="%s">%s</a>',
  1358 					get_delete_post_link( $post->ID ),
  1373 					get_delete_post_link( $post->ID ),
  1359 					/* translators: %s: post title */
  1374 					/* translators: %s: Post title. */
  1360 					esc_attr( sprintf( __( 'Move &#8220;%s&#8221; to the Trash' ), $title ) ),
  1375 					esc_attr( sprintf( __( 'Move &#8220;%s&#8221; to the Trash' ), $title ) ),
  1361 					_x( 'Trash', 'verb' )
  1376 					_x( 'Trash', 'verb' )
  1362 				);
  1377 				);
  1363 			}
  1378 			}
  1364 			if ( 'trash' === $post->post_status || ! EMPTY_TRASH_DAYS ) {
  1379 			if ( 'trash' === $post->post_status || ! EMPTY_TRASH_DAYS ) {
  1365 				$actions['delete'] = sprintf(
  1380 				$actions['delete'] = sprintf(
  1366 					'<a href="%s" class="submitdelete" aria-label="%s">%s</a>',
  1381 					'<a href="%s" class="submitdelete" aria-label="%s">%s</a>',
  1367 					get_delete_post_link( $post->ID, '', true ),
  1382 					get_delete_post_link( $post->ID, '', true ),
  1368 					/* translators: %s: post title */
  1383 					/* translators: %s: Post title. */
  1369 					esc_attr( sprintf( __( 'Delete &#8220;%s&#8221; permanently' ), $title ) ),
  1384 					esc_attr( sprintf( __( 'Delete &#8220;%s&#8221; permanently' ), $title ) ),
  1370 					__( 'Delete Permanently' )
  1385 					__( 'Delete Permanently' )
  1371 				);
  1386 				);
  1372 			}
  1387 			}
  1373 		}
  1388 		}
  1374 
  1389 
  1375 		if ( is_post_type_viewable( $post_type_object ) ) {
  1390 		if ( is_post_type_viewable( $post_type_object ) ) {
  1376 			if ( in_array( $post->post_status, array( 'pending', 'draft', 'future' ) ) ) {
  1391 			if ( in_array( $post->post_status, array( 'pending', 'draft', 'future' ), true ) ) {
  1377 				if ( $can_edit_post ) {
  1392 				if ( $can_edit_post ) {
  1378 					$preview_link    = get_preview_post_link( $post );
  1393 					$preview_link    = get_preview_post_link( $post );
  1379 					$actions['view'] = sprintf(
  1394 					$actions['view'] = sprintf(
  1380 						'<a href="%s" rel="bookmark" aria-label="%s">%s</a>',
  1395 						'<a href="%s" rel="bookmark" aria-label="%s">%s</a>',
  1381 						esc_url( $preview_link ),
  1396 						esc_url( $preview_link ),
  1382 						/* translators: %s: post title */
  1397 						/* translators: %s: Post title. */
  1383 						esc_attr( sprintf( __( 'Preview &#8220;%s&#8221;' ), $title ) ),
  1398 						esc_attr( sprintf( __( 'Preview &#8220;%s&#8221;' ), $title ) ),
  1384 						__( 'Preview' )
  1399 						__( 'Preview' )
  1385 					);
  1400 					);
  1386 				}
  1401 				}
  1387 			} elseif ( 'trash' != $post->post_status ) {
  1402 			} elseif ( 'trash' !== $post->post_status ) {
  1388 				$actions['view'] = sprintf(
  1403 				$actions['view'] = sprintf(
  1389 					'<a href="%s" rel="bookmark" aria-label="%s">%s</a>',
  1404 					'<a href="%s" rel="bookmark" aria-label="%s">%s</a>',
  1390 					get_permalink( $post->ID ),
  1405 					get_permalink( $post->ID ),
  1391 					/* translators: %s: post title */
  1406 					/* translators: %s: Post title. */
  1392 					esc_attr( sprintf( __( 'View &#8220;%s&#8221;' ), $title ) ),
  1407 					esc_attr( sprintf( __( 'View &#8220;%s&#8221;' ), $title ) ),
  1393 					__( 'View' )
  1408 					__( 'View' )
  1394 				);
  1409 				);
  1395 			}
  1410 			}
  1396 		}
  1411 		}
  1397 
  1412 
  1398 		if ( 'wp_block' === $post->post_type ) {
  1413 		if ( 'wp_block' === $post->post_type ) {
  1399 			$actions['export'] = sprintf(
  1414 			$actions['export'] = sprintf(
  1400 				'<button type="button" class="wp-list-reusable-blocks__export button-link" data-id="%s" aria-label="%s">%s</button>',
  1415 				'<button type="button" class="wp-list-reusable-blocks__export button-link" data-id="%s" aria-label="%s">%s</button>',
  1401 				$post->ID,
  1416 				$post->ID,
  1402 				/* translators: %s: post title */
  1417 				/* translators: %s: Post title. */
  1403 				esc_attr( sprintf( __( 'Export &#8220;%s&#8221; as JSON' ), $title ) ),
  1418 				esc_attr( sprintf( __( 'Export &#8220;%s&#8221; as JSON' ), $title ) ),
  1404 				__( 'Export as JSON' )
  1419 				__( 'Export as JSON' )
  1405 			);
  1420 			);
  1406 		}
  1421 		}
  1407 
  1422 
  1456 		$post_type_object = get_post_type_object( $screen->post_type );
  1471 		$post_type_object = get_post_type_object( $screen->post_type );
  1457 
  1472 
  1458 		$taxonomy_names          = get_object_taxonomies( $screen->post_type );
  1473 		$taxonomy_names          = get_object_taxonomies( $screen->post_type );
  1459 		$hierarchical_taxonomies = array();
  1474 		$hierarchical_taxonomies = array();
  1460 		$flat_taxonomies         = array();
  1475 		$flat_taxonomies         = array();
       
  1476 
  1461 		foreach ( $taxonomy_names as $taxonomy_name ) {
  1477 		foreach ( $taxonomy_names as $taxonomy_name ) {
  1462 
  1478 
  1463 			$taxonomy = get_taxonomy( $taxonomy_name );
  1479 			$taxonomy = get_taxonomy( $taxonomy_name );
  1464 
  1480 
  1465 			$show_in_quick_edit = $taxonomy->show_in_quick_edit;
  1481 			$show_in_quick_edit = $taxonomy->show_in_quick_edit;
  1496 			'author'     => true,
  1512 			'author'     => true,
  1497 		);
  1513 		);
  1498 
  1514 
  1499 		?>
  1515 		?>
  1500 
  1516 
  1501 	<form method="get"><table style="display: none"><tbody id="inlineedit">
  1517 		<form method="get">
       
  1518 		<table style="display: none"><tbody id="inlineedit">
  1502 		<?php
  1519 		<?php
  1503 		$hclass              = count( $hierarchical_taxonomies ) ? 'post' : 'page';
  1520 		$hclass              = count( $hierarchical_taxonomies ) ? 'post' : 'page';
  1504 		$inline_edit_classes = "inline-edit-row inline-edit-row-$hclass";
  1521 		$inline_edit_classes = "inline-edit-row inline-edit-row-$hclass";
  1505 		$bulk_edit_classes   = "bulk-edit-row bulk-edit-row-$hclass bulk-edit-{$screen->post_type}";
  1522 		$bulk_edit_classes   = "bulk-edit-row bulk-edit-row-$hclass bulk-edit-{$screen->post_type}";
  1506 		$quick_edit_classes  = "quick-edit-row quick-edit-row-$hclass inline-edit-{$screen->post_type}";
  1523 		$quick_edit_classes  = "quick-edit-row quick-edit-row-$hclass inline-edit-{$screen->post_type}";
  1507 
  1524 
  1508 		$bulk = 0;
  1525 		$bulk = 0;
  1509 		while ( $bulk < 2 ) {
  1526 		while ( $bulk < 2 ) :
       
  1527 			$classes  = $inline_edit_classes . ' ';
       
  1528 			$classes .= $bulk ? $bulk_edit_classes : $quick_edit_classes;
  1510 			?>
  1529 			?>
  1511 
  1530 			<tr id="<?php echo $bulk ? 'bulk-edit' : 'inline-edit'; ?>" class="<?php echo $classes; ?>" style="display: none">
  1512 		<tr id="<?php echo $bulk ? 'bulk-edit' : 'inline-edit'; ?>" class="
  1531 			<td colspan="<?php echo $this->get_column_count(); ?>" class="colspanchange">
       
  1532 
       
  1533 			<fieldset class="inline-edit-col-left">
       
  1534 				<legend class="inline-edit-legend"><?php echo $bulk ? __( 'Bulk Edit' ) : __( 'Quick Edit' ); ?></legend>
       
  1535 				<div class="inline-edit-col">
       
  1536 
       
  1537 				<?php if ( post_type_supports( $screen->post_type, 'title' ) ) : ?>
       
  1538 
       
  1539 					<?php if ( $bulk ) : ?>
       
  1540 
       
  1541 						<div id="bulk-title-div">
       
  1542 							<div id="bulk-titles"></div>
       
  1543 						</div>
       
  1544 
       
  1545 					<?php else : // $bulk ?>
       
  1546 
       
  1547 						<label>
       
  1548 							<span class="title"><?php _e( 'Title' ); ?></span>
       
  1549 							<span class="input-text-wrap"><input type="text" name="post_title" class="ptitle" value="" /></span>
       
  1550 						</label>
       
  1551 
       
  1552 						<?php if ( is_post_type_viewable( $screen->post_type ) ) : ?>
       
  1553 
       
  1554 							<label>
       
  1555 								<span class="title"><?php _e( 'Slug' ); ?></span>
       
  1556 								<span class="input-text-wrap"><input type="text" name="post_name" value="" /></span>
       
  1557 							</label>
       
  1558 
       
  1559 						<?php endif; // is_post_type_viewable() ?>
       
  1560 
       
  1561 					<?php endif; // $bulk ?>
       
  1562 
       
  1563 				<?php endif; // post_type_supports( ... 'title' ) ?>
       
  1564 
       
  1565 				<?php if ( ! $bulk ) : ?>
       
  1566 					<fieldset class="inline-edit-date">
       
  1567 						<legend><span class="title"><?php _e( 'Date' ); ?></span></legend>
       
  1568 						<?php touch_time( 1, 1, 0, 1 ); ?>
       
  1569 					</fieldset>
       
  1570 					<br class="clear" />
       
  1571 				<?php endif; // $bulk ?>
       
  1572 
       
  1573 				<?php
       
  1574 				if ( post_type_supports( $screen->post_type, 'author' ) ) :
       
  1575 					$authors_dropdown = '';
       
  1576 
       
  1577 					if ( current_user_can( $post_type_object->cap->edit_others_posts ) ) :
       
  1578 						$users_opt = array(
       
  1579 							'hide_if_only_one_author' => false,
       
  1580 							'who'                     => 'authors',
       
  1581 							'name'                    => 'post_author',
       
  1582 							'class'                   => 'authors',
       
  1583 							'multi'                   => 1,
       
  1584 							'echo'                    => 0,
       
  1585 							'show'                    => 'display_name_with_login',
       
  1586 						);
       
  1587 
       
  1588 						if ( $bulk ) {
       
  1589 							$users_opt['show_option_none'] = __( '&mdash; No Change &mdash;' );
       
  1590 						}
       
  1591 
       
  1592 						$authors = wp_dropdown_users( $users_opt );
       
  1593 						if ( $authors ) :
       
  1594 							$authors_dropdown  = '<label class="inline-edit-author">';
       
  1595 							$authors_dropdown .= '<span class="title">' . __( 'Author' ) . '</span>';
       
  1596 							$authors_dropdown .= $authors;
       
  1597 							$authors_dropdown .= '</label>';
       
  1598 						endif;
       
  1599 					endif; // current_user_can( 'edit_others_posts' )
       
  1600 					?>
       
  1601 
       
  1602 					<?php
       
  1603 					if ( ! $bulk ) {
       
  1604 						echo $authors_dropdown;
       
  1605 					}
       
  1606 				endif; // post_type_supports( ... 'author' )
       
  1607 				?>
       
  1608 
       
  1609 				<?php if ( ! $bulk && $can_publish ) : ?>
       
  1610 
       
  1611 					<div class="inline-edit-group wp-clearfix">
       
  1612 						<label class="alignleft">
       
  1613 							<span class="title"><?php _e( 'Password' ); ?></span>
       
  1614 							<span class="input-text-wrap"><input type="text" name="post_password" class="inline-edit-password-input" value="" /></span>
       
  1615 						</label>
       
  1616 
       
  1617 						<span class="alignleft inline-edit-or">
  1513 							<?php
  1618 							<?php
  1514 							echo $inline_edit_classes . ' ';
  1619 							/* translators: Between password field and private checkbox on post quick edit interface. */
  1515 							echo $bulk ? $bulk_edit_classes : $quick_edit_classes;
  1620 							_e( '&ndash;OR&ndash;' );
  1516 							?>
  1621 							?>
  1517 		" style="display: none"><td colspan="<?php echo $this->get_column_count(); ?>" class="colspanchange">
  1622 						</span>
  1518 
  1623 						<label class="alignleft inline-edit-private">
  1519 		<fieldset class="inline-edit-col-left">
  1624 							<input type="checkbox" name="keep_private" value="private" />
  1520 			<legend class="inline-edit-legend"><?php echo $bulk ? __( 'Bulk Edit' ) : __( 'Quick Edit' ); ?></legend>
  1625 							<span class="checkbox-title"><?php _e( 'Private' ); ?></span>
  1521 			<div class="inline-edit-col">
  1626 						</label>
  1522 			<?php
  1627 					</div>
  1523 
  1628 
  1524 			if ( post_type_supports( $screen->post_type, 'title' ) ) :
  1629 				<?php endif; ?>
  1525 				if ( $bulk ) :
  1630 
  1526 					?>
  1631 				</div>
  1527 			<div id="bulk-title-div">
       
  1528 				<div id="bulk-titles"></div>
       
  1529 			</div>
       
  1530 
       
  1531 			<?php else : // $bulk ?>
       
  1532 
       
  1533 			<label>
       
  1534 				<span class="title"><?php _e( 'Title' ); ?></span>
       
  1535 				<span class="input-text-wrap"><input type="text" name="post_title" class="ptitle" value="" /></span>
       
  1536 			</label>
       
  1537 
       
  1538 				<?php if ( is_post_type_viewable( $screen->post_type ) ) : // is_post_type_viewable check ?>
       
  1539 
       
  1540 			<label>
       
  1541 				<span class="title"><?php _e( 'Slug' ); ?></span>
       
  1542 				<span class="input-text-wrap"><input type="text" name="post_name" value="" /></span>
       
  1543 			</label>
       
  1544 
       
  1545 					<?php
       
  1546 	endif; // is_post_type_viewable check
       
  1547 	endif; // $bulk
       
  1548 	endif; // post_type_supports title
       
  1549 			?>
       
  1550 
       
  1551 			<?php if ( ! $bulk ) : ?>
       
  1552 			<fieldset class="inline-edit-date">
       
  1553 			<legend><span class="title"><?php _e( 'Date' ); ?></span></legend>
       
  1554 				<?php touch_time( 1, 1, 0, 1 ); ?>
       
  1555 			</fieldset>
  1632 			</fieldset>
  1556 			<br class="clear" />
  1633 
       
  1634 			<?php if ( count( $hierarchical_taxonomies ) && ! $bulk ) : ?>
       
  1635 
       
  1636 				<fieldset class="inline-edit-col-center inline-edit-categories">
       
  1637 					<div class="inline-edit-col">
       
  1638 
       
  1639 					<?php foreach ( $hierarchical_taxonomies as $taxonomy ) : ?>
       
  1640 
       
  1641 						<span class="title inline-edit-categories-label"><?php echo esc_html( $taxonomy->labels->name ); ?></span>
       
  1642 						<input type="hidden" name="<?php echo ( 'category' === $taxonomy->name ) ? 'post_category[]' : 'tax_input[' . esc_attr( $taxonomy->name ) . '][]'; ?>" value="0" />
       
  1643 						<ul class="cat-checklist <?php echo esc_attr( $taxonomy->name ); ?>-checklist">
       
  1644 							<?php wp_terms_checklist( null, array( 'taxonomy' => $taxonomy->name ) ); ?>
       
  1645 						</ul>
       
  1646 
       
  1647 					<?php endforeach; // $hierarchical_taxonomies as $taxonomy ?>
       
  1648 
       
  1649 					</div>
       
  1650 				</fieldset>
       
  1651 
       
  1652 			<?php endif; // count( $hierarchical_taxonomies ) && ! $bulk ?>
       
  1653 
       
  1654 			<fieldset class="inline-edit-col-right">
       
  1655 				<div class="inline-edit-col">
       
  1656 
  1557 				<?php
  1657 				<?php
  1558 	endif; // $bulk
  1658 				if ( post_type_supports( $screen->post_type, 'author' ) && $bulk ) {
  1559 
  1659 					echo $authors_dropdown;
  1560 			if ( post_type_supports( $screen->post_type, 'author' ) ) :
       
  1561 				$authors_dropdown = '';
       
  1562 
       
  1563 				if ( current_user_can( $post_type_object->cap->edit_others_posts ) ) :
       
  1564 					$users_opt = array(
       
  1565 						'hide_if_only_one_author' => false,
       
  1566 						'who'                     => 'authors',
       
  1567 						'name'                    => 'post_author',
       
  1568 						'class'                   => 'authors',
       
  1569 						'multi'                   => 1,
       
  1570 						'echo'                    => 0,
       
  1571 						'show'                    => 'display_name_with_login',
       
  1572 					);
       
  1573 					if ( $bulk ) {
       
  1574 						$users_opt['show_option_none'] = __( '&mdash; No Change &mdash;' );
       
  1575 					}
       
  1576 
       
  1577 					if ( $authors = wp_dropdown_users( $users_opt ) ) :
       
  1578 						$authors_dropdown  = '<label class="inline-edit-author">';
       
  1579 						$authors_dropdown .= '<span class="title">' . __( 'Author' ) . '</span>';
       
  1580 						$authors_dropdown .= $authors;
       
  1581 						$authors_dropdown .= '</label>';
       
  1582 					endif;
       
  1583 				endif; // authors
       
  1584 				?>
       
  1585 
       
  1586 				<?php
       
  1587 				if ( ! $bulk ) {
       
  1588 					echo $authors_dropdown;}
       
  1589 	endif; // post_type_supports author
       
  1590 
       
  1591 			if ( ! $bulk && $can_publish ) :
       
  1592 				?>
       
  1593 
       
  1594 		<div class="inline-edit-group wp-clearfix">
       
  1595 			<label class="alignleft">
       
  1596 				<span class="title"><?php _e( 'Password' ); ?></span>
       
  1597 				<span class="input-text-wrap"><input type="text" name="post_password" class="inline-edit-password-input" value="" /></span>
       
  1598 			</label>
       
  1599 
       
  1600 			<em class="alignleft inline-edit-or">
       
  1601 				<?php
       
  1602 				/* translators: Between password field and private checkbox on post quick edit interface */
       
  1603 				_e( '&ndash;OR&ndash;' );
       
  1604 				?>
       
  1605 				</em>
       
  1606 				<label class="alignleft inline-edit-private">
       
  1607 				<input type="checkbox" name="keep_private" value="private" />
       
  1608 				<span class="checkbox-title"><?php _e( 'Private' ); ?></span>
       
  1609 				</label>
       
  1610 			</div>
       
  1611 
       
  1612 				<?php endif; ?>
       
  1613 
       
  1614 		</div></fieldset>
       
  1615 
       
  1616 			<?php if ( count( $hierarchical_taxonomies ) && ! $bulk ) : ?>
       
  1617 
       
  1618 		<fieldset class="inline-edit-col-center inline-edit-categories"><div class="inline-edit-col">
       
  1619 
       
  1620 				<?php foreach ( $hierarchical_taxonomies as $taxonomy ) : ?>
       
  1621 
       
  1622 			<span class="title inline-edit-categories-label"><?php echo esc_html( $taxonomy->labels->name ); ?></span>
       
  1623 			<input type="hidden" name="<?php echo ( $taxonomy->name === 'category' ) ? 'post_category[]' : 'tax_input[' . esc_attr( $taxonomy->name ) . '][]'; ?>" value="0" />
       
  1624 			<ul class="cat-checklist <?php echo esc_attr( $taxonomy->name ); ?>-checklist">
       
  1625 					<?php wp_terms_checklist( null, array( 'taxonomy' => $taxonomy->name ) ); ?>
       
  1626 			</ul>
       
  1627 
       
  1628 	<?php endforeach; //$hierarchical_taxonomies as $taxonomy ?>
       
  1629 
       
  1630 		</div></fieldset>
       
  1631 
       
  1632 	<?php endif; // count( $hierarchical_taxonomies ) && !$bulk ?>
       
  1633 
       
  1634 		<fieldset class="inline-edit-col-right"><div class="inline-edit-col">
       
  1635 
       
  1636 			<?php
       
  1637 			if ( post_type_supports( $screen->post_type, 'author' ) && $bulk ) {
       
  1638 				echo $authors_dropdown;
       
  1639 			}
       
  1640 
       
  1641 			if ( post_type_supports( $screen->post_type, 'page-attributes' ) ) :
       
  1642 
       
  1643 				if ( $post_type_object->hierarchical ) :
       
  1644 					?>
       
  1645 		<label>
       
  1646 			<span class="title"><?php _e( 'Parent' ); ?></span>
       
  1647 					<?php
       
  1648 					$dropdown_args = array(
       
  1649 						'post_type'         => $post_type_object->name,
       
  1650 						'selected'          => $post->post_parent,
       
  1651 						'name'              => 'post_parent',
       
  1652 						'show_option_none'  => __( 'Main Page (no parent)' ),
       
  1653 						'option_none_value' => 0,
       
  1654 						'sort_column'       => 'menu_order, post_title',
       
  1655 					);
       
  1656 
       
  1657 					if ( $bulk ) {
       
  1658 						$dropdown_args['show_option_no_change'] = __( '&mdash; No Change &mdash;' );
       
  1659 					}
       
  1660 
       
  1661 					/**
       
  1662 					 * Filters the arguments used to generate the Quick Edit page-parent drop-down.
       
  1663 					 *
       
  1664 					 * @since 2.7.0
       
  1665 					 *
       
  1666 					 * @see wp_dropdown_pages()
       
  1667 					 *
       
  1668 					 * @param array $dropdown_args An array of arguments.
       
  1669 					 */
       
  1670 					$dropdown_args = apply_filters( 'quick_edit_dropdown_pages_args', $dropdown_args );
       
  1671 
       
  1672 					wp_dropdown_pages( $dropdown_args );
       
  1673 					?>
       
  1674 		</label>
       
  1675 
       
  1676 					<?php
       
  1677 				endif; // hierarchical
       
  1678 
       
  1679 				if ( ! $bulk ) :
       
  1680 					?>
       
  1681 
       
  1682 			<label>
       
  1683 				<span class="title"><?php _e( 'Order' ); ?></span>
       
  1684 				<span class="input-text-wrap"><input type="text" name="menu_order" class="inline-edit-menu-order-input" value="<?php echo $post->menu_order; ?>" /></span>
       
  1685 			</label>
       
  1686 
       
  1687 					<?php
       
  1688 				endif; // !$bulk
       
  1689 		endif; // page-attributes
       
  1690 			?>
       
  1691 
       
  1692 			<?php if ( 0 < count( get_page_templates( null, $screen->post_type ) ) ) : ?>
       
  1693 		<label>
       
  1694 			<span class="title"><?php _e( 'Template' ); ?></span>
       
  1695 			<select name="page_template">
       
  1696 				<?php	if ( $bulk ) : ?>
       
  1697 				<option value="-1"><?php _e( '&mdash; No Change &mdash;' ); ?></option>
       
  1698 				<?php	endif; // $bulk ?>
       
  1699 				<?php
       
  1700 				/** This filter is documented in wp-admin/includes/meta-boxes.php */
       
  1701 				$default_title = apply_filters( 'default_page_template_title', __( 'Default Template' ), 'quick-edit' );
       
  1702 				?>
       
  1703 				<option value="default"><?php echo esc_html( $default_title ); ?></option>
       
  1704 				<?php page_template_dropdown( '', $screen->post_type ); ?>
       
  1705 			</select>
       
  1706 		</label>
       
  1707 	<?php endif; ?>
       
  1708 
       
  1709 			<?php if ( count( $flat_taxonomies ) && ! $bulk ) : ?>
       
  1710 
       
  1711 				<?php foreach ( $flat_taxonomies as $taxonomy ) : ?>
       
  1712 					<?php
       
  1713 					if ( current_user_can( $taxonomy->cap->assign_terms ) ) :
       
  1714 						$taxonomy_name = esc_attr( $taxonomy->name );
       
  1715 
       
  1716 						?>
       
  1717 			<label class="inline-edit-tags">
       
  1718 				<span class="title"><?php echo esc_html( $taxonomy->labels->name ); ?></span>
       
  1719 				<textarea data-wp-taxonomy="<?php echo $taxonomy_name; ?>" cols="22" rows="1" name="tax_input[<?php echo $taxonomy_name; ?>]" class="tax_input_<?php echo $taxonomy_name; ?>"></textarea>
       
  1720 			</label>
       
  1721 					<?php endif; ?>
       
  1722 
       
  1723 	<?php endforeach; //$flat_taxonomies as $taxonomy ?>
       
  1724 
       
  1725 	<?php endif; // count( $flat_taxonomies ) && !$bulk ?>
       
  1726 
       
  1727 			<?php
       
  1728 			if ( post_type_supports( $screen->post_type, 'comments' ) || post_type_supports( $screen->post_type, 'trackbacks' ) ) :
       
  1729 				if ( $bulk ) :
       
  1730 					?>
       
  1731 
       
  1732 			<div class="inline-edit-group wp-clearfix">
       
  1733 					<?php if ( post_type_supports( $screen->post_type, 'comments' ) ) : ?>
       
  1734 			<label class="alignleft">
       
  1735 				<span class="title"><?php _e( 'Comments' ); ?></span>
       
  1736 				<select name="comment_status">
       
  1737 					<option value=""><?php _e( '&mdash; No Change &mdash;' ); ?></option>
       
  1738 					<option value="open"><?php _e( 'Allow' ); ?></option>
       
  1739 					<option value="closed"><?php _e( 'Do not allow' ); ?></option>
       
  1740 				</select>
       
  1741 			</label>
       
  1742 		<?php endif; if ( post_type_supports( $screen->post_type, 'trackbacks' ) ) : ?>
       
  1743 			<label class="alignright">
       
  1744 				<span class="title"><?php _e( 'Pings' ); ?></span>
       
  1745 				<select name="ping_status">
       
  1746 					<option value=""><?php _e( '&mdash; No Change &mdash;' ); ?></option>
       
  1747 					<option value="open"><?php _e( 'Allow' ); ?></option>
       
  1748 					<option value="closed"><?php _e( 'Do not allow' ); ?></option>
       
  1749 				</select>
       
  1750 			</label>
       
  1751 		<?php endif; ?>
       
  1752 			</div>
       
  1753 
       
  1754 			<?php else : // $bulk ?>
       
  1755 
       
  1756 			<div class="inline-edit-group wp-clearfix">
       
  1757 				<?php if ( post_type_supports( $screen->post_type, 'comments' ) ) : ?>
       
  1758 				<label class="alignleft">
       
  1759 					<input type="checkbox" name="comment_status" value="open" />
       
  1760 					<span class="checkbox-title"><?php _e( 'Allow Comments' ); ?></span>
       
  1761 				</label>
       
  1762 			<?php endif; if ( post_type_supports( $screen->post_type, 'trackbacks' ) ) : ?>
       
  1763 				<label class="alignleft">
       
  1764 					<input type="checkbox" name="ping_status" value="open" />
       
  1765 					<span class="checkbox-title"><?php _e( 'Allow Pings' ); ?></span>
       
  1766 				</label>
       
  1767 			<?php endif; ?>
       
  1768 			</div>
       
  1769 
       
  1770 				<?php
       
  1771 	endif; // $bulk
       
  1772 	endif; // post_type_supports comments or pings
       
  1773 			?>
       
  1774 
       
  1775 			<div class="inline-edit-group wp-clearfix">
       
  1776 				<label class="inline-edit-status alignleft">
       
  1777 					<span class="title"><?php _e( 'Status' ); ?></span>
       
  1778 					<select name="_status">
       
  1779 			<?php if ( $bulk ) : ?>
       
  1780 						<option value="-1"><?php _e( '&mdash; No Change &mdash;' ); ?></option>
       
  1781 	<?php endif; // $bulk ?>
       
  1782 					<?php if ( $can_publish ) : // Contributors only get "Unpublished" and "Pending Review" ?>
       
  1783 						<option value="publish"><?php _e( 'Published' ); ?></option>
       
  1784 						<option value="future"><?php _e( 'Scheduled' ); ?></option>
       
  1785 						<?php if ( $bulk ) : ?>
       
  1786 						<option value="private"><?php _e( 'Private' ); ?></option>
       
  1787 	<?php endif; // $bulk ?>
       
  1788 					<?php endif; ?>
       
  1789 						<option value="pending"><?php _e( 'Pending Review' ); ?></option>
       
  1790 						<option value="draft"><?php _e( 'Draft' ); ?></option>
       
  1791 					</select>
       
  1792 				</label>
       
  1793 
       
  1794 			<?php if ( 'post' === $screen->post_type && $can_publish && current_user_can( $post_type_object->cap->edit_others_posts ) ) : ?>
       
  1795 
       
  1796 				<?php	if ( $bulk ) : ?>
       
  1797 
       
  1798 				<label class="alignright">
       
  1799 					<span class="title"><?php _e( 'Sticky' ); ?></span>
       
  1800 					<select name="sticky">
       
  1801 						<option value="-1"><?php _e( '&mdash; No Change &mdash;' ); ?></option>
       
  1802 						<option value="sticky"><?php _e( 'Sticky' ); ?></option>
       
  1803 						<option value="unsticky"><?php _e( 'Not Sticky' ); ?></option>
       
  1804 					</select>
       
  1805 				</label>
       
  1806 
       
  1807 	<?php	else : // $bulk ?>
       
  1808 
       
  1809 				<label class="alignleft">
       
  1810 					<input type="checkbox" name="sticky" value="sticky" />
       
  1811 					<span class="checkbox-title"><?php _e( 'Make this post sticky' ); ?></span>
       
  1812 				</label>
       
  1813 
       
  1814 	<?php	endif; // $bulk ?>
       
  1815 
       
  1816 	<?php endif; // 'post' && $can_publish && current_user_can( 'edit_others_cap' ) ?>
       
  1817 
       
  1818 			</div>
       
  1819 
       
  1820 			<?php
       
  1821 
       
  1822 			if ( $bulk && current_theme_supports( 'post-formats' ) && post_type_supports( $screen->post_type, 'post-formats' ) ) {
       
  1823 				$post_formats = get_theme_support( 'post-formats' );
       
  1824 
       
  1825 				?>
       
  1826 		<label class="alignleft">
       
  1827 		<span class="title"><?php _ex( 'Format', 'post format' ); ?></span>
       
  1828 		<select name="post_format">
       
  1829 			<option value="-1"><?php _e( '&mdash; No Change &mdash;' ); ?></option>
       
  1830 			<option value="0"><?php echo get_post_format_string( 'standard' ); ?></option>
       
  1831 				<?php
       
  1832 				if ( is_array( $post_formats[0] ) ) {
       
  1833 					foreach ( $post_formats[0] as $format ) {
       
  1834 						?>
       
  1835 					<option value="<?php echo esc_attr( $format ); ?>"><?php echo esc_html( get_post_format_string( $format ) ); ?></option>
       
  1836 						<?php
       
  1837 					}
       
  1838 				}
  1660 				}
  1839 				?>
  1661 				?>
  1840 		</select></label>
  1662 
  1841 				<?php
  1663 				<?php if ( post_type_supports( $screen->post_type, 'page-attributes' ) ) : ?>
  1842 
  1664 
  1843 			}
  1665 					<?php if ( $post_type_object->hierarchical ) : ?>
  1844 
  1666 
  1845 			?>
  1667 						<label>
  1846 
  1668 							<span class="title"><?php _e( 'Parent' ); ?></span>
  1847 		</div></fieldset>
  1669 							<?php
       
  1670 							$dropdown_args = array(
       
  1671 								'post_type'         => $post_type_object->name,
       
  1672 								'selected'          => $post->post_parent,
       
  1673 								'name'              => 'post_parent',
       
  1674 								'show_option_none'  => __( 'Main Page (no parent)' ),
       
  1675 								'option_none_value' => 0,
       
  1676 								'sort_column'       => 'menu_order, post_title',
       
  1677 							);
       
  1678 
       
  1679 							if ( $bulk ) {
       
  1680 								$dropdown_args['show_option_no_change'] = __( '&mdash; No Change &mdash;' );
       
  1681 							}
       
  1682 
       
  1683 							/**
       
  1684 							 * Filters the arguments used to generate the Quick Edit page-parent drop-down.
       
  1685 							 *
       
  1686 							 * @since 2.7.0
       
  1687 							 *
       
  1688 							 * @see wp_dropdown_pages()
       
  1689 							 *
       
  1690 							 * @param array $dropdown_args An array of arguments.
       
  1691 							 */
       
  1692 							$dropdown_args = apply_filters( 'quick_edit_dropdown_pages_args', $dropdown_args );
       
  1693 
       
  1694 							wp_dropdown_pages( $dropdown_args );
       
  1695 							?>
       
  1696 						</label>
       
  1697 
       
  1698 					<?php endif; // hierarchical ?>
       
  1699 
       
  1700 					<?php if ( ! $bulk ) : ?>
       
  1701 
       
  1702 						<label>
       
  1703 							<span class="title"><?php _e( 'Order' ); ?></span>
       
  1704 							<span class="input-text-wrap"><input type="text" name="menu_order" class="inline-edit-menu-order-input" value="<?php echo $post->menu_order; ?>" /></span>
       
  1705 						</label>
       
  1706 
       
  1707 					<?php endif; // ! $bulk ?>
       
  1708 
       
  1709 				<?php endif; // post_type_supports( ... 'page-attributes' ) ?>
       
  1710 
       
  1711 				<?php if ( 0 < count( get_page_templates( null, $screen->post_type ) ) ) : ?>
       
  1712 
       
  1713 					<label>
       
  1714 						<span class="title"><?php _e( 'Template' ); ?></span>
       
  1715 						<select name="page_template">
       
  1716 							<?php if ( $bulk ) : ?>
       
  1717 							<option value="-1"><?php _e( '&mdash; No Change &mdash;' ); ?></option>
       
  1718 							<?php endif; // $bulk ?>
       
  1719 							<?php
       
  1720 							/** This filter is documented in wp-admin/includes/meta-boxes.php */
       
  1721 							$default_title = apply_filters( 'default_page_template_title', __( 'Default template' ), 'quick-edit' );
       
  1722 							?>
       
  1723 							<option value="default"><?php echo esc_html( $default_title ); ?></option>
       
  1724 							<?php page_template_dropdown( '', $screen->post_type ); ?>
       
  1725 						</select>
       
  1726 					</label>
       
  1727 
       
  1728 				<?php endif; ?>
       
  1729 
       
  1730 				<?php if ( count( $flat_taxonomies ) && ! $bulk ) : ?>
       
  1731 
       
  1732 					<?php foreach ( $flat_taxonomies as $taxonomy ) : ?>
       
  1733 
       
  1734 						<?php if ( current_user_can( $taxonomy->cap->assign_terms ) ) : ?>
       
  1735 							<?php $taxonomy_name = esc_attr( $taxonomy->name ); ?>
       
  1736 
       
  1737 							<label class="inline-edit-tags">
       
  1738 								<span class="title"><?php echo esc_html( $taxonomy->labels->name ); ?></span>
       
  1739 								<textarea data-wp-taxonomy="<?php echo $taxonomy_name; ?>" cols="22" rows="1" name="tax_input[<?php echo $taxonomy_name; ?>]" class="tax_input_<?php echo $taxonomy_name; ?>"></textarea>
       
  1740 							</label>
       
  1741 
       
  1742 						<?php endif; // current_user_can( 'assign_terms' ) ?>
       
  1743 
       
  1744 					<?php endforeach; // $flat_taxonomies as $taxonomy ?>
       
  1745 
       
  1746 				<?php endif; // count( $flat_taxonomies ) && ! $bulk ?>
       
  1747 
       
  1748 				<?php if ( post_type_supports( $screen->post_type, 'comments' ) || post_type_supports( $screen->post_type, 'trackbacks' ) ) : ?>
       
  1749 
       
  1750 					<?php if ( $bulk ) : ?>
       
  1751 
       
  1752 						<div class="inline-edit-group wp-clearfix">
       
  1753 
       
  1754 						<?php if ( post_type_supports( $screen->post_type, 'comments' ) ) : ?>
       
  1755 
       
  1756 							<label class="alignleft">
       
  1757 								<span class="title"><?php _e( 'Comments' ); ?></span>
       
  1758 								<select name="comment_status">
       
  1759 									<option value=""><?php _e( '&mdash; No Change &mdash;' ); ?></option>
       
  1760 									<option value="open"><?php _e( 'Allow' ); ?></option>
       
  1761 									<option value="closed"><?php _e( 'Do not allow' ); ?></option>
       
  1762 								</select>
       
  1763 							</label>
       
  1764 
       
  1765 						<?php endif; ?>
       
  1766 
       
  1767 						<?php if ( post_type_supports( $screen->post_type, 'trackbacks' ) ) : ?>
       
  1768 
       
  1769 							<label class="alignright">
       
  1770 								<span class="title"><?php _e( 'Pings' ); ?></span>
       
  1771 								<select name="ping_status">
       
  1772 									<option value=""><?php _e( '&mdash; No Change &mdash;' ); ?></option>
       
  1773 									<option value="open"><?php _e( 'Allow' ); ?></option>
       
  1774 									<option value="closed"><?php _e( 'Do not allow' ); ?></option>
       
  1775 								</select>
       
  1776 							</label>
       
  1777 
       
  1778 						<?php endif; ?>
       
  1779 
       
  1780 						</div>
       
  1781 
       
  1782 					<?php else : // $bulk ?>
       
  1783 
       
  1784 						<div class="inline-edit-group wp-clearfix">
       
  1785 
       
  1786 						<?php if ( post_type_supports( $screen->post_type, 'comments' ) ) : ?>
       
  1787 
       
  1788 							<label class="alignleft">
       
  1789 								<input type="checkbox" name="comment_status" value="open" />
       
  1790 								<span class="checkbox-title"><?php _e( 'Allow Comments' ); ?></span>
       
  1791 							</label>
       
  1792 
       
  1793 						<?php endif; ?>
       
  1794 
       
  1795 						<?php if ( post_type_supports( $screen->post_type, 'trackbacks' ) ) : ?>
       
  1796 
       
  1797 							<label class="alignleft">
       
  1798 								<input type="checkbox" name="ping_status" value="open" />
       
  1799 								<span class="checkbox-title"><?php _e( 'Allow Pings' ); ?></span>
       
  1800 							</label>
       
  1801 
       
  1802 						<?php endif; ?>
       
  1803 
       
  1804 						</div>
       
  1805 
       
  1806 					<?php endif; // $bulk ?>
       
  1807 
       
  1808 				<?php endif; // post_type_supports( ... comments or pings ) ?>
       
  1809 
       
  1810 					<div class="inline-edit-group wp-clearfix">
       
  1811 
       
  1812 						<label class="inline-edit-status alignleft">
       
  1813 							<span class="title"><?php _e( 'Status' ); ?></span>
       
  1814 							<select name="_status">
       
  1815 								<?php if ( $bulk ) : ?>
       
  1816 									<option value="-1"><?php _e( '&mdash; No Change &mdash;' ); ?></option>
       
  1817 								<?php endif; // $bulk ?>
       
  1818 
       
  1819 								<?php if ( $can_publish ) : // Contributors only get "Unpublished" and "Pending Review". ?>
       
  1820 									<option value="publish"><?php _e( 'Published' ); ?></option>
       
  1821 									<option value="future"><?php _e( 'Scheduled' ); ?></option>
       
  1822 									<?php if ( $bulk ) : ?>
       
  1823 										<option value="private"><?php _e( 'Private' ); ?></option>
       
  1824 									<?php endif; // $bulk ?>
       
  1825 								<?php endif; ?>
       
  1826 
       
  1827 								<option value="pending"><?php _e( 'Pending Review' ); ?></option>
       
  1828 								<option value="draft"><?php _e( 'Draft' ); ?></option>
       
  1829 							</select>
       
  1830 						</label>
       
  1831 
       
  1832 						<?php if ( 'post' === $screen->post_type && $can_publish && current_user_can( $post_type_object->cap->edit_others_posts ) ) : ?>
       
  1833 
       
  1834 							<?php if ( $bulk ) : ?>
       
  1835 
       
  1836 								<label class="alignright">
       
  1837 									<span class="title"><?php _e( 'Sticky' ); ?></span>
       
  1838 									<select name="sticky">
       
  1839 										<option value="-1"><?php _e( '&mdash; No Change &mdash;' ); ?></option>
       
  1840 										<option value="sticky"><?php _e( 'Sticky' ); ?></option>
       
  1841 										<option value="unsticky"><?php _e( 'Not Sticky' ); ?></option>
       
  1842 									</select>
       
  1843 								</label>
       
  1844 
       
  1845 							<?php else : // $bulk ?>
       
  1846 
       
  1847 								<label class="alignleft">
       
  1848 									<input type="checkbox" name="sticky" value="sticky" />
       
  1849 									<span class="checkbox-title"><?php _e( 'Make this post sticky' ); ?></span>
       
  1850 								</label>
       
  1851 
       
  1852 							<?php endif; // $bulk ?>
       
  1853 
       
  1854 						<?php endif; // 'post' && $can_publish && current_user_can( 'edit_others_posts' ) ?>
       
  1855 
       
  1856 					</div>
       
  1857 
       
  1858 				<?php if ( $bulk && current_theme_supports( 'post-formats' ) && post_type_supports( $screen->post_type, 'post-formats' ) ) : ?>
       
  1859 					<?php $post_formats = get_theme_support( 'post-formats' ); ?>
       
  1860 
       
  1861 					<label class="alignleft">
       
  1862 						<span class="title"><?php _ex( 'Format', 'post format' ); ?></span>
       
  1863 						<select name="post_format">
       
  1864 							<option value="-1"><?php _e( '&mdash; No Change &mdash;' ); ?></option>
       
  1865 							<option value="0"><?php echo get_post_format_string( 'standard' ); ?></option>
       
  1866 							<?php if ( is_array( $post_formats[0] ) ) : ?>
       
  1867 								<?php foreach ( $post_formats[0] as $format ) : ?>
       
  1868 									<option value="<?php echo esc_attr( $format ); ?>"><?php echo esc_html( get_post_format_string( $format ) ); ?></option>
       
  1869 								<?php endforeach; ?>
       
  1870 							<?php endif; ?>
       
  1871 						</select>
       
  1872 					</label>
       
  1873 
       
  1874 				<?php endif; ?>
       
  1875 
       
  1876 				</div>
       
  1877 			</fieldset>
  1848 
  1878 
  1849 			<?php
  1879 			<?php
  1850 			list( $columns ) = $this->get_column_info();
  1880 			list( $columns ) = $this->get_column_info();
  1851 
  1881 
  1852 			foreach ( $columns as $column_name => $column_display_name ) {
  1882 			foreach ( $columns as $column_name => $column_display_name ) {
  1859 					/**
  1889 					/**
  1860 					 * Fires once for each column in Bulk Edit mode.
  1890 					 * Fires once for each column in Bulk Edit mode.
  1861 					 *
  1891 					 *
  1862 					 * @since 2.7.0
  1892 					 * @since 2.7.0
  1863 					 *
  1893 					 *
  1864 					 * @param string  $column_name Name of the column to edit.
  1894 					 * @param string $column_name Name of the column to edit.
  1865 					 * @param WP_Post $post_type   The post type slug.
  1895 					 * @param string $post_type   The post type slug.
  1866 					 */
  1896 					 */
  1867 					do_action( 'bulk_edit_custom_box', $column_name, $screen->post_type );
  1897 					do_action( 'bulk_edit_custom_box', $column_name, $screen->post_type );
  1868 				} else {
  1898 				} else {
  1869 
  1899 
  1870 					/**
  1900 					/**
  1872 					 *
  1902 					 *
  1873 					 * @since 2.7.0
  1903 					 * @since 2.7.0
  1874 					 *
  1904 					 *
  1875 					 * @param string $column_name Name of the column to edit.
  1905 					 * @param string $column_name Name of the column to edit.
  1876 					 * @param string $post_type   The post type slug, or current screen name if this is a taxonomy list table.
  1906 					 * @param string $post_type   The post type slug, or current screen name if this is a taxonomy list table.
  1877 					 * @param string taxonomy     The taxonomy name, if any.
  1907 					 * @param string $taxonomy    The taxonomy name, if any.
  1878 					 */
  1908 					 */
  1879 					do_action( 'quick_edit_custom_box', $column_name, $screen->post_type, '' );
  1909 					do_action( 'quick_edit_custom_box', $column_name, $screen->post_type, '' );
  1880 				}
  1910 				}
  1881 			}
  1911 			}
  1882 			?>
  1912 			?>
  1883 		<div class="submit inline-edit-save">
  1913 
  1884 			<button type="button" class="button cancel alignleft"><?php _e( 'Cancel' ); ?></button>
  1914 			<div class="submit inline-edit-save">
  1885 			<?php
  1915 				<button type="button" class="button cancel alignleft"><?php _e( 'Cancel' ); ?></button>
  1886 			if ( ! $bulk ) {
  1916 
  1887 				wp_nonce_field( 'inlineeditnonce', '_inline_edit', false );
  1917 				<?php if ( ! $bulk ) : ?>
  1888 				?>
  1918 					<?php wp_nonce_field( 'inlineeditnonce', '_inline_edit', false ); ?>
  1889 				<button type="button" class="button button-primary save alignright"><?php _e( 'Update' ); ?></button>
  1919 					<button type="button" class="button button-primary save alignright"><?php _e( 'Update' ); ?></button>
  1890 				<span class="spinner"></span>
  1920 					<span class="spinner"></span>
  1891 				<?php
  1921 				<?php else : ?>
  1892 			} else {
  1922 					<?php submit_button( __( 'Update' ), 'primary alignright', 'bulk_edit', false ); ?>
  1893 				submit_button( __( 'Update' ), 'primary alignright', 'bulk_edit', false );
  1923 				<?php endif; ?>
  1894 			}
  1924 
  1895 			?>
  1925 				<input type="hidden" name="post_view" value="<?php echo esc_attr( $m ); ?>" />
  1896 			<input type="hidden" name="post_view" value="<?php echo esc_attr( $m ); ?>" />
  1926 				<input type="hidden" name="screen" value="<?php echo esc_attr( $screen->id ); ?>" />
  1897 			<input type="hidden" name="screen" value="<?php echo esc_attr( $screen->id ); ?>" />
  1927 				<?php if ( ! $bulk && ! post_type_supports( $screen->post_type, 'author' ) ) : ?>
  1898 			<?php if ( ! $bulk && ! post_type_supports( $screen->post_type, 'author' ) ) { ?>
  1928 					<input type="hidden" name="post_author" value="<?php echo esc_attr( $post->post_author ); ?>" />
  1899 				<input type="hidden" name="post_author" value="<?php echo esc_attr( $post->post_author ); ?>" />
  1929 				<?php endif; ?>
  1900 			<?php } ?>
  1930 				<br class="clear" />
  1901 			<br class="clear" />
  1931 
  1902 			<div class="notice notice-error notice-alt inline hidden">
  1932 				<div class="notice notice-error notice-alt inline hidden">
  1903 				<p class="error"></p>
  1933 					<p class="error"></p>
       
  1934 				</div>
  1904 			</div>
  1935 			</div>
  1905 		</div>
  1936 
  1906 		</td></tr>
  1937 			</td></tr>
       
  1938 
  1907 			<?php
  1939 			<?php
  1908 			$bulk++;
  1940 			$bulk++;
  1909 		}
  1941 		endwhile;
  1910 		?>
  1942 		?>
  1911 		</tbody></table></form>
  1943 		</tbody></table>
       
  1944 		</form>
  1912 		<?php
  1945 		<?php
  1913 	}
  1946 	}
  1914 }
  1947 }