[ 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
  31       * @global string $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
 334       * @param WP_Term $tag   Term object.
 335       * @param int     $level
 336       */
 337  	public function single_row( $tag, $level = 0 ) {
 338          global $taxonomy;
 339          $tag = sanitize_term( $tag, $taxonomy );
 340  
 341          $this->level = $level;
 342  
 343          if ( $tag->parent ) {
 344              $count = count( get_ancestors( $tag->term_id, $taxonomy, 'taxonomy' ) );
 345              $level = 'level-' . $count;
 346          } else {
 347              $level = 'level-0';
 348          }
 349  
 350          echo '<tr id="tag-' . $tag->term_id . '" class="' . $level . '">';
 351          $this->single_row_columns( $tag );
 352          echo '</tr>';
 353      }
 354  
 355      /**
 356       * @since 5.9.0 Renamed `$tag` to `$item` to match parent class for PHP 8 named parameter support.
 357       *
 358       * @param WP_Term $item Term object.
 359       * @return string
 360       */
 361  	public function column_cb( $item ) {
 362          // Restores the more descriptive, specific name for use within this method.
 363          $tag = $item;
 364  
 365          if ( current_user_can( 'delete_term', $tag->term_id ) ) {
 366              return sprintf(
 367                  '<input type="checkbox" name="delete_tags[]" value="%1$s" id="cb-select-%1$s" />' .
 368                  '<label for="cb-select-%1$s"><span class="screen-reader-text">%2$s</span></label>',
 369                  $tag->term_id,
 370                  /* translators: Hidden accessibility text. %s: Taxonomy term name. */
 371                  sprintf( __( 'Select %s' ), $tag->name )
 372              );
 373          }
 374  
 375          return '&nbsp;';
 376      }
 377  
 378      /**
 379       * @param WP_Term $tag Term object.
 380       * @return string
 381       */
 382  	public function column_name( $tag ) {
 383          $taxonomy = $this->screen->taxonomy;
 384  
 385          $pad = str_repeat( '&#8212; ', max( 0, $this->level ) );
 386  
 387          /**
 388           * Filters display of the term name in the terms list table.
 389           *
 390           * The default output may include padding due to the term's
 391           * current level in the term hierarchy.
 392           *
 393           * @since 2.5.0
 394           *
 395           * @see WP_Terms_List_Table::column_name()
 396           *
 397           * @param string $pad_tag_name The term name, padded if not top-level.
 398           * @param WP_Term $tag         Term object.
 399           */
 400          $name = apply_filters( 'term_name', $pad . ' ' . $tag->name, $tag );
 401  
 402          $qe_data = get_term( $tag->term_id, $taxonomy, OBJECT, 'edit' );
 403  
 404          $uri = wp_doing_ajax() ? wp_get_referer() : $_SERVER['REQUEST_URI'];
 405  
 406          $edit_link = get_edit_term_link( $tag, $taxonomy, $this->screen->post_type );
 407  
 408          if ( $edit_link ) {
 409              $edit_link = add_query_arg(
 410                  'wp_http_referer',
 411                  urlencode( wp_unslash( $uri ) ),
 412                  $edit_link
 413              );
 414              $name      = sprintf(
 415                  '<a class="row-title" href="%s" aria-label="%s">%s</a>',
 416                  esc_url( $edit_link ),
 417                  /* translators: %s: Taxonomy term name. */
 418                  esc_attr( sprintf( __( '&#8220;%s&#8221; (Edit)' ), $tag->name ) ),
 419                  $name
 420              );
 421          }
 422  
 423          $output = sprintf(
 424              '<strong>%s</strong><br />',
 425              $name
 426          );
 427  
 428          /** This filter is documented in wp-admin/includes/class-wp-terms-list-table.php */
 429          $quick_edit_enabled = apply_filters( 'quick_edit_enabled_for_taxonomy', true, $taxonomy );
 430  
 431          if ( $quick_edit_enabled ) {
 432              $output .= '<div class="hidden" id="inline_' . $qe_data->term_id . '">';
 433              $output .= '<div class="name">' . $qe_data->name . '</div>';
 434  
 435              /** This filter is documented in wp-admin/edit-tag-form.php */
 436              $output .= '<div class="slug">' . apply_filters( 'editable_slug', $qe_data->slug, $qe_data ) . '</div>';
 437              $output .= '<div class="parent">' . $qe_data->parent . '</div></div>';
 438          }
 439  
 440          return $output;
 441      }
 442  
 443      /**
 444       * Gets the name of the default primary column.
 445       *
 446       * @since 4.3.0
 447       *
 448       * @return string Name of the default primary column, in this case, 'name'.
 449       */
 450  	protected function get_default_primary_column_name() {
 451          return 'name';
 452      }
 453  
 454      /**
 455       * Generates and displays row action links.
 456       *
 457       * @since 4.3.0
 458       * @since 5.9.0 Renamed `$tag` to `$item` to match parent class for PHP 8 named parameter support.
 459       *
 460       * @param WP_Term $item        Tag being acted upon.
 461       * @param string  $column_name Current column name.
 462       * @param string  $primary     Primary column name.
 463       * @return string Row actions output for terms, or an empty string
 464       *                if the current column is not the primary column.
 465       */
 466  	protected function handle_row_actions( $item, $column_name, $primary ) {
 467          if ( $primary !== $column_name ) {
 468              return '';
 469          }
 470  
 471          // Restores the more descriptive, specific name for use within this method.
 472          $tag = $item;
 473  
 474          $taxonomy = $this->screen->taxonomy;
 475          $uri      = wp_doing_ajax() ? wp_get_referer() : $_SERVER['REQUEST_URI'];
 476  
 477          $actions = array();
 478  
 479          if ( current_user_can( 'edit_term', $tag->term_id ) ) {
 480              $actions['edit'] = sprintf(
 481                  '<a href="%s" aria-label="%s">%s</a>',
 482                  esc_url(
 483                      add_query_arg(
 484                          'wp_http_referer',
 485                          urlencode( wp_unslash( $uri ) ),
 486                          get_edit_term_link( $tag, $taxonomy, $this->screen->post_type )
 487                      )
 488                  ),
 489                  /* translators: %s: Taxonomy term name. */
 490                  esc_attr( sprintf( __( 'Edit &#8220;%s&#8221;' ), $tag->name ) ),
 491                  __( 'Edit' )
 492              );
 493  
 494              /**
 495               * Filters whether Quick Edit should be enabled for the given taxonomy.
 496               *
 497               * @since 6.4.0
 498               *
 499               * @param bool   $enable   Whether to enable the Quick Edit functionality. Default true.
 500               * @param string $taxonomy Taxonomy name.
 501               */
 502              $quick_edit_enabled = apply_filters( 'quick_edit_enabled_for_taxonomy', true, $taxonomy );
 503  
 504              if ( $quick_edit_enabled ) {
 505                  $actions['inline hide-if-no-js'] = sprintf(
 506                      '<button type="button" class="button-link editinline" aria-label="%s" aria-expanded="false">%s</button>',
 507                      /* translators: %s: Taxonomy term name. */
 508                      esc_attr( sprintf( __( 'Quick edit &#8220;%s&#8221; inline' ), $tag->name ) ),
 509                      __( 'Quick&nbsp;Edit' )
 510                  );
 511              }
 512          }
 513  
 514          if ( current_user_can( 'delete_term', $tag->term_id ) ) {
 515              $actions['delete'] = sprintf(
 516                  '<a href="%s" class="delete-tag aria-button-if-js" aria-label="%s">%s</a>',
 517                  wp_nonce_url( "edit-tags.php?action=delete&amp;taxonomy=$taxonomy&amp;tag_ID=$tag->term_id", 'delete-tag_' . $tag->term_id ),
 518                  /* translators: %s: Taxonomy term name. */
 519                  esc_attr( sprintf( __( 'Delete &#8220;%s&#8221;' ), $tag->name ) ),
 520                  __( 'Delete' )
 521              );
 522          }
 523  
 524          if ( is_term_publicly_viewable( $tag ) ) {
 525              $actions['view'] = sprintf(
 526                  '<a href="%s" aria-label="%s">%s</a>',
 527                  get_term_link( $tag ),
 528                  /* translators: %s: Taxonomy term name. */
 529                  esc_attr( sprintf( __( 'View &#8220;%s&#8221; archive' ), $tag->name ) ),
 530                  __( 'View' )
 531              );
 532          }
 533  
 534          /**
 535           * Filters the action links displayed for each term in the Tags list table.
 536           *
 537           * @since 2.8.0
 538           * @since 3.0.0 Deprecated in favor of {@see '{$taxonomy}_row_actions'} filter.
 539           * @since 5.4.2 Restored (un-deprecated).
 540           *
 541           * @param string[] $actions An array of action links to be displayed. Default
 542           *                          'Edit', 'Quick Edit', 'Delete', and 'View'.
 543           * @param WP_Term  $tag     Term object.
 544           */
 545          $actions = apply_filters( 'tag_row_actions', $actions, $tag );
 546  
 547          /**
 548           * Filters the action links displayed for each term in the terms list table.
 549           *
 550           * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug.
 551           *
 552           * Possible hook names include:
 553           *
 554           *  - `category_row_actions`
 555           *  - `post_tag_row_actions`
 556           *
 557           * @since 3.0.0
 558           *
 559           * @param string[] $actions An array of action links to be displayed. Default
 560           *                          'Edit', 'Quick Edit', 'Delete', and 'View'.
 561           * @param WP_Term  $tag     Term object.
 562           */
 563          $actions = apply_filters( "{$taxonomy}_row_actions", $actions, $tag );
 564  
 565          return $this->row_actions( $actions );
 566      }
 567  
 568      /**
 569       * @param WP_Term $tag Term object.
 570       * @return string
 571       */
 572  	public function column_description( $tag ) {
 573          if ( $tag->description ) {
 574              return $tag->description;
 575          } else {
 576              return '<span aria-hidden="true">&#8212;</span><span class="screen-reader-text">' .
 577                  /* translators: Hidden accessibility text. */
 578                  __( 'No description' ) .
 579              '</span>';
 580          }
 581      }
 582  
 583      /**
 584       * @param WP_Term $tag Term object.
 585       * @return string
 586       */
 587  	public function column_slug( $tag ) {
 588          /** This filter is documented in wp-admin/edit-tag-form.php */
 589          return apply_filters( 'editable_slug', $tag->slug, $tag );
 590      }
 591  
 592      /**
 593       * @param WP_Term $tag Term object.
 594       * @return string
 595       */
 596  	public function column_posts( $tag ) {
 597          $count = number_format_i18n( $tag->count );
 598  
 599          $tax = get_taxonomy( $this->screen->taxonomy );
 600  
 601          $ptype_object = get_post_type_object( $this->screen->post_type );
 602          if ( ! $ptype_object->show_ui ) {
 603              return $count;
 604          }
 605  
 606          if ( $tax->query_var ) {
 607              $args = array( $tax->query_var => $tag->slug );
 608          } else {
 609              $args = array(
 610                  'taxonomy' => $tax->name,
 611                  'term'     => $tag->slug,
 612              );
 613          }
 614  
 615          if ( 'post' !== $this->screen->post_type ) {
 616              $args['post_type'] = $this->screen->post_type;
 617          }
 618  
 619          if ( 'attachment' === $this->screen->post_type ) {
 620              return "<a href='" . esc_url( add_query_arg( $args, 'upload.php' ) ) . "'>$count</a>";
 621          }
 622  
 623          return "<a href='" . esc_url( add_query_arg( $args, 'edit.php' ) ) . "'>$count</a>";
 624      }
 625  
 626      /**
 627       * @param WP_Term $tag Term object.
 628       * @return string
 629       */
 630  	public function column_links( $tag ) {
 631          $count = number_format_i18n( $tag->count );
 632  
 633          if ( $count ) {
 634              $count = "<a href='link-manager.php?cat_id=$tag->term_id'>$count</a>";
 635          }
 636  
 637          return $count;
 638      }
 639  
 640      /**
 641       * @since 5.9.0 Renamed `$tag` to `$item` to match parent class for PHP 8 named parameter support.
 642       *
 643       * @param WP_Term $item        Term object.
 644       * @param string  $column_name Name of the column.
 645       * @return string
 646       */
 647  	public function column_default( $item, $column_name ) {
 648          // Restores the more descriptive, specific name for use within this method.
 649          $tag = $item;
 650  
 651          /**
 652           * Filters the displayed columns in the terms list table.
 653           *
 654           * The dynamic portion of the hook name, `$this->screen->taxonomy`,
 655           * refers to the slug of the current taxonomy.
 656           *
 657           * Possible hook names include:
 658           *
 659           *  - `manage_category_custom_column`
 660           *  - `manage_post_tag_custom_column`
 661           *
 662           * @since 2.8.0
 663           *
 664           * @param string $string      Custom column output. Default empty.
 665           * @param string $column_name Name of the column.
 666           * @param int    $term_id     Term ID.
 667           */
 668          return apply_filters( "manage_{$this->screen->taxonomy}_custom_column", '', $column_name, $tag->term_id );
 669      }
 670  
 671      /**
 672       * Outputs the hidden row displayed when inline editing
 673       *
 674       * @since 3.1.0
 675       */
 676  	public function inline_edit() {
 677          $tax = get_taxonomy( $this->screen->taxonomy );
 678  
 679          if ( ! current_user_can( $tax->cap->edit_terms ) ) {
 680              return;
 681          }
 682          ?>
 683  
 684          <form method="get">
 685          <table style="display: none"><tbody id="inlineedit">
 686  
 687              <tr id="inline-edit" class="inline-edit-row" style="display: none">
 688              <td colspan="<?php echo $this->get_column_count(); ?>" class="colspanchange">
 689              <div class="inline-edit-wrapper">
 690  
 691              <fieldset>
 692                  <legend class="inline-edit-legend"><?php _e( 'Quick Edit' ); ?></legend>
 693                  <div class="inline-edit-col">
 694                  <label>
 695                      <span class="title"><?php _ex( 'Name', 'term name' ); ?></span>
 696                      <span class="input-text-wrap"><input type="text" name="name" class="ptitle" value="" /></span>
 697                  </label>
 698  
 699                  <label>
 700                      <span class="title"><?php _e( 'Slug' ); ?></span>
 701                      <span class="input-text-wrap"><input type="text" name="slug" class="ptitle" value="" /></span>
 702                  </label>
 703                  </div>
 704              </fieldset>
 705  
 706              <?php
 707              $core_columns = array(
 708                  'cb'          => true,
 709                  'description' => true,
 710                  'name'        => true,
 711                  'slug'        => true,
 712                  'posts'       => true,
 713              );
 714  
 715              list( $columns ) = $this->get_column_info();
 716  
 717              foreach ( $columns as $column_name => $column_display_name ) {
 718                  if ( isset( $core_columns[ $column_name ] ) ) {
 719                      continue;
 720                  }
 721  
 722                  /** This action is documented in wp-admin/includes/class-wp-posts-list-table.php */
 723                  do_action( 'quick_edit_custom_box', $column_name, 'edit-tags', $this->screen->taxonomy );
 724              }
 725              ?>
 726  
 727              <div class="inline-edit-save submit">
 728                  <button type="button" class="save button button-primary"><?php echo $tax->labels->update_item; ?></button>
 729                  <button type="button" class="cancel button"><?php _e( 'Cancel' ); ?></button>
 730                  <span class="spinner"></span>
 731  
 732                  <?php wp_nonce_field( 'taxinlineeditnonce', '_inline_edit', false ); ?>
 733                  <input type="hidden" name="taxonomy" value="<?php echo esc_attr( $this->screen->taxonomy ); ?>" />
 734                  <input type="hidden" name="post_type" value="<?php echo esc_attr( $this->screen->post_type ); ?>" />
 735  
 736                  <?php
 737                  wp_admin_notice(
 738                      '<p class="error"></p>',
 739                      array(
 740                          'type'               => 'error',
 741                          'additional_classes' => array( 'notice-alt', 'inline', 'hidden' ),
 742                          'paragraph_wrap'     => false,
 743                      )
 744                  );
 745                  ?>
 746              </div>
 747              </div>
 748  
 749              </td></tr>
 750  
 751          </tbody></table>
 752          </form>
 753          <?php
 754      }
 755  }


Generated : Tue Mar 19 08:20:01 2024 Cross-referenced by PHPXref