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