[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-admin/includes/ -> class-wp-posts-list-table.php (source)

   1  <?php
   2  /**
   3   * List Table API: WP_Posts_List_Table class
   4   *
   5   * @package WordPress
   6   * @subpackage Administration
   7   * @since 3.1.0
   8   */
   9  
  10  /**
  11   * Core class used to implement displaying posts in a list table.
  12   *
  13   * @since 3.1.0
  14   * @access private
  15   *
  16   * @see WP_List_Table
  17   */
  18  class WP_Posts_List_Table extends WP_List_Table {
  19  
  20      /**
  21       * Whether the items should be displayed hierarchically or linearly.
  22       *
  23       * @since 3.1.0
  24       * @var bool
  25       */
  26      protected $hierarchical_display;
  27  
  28      /**
  29       * Holds the number of pending comments for each post.
  30       *
  31       * @since 3.1.0
  32       * @var array
  33       */
  34      protected $comment_pending_count;
  35  
  36      /**
  37       * Holds the number of posts for this user.
  38       *
  39       * @since 3.1.0
  40       * @var int
  41       */
  42      private $user_posts_count;
  43  
  44      /**
  45       * Holds the number of posts which are sticky.
  46       *
  47       * @since 3.1.0
  48       * @var int
  49       */
  50      private $sticky_posts_count = 0;
  51  
  52      private $is_trash;
  53  
  54      /**
  55       * Current level for output.
  56       *
  57       * @since 4.3.0
  58       * @var int
  59       */
  60      protected $current_level = 0;
  61  
  62      /**
  63       * Constructor.
  64       *
  65       * @since 3.1.0
  66       *
  67       * @see WP_List_Table::__construct() for more information on default arguments.
  68       *
  69       * @global WP_Post_Type $post_type_object
  70       * @global wpdb         $wpdb             WordPress database abstraction object.
  71       *
  72       * @param array $args An associative array of arguments.
  73       */
  74  	public function __construct( $args = array() ) {
  75          global $post_type_object, $wpdb;
  76  
  77          parent::__construct(
  78              array(
  79                  'plural' => 'posts',
  80                  'screen' => isset( $args['screen'] ) ? $args['screen'] : null,
  81              )
  82          );
  83  
  84          $post_type        = $this->screen->post_type;
  85          $post_type_object = get_post_type_object( $post_type );
  86  
  87          $exclude_states = get_post_stati(
  88              array(
  89                  'show_in_admin_all_list' => false,
  90              )
  91          );
  92  
  93          $this->user_posts_count = (int) $wpdb->get_var(
  94              $wpdb->prepare(
  95                  "SELECT COUNT( 1 )
  96                  FROM $wpdb->posts
  97                  WHERE post_type = %s
  98                  AND post_status NOT IN ( '" . implode( "','", $exclude_states ) . "' )
  99                  AND post_author = %d",
 100                  $post_type,
 101                  get_current_user_id()
 102              )
 103          );
 104  
 105          if ( $this->user_posts_count
 106              && ! current_user_can( $post_type_object->cap->edit_others_posts )
 107              && empty( $_REQUEST['post_status'] ) && empty( $_REQUEST['all_posts'] )
 108              && empty( $_REQUEST['author'] ) && empty( $_REQUEST['show_sticky'] )
 109          ) {
 110              $_GET['author'] = get_current_user_id();
 111          }
 112  
 113          $sticky_posts = get_option( 'sticky_posts' );
 114  
 115          if ( 'post' === $post_type && $sticky_posts ) {
 116              $sticky_posts = implode( ', ', array_map( 'absint', (array) $sticky_posts ) );
 117  
 118              $this->sticky_posts_count = (int) $wpdb->get_var(
 119                  $wpdb->prepare(
 120                      "SELECT COUNT( 1 )
 121                      FROM $wpdb->posts
 122                      WHERE post_type = %s
 123                      AND post_status NOT IN ('trash', 'auto-draft')
 124                      AND ID IN ($sticky_posts)",
 125                      $post_type
 126                  )
 127              );
 128          }
 129      }
 130  
 131      /**
 132       * Sets whether the table layout should be hierarchical or not.
 133       *
 134       * @since 4.2.0
 135       *
 136       * @param bool $display Whether the table layout should be hierarchical.
 137       */
 138  	public function set_hierarchical_display( $display ) {
 139          $this->hierarchical_display = $display;
 140      }
 141  
 142      /**
 143       * @return bool
 144       */
 145  	public function ajax_user_can() {
 146          return current_user_can( get_post_type_object( $this->screen->post_type )->cap->edit_posts );
 147      }
 148  
 149      /**
 150       * @global string   $mode             List table view mode.
 151       * @global array    $avail_post_stati
 152       * @global WP_Query $wp_query         WordPress Query object.
 153       * @global int      $per_page
 154       */
 155  	public function prepare_items() {
 156          global $mode, $avail_post_stati, $wp_query, $per_page;
 157  
 158          if ( ! empty( $_REQUEST['mode'] ) ) {
 159              $mode = 'excerpt' === $_REQUEST['mode'] ? 'excerpt' : 'list';
 160              set_user_setting( 'posts_list_mode', $mode );
 161          } else {
 162              $mode = get_user_setting( 'posts_list_mode', 'list' );
 163          }
 164  
 165          // Is going to call wp().
 166          $avail_post_stati = wp_edit_posts_query();
 167  
 168          $this->set_hierarchical_display(
 169              is_post_type_hierarchical( $this->screen->post_type )
 170              && 'menu_order title' === $wp_query->query['orderby']
 171          );
 172  
 173          $post_type = $this->screen->post_type;
 174          $per_page  = $this->get_items_per_page( 'edit_' . $post_type . '_per_page' );
 175  
 176          /** This filter is documented in wp-admin/includes/post.php */
 177          $per_page = apply_filters( 'edit_posts_per_page', $per_page, $post_type );
 178  
 179          if ( $this->hierarchical_display ) {
 180              $total_items = $wp_query->post_count;
 181          } elseif ( $wp_query->found_posts || $this->get_pagenum() === 1 ) {
 182              $total_items = $wp_query->found_posts;
 183          } else {
 184              $post_counts = (array) wp_count_posts( $post_type, 'readable' );
 185  
 186              if ( isset( $_REQUEST['post_status'] ) && in_array( $_REQUEST['post_status'], $avail_post_stati, true ) ) {
 187                  $total_items = $post_counts[ $_REQUEST['post_status'] ];
 188              } elseif ( isset( $_REQUEST['show_sticky'] ) && $_REQUEST['show_sticky'] ) {
 189                  $total_items = $this->sticky_posts_count;
 190              } elseif ( isset( $_GET['author'] ) && get_current_user_id() === (int) $_GET['author'] ) {
 191                  $total_items = $this->user_posts_count;
 192              } else {
 193                  $total_items = array_sum( $post_counts );
 194  
 195                  // Subtract post types that are not included in the admin all list.
 196                  foreach ( get_post_stati( array( 'show_in_admin_all_list' => false ) ) as $state ) {
 197                      $total_items -= $post_counts[ $state ];
 198                  }
 199              }
 200          }
 201  
 202          $this->is_trash = isset( $_REQUEST['post_status'] ) && 'trash' === $_REQUEST['post_status'];
 203  
 204          $this->set_pagination_args(
 205              array(
 206                  'total_items' => $total_items,
 207                  'per_page'    => $per_page,
 208              )
 209          );
 210      }
 211  
 212      /**
 213       * @return bool
 214       */
 215  	public function has_items() {
 216          return have_posts();
 217      }
 218  
 219      /**
 220       */
 221  	public function no_items() {
 222          if ( isset( $_REQUEST['post_status'] ) && 'trash' === $_REQUEST['post_status'] ) {
 223              echo get_post_type_object( $this->screen->post_type )->labels->not_found_in_trash;
 224          } else {
 225              echo get_post_type_object( $this->screen->post_type )->labels->not_found;
 226          }
 227      }
 228  
 229      /**
 230       * Determine if the current view is the "All" view.
 231       *
 232       * @since 4.2.0
 233       *
 234       * @return bool Whether the current view is the "All" view.
 235       */
 236  	protected function is_base_request() {
 237          $vars = $_GET;
 238          unset( $vars['paged'] );
 239  
 240          if ( empty( $vars ) ) {
 241              return true;
 242          } elseif ( 1 === count( $vars ) && ! empty( $vars['post_type'] ) ) {
 243              return $this->screen->post_type === $vars['post_type'];
 244          }
 245  
 246          return 1 === count( $vars ) && ! empty( $vars['mode'] );
 247      }
 248  
 249      /**
 250       * Helper to create links to edit.php with params.
 251       *
 252       * @since 4.4.0
 253       *
 254       * @param string[] $args      Associative array of URL parameters for the link.
 255       * @param string   $link_text Link text.
 256       * @param string   $css_class Optional. Class attribute. Default empty string.
 257       * @return string The formatted link string.
 258       */
 259  	protected function get_edit_link( $args, $link_text, $css_class = '' ) {
 260          $url = add_query_arg( $args, 'edit.php' );
 261  
 262          $class_html   = '';
 263          $aria_current = '';
 264  
 265          if ( ! empty( $css_class ) ) {
 266              $class_html = sprintf(
 267                  ' class="%s"',
 268                  esc_attr( $css_class )
 269              );
 270  
 271              if ( 'current' === $css_class ) {
 272                  $aria_current = ' aria-current="page"';
 273              }
 274          }
 275  
 276          return sprintf(
 277              '<a href="%s"%s%s>%s</a>',
 278              esc_url( $url ),
 279              $class_html,
 280              $aria_current,
 281              $link_text
 282          );
 283      }
 284  
 285      /**
 286       * @global array $locked_post_status This seems to be deprecated.
 287       * @global array $avail_post_stati
 288       * @return array
 289       */
 290  	protected function get_views() {
 291          global $locked_post_status, $avail_post_stati;
 292  
 293          $post_type = $this->screen->post_type;
 294  
 295          if ( ! empty( $locked_post_status ) ) {
 296              return array();
 297          }
 298  
 299          $status_links = array();
 300          $num_posts    = wp_count_posts( $post_type, 'readable' );
 301          $total_posts  = array_sum( (array) $num_posts );
 302          $class        = '';
 303  
 304          $current_user_id = get_current_user_id();
 305          $all_args        = array( 'post_type' => $post_type );
 306          $mine            = '';
 307  
 308          // Subtract post types that are not included in the admin all list.
 309          foreach ( get_post_stati( array( 'show_in_admin_all_list' => false ) ) as $state ) {
 310              $total_posts -= $num_posts->$state;
 311          }
 312  
 313          if ( $this->user_posts_count && $this->user_posts_count !== $total_posts ) {
 314              if ( isset( $_GET['author'] ) && ( $current_user_id === (int) $_GET['author'] ) ) {
 315                  $class = 'current';
 316              }
 317  
 318              $mine_args = array(
 319                  'post_type' => $post_type,
 320                  'author'    => $current_user_id,
 321              );
 322  
 323              $mine_inner_html = sprintf(
 324                  /* translators: %s: Number of posts. */
 325                  _nx(
 326                      'Mine <span class="count">(%s)</span>',
 327                      'Mine <span class="count">(%s)</span>',
 328                      $this->user_posts_count,
 329                      'posts'
 330                  ),
 331                  number_format_i18n( $this->user_posts_count )
 332              );
 333  
 334              $mine = $this->get_edit_link( $mine_args, $mine_inner_html, $class );
 335  
 336              $all_args['all_posts'] = 1;
 337              $class                 = '';
 338          }
 339  
 340          if ( empty( $class ) && ( $this->is_base_request() || isset( $_REQUEST['all_posts'] ) ) ) {
 341              $class = 'current';
 342          }
 343  
 344          $all_inner_html = sprintf(
 345              /* translators: %s: Number of posts. */
 346              _nx(
 347                  'All <span class="count">(%s)</span>',
 348                  'All <span class="count">(%s)</span>',
 349                  $total_posts,
 350                  'posts'
 351              ),
 352              number_format_i18n( $total_posts )
 353          );
 354  
 355          $status_links['all'] = $this->get_edit_link( $all_args, $all_inner_html, $class );
 356  
 357          if ( $mine ) {
 358              $status_links['mine'] = $mine;
 359          }
 360  
 361          foreach ( get_post_stati( array( 'show_in_admin_status_list' => true ), 'objects' ) as $status ) {
 362              $class = '';
 363  
 364              $status_name = $status->name;
 365  
 366              if ( ! in_array( $status_name, $avail_post_stati, true ) || empty( $num_posts->$status_name ) ) {
 367                  continue;
 368              }
 369  
 370              if ( isset( $_REQUEST['post_status'] ) && $status_name === $_REQUEST['post_status'] ) {
 371                  $class = 'current';
 372              }
 373  
 374              $status_args = array(
 375                  'post_status' => $status_name,
 376                  'post_type'   => $post_type,
 377              );
 378  
 379              $status_label = sprintf(
 380                  translate_nooped_plural( $status->label_count, $num_posts->$status_name ),
 381                  number_format_i18n( $num_posts->$status_name )
 382              );
 383  
 384              $status_links[ $status_name ] = $this->get_edit_link( $status_args, $status_label, $class );
 385          }
 386  
 387          if ( ! empty( $this->sticky_posts_count ) ) {
 388              $class = ! empty( $_REQUEST['show_sticky'] ) ? 'current' : '';
 389  
 390              $sticky_args = array(
 391                  'post_type'   => $post_type,
 392                  'show_sticky' => 1,
 393              );
 394  
 395              $sticky_inner_html = sprintf(
 396                  /* translators: %s: Number of posts. */
 397                  _nx(
 398                      'Sticky <span class="count">(%s)</span>',
 399                      'Sticky <span class="count">(%s)</span>',
 400                      $this->sticky_posts_count,
 401                      'posts'
 402                  ),
 403                  number_format_i18n( $this->sticky_posts_count )
 404              );
 405  
 406              $sticky_link = array(
 407                  'sticky' => $this->get_edit_link( $sticky_args, $sticky_inner_html, $class ),
 408              );
 409  
 410              // 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 );
 412              $status_links = array_merge( array_slice( $status_links, 0, $split ), $sticky_link, array_slice( $status_links, $split ) );
 413          }
 414  
 415          return $status_links;
 416      }
 417  
 418      /**
 419       * @return array
 420       */
 421  	protected function get_bulk_actions() {
 422          $actions       = array();
 423          $post_type_obj = get_post_type_object( $this->screen->post_type );
 424  
 425          if ( current_user_can( $post_type_obj->cap->edit_posts ) ) {
 426              if ( $this->is_trash ) {
 427                  $actions['untrash'] = __( 'Restore' );
 428              } else {
 429                  $actions['edit'] = __( 'Edit' );
 430              }
 431          }
 432  
 433          if ( current_user_can( $post_type_obj->cap->delete_posts ) ) {
 434              if ( $this->is_trash || ! EMPTY_TRASH_DAYS ) {
 435                  $actions['delete'] = __( 'Delete permanently' );
 436              } else {
 437                  $actions['trash'] = __( 'Move to Trash' );
 438              }
 439          }
 440  
 441          return $actions;
 442      }
 443  
 444      /**
 445       * Displays a categories drop-down for filtering on the Posts list table.
 446       *
 447       * @since 4.6.0
 448       *
 449       * @global int $cat Currently selected category.
 450       *
 451       * @param string $post_type Post type slug.
 452       */
 453  	protected function categories_dropdown( $post_type ) {
 454          global $cat;
 455  
 456          /**
 457           * Filters whether to remove the 'Categories' drop-down from the post list table.
 458           *
 459           * @since 4.6.0
 460           *
 461           * @param bool   $disable   Whether to disable the categories drop-down. Default false.
 462           * @param string $post_type Post type slug.
 463           */
 464          if ( false !== apply_filters( 'disable_categories_dropdown', false, $post_type ) ) {
 465              return;
 466          }
 467  
 468          if ( is_object_in_taxonomy( $post_type, 'category' ) ) {
 469              $dropdown_options = array(
 470                  'show_option_all' => get_taxonomy( 'category' )->labels->all_items,
 471                  'hide_empty'      => 0,
 472                  'hierarchical'    => 1,
 473                  'show_count'      => 0,
 474                  'orderby'         => 'name',
 475                  'selected'        => $cat,
 476              );
 477  
 478              echo '<label class="screen-reader-text" for="cat">' . get_taxonomy( 'category' )->labels->filter_by_item . '</label>';
 479  
 480              wp_dropdown_categories( $dropdown_options );
 481          }
 482      }
 483  
 484      /**
 485       * Displays a formats drop-down for filtering items.
 486       *
 487       * @since 5.2.0
 488       * @access protected
 489       *
 490       * @param string $post_type Post type slug.
 491       */
 492  	protected function formats_dropdown( $post_type ) {
 493          /**
 494           * Filters whether to remove the 'Formats' drop-down from the post list table.
 495           *
 496           * @since 5.2.0
 497           * @since 5.5.0 The `$post_type` parameter was added.
 498           *
 499           * @param bool   $disable   Whether to disable the drop-down. Default false.
 500           * @param string $post_type Post type slug.
 501           */
 502          if ( apply_filters( 'disable_formats_dropdown', false, $post_type ) ) {
 503              return;
 504          }
 505  
 506          // Return if the post type doesn't have post formats or if we're in the Trash.
 507          if ( ! is_object_in_taxonomy( $post_type, 'post_format' ) || $this->is_trash ) {
 508              return;
 509          }
 510  
 511          // Make sure the dropdown shows only formats with a post count greater than 0.
 512          $used_post_formats = get_terms(
 513              array(
 514                  'taxonomy'   => 'post_format',
 515                  'hide_empty' => true,
 516              )
 517          );
 518  
 519          // Return if there are no posts using formats.
 520          if ( ! $used_post_formats ) {
 521              return;
 522          }
 523  
 524          $displayed_post_format = isset( $_GET['post_format'] ) ? $_GET['post_format'] : '';
 525          ?>
 526          <label for="filter-by-format" class="screen-reader-text"><?php _e( 'Filter by post format' ); ?></label>
 527          <select name="post_format" id="filter-by-format">
 528              <option<?php selected( $displayed_post_format, '' ); ?> value=""><?php _e( 'All formats' ); ?></option>
 529              <?php
 530              foreach ( $used_post_formats as $used_post_format ) {
 531                  // Post format slug.
 532                  $slug = str_replace( 'post-format-', '', $used_post_format->slug );
 533                  // Pretty, translated version of the post format slug.
 534                  $pretty_name = get_post_format_string( $slug );
 535  
 536                  // Skip the standard post format.
 537                  if ( 'standard' === $slug ) {
 538                      continue;
 539                  }
 540                  ?>
 541                  <option<?php selected( $displayed_post_format, $slug ); ?> value="<?php echo esc_attr( $slug ); ?>"><?php echo esc_html( $pretty_name ); ?></option>
 542                  <?php
 543              }
 544              ?>
 545          </select>
 546          <?php
 547      }
 548  
 549      /**
 550       * @param string $which
 551       */
 552  	protected function extra_tablenav( $which ) {
 553          ?>
 554          <div class="alignleft actions">
 555          <?php
 556          if ( 'top' === $which ) {
 557              ob_start();
 558  
 559              $this->months_dropdown( $this->screen->post_type );
 560              $this->categories_dropdown( $this->screen->post_type );
 561              $this->formats_dropdown( $this->screen->post_type );
 562  
 563              /**
 564               * Fires before the Filter button on the Posts and Pages list tables.
 565               *
 566               * The Filter button allows sorting by date and/or category on the
 567               * Posts list table, and sorting by date on the Pages list table.
 568               *
 569               * @since 2.1.0
 570               * @since 4.4.0 The `$post_type` parameter was added.
 571               * @since 4.6.0 The `$which` parameter was added.
 572               *
 573               * @param string $post_type The post type slug.
 574               * @param string $which     The location of the extra table nav markup:
 575               *                          'top' or 'bottom' for WP_Posts_List_Table,
 576               *                          'bar' for WP_Media_List_Table.
 577               */
 578              do_action( 'restrict_manage_posts', $this->screen->post_type, $which );
 579  
 580              $output = ob_get_clean();
 581  
 582              if ( ! empty( $output ) ) {
 583                  echo $output;
 584                  submit_button( __( 'Filter' ), '', 'filter_action', false, array( 'id' => 'post-query-submit' ) );
 585              }
 586          }
 587  
 588          if ( $this->is_trash && $this->has_items()
 589              && current_user_can( get_post_type_object( $this->screen->post_type )->cap->edit_others_posts )
 590          ) {
 591              submit_button( __( 'Empty Trash' ), 'apply', 'delete_all', false );
 592          }
 593          ?>
 594          </div>
 595          <?php
 596          /**
 597           * Fires immediately following the closing "actions" div in the tablenav for the posts
 598           * list table.
 599           *
 600           * @since 4.4.0
 601           *
 602           * @param string $which The location of the extra table nav markup: 'top' or 'bottom'.
 603           */
 604          do_action( 'manage_posts_extra_tablenav', $which );
 605      }
 606  
 607      /**
 608       * @return string
 609       */
 610  	public function current_action() {
 611          if ( isset( $_REQUEST['delete_all'] ) || isset( $_REQUEST['delete_all2'] ) ) {
 612              return 'delete_all';
 613          }
 614  
 615          return parent::current_action();
 616      }
 617  
 618      /**
 619       * @global string $mode List table view mode.
 620       *
 621       * @return array
 622       */
 623  	protected function get_table_classes() {
 624          global $mode;
 625  
 626          $mode_class = esc_attr( 'table-view-' . $mode );
 627  
 628          return array(
 629              'widefat',
 630              'fixed',
 631              'striped',
 632              $mode_class,
 633              is_post_type_hierarchical( $this->screen->post_type ) ? 'pages' : 'posts',
 634          );
 635      }
 636  
 637      /**
 638       * @return array
 639       */
 640  	public function get_columns() {
 641          $post_type = $this->screen->post_type;
 642  
 643          $posts_columns = array();
 644  
 645          $posts_columns['cb'] = '<input type="checkbox" />';
 646  
 647          /* translators: Posts screen column name. */
 648          $posts_columns['title'] = _x( 'Title', 'column name' );
 649  
 650          if ( post_type_supports( $post_type, 'author' ) ) {
 651              $posts_columns['author'] = __( 'Author' );
 652          }
 653  
 654          $taxonomies = get_object_taxonomies( $post_type, 'objects' );
 655          $taxonomies = wp_filter_object_list( $taxonomies, array( 'show_admin_column' => true ), 'and', 'name' );
 656  
 657          /**
 658           * Filters the taxonomy columns in the Posts list table.
 659           *
 660           * The dynamic portion of the hook name, `$post_type`, refers to the post
 661           * type slug.
 662           *
 663           * Possible hook names include:
 664           *
 665           *  - `manage_taxonomies_for_post_columns`
 666           *  - `manage_taxonomies_for_page_columns`
 667           *
 668           * @since 3.5.0
 669           *
 670           * @param string[] $taxonomies Array of taxonomy names to show columns for.
 671           * @param string   $post_type  The post type.
 672           */
 673          $taxonomies = apply_filters( "manage_taxonomies_for_{$post_type}_columns", $taxonomies, $post_type );
 674          $taxonomies = array_filter( $taxonomies, 'taxonomy_exists' );
 675  
 676          foreach ( $taxonomies as $taxonomy ) {
 677              if ( 'category' === $taxonomy ) {
 678                  $column_key = 'categories';
 679              } elseif ( 'post_tag' === $taxonomy ) {
 680                  $column_key = 'tags';
 681              } else {
 682                  $column_key = 'taxonomy-' . $taxonomy;
 683              }
 684  
 685              $posts_columns[ $column_key ] = get_taxonomy( $taxonomy )->labels->name;
 686          }
 687  
 688          $post_status = ! empty( $_REQUEST['post_status'] ) ? $_REQUEST['post_status'] : 'all';
 689  
 690          if ( post_type_supports( $post_type, 'comments' )
 691              && ! in_array( $post_status, array( 'pending', 'draft', 'future' ), true )
 692          ) {
 693              $posts_columns['comments'] = sprintf(
 694                  '<span class="vers comment-grey-bubble" title="%1$s"><span class="screen-reader-text">%2$s</span></span>',
 695                  esc_attr__( 'Comments' ),
 696                  __( 'Comments' )
 697              );
 698          }
 699  
 700          $posts_columns['date'] = __( 'Date' );
 701  
 702          if ( 'page' === $post_type ) {
 703  
 704              /**
 705               * Filters the columns displayed in the Pages list table.
 706               *
 707               * @since 2.5.0
 708               *
 709               * @param string[] $post_columns An associative array of column headings.
 710               */
 711              $posts_columns = apply_filters( 'manage_pages_columns', $posts_columns );
 712          } else {
 713  
 714              /**
 715               * Filters the columns displayed in the Posts list table.
 716               *
 717               * @since 1.5.0
 718               *
 719               * @param string[] $post_columns An associative array of column headings.
 720               * @param string   $post_type    The post type slug.
 721               */
 722              $posts_columns = apply_filters( 'manage_posts_columns', $posts_columns, $post_type );
 723          }
 724  
 725          /**
 726           * Filters the columns displayed in the Posts list table for a specific post type.
 727           *
 728           * The dynamic portion of the hook name, `$post_type`, refers to the post type slug.
 729           *
 730           * Possible hook names include:
 731           *
 732           *  - `manage_post_posts_columns`
 733           *  - `manage_page_posts_columns`
 734           *
 735           * @since 3.0.0
 736           *
 737           * @param string[] $post_columns An associative array of column headings.
 738           */
 739          return apply_filters( "manage_{$post_type}_posts_columns", $posts_columns );
 740      }
 741  
 742      /**
 743       * @return array
 744       */
 745  	protected function get_sortable_columns() {
 746          return array(
 747              'title'    => 'title',
 748              'parent'   => 'parent',
 749              'comments' => 'comment_count',
 750              'date'     => array( 'date', true ),
 751          );
 752      }
 753  
 754      /**
 755       * @global WP_Query $wp_query WordPress Query object.
 756       * @global int $per_page
 757       * @param array $posts
 758       * @param int   $level
 759       */
 760  	public function display_rows( $posts = array(), $level = 0 ) {
 761          global $wp_query, $per_page;
 762  
 763          if ( empty( $posts ) ) {
 764              $posts = $wp_query->posts;
 765          }
 766  
 767          add_filter( 'the_title', 'esc_html' );
 768  
 769          if ( $this->hierarchical_display ) {
 770              $this->_display_rows_hierarchical( $posts, $this->get_pagenum(), $per_page );
 771          } else {
 772              $this->_display_rows( $posts, $level );
 773          }
 774      }
 775  
 776      /**
 777       * @param array $posts
 778       * @param int   $level
 779       */
 780  	private function _display_rows( $posts, $level = 0 ) {
 781          $post_type = $this->screen->post_type;
 782  
 783          // Create array of post IDs.
 784          $post_ids = array();
 785  
 786          foreach ( $posts as $a_post ) {
 787              $post_ids[] = $a_post->ID;
 788          }
 789  
 790          if ( post_type_supports( $post_type, 'comments' ) ) {
 791              $this->comment_pending_count = get_pending_comments_num( $post_ids );
 792          }
 793  
 794          foreach ( $posts as $post ) {
 795              $this->single_row( $post, $level );
 796          }
 797      }
 798  
 799      /**
 800       * @global wpdb    $wpdb WordPress database abstraction object.
 801       * @global WP_Post $post Global post object.
 802       * @param array $pages
 803       * @param int   $pagenum
 804       * @param int   $per_page
 805       */
 806  	private function _display_rows_hierarchical( $pages, $pagenum = 1, $per_page = 20 ) {
 807          global $wpdb;
 808  
 809          $level = 0;
 810  
 811          if ( ! $pages ) {
 812              $pages = get_pages( array( 'sort_column' => 'menu_order' ) );
 813  
 814              if ( ! $pages ) {
 815                  return;
 816              }
 817          }
 818  
 819          /*
 820           * Arrange pages into two parts: top level pages and children_pages.
 821           * children_pages is two dimensional array. Example:
 822           * children_pages[10][] contains all sub-pages whose parent is 10.
 823           * It only takes O( N ) to arrange this and it takes O( 1 ) for subsequent lookup operations
 824           * If searching, ignore hierarchy and treat everything as top level
 825           */
 826          if ( empty( $_REQUEST['s'] ) ) {
 827              $top_level_pages = array();
 828              $children_pages  = array();
 829  
 830              foreach ( $pages as $page ) {
 831                  // Catch and repair bad pages.
 832                  if ( $page->post_parent === $page->ID ) {
 833                      $page->post_parent = 0;
 834                      $wpdb->update( $wpdb->posts, array( 'post_parent' => 0 ), array( 'ID' => $page->ID ) );
 835                      clean_post_cache( $page );
 836                  }
 837  
 838                  if ( $page->post_parent > 0 ) {
 839                      $children_pages[ $page->post_parent ][] = $page;
 840                  } else {
 841                      $top_level_pages[] = $page;
 842                  }
 843              }
 844  
 845              $pages = &$top_level_pages;
 846          }
 847  
 848          $count      = 0;
 849          $start      = ( $pagenum - 1 ) * $per_page;
 850          $end        = $start + $per_page;
 851          $to_display = array();
 852  
 853          foreach ( $pages as $page ) {
 854              if ( $count >= $end ) {
 855                  break;
 856              }
 857  
 858              if ( $count >= $start ) {
 859                  $to_display[ $page->ID ] = $level;
 860              }
 861  
 862              $count++;
 863  
 864              if ( isset( $children_pages ) ) {
 865                  $this->_page_rows( $children_pages, $count, $page->ID, $level + 1, $pagenum, $per_page, $to_display );
 866              }
 867          }
 868  
 869          // If it is the last pagenum and there are orphaned pages, display them with paging as well.
 870          if ( isset( $children_pages ) && $count < $end ) {
 871              foreach ( $children_pages as $orphans ) {
 872                  foreach ( $orphans as $op ) {
 873                      if ( $count >= $end ) {
 874                          break;
 875                      }
 876  
 877                      if ( $count >= $start ) {
 878                          $to_display[ $op->ID ] = 0;
 879                      }
 880  
 881                      $count++;
 882                  }
 883              }
 884          }
 885  
 886          $ids = array_keys( $to_display );
 887          _prime_post_caches( $ids );
 888  
 889          if ( ! isset( $GLOBALS['post'] ) ) {
 890              $GLOBALS['post'] = reset( $ids );
 891          }
 892  
 893          foreach ( $to_display as $page_id => $level ) {
 894              echo "\t";
 895              $this->single_row( $page_id, $level );
 896          }
 897      }
 898  
 899      /**
 900       * Given a top level page ID, display the nested hierarchy of sub-pages
 901       * together with paging support
 902       *
 903       * @since 3.1.0 (Standalone function exists since 2.6.0)
 904       * @since 4.2.0 Added the `$to_display` parameter.
 905       *
 906       * @param array $children_pages
 907       * @param int   $count
 908       * @param int   $parent_page
 909       * @param int   $level
 910       * @param int   $pagenum
 911       * @param int   $per_page
 912       * @param array $to_display List of pages to be displayed. Passed by reference.
 913       */
 914  	private function _page_rows( &$children_pages, &$count, $parent_page, $level, $pagenum, $per_page, &$to_display ) {
 915          if ( ! isset( $children_pages[ $parent_page ] ) ) {
 916              return;
 917          }
 918  
 919          $start = ( $pagenum - 1 ) * $per_page;
 920          $end   = $start + $per_page;
 921  
 922          foreach ( $children_pages[ $parent_page ] as $page ) {
 923              if ( $count >= $end ) {
 924                  break;
 925              }
 926  
 927              // If the page starts in a subtree, print the parents.
 928              if ( $count === $start && $page->post_parent > 0 ) {
 929                  $my_parents = array();
 930                  $my_parent  = $page->post_parent;
 931  
 932                  while ( $my_parent ) {
 933                      // Get the ID from the list or the attribute if my_parent is an object.
 934                      $parent_id = $my_parent;
 935  
 936                      if ( is_object( $my_parent ) ) {
 937                          $parent_id = $my_parent->ID;
 938                      }
 939  
 940                      $my_parent    = get_post( $parent_id );
 941                      $my_parents[] = $my_parent;
 942  
 943                      if ( ! $my_parent->post_parent ) {
 944                          break;
 945                      }
 946  
 947                      $my_parent = $my_parent->post_parent;
 948                  }
 949  
 950                  $num_parents = count( $my_parents );
 951  
 952                  while ( $my_parent = array_pop( $my_parents ) ) {
 953                      $to_display[ $my_parent->ID ] = $level - $num_parents;
 954                      $num_parents--;
 955                  }
 956              }
 957  
 958              if ( $count >= $start ) {
 959                  $to_display[ $page->ID ] = $level;
 960              }
 961  
 962              $count++;
 963  
 964              $this->_page_rows( $children_pages, $count, $page->ID, $level + 1, $pagenum, $per_page, $to_display );
 965          }
 966  
 967          unset( $children_pages[ $parent_page ] ); // Required in order to keep track of orphans.
 968      }
 969  
 970      /**
 971       * Handles the checkbox column output.
 972       *
 973       * @since 4.3.0
 974       * @since 5.9.0 Renamed `$post` to `$item` to match parent class for PHP 8 named parameter support.
 975       *
 976       * @param WP_Post $item The current WP_Post object.
 977       */
 978  	public function column_cb( $item ) {
 979          // Restores the more descriptive, specific name for use within this method.
 980          $post = $item;
 981          $show = current_user_can( 'edit_post', $post->ID );
 982  
 983          /**
 984           * Filters whether to show the bulk edit checkbox for a post in its list table.
 985           *
 986           * By default the checkbox is only shown if the current user can edit the post.
 987           *
 988           * @since 5.7.0
 989           *
 990           * @param bool    $show Whether to show the checkbox.
 991           * @param WP_Post $post The current WP_Post object.
 992           */
 993          if ( apply_filters( 'wp_list_table_show_post_checkbox', $show, $post ) ) :
 994              ?>
 995              <label class="screen-reader-text" for="cb-select-<?php the_ID(); ?>">
 996                  <?php
 997                      /* translators: %s: Post title. */
 998                      printf( __( 'Select %s' ), _draft_or_post_title() );
 999                  ?>
1000              </label>
1001              <input id="cb-select-<?php the_ID(); ?>" type="checkbox" name="post[]" value="<?php the_ID(); ?>" />
1002              <div class="locked-indicator">
1003                  <span class="locked-indicator-icon" aria-hidden="true"></span>
1004                  <span class="screen-reader-text">
1005                  <?php
1006                  printf(
1007                      /* translators: %s: Post title. */
1008                      __( '&#8220;%s&#8221; is locked' ),
1009                      _draft_or_post_title()
1010                  );
1011                  ?>
1012                  </span>
1013              </div>
1014              <?php
1015          endif;
1016      }
1017  
1018      /**
1019       * @since 4.3.0
1020       *
1021       * @param WP_Post $post
1022       * @param string  $classes
1023       * @param string  $data
1024       * @param string  $primary
1025       */
1026  	protected function _column_title( $post, $classes, $data, $primary ) {
1027          echo '<td class="' . $classes . ' page-title" ', $data, '>';
1028          echo $this->column_title( $post );
1029          echo $this->handle_row_actions( $post, 'title', $primary );
1030          echo '</td>';
1031      }
1032  
1033      /**
1034       * Handles the title column output.
1035       *
1036       * @since 4.3.0
1037       *
1038       * @global string $mode List table view mode.
1039       *
1040       * @param WP_Post $post The current WP_Post object.
1041       */
1042  	public function column_title( $post ) {
1043          global $mode;
1044  
1045          if ( $this->hierarchical_display ) {
1046              if ( 0 === $this->current_level && (int) $post->post_parent > 0 ) {
1047                  // Sent level 0 by accident, by default, or because we don't know the actual level.
1048                  $find_main_page = (int) $post->post_parent;
1049  
1050                  while ( $find_main_page > 0 ) {
1051                      $parent = get_post( $find_main_page );
1052  
1053                      if ( is_null( $parent ) ) {
1054                          break;
1055                      }
1056  
1057                      $this->current_level++;
1058                      $find_main_page = (int) $parent->post_parent;
1059  
1060                      if ( ! isset( $parent_name ) ) {
1061                          /** This filter is documented in wp-includes/post-template.php */
1062                          $parent_name = apply_filters( 'the_title', $parent->post_title, $parent->ID );
1063                      }
1064                  }
1065              }
1066          }
1067  
1068          $can_edit_post = current_user_can( 'edit_post', $post->ID );
1069  
1070          if ( $can_edit_post && 'trash' !== $post->post_status ) {
1071              $lock_holder = wp_check_post_lock( $post->ID );
1072  
1073              if ( $lock_holder ) {
1074                  $lock_holder   = get_userdata( $lock_holder );
1075                  $locked_avatar = get_avatar( $lock_holder->ID, 18 );
1076                  /* translators: %s: User's display name. */
1077                  $locked_text = esc_html( sprintf( __( '%s is currently editing' ), $lock_holder->display_name ) );
1078              } else {
1079                  $locked_avatar = '';
1080                  $locked_text   = '';
1081              }
1082  
1083              echo '<div class="locked-info"><span class="locked-avatar">' . $locked_avatar . '</span> <span class="locked-text">' . $locked_text . "</span></div>\n";
1084          }
1085  
1086          $pad = str_repeat( '&#8212; ', $this->current_level );
1087          echo '<strong>';
1088  
1089          $title = _draft_or_post_title();
1090  
1091          if ( $can_edit_post && 'trash' !== $post->post_status ) {
1092              printf(
1093                  '<a class="row-title" href="%s" aria-label="%s">%s%s</a>',
1094                  get_edit_post_link( $post->ID ),
1095                  /* translators: %s: Post title. */
1096                  esc_attr( sprintf( __( '&#8220;%s&#8221; (Edit)' ), $title ) ),
1097                  $pad,
1098                  $title
1099              );
1100          } else {
1101              printf(
1102                  '<span>%s%s</span>',
1103                  $pad,
1104                  $title
1105              );
1106          }
1107          _post_states( $post );
1108  
1109          if ( isset( $parent_name ) ) {
1110              $post_type_object = get_post_type_object( $post->post_type );
1111              echo ' | ' . $post_type_object->labels->parent_item_colon . ' ' . esc_html( $parent_name );
1112          }
1113  
1114          echo "</strong>\n";
1115  
1116          if ( 'excerpt' === $mode
1117              && ! is_post_type_hierarchical( $this->screen->post_type )
1118              && current_user_can( 'read_post', $post->ID )
1119          ) {
1120              if ( post_password_required( $post ) ) {
1121                  echo '<span class="protected-post-excerpt">' . esc_html( get_the_excerpt() ) . '</span>';
1122              } else {
1123                  echo esc_html( get_the_excerpt() );
1124              }
1125          }
1126  
1127          get_inline_data( $post );
1128      }
1129  
1130      /**
1131       * Handles the post date column output.
1132       *
1133       * @since 4.3.0
1134       *
1135       * @global string $mode List table view mode.
1136       *
1137       * @param WP_Post $post The current WP_Post object.
1138       */
1139  	public function column_date( $post ) {
1140          global $mode;
1141  
1142          if ( '0000-00-00 00:00:00' === $post->post_date ) {
1143              $t_time    = __( 'Unpublished' );
1144              $time_diff = 0;
1145          } else {
1146              $t_time = sprintf(
1147                  /* translators: 1: Post date, 2: Post time. */
1148                  __( '%1$s at %2$s' ),
1149                  /* translators: Post date format. See https://www.php.net/manual/datetime.format.php */
1150                  get_the_time( __( 'Y/m/d' ), $post ),
1151                  /* translators: Post time format. See https://www.php.net/manual/datetime.format.php */
1152                  get_the_time( __( 'g:i a' ), $post )
1153              );
1154  
1155              $time      = get_post_timestamp( $post );
1156              $time_diff = time() - $time;
1157          }
1158  
1159          if ( 'publish' === $post->post_status ) {
1160              $status = __( 'Published' );
1161          } elseif ( 'future' === $post->post_status ) {
1162              if ( $time_diff > 0 ) {
1163                  $status = '<strong class="error-message">' . __( 'Missed schedule' ) . '</strong>';
1164              } else {
1165                  $status = __( 'Scheduled' );
1166              }
1167          } else {
1168              $status = __( 'Last Modified' );
1169          }
1170  
1171          /**
1172           * Filters the status text of the post.
1173           *
1174           * @since 4.8.0
1175           *
1176           * @param string  $status      The status text.
1177           * @param WP_Post $post        Post object.
1178           * @param string  $column_name The column name.
1179           * @param string  $mode        The list display mode ('excerpt' or 'list').
1180           */
1181          $status = apply_filters( 'post_date_column_status', $status, $post, 'date', $mode );
1182  
1183          if ( $status ) {
1184              echo $status . '<br />';
1185          }
1186  
1187          /**
1188           * Filters the published time of the post.
1189           *
1190           * @since 2.5.1
1191           * @since 5.5.0 Removed the difference between 'excerpt' and 'list' modes.
1192           *              The published time and date are both displayed now,
1193           *              which is equivalent to the previous 'excerpt' mode.
1194           *
1195           * @param string  $t_time      The published time.
1196           * @param WP_Post $post        Post object.
1197           * @param string  $column_name The column name.
1198           * @param string  $mode        The list display mode ('excerpt' or 'list').
1199           */
1200          echo apply_filters( 'post_date_column_time', $t_time, $post, 'date', $mode );
1201      }
1202  
1203      /**
1204       * Handles the comments column output.
1205       *
1206       * @since 4.3.0
1207       *
1208       * @param WP_Post $post The current WP_Post object.
1209       */
1210  	public function column_comments( $post ) {
1211          ?>
1212          <div class="post-com-count-wrapper">
1213          <?php
1214              $pending_comments = isset( $this->comment_pending_count[ $post->ID ] ) ? $this->comment_pending_count[ $post->ID ] : 0;
1215  
1216              $this->comments_bubble( $post->ID, $pending_comments );
1217          ?>
1218          </div>
1219          <?php
1220      }
1221  
1222      /**
1223       * Handles the post author column output.
1224       *
1225       * @since 4.3.0
1226       *
1227       * @param WP_Post $post The current WP_Post object.
1228       */
1229  	public function column_author( $post ) {
1230          $args = array(
1231              'post_type' => $post->post_type,
1232              'author'    => get_the_author_meta( 'ID' ),
1233          );
1234          echo $this->get_edit_link( $args, get_the_author() );
1235      }
1236  
1237      /**
1238       * Handles the default column output.
1239       *
1240       * @since 4.3.0
1241       * @since 5.9.0 Renamed `$post` to `$item` to match parent class for PHP 8 named parameter support.
1242       *
1243       * @param WP_Post $item        The current WP_Post object.
1244       * @param string  $column_name The current column name.
1245       */
1246  	public function column_default( $item, $column_name ) {
1247          // Restores the more descriptive, specific name for use within this method.
1248          $post = $item;
1249  
1250          if ( 'categories' === $column_name ) {
1251              $taxonomy = 'category';
1252          } elseif ( 'tags' === $column_name ) {
1253              $taxonomy = 'post_tag';
1254          } elseif ( 0 === strpos( $column_name, 'taxonomy-' ) ) {
1255              $taxonomy = substr( $column_name, 9 );
1256          } else {
1257              $taxonomy = false;
1258          }
1259  
1260          if ( $taxonomy ) {
1261              $taxonomy_object = get_taxonomy( $taxonomy );
1262              $terms           = get_the_terms( $post->ID, $taxonomy );
1263  
1264              if ( is_array( $terms ) ) {
1265                  $term_links = array();
1266  
1267                  foreach ( $terms as $t ) {
1268                      $posts_in_term_qv = array();
1269  
1270                      if ( 'post' !== $post->post_type ) {
1271                          $posts_in_term_qv['post_type'] = $post->post_type;
1272                      }
1273  
1274                      if ( $taxonomy_object->query_var ) {
1275                          $posts_in_term_qv[ $taxonomy_object->query_var ] = $t->slug;
1276                      } else {
1277                          $posts_in_term_qv['taxonomy'] = $taxonomy;
1278                          $posts_in_term_qv['term']     = $t->slug;
1279                      }
1280  
1281                      $label = esc_html( sanitize_term_field( 'name', $t->name, $t->term_id, $taxonomy, 'display' ) );
1282  
1283                      $term_links[] = $this->get_edit_link( $posts_in_term_qv, $label );
1284                  }
1285  
1286                  /**
1287                   * Filters the links in `$taxonomy` column of edit.php.
1288                   *
1289                   * @since 5.2.0
1290                   *
1291                   * @param string[]  $term_links Array of term editing links.
1292                   * @param string    $taxonomy   Taxonomy name.
1293                   * @param WP_Term[] $terms      Array of term objects appearing in the post row.
1294                   */
1295                  $term_links = apply_filters( 'post_column_taxonomy_links', $term_links, $taxonomy, $terms );
1296  
1297                  echo implode( wp_get_list_item_separator(), $term_links );
1298              } else {
1299                  echo '<span aria-hidden="true">&#8212;</span><span class="screen-reader-text">' . $taxonomy_object->labels->no_terms . '</span>';
1300              }
1301              return;
1302          }
1303  
1304          if ( is_post_type_hierarchical( $post->post_type ) ) {
1305  
1306              /**
1307               * Fires in each custom column on the Posts list table.
1308               *
1309               * This hook only fires if the current post type is hierarchical,
1310               * such as pages.
1311               *
1312               * @since 2.5.0
1313               *
1314               * @param string $column_name The name of the column to display.
1315               * @param int    $post_id     The current post ID.
1316               */
1317              do_action( 'manage_pages_custom_column', $column_name, $post->ID );
1318          } else {
1319  
1320              /**
1321               * Fires in each custom column in the Posts list table.
1322               *
1323               * This hook only fires if the current post type is non-hierarchical,
1324               * such as posts.
1325               *
1326               * @since 1.5.0
1327               *
1328               * @param string $column_name The name of the column to display.
1329               * @param int    $post_id     The current post ID.
1330               */
1331              do_action( 'manage_posts_custom_column', $column_name, $post->ID );
1332          }
1333  
1334          /**
1335           * Fires for each custom column of a specific post type in the Posts list table.
1336           *
1337           * The dynamic portion of the hook name, `$post->post_type`, refers to the post type.
1338           *
1339           * Possible hook names include:
1340           *
1341           *  - `manage_post_posts_custom_column`
1342           *  - `manage_page_posts_custom_column`
1343           *
1344           * @since 3.1.0
1345           *
1346           * @param string $column_name The name of the column to display.
1347           * @param int    $post_id     The current post ID.
1348           */
1349          do_action( "manage_{$post->post_type}_posts_custom_column", $column_name, $post->ID );
1350      }
1351  
1352      /**
1353       * @global WP_Post $post Global post object.
1354       *
1355       * @param int|WP_Post $post
1356       * @param int         $level
1357       */
1358  	public function single_row( $post, $level = 0 ) {
1359          $global_post = get_post();
1360  
1361          $post                = get_post( $post );
1362          $this->current_level = $level;
1363  
1364          $GLOBALS['post'] = $post;
1365          setup_postdata( $post );
1366  
1367          $classes = 'iedit author-' . ( get_current_user_id() === (int) $post->post_author ? 'self' : 'other' );
1368  
1369          $lock_holder = wp_check_post_lock( $post->ID );
1370  
1371          if ( $lock_holder ) {
1372              $classes .= ' wp-locked';
1373          }
1374  
1375          if ( $post->post_parent ) {
1376              $count    = count( get_post_ancestors( $post->ID ) );
1377              $classes .= ' level-' . $count;
1378          } else {
1379              $classes .= ' level-0';
1380          }
1381          ?>
1382          <tr id="post-<?php echo $post->ID; ?>" class="<?php echo implode( ' ', get_post_class( $classes, $post->ID ) ); ?>">
1383              <?php $this->single_row_columns( $post ); ?>
1384          </tr>
1385          <?php
1386          $GLOBALS['post'] = $global_post;
1387      }
1388  
1389      /**
1390       * Gets the name of the default primary column.
1391       *
1392       * @since 4.3.0
1393       *
1394       * @return string Name of the default primary column, in this case, 'title'.
1395       */
1396  	protected function get_default_primary_column_name() {
1397          return 'title';
1398      }
1399  
1400      /**
1401       * Generates and displays row action links.
1402       *
1403       * @since 4.3.0
1404       * @since 5.9.0 Renamed `$post` to `$item` to match parent class for PHP 8 named parameter support.
1405       *
1406       * @param WP_Post $item        Post being acted upon.
1407       * @param string  $column_name Current column name.
1408       * @param string  $primary     Primary column name.
1409       * @return string Row actions output for posts, or an empty string
1410       *                if the current column is not the primary column.
1411       */
1412  	protected function handle_row_actions( $item, $column_name, $primary ) {
1413          if ( $primary !== $column_name ) {
1414              return '';
1415          }
1416  
1417          // Restores the more descriptive, specific name for use within this method.
1418          $post             = $item;
1419          $post_type_object = get_post_type_object( $post->post_type );
1420          $can_edit_post    = current_user_can( 'edit_post', $post->ID );
1421          $actions          = array();
1422          $title            = _draft_or_post_title();
1423  
1424          if ( $can_edit_post && 'trash' !== $post->post_status ) {
1425              $actions['edit'] = sprintf(
1426                  '<a href="%s" aria-label="%s">%s</a>',
1427                  get_edit_post_link( $post->ID ),
1428                  /* translators: %s: Post title. */
1429                  esc_attr( sprintf( __( 'Edit &#8220;%s&#8221;' ), $title ) ),
1430                  __( 'Edit' )
1431              );
1432  
1433              if ( 'wp_block' !== $post->post_type ) {
1434                  $actions['inline hide-if-no-js'] = sprintf(
1435                      '<button type="button" class="button-link editinline" aria-label="%s" aria-expanded="false">%s</button>',
1436                      /* translators: %s: Post title. */
1437                      esc_attr( sprintf( __( 'Quick edit &#8220;%s&#8221; inline' ), $title ) ),
1438                      __( 'Quick&nbsp;Edit' )
1439                  );
1440              }
1441          }
1442  
1443          if ( current_user_can( 'delete_post', $post->ID ) ) {
1444              if ( 'trash' === $post->post_status ) {
1445                  $actions['untrash'] = sprintf(
1446                      '<a href="%s" aria-label="%s">%s</a>',
1447                      wp_nonce_url( admin_url( sprintf( $post_type_object->_edit_link . '&amp;action=untrash', $post->ID ) ), 'untrash-post_' . $post->ID ),
1448                      /* translators: %s: Post title. */
1449                      esc_attr( sprintf( __( 'Restore &#8220;%s&#8221; from the Trash' ), $title ) ),
1450                      __( 'Restore' )
1451                  );
1452              } elseif ( EMPTY_TRASH_DAYS ) {
1453                  $actions['trash'] = sprintf(
1454                      '<a href="%s" class="submitdelete" aria-label="%s">%s</a>',
1455                      get_delete_post_link( $post->ID ),
1456                      /* translators: %s: Post title. */
1457                      esc_attr( sprintf( __( 'Move &#8220;%s&#8221; to the Trash' ), $title ) ),
1458                      _x( 'Trash', 'verb' )
1459                  );
1460              }
1461  
1462              if ( 'trash' === $post->post_status || ! EMPTY_TRASH_DAYS ) {
1463                  $actions['delete'] = sprintf(
1464                      '<a href="%s" class="submitdelete" aria-label="%s">%s</a>',
1465                      get_delete_post_link( $post->ID, '', true ),
1466                      /* translators: %s: Post title. */
1467                      esc_attr( sprintf( __( 'Delete &#8220;%s&#8221; permanently' ), $title ) ),
1468                      __( 'Delete Permanently' )
1469                  );
1470              }
1471          }
1472  
1473          if ( is_post_type_viewable( $post_type_object ) ) {
1474              if ( in_array( $post->post_status, array( 'pending', 'draft', 'future' ), true ) ) {
1475                  if ( $can_edit_post ) {
1476                      $preview_link    = get_preview_post_link( $post );
1477                      $actions['view'] = sprintf(
1478                          '<a href="%s" rel="bookmark" aria-label="%s">%s</a>',
1479                          esc_url( $preview_link ),
1480                          /* translators: %s: Post title. */
1481                          esc_attr( sprintf( __( 'Preview &#8220;%s&#8221;' ), $title ) ),
1482                          __( 'Preview' )
1483                      );
1484                  }
1485              } elseif ( 'trash' !== $post->post_status ) {
1486                  $actions['view'] = sprintf(
1487                      '<a href="%s" rel="bookmark" aria-label="%s">%s</a>',
1488                      get_permalink( $post->ID ),
1489                      /* translators: %s: Post title. */
1490                      esc_attr( sprintf( __( 'View &#8220;%s&#8221;' ), $title ) ),
1491                      __( 'View' )
1492                  );
1493              }
1494          }
1495  
1496          if ( 'wp_block' === $post->post_type ) {
1497              $actions['export'] = sprintf(
1498                  '<button type="button" class="wp-list-reusable-blocks__export button-link" data-id="%s" aria-label="%s">%s</button>',
1499                  $post->ID,
1500                  /* translators: %s: Post title. */
1501                  esc_attr( sprintf( __( 'Export &#8220;%s&#8221; as JSON' ), $title ) ),
1502                  __( 'Export as JSON' )
1503              );
1504          }
1505  
1506          if ( is_post_type_hierarchical( $post->post_type ) ) {
1507  
1508              /**
1509               * Filters the array of row action links on the Pages list table.
1510               *
1511               * The filter is evaluated only for hierarchical post types.
1512               *
1513               * @since 2.8.0
1514               *
1515               * @param string[] $actions An array of row action links. Defaults are
1516               *                          'Edit', 'Quick Edit', 'Restore', 'Trash',
1517               *                          'Delete Permanently', 'Preview', and 'View'.
1518               * @param WP_Post  $post    The post object.
1519               */
1520              $actions = apply_filters( 'page_row_actions', $actions, $post );
1521          } else {
1522  
1523              /**
1524               * Filters the array of row action links on the Posts list table.
1525               *
1526               * The filter is evaluated only for non-hierarchical post types.
1527               *
1528               * @since 2.8.0
1529               *
1530               * @param string[] $actions An array of row action links. Defaults are
1531               *                          'Edit', 'Quick Edit', 'Restore', 'Trash',
1532               *                          'Delete Permanently', 'Preview', and 'View'.
1533               * @param WP_Post  $post    The post object.
1534               */
1535              $actions = apply_filters( 'post_row_actions', $actions, $post );
1536          }
1537  
1538          return $this->row_actions( $actions );
1539      }
1540  
1541      /**
1542       * Outputs the hidden row displayed when inline editing
1543       *
1544       * @since 3.1.0
1545       *
1546       * @global string $mode List table view mode.
1547       */
1548  	public function inline_edit() {
1549          global $mode;
1550  
1551          $screen = $this->screen;
1552  
1553          $post             = get_default_post_to_edit( $screen->post_type );
1554          $post_type_object = get_post_type_object( $screen->post_type );
1555  
1556          $taxonomy_names          = get_object_taxonomies( $screen->post_type );
1557          $hierarchical_taxonomies = array();
1558          $flat_taxonomies         = array();
1559  
1560          foreach ( $taxonomy_names as $taxonomy_name ) {
1561              $taxonomy = get_taxonomy( $taxonomy_name );
1562  
1563              $show_in_quick_edit = $taxonomy->show_in_quick_edit;
1564  
1565              /**
1566               * Filters whether the current taxonomy should be shown in the Quick Edit panel.
1567               *
1568               * @since 4.2.0
1569               *
1570               * @param bool   $show_in_quick_edit Whether to show the current taxonomy in Quick Edit.
1571               * @param string $taxonomy_name      Taxonomy name.
1572               * @param string $post_type          Post type of current Quick Edit post.
1573               */
1574              if ( ! apply_filters( 'quick_edit_show_taxonomy', $show_in_quick_edit, $taxonomy_name, $screen->post_type ) ) {
1575                  continue;
1576              }
1577  
1578              if ( $taxonomy->hierarchical ) {
1579                  $hierarchical_taxonomies[] = $taxonomy;
1580              } else {
1581                  $flat_taxonomies[] = $taxonomy;
1582              }
1583          }
1584  
1585          $m            = ( isset( $mode ) && 'excerpt' === $mode ) ? 'excerpt' : 'list';
1586          $can_publish  = current_user_can( $post_type_object->cap->publish_posts );
1587          $core_columns = array(
1588              'cb'         => true,
1589              'date'       => true,
1590              'title'      => true,
1591              'categories' => true,
1592              'tags'       => true,
1593              'comments'   => true,
1594              'author'     => true,
1595          );
1596          ?>
1597  
1598          <form method="get">
1599          <table style="display: none"><tbody id="inlineedit">
1600          <?php
1601          $hclass              = count( $hierarchical_taxonomies ) ? 'post' : 'page';
1602          $inline_edit_classes = "inline-edit-row inline-edit-row-$hclass";
1603          $bulk_edit_classes   = "bulk-edit-row bulk-edit-row-$hclass bulk-edit-{$screen->post_type}";
1604          $quick_edit_classes  = "quick-edit-row quick-edit-row-$hclass inline-edit-{$screen->post_type}";
1605  
1606          $bulk = 0;
1607  
1608          while ( $bulk < 2 ) :
1609              $classes  = $inline_edit_classes . ' ';
1610              $classes .= $bulk ? $bulk_edit_classes : $quick_edit_classes;
1611              ?>
1612              <tr id="<?php echo $bulk ? 'bulk-edit' : 'inline-edit'; ?>" class="<?php echo $classes; ?>" style="display: none">
1613              <td colspan="<?php echo $this->get_column_count(); ?>" class="colspanchange">
1614              <div class="inline-edit-wrapper" role="region" aria-labelledby="<?php echo $bulk ? 'bulk' : 'quick'; ?>-edit-legend">
1615              <fieldset class="inline-edit-col-left">
1616                  <legend class="inline-edit-legend" id="<?php echo $bulk ? 'bulk' : 'quick'; ?>-edit-legend"><?php echo $bulk ? __( 'Bulk Edit' ) : __( 'Quick Edit' ); ?></legend>
1617                  <div class="inline-edit-col">
1618  
1619                  <?php if ( post_type_supports( $screen->post_type, 'title' ) ) : ?>
1620  
1621                      <?php if ( $bulk ) : ?>
1622  
1623                          <div id="bulk-title-div">
1624                              <div id="bulk-titles"></div>
1625                          </div>
1626  
1627                      <?php else : // $bulk ?>
1628  
1629                          <label>
1630                              <span class="title"><?php _e( 'Title' ); ?></span>
1631                              <span class="input-text-wrap"><input type="text" name="post_title" class="ptitle" value="" /></span>
1632                          </label>
1633  
1634                          <?php if ( is_post_type_viewable( $screen->post_type ) ) : ?>
1635  
1636                              <label>
1637                                  <span class="title"><?php _e( 'Slug' ); ?></span>
1638                                  <span class="input-text-wrap"><input type="text" name="post_name" value="" autocomplete="off" spellcheck="false" /></span>
1639                              </label>
1640  
1641                          <?php endif; // is_post_type_viewable() ?>
1642  
1643                      <?php endif; // $bulk ?>
1644  
1645                  <?php endif; // post_type_supports( ... 'title' ) ?>
1646  
1647                  <?php if ( ! $bulk ) : ?>
1648                      <fieldset class="inline-edit-date">
1649                          <legend><span class="title"><?php _e( 'Date' ); ?></span></legend>
1650                          <?php touch_time( 1, 1, 0, 1 ); ?>
1651                      </fieldset>
1652                      <br class="clear" />
1653                  <?php endif; // $bulk ?>
1654  
1655                  <?php
1656                  if ( post_type_supports( $screen->post_type, 'author' ) ) {
1657                      $authors_dropdown = '';
1658  
1659                      if ( current_user_can( $post_type_object->cap->edit_others_posts ) ) {
1660                          $dropdown_name  = 'post_author';
1661                          $dropdown_class = 'authors';
1662                          if ( wp_is_large_user_count() ) {
1663                              $authors_dropdown = sprintf( '<select name="%s" class="%s hidden"></select>', esc_attr( $dropdown_name ), esc_attr( $dropdown_class ) );
1664                          } else {
1665                              $users_opt = array(
1666                                  'hide_if_only_one_author' => false,
1667                                  'capability'              => array( $post_type_object->cap->edit_posts ),
1668                                  'name'                    => $dropdown_name,
1669                                  'class'                   => $dropdown_class,
1670                                  'multi'                   => 1,
1671                                  'echo'                    => 0,
1672                                  'show'                    => 'display_name_with_login',
1673                              );
1674  
1675                              if ( $bulk ) {
1676                                  $users_opt['show_option_none'] = __( '&mdash; No Change &mdash;' );
1677                              }
1678  
1679                              /**
1680                               * Filters the arguments used to generate the Quick Edit authors drop-down.
1681                               *
1682                               * @since 5.6.0
1683                               *
1684                               * @see wp_dropdown_users()
1685                               *
1686                               * @param array $users_opt An array of arguments passed to wp_dropdown_users().
1687                               * @param bool $bulk A flag to denote if it's a bulk action.
1688                               */
1689                              $users_opt = apply_filters( 'quick_edit_dropdown_authors_args', $users_opt, $bulk );
1690  
1691                              $authors = wp_dropdown_users( $users_opt );
1692  
1693                              if ( $authors ) {
1694                                  $authors_dropdown  = '<label class="inline-edit-author">';
1695                                  $authors_dropdown .= '<span class="title">' . __( 'Author' ) . '</span>';
1696                                  $authors_dropdown .= $authors;
1697                                  $authors_dropdown .= '</label>';
1698                              }
1699                          }
1700                      } // current_user_can( 'edit_others_posts' )
1701  
1702                      if ( ! $bulk ) {
1703                          echo $authors_dropdown;
1704                      }
1705                  } // post_type_supports( ... 'author' )
1706                  ?>
1707  
1708                  <?php if ( ! $bulk && $can_publish ) : ?>
1709  
1710                      <div class="inline-edit-group wp-clearfix">
1711                          <label class="alignleft">
1712                              <span class="title"><?php _e( 'Password' ); ?></span>
1713                              <span class="input-text-wrap"><input type="text" name="post_password" class="inline-edit-password-input" value="" /></span>
1714                          </label>
1715  
1716                          <span class="alignleft inline-edit-or">
1717                              <?php
1718                              /* translators: Between password field and private checkbox on post quick edit interface. */
1719                              _e( '&ndash;OR&ndash;' );
1720                              ?>
1721                          </span>
1722                          <label class="alignleft inline-edit-private">
1723                              <input type="checkbox" name="keep_private" value="private" />
1724                              <span class="checkbox-title"><?php _e( 'Private' ); ?></span>
1725                          </label>
1726                      </div>
1727  
1728                  <?php endif; ?>
1729  
1730                  </div>
1731              </fieldset>
1732  
1733              <?php if ( count( $hierarchical_taxonomies ) && ! $bulk ) : ?>
1734  
1735                  <fieldset class="inline-edit-col-center inline-edit-categories">
1736                      <div class="inline-edit-col">
1737  
1738                      <?php foreach ( $hierarchical_taxonomies as $taxonomy ) : ?>
1739  
1740                          <span class="title inline-edit-categories-label"><?php echo esc_html( $taxonomy->labels->name ); ?></span>
1741                          <input type="hidden" name="<?php echo ( 'category' === $taxonomy->name ) ? 'post_category[]' : 'tax_input[' . esc_attr( $taxonomy->name ) . '][]'; ?>" value="0" />
1742                          <ul class="cat-checklist <?php echo esc_attr( $taxonomy->name ); ?>-checklist">
1743                              <?php wp_terms_checklist( 0, array( 'taxonomy' => $taxonomy->name ) ); ?>
1744                          </ul>
1745  
1746                      <?php endforeach; // $hierarchical_taxonomies as $taxonomy ?>
1747  
1748                      </div>
1749                  </fieldset>
1750  
1751              <?php endif; // count( $hierarchical_taxonomies ) && ! $bulk ?>
1752  
1753              <fieldset class="inline-edit-col-right">
1754                  <div class="inline-edit-col">
1755  
1756                  <?php
1757                  if ( post_type_supports( $screen->post_type, 'author' ) && $bulk ) {
1758                      echo $authors_dropdown;
1759                  }
1760                  ?>
1761  
1762                  <?php if ( post_type_supports( $screen->post_type, 'page-attributes' ) ) : ?>
1763  
1764                      <?php if ( $post_type_object->hierarchical ) : ?>
1765  
1766                          <label>
1767                              <span class="title"><?php _e( 'Parent' ); ?></span>
1768                              <?php
1769                              $dropdown_args = array(
1770                                  'post_type'         => $post_type_object->name,
1771                                  'selected'          => $post->post_parent,
1772                                  'name'              => 'post_parent',
1773                                  'show_option_none'  => __( 'Main Page (no parent)' ),
1774                                  'option_none_value' => 0,
1775                                  'sort_column'       => 'menu_order, post_title',
1776                              );
1777  
1778                              if ( $bulk ) {
1779                                  $dropdown_args['show_option_no_change'] = __( '&mdash; No Change &mdash;' );
1780                              }
1781  
1782                              /**
1783                               * Filters the arguments used to generate the Quick Edit page-parent drop-down.
1784                               *
1785                               * @since 2.7.0
1786                               * @since 5.6.0 The `$bulk` parameter was added.
1787                               *
1788                               * @see wp_dropdown_pages()
1789                               *
1790                               * @param array $dropdown_args An array of arguments passed to wp_dropdown_pages().
1791                               * @param bool  $bulk          A flag to denote if it's a bulk action.
1792                               */
1793                              $dropdown_args = apply_filters( 'quick_edit_dropdown_pages_args', $dropdown_args, $bulk );
1794  
1795                              wp_dropdown_pages( $dropdown_args );
1796                              ?>
1797                          </label>
1798  
1799                      <?php endif; // hierarchical ?>
1800  
1801                      <?php if ( ! $bulk ) : ?>
1802  
1803                          <label>
1804                              <span class="title"><?php _e( 'Order' ); ?></span>
1805                              <span class="input-text-wrap"><input type="text" name="menu_order" class="inline-edit-menu-order-input" value="<?php echo $post->menu_order; ?>" /></span>
1806                          </label>
1807  
1808                      <?php endif; // ! $bulk ?>
1809  
1810                  <?php endif; // post_type_supports( ... 'page-attributes' ) ?>
1811  
1812                  <?php if ( 0 < count( get_page_templates( null, $screen->post_type ) ) ) : ?>
1813  
1814                      <label>
1815                          <span class="title"><?php _e( 'Template' ); ?></span>
1816                          <select name="page_template">
1817                              <?php if ( $bulk ) : ?>
1818                              <option value="-1"><?php _e( '&mdash; No Change &mdash;' ); ?></option>
1819                              <?php endif; // $bulk ?>
1820                              <?php
1821                              /** This filter is documented in wp-admin/includes/meta-boxes.php */
1822                              $default_title = apply_filters( 'default_page_template_title', __( 'Default template' ), 'quick-edit' );
1823                              ?>
1824                              <option value="default"><?php echo esc_html( $default_title ); ?></option>
1825                              <?php page_template_dropdown( '', $screen->post_type ); ?>
1826                          </select>
1827                      </label>
1828  
1829                  <?php endif; ?>
1830  
1831                  <?php if ( count( $flat_taxonomies ) && ! $bulk ) : ?>
1832  
1833                      <?php foreach ( $flat_taxonomies as $taxonomy ) : ?>
1834  
1835                          <?php if ( current_user_can( $taxonomy->cap->assign_terms ) ) : ?>
1836                              <?php $taxonomy_name = esc_attr( $taxonomy->name ); ?>
1837                              <div class="inline-edit-tags-wrap">
1838                              <label class="inline-edit-tags">
1839                                  <span class="title"><?php echo esc_html( $taxonomy->labels->name ); ?></span>
1840                                  <textarea data-wp-taxonomy="<?php echo $taxonomy_name; ?>" cols="22" rows="1" name="tax_input[<?php echo esc_attr( $taxonomy->name ); ?>]" class="tax_input_<?php echo esc_attr( $taxonomy->name ); ?>" aria-describedby="inline-edit-<?php echo esc_attr( $taxonomy->name ); ?>-desc"></textarea>
1841                              </label>
1842                              <p class="howto" id="inline-edit-<?php echo esc_attr( $taxonomy->name ); ?>-desc"><?php echo esc_html( $taxonomy->labels->separate_items_with_commas ); ?></p>
1843                              </div>
1844                          <?php endif; // current_user_can( 'assign_terms' ) ?>
1845  
1846                      <?php endforeach; // $flat_taxonomies as $taxonomy ?>
1847  
1848                  <?php endif; // count( $flat_taxonomies ) && ! $bulk ?>
1849  
1850                  <?php if ( post_type_supports( $screen->post_type, 'comments' ) || post_type_supports( $screen->post_type, 'trackbacks' ) ) : ?>
1851  
1852                      <?php if ( $bulk ) : ?>
1853  
1854                          <div class="inline-edit-group wp-clearfix">
1855  
1856                          <?php if ( post_type_supports( $screen->post_type, 'comments' ) ) : ?>
1857  
1858                              <label class="alignleft">
1859                                  <span class="title"><?php _e( 'Comments' ); ?></span>
1860                                  <select name="comment_status">
1861                                      <option value=""><?php _e( '&mdash; No Change &mdash;' ); ?></option>
1862                                      <option value="open"><?php _e( 'Allow' ); ?></option>
1863                                      <option value="closed"><?php _e( 'Do not allow' ); ?></option>
1864                                  </select>
1865                              </label>
1866  
1867                          <?php endif; ?>
1868  
1869                          <?php if ( post_type_supports( $screen->post_type, 'trackbacks' ) ) : ?>
1870  
1871                              <label class="alignright">
1872                                  <span class="title"><?php _e( 'Pings' ); ?></span>
1873                                  <select name="ping_status">
1874                                      <option value=""><?php _e( '&mdash; No Change &mdash;' ); ?></option>
1875                                      <option value="open"><?php _e( 'Allow' ); ?></option>
1876                                      <option value="closed"><?php _e( 'Do not allow' ); ?></option>
1877                                  </select>
1878                              </label>
1879  
1880                          <?php endif; ?>
1881  
1882                          </div>
1883  
1884                      <?php else : // $bulk ?>
1885  
1886                          <div class="inline-edit-group wp-clearfix">
1887  
1888                          <?php if ( post_type_supports( $screen->post_type, 'comments' ) ) : ?>
1889  
1890                              <label class="alignleft">
1891                                  <input type="checkbox" name="comment_status" value="open" />
1892                                  <span class="checkbox-title"><?php _e( 'Allow Comments' ); ?></span>
1893                              </label>
1894  
1895                          <?php endif; ?>
1896  
1897                          <?php if ( post_type_supports( $screen->post_type, 'trackbacks' ) ) : ?>
1898  
1899                              <label class="alignleft">
1900                                  <input type="checkbox" name="ping_status" value="open" />
1901                                  <span class="checkbox-title"><?php _e( 'Allow Pings' ); ?></span>
1902                              </label>
1903  
1904                          <?php endif; ?>
1905  
1906                          </div>
1907  
1908                      <?php endif; // $bulk ?>
1909  
1910                  <?php endif; // post_type_supports( ... comments or pings ) ?>
1911  
1912                      <div class="inline-edit-group wp-clearfix">
1913  
1914                          <label class="inline-edit-status alignleft">
1915                              <span class="title"><?php _e( 'Status' ); ?></span>
1916                              <select name="_status">
1917                                  <?php if ( $bulk ) : ?>
1918                                      <option value="-1"><?php _e( '&mdash; No Change &mdash;' ); ?></option>
1919                                  <?php endif; // $bulk ?>
1920  
1921                                  <?php if ( $can_publish ) : // Contributors only get "Unpublished" and "Pending Review". ?>
1922                                      <option value="publish"><?php _e( 'Published' ); ?></option>
1923                                      <option value="future"><?php _e( 'Scheduled' ); ?></option>
1924                                      <?php if ( $bulk ) : ?>
1925                                          <option value="private"><?php _e( 'Private' ); ?></option>
1926                                      <?php endif; // $bulk ?>
1927                                  <?php endif; ?>
1928  
1929                                  <option value="pending"><?php _e( 'Pending Review' ); ?></option>
1930                                  <option value="draft"><?php _e( 'Draft' ); ?></option>
1931                              </select>
1932                          </label>
1933  
1934                          <?php if ( 'post' === $screen->post_type && $can_publish && current_user_can( $post_type_object->cap->edit_others_posts ) ) : ?>
1935  
1936                              <?php if ( $bulk ) : ?>
1937  
1938                                  <label class="alignright">
1939                                      <span class="title"><?php _e( 'Sticky' ); ?></span>
1940                                      <select name="sticky">
1941                                          <option value="-1"><?php _e( '&mdash; No Change &mdash;' ); ?></option>
1942                                          <option value="sticky"><?php _e( 'Sticky' ); ?></option>
1943                                          <option value="unsticky"><?php _e( 'Not Sticky' ); ?></option>
1944                                      </select>
1945                                  </label>
1946  
1947                              <?php else : // $bulk ?>
1948  
1949                                  <label class="alignleft">
1950                                      <input type="checkbox" name="sticky" value="sticky" />
1951                                      <span class="checkbox-title"><?php _e( 'Make this post sticky' ); ?></span>
1952                                  </label>
1953  
1954                              <?php endif; // $bulk ?>
1955  
1956                          <?php endif; // 'post' && $can_publish && current_user_can( 'edit_others_posts' ) ?>
1957  
1958                      </div>
1959  
1960                  <?php if ( $bulk && current_theme_supports( 'post-formats' ) && post_type_supports( $screen->post_type, 'post-formats' ) ) : ?>
1961                      <?php $post_formats = get_theme_support( 'post-formats' ); ?>
1962  
1963                      <label class="alignleft">
1964                          <span class="title"><?php _ex( 'Format', 'post format' ); ?></span>
1965                          <select name="post_format">
1966                              <option value="-1"><?php _e( '&mdash; No Change &mdash;' ); ?></option>
1967                              <option value="0"><?php echo get_post_format_string( 'standard' ); ?></option>
1968                              <?php if ( is_array( $post_formats[0] ) ) : ?>
1969                                  <?php foreach ( $post_formats[0] as $format ) : ?>
1970                                      <option value="<?php echo esc_attr( $format ); ?>"><?php echo esc_html( get_post_format_string( $format ) ); ?></option>
1971                                  <?php endforeach; ?>
1972                              <?php endif; ?>
1973                          </select>
1974                      </label>
1975  
1976                  <?php endif; ?>
1977  
1978                  </div>
1979              </fieldset>
1980  
1981              <?php
1982              list( $columns ) = $this->get_column_info();
1983  
1984              foreach ( $columns as $column_name => $column_display_name ) {
1985                  if ( isset( $core_columns[ $column_name ] ) ) {
1986                      continue;
1987                  }
1988  
1989                  if ( $bulk ) {
1990  
1991                      /**
1992                       * Fires once for each column in Bulk Edit mode.
1993                       *
1994                       * @since 2.7.0
1995                       *
1996                       * @param string $column_name Name of the column to edit.
1997                       * @param string $post_type   The post type slug.
1998                       */
1999                      do_action( 'bulk_edit_custom_box', $column_name, $screen->post_type );
2000                  } else {
2001  
2002                      /**
2003                       * Fires once for each column in Quick Edit mode.
2004                       *
2005                       * @since 2.7.0
2006                       *
2007                       * @param string $column_name Name of the column to edit.
2008                       * @param string $post_type   The post type slug, or current screen name if this is a taxonomy list table.
2009                       * @param string $taxonomy    The taxonomy name, if any.
2010                       */
2011                      do_action( 'quick_edit_custom_box', $column_name, $screen->post_type, '' );
2012                  }
2013              }
2014              ?>
2015  
2016              <div class="submit inline-edit-save">
2017                  <?php if ( ! $bulk ) : ?>
2018                      <?php wp_nonce_field( 'inlineeditnonce', '_inline_edit', false ); ?>
2019                      <button type="button" class="button button-primary save"><?php _e( 'Update' ); ?></button>
2020                  <?php else : ?>
2021                      <?php submit_button( __( 'Update' ), 'primary', 'bulk_edit', false ); ?>
2022                  <?php endif; ?>
2023  
2024                  <button type="button" class="button cancel"><?php _e( 'Cancel' ); ?></button>
2025  
2026                  <?php if ( ! $bulk ) : ?>
2027                      <span class="spinner"></span>
2028                  <?php endif; ?>
2029  
2030                  <input type="hidden" name="post_view" value="<?php echo esc_attr( $m ); ?>" />
2031                  <input type="hidden" name="screen" value="<?php echo esc_attr( $screen->id ); ?>" />
2032                  <?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 ); ?>" />
2034                  <?php endif; ?>
2035  
2036                  <div class="notice notice-error notice-alt inline hidden">
2037                      <p class="error"></p>
2038                  </div>
2039              </div>
2040          </div> <!-- end of .inline-edit-wrapper -->
2041  
2042              </td></tr>
2043  
2044              <?php
2045              $bulk++;
2046          endwhile;
2047          ?>
2048          </tbody></table>
2049          </form>
2050          <?php
2051      }
2052  }


Generated: Tue Mar 19 01:00:02 2024 Cross-referenced by PHPXref 0.7.1