wp/wp-admin/includes/class-wp-terms-list-table.php
changeset 9 177826044cd9
parent 7 cf61fcea0001
child 16 a86126ab1dd4
equal deleted inserted replaced
8:c7c34916027a 9:177826044cd9
    36 	 * @param array $args An associative array of arguments.
    36 	 * @param array $args An associative array of arguments.
    37 	 */
    37 	 */
    38 	public function __construct( $args = array() ) {
    38 	public function __construct( $args = array() ) {
    39 		global $post_type, $taxonomy, $action, $tax;
    39 		global $post_type, $taxonomy, $action, $tax;
    40 
    40 
    41 		parent::__construct( array(
    41 		parent::__construct(
    42 			'plural' => 'tags',
    42 			array(
    43 			'singular' => 'tag',
    43 				'plural'   => 'tags',
    44 			'screen' => isset( $args['screen'] ) ? $args['screen'] : null,
    44 				'singular' => 'tag',
    45 		) );
    45 				'screen'   => isset( $args['screen'] ) ? $args['screen'] : null,
       
    46 			)
       
    47 		);
    46 
    48 
    47 		$action    = $this->screen->action;
    49 		$action    = $this->screen->action;
    48 		$post_type = $this->screen->post_type;
    50 		$post_type = $this->screen->post_type;
    49 		$taxonomy  = $this->screen->taxonomy;
    51 		$taxonomy  = $this->screen->taxonomy;
    50 
    52 
    51 		if ( empty( $taxonomy ) )
    53 		if ( empty( $taxonomy ) ) {
    52 			$taxonomy = 'post_tag';
    54 			$taxonomy = 'post_tag';
    53 
    55 		}
    54 		if ( ! taxonomy_exists( $taxonomy ) )
    56 
       
    57 		if ( ! taxonomy_exists( $taxonomy ) ) {
    55 			wp_die( __( 'Invalid taxonomy.' ) );
    58 			wp_die( __( 'Invalid taxonomy.' ) );
       
    59 		}
    56 
    60 
    57 		$tax = get_taxonomy( $taxonomy );
    61 		$tax = get_taxonomy( $taxonomy );
    58 
    62 
    59 		// @todo Still needed? Maybe just the show_ui part.
    63 		// @todo Still needed? Maybe just the show_ui part.
    60 		if ( empty( $post_type ) || !in_array( $post_type, get_post_types( array( 'show_ui' => true ) ) ) )
    64 		if ( empty( $post_type ) || ! in_array( $post_type, get_post_types( array( 'show_ui' => true ) ) ) ) {
    61 			$post_type = 'post';
    65 			$post_type = 'post';
    62 
    66 		}
    63 	}
    67 
    64 
    68 	}
    65 	/**
    69 
    66 	 *
    70 	/**
    67 	 * @return bool
    71 	 * @return bool
    68 	 */
    72 	 */
    69 	public function ajax_user_can() {
    73 	public function ajax_user_can() {
    70 		return current_user_can( get_taxonomy( $this->screen->taxonomy )->cap->manage_terms );
    74 		return current_user_can( get_taxonomy( $this->screen->taxonomy )->cap->manage_terms );
    71 	}
    75 	}
   103 			 * @param int $tags_per_page Number of categories to be displayed. Default 20.
   107 			 * @param int $tags_per_page Number of categories to be displayed. Default 20.
   104 			 */
   108 			 */
   105 			$tags_per_page = apply_filters( 'edit_categories_per_page', $tags_per_page );
   109 			$tags_per_page = apply_filters( 'edit_categories_per_page', $tags_per_page );
   106 		}
   110 		}
   107 
   111 
   108 		$search = !empty( $_REQUEST['s'] ) ? trim( wp_unslash( $_REQUEST['s'] ) ) : '';
   112 		$search = ! empty( $_REQUEST['s'] ) ? trim( wp_unslash( $_REQUEST['s'] ) ) : '';
   109 
   113 
   110 		$args = array(
   114 		$args = array(
   111 			'search' => $search,
   115 			'search' => $search,
   112 			'page' => $this->get_pagenum(),
   116 			'page'   => $this->get_pagenum(),
   113 			'number' => $tags_per_page,
   117 			'number' => $tags_per_page,
   114 		);
   118 		);
   115 
   119 
   116 		if ( !empty( $_REQUEST['orderby'] ) )
   120 		if ( ! empty( $_REQUEST['orderby'] ) ) {
   117 			$args['orderby'] = trim( wp_unslash( $_REQUEST['orderby'] ) );
   121 			$args['orderby'] = trim( wp_unslash( $_REQUEST['orderby'] ) );
   118 
   122 		}
   119 		if ( !empty( $_REQUEST['order'] ) )
   123 
       
   124 		if ( ! empty( $_REQUEST['order'] ) ) {
   120 			$args['order'] = trim( wp_unslash( $_REQUEST['order'] ) );
   125 			$args['order'] = trim( wp_unslash( $_REQUEST['order'] ) );
       
   126 		}
   121 
   127 
   122 		$this->callback_args = $args;
   128 		$this->callback_args = $args;
   123 
   129 
   124 		$this->set_pagination_args( array(
   130 		$this->set_pagination_args(
   125 			'total_items' => wp_count_terms( $this->screen->taxonomy, compact( 'search' ) ),
   131 			array(
   126 			'per_page' => $tags_per_page,
   132 				'total_items' => wp_count_terms( $this->screen->taxonomy, compact( 'search' ) ),
   127 		) );
   133 				'per_page'    => $tags_per_page,
   128 	}
   134 			)
   129 
   135 		);
   130 	/**
   136 	}
   131 	 *
   137 
       
   138 	/**
   132 	 * @return bool
   139 	 * @return bool
   133 	 */
   140 	 */
   134 	public function has_items() {
   141 	public function has_items() {
   135 		// todo: populate $this->items in prepare_items()
   142 		// todo: populate $this->items in prepare_items()
   136 		return true;
   143 		return true;
   141 	public function no_items() {
   148 	public function no_items() {
   142 		echo get_taxonomy( $this->screen->taxonomy )->labels->not_found;
   149 		echo get_taxonomy( $this->screen->taxonomy )->labels->not_found;
   143 	}
   150 	}
   144 
   151 
   145 	/**
   152 	/**
   146 	 *
       
   147 	 * @return array
   153 	 * @return array
   148 	 */
   154 	 */
   149 	protected function get_bulk_actions() {
   155 	protected function get_bulk_actions() {
   150 		$actions = array();
   156 		$actions = array();
   151 
   157 
   155 
   161 
   156 		return $actions;
   162 		return $actions;
   157 	}
   163 	}
   158 
   164 
   159 	/**
   165 	/**
   160 	 *
       
   161 	 * @return string
   166 	 * @return string
   162 	 */
   167 	 */
   163 	public function current_action() {
   168 	public function current_action() {
   164 		if ( isset( $_REQUEST['action'] ) && isset( $_REQUEST['delete_tags'] ) && ( 'delete' === $_REQUEST['action'] || 'delete' === $_REQUEST['action2'] ) )
   169 		if ( isset( $_REQUEST['action'] ) && isset( $_REQUEST['delete_tags'] ) && ( 'delete' === $_REQUEST['action'] || 'delete' === $_REQUEST['action2'] ) ) {
   165 			return 'bulk-delete';
   170 			return 'bulk-delete';
       
   171 		}
   166 
   172 
   167 		return parent::current_action();
   173 		return parent::current_action();
   168 	}
   174 	}
   169 
   175 
   170 	/**
   176 	/**
   171 	 *
       
   172 	 * @return array
   177 	 * @return array
   173 	 */
   178 	 */
   174 	public function get_columns() {
   179 	public function get_columns() {
   175 		$columns = array(
   180 		$columns = array(
   176 			'cb'          => '<input type="checkbox" />',
   181 			'cb'          => '<input type="checkbox" />',
   187 
   192 
   188 		return $columns;
   193 		return $columns;
   189 	}
   194 	}
   190 
   195 
   191 	/**
   196 	/**
   192 	 *
       
   193 	 * @return array
   197 	 * @return array
   194 	 */
   198 	 */
   195 	protected function get_sortable_columns() {
   199 	protected function get_sortable_columns() {
   196 		return array(
   200 		return array(
   197 			'name'        => 'name',
   201 			'name'        => 'name',
   198 			'description' => 'description',
   202 			'description' => 'description',
   199 			'slug'        => 'slug',
   203 			'slug'        => 'slug',
   200 			'posts'       => 'count',
   204 			'posts'       => 'count',
   201 			'links'       => 'count'
   205 			'links'       => 'count',
   202 		);
   206 		);
   203 	}
   207 	}
   204 
   208 
   205 	/**
   209 	/**
   206 	 */
   210 	 */
   207 	public function display_rows_or_placeholder() {
   211 	public function display_rows_or_placeholder() {
   208 		$taxonomy = $this->screen->taxonomy;
   212 		$taxonomy = $this->screen->taxonomy;
   209 
   213 
   210 		$args = wp_parse_args( $this->callback_args, array(
   214 		$args = wp_parse_args(
   211 			'page' => 1,
   215 			$this->callback_args,
   212 			'number' => 20,
   216 			array(
   213 			'search' => '',
   217 				'page'       => 1,
   214 			'hide_empty' => 0
   218 				'number'     => 20,
   215 		) );
   219 				'search'     => '',
       
   220 				'hide_empty' => 0,
       
   221 			)
       
   222 		);
   216 
   223 
   217 		$page = $args['page'];
   224 		$page = $args['page'];
   218 
   225 
   219 		// Set variable because $args['number'] can be subsequently overridden.
   226 		// Set variable because $args['number'] can be subsequently overridden.
   220 		$number = $args['number'];
   227 		$number = $args['number'];
   266 
   273 
   267 		$end = $start + $per_page;
   274 		$end = $start + $per_page;
   268 
   275 
   269 		foreach ( $terms as $key => $term ) {
   276 		foreach ( $terms as $key => $term ) {
   270 
   277 
   271 			if ( $count >= $end )
   278 			if ( $count >= $end ) {
   272 				break;
   279 				break;
   273 
   280 			}
   274 			if ( $term->parent != $parent && empty( $_REQUEST['s'] ) )
   281 
       
   282 			if ( $term->parent != $parent && empty( $_REQUEST['s'] ) ) {
   275 				continue;
   283 				continue;
       
   284 			}
   276 
   285 
   277 			// If the page starts in a subtree, print the parents.
   286 			// If the page starts in a subtree, print the parents.
   278 			if ( $count == $start && $term->parent > 0 && empty( $_REQUEST['s'] ) ) {
   287 			if ( $count == $start && $term->parent > 0 && empty( $_REQUEST['s'] ) ) {
   279 				$my_parents = $parent_ids = array();
   288 				$my_parents = $parent_ids = array();
   280 				$p = $term->parent;
   289 				$p          = $term->parent;
   281 				while ( $p ) {
   290 				while ( $p ) {
   282 					$my_parent = get_term( $p, $taxonomy );
   291 					$my_parent    = get_term( $p, $taxonomy );
   283 					$my_parents[] = $my_parent;
   292 					$my_parents[] = $my_parent;
   284 					$p = $my_parent->parent;
   293 					$p            = $my_parent->parent;
   285 					if ( in_array( $p, $parent_ids ) ) // Prevent parent loops.
   294 					if ( in_array( $p, $parent_ids ) ) { // Prevent parent loops.
   286 						break;
   295 						break;
       
   296 					}
   287 					$parent_ids[] = $p;
   297 					$parent_ids[] = $p;
   288 				}
   298 				}
   289 				unset( $parent_ids );
   299 				unset( $parent_ids );
   290 
   300 
   291 				$num_parents = count( $my_parents );
   301 				$num_parents = count( $my_parents );
   301 				$this->single_row( $term, $level );
   311 				$this->single_row( $term, $level );
   302 			}
   312 			}
   303 
   313 
   304 			++$count;
   314 			++$count;
   305 
   315 
   306 			unset( $terms[$key] );
   316 			unset( $terms[ $key ] );
   307 
   317 
   308 			if ( isset( $children[$term->term_id] ) && empty( $_REQUEST['s'] ) )
   318 			if ( isset( $children[ $term->term_id ] ) && empty( $_REQUEST['s'] ) ) {
   309 				$this->_rows( $taxonomy, $terms, $children, $start, $per_page, $count, $term->term_id, $level + 1 );
   319 				$this->_rows( $taxonomy, $terms, $children, $start, $per_page, $count, $term->term_id, $level + 1 );
       
   320 			}
   310 		}
   321 		}
   311 	}
   322 	}
   312 
   323 
   313 	/**
   324 	/**
   314 	 * @global string $taxonomy
   325 	 * @global string $taxonomy
   315 	 * @param WP_Term $tag Term object.
   326 	 * @param WP_Term $tag Term object.
   316 	 * @param int $level
   327 	 * @param int $level
   317 	 */
   328 	 */
   318 	public function single_row( $tag, $level = 0 ) {
   329 	public function single_row( $tag, $level = 0 ) {
   319 		global $taxonomy;
   330 		global $taxonomy;
   320  		$tag = sanitize_term( $tag, $taxonomy );
   331 		$tag = sanitize_term( $tag, $taxonomy );
   321 
   332 
   322 		$this->level = $level;
   333 		$this->level = $level;
   323 
   334 
   324 		echo '<tr id="tag-' . $tag->term_id . '">';
   335 		if ( $tag->parent ) {
       
   336 			$count = count( get_ancestors( $tag->term_id, $taxonomy, 'taxonomy' ) );
       
   337 			$level = 'level-' . $count;
       
   338 		} else {
       
   339 			$level = 'level-0';
       
   340 		}
       
   341 
       
   342 		echo '<tr id="tag-' . $tag->term_id . '" class="' . $level . '">';
   325 		$this->single_row_columns( $tag );
   343 		$this->single_row_columns( $tag );
   326 		echo '</tr>';
   344 		echo '</tr>';
   327 	}
   345 	}
   328 
   346 
   329 	/**
   347 	/**
   365 
   383 
   366 		$qe_data = get_term( $tag->term_id, $taxonomy, OBJECT, 'edit' );
   384 		$qe_data = get_term( $tag->term_id, $taxonomy, OBJECT, 'edit' );
   367 
   385 
   368 		$uri = wp_doing_ajax() ? wp_get_referer() : $_SERVER['REQUEST_URI'];
   386 		$uri = wp_doing_ajax() ? wp_get_referer() : $_SERVER['REQUEST_URI'];
   369 
   387 
   370 		$edit_link = add_query_arg(
   388 		$edit_link = get_edit_term_link( $tag->term_id, $taxonomy, $this->screen->post_type );
   371 			'wp_http_referer',
   389 
   372 			urlencode( wp_unslash( $uri ) ),
   390 		if ( $edit_link ) {
   373 			get_edit_term_link( $tag->term_id, $taxonomy, $this->screen->post_type )
   391 			$edit_link = add_query_arg(
   374 		);
   392 				'wp_http_referer',
       
   393 				urlencode( wp_unslash( $uri ) ),
       
   394 				$edit_link
       
   395 			);
       
   396 			$name      = sprintf(
       
   397 				'<a class="row-title" href="%s" aria-label="%s">%s</a>',
       
   398 				esc_url( $edit_link ),
       
   399 				/* translators: %s: taxonomy term name */
       
   400 				esc_attr( sprintf( __( '&#8220;%s&#8221; (Edit)' ), $tag->name ) ),
       
   401 				$name
       
   402 			);
       
   403 		}
   375 
   404 
   376 		$out = sprintf(
   405 		$out = sprintf(
   377 			'<strong><a class="row-title" href="%s" aria-label="%s">%s</a></strong><br />',
   406 			'<strong>%s</strong><br />',
   378 			esc_url( $edit_link ),
       
   379 			/* translators: %s: taxonomy term name */
       
   380 			esc_attr( sprintf( __( '&#8220;%s&#8221; (Edit)' ), $tag->name ) ),
       
   381 			$name
   407 			$name
   382 		);
   408 		);
   383 
   409 
   384 		$out .= '<div class="hidden" id="inline_' . $qe_data->term_id . '">';
   410 		$out .= '<div class="hidden" id="inline_' . $qe_data->term_id . '">';
   385 		$out .= '<div class="name">' . $qe_data->name . '</div>';
   411 		$out .= '<div class="name">' . $qe_data->name . '</div>';
   416 		if ( $primary !== $column_name ) {
   442 		if ( $primary !== $column_name ) {
   417 			return '';
   443 			return '';
   418 		}
   444 		}
   419 
   445 
   420 		$taxonomy = $this->screen->taxonomy;
   446 		$taxonomy = $this->screen->taxonomy;
   421 		$tax = get_taxonomy( $taxonomy );
   447 		$tax      = get_taxonomy( $taxonomy );
   422 		$uri = wp_doing_ajax() ? wp_get_referer() : $_SERVER['REQUEST_URI'];
   448 		$uri      = wp_doing_ajax() ? wp_get_referer() : $_SERVER['REQUEST_URI'];
   423 
   449 
   424 		$edit_link = add_query_arg(
   450 		$edit_link = add_query_arg(
   425 			'wp_http_referer',
   451 			'wp_http_referer',
   426 			urlencode( wp_unslash( $uri ) ),
   452 			urlencode( wp_unslash( $uri ) ),
   427 			get_edit_term_link( $tag->term_id, $taxonomy, $this->screen->post_type )
   453 			get_edit_term_link( $tag->term_id, $taxonomy, $this->screen->post_type )
   435 				/* translators: %s: taxonomy term name */
   461 				/* translators: %s: taxonomy term name */
   436 				esc_attr( sprintf( __( 'Edit &#8220;%s&#8221;' ), $tag->name ) ),
   462 				esc_attr( sprintf( __( 'Edit &#8220;%s&#8221;' ), $tag->name ) ),
   437 				__( 'Edit' )
   463 				__( 'Edit' )
   438 			);
   464 			);
   439 			$actions['inline hide-if-no-js'] = sprintf(
   465 			$actions['inline hide-if-no-js'] = sprintf(
   440 				'<a href="#" class="editinline aria-button-if-js" aria-label="%s">%s</a>',
   466 				'<button type="button" class="button-link editinline" aria-label="%s" aria-expanded="false">%s</button>',
   441 				/* translators: %s: taxonomy term name */
   467 				/* translators: %s: taxonomy term name */
   442 				esc_attr( sprintf( __( 'Quick edit &#8220;%s&#8221; inline' ), $tag->name ) ),
   468 				esc_attr( sprintf( __( 'Quick edit &#8220;%s&#8221; inline' ), $tag->name ) ),
   443 				__( 'Quick&nbsp;Edit' )
   469 				__( 'Quick&nbsp;Edit' )
   444 			);
   470 			);
   445 		}
   471 		}
   450 				/* translators: %s: taxonomy term name */
   476 				/* translators: %s: taxonomy term name */
   451 				esc_attr( sprintf( __( 'Delete &#8220;%s&#8221;' ), $tag->name ) ),
   477 				esc_attr( sprintf( __( 'Delete &#8220;%s&#8221;' ), $tag->name ) ),
   452 				__( 'Delete' )
   478 				__( 'Delete' )
   453 			);
   479 			);
   454 		}
   480 		}
   455 		if ( $tax->public ) {
   481 		if ( is_taxonomy_viewable( $tax ) ) {
   456 			$actions['view'] = sprintf(
   482 			$actions['view'] = sprintf(
   457 				'<a href="%s" aria-label="%s">%s</a>',
   483 				'<a href="%s" aria-label="%s">%s</a>',
   458 				get_term_link( $tag ),
   484 				get_term_link( $tag ),
   459 				/* translators: %s: taxonomy term name */
   485 				/* translators: %s: taxonomy term name */
   460 				esc_attr( sprintf( __( 'View &#8220;%s&#8221; archive' ), $tag->name ) ),
   486 				esc_attr( sprintf( __( 'View &#8220;%s&#8221; archive' ), $tag->name ) ),
   466 		 * Filters the action links displayed for each term in the Tags list table.
   492 		 * Filters the action links displayed for each term in the Tags list table.
   467 		 *
   493 		 *
   468 		 * @since 2.8.0
   494 		 * @since 2.8.0
   469 		 * @deprecated 3.0.0 Use {$taxonomy}_row_actions instead.
   495 		 * @deprecated 3.0.0 Use {$taxonomy}_row_actions instead.
   470 		 *
   496 		 *
   471 		 * @param array  $actions An array of action links to be displayed. Default
   497 		 * @param string[] $actions An array of action links to be displayed. Default
   472 		 *                        'Edit', 'Quick Edit', 'Delete', and 'View'.
   498 		 *                          'Edit', 'Quick Edit', 'Delete', and 'View'.
   473 		 * @param WP_Term $tag    Term object.
   499 		 * @param WP_Term  $tag     Term object.
   474 		 */
   500 		 */
   475 		$actions = apply_filters( 'tag_row_actions', $actions, $tag );
   501 		$actions = apply_filters( 'tag_row_actions', $actions, $tag );
   476 
   502 
   477 		/**
   503 		/**
   478 		 * Filters the action links displayed for each term in the terms list table.
   504 		 * Filters the action links displayed for each term in the terms list table.
   479 		 *
   505 		 *
   480 		 * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug.
   506 		 * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug.
   481 		 *
   507 		 *
   482 		 * @since 3.0.0
   508 		 * @since 3.0.0
   483 		 *
   509 		 *
   484 		 * @param array  $actions An array of action links to be displayed. Default
   510 		 * @param string[] $actions An array of action links to be displayed. Default
   485 		 *                        'Edit', 'Quick Edit', 'Delete', and 'View'.
   511 		 *                          'Edit', 'Quick Edit', 'Delete', and 'View'.
   486 		 * @param WP_Term $tag    Term object.
   512 		 * @param WP_Term  $tag     Term object.
   487 		 */
   513 		 */
   488 		$actions = apply_filters( "{$taxonomy}_row_actions", $actions, $tag );
   514 		$actions = apply_filters( "{$taxonomy}_row_actions", $actions, $tag );
   489 
   515 
   490 		return $this->row_actions( $actions );
   516 		return $this->row_actions( $actions );
   491 	}
   517 	}
   519 		$count = number_format_i18n( $tag->count );
   545 		$count = number_format_i18n( $tag->count );
   520 
   546 
   521 		$tax = get_taxonomy( $this->screen->taxonomy );
   547 		$tax = get_taxonomy( $this->screen->taxonomy );
   522 
   548 
   523 		$ptype_object = get_post_type_object( $this->screen->post_type );
   549 		$ptype_object = get_post_type_object( $this->screen->post_type );
   524 		if ( ! $ptype_object->show_ui )
   550 		if ( ! $ptype_object->show_ui ) {
   525 			return $count;
   551 			return $count;
       
   552 		}
   526 
   553 
   527 		if ( $tax->query_var ) {
   554 		if ( $tax->query_var ) {
   528 			$args = array( $tax->query_var => $tag->slug );
   555 			$args = array( $tax->query_var => $tag->slug );
   529 		} else {
   556 		} else {
   530 			$args = array( 'taxonomy' => $tax->name, 'term' => $tag->slug );
   557 			$args = array(
   531 		}
   558 				'taxonomy' => $tax->name,
   532 
   559 				'term'     => $tag->slug,
   533 		if ( 'post' != $this->screen->post_type )
   560 			);
       
   561 		}
       
   562 
       
   563 		if ( 'post' != $this->screen->post_type ) {
   534 			$args['post_type'] = $this->screen->post_type;
   564 			$args['post_type'] = $this->screen->post_type;
   535 
   565 		}
   536 		if ( 'attachment' === $this->screen->post_type )
   566 
   537 			return "<a href='" . esc_url ( add_query_arg( $args, 'upload.php' ) ) . "'>$count</a>";
   567 		if ( 'attachment' === $this->screen->post_type ) {
   538 
   568 			return "<a href='" . esc_url( add_query_arg( $args, 'upload.php' ) ) . "'>$count</a>";
   539 		return "<a href='" . esc_url ( add_query_arg( $args, 'edit.php' ) ) . "'>$count</a>";
   569 		}
       
   570 
       
   571 		return "<a href='" . esc_url( add_query_arg( $args, 'edit.php' ) ) . "'>$count</a>";
   540 	}
   572 	}
   541 
   573 
   542 	/**
   574 	/**
   543 	 * @param WP_Term $tag Term object.
   575 	 * @param WP_Term $tag Term object.
   544 	 * @return string
   576 	 * @return string
   545 	 */
   577 	 */
   546 	public function column_links( $tag ) {
   578 	public function column_links( $tag ) {
   547 		$count = number_format_i18n( $tag->count );
   579 		$count = number_format_i18n( $tag->count );
   548 		if ( $count )
   580 		if ( $count ) {
   549 			$count = "<a href='link-manager.php?cat_id=$tag->term_id'>$count</a>";
   581 			$count = "<a href='link-manager.php?cat_id=$tag->term_id'>$count</a>";
       
   582 		}
   550 		return $count;
   583 		return $count;
   551 	}
   584 	}
   552 
   585 
   553 	/**
   586 	/**
   554 	 * @param WP_Term $tag Term object.
   587 	 * @param WP_Term $tag Term object.
   577 	 * @since 3.1.0
   610 	 * @since 3.1.0
   578 	 */
   611 	 */
   579 	public function inline_edit() {
   612 	public function inline_edit() {
   580 		$tax = get_taxonomy( $this->screen->taxonomy );
   613 		$tax = get_taxonomy( $this->screen->taxonomy );
   581 
   614 
   582 		if ( ! current_user_can( $tax->cap->edit_terms ) )
   615 		if ( ! current_user_can( $tax->cap->edit_terms ) ) {
   583 			return;
   616 			return;
   584 ?>
   617 		}
       
   618 		?>
   585 
   619 
   586 	<form method="get"><table style="display: none"><tbody id="inlineedit">
   620 	<form method="get"><table style="display: none"><tbody id="inlineedit">
   587 		<tr id="inline-edit" class="inline-edit-row" style="display: none"><td colspan="<?php echo $this->get_column_count(); ?>" class="colspanchange">
   621 		<tr id="inline-edit" class="inline-edit-row" style="display: none"><td colspan="<?php echo $this->get_column_count(); ?>" class="colspanchange">
   588 
   622 
   589 			<fieldset>
   623 			<fieldset>
   591 				<div class="inline-edit-col">
   625 				<div class="inline-edit-col">
   592 				<label>
   626 				<label>
   593 					<span class="title"><?php _ex( 'Name', 'term name' ); ?></span>
   627 					<span class="title"><?php _ex( 'Name', 'term name' ); ?></span>
   594 					<span class="input-text-wrap"><input type="text" name="name" class="ptitle" value="" /></span>
   628 					<span class="input-text-wrap"><input type="text" name="name" class="ptitle" value="" /></span>
   595 				</label>
   629 				</label>
   596 	<?php if ( !global_terms_enabled() ) { ?>
   630 		<?php if ( ! global_terms_enabled() ) { ?>
   597 				<label>
   631 				<label>
   598 					<span class="title"><?php _e( 'Slug' ); ?></span>
   632 					<span class="title"><?php _e( 'Slug' ); ?></span>
   599 					<span class="input-text-wrap"><input type="text" name="slug" class="ptitle" value="" /></span>
   633 					<span class="input-text-wrap"><input type="text" name="slug" class="ptitle" value="" /></span>
   600 				</label>
   634 				</label>
   601 	<?php } ?>
   635 	<?php } ?>
   602 			</div></fieldset>
   636 			</div></fieldset>
   603 	<?php
   637 		<?php
   604 
   638 
   605 		$core_columns = array( 'cb' => true, 'description' => true, 'name' => true, 'slug' => true, 'posts' => true );
   639 		$core_columns = array(
       
   640 			'cb'          => true,
       
   641 			'description' => true,
       
   642 			'name'        => true,
       
   643 			'slug'        => true,
       
   644 			'posts'       => true,
       
   645 		);
   606 
   646 
   607 		list( $columns ) = $this->get_column_info();
   647 		list( $columns ) = $this->get_column_info();
   608 
   648 
   609 		foreach ( $columns as $column_name => $column_display_name ) {
   649 		foreach ( $columns as $column_name => $column_display_name ) {
   610 			if ( isset( $core_columns[$column_name] ) )
   650 			if ( isset( $core_columns[ $column_name ] ) ) {
   611 				continue;
   651 				continue;
       
   652 			}
   612 
   653 
   613 			/** This action is documented in wp-admin/includes/class-wp-posts-list-table.php */
   654 			/** This action is documented in wp-admin/includes/class-wp-posts-list-table.php */
   614 			do_action( 'quick_edit_custom_box', $column_name, 'edit-tags', $this->screen->taxonomy );
   655 			do_action( 'quick_edit_custom_box', $column_name, 'edit-tags', $this->screen->taxonomy );
   615 		}
   656 		}
   616 
   657 
   617 	?>
   658 		?>
   618 
   659 
   619 		<div class="inline-edit-save submit">
   660 		<div class="inline-edit-save submit">
   620 			<button type="button" class="cancel button alignleft"><?php _e( 'Cancel' ); ?></button>
   661 			<button type="button" class="cancel button alignleft"><?php _e( 'Cancel' ); ?></button>
   621 			<button type="button" class="save button button-primary alignright"><?php echo $tax->labels->update_item; ?></button>
   662 			<button type="button" class="save button button-primary alignright"><?php echo $tax->labels->update_item; ?></button>
   622 			<span class="spinner"></span>
   663 			<span class="spinner"></span>
   628 				<p class="error"></p>
   669 				<p class="error"></p>
   629 			</div>
   670 			</div>
   630 		</div>
   671 		</div>
   631 		</td></tr>
   672 		</td></tr>
   632 		</tbody></table></form>
   673 		</tbody></table></form>
   633 	<?php
   674 		<?php
   634 	}
   675 	}
   635 }
   676 }