diff -r c7c34916027a -r 177826044cd9 wp/wp-admin/includes/class-wp-terms-list-table.php --- a/wp/wp-admin/includes/class-wp-terms-list-table.php Mon Oct 14 18:06:33 2019 +0200 +++ b/wp/wp-admin/includes/class-wp-terms-list-table.php Mon Oct 14 18:28:13 2019 +0200 @@ -38,32 +38,36 @@ public function __construct( $args = array() ) { global $post_type, $taxonomy, $action, $tax; - parent::__construct( array( - 'plural' => 'tags', - 'singular' => 'tag', - 'screen' => isset( $args['screen'] ) ? $args['screen'] : null, - ) ); + parent::__construct( + array( + 'plural' => 'tags', + 'singular' => 'tag', + 'screen' => isset( $args['screen'] ) ? $args['screen'] : null, + ) + ); $action = $this->screen->action; $post_type = $this->screen->post_type; $taxonomy = $this->screen->taxonomy; - if ( empty( $taxonomy ) ) + if ( empty( $taxonomy ) ) { $taxonomy = 'post_tag'; + } - if ( ! taxonomy_exists( $taxonomy ) ) + if ( ! taxonomy_exists( $taxonomy ) ) { wp_die( __( 'Invalid taxonomy.' ) ); + } $tax = get_taxonomy( $taxonomy ); // @todo Still needed? Maybe just the show_ui part. - if ( empty( $post_type ) || !in_array( $post_type, get_post_types( array( 'show_ui' => true ) ) ) ) + if ( empty( $post_type ) || ! in_array( $post_type, get_post_types( array( 'show_ui' => true ) ) ) ) { $post_type = 'post'; + } } /** - * * @return bool */ public function ajax_user_can() { @@ -105,30 +109,33 @@ $tags_per_page = apply_filters( 'edit_categories_per_page', $tags_per_page ); } - $search = !empty( $_REQUEST['s'] ) ? trim( wp_unslash( $_REQUEST['s'] ) ) : ''; + $search = ! empty( $_REQUEST['s'] ) ? trim( wp_unslash( $_REQUEST['s'] ) ) : ''; $args = array( 'search' => $search, - 'page' => $this->get_pagenum(), + 'page' => $this->get_pagenum(), 'number' => $tags_per_page, ); - if ( !empty( $_REQUEST['orderby'] ) ) + if ( ! empty( $_REQUEST['orderby'] ) ) { $args['orderby'] = trim( wp_unslash( $_REQUEST['orderby'] ) ); + } - if ( !empty( $_REQUEST['order'] ) ) + if ( ! empty( $_REQUEST['order'] ) ) { $args['order'] = trim( wp_unslash( $_REQUEST['order'] ) ); + } $this->callback_args = $args; - $this->set_pagination_args( array( - 'total_items' => wp_count_terms( $this->screen->taxonomy, compact( 'search' ) ), - 'per_page' => $tags_per_page, - ) ); + $this->set_pagination_args( + array( + 'total_items' => wp_count_terms( $this->screen->taxonomy, compact( 'search' ) ), + 'per_page' => $tags_per_page, + ) + ); } /** - * * @return bool */ public function has_items() { @@ -143,7 +150,6 @@ } /** - * * @return array */ protected function get_bulk_actions() { @@ -157,18 +163,17 @@ } /** - * * @return string */ public function current_action() { - if ( isset( $_REQUEST['action'] ) && isset( $_REQUEST['delete_tags'] ) && ( 'delete' === $_REQUEST['action'] || 'delete' === $_REQUEST['action2'] ) ) + if ( isset( $_REQUEST['action'] ) && isset( $_REQUEST['delete_tags'] ) && ( 'delete' === $_REQUEST['action'] || 'delete' === $_REQUEST['action2'] ) ) { return 'bulk-delete'; + } return parent::current_action(); } /** - * * @return array */ public function get_columns() { @@ -189,7 +194,6 @@ } /** - * * @return array */ protected function get_sortable_columns() { @@ -198,7 +202,7 @@ 'description' => 'description', 'slug' => 'slug', 'posts' => 'count', - 'links' => 'count' + 'links' => 'count', ); } @@ -207,12 +211,15 @@ public function display_rows_or_placeholder() { $taxonomy = $this->screen->taxonomy; - $args = wp_parse_args( $this->callback_args, array( - 'page' => 1, - 'number' => 20, - 'search' => '', - 'hide_empty' => 0 - ) ); + $args = wp_parse_args( + $this->callback_args, + array( + 'page' => 1, + 'number' => 20, + 'search' => '', + 'hide_empty' => 0, + ) + ); $page = $args['page']; @@ -268,22 +275,25 @@ foreach ( $terms as $key => $term ) { - if ( $count >= $end ) + if ( $count >= $end ) { break; + } - if ( $term->parent != $parent && empty( $_REQUEST['s'] ) ) + if ( $term->parent != $parent && empty( $_REQUEST['s'] ) ) { continue; + } // If the page starts in a subtree, print the parents. if ( $count == $start && $term->parent > 0 && empty( $_REQUEST['s'] ) ) { $my_parents = $parent_ids = array(); - $p = $term->parent; + $p = $term->parent; while ( $p ) { - $my_parent = get_term( $p, $taxonomy ); + $my_parent = get_term( $p, $taxonomy ); $my_parents[] = $my_parent; - $p = $my_parent->parent; - if ( in_array( $p, $parent_ids ) ) // Prevent parent loops. + $p = $my_parent->parent; + if ( in_array( $p, $parent_ids ) ) { // Prevent parent loops. break; + } $parent_ids[] = $p; } unset( $parent_ids ); @@ -303,10 +313,11 @@ ++$count; - unset( $terms[$key] ); + unset( $terms[ $key ] ); - if ( isset( $children[$term->term_id] ) && empty( $_REQUEST['s'] ) ) + if ( isset( $children[ $term->term_id ] ) && empty( $_REQUEST['s'] ) ) { $this->_rows( $taxonomy, $terms, $children, $start, $per_page, $count, $term->term_id, $level + 1 ); + } } } @@ -317,11 +328,18 @@ */ public function single_row( $tag, $level = 0 ) { global $taxonomy; - $tag = sanitize_term( $tag, $taxonomy ); + $tag = sanitize_term( $tag, $taxonomy ); $this->level = $level; - echo '