[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

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

   1  <?php
   2  /**
   3   * List Table API: WP_Terms_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 terms in a list table.
  12   *
  13   * @since 3.1.0
  14   *
  15   * @see WP_List_Table
  16   */
  17  class WP_Terms_List_Table extends WP_List_Table {
  18  
  19      public $callback_args;
  20  
  21      private $level;
  22  
  23      /**
  24       * Constructor.
  25       *
  26       * @since 3.1.0
  27       *
  28       * @see WP_List_Table::__construct() for more information on default arguments.
  29       *
  30       * @global string $post_type Global post type.
  31       * @global string $taxonomy  Global taxonomy.
  32       * @global string $action
  33       * @global object $tax
  34       *
  35       * @param array $args An associative array of arguments.
  36       */
  37  	public function __construct( $args = array() ) {
  38          global $post_type, $taxonomy, $action, $tax;
  39  
  40          parent::__construct(
  41              array(
  42                  'plural'   => 'tags',
  43                  'singular' => 'tag',
  44                  'screen'   => isset( $args['screen'] ) ? $args['screen'] : null,
  45              )
  46          );
  47  
  48          $action    = $this->screen->action;
  49          $post_type = $this->screen->post_type;
  50          $taxonomy  = $this->screen->taxonomy;
  51  
  52          if ( empty( $taxonomy ) ) {
  53              $taxonomy = 'post_tag';
  54          }
  55  
  56          if ( ! taxonomy_exists( $taxonomy ) ) {
  57              wp_die( __( 'Invalid taxonomy.' ) );
  58          }
  59  
  60          $tax = get_taxonomy( $taxonomy );
  61  
  62          // @todo Still needed? Maybe just the show_ui part.
  63          if ( empty( $post_type ) || ! in_array( $post_type, get_post_types( array( 'show_ui' => true ) ), true ) ) {
  64              $post_type = 'post';
  65          }
  66      }
  67  
  68      /**
  69       * @return bool
  70       */
  71  	public function ajax_user_can() {
  72          return current_user_can( get_taxonomy( $this->screen->taxonomy )->cap->manage_terms );
  73      }
  74  
  75      /**
  76       */
  77  	public function prepare_items() {
  78          $taxonomy = $this->screen->taxonomy;
  79  
  80          $tags_per_page = $this->get_items_per_page( "edit_{$taxonomy}_per_page" );
  81  
  82          if ( 'post_tag' === $taxonomy ) {
  83              /**
  84               * Filters the number of terms displayed per page for the Tags list table.
  85               *
  86               * @since 2.8.0
  87               *
  88               * @param int $tags_per_page Number of tags to be displayed. Default 20.
  89               */
  90              $tags_per_page = apply_filters( 'edit_tags_per_page', $tags_per_page );
  91  
  92              /**
  93               * Filters the number of terms displayed per page for the Tags list table.
  94               *
  95               * @since 2.7.0
  96               * @deprecated 2.8.0 Use {@see 'edit_tags_per_page'} instead.
  97               *
  98               * @param int $tags_per_page Number of tags to be displayed. Default 20.
  99               */
 100              $tags_per_page = apply_filters_deprecated( 'tagsperpage', array( $tags_per_page ), '2.8.0', 'edit_tags_per_page' );
 101          } elseif ( 'category' === $taxonomy ) {
 102              /**
 103               * Filters the number of terms displayed per page for the Categories list table.
 104               *
 105               * @since 2.8.0
 106               *
 107               * @param int $tags_per_page Number of categories to be displayed. Default 20.
 108               */
 109              $tags_per_page = apply_filters( 'edit_categories_per_page', $tags_per_page );
 110          }
 111  
 112          $search = ! empty( $_REQUEST['s'] ) ? trim( wp_unslash( $_REQUEST['s'] ) ) : '';
 113  
 114          $args = array(
 115              'taxonomy'   => $taxonomy,
 116              'search'     => $search,
 117              'page'       => $this->get_pagenum(),
 118              'number'     => $tags_per_page,
 119              'hide_empty' => 0,
 120          );
 121  
 122          if ( ! empty( $_REQUEST['orderby'] ) ) {
 123              $args['orderby'] = trim( wp_unslash( $_REQUEST['orderby'] ) );
 124          }
 125  
 126          if ( ! empty( $_REQUEST['order'] ) ) {
 127              $args['order'] = trim( wp_unslash( $_REQUEST['order'] ) );
 128          }
 129  
 130          $args['offset'] = ( $args['page'] - 1 ) * $args['number'];
 131  
 132          // Save the values because 'number' and 'offset' can be subsequently overridden.
 133          $this->callback_args = $args;
 134  
 135          if ( is_taxonomy_hierarchical( $taxonomy ) && ! isset( $args['orderby'] ) ) {
 136              // We'll need the full set of terms then.
 137              $args['number'] = 0;
 138              $args['offset'] = $args['number'];
 139          }
 140  
 141          $this->items = get_terms( $args );
 142  
 143          $this->set_pagination_args(
 144              array(
 145                  'total_items' => wp_count_terms(
 146                      array(
 147                          'taxonomy' => $taxonomy,
 148                          'search'   => $search,
 149                      )
 150                  ),
 151                  'per_page'    => $tags_per_page,
 152              )
 153          );
 154      }
 155  
 156      /**
 157       */
 158  	public function no_items() {
 159          echo get_taxonomy( $this->screen->taxonomy )->labels->not_found;
 160      }
 161  
 162      /**
 163       * @return array
 164       */
 165  	protected function get_bulk_actions() {
 166          $actions = array();
 167  
 168          if ( current_user_can( get_taxonomy( $this->screen->taxonomy )->cap->delete_terms ) ) {
 169              $actions['delete'] = __( 'Delete' );
 170          }
 171  
 172          return $actions;
 173      }
 174  
 175      /**
 176       * @return string
 177       */
 178  	public function current_action() {
 179          if ( isset( $_REQUEST['action'] ) && isset( $_REQUEST['delete_tags'] ) && 'delete' === $_REQUEST['action'] ) {
 180              return 'bulk-delete';
 181          }
 182  
 183          return parent::current_action();
 184      }
 185  
 186      /**
 187       * @return string[] Array of column titles keyed by their column name.
 188       */
 189  	public function get_columns() {
 190          $columns = array(
 191              'cb'          => '<input type="checkbox" />',
 192              'name'        => _x( 'Name', 'term name' ),
 193              'description' => __( 'Description' ),
 194              'slug'        => __( 'Slug' ),
 195          );
 196  
 197          if ( 'link_category' === $this->screen->taxonomy ) {
 198              $columns['links'] = __( 'Links' );
 199          } else {
 200              $columns['posts'] = _x( 'Count', 'Number/count of items' );
 201          }
 202  
 203          return $columns;
 204      }
 205  
 206      /**
 207       * @return array
 208       */
 209  	protected function get_sortable_columns() {
 210          $taxonomy = $this->screen->taxonomy;
 211  
 212          if ( ! isset( $_GET['orderby'] ) && is_taxonomy_hierarchical( $taxonomy ) ) {
 213              $name_orderby_text = __( 'Table ordered hierarchically.' );
 214          } else {
 215              $name_orderby_text = __( 'Table ordered by Name.' );
 216          }
 217  
 218          return array(
 219              'name'        => array( 'name', false, _x( 'Name', 'term name' ), $name_orderby_text, 'asc' ),
 220              'description' => array( 'description', false, __( 'Description' ), __( 'Table ordered by Description.' ) ),
 221              'slug'        => array( 'slug', false, __( 'Slug' ), __( 'Table ordered by Slug.' ) ),
 222              'posts'       => array( 'count', false, _x( 'Count', 'Number/count of items' ), __( 'Table ordered by Posts Count.' ) ),
 223              'links'       => array( 'count', false, __( 'Links' ), __( 'Table ordered by Links.' ) ),
 224          );
 225      }
 226  
 227      /**
 228       */
 229  	public function display_rows_or_placeholder() {
 230          $taxonomy = $this->screen->taxonomy;
 231  
 232          $number = $this->callback_args['number'];
 233          $offset = $this->callback_args['offset'];
 234  
 235          // Convert it to table rows.
 236          $count = 0;
 237  
 238          if ( empty( $this->items ) || ! is_array( $this->items ) ) {
 239              echo '<tr class="no-items"><td class="colspanchange" colspan="' . $this->get_column_count() . '">';
 240              $this->no_items();
 241              echo '</td></tr>';
 242              return;
 243          }
 244  
 245          if ( is_taxonomy_hierarchical( $taxonomy ) && ! isset( $this->callback_args['orderby'] ) ) {
 246              if ( ! empty( $this->callback_args['search'] ) ) {// Ignore children on searches.
 247                  $children = array();
 248              } else {
 249                  $children = _get_term_hierarchy( $taxonomy );
 250              }
 251  
 252              /*
 253               * Some funky recursion to get the job done (paging & parents mainly) is contained within.
 254               * Skip it for non-hierarchical taxonomies for performance sake.
 255               */
 256              $this->_rows( $taxonomy, $this->items, $children, $offset, $number, $count );
 257          } else {
 258              foreach ( $this->items as $term ) {
 259                  $this->single_row( $term );
 260              }
 261          }
 262      }
 263  
 264      /**
 265       * @param string $taxonomy
 266       * @param array  $terms
 267       * @param array  $children
 268       * @param int    $start
 269       * @param int    $per_page
 270       * @param int    $count
 271       * @param int    $parent_term
 272       * @param int    $level
 273       */
 274  	private function _rows( $taxonomy, $terms, &$children, $start, $per_page, &$count, $parent_term = 0, $level = 0 ) {
 275  
 276          $end = $start + $per_page;
 277  
 278          foreach ( $terms as $key => $term ) {
 279  
 280              if ( $count >= $end ) {
 281                  break;
 282              }
 283  
 284              if ( $term->parent !== $parent_term && empty( $_REQUEST['s'] ) ) {
 285                  continue;
 286              }
 287  
 288              // If the page starts in a subtree, print the parents.
 289              if ( $count === $start && $term->parent > 0 && empty( $_REQUEST['s'] ) ) {
 290                  $my_parents = array();
 291                  $parent_ids = array();
 292                  $p          = $term->parent;
 293  
 294                  while ( $p ) {
 295                      $my_parent    = get_term( $p, $taxonomy );
 296                      $my_parents[] = $my_parent;
 297                      $p            = $my_parent->parent;
 298  
 299                      if ( in_array( $p, $parent_ids, true ) ) { // Prevent parent loops.
 300                          break;
 301                      }
 302  
 303                      $parent_ids[] = $p;
 304                  }
 305  
 306                  unset( $parent_ids );
 307  
 308                  $num_parents = count( $my_parents );
 309  
 310                  while ( $my_parent = array_pop( $my_parents ) ) {
 311                      echo "\t";
 312                      $this->single_row( $my_parent, $level - $num_parents );
 313                      --$num_parents;
 314                  }
 315              }
 316  
 317              if ( $count >= $start ) {
 318                  echo "\t";
 319                  $this->single_row( $term, $level );
 320              }
 321  
 322              ++$count;
 323  
 324              unset( $terms[ $key ] );
 325  
 326              if ( isset( $children[ $term->term_id ] ) && empty( $_REQUEST['s'] ) ) {
 327                  $this->_rows( $taxonomy, $terms, $children, $start, $per_page, $count, $term->term_id, $level + 1 );
 328              }
 329          }
 330      }
 331  
 332      /**
 333       * @global string $taxonomy Global taxonomy.
 334       *
 335       * @param WP_Term $tag   Term object.
 336       * @param int     $level
 337       */
 338  	public function single_row( $tag, $level = 0 ) {
 339          global $taxonomy;
 340          $tag = sanitize_term( $tag, $taxonomy );
 341  
 342          $this->level = $level;
 343  
 344          if ( $tag->parent ) {
 345              $count = count( get_ancestors( $tag->term_id, $taxonomy, 'taxonomy' ) );
 346              $level = 'level-' . $count;
 347          } else {
 348              $level = 'level-0';
 349          }
 350  
 351          echo '<tr id="tag-' . $tag->term_id . '" class="' . $level . '">';
 352          $this->single_row_columns( $tag );
 353          echo '</tr>';
 354      }
 355  
 356      /**
 357       * @since 5.9.0 Renamed `$tag` to `$item` to match parent class for PHP 8 named parameter support.
 358       *
 359       * @param WP_Term $item Term object.
 360       * @return string
 361       */
 362  	public function column_cb( $item ) {
 363          // Restores the more descriptive, specific name for use within this method.
 364          $tag = $item;
 365  
 366          if ( current_user_can( 'delete_term', $tag->term_id ) ) {
 367              return sprintf(
 368                  '<input type="checkbox" name="delete_tags[]" value="%1$s" id="cb-select-%1$s" />' .
 369                  '<label for="cb-select-%1$s"><span class="screen-reader-text">%2$s</span></label>',
 370                  $tag->term_id,
 371                  /* translators: Hidden accessibility text. %s: Taxonomy term name. */
 372                  sprintf( __( 'Select %s' ), $tag->name )
 373              );
 374          }
 375  
 376          return '&nbsp;';
 377      }
 378  
 379      /**
 380       * @param WP_Term $tag Term object.
 381       * @return string
 382       */
 383  	public function column_name( $tag ) {
 384          $taxonomy = $this->screen->taxonomy;
 385  
 386          $pad = str_repeat( '&#8212; ', max( 0, $this->level ) );
 387  
 388          /**
 389           * Filters display of the term name in the terms list table.
 390           *
 391           * The default output may include padding due to the term's
 392           * current level in the term hierarchy.
 393           *
 394           * @since 2.5.0
 395           *
 396           * @see WP_Terms_List_Table::column_name()
 397           *
 398           * @param string $pad_tag_name The term name, padded if not top-level.
 399           * @param WP_Term $tag         Term object.
 400           */
 401          $name = apply_filters( 'term_name', $pad . ' ' . $tag->name, $tag );
 402  
 403          $qe_data = get_term( $tag->term_id, $taxonomy, OBJECT, 'edit' );
 404  
 405          $uri = wp_doing_ajax() ? wp_get_referer() : $_SERVER['REQUEST_URI'];
 406  
 407          $edit_link = get_edit_term_link( $tag, $taxonomy, $this->screen->post_type );
 408  
 409          if ( $edit_link ) {
 410              $edit_link = add_query_arg(
 411                  'wp_http_referer',
 412                  urlencode( wp_unslash( $uri ) ),
 413                  $edit_link
 414              );
 415              $name      = sprintf(
 416                  '<a class="row-title" href="%s" aria-label="%s">%s</a>',
 417                  esc_url( $edit_link ),
 418                  /* translators: %s: Taxonomy term name. */
 419                  esc_attr( sprintf( __( '&#8220;%s&#8221; (Edit)' ), $tag->name ) ),
 420                  $name
 421              );
 422          }
 423  
 424          $output = sprintf(
 425              '<strong>%s</strong><br />',
 426              $name
 427          );
 428  
 429          /** This filter is documented in wp-admin/includes/class-wp-terms-list-table.php */
 430          $quick_edit_enabled = apply_filters( 'quick_edit_enabled_for_taxonomy', true, $taxonomy );
 431  
 432          if ( $quick_edit_enabled ) {
 433              $output .= '<div class="hidden" id="inline_' . $qe_data->term_id . '">';
 434              $output .= '<div class="name">' . $qe_data->name . '</div>';
 435  
 436              /** This filter is documented in wp-admin/edit-tag-form.php */
 437              $output .= '<div class="slug">' . apply_filters( 'editable_slug', $qe_data->slug, $qe_data ) . '</div>';
 438              $output .= '<div class="parent">' . $qe_data->parent . '</div></div>';
 439          }
 440  
 441          return $output;
 442      }
 443  
 444      /**
 445       * Gets the name of the default primary column.
 446       *
 447       * @since 4.3.0
 448       *
 449       * @return string Name of the default primary column, in this case, 'name'.
 450       */
 451  	protected function get_default_primary_column_name() {
 452          return 'name';
 453      }
 454  
 455      /**
 456       * Generates and displays row action links.
 457       *
 458       * @since 4.3.0
 459       * @since 5.9.0 Renamed `$tag` to `$item` to match parent class for PHP 8 named parameter support.
 460       *
 461       * @param WP_Term $item        Tag being acted upon.
 462       * @param string  $column_name Current column name.
 463       * @param string  $primary     Primary column name.
 464       * @return string Row actions output for terms, or an empty string
 465       *                if the current column is not the primary column.
 466       */
 467  	protected function handle_row_actions( $item, $column_name, $primary ) {
 468          if ( $primary !== $column_name ) {
 469              return '';
 470          }
 471  
 472          // Restores the more descriptive, specific name for use within this method.
 473          $tag = $item;
 474  
 475          $taxonomy = $this->screen->taxonomy;
 476          $uri      = wp_doing_ajax() ? wp_get_referer() : $_SERVER['REQUEST_URI'];
 477  
 478          $actions = array();
 479  
 480          if ( current_user_can( 'edit_term', $tag->term_id ) ) {
 481              $actions['edit'] = sprintf(
 482                  '<a href="%s" aria-label="%s">%s</a>',
 483                  esc_url(
 484                      add_query_arg(
 485                          'wp_http_referer',
 486                          urlencode( wp_unslash( $uri ) ),
 487                          get_edit_term_link( $tag, $taxonomy, $this->screen->post_type )
 488                      )
 489                  ),
 490                  /* translators: %s: Taxonomy term name. */
 491                  esc_attr( sprintf( __( 'Edit &#8220;%s&#8221;' ), $tag->name ) ),
 492                  __( 'Edit' )
 493              );
 494  
 495              /**
 496               * Filters whether Quick Edit should be enabled for the given taxonomy.
 497               *
 498               * @since 6.4.0
 499               *
 500               * @param bool   $enable   Whether to enable the Quick Edit functionality. Default true.
 501               * @param string $taxonomy Taxonomy name.
 502               */
 503              $quick_edit_enabled = apply_filters( 'quick_edit_enabled_for_taxonomy', true, $taxonomy );
 504  
 505              if ( $quick_edit_enabled ) {
 506                  $actions['inline hide-if-no-js'] = sprintf(
 507                      '<button type="button" class="button-link editinline" aria-label="%s" aria-expanded="false">%s</button>',
 508                      /* translators: %s: Taxonomy term name. */
 509                      esc_attr( sprintf( __( 'Quick edit &#8220;%s&#8221; inline' ), $tag->name ) ),
 510                      __( 'Quick&nbsp;Edit' )
 511                  );
 512              }
 513          }
 514  
 515          if ( current_user_can( 'delete_term', $tag->term_id ) ) {
 516              $actions['delete'] = sprintf(
 517                  '<a href="%s" class="delete-tag aria-button-if-js" aria-label="%s">%s</a>',
 518                  wp_nonce_url( "edit-tags.php?action=delete&amp;taxonomy=$taxonomy&amp;tag_ID=$tag->term_id", 'delete-tag_' . $tag->term_id ),
 519                  /* translators: %s: Taxonomy term name. */
 520                  esc_attr( sprintf( __( 'Delete &#8220;%s&#8221;' ), $tag->name ) ),
 521                  __( 'Delete' )
 522              );
 523          }
 524  
 525          if ( is_term_publicly_viewable( $tag ) ) {
 526              $actions['view'] = sprintf(
 527                  '<a href="%s" aria-label="%s">%s</a>',
 528                  get_term_link( $tag ),
 529                  /* translators: %s: Taxonomy term name. */
 530                  esc_attr( sprintf( __( 'View &#8220;%s&#8221; archive' ), $tag->name ) ),
 531                  __( 'View' )
 532              );
 533          }
 534  
 535          /**
 536           * Filters the action links displayed for each term in the Tags list table.
 537           *
 538           * @since 2.8.0
 539           * @since 3.0.0 Deprecated in favor of {@see '{$taxonomy}_row_actions'} filter.
 540           * @since 5.4.2 Restored (un-deprecated).
 541           *
 542           * @param string[] $actions An array of action links to be displayed. Default
 543           *                          'Edit', 'Quick Edit', 'Delete', and 'View'.
 544           * @param WP_Term  $tag     Term object.
 545           */
 546          $actions = apply_filters( 'tag_row_actions', $actions, $tag );
 547  
 548          /**
 549           * Filters the action links displayed for each term in the terms list table.
 550           *
 551           * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug.
 552           *
 553           * Possible hook names include:
 554           *
 555           *  - `category_row_actions`
 556           *  - `post_tag_row_actions`
 557           *
 558           * @since 3.0.0
 559           *
 560           * @param string[] $actions An array of action links to be displayed. Default
 561           *                          'Edit', 'Quick Edit', 'Delete', and 'View'.
 562           * @param WP_Term  $tag     Term object.
 563           */
 564          $actions = apply_filters( "{$taxonomy}_row_actions", $actions, $tag );
 565  
 566          return $this->row_actions( $actions );
 567      }
 568  
 569      /**
 570       * @param WP_Term $tag Term object.
 571       * @return string
 572       */
 573  	public function column_description( $tag ) {
 574          if ( $tag->description ) {
 575              return $tag->description;
 576          } else {
 577              return '<span aria-hidden="true">&#8212;</span><span class="screen-reader-text">' .
 578                  /* translators: Hidden accessibility text. */
 579                  __( 'No description' ) .
 580              '</span>';
 581          }
 582      }
 583  
 584      /**
 585       * @param WP_Term $tag Term object.
 586       * @return string
 587       */
 588  	public function column_slug( $tag ) {
 589          /** This filter is documented in wp-admin/edit-tag-form.php */
 590          return apply_filters( 'editable_slug', $tag->slug, $tag );
 591      }
 592  
 593      /**
 594       * @param WP_Term $tag Term object.
 595       * @return string
 596       */
 597  	public function column_posts( $tag ) {
 598          $count = number_format_i18n( $tag->count );
 599  
 600          $tax = get_taxonomy( $this->screen->taxonomy );
 601  
 602          $ptype_object = get_post_type_object( $this->screen->post_type );
 603          if ( ! $ptype_object->show_ui ) {
 604              return $count;
 605          }
 606  
 607          if ( $tax->query_var ) {
 608              $args = array( $tax->query_var => $tag->slug );
 609          } else {
 610              $args = array(
 611                  'taxonomy' => $tax->name,
 612                  'term'     => $tag->slug,
 613              );
 614          }
 615  
 616          if ( 'post' !== $this->screen->post_type ) {
 617              $args['post_type'] = $this->screen->post_type;
 618          }
 619  
 620          if ( 'attachment' === $this->screen->post_type ) {
 621              return "<a href='" . esc_url( add_query_arg( $args, 'upload.php' ) ) . "'>$count</a>";
 622          }
 623  
 624          return "<a href='" . esc_url( add_query_arg( $args, 'edit.php' ) ) . "'>$count</a>";
 625      }
 626  
 627      /**
 628       * @param WP_Term $tag Term object.
 629       * @return string
 630       */
 631  	public function column_links( $tag ) {
 632          $count = number_format_i18n( $tag->count );
 633  
 634          if ( $count ) {
 635              $count = "<a href='link-manager.php?cat_id=$tag->term_id'>$count</a>";
 636          }
 637  
 638          return $count;
 639      }
 640  
 641      /**
 642       * @since 5.9.0 Renamed `$tag` to `$item` to match parent class for PHP 8 named parameter support.
 643       *
 644       * @param WP_Term $item        Term object.
 645       * @param string  $column_name Name of the column.
 646       * @return string
 647       */
 648  	public function column_default( $item, $column_name ) {
 649          // Restores the more descriptive, specific name for use within this method.
 650          $tag = $item;
 651  
 652          /**
 653           * Filters the displayed columns in the terms list table.
 654           *
 655           * The dynamic portion of the hook name, `$this->screen->taxonomy`,
 656           * refers to the slug of the current taxonomy.
 657           *
 658           * Possible hook names include:
 659           *
 660           *  - `manage_category_custom_column`
 661           *  - `manage_post_tag_custom_column`
 662           *
 663           * @since 2.8.0
 664           *
 665           * @param string $string      Custom column output. Default empty.
 666           * @param string $column_name Name of the column.
 667           * @param int    $term_id     Term ID.
 668           */
 669          return apply_filters( "manage_{$this->screen->taxonomy}_custom_column", '', $column_name, $tag->term_id );
 670      }
 671  
 672      /**
 673       * Outputs the hidden row displayed when inline editing
 674       *
 675       * @since 3.1.0
 676       */
 677  	public function inline_edit() {
 678          $tax = get_taxonomy( $this->screen->taxonomy );
 679  
 680          if ( ! current_user_can( $tax->cap->edit_terms ) ) {
 681              return;
 682          }
 683          ?>
 684  
 685          <form method="get">
 686          <table style="display: none"><tbody id="inlineedit">
 687  
 688              <tr id="inline-edit" class="inline-edit-row" style="display: none">
 689              <td colspan="<?php echo $this->get_column_count(); ?>" class="colspanchange">
 690              <div class="inline-edit-wrapper">
 691  
 692              <fieldset>
 693                  <legend class="inline-edit-legend"><?php _e( 'Quick Edit' ); ?></legend>
 694                  <div class="inline-edit-col">
 695                  <label>
 696                      <span class="title"><?php _ex( 'Name', 'term name' ); ?></span>
 697                      <span class="input-text-wrap"><input type="text" name="name" class="ptitle" value="" /></span>
 698                  </label>
 699  
 700                  <label>
 701                      <span class="title"><?php _e( 'Slug' ); ?></span>
 702                      <span class="input-text-wrap"><input type="text" name="slug" class="ptitle" value="" /></span>
 703                  </label>
 704                  </div>
 705              </fieldset>
 706  
 707              <?php
 708              $core_columns = array(
 709                  'cb'          => true,
 710                  'description' => true,
 711                  'name'        => true,
 712                  'slug'        => true,
 713                  'posts'       => true,
 714              );
 715  
 716              list( $columns ) = $this->get_column_info();
 717  
 718              foreach ( $columns as $column_name => $column_display_name ) {
 719                  if ( isset( $core_columns[ $column_name ] ) ) {
 720                      continue;
 721                  }
 722  
 723                  /** This action is documented in wp-admin/includes/class-wp-posts-list-table.php */
 724                  do_action( 'quick_edit_custom_box', $column_name, 'edit-tags', $this->screen->taxonomy );
 725              }
 726              ?>
 727  
 728              <div class="inline-edit-save submit">
 729                  <button type="button" class="save button button-primary"><?php echo $tax->labels->update_item; ?></button>
 730                  <button type="button" class="cancel button"><?php _e( 'Cancel' ); ?></button>
 731                  <span class="spinner"></span>
 732  
 733                  <?php wp_nonce_field( 'taxinlineeditnonce', '_inline_edit', false ); ?>
 734                  <input type="hidden" name="taxonomy" value="<?php echo esc_attr( $this->screen->taxonomy ); ?>" />
 735                  <input type="hidden" name="post_type" value="<?php echo esc_attr( $this->screen->post_type ); ?>" />
 736  
 737                  <?php
 738                  wp_admin_notice(
 739                      '<p class="error"></p>',
 740                      array(
 741                          'type'               => 'error',
 742                          'additional_classes' => array( 'notice-alt', 'inline', 'hidden' ),
 743                          'paragraph_wrap'     => false,
 744                      )
 745                  );
 746                  ?>
 747              </div>
 748              </div>
 749  
 750              </td></tr>
 751  
 752          </tbody></table>
 753          </form>
 754          <?php
 755      }
 756  }


Generated : Thu Nov 21 08:20:01 2024 Cross-referenced by PHPXref