[ 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   $label Link text.
 256       * @param string   $class Optional. Class attribute. Default empty string.
 257       * @return string The formatted link string.
 258       */
 259  	protected function get_edit_link( $args, $label, $class = '' ) {
 260          $url = add_query_arg( $args, 'edit.php' );
 261  
 262          $class_html   = '';
 263          $aria_current = '';
 264  
 265          if ( ! empty( $class ) ) {
 266              $class_html = sprintf(
 267                  ' class="%s"',
 268                  esc_attr( $class )
 269              );
 270  
 271              if ( 'current' === $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              $label
 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, eg.
 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
 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, $level, $pagenum, $per_page, &$to_display ) {
 915          if ( ! isset( $children_pages[ $parent ] ) ) {
 916              return;
 917          }
 918  
 919          $start = ( $pagenum - 1 ) * $per_page;
 920          $end   = $start + $per_page;
 921  
 922          foreach ( $children_pages[ $parent ] 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 ] ); // 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                  /* translators: Used between list items, there is a space after the comma. */
1298                  echo implode( __( ', ' ), $term_links );
1299              } else {
1300                  echo '<span aria-hidden="true">&#8212;</span><span class="screen-reader-text">' . $taxonomy_object->labels->no_terms . '</span>';
1301              }
1302              return;
1303          }
1304  
1305          if ( is_post_type_hierarchical( $post->post_type ) ) {
1306  
1307              /**
1308               * Fires in each custom column on the Posts list table.
1309               *
1310               * This hook only fires if the current post type is hierarchical,
1311               * such as pages.
1312               *
1313               * @since 2.5.0
1314               *
1315               * @param string $column_name The name of the column to display.
1316               * @param int    $post_id     The current post ID.
1317               */
1318              do_action( 'manage_pages_custom_column', $column_name, $post->ID );
1319          } else {
1320  
1321              /**
1322               * Fires in each custom column in the Posts list table.
1323               *
1324               * This hook only fires if the current post type is non-hierarchical,
1325               * such as posts.
1326               *
1327               * @since 1.5.0
1328               *
1329               * @param string $column_name The name of the column to display.
1330               * @param int    $post_id     The current post ID.
1331               */
1332              do_action( 'manage_posts_custom_column', $column_name, $post->ID );
1333          }
1334  
1335          /**
1336           * Fires for each custom column of a specific post type in the Posts list table.
1337           *
1338           * The dynamic portion of the hook name, `$post->post_type`, refers to the post type.
1339           *
1340           * Possible hook names include:
1341           *
1342           *  - `manage_post_posts_custom_column`
1343           *  - `manage_page_posts_custom_column`
1344           *
1345           * @since 3.1.0
1346           *
1347           * @param string $column_name The name of the column to display.
1348           * @param int    $post_id     The current post ID.
1349           */
1350          do_action( "manage_{$post->post_type}_posts_custom_column", $column_name, $post->ID );
1351      }
1352  
1353      /**
1354       * @global WP_Post $post Global post object.
1355       *
1356       * @param int|WP_Post $post
1357       * @param int         $level
1358       */
1359  	public function single_row( $post, $level = 0 ) {
1360          $global_post = get_post();
1361  
1362          $post                = get_post( $post );
1363          $this->current_level = $level;
1364  
1365          $GLOBALS['post'] = $post;
1366          setup_postdata( $post );
1367  
1368          $classes = 'iedit author-' . ( get_current_user_id() === (int) $post->post_author ? 'self' : 'other' );
1369  
1370          $lock_holder = wp_check_post_lock( $post->ID );
1371  
1372          if ( $lock_holder ) {
1373              $classes .= ' wp-locked';
1374          }
1375  
1376          if ( $post->post_parent ) {
1377              $count    = count( get_post_ancestors( $post->ID ) );
1378              $classes .= ' level-' . $count;
1379          } else {
1380              $classes .= ' level-0';
1381          }
1382          ?>
1383          <tr id="post-<?php echo $post->ID; ?>" class="<?php echo implode( ' ', get_post_class( $classes, $post->ID ) ); ?>">
1384              <?php $this->single_row_columns( $post ); ?>
1385          </tr>
1386          <?php
1387          $GLOBALS['post'] = $global_post;
1388      }
1389  
1390      /**
1391       * Gets the name of the default primary column.
1392       *
1393       * @since 4.3.0
1394       *
1395       * @return string Name of the default primary column, in this case, 'title'.
1396       */
1397  	protected function get_default_primary_column_name() {
1398          return 'title';
1399      }
1400  
1401      /**
1402       * Generates and displays row action links.
1403       *
1404       * @since 4.3.0
1405       * @since 5.9.0 Renamed `$post` to `$item` to match parent class for PHP 8 named parameter support.
1406       *
1407       * @param WP_Post $item        Post being acted upon.
1408       * @param string  $column_name Current column name.
1409       * @param string  $primary     Primary column name.
1410       * @return string Row actions output for posts, or an empty string
1411       *                if the current column is not the primary column.
1412       */
1413  	protected function handle_row_actions( $item, $column_name, $primary ) {
1414          if ( $primary !== $column_name ) {
1415              return '';
1416          }
1417  
1418          // Restores the more descriptive, specific name for use within this method.
1419          $post             = $item;
1420          $post_type_object = get_post_type_object( $post->post_type );
1421          $can_edit_post    = current_user_can( 'edit_post', $post->ID );
1422          $actions          = array();
1423          $title            = _draft_or_post_title();
1424  
1425          if ( $can_edit_post && 'trash' !== $post->post_status ) {
1426              $actions['edit'] = sprintf(
1427                  '<a href="%s" aria-label="%s">%s</a>',
1428                  get_edit_post_link( $post->ID ),
1429                  /* translators: %s: Post title. */
1430                  esc_attr( sprintf( __( 'Edit &#8220;%s&#8221;' ), $title ) ),
1431                  __( 'Edit' )
1432              );
1433  
1434              if ( 'wp_block' !== $post->post_type ) {
1435                  $actions['inline hide-if-no-js'] = sprintf(
1436                      '<button type="button" class="button-link editinline" aria-label="%s" aria-expanded="false">%s</button>',
1437                      /* translators: %s: Post title. */
1438                      esc_attr( sprintf( __( 'Quick edit &#8220;%s&#8221; inline' ), $title ) ),
1439                      __( 'Quick&nbsp;Edit' )
1440                  );
1441              }
1442          }
1443  
1444          if ( current_user_can( 'delete_post', $post->ID ) ) {
1445              if ( 'trash' === $post->post_status ) {
1446                  $actions['untrash'] = sprintf(
1447                      '<a href="%s" aria-label="%s">%s</a>',
1448                      wp_nonce_url( admin_url( sprintf( $post_type_object->_edit_link . '&amp;action=untrash', $post->ID ) ), 'untrash-post_' . $post->ID ),
1449                      /* translators: %s: Post title. */
1450                      esc_attr( sprintf( __( 'Restore &#8220;%s&#8221; from the Trash' ), $title ) ),
1451                      __( 'Restore' )
1452                  );
1453              } elseif ( EMPTY_TRASH_DAYS ) {
1454                  $actions['trash'] = sprintf(
1455                      '<a href="%s" class="submitdelete" aria-label="%s">%s</a>',
1456                      get_delete_post_link( $post->ID ),
1457                      /* translators: %s: Post title. */
1458                      esc_attr( sprintf( __( 'Move &#8220;%s&#8221; to the Trash' ), $title ) ),
1459                      _x( 'Trash', 'verb' )
1460                  );
1461              }
1462  
1463              if ( 'trash' === $post->post_status || ! EMPTY_TRASH_DAYS ) {
1464                  $actions['delete'] = sprintf(
1465                      '<a href="%s" class="submitdelete" aria-label="%s">%s</a>',
1466                      get_delete_post_link( $post->ID, '', true ),
1467                      /* translators: %s: Post title. */
1468                      esc_attr( sprintf( __( 'Delete &#8220;%s&#8221; permanently' ), $title ) ),
1469                      __( 'Delete Permanently' )
1470                  );
1471              }
1472          }
1473  
1474          if ( is_post_type_viewable( $post_type_object ) ) {
1475              if ( in_array( $post->post_status, array( 'pending', 'draft', 'future' ), true ) ) {
1476                  if ( $can_edit_post ) {
1477                      $preview_link    = get_preview_post_link( $post );
1478                      $actions['view'] = sprintf(
1479                          '<a href="%s" rel="bookmark" aria-label="%s">%s</a>',
1480                          esc_url( $preview_link ),
1481                          /* translators: %s: Post title. */
1482                          esc_attr( sprintf( __( 'Preview &#8220;%s&#8221;' ), $title ) ),
1483                          __( 'Preview' )
1484                      );
1485                  }
1486              } elseif ( 'trash' !== $post->post_status ) {
1487                  $actions['view'] = sprintf(
1488                      '<a href="%s" rel="bookmark" aria-label="%s">%s</a>',
1489                      get_permalink( $post->ID ),
1490                      /* translators: %s: Post title. */
1491                      esc_attr( sprintf( __( 'View &#8220;%s&#8221;' ), $title ) ),
1492                      __( 'View' )
1493                  );
1494              }
1495          }
1496  
1497          if ( 'wp_block' === $post->post_type ) {
1498              $actions['export'] = sprintf(
1499                  '<button type="button" class="wp-list-reusable-blocks__export button-link" data-id="%s" aria-label="%s">%s</button>',
1500                  $post->ID,
1501                  /* translators: %s: Post title. */
1502                  esc_attr( sprintf( __( 'Export &#8220;%s&#8221; as JSON' ), $title ) ),
1503                  __( 'Export as JSON' )
1504              );
1505          }
1506  
1507          if ( is_post_type_hierarchical( $post->post_type ) ) {
1508  
1509              /**
1510               * Filters the array of row action links on the Pages list table.
1511               *
1512               * The filter is evaluated only for hierarchical post types.
1513               *
1514               * @since 2.8.0
1515               *
1516               * @param string[] $actions An array of row action links. Defaults are
1517               *                          'Edit', 'Quick Edit', 'Restore', 'Trash',
1518               *                          'Delete Permanently', 'Preview', and 'View'.
1519               * @param WP_Post  $post    The post object.
1520               */
1521              $actions = apply_filters( 'page_row_actions', $actions, $post );
1522          } else {
1523  
1524              /**
1525               * Filters the array of row action links on the Posts list table.
1526               *
1527               * The filter is evaluated only for non-hierarchical post types.
1528               *
1529               * @since 2.8.0
1530               *
1531               * @param string[] $actions An array of row action links. Defaults are
1532               *                          'Edit', 'Quick Edit', 'Restore', 'Trash',
1533               *                          'Delete Permanently', 'Preview', and 'View'.
1534               * @param WP_Post  $post    The post object.
1535               */
1536              $actions = apply_filters( 'post_row_actions', $actions, $post );
1537          }
1538  
1539          return $this->row_actions( $actions );
1540      }
1541  
1542      /**
1543       * Outputs the hidden row displayed when inline editing
1544       *
1545       * @since 3.1.0
1546       *
1547       * @global string $mode List table view mode.
1548       */
1549  	public function inline_edit() {
1550          global $mode;
1551  
1552          $screen = $this->screen;
1553  
1554          $post             = get_default_post_to_edit( $screen->post_type );
1555          $post_type_object = get_post_type_object( $screen->post_type );
1556  
1557          $taxonomy_names          = get_object_taxonomies( $screen->post_type );
1558          $hierarchical_taxonomies = array();
1559          $flat_taxonomies         = array();
1560  
1561          foreach ( $taxonomy_names as $taxonomy_name ) {
1562              $taxonomy = get_taxonomy( $taxonomy_name );
1563  
1564              $show_in_quick_edit = $taxonomy->show_in_quick_edit;
1565  
1566              /**
1567               * Filters whether the current taxonomy should be shown in the Quick Edit panel.
1568               *
1569               * @since 4.2.0
1570               *
1571               * @param bool   $show_in_quick_edit Whether to show the current taxonomy in Quick Edit.
1572               * @param string $taxonomy_name      Taxonomy name.
1573               * @param string $post_type          Post type of current Quick Edit post.
1574               */
1575              if ( ! apply_filters( 'quick_edit_show_taxonomy', $show_in_quick_edit, $taxonomy_name, $screen->post_type ) ) {
1576                  continue;
1577              }
1578  
1579              if ( $taxonomy->hierarchical ) {
1580                  $hierarchical_taxonomies[] = $taxonomy;
1581              } else {
1582                  $flat_taxonomies[] = $taxonomy;
1583              }
1584          }
1585  
1586          $m            = ( isset( $mode ) && 'excerpt' === $mode ) ? 'excerpt' : 'list';
1587          $can_publish  = current_user_can( $post_type_object->cap->publish_posts );
1588          $core_columns = array(
1589              'cb'         => true,
1590              'date'       => true,
1591              'title'      => true,
1592              'categories' => true,
1593              'tags'       => true,
1594              'comments'   => true,
1595              'author'     => true,
1596          );
1597          ?>
1598  
1599          <form method="get">
1600          <table style="display: none"><tbody id="inlineedit">
1601          <?php
1602          $hclass              = count( $hierarchical_taxonomies ) ? 'post' : 'page';
1603          $inline_edit_classes = "inline-edit-row inline-edit-row-$hclass";
1604          $bulk_edit_classes   = "bulk-edit-row bulk-edit-row-$hclass bulk-edit-{$screen->post_type}";
1605          $quick_edit_classes  = "quick-edit-row quick-edit-row-$hclass inline-edit-{$screen->post_type}";
1606  
1607          $bulk = 0;
1608  
1609          while ( $bulk < 2 ) :
1610              $classes  = $inline_edit_classes . ' ';
1611              $classes .= $bulk ? $bulk_edit_classes : $quick_edit_classes;
1612              ?>
1613              <tr id="<?php echo $bulk ? 'bulk-edit' : 'inline-edit'; ?>" class="<?php echo $classes; ?>" style="display: none">
1614              <td colspan="<?php echo $this->get_column_count(); ?>" class="colspanchange">
1615  
1616              <fieldset class="inline-edit-col-left">
1617                  <legend class="inline-edit-legend"><?php echo $bulk ? __( 'Bulk Edit' ) : __( 'Quick Edit' ); ?></legend>
1618                  <div class="inline-edit-col">
1619  
1620                  <?php if ( post_type_supports( $screen->post_type, 'title' ) ) : ?>
1621  
1622                      <?php if ( $bulk ) : ?>
1623  
1624                          <div id="bulk-title-div">
1625                              <div id="bulk-titles"></div>
1626                          </div>
1627  
1628                      <?php else : // $bulk ?>
1629  
1630                          <label>
1631                              <span class="title"><?php _e( 'Title' ); ?></span>
1632                              <span class="input-text-wrap"><input type="text" name="post_title" class="ptitle" value="" /></span>
1633                          </label>
1634  
1635                          <?php if ( is_post_type_viewable( $screen->post_type ) ) : ?>
1636  
1637                              <label>
1638                                  <span class="title"><?php _e( 'Slug' ); ?></span>
1639                                  <span class="input-text-wrap"><input type="text" name="post_name" value="" /></span>
1640                              </label>
1641  
1642                          <?php endif; // is_post_type_viewable() ?>
1643  
1644                      <?php endif; // $bulk ?>
1645  
1646                  <?php endif; // post_type_supports( ... 'title' ) ?>
1647  
1648                  <?php if ( ! $bulk ) : ?>
1649                      <fieldset class="inline-edit-date">
1650                          <legend><span class="title"><?php _e( 'Date' ); ?></span></legend>
1651                          <?php touch_time( 1, 1, 0, 1 ); ?>
1652                      </fieldset>
1653                      <br class="clear" />
1654                  <?php endif; // $bulk ?>
1655  
1656                  <?php
1657                  if ( post_type_supports( $screen->post_type, 'author' ) ) {
1658                      $authors_dropdown = '';
1659  
1660                      if ( current_user_can( $post_type_object->cap->edit_others_posts ) ) {
1661                          $users_opt = array(
1662                              'hide_if_only_one_author' => false,
1663                              'who'                     => 'authors',
1664                              'name'                    => 'post_author',
1665                              'class'                   => 'authors',
1666                              'multi'                   => 1,
1667                              'echo'                    => 0,
1668                              'show'                    => 'display_name_with_login',
1669                          );
1670  
1671                          if ( $bulk ) {
1672                              $users_opt['show_option_none'] = __( '&mdash; No Change &mdash;' );
1673                          }
1674  
1675                          /**
1676                           * Filters the arguments used to generate the Quick Edit authors drop-down.
1677                           *
1678                           * @since 5.6.0
1679                           *
1680                           * @see wp_dropdown_users()
1681                           *
1682                           * @param array $users_opt An array of arguments passed to wp_dropdown_users().
1683                           * @param bool  $bulk      A flag to denote if it's a bulk action.
1684                           */
1685                          $users_opt = apply_filters( 'quick_edit_dropdown_authors_args', $users_opt, $bulk );
1686  
1687                          $authors = wp_dropdown_users( $users_opt );
1688  
1689                          if ( $authors ) {
1690                              $authors_dropdown  = '<label class="inline-edit-author">';
1691                              $authors_dropdown .= '<span class="title">' . __( 'Author' ) . '</span>';
1692                              $authors_dropdown .= $authors;
1693                              $authors_dropdown .= '</label>';
1694                          }
1695                      } // current_user_can( 'edit_others_posts' )
1696  
1697                      if ( ! $bulk ) {
1698                          echo $authors_dropdown;
1699                      }
1700                  } // post_type_supports( ... 'author' )
1701                  ?>
1702  
1703                  <?php if ( ! $bulk && $can_publish ) : ?>
1704  
1705                      <div class="inline-edit-group wp-clearfix">
1706                          <label class="alignleft">
1707                              <span class="title"><?php _e( 'Password' ); ?></span>
1708                              <span class="input-text-wrap"><input type="text" name="post_password" class="inline-edit-password-input" value="" /></span>
1709                          </label>
1710  
1711                          <span class="alignleft inline-edit-or">
1712                              <?php
1713                              /* translators: Between password field and private checkbox on post quick edit interface. */
1714                              _e( '&ndash;OR&ndash;' );
1715                              ?>
1716                          </span>
1717                          <label class="alignleft inline-edit-private">
1718                              <input type="checkbox" name="keep_private" value="private" />
1719                              <span class="checkbox-title"><?php _e( 'Private' ); ?></span>
1720                          </label>
1721                      </div>
1722  
1723                  <?php endif; ?>
1724  
1725                  </div>
1726              </fieldset>
1727  
1728              <?php if ( count( $hierarchical_taxonomies ) && ! $bulk ) : ?>
1729  
1730                  <fieldset class="inline-edit-col-center inline-edit-categories">
1731                      <div class="inline-edit-col">
1732  
1733                      <?php foreach ( $hierarchical_taxonomies as $taxonomy ) : ?>
1734  
1735                          <span class="title inline-edit-categories-label"><?php echo esc_html( $taxonomy->labels->name ); ?></span>
1736                          <input type="hidden" name="<?php echo ( 'category' === $taxonomy->name ) ? 'post_category[]' : 'tax_input[' . esc_attr( $taxonomy->name ) . '][]'; ?>" value="0" />
1737                          <ul class="cat-checklist <?php echo esc_attr( $taxonomy->name ); ?>-checklist">
1738                              <?php wp_terms_checklist( 0, array( 'taxonomy' => $taxonomy->name ) ); ?>
1739                          </ul>
1740  
1741                      <?php endforeach; // $hierarchical_taxonomies as $taxonomy ?>
1742  
1743                      </div>
1744                  </fieldset>
1745  
1746              <?php endif; // count( $hierarchical_taxonomies ) && ! $bulk ?>
1747  
1748              <fieldset class="inline-edit-col-right">
1749                  <div class="inline-edit-col">
1750  
1751                  <?php
1752                  if ( post_type_supports( $screen->post_type, 'author' ) && $bulk ) {
1753                      echo $authors_dropdown;
1754                  }
1755                  ?>
1756  
1757                  <?php if ( post_type_supports( $screen->post_type, 'page-attributes' ) ) : ?>
1758  
1759                      <?php if ( $post_type_object->hierarchical ) : ?>
1760  
1761                          <label>
1762                              <span class="title"><?php _e( 'Parent' ); ?></span>
1763                              <?php
1764                              $dropdown_args = array(
1765                                  'post_type'         => $post_type_object->name,
1766                                  'selected'          => $post->post_parent,
1767                                  'name'              => 'post_parent',
1768                                  'show_option_none'  => __( 'Main Page (no parent)' ),
1769                                  'option_none_value' => 0,
1770                                  'sort_column'       => 'menu_order, post_title',
1771                              );
1772  
1773                              if ( $bulk ) {
1774                                  $dropdown_args['show_option_no_change'] = __( '&mdash; No Change &mdash;' );
1775                              }
1776  
1777                              /**
1778                               * Filters the arguments used to generate the Quick Edit page-parent drop-down.
1779                               *
1780                               * @since 2.7.0
1781                               * @since 5.6.0 The `$bulk` parameter was added.
1782                               *
1783                               * @see wp_dropdown_pages()
1784                               *
1785                               * @param array $dropdown_args An array of arguments passed to wp_dropdown_pages().
1786                               * @param bool  $bulk          A flag to denote if it's a bulk action.
1787                               */
1788                              $dropdown_args = apply_filters( 'quick_edit_dropdown_pages_args', $dropdown_args, $bulk );
1789  
1790                              wp_dropdown_pages( $dropdown_args );
1791                              ?>
1792                          </label>
1793  
1794                      <?php endif; // hierarchical ?>
1795  
1796                      <?php if ( ! $bulk ) : ?>
1797  
1798                          <label>
1799                              <span class="title"><?php _e( 'Order' ); ?></span>
1800                              <span class="input-text-wrap"><input type="text" name="menu_order" class="inline-edit-menu-order-input" value="<?php echo $post->menu_order; ?>" /></span>
1801                          </label>
1802  
1803                      <?php endif; // ! $bulk ?>
1804  
1805                  <?php endif; // post_type_supports( ... 'page-attributes' ) ?>
1806  
1807                  <?php if ( 0 < count( get_page_templates( null, $screen->post_type ) ) ) : ?>
1808  
1809                      <label>
1810                          <span class="title"><?php _e( 'Template' ); ?></span>
1811                          <select name="page_template">
1812                              <?php if ( $bulk ) : ?>
1813                              <option value="-1"><?php _e( '&mdash; No Change &mdash;' ); ?></option>
1814                              <?php endif; // $bulk ?>
1815                              <?php
1816                              /** This filter is documented in wp-admin/includes/meta-boxes.php */
1817                              $default_title = apply_filters( 'default_page_template_title', __( 'Default template' ), 'quick-edit' );
1818                              ?>
1819                              <option value="default"><?php echo esc_html( $default_title ); ?></option>
1820                              <?php page_template_dropdown( '', $screen->post_type ); ?>
1821                          </select>
1822                      </label>
1823  
1824                  <?php endif; ?>
1825  
1826                  <?php if ( count( $flat_taxonomies ) && ! $bulk ) : ?>
1827  
1828                      <?php foreach ( $flat_taxonomies as $taxonomy ) : ?>
1829  
1830                          <?php if ( current_user_can( $taxonomy->cap->assign_terms ) ) : ?>
1831                              <?php $taxonomy_name = esc_attr( $taxonomy->name ); ?>
1832  
1833                              <label class="inline-edit-tags">
1834                                  <span class="title"><?php echo esc_html( $taxonomy->labels->name ); ?></span>
1835                                  <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>
1836                              </label>
1837  
1838                          <?php endif; // current_user_can( 'assign_terms' ) ?>
1839  
1840                      <?php endforeach; // $flat_taxonomies as $taxonomy ?>
1841  
1842                  <?php endif; // count( $flat_taxonomies ) && ! $bulk ?>
1843  
1844                  <?php if ( post_type_supports( $screen->post_type, 'comments' ) || post_type_supports( $screen->post_type, 'trackbacks' ) ) : ?>
1845  
1846                      <?php if ( $bulk ) : ?>
1847  
1848                          <div class="inline-edit-group wp-clearfix">
1849  
1850                          <?php if ( post_type_supports( $screen->post_type, 'comments' ) ) : ?>
1851  
1852                              <label class="alignleft">
1853                                  <span class="title"><?php _e( 'Comments' ); ?></span>
1854                                  <select name="comment_status">
1855                                      <option value=""><?php _e( '&mdash; No Change &mdash;' ); ?></option>
1856                                      <option value="open"><?php _e( 'Allow' ); ?></option>
1857                                      <option value="closed"><?php _e( 'Do not allow' ); ?></option>
1858                                  </select>
1859                              </label>
1860  
1861                          <?php endif; ?>
1862  
1863                          <?php if ( post_type_supports( $screen->post_type, 'trackbacks' ) ) : ?>
1864  
1865                              <label class="alignright">
1866                                  <span class="title"><?php _e( 'Pings' ); ?></span>
1867                                  <select name="ping_status">
1868                                      <option value=""><?php _e( '&mdash; No Change &mdash;' ); ?></option>
1869                                      <option value="open"><?php _e( 'Allow' ); ?></option>
1870                                      <option value="closed"><?php _e( 'Do not allow' ); ?></option>
1871                                  </select>
1872                              </label>
1873  
1874                          <?php endif; ?>
1875  
1876                          </div>
1877  
1878                      <?php else : // $bulk ?>
1879  
1880                          <div class="inline-edit-group wp-clearfix">
1881  
1882                          <?php if ( post_type_supports( $screen->post_type, 'comments' ) ) : ?>
1883  
1884                              <label class="alignleft">
1885                                  <input type="checkbox" name="comment_status" value="open" />
1886                                  <span class="checkbox-title"><?php _e( 'Allow Comments' ); ?></span>
1887                              </label>
1888  
1889                          <?php endif; ?>
1890  
1891                          <?php if ( post_type_supports( $screen->post_type, 'trackbacks' ) ) : ?>
1892  
1893                              <label class="alignleft">
1894                                  <input type="checkbox" name="ping_status" value="open" />
1895                                  <span class="checkbox-title"><?php _e( 'Allow Pings' ); ?></span>
1896                              </label>
1897  
1898                          <?php endif; ?>
1899  
1900                          </div>
1901  
1902                      <?php endif; // $bulk ?>
1903  
1904                  <?php endif; // post_type_supports( ... comments or pings ) ?>
1905  
1906                      <div class="inline-edit-group wp-clearfix">
1907  
1908                          <label class="inline-edit-status alignleft">
1909                              <span class="title"><?php _e( 'Status' ); ?></span>
1910                              <select name="_status">
1911                                  <?php if ( $bulk ) : ?>
1912                                      <option value="-1"><?php _e( '&mdash; No Change &mdash;' ); ?></option>
1913                                  <?php endif; // $bulk ?>
1914  
1915                                  <?php if ( $can_publish ) : // Contributors only get "Unpublished" and "Pending Review". ?>
1916                                      <option value="publish"><?php _e( 'Published' ); ?></option>
1917                                      <option value="future"><?php _e( 'Scheduled' ); ?></option>
1918                                      <?php if ( $bulk ) : ?>
1919                                          <option value="private"><?php _e( 'Private' ); ?></option>
1920                                      <?php endif; // $bulk ?>
1921                                  <?php endif; ?>
1922  
1923                                  <option value="pending"><?php _e( 'Pending Review' ); ?></option>
1924                                  <option value="draft"><?php _e( 'Draft' ); ?></option>
1925                              </select>
1926                          </label>
1927  
1928                          <?php if ( 'post' === $screen->post_type && $can_publish && current_user_can( $post_type_object->cap->edit_others_posts ) ) : ?>
1929  
1930                              <?php if ( $bulk ) : ?>
1931  
1932                                  <label class="alignright">
1933                                      <span class="title"><?php _e( 'Sticky' ); ?></span>
1934                                      <select name="sticky">
1935                                          <option value="-1"><?php _e( '&mdash; No Change &mdash;' ); ?></option>
1936                                          <option value="sticky"><?php _e( 'Sticky' ); ?></option>
1937                                          <option value="unsticky"><?php _e( 'Not Sticky' ); ?></option>
1938                                      </select>
1939                                  </label>
1940  
1941                              <?php else : // $bulk ?>
1942  
1943                                  <label class="alignleft">
1944                                      <input type="checkbox" name="sticky" value="sticky" />
1945                                      <span class="checkbox-title"><?php _e( 'Make this post sticky' ); ?></span>
1946                                  </label>
1947  
1948                              <?php endif; // $bulk ?>
1949  
1950                          <?php endif; // 'post' && $can_publish && current_user_can( 'edit_others_posts' ) ?>
1951  
1952                      </div>
1953  
1954                  <?php if ( $bulk && current_theme_supports( 'post-formats' ) && post_type_supports( $screen->post_type, 'post-formats' ) ) : ?>
1955                      <?php $post_formats = get_theme_support( 'post-formats' ); ?>
1956  
1957                      <label class="alignleft">
1958                          <span class="title"><?php _ex( 'Format', 'post format' ); ?></span>
1959                          <select name="post_format">
1960                              <option value="-1"><?php _e( '&mdash; No Change &mdash;' ); ?></option>
1961                              <option value="0"><?php echo get_post_format_string( 'standard' ); ?></option>
1962                              <?php if ( is_array( $post_formats[0] ) ) : ?>
1963                                  <?php foreach ( $post_formats[0] as $format ) : ?>
1964                                      <option value="<?php echo esc_attr( $format ); ?>"><?php echo esc_html( get_post_format_string( $format ) ); ?></option>
1965                                  <?php endforeach; ?>
1966                              <?php endif; ?>
1967                          </select>
1968                      </label>
1969  
1970                  <?php endif; ?>
1971  
1972                  </div>
1973              </fieldset>
1974  
1975              <?php
1976              list( $columns ) = $this->get_column_info();
1977  
1978              foreach ( $columns as $column_name => $column_display_name ) {
1979                  if ( isset( $core_columns[ $column_name ] ) ) {
1980                      continue;
1981                  }
1982  
1983                  if ( $bulk ) {
1984  
1985                      /**
1986                       * Fires once for each column in Bulk Edit mode.
1987                       *
1988                       * @since 2.7.0
1989                       *
1990                       * @param string $column_name Name of the column to edit.
1991                       * @param string $post_type   The post type slug.
1992                       */
1993                      do_action( 'bulk_edit_custom_box', $column_name, $screen->post_type );
1994                  } else {
1995  
1996                      /**
1997                       * Fires once for each column in Quick Edit mode.
1998                       *
1999                       * @since 2.7.0
2000                       *
2001                       * @param string $column_name Name of the column to edit.
2002                       * @param string $post_type   The post type slug, or current screen name if this is a taxonomy list table.
2003                       * @param string $taxonomy    The taxonomy name, if any.
2004                       */
2005                      do_action( 'quick_edit_custom_box', $column_name, $screen->post_type, '' );
2006                  }
2007              }
2008              ?>
2009  
2010              <div class="submit inline-edit-save">
2011                  <button type="button" class="button cancel alignleft"><?php _e( 'Cancel' ); ?></button>
2012  
2013                  <?php if ( ! $bulk ) : ?>
2014                      <?php wp_nonce_field( 'inlineeditnonce', '_inline_edit', false ); ?>
2015                      <button type="button" class="button button-primary save alignright"><?php _e( 'Update' ); ?></button>
2016                      <span class="spinner"></span>
2017                  <?php else : ?>
2018                      <?php submit_button( __( 'Update' ), 'primary alignright', 'bulk_edit', false ); ?>
2019                  <?php endif; ?>
2020  
2021                  <input type="hidden" name="post_view" value="<?php echo esc_attr( $m ); ?>" />
2022                  <input type="hidden" name="screen" value="<?php echo esc_attr( $screen->id ); ?>" />
2023                  <?php if ( ! $bulk && ! post_type_supports( $screen->post_type, 'author' ) ) : ?>
2024                      <input type="hidden" name="post_author" value="<?php echo esc_attr( $post->post_author ); ?>" />
2025                  <?php endif; ?>
2026                  <br class="clear" />
2027  
2028                  <div class="notice notice-error notice-alt inline hidden">
2029                      <p class="error"></p>
2030                  </div>
2031              </div>
2032  
2033              </td></tr>
2034  
2035              <?php
2036              $bulk++;
2037          endwhile;
2038          ?>
2039          </tbody></table>
2040          </form>
2041          <?php
2042      }
2043  }


Generated: Thu Oct 21 01:00:03 2021 Cross-referenced by PHPXref 0.7.1