127 |
127 |
128 $this->callback_args = $args; |
128 $this->callback_args = $args; |
129 |
129 |
130 $this->set_pagination_args( |
130 $this->set_pagination_args( |
131 array( |
131 array( |
132 'total_items' => wp_count_terms( $this->screen->taxonomy, compact( 'search' ) ), |
132 'total_items' => wp_count_terms( |
|
133 array( |
|
134 'taxonomy' => $this->screen->taxonomy, |
|
135 'search' => $search, |
|
136 ) |
|
137 ), |
133 'per_page' => $tags_per_page, |
138 'per_page' => $tags_per_page, |
134 ) |
139 ) |
135 ); |
140 ); |
136 } |
141 } |
137 |
142 |
285 |
290 |
286 if ( $count >= $end ) { |
291 if ( $count >= $end ) { |
287 break; |
292 break; |
288 } |
293 } |
289 |
294 |
290 if ( $term->parent != $parent && empty( $_REQUEST['s'] ) ) { |
295 if ( $term->parent !== $parent && empty( $_REQUEST['s'] ) ) { |
291 continue; |
296 continue; |
292 } |
297 } |
293 |
298 |
294 // If the page starts in a subtree, print the parents. |
299 // If the page starts in a subtree, print the parents. |
295 if ( $count == $start && $term->parent > 0 && empty( $_REQUEST['s'] ) ) { |
300 if ( $count === $start && $term->parent > 0 && empty( $_REQUEST['s'] ) ) { |
296 $my_parents = array(); |
301 $my_parents = array(); |
297 $parent_ids = array(); |
302 $parent_ids = array(); |
298 $p = $term->parent; |
303 $p = $term->parent; |
|
304 |
299 while ( $p ) { |
305 while ( $p ) { |
300 $my_parent = get_term( $p, $taxonomy ); |
306 $my_parent = get_term( $p, $taxonomy ); |
301 $my_parents[] = $my_parent; |
307 $my_parents[] = $my_parent; |
302 $p = $my_parent->parent; |
308 $p = $my_parent->parent; |
|
309 |
303 if ( in_array( $p, $parent_ids, true ) ) { // Prevent parent loops. |
310 if ( in_array( $p, $parent_ids, true ) ) { // Prevent parent loops. |
304 break; |
311 break; |
305 } |
312 } |
|
313 |
306 $parent_ids[] = $p; |
314 $parent_ids[] = $p; |
307 } |
315 } |
|
316 |
308 unset( $parent_ids ); |
317 unset( $parent_ids ); |
309 |
318 |
310 $num_parents = count( $my_parents ); |
319 $num_parents = count( $my_parents ); |
|
320 |
311 while ( $my_parent = array_pop( $my_parents ) ) { |
321 while ( $my_parent = array_pop( $my_parents ) ) { |
312 echo "\t"; |
322 echo "\t"; |
313 $this->single_row( $my_parent, $level - $num_parents ); |
323 $this->single_row( $my_parent, $level - $num_parents ); |
314 $num_parents--; |
324 $num_parents--; |
315 } |
325 } |
467 urlencode( wp_unslash( $uri ) ), |
477 urlencode( wp_unslash( $uri ) ), |
468 get_edit_term_link( $tag->term_id, $taxonomy, $this->screen->post_type ) |
478 get_edit_term_link( $tag->term_id, $taxonomy, $this->screen->post_type ) |
469 ); |
479 ); |
470 |
480 |
471 $actions = array(); |
481 $actions = array(); |
|
482 |
472 if ( current_user_can( 'edit_term', $tag->term_id ) ) { |
483 if ( current_user_can( 'edit_term', $tag->term_id ) ) { |
473 $actions['edit'] = sprintf( |
484 $actions['edit'] = sprintf( |
474 '<a href="%s" aria-label="%s">%s</a>', |
485 '<a href="%s" aria-label="%s">%s</a>', |
475 esc_url( $edit_link ), |
486 esc_url( $edit_link ), |
476 /* translators: %s: Taxonomy term name. */ |
487 /* translators: %s: Taxonomy term name. */ |
482 /* translators: %s: Taxonomy term name. */ |
493 /* translators: %s: Taxonomy term name. */ |
483 esc_attr( sprintf( __( 'Quick edit “%s” inline' ), $tag->name ) ), |
494 esc_attr( sprintf( __( 'Quick edit “%s” inline' ), $tag->name ) ), |
484 __( 'Quick Edit' ) |
495 __( 'Quick Edit' ) |
485 ); |
496 ); |
486 } |
497 } |
|
498 |
487 if ( current_user_can( 'delete_term', $tag->term_id ) ) { |
499 if ( current_user_can( 'delete_term', $tag->term_id ) ) { |
488 $actions['delete'] = sprintf( |
500 $actions['delete'] = sprintf( |
489 '<a href="%s" class="delete-tag aria-button-if-js" aria-label="%s">%s</a>', |
501 '<a href="%s" class="delete-tag aria-button-if-js" aria-label="%s">%s</a>', |
490 wp_nonce_url( "edit-tags.php?action=delete&taxonomy=$taxonomy&tag_ID=$tag->term_id", 'delete-tag_' . $tag->term_id ), |
502 wp_nonce_url( "edit-tags.php?action=delete&taxonomy=$taxonomy&tag_ID=$tag->term_id", 'delete-tag_' . $tag->term_id ), |
491 /* translators: %s: Taxonomy term name. */ |
503 /* translators: %s: Taxonomy term name. */ |
492 esc_attr( sprintf( __( 'Delete “%s”' ), $tag->name ) ), |
504 esc_attr( sprintf( __( 'Delete “%s”' ), $tag->name ) ), |
493 __( 'Delete' ) |
505 __( 'Delete' ) |
494 ); |
506 ); |
495 } |
507 } |
|
508 |
496 if ( is_taxonomy_viewable( $tax ) ) { |
509 if ( is_taxonomy_viewable( $tax ) ) { |
497 $actions['view'] = sprintf( |
510 $actions['view'] = sprintf( |
498 '<a href="%s" aria-label="%s">%s</a>', |
511 '<a href="%s" aria-label="%s">%s</a>', |
499 get_term_link( $tag ), |
512 get_term_link( $tag ), |
500 /* translators: %s: Taxonomy term name. */ |
513 /* translators: %s: Taxonomy term name. */ |
519 /** |
532 /** |
520 * Filters the action links displayed for each term in the terms list table. |
533 * Filters the action links displayed for each term in the terms list table. |
521 * |
534 * |
522 * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug. |
535 * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug. |
523 * |
536 * |
|
537 * Possible hook names include: |
|
538 * |
|
539 * - `category_row_actions` |
|
540 * - `post_tag_row_actions` |
|
541 * |
524 * @since 3.0.0 |
542 * @since 3.0.0 |
525 * |
543 * |
526 * @param string[] $actions An array of action links to be displayed. Default |
544 * @param string[] $actions An array of action links to be displayed. Default |
527 * 'Edit', 'Quick Edit', 'Delete', and 'View'. |
545 * 'Edit', 'Quick Edit', 'Delete', and 'View'. |
528 * @param WP_Term $tag Term object. |
546 * @param WP_Term $tag Term object. |
591 * @param WP_Term $tag Term object. |
609 * @param WP_Term $tag Term object. |
592 * @return string |
610 * @return string |
593 */ |
611 */ |
594 public function column_links( $tag ) { |
612 public function column_links( $tag ) { |
595 $count = number_format_i18n( $tag->count ); |
613 $count = number_format_i18n( $tag->count ); |
|
614 |
596 if ( $count ) { |
615 if ( $count ) { |
597 $count = "<a href='link-manager.php?cat_id=$tag->term_id'>$count</a>"; |
616 $count = "<a href='link-manager.php?cat_id=$tag->term_id'>$count</a>"; |
598 } |
617 } |
|
618 |
599 return $count; |
619 return $count; |
600 } |
620 } |
601 |
621 |
602 /** |
622 /** |
603 * @param WP_Term $tag Term object. |
623 * @param WP_Term $tag Term object. |
608 /** |
628 /** |
609 * Filters the displayed columns in the terms list table. |
629 * Filters the displayed columns in the terms list table. |
610 * |
630 * |
611 * The dynamic portion of the hook name, `$this->screen->taxonomy`, |
631 * The dynamic portion of the hook name, `$this->screen->taxonomy`, |
612 * refers to the slug of the current taxonomy. |
632 * refers to the slug of the current taxonomy. |
|
633 * |
|
634 * Possible hook names include: |
|
635 * |
|
636 * - `manage_category_custom_column` |
|
637 * - `manage_post_tag_custom_column` |
613 * |
638 * |
614 * @since 2.8.0 |
639 * @since 2.8.0 |
615 * |
640 * |
616 * @param string $string Blank string. |
641 * @param string $string Blank string. |
617 * @param string $column_name Name of the column. |
642 * @param string $column_name Name of the column. |