author | ymh <ymh.work@gmail.com> |
Wed, 21 Sep 2022 18:19:35 +0200 | |
changeset 18 | be944660c56a |
parent 16 | a86126ab1dd4 |
child 19 | 3d72ae0968f4 |
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_Posts_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 posts 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_Posts_List_Table extends WP_List_Table { |
|
19 |
||
20 |
/** |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
21 |
* Whether the items should be displayed hierarchically or linearly. |
0 | 22 |
* |
23 |
* @since 3.1.0 |
|
24 |
* @var bool |
|
25 |
*/ |
|
5 | 26 |
protected $hierarchical_display; |
0 | 27 |
|
28 |
/** |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
29 |
* Holds the number of pending comments for each post. |
0 | 30 |
* |
31 |
* @since 3.1.0 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
32 |
* @var array |
0 | 33 |
*/ |
5 | 34 |
protected $comment_pending_count; |
0 | 35 |
|
36 |
/** |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
37 |
* Holds the number of posts for this user. |
0 | 38 |
* |
39 |
* @since 3.1.0 |
|
40 |
* @var int |
|
41 |
*/ |
|
5 | 42 |
private $user_posts_count; |
0 | 43 |
|
44 |
/** |
|
45 |
* Holds the number of posts which are sticky. |
|
46 |
* |
|
47 |
* @since 3.1.0 |
|
48 |
* @var int |
|
49 |
*/ |
|
5 | 50 |
private $sticky_posts_count = 0; |
51 |
||
52 |
private $is_trash; |
|
0 | 53 |
|
5 | 54 |
/** |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
55 |
* Current level for output. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
56 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
57 |
* @since 4.3.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
58 |
* @var int |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
59 |
*/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
60 |
protected $current_level = 0; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
61 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
62 |
/** |
5 | 63 |
* Constructor. |
64 |
* |
|
65 |
* @since 3.1.0 |
|
66 |
* |
|
67 |
* @see WP_List_Table::__construct() for more information on default arguments. |
|
68 |
* |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
69 |
* @global WP_Post_Type $post_type_object |
16 | 70 |
* @global wpdb $wpdb WordPress database abstraction object. |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
71 |
* |
5 | 72 |
* @param array $args An associative array of arguments. |
73 |
*/ |
|
74 |
public function __construct( $args = array() ) { |
|
0 | 75 |
global $post_type_object, $wpdb; |
76 |
||
9 | 77 |
parent::__construct( |
78 |
array( |
|
79 |
'plural' => 'posts', |
|
80 |
'screen' => isset( $args['screen'] ) ? $args['screen'] : null, |
|
81 |
) |
|
82 |
); |
|
0 | 83 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
84 |
$post_type = $this->screen->post_type; |
0 | 85 |
$post_type_object = get_post_type_object( $post_type ); |
86 |
||
18 | 87 |
$exclude_states = get_post_stati( |
9 | 88 |
array( |
89 |
'show_in_admin_all_list' => false, |
|
90 |
) |
|
91 |
); |
|
18 | 92 |
|
93 |
$this->user_posts_count = (int) $wpdb->get_var( |
|
94 |
$wpdb->prepare( |
|
95 |
"SELECT COUNT( 1 ) |
|
96 |
FROM $wpdb->posts |
|
97 |
WHERE post_type = %s |
|
98 |
AND post_status NOT IN ( '" . implode( "','", $exclude_states ) . "' ) |
|
99 |
AND post_author = %d", |
|
100 |
$post_type, |
|
101 |
get_current_user_id() |
|
9 | 102 |
) |
103 |
); |
|
0 | 104 |
|
18 | 105 |
if ( $this->user_posts_count |
106 |
&& ! current_user_can( $post_type_object->cap->edit_others_posts ) |
|
107 |
&& empty( $_REQUEST['post_status'] ) && empty( $_REQUEST['all_posts'] ) |
|
108 |
&& empty( $_REQUEST['author'] ) && empty( $_REQUEST['show_sticky'] ) |
|
109 |
) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
110 |
$_GET['author'] = get_current_user_id(); |
0 | 111 |
} |
112 |
||
16 | 113 |
$sticky_posts = get_option( 'sticky_posts' ); |
18 | 114 |
|
16 | 115 |
if ( 'post' === $post_type && $sticky_posts ) { |
18 | 116 |
$sticky_posts = implode( ', ', array_map( 'absint', (array) $sticky_posts ) ); |
117 |
||
118 |
$this->sticky_posts_count = (int) $wpdb->get_var( |
|
119 |
$wpdb->prepare( |
|
120 |
"SELECT COUNT( 1 ) |
|
121 |
FROM $wpdb->posts |
|
122 |
WHERE post_type = %s |
|
123 |
AND post_status NOT IN ('trash', 'auto-draft') |
|
124 |
AND ID IN ($sticky_posts)", |
|
125 |
$post_type |
|
126 |
) |
|
127 |
); |
|
0 | 128 |
} |
129 |
} |
|
130 |
||
5 | 131 |
/** |
132 |
* Sets whether the table layout should be hierarchical or not. |
|
133 |
* |
|
134 |
* @since 4.2.0 |
|
135 |
* |
|
136 |
* @param bool $display Whether the table layout should be hierarchical. |
|
137 |
*/ |
|
138 |
public function set_hierarchical_display( $display ) { |
|
139 |
$this->hierarchical_display = $display; |
|
140 |
} |
|
141 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
142 |
/** |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
143 |
* @return bool |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
144 |
*/ |
5 | 145 |
public function ajax_user_can() { |
0 | 146 |
return current_user_can( get_post_type_object( $this->screen->post_type )->cap->edit_posts ); |
147 |
} |
|
148 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
149 |
/** |
16 | 150 |
* @global string $mode List table view mode. |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
151 |
* @global array $avail_post_stati |
16 | 152 |
* @global WP_Query $wp_query WordPress Query object. |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
153 |
* @global int $per_page |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
154 |
*/ |
5 | 155 |
public function prepare_items() { |
16 | 156 |
global $mode, $avail_post_stati, $wp_query, $per_page; |
0 | 157 |
|
16 | 158 |
if ( ! empty( $_REQUEST['mode'] ) ) { |
159 |
$mode = 'excerpt' === $_REQUEST['mode'] ? 'excerpt' : 'list'; |
|
160 |
set_user_setting( 'posts_list_mode', $mode ); |
|
161 |
} else { |
|
162 |
$mode = get_user_setting( 'posts_list_mode', 'list' ); |
|
163 |
} |
|
164 |
||
165 |
// Is going to call wp(). |
|
0 | 166 |
$avail_post_stati = wp_edit_posts_query(); |
167 |
||
18 | 168 |
$this->set_hierarchical_display( |
169 |
is_post_type_hierarchical( $this->screen->post_type ) |
|
170 |
&& 'menu_order title' === $wp_query->query['orderby'] |
|
171 |
); |
|
0 | 172 |
|
173 |
$post_type = $this->screen->post_type; |
|
9 | 174 |
$per_page = $this->get_items_per_page( 'edit_' . $post_type . '_per_page' ); |
5 | 175 |
|
176 |
/** This filter is documented in wp-admin/includes/post.php */ |
|
9 | 177 |
$per_page = apply_filters( 'edit_posts_per_page', $per_page, $post_type ); |
0 | 178 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
179 |
if ( $this->hierarchical_display ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
180 |
$total_items = $wp_query->post_count; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
181 |
} elseif ( $wp_query->found_posts || $this->get_pagenum() === 1 ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
182 |
$total_items = $wp_query->found_posts; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
183 |
} else { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
184 |
$post_counts = (array) wp_count_posts( $post_type, 'readable' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
185 |
|
16 | 186 |
if ( isset( $_REQUEST['post_status'] ) && in_array( $_REQUEST['post_status'], $avail_post_stati, true ) ) { |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
187 |
$total_items = $post_counts[ $_REQUEST['post_status'] ]; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
188 |
} elseif ( isset( $_REQUEST['show_sticky'] ) && $_REQUEST['show_sticky'] ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
189 |
$total_items = $this->sticky_posts_count; |
18 | 190 |
} elseif ( isset( $_GET['author'] ) && get_current_user_id() === (int) $_GET['author'] ) { |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
191 |
$total_items = $this->user_posts_count; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
192 |
} else { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
193 |
$total_items = array_sum( $post_counts ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
194 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
195 |
// Subtract post types that are not included in the admin all list. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
196 |
foreach ( get_post_stati( array( 'show_in_admin_all_list' => false ) ) as $state ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
197 |
$total_items -= $post_counts[ $state ]; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
198 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
199 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
200 |
} |
0 | 201 |
|
16 | 202 |
$this->is_trash = isset( $_REQUEST['post_status'] ) && 'trash' === $_REQUEST['post_status']; |
0 | 203 |
|
9 | 204 |
$this->set_pagination_args( |
205 |
array( |
|
206 |
'total_items' => $total_items, |
|
207 |
'per_page' => $per_page, |
|
208 |
) |
|
209 |
); |
|
0 | 210 |
} |
211 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
212 |
/** |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
213 |
* @return bool |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
214 |
*/ |
5 | 215 |
public function has_items() { |
0 | 216 |
return have_posts(); |
217 |
} |
|
218 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
219 |
/** |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
220 |
*/ |
5 | 221 |
public function no_items() { |
9 | 222 |
if ( isset( $_REQUEST['post_status'] ) && 'trash' === $_REQUEST['post_status'] ) { |
0 | 223 |
echo get_post_type_object( $this->screen->post_type )->labels->not_found_in_trash; |
9 | 224 |
} else { |
0 | 225 |
echo get_post_type_object( $this->screen->post_type )->labels->not_found; |
9 | 226 |
} |
0 | 227 |
} |
228 |
||
5 | 229 |
/** |
230 |
* Determine if the current view is the "All" view. |
|
231 |
* |
|
232 |
* @since 4.2.0 |
|
233 |
* |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
234 |
* @return bool Whether the current view is the "All" view. |
5 | 235 |
*/ |
236 |
protected function is_base_request() { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
237 |
$vars = $_GET; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
238 |
unset( $vars['paged'] ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
239 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
240 |
if ( empty( $vars ) ) { |
5 | 241 |
return true; |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
242 |
} elseif ( 1 === count( $vars ) && ! empty( $vars['post_type'] ) ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
243 |
return $this->screen->post_type === $vars['post_type']; |
5 | 244 |
} |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
245 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
246 |
return 1 === count( $vars ) && ! empty( $vars['mode'] ); |
5 | 247 |
} |
248 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
249 |
/** |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
250 |
* Helper to create links to edit.php with params. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
251 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
252 |
* @since 4.4.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
253 |
* |
9 | 254 |
* @param string[] $args Associative array of URL parameters for the link. |
255 |
* @param string $label Link text. |
|
256 |
* @param string $class Optional. Class attribute. Default empty string. |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
257 |
* @return string The formatted link string. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
258 |
*/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
259 |
protected function get_edit_link( $args, $label, $class = '' ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
260 |
$url = add_query_arg( $args, 'edit.php' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
261 |
|
16 | 262 |
$class_html = ''; |
263 |
$aria_current = ''; |
|
18 | 264 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
265 |
if ( ! empty( $class ) ) { |
9 | 266 |
$class_html = sprintf( |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
267 |
' class="%s"', |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
268 |
esc_attr( $class ) |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
269 |
); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
270 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
271 |
if ( 'current' === $class ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
272 |
$aria_current = ' aria-current="page"'; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
273 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
274 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
275 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
276 |
return sprintf( |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
277 |
'<a href="%s"%s%s>%s</a>', |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
278 |
esc_url( $url ), |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
279 |
$class_html, |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
280 |
$aria_current, |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
281 |
$label |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
282 |
); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
283 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
284 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
285 |
/** |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
286 |
* @global array $locked_post_status This seems to be deprecated. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
287 |
* @global array $avail_post_stati |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
288 |
* @return array |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
289 |
*/ |
5 | 290 |
protected function get_views() { |
0 | 291 |
global $locked_post_status, $avail_post_stati; |
292 |
||
293 |
$post_type = $this->screen->post_type; |
|
294 |
||
9 | 295 |
if ( ! empty( $locked_post_status ) ) { |
0 | 296 |
return array(); |
9 | 297 |
} |
0 | 298 |
|
299 |
$status_links = array(); |
|
9 | 300 |
$num_posts = wp_count_posts( $post_type, 'readable' ); |
301 |
$total_posts = array_sum( (array) $num_posts ); |
|
302 |
$class = ''; |
|
0 | 303 |
|
304 |
$current_user_id = get_current_user_id(); |
|
9 | 305 |
$all_args = array( 'post_type' => $post_type ); |
306 |
$mine = ''; |
|
0 | 307 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
308 |
// Subtract post types that are not included in the admin all list. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
309 |
foreach ( get_post_stati( array( 'show_in_admin_all_list' => false ) ) as $state ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
310 |
$total_posts -= $num_posts->$state; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
311 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
312 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
313 |
if ( $this->user_posts_count && $this->user_posts_count !== $total_posts ) { |
18 | 314 |
if ( isset( $_GET['author'] ) && ( $current_user_id === (int) $_GET['author'] ) ) { |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
315 |
$class = 'current'; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
316 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
317 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
318 |
$mine_args = array( |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
319 |
'post_type' => $post_type, |
9 | 320 |
'author' => $current_user_id, |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
321 |
); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
322 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
323 |
$mine_inner_html = sprintf( |
16 | 324 |
/* translators: %s: Number of posts. */ |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
325 |
_nx( |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
326 |
'Mine <span class="count">(%s)</span>', |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
327 |
'Mine <span class="count">(%s)</span>', |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
328 |
$this->user_posts_count, |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
329 |
'posts' |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
330 |
), |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
331 |
number_format_i18n( $this->user_posts_count ) |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
332 |
); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
333 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
334 |
$mine = $this->get_edit_link( $mine_args, $mine_inner_html, $class ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
335 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
336 |
$all_args['all_posts'] = 1; |
9 | 337 |
$class = ''; |
0 | 338 |
} |
339 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
340 |
if ( empty( $class ) && ( $this->is_base_request() || isset( $_REQUEST['all_posts'] ) ) ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
341 |
$class = 'current'; |
5 | 342 |
} |
343 |
||
344 |
$all_inner_html = sprintf( |
|
16 | 345 |
/* translators: %s: Number of posts. */ |
5 | 346 |
_nx( |
347 |
'All <span class="count">(%s)</span>', |
|
348 |
'All <span class="count">(%s)</span>', |
|
349 |
$total_posts, |
|
350 |
'posts' |
|
351 |
), |
|
352 |
number_format_i18n( $total_posts ) |
|
353 |
); |
|
354 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
355 |
$status_links['all'] = $this->get_edit_link( $all_args, $all_inner_html, $class ); |
18 | 356 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
357 |
if ( $mine ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
358 |
$status_links['mine'] = $mine; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
359 |
} |
0 | 360 |
|
9 | 361 |
foreach ( get_post_stati( array( 'show_in_admin_status_list' => true ), 'objects' ) as $status ) { |
0 | 362 |
$class = ''; |
363 |
||
364 |
$status_name = $status->name; |
|
365 |
||
16 | 366 |
if ( ! in_array( $status_name, $avail_post_stati, true ) || empty( $num_posts->$status_name ) ) { |
0 | 367 |
continue; |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
368 |
} |
0 | 369 |
|
9 | 370 |
if ( isset( $_REQUEST['post_status'] ) && $status_name === $_REQUEST['post_status'] ) { |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
371 |
$class = 'current'; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
372 |
} |
0 | 373 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
374 |
$status_args = array( |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
375 |
'post_status' => $status_name, |
9 | 376 |
'post_type' => $post_type, |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
377 |
); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
378 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
379 |
$status_label = sprintf( |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
380 |
translate_nooped_plural( $status->label_count, $num_posts->$status_name ), |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
381 |
number_format_i18n( $num_posts->$status_name ) |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
382 |
); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
383 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
384 |
$status_links[ $status_name ] = $this->get_edit_link( $status_args, $status_label, $class ); |
0 | 385 |
} |
386 |
||
387 |
if ( ! empty( $this->sticky_posts_count ) ) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
388 |
$class = ! empty( $_REQUEST['show_sticky'] ) ? 'current' : ''; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
389 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
390 |
$sticky_args = array( |
9 | 391 |
'post_type' => $post_type, |
392 |
'show_sticky' => 1, |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
393 |
); |
0 | 394 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
395 |
$sticky_inner_html = sprintf( |
16 | 396 |
/* translators: %s: Number of posts. */ |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
397 |
_nx( |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
398 |
'Sticky <span class="count">(%s)</span>', |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
399 |
'Sticky <span class="count">(%s)</span>', |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
400 |
$this->sticky_posts_count, |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
401 |
'posts' |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
402 |
), |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
403 |
number_format_i18n( $this->sticky_posts_count ) |
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 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
406 |
$sticky_link = array( |
9 | 407 |
'sticky' => $this->get_edit_link( $sticky_args, $sticky_inner_html, $class ), |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
408 |
); |
0 | 409 |
|
410 |
// Sticky comes after Publish, or if not listed, after All. |
|
16 | 411 |
$split = 1 + array_search( ( isset( $status_links['publish'] ) ? 'publish' : 'all' ), array_keys( $status_links ), true ); |
0 | 412 |
$status_links = array_merge( array_slice( $status_links, 0, $split ), $sticky_link, array_slice( $status_links, $split ) ); |
413 |
} |
|
414 |
||
415 |
return $status_links; |
|
416 |
} |
|
417 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
418 |
/** |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
419 |
* @return array |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
420 |
*/ |
5 | 421 |
protected function get_bulk_actions() { |
9 | 422 |
$actions = array(); |
5 | 423 |
$post_type_obj = get_post_type_object( $this->screen->post_type ); |
0 | 424 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
425 |
if ( current_user_can( $post_type_obj->cap->edit_posts ) ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
426 |
if ( $this->is_trash ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
427 |
$actions['untrash'] = __( 'Restore' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
428 |
} else { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
429 |
$actions['edit'] = __( 'Edit' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
430 |
} |
5 | 431 |
} |
0 | 432 |
|
5 | 433 |
if ( current_user_can( $post_type_obj->cap->delete_posts ) ) { |
434 |
if ( $this->is_trash || ! EMPTY_TRASH_DAYS ) { |
|
16 | 435 |
$actions['delete'] = __( 'Delete permanently' ); |
5 | 436 |
} else { |
437 |
$actions['trash'] = __( 'Move to Trash' ); |
|
438 |
} |
|
439 |
} |
|
0 | 440 |
|
441 |
return $actions; |
|
442 |
} |
|
443 |
||
5 | 444 |
/** |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
445 |
* Displays a categories drop-down for filtering on the Posts list table. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
446 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
447 |
* @since 4.6.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
448 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
449 |
* @global int $cat Currently selected category. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
450 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
451 |
* @param string $post_type Post type slug. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
452 |
*/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
453 |
protected function categories_dropdown( $post_type ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
454 |
global $cat; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
455 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
456 |
/** |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
457 |
* Filters whether to remove the 'Categories' drop-down from the post list table. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
458 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
459 |
* @since 4.6.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
460 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
461 |
* @param bool $disable Whether to disable the categories drop-down. Default false. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
462 |
* @param string $post_type Post type slug. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
463 |
*/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
464 |
if ( false !== apply_filters( 'disable_categories_dropdown', false, $post_type ) ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
465 |
return; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
466 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
467 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
468 |
if ( is_object_in_taxonomy( $post_type, 'category' ) ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
469 |
$dropdown_options = array( |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
470 |
'show_option_all' => get_taxonomy( 'category' )->labels->all_items, |
9 | 471 |
'hide_empty' => 0, |
472 |
'hierarchical' => 1, |
|
473 |
'show_count' => 0, |
|
474 |
'orderby' => 'name', |
|
475 |
'selected' => $cat, |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
476 |
); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
477 |
|
18 | 478 |
echo '<label class="screen-reader-text" for="cat">' . get_taxonomy( 'category' )->labels->filter_by_item . '</label>'; |
479 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
480 |
wp_dropdown_categories( $dropdown_options ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
481 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
482 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
483 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
484 |
/** |
9 | 485 |
* Displays a formats drop-down for filtering items. |
486 |
* |
|
487 |
* @since 5.2.0 |
|
488 |
* @access protected |
|
489 |
* |
|
16 | 490 |
* @param string $post_type Post type slug. |
9 | 491 |
*/ |
492 |
protected function formats_dropdown( $post_type ) { |
|
493 |
/** |
|
494 |
* Filters whether to remove the 'Formats' drop-down from the post list table. |
|
495 |
* |
|
496 |
* @since 5.2.0 |
|
16 | 497 |
* @since 5.5.0 The `$post_type` parameter was added. |
9 | 498 |
* |
16 | 499 |
* @param bool $disable Whether to disable the drop-down. Default false. |
500 |
* @param string $post_type Post type slug. |
|
9 | 501 |
*/ |
16 | 502 |
if ( apply_filters( 'disable_formats_dropdown', false, $post_type ) ) { |
503 |
return; |
|
504 |
} |
|
505 |
||
506 |
// Return if the post type doesn't have post formats or if we're in the Trash. |
|
507 |
if ( ! is_object_in_taxonomy( $post_type, 'post_format' ) || $this->is_trash ) { |
|
9 | 508 |
return; |
509 |
} |
|
510 |
||
511 |
// Make sure the dropdown shows only formats with a post count greater than 0. |
|
512 |
$used_post_formats = get_terms( |
|
513 |
array( |
|
514 |
'taxonomy' => 'post_format', |
|
515 |
'hide_empty' => true, |
|
516 |
) |
|
517 |
); |
|
518 |
||
16 | 519 |
// Return if there are no posts using formats. |
520 |
if ( ! $used_post_formats ) { |
|
9 | 521 |
return; |
522 |
} |
|
523 |
||
524 |
$displayed_post_format = isset( $_GET['post_format'] ) ? $_GET['post_format'] : ''; |
|
525 |
?> |
|
526 |
<label for="filter-by-format" class="screen-reader-text"><?php _e( 'Filter by post format' ); ?></label> |
|
527 |
<select name="post_format" id="filter-by-format"> |
|
528 |
<option<?php selected( $displayed_post_format, '' ); ?> value=""><?php _e( 'All formats' ); ?></option> |
|
529 |
<?php |
|
530 |
foreach ( $used_post_formats as $used_post_format ) { |
|
531 |
// Post format slug. |
|
532 |
$slug = str_replace( 'post-format-', '', $used_post_format->slug ); |
|
533 |
// Pretty, translated version of the post format slug. |
|
534 |
$pretty_name = get_post_format_string( $slug ); |
|
18 | 535 |
|
9 | 536 |
// Skip the standard post format. |
537 |
if ( 'standard' === $slug ) { |
|
538 |
continue; |
|
539 |
} |
|
540 |
?> |
|
541 |
<option<?php selected( $displayed_post_format, $slug ); ?> value="<?php echo esc_attr( $slug ); ?>"><?php echo esc_html( $pretty_name ); ?></option> |
|
542 |
<?php |
|
543 |
} |
|
544 |
?> |
|
545 |
</select> |
|
546 |
<?php |
|
547 |
} |
|
548 |
||
549 |
/** |
|
5 | 550 |
* @param string $which |
551 |
*/ |
|
552 |
protected function extra_tablenav( $which ) { |
|
9 | 553 |
?> |
0 | 554 |
<div class="alignleft actions"> |
9 | 555 |
<?php |
16 | 556 |
if ( 'top' === $which ) { |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
557 |
ob_start(); |
0 | 558 |
|
559 |
$this->months_dropdown( $this->screen->post_type ); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
560 |
$this->categories_dropdown( $this->screen->post_type ); |
9 | 561 |
$this->formats_dropdown( $this->screen->post_type ); |
5 | 562 |
|
563 |
/** |
|
564 |
* Fires before the Filter button on the Posts and Pages list tables. |
|
565 |
* |
|
566 |
* The Filter button allows sorting by date and/or category on the |
|
567 |
* Posts list table, and sorting by date on the Pages list table. |
|
568 |
* |
|
569 |
* @since 2.1.0 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
570 |
* @since 4.4.0 The `$post_type` parameter was added. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
571 |
* @since 4.6.0 The `$which` parameter was added. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
572 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
573 |
* @param string $post_type The post type slug. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
574 |
* @param string $which The location of the extra table nav markup: |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
575 |
* 'top' or 'bottom' for WP_Posts_List_Table, |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
576 |
* 'bar' for WP_Media_List_Table. |
5 | 577 |
*/ |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
578 |
do_action( 'restrict_manage_posts', $this->screen->post_type, $which ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
579 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
580 |
$output = ob_get_clean(); |
5 | 581 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
582 |
if ( ! empty( $output ) ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
583 |
echo $output; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
584 |
submit_button( __( 'Filter' ), '', 'filter_action', false, array( 'id' => 'post-query-submit' ) ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
585 |
} |
0 | 586 |
} |
587 |
||
18 | 588 |
if ( $this->is_trash && $this->has_items() |
589 |
&& current_user_can( get_post_type_object( $this->screen->post_type )->cap->edit_others_posts ) |
|
590 |
) { |
|
0 | 591 |
submit_button( __( 'Empty Trash' ), 'apply', 'delete_all', false ); |
592 |
} |
|
9 | 593 |
?> |
0 | 594 |
</div> |
9 | 595 |
<?php |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
596 |
/** |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
597 |
* Fires immediately following the closing "actions" div in the tablenav for the posts |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
598 |
* list table. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
599 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
600 |
* @since 4.4.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
601 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
602 |
* @param string $which The location of the extra table nav markup: 'top' or 'bottom'. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
603 |
*/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
604 |
do_action( 'manage_posts_extra_tablenav', $which ); |
0 | 605 |
} |
606 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
607 |
/** |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
608 |
* @return string |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
609 |
*/ |
5 | 610 |
public function current_action() { |
9 | 611 |
if ( isset( $_REQUEST['delete_all'] ) || isset( $_REQUEST['delete_all2'] ) ) { |
0 | 612 |
return 'delete_all'; |
9 | 613 |
} |
0 | 614 |
|
615 |
return parent::current_action(); |
|
616 |
} |
|
617 |
||
5 | 618 |
/** |
16 | 619 |
* @global string $mode List table view mode. |
620 |
* |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
621 |
* @return array |
5 | 622 |
*/ |
623 |
protected function get_table_classes() { |
|
16 | 624 |
global $mode; |
625 |
||
626 |
$mode_class = esc_attr( 'table-view-' . $mode ); |
|
627 |
||
18 | 628 |
return array( |
629 |
'widefat', |
|
630 |
'fixed', |
|
631 |
'striped', |
|
632 |
$mode_class, |
|
633 |
is_post_type_hierarchical( $this->screen->post_type ) ? 'pages' : 'posts', |
|
634 |
); |
|
0 | 635 |
} |
636 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
637 |
/** |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
638 |
* @return array |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
639 |
*/ |
5 | 640 |
public function get_columns() { |
0 | 641 |
$post_type = $this->screen->post_type; |
642 |
||
643 |
$posts_columns = array(); |
|
644 |
||
645 |
$posts_columns['cb'] = '<input type="checkbox" />'; |
|
646 |
||
16 | 647 |
/* translators: Posts screen column name. */ |
0 | 648 |
$posts_columns['title'] = _x( 'Title', 'column name' ); |
649 |
||
5 | 650 |
if ( post_type_supports( $post_type, 'author' ) ) { |
0 | 651 |
$posts_columns['author'] = __( 'Author' ); |
5 | 652 |
} |
0 | 653 |
|
654 |
$taxonomies = get_object_taxonomies( $post_type, 'objects' ); |
|
655 |
$taxonomies = wp_filter_object_list( $taxonomies, array( 'show_admin_column' => true ), 'and', 'name' ); |
|
656 |
||
5 | 657 |
/** |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
658 |
* Filters the taxonomy columns in the Posts list table. |
5 | 659 |
* |
660 |
* The dynamic portion of the hook name, `$post_type`, refers to the post |
|
661 |
* type slug. |
|
662 |
* |
|
18 | 663 |
* Possible hook names include: |
664 |
* |
|
665 |
* - `manage_taxonomies_for_post_columns` |
|
666 |
* - `manage_taxonomies_for_page_columns` |
|
667 |
* |
|
5 | 668 |
* @since 3.5.0 |
669 |
* |
|
9 | 670 |
* @param string[] $taxonomies Array of taxonomy names to show columns for. |
671 |
* @param string $post_type The post type. |
|
5 | 672 |
*/ |
0 | 673 |
$taxonomies = apply_filters( "manage_taxonomies_for_{$post_type}_columns", $taxonomies, $post_type ); |
674 |
$taxonomies = array_filter( $taxonomies, 'taxonomy_exists' ); |
|
675 |
||
676 |
foreach ( $taxonomies as $taxonomy ) { |
|
9 | 677 |
if ( 'category' === $taxonomy ) { |
0 | 678 |
$column_key = 'categories'; |
9 | 679 |
} elseif ( 'post_tag' === $taxonomy ) { |
0 | 680 |
$column_key = 'tags'; |
9 | 681 |
} else { |
0 | 682 |
$column_key = 'taxonomy-' . $taxonomy; |
9 | 683 |
} |
0 | 684 |
|
685 |
$posts_columns[ $column_key ] = get_taxonomy( $taxonomy )->labels->name; |
|
686 |
} |
|
687 |
||
9 | 688 |
$post_status = ! empty( $_REQUEST['post_status'] ) ? $_REQUEST['post_status'] : 'all'; |
18 | 689 |
|
690 |
if ( post_type_supports( $post_type, 'comments' ) |
|
691 |
&& ! in_array( $post_status, array( 'pending', 'draft', 'future' ), true ) |
|
692 |
) { |
|
693 |
$posts_columns['comments'] = sprintf( |
|
694 |
'<span class="vers comment-grey-bubble" title="%1$s"><span class="screen-reader-text">%2$s</span></span>', |
|
695 |
esc_attr__( 'Comments' ), |
|
696 |
__( 'Comments' ) |
|
697 |
); |
|
9 | 698 |
} |
0 | 699 |
|
700 |
$posts_columns['date'] = __( 'Date' ); |
|
701 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
702 |
if ( 'page' === $post_type ) { |
5 | 703 |
|
704 |
/** |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
705 |
* Filters the columns displayed in the Pages list table. |
5 | 706 |
* |
707 |
* @since 2.5.0 |
|
708 |
* |
|
9 | 709 |
* @param string[] $post_columns An associative array of column headings. |
5 | 710 |
*/ |
0 | 711 |
$posts_columns = apply_filters( 'manage_pages_columns', $posts_columns ); |
5 | 712 |
} else { |
713 |
||
714 |
/** |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
715 |
* Filters the columns displayed in the Posts list table. |
5 | 716 |
* |
717 |
* @since 1.5.0 |
|
718 |
* |
|
9 | 719 |
* @param string[] $post_columns An associative array of column headings. |
720 |
* @param string $post_type The post type slug. |
|
5 | 721 |
*/ |
0 | 722 |
$posts_columns = apply_filters( 'manage_posts_columns', $posts_columns, $post_type ); |
5 | 723 |
} |
724 |
||
725 |
/** |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
726 |
* Filters the columns displayed in the Posts list table for a specific post type. |
5 | 727 |
* |
728 |
* The dynamic portion of the hook name, `$post_type`, refers to the post type slug. |
|
729 |
* |
|
18 | 730 |
* Possible hook names include: |
731 |
* |
|
732 |
* - `manage_post_posts_columns` |
|
733 |
* - `manage_page_posts_columns` |
|
734 |
* |
|
5 | 735 |
* @since 3.0.0 |
736 |
* |
|
9 | 737 |
* @param string[] $post_columns An associative array of column headings. |
5 | 738 |
*/ |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
739 |
return apply_filters( "manage_{$post_type}_posts_columns", $posts_columns ); |
0 | 740 |
} |
741 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
742 |
/** |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
743 |
* @return array |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
744 |
*/ |
5 | 745 |
protected function get_sortable_columns() { |
0 | 746 |
return array( |
747 |
'title' => 'title', |
|
748 |
'parent' => 'parent', |
|
749 |
'comments' => 'comment_count', |
|
9 | 750 |
'date' => array( 'date', true ), |
0 | 751 |
); |
752 |
} |
|
753 |
||
5 | 754 |
/** |
16 | 755 |
* @global WP_Query $wp_query WordPress Query object. |
5 | 756 |
* @global int $per_page |
757 |
* @param array $posts |
|
16 | 758 |
* @param int $level |
5 | 759 |
*/ |
760 |
public function display_rows( $posts = array(), $level = 0 ) { |
|
0 | 761 |
global $wp_query, $per_page; |
762 |
||
9 | 763 |
if ( empty( $posts ) ) { |
0 | 764 |
$posts = $wp_query->posts; |
9 | 765 |
} |
0 | 766 |
|
767 |
add_filter( 'the_title', 'esc_html' ); |
|
768 |
||
769 |
if ( $this->hierarchical_display ) { |
|
770 |
$this->_display_rows_hierarchical( $posts, $this->get_pagenum(), $per_page ); |
|
771 |
} else { |
|
772 |
$this->_display_rows( $posts, $level ); |
|
773 |
} |
|
774 |
} |
|
775 |
||
5 | 776 |
/** |
777 |
* @param array $posts |
|
16 | 778 |
* @param int $level |
5 | 779 |
*/ |
780 |
private function _display_rows( $posts, $level = 0 ) { |
|
9 | 781 |
$post_type = $this->screen->post_type; |
782 |
||
0 | 783 |
// Create array of post IDs. |
784 |
$post_ids = array(); |
|
785 |
||
9 | 786 |
foreach ( $posts as $a_post ) { |
0 | 787 |
$post_ids[] = $a_post->ID; |
9 | 788 |
} |
0 | 789 |
|
9 | 790 |
if ( post_type_supports( $post_type, 'comments' ) ) { |
791 |
$this->comment_pending_count = get_pending_comments_num( $post_ids ); |
|
792 |
} |
|
0 | 793 |
|
9 | 794 |
foreach ( $posts as $post ) { |
0 | 795 |
$this->single_row( $post, $level ); |
9 | 796 |
} |
0 | 797 |
} |
798 |
||
5 | 799 |
/** |
16 | 800 |
* @global wpdb $wpdb WordPress database abstraction object. |
801 |
* @global WP_Post $post Global post object. |
|
5 | 802 |
* @param array $pages |
16 | 803 |
* @param int $pagenum |
804 |
* @param int $per_page |
|
5 | 805 |
*/ |
806 |
private function _display_rows_hierarchical( $pages, $pagenum = 1, $per_page = 20 ) { |
|
0 | 807 |
global $wpdb; |
808 |
||
809 |
$level = 0; |
|
810 |
||
811 |
if ( ! $pages ) { |
|
812 |
$pages = get_pages( array( 'sort_column' => 'menu_order' ) ); |
|
813 |
||
9 | 814 |
if ( ! $pages ) { |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
815 |
return; |
9 | 816 |
} |
0 | 817 |
} |
818 |
||
819 |
/* |
|
5 | 820 |
* Arrange pages into two parts: top level pages and children_pages |
0 | 821 |
* children_pages is two dimensional array, eg. |
822 |
* children_pages[10][] contains all sub-pages whose parent is 10. |
|
823 |
* It only takes O( N ) to arrange this and it takes O( 1 ) for subsequent lookup operations |
|
824 |
* If searching, ignore hierarchy and treat everything as top level |
|
825 |
*/ |
|
826 |
if ( empty( $_REQUEST['s'] ) ) { |
|
827 |
$top_level_pages = array(); |
|
9 | 828 |
$children_pages = array(); |
0 | 829 |
|
830 |
foreach ( $pages as $page ) { |
|
5 | 831 |
// Catch and repair bad pages. |
18 | 832 |
if ( $page->post_parent === $page->ID ) { |
0 | 833 |
$page->post_parent = 0; |
834 |
$wpdb->update( $wpdb->posts, array( 'post_parent' => 0 ), array( 'ID' => $page->ID ) ); |
|
835 |
clean_post_cache( $page ); |
|
836 |
} |
|
837 |
||
18 | 838 |
if ( $page->post_parent > 0 ) { |
839 |
$children_pages[ $page->post_parent ][] = $page; |
|
840 |
} else { |
|
0 | 841 |
$top_level_pages[] = $page; |
9 | 842 |
} |
0 | 843 |
} |
844 |
||
845 |
$pages = &$top_level_pages; |
|
846 |
} |
|
847 |
||
9 | 848 |
$count = 0; |
849 |
$start = ( $pagenum - 1 ) * $per_page; |
|
850 |
$end = $start + $per_page; |
|
5 | 851 |
$to_display = array(); |
0 | 852 |
|
853 |
foreach ( $pages as $page ) { |
|
9 | 854 |
if ( $count >= $end ) { |
0 | 855 |
break; |
9 | 856 |
} |
0 | 857 |
|
858 |
if ( $count >= $start ) { |
|
9 | 859 |
$to_display[ $page->ID ] = $level; |
0 | 860 |
} |
861 |
||
862 |
$count++; |
|
863 |
||
9 | 864 |
if ( isset( $children_pages ) ) { |
5 | 865 |
$this->_page_rows( $children_pages, $count, $page->ID, $level + 1, $pagenum, $per_page, $to_display ); |
9 | 866 |
} |
0 | 867 |
} |
868 |
||
5 | 869 |
// If it is the last pagenum and there are orphaned pages, display them with paging as well. |
9 | 870 |
if ( isset( $children_pages ) && $count < $end ) { |
871 |
foreach ( $children_pages as $orphans ) { |
|
0 | 872 |
foreach ( $orphans as $op ) { |
9 | 873 |
if ( $count >= $end ) { |
0 | 874 |
break; |
9 | 875 |
} |
0 | 876 |
|
877 |
if ( $count >= $start ) { |
|
9 | 878 |
$to_display[ $op->ID ] = 0; |
0 | 879 |
} |
880 |
||
881 |
$count++; |
|
882 |
} |
|
883 |
} |
|
884 |
} |
|
5 | 885 |
|
886 |
$ids = array_keys( $to_display ); |
|
887 |
_prime_post_caches( $ids ); |
|
888 |
||
889 |
if ( ! isset( $GLOBALS['post'] ) ) { |
|
890 |
$GLOBALS['post'] = reset( $ids ); |
|
891 |
} |
|
892 |
||
893 |
foreach ( $to_display as $page_id => $level ) { |
|
894 |
echo "\t"; |
|
895 |
$this->single_row( $page_id, $level ); |
|
896 |
} |
|
0 | 897 |
} |
898 |
||
899 |
/** |
|
900 |
* Given a top level page ID, display the nested hierarchy of sub-pages |
|
901 |
* together with paging support |
|
902 |
* |
|
903 |
* @since 3.1.0 (Standalone function exists since 2.6.0) |
|
5 | 904 |
* @since 4.2.0 Added the `$to_display` parameter. |
0 | 905 |
* |
906 |
* @param array $children_pages |
|
16 | 907 |
* @param int $count |
908 |
* @param int $parent |
|
909 |
* @param int $level |
|
910 |
* @param int $pagenum |
|
911 |
* @param int $per_page |
|
5 | 912 |
* @param array $to_display List of pages to be displayed. Passed by reference. |
0 | 913 |
*/ |
5 | 914 |
private function _page_rows( &$children_pages, &$count, $parent, $level, $pagenum, $per_page, &$to_display ) { |
9 | 915 |
if ( ! isset( $children_pages[ $parent ] ) ) { |
0 | 916 |
return; |
9 | 917 |
} |
0 | 918 |
|
919 |
$start = ( $pagenum - 1 ) * $per_page; |
|
9 | 920 |
$end = $start + $per_page; |
0 | 921 |
|
9 | 922 |
foreach ( $children_pages[ $parent ] as $page ) { |
923 |
if ( $count >= $end ) { |
|
0 | 924 |
break; |
9 | 925 |
} |
0 | 926 |
|
927 |
// If the page starts in a subtree, print the parents. |
|
18 | 928 |
if ( $count === $start && $page->post_parent > 0 ) { |
0 | 929 |
$my_parents = array(); |
9 | 930 |
$my_parent = $page->post_parent; |
18 | 931 |
|
0 | 932 |
while ( $my_parent ) { |
16 | 933 |
// Get the ID from the list or the attribute if my_parent is an object. |
5 | 934 |
$parent_id = $my_parent; |
18 | 935 |
|
5 | 936 |
if ( is_object( $my_parent ) ) { |
937 |
$parent_id = $my_parent->ID; |
|
938 |
} |
|
939 |
||
9 | 940 |
$my_parent = get_post( $parent_id ); |
0 | 941 |
$my_parents[] = $my_parent; |
18 | 942 |
|
9 | 943 |
if ( ! $my_parent->post_parent ) { |
0 | 944 |
break; |
9 | 945 |
} |
18 | 946 |
|
0 | 947 |
$my_parent = $my_parent->post_parent; |
948 |
} |
|
18 | 949 |
|
0 | 950 |
$num_parents = count( $my_parents ); |
18 | 951 |
|
0 | 952 |
while ( $my_parent = array_pop( $my_parents ) ) { |
9 | 953 |
$to_display[ $my_parent->ID ] = $level - $num_parents; |
0 | 954 |
$num_parents--; |
955 |
} |
|
956 |
} |
|
957 |
||
958 |
if ( $count >= $start ) { |
|
9 | 959 |
$to_display[ $page->ID ] = $level; |
0 | 960 |
} |
961 |
||
962 |
$count++; |
|
963 |
||
5 | 964 |
$this->_page_rows( $children_pages, $count, $page->ID, $level + 1, $pagenum, $per_page, $to_display ); |
0 | 965 |
} |
966 |
||
16 | 967 |
unset( $children_pages[ $parent ] ); // Required in order to keep track of orphans. |
0 | 968 |
} |
969 |
||
5 | 970 |
/** |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
971 |
* Handles the checkbox column output. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
972 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
973 |
* @since 4.3.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
974 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
975 |
* @param WP_Post $post The current WP_Post object. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
976 |
*/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
977 |
public function column_cb( $post ) { |
18 | 978 |
$show = current_user_can( 'edit_post', $post->ID ); |
979 |
||
980 |
/** |
|
981 |
* Filters whether to show the bulk edit checkbox for a post in its list table. |
|
982 |
* |
|
983 |
* By default the checkbox is only shown if the current user can edit the post. |
|
984 |
* |
|
985 |
* @since 5.7.0 |
|
986 |
* |
|
987 |
* @param bool $show Whether to show the checkbox. |
|
988 |
* @param WP_Post $post The current WP_Post object. |
|
989 |
*/ |
|
990 |
if ( apply_filters( 'wp_list_table_show_post_checkbox', $show, $post ) ) : |
|
9 | 991 |
?> |
992 |
<label class="screen-reader-text" for="cb-select-<?php the_ID(); ?>"> |
|
16 | 993 |
<?php |
994 |
/* translators: %s: Post title. */ |
|
995 |
printf( __( 'Select %s' ), _draft_or_post_title() ); |
|
996 |
?> |
|
9 | 997 |
</label> |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
998 |
<input id="cb-select-<?php the_ID(); ?>" type="checkbox" name="post[]" value="<?php the_ID(); ?>" /> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
999 |
<div class="locked-indicator"> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1000 |
<span class="locked-indicator-icon" aria-hidden="true"></span> |
9 | 1001 |
<span class="screen-reader-text"> |
1002 |
<?php |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1003 |
printf( |
16 | 1004 |
/* translators: %s: Post title. */ |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1005 |
__( '“%s” is locked' ), |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1006 |
_draft_or_post_title() |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1007 |
); |
9 | 1008 |
?> |
1009 |
</span> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1010 |
</div> |
9 | 1011 |
<?php |
1012 |
endif; |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1013 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1014 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1015 |
/** |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1016 |
* @since 4.3.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1017 |
* |
5 | 1018 |
* @param WP_Post $post |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1019 |
* @param string $classes |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1020 |
* @param string $data |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1021 |
* @param string $primary |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1022 |
*/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1023 |
protected function _column_title( $post, $classes, $data, $primary ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1024 |
echo '<td class="' . $classes . ' page-title" ', $data, '>'; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1025 |
echo $this->column_title( $post ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1026 |
echo $this->handle_row_actions( $post, 'title', $primary ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1027 |
echo '</td>'; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1028 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1029 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1030 |
/** |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1031 |
* Handles the title column output. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1032 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1033 |
* @since 4.3.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1034 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1035 |
* @global string $mode List table view mode. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1036 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1037 |
* @param WP_Post $post The current WP_Post object. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1038 |
*/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1039 |
public function column_title( $post ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1040 |
global $mode; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1041 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1042 |
if ( $this->hierarchical_display ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1043 |
if ( 0 === $this->current_level && (int) $post->post_parent > 0 ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1044 |
// Sent level 0 by accident, by default, or because we don't know the actual level. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1045 |
$find_main_page = (int) $post->post_parent; |
18 | 1046 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1047 |
while ( $find_main_page > 0 ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1048 |
$parent = get_post( $find_main_page ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1049 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1050 |
if ( is_null( $parent ) ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1051 |
break; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1052 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1053 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1054 |
$this->current_level++; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1055 |
$find_main_page = (int) $parent->post_parent; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1056 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1057 |
if ( ! isset( $parent_name ) ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1058 |
/** This filter is documented in wp-includes/post-template.php */ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1059 |
$parent_name = apply_filters( 'the_title', $parent->post_title, $parent->ID ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1060 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1061 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1062 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1063 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1064 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1065 |
$can_edit_post = current_user_can( 'edit_post', $post->ID ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1066 |
|
16 | 1067 |
if ( $can_edit_post && 'trash' !== $post->post_status ) { |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1068 |
$lock_holder = wp_check_post_lock( $post->ID ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1069 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1070 |
if ( $lock_holder ) { |
9 | 1071 |
$lock_holder = get_userdata( $lock_holder ); |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1072 |
$locked_avatar = get_avatar( $lock_holder->ID, 18 ); |
16 | 1073 |
/* translators: %s: User's display name. */ |
1074 |
$locked_text = esc_html( sprintf( __( '%s is currently editing' ), $lock_holder->display_name ) ); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1075 |
} else { |
16 | 1076 |
$locked_avatar = ''; |
1077 |
$locked_text = ''; |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1078 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1079 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1080 |
echo '<div class="locked-info"><span class="locked-avatar">' . $locked_avatar . '</span> <span class="locked-text">' . $locked_text . "</span></div>\n"; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1081 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1082 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1083 |
$pad = str_repeat( '— ', $this->current_level ); |
9 | 1084 |
echo '<strong>'; |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1085 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1086 |
$title = _draft_or_post_title(); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1087 |
|
16 | 1088 |
if ( $can_edit_post && 'trash' !== $post->post_status ) { |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1089 |
printf( |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1090 |
'<a class="row-title" href="%s" aria-label="%s">%s%s</a>', |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1091 |
get_edit_post_link( $post->ID ), |
16 | 1092 |
/* translators: %s: Post title. */ |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1093 |
esc_attr( sprintf( __( '“%s” (Edit)' ), $title ) ), |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1094 |
$pad, |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1095 |
$title |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1096 |
); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1097 |
} else { |
9 | 1098 |
printf( |
1099 |
'<span>%s%s</span>', |
|
1100 |
$pad, |
|
1101 |
$title |
|
1102 |
); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1103 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1104 |
_post_states( $post ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1105 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1106 |
if ( isset( $parent_name ) ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1107 |
$post_type_object = get_post_type_object( $post->post_type ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1108 |
echo ' | ' . $post_type_object->labels->parent_item_colon . ' ' . esc_html( $parent_name ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1109 |
} |
18 | 1110 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1111 |
echo "</strong>\n"; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1112 |
|
16 | 1113 |
if ( 'excerpt' === $mode |
1114 |
&& ! is_post_type_hierarchical( $this->screen->post_type ) |
|
1115 |
&& current_user_can( 'read_post', $post->ID ) |
|
1116 |
) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1117 |
if ( post_password_required( $post ) ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1118 |
echo '<span class="protected-post-excerpt">' . esc_html( get_the_excerpt() ) . '</span>'; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1119 |
} else { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1120 |
echo esc_html( get_the_excerpt() ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1121 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1122 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1123 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1124 |
get_inline_data( $post ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1125 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1126 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1127 |
/** |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1128 |
* Handles the post date column output. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1129 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1130 |
* @since 4.3.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1131 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1132 |
* @global string $mode List table view mode. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1133 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1134 |
* @param WP_Post $post The current WP_Post object. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1135 |
*/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1136 |
public function column_date( $post ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1137 |
global $mode; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1138 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1139 |
if ( '0000-00-00 00:00:00' === $post->post_date ) { |
16 | 1140 |
$t_time = __( 'Unpublished' ); |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1141 |
$time_diff = 0; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1142 |
} else { |
16 | 1143 |
$t_time = sprintf( |
1144 |
/* translators: 1: Post date, 2: Post time. */ |
|
1145 |
__( '%1$s at %2$s' ), |
|
18 | 1146 |
/* translators: Post date format. See https://www.php.net/manual/datetime.format.php */ |
16 | 1147 |
get_the_time( __( 'Y/m/d' ), $post ), |
18 | 1148 |
/* translators: Post time format. See https://www.php.net/manual/datetime.format.php */ |
16 | 1149 |
get_the_time( __( 'g:i a' ), $post ) |
1150 |
); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1151 |
|
16 | 1152 |
$time = get_post_timestamp( $post ); |
1153 |
$time_diff = time() - $time; |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1154 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1155 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1156 |
if ( 'publish' === $post->post_status ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1157 |
$status = __( 'Published' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1158 |
} elseif ( 'future' === $post->post_status ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1159 |
if ( $time_diff > 0 ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1160 |
$status = '<strong class="error-message">' . __( 'Missed schedule' ) . '</strong>'; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1161 |
} else { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1162 |
$status = __( 'Scheduled' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1163 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1164 |
} else { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1165 |
$status = __( 'Last Modified' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1166 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1167 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1168 |
/** |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1169 |
* Filters the status text of the post. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1170 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1171 |
* @since 4.8.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1172 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1173 |
* @param string $status The status text. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1174 |
* @param WP_Post $post Post object. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1175 |
* @param string $column_name The column name. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1176 |
* @param string $mode The list display mode ('excerpt' or 'list'). |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1177 |
*/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1178 |
$status = apply_filters( 'post_date_column_status', $status, $post, 'date', $mode ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1179 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1180 |
if ( $status ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1181 |
echo $status . '<br />'; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1182 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1183 |
|
16 | 1184 |
/** |
1185 |
* Filters the published time of the post. |
|
1186 |
* |
|
1187 |
* @since 2.5.1 |
|
1188 |
* @since 5.5.0 Removed the difference between 'excerpt' and 'list' modes. |
|
1189 |
* The published time and date are both displayed now, |
|
1190 |
* which is equivalent to the previous 'excerpt' mode. |
|
1191 |
* |
|
1192 |
* @param string $t_time The published time. |
|
1193 |
* @param WP_Post $post Post object. |
|
1194 |
* @param string $column_name The column name. |
|
1195 |
* @param string $mode The list display mode ('excerpt' or 'list'). |
|
1196 |
*/ |
|
1197 |
echo apply_filters( 'post_date_column_time', $t_time, $post, 'date', $mode ); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1198 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1199 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1200 |
/** |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1201 |
* Handles the comments column output. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1202 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1203 |
* @since 4.3.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1204 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1205 |
* @param WP_Post $post The current WP_Post object. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1206 |
*/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1207 |
public function column_comments( $post ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1208 |
?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1209 |
<div class="post-com-count-wrapper"> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1210 |
<?php |
9 | 1211 |
$pending_comments = isset( $this->comment_pending_count[ $post->ID ] ) ? $this->comment_pending_count[ $post->ID ] : 0; |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1212 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1213 |
$this->comments_bubble( $post->ID, $pending_comments ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1214 |
?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1215 |
</div> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1216 |
<?php |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1217 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1218 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1219 |
/** |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1220 |
* Handles the post author column output. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1221 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1222 |
* @since 4.3.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1223 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1224 |
* @param WP_Post $post The current WP_Post object. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1225 |
*/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1226 |
public function column_author( $post ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1227 |
$args = array( |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1228 |
'post_type' => $post->post_type, |
9 | 1229 |
'author' => get_the_author_meta( 'ID' ), |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1230 |
); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1231 |
echo $this->get_edit_link( $args, get_the_author() ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1232 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1233 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1234 |
/** |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1235 |
* Handles the default column output. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1236 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1237 |
* @since 4.3.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1238 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1239 |
* @param WP_Post $post The current WP_Post object. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1240 |
* @param string $column_name The current column name. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1241 |
*/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1242 |
public function column_default( $post, $column_name ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1243 |
if ( 'categories' === $column_name ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1244 |
$taxonomy = 'category'; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1245 |
} elseif ( 'tags' === $column_name ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1246 |
$taxonomy = 'post_tag'; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1247 |
} elseif ( 0 === strpos( $column_name, 'taxonomy-' ) ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1248 |
$taxonomy = substr( $column_name, 9 ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1249 |
} else { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1250 |
$taxonomy = false; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1251 |
} |
18 | 1252 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1253 |
if ( $taxonomy ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1254 |
$taxonomy_object = get_taxonomy( $taxonomy ); |
9 | 1255 |
$terms = get_the_terms( $post->ID, $taxonomy ); |
18 | 1256 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1257 |
if ( is_array( $terms ) ) { |
9 | 1258 |
$term_links = array(); |
18 | 1259 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1260 |
foreach ( $terms as $t ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1261 |
$posts_in_term_qv = array(); |
18 | 1262 |
|
16 | 1263 |
if ( 'post' !== $post->post_type ) { |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1264 |
$posts_in_term_qv['post_type'] = $post->post_type; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1265 |
} |
18 | 1266 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1267 |
if ( $taxonomy_object->query_var ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1268 |
$posts_in_term_qv[ $taxonomy_object->query_var ] = $t->slug; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1269 |
} else { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1270 |
$posts_in_term_qv['taxonomy'] = $taxonomy; |
9 | 1271 |
$posts_in_term_qv['term'] = $t->slug; |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1272 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1273 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1274 |
$label = esc_html( sanitize_term_field( 'name', $t->name, $t->term_id, $taxonomy, 'display' ) ); |
9 | 1275 |
|
1276 |
$term_links[] = $this->get_edit_link( $posts_in_term_qv, $label ); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1277 |
} |
9 | 1278 |
|
1279 |
/** |
|
1280 |
* Filters the links in `$taxonomy` column of edit.php. |
|
1281 |
* |
|
1282 |
* @since 5.2.0 |
|
1283 |
* |
|
16 | 1284 |
* @param string[] $term_links Array of term editing links. |
1285 |
* @param string $taxonomy Taxonomy name. |
|
1286 |
* @param WP_Term[] $terms Array of term objects appearing in the post row. |
|
9 | 1287 |
*/ |
1288 |
$term_links = apply_filters( 'post_column_taxonomy_links', $term_links, $taxonomy, $terms ); |
|
1289 |
||
16 | 1290 |
/* translators: Used between list items, there is a space after the comma. */ |
18 | 1291 |
echo implode( __( ', ' ), $term_links ); |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1292 |
} else { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1293 |
echo '<span aria-hidden="true">—</span><span class="screen-reader-text">' . $taxonomy_object->labels->no_terms . '</span>'; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1294 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1295 |
return; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1296 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1297 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1298 |
if ( is_post_type_hierarchical( $post->post_type ) ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1299 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1300 |
/** |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1301 |
* Fires in each custom column on the Posts list table. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1302 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1303 |
* This hook only fires if the current post type is hierarchical, |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1304 |
* such as pages. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1305 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1306 |
* @since 2.5.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1307 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1308 |
* @param string $column_name The name of the column to display. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1309 |
* @param int $post_id The current post ID. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1310 |
*/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1311 |
do_action( 'manage_pages_custom_column', $column_name, $post->ID ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1312 |
} else { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1313 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1314 |
/** |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1315 |
* Fires in each custom column in the Posts list table. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1316 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1317 |
* This hook only fires if the current post type is non-hierarchical, |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1318 |
* such as posts. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1319 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1320 |
* @since 1.5.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1321 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1322 |
* @param string $column_name The name of the column to display. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1323 |
* @param int $post_id The current post ID. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1324 |
*/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1325 |
do_action( 'manage_posts_custom_column', $column_name, $post->ID ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1326 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1327 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1328 |
/** |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1329 |
* Fires for each custom column of a specific post type in the Posts list table. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1330 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1331 |
* The dynamic portion of the hook name, `$post->post_type`, refers to the post type. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1332 |
* |
18 | 1333 |
* Possible hook names include: |
1334 |
* |
|
1335 |
* - `manage_post_posts_custom_column` |
|
1336 |
* - `manage_page_posts_custom_column` |
|
1337 |
* |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1338 |
* @since 3.1.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1339 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1340 |
* @param string $column_name The name of the column to display. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1341 |
* @param int $post_id The current post ID. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1342 |
*/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1343 |
do_action( "manage_{$post->post_type}_posts_custom_column", $column_name, $post->ID ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1344 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1345 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1346 |
/** |
16 | 1347 |
* @global WP_Post $post Global post object. |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1348 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1349 |
* @param int|WP_Post $post |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1350 |
* @param int $level |
5 | 1351 |
*/ |
1352 |
public function single_row( $post, $level = 0 ) { |
|
0 | 1353 |
$global_post = get_post(); |
5 | 1354 |
|
9 | 1355 |
$post = get_post( $post ); |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1356 |
$this->current_level = $level; |
5 | 1357 |
|
0 | 1358 |
$GLOBALS['post'] = $post; |
1359 |
setup_postdata( $post ); |
|
1360 |
||
18 | 1361 |
$classes = 'iedit author-' . ( get_current_user_id() === (int) $post->post_author ? 'self' : 'other' ); |
0 | 1362 |
|
1363 |
$lock_holder = wp_check_post_lock( $post->ID ); |
|
18 | 1364 |
|
0 | 1365 |
if ( $lock_holder ) { |
1366 |
$classes .= ' wp-locked'; |
|
1367 |
} |
|
5 | 1368 |
|
1369 |
if ( $post->post_parent ) { |
|
9 | 1370 |
$count = count( get_post_ancestors( $post->ID ) ); |
1371 |
$classes .= ' level-' . $count; |
|
5 | 1372 |
} else { |
9 | 1373 |
$classes .= ' level-0'; |
5 | 1374 |
} |
9 | 1375 |
?> |
5 | 1376 |
<tr id="post-<?php echo $post->ID; ?>" class="<?php echo implode( ' ', get_post_class( $classes, $post->ID ) ); ?>"> |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1377 |
<?php $this->single_row_columns( $post ); ?> |
0 | 1378 |
</tr> |
9 | 1379 |
<?php |
0 | 1380 |
$GLOBALS['post'] = $global_post; |
1381 |
} |
|
1382 |
||
1383 |
/** |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1384 |
* Gets the name of the default primary column. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1385 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1386 |
* @since 4.3.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1387 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1388 |
* @return string Name of the default primary column, in this case, 'title'. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1389 |
*/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1390 |
protected function get_default_primary_column_name() { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1391 |
return 'title'; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1392 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1393 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1394 |
/** |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1395 |
* Generates and displays row action links. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1396 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1397 |
* @since 4.3.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1398 |
* |
18 | 1399 |
* @param WP_Post $post Post being acted upon. |
1400 |
* @param string $column_name Current column name. |
|
1401 |
* @param string $primary Primary column name. |
|
16 | 1402 |
* @return string Row actions output for posts, or an empty string |
1403 |
* if the current column is not the primary column. |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1404 |
*/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1405 |
protected function handle_row_actions( $post, $column_name, $primary ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1406 |
if ( $primary !== $column_name ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1407 |
return ''; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1408 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1409 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1410 |
$post_type_object = get_post_type_object( $post->post_type ); |
9 | 1411 |
$can_edit_post = current_user_can( 'edit_post', $post->ID ); |
1412 |
$actions = array(); |
|
1413 |
$title = _draft_or_post_title(); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1414 |
|
16 | 1415 |
if ( $can_edit_post && 'trash' !== $post->post_status ) { |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1416 |
$actions['edit'] = sprintf( |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1417 |
'<a href="%s" aria-label="%s">%s</a>', |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1418 |
get_edit_post_link( $post->ID ), |
16 | 1419 |
/* translators: %s: Post title. */ |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1420 |
esc_attr( sprintf( __( 'Edit “%s”' ), $title ) ), |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1421 |
__( 'Edit' ) |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1422 |
); |
9 | 1423 |
|
1424 |
if ( 'wp_block' !== $post->post_type ) { |
|
1425 |
$actions['inline hide-if-no-js'] = sprintf( |
|
1426 |
'<button type="button" class="button-link editinline" aria-label="%s" aria-expanded="false">%s</button>', |
|
16 | 1427 |
/* translators: %s: Post title. */ |
9 | 1428 |
esc_attr( sprintf( __( 'Quick edit “%s” inline' ), $title ) ), |
1429 |
__( 'Quick Edit' ) |
|
1430 |
); |
|
1431 |
} |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1432 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1433 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1434 |
if ( current_user_can( 'delete_post', $post->ID ) ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1435 |
if ( 'trash' === $post->post_status ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1436 |
$actions['untrash'] = sprintf( |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1437 |
'<a href="%s" aria-label="%s">%s</a>', |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1438 |
wp_nonce_url( admin_url( sprintf( $post_type_object->_edit_link . '&action=untrash', $post->ID ) ), 'untrash-post_' . $post->ID ), |
16 | 1439 |
/* translators: %s: Post title. */ |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1440 |
esc_attr( sprintf( __( 'Restore “%s” from the Trash' ), $title ) ), |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1441 |
__( 'Restore' ) |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1442 |
); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1443 |
} elseif ( EMPTY_TRASH_DAYS ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1444 |
$actions['trash'] = sprintf( |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1445 |
'<a href="%s" class="submitdelete" aria-label="%s">%s</a>', |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1446 |
get_delete_post_link( $post->ID ), |
16 | 1447 |
/* translators: %s: Post title. */ |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1448 |
esc_attr( sprintf( __( 'Move “%s” to the Trash' ), $title ) ), |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1449 |
_x( 'Trash', 'verb' ) |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1450 |
); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1451 |
} |
18 | 1452 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1453 |
if ( 'trash' === $post->post_status || ! EMPTY_TRASH_DAYS ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1454 |
$actions['delete'] = sprintf( |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1455 |
'<a href="%s" class="submitdelete" aria-label="%s">%s</a>', |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1456 |
get_delete_post_link( $post->ID, '', true ), |
16 | 1457 |
/* translators: %s: Post title. */ |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1458 |
esc_attr( sprintf( __( 'Delete “%s” permanently' ), $title ) ), |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1459 |
__( 'Delete Permanently' ) |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1460 |
); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1461 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1462 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1463 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1464 |
if ( is_post_type_viewable( $post_type_object ) ) { |
16 | 1465 |
if ( in_array( $post->post_status, array( 'pending', 'draft', 'future' ), true ) ) { |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1466 |
if ( $can_edit_post ) { |
9 | 1467 |
$preview_link = get_preview_post_link( $post ); |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1468 |
$actions['view'] = sprintf( |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1469 |
'<a href="%s" rel="bookmark" aria-label="%s">%s</a>', |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1470 |
esc_url( $preview_link ), |
16 | 1471 |
/* translators: %s: Post title. */ |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1472 |
esc_attr( sprintf( __( 'Preview “%s”' ), $title ) ), |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1473 |
__( 'Preview' ) |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1474 |
); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1475 |
} |
16 | 1476 |
} elseif ( 'trash' !== $post->post_status ) { |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1477 |
$actions['view'] = sprintf( |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1478 |
'<a href="%s" rel="bookmark" aria-label="%s">%s</a>', |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1479 |
get_permalink( $post->ID ), |
16 | 1480 |
/* translators: %s: Post title. */ |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1481 |
esc_attr( sprintf( __( 'View “%s”' ), $title ) ), |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1482 |
__( 'View' ) |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1483 |
); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1484 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1485 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1486 |
|
9 | 1487 |
if ( 'wp_block' === $post->post_type ) { |
1488 |
$actions['export'] = sprintf( |
|
1489 |
'<button type="button" class="wp-list-reusable-blocks__export button-link" data-id="%s" aria-label="%s">%s</button>', |
|
1490 |
$post->ID, |
|
16 | 1491 |
/* translators: %s: Post title. */ |
9 | 1492 |
esc_attr( sprintf( __( 'Export “%s” as JSON' ), $title ) ), |
1493 |
__( 'Export as JSON' ) |
|
1494 |
); |
|
1495 |
} |
|
1496 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1497 |
if ( is_post_type_hierarchical( $post->post_type ) ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1498 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1499 |
/** |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1500 |
* Filters the array of row action links on the Pages list table. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1501 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1502 |
* The filter is evaluated only for hierarchical post types. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1503 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1504 |
* @since 2.8.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1505 |
* |
9 | 1506 |
* @param string[] $actions An array of row action links. Defaults are |
1507 |
* 'Edit', 'Quick Edit', 'Restore', 'Trash', |
|
1508 |
* 'Delete Permanently', 'Preview', and 'View'. |
|
1509 |
* @param WP_Post $post The post object. |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1510 |
*/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1511 |
$actions = apply_filters( 'page_row_actions', $actions, $post ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1512 |
} else { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1513 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1514 |
/** |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1515 |
* Filters the array of row action links on the Posts list table. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1516 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1517 |
* The filter is evaluated only for non-hierarchical post types. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1518 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1519 |
* @since 2.8.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1520 |
* |
9 | 1521 |
* @param string[] $actions An array of row action links. Defaults are |
1522 |
* 'Edit', 'Quick Edit', 'Restore', 'Trash', |
|
1523 |
* 'Delete Permanently', 'Preview', and 'View'. |
|
1524 |
* @param WP_Post $post The post object. |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1525 |
*/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1526 |
$actions = apply_filters( 'post_row_actions', $actions, $post ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1527 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1528 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1529 |
return $this->row_actions( $actions ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1530 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1531 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1532 |
/** |
0 | 1533 |
* Outputs the hidden row displayed when inline editing |
1534 |
* |
|
1535 |
* @since 3.1.0 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1536 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1537 |
* @global string $mode List table view mode. |
0 | 1538 |
*/ |
5 | 1539 |
public function inline_edit() { |
0 | 1540 |
global $mode; |
1541 |
||
1542 |
$screen = $this->screen; |
|
1543 |
||
9 | 1544 |
$post = get_default_post_to_edit( $screen->post_type ); |
0 | 1545 |
$post_type_object = get_post_type_object( $screen->post_type ); |
1546 |
||
9 | 1547 |
$taxonomy_names = get_object_taxonomies( $screen->post_type ); |
0 | 1548 |
$hierarchical_taxonomies = array(); |
9 | 1549 |
$flat_taxonomies = array(); |
16 | 1550 |
|
0 | 1551 |
foreach ( $taxonomy_names as $taxonomy_name ) { |
1552 |
$taxonomy = get_taxonomy( $taxonomy_name ); |
|
1553 |
||
5 | 1554 |
$show_in_quick_edit = $taxonomy->show_in_quick_edit; |
1555 |
||
1556 |
/** |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1557 |
* Filters whether the current taxonomy should be shown in the Quick Edit panel. |
5 | 1558 |
* |
1559 |
* @since 4.2.0 |
|
1560 |
* |
|
1561 |
* @param bool $show_in_quick_edit Whether to show the current taxonomy in Quick Edit. |
|
1562 |
* @param string $taxonomy_name Taxonomy name. |
|
1563 |
* @param string $post_type Post type of current Quick Edit post. |
|
1564 |
*/ |
|
1565 |
if ( ! apply_filters( 'quick_edit_show_taxonomy', $show_in_quick_edit, $taxonomy_name, $screen->post_type ) ) { |
|
0 | 1566 |
continue; |
5 | 1567 |
} |
0 | 1568 |
|
9 | 1569 |
if ( $taxonomy->hierarchical ) { |
0 | 1570 |
$hierarchical_taxonomies[] = $taxonomy; |
9 | 1571 |
} else { |
0 | 1572 |
$flat_taxonomies[] = $taxonomy; |
9 | 1573 |
} |
0 | 1574 |
} |
1575 |
||
9 | 1576 |
$m = ( isset( $mode ) && 'excerpt' === $mode ) ? 'excerpt' : 'list'; |
1577 |
$can_publish = current_user_can( $post_type_object->cap->publish_posts ); |
|
1578 |
$core_columns = array( |
|
1579 |
'cb' => true, |
|
1580 |
'date' => true, |
|
1581 |
'title' => true, |
|
1582 |
'categories' => true, |
|
1583 |
'tags' => true, |
|
1584 |
'comments' => true, |
|
1585 |
'author' => true, |
|
1586 |
); |
|
1587 |
?> |
|
0 | 1588 |
|
16 | 1589 |
<form method="get"> |
1590 |
<table style="display: none"><tbody id="inlineedit"> |
|
0 | 1591 |
<?php |
9 | 1592 |
$hclass = count( $hierarchical_taxonomies ) ? 'post' : 'page'; |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1593 |
$inline_edit_classes = "inline-edit-row inline-edit-row-$hclass"; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1594 |
$bulk_edit_classes = "bulk-edit-row bulk-edit-row-$hclass bulk-edit-{$screen->post_type}"; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1595 |
$quick_edit_classes = "quick-edit-row quick-edit-row-$hclass inline-edit-{$screen->post_type}"; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1596 |
|
0 | 1597 |
$bulk = 0; |
18 | 1598 |
|
16 | 1599 |
while ( $bulk < 2 ) : |
1600 |
$classes = $inline_edit_classes . ' '; |
|
1601 |
$classes .= $bulk ? $bulk_edit_classes : $quick_edit_classes; |
|
9 | 1602 |
?> |
16 | 1603 |
<tr id="<?php echo $bulk ? 'bulk-edit' : 'inline-edit'; ?>" class="<?php echo $classes; ?>" style="display: none"> |
1604 |
<td colspan="<?php echo $this->get_column_count(); ?>" class="colspanchange"> |
|
1605 |
||
1606 |
<fieldset class="inline-edit-col-left"> |
|
1607 |
<legend class="inline-edit-legend"><?php echo $bulk ? __( 'Bulk Edit' ) : __( 'Quick Edit' ); ?></legend> |
|
1608 |
<div class="inline-edit-col"> |
|
1609 |
||
1610 |
<?php if ( post_type_supports( $screen->post_type, 'title' ) ) : ?> |
|
1611 |
||
1612 |
<?php if ( $bulk ) : ?> |
|
1613 |
||
1614 |
<div id="bulk-title-div"> |
|
1615 |
<div id="bulk-titles"></div> |
|
1616 |
</div> |
|
1617 |
||
1618 |
<?php else : // $bulk ?> |
|
1619 |
||
1620 |
<label> |
|
1621 |
<span class="title"><?php _e( 'Title' ); ?></span> |
|
1622 |
<span class="input-text-wrap"><input type="text" name="post_title" class="ptitle" value="" /></span> |
|
1623 |
</label> |
|
1624 |
||
1625 |
<?php if ( is_post_type_viewable( $screen->post_type ) ) : ?> |
|
1626 |
||
1627 |
<label> |
|
1628 |
<span class="title"><?php _e( 'Slug' ); ?></span> |
|
1629 |
<span class="input-text-wrap"><input type="text" name="post_name" value="" /></span> |
|
1630 |
</label> |
|
1631 |
||
1632 |
<?php endif; // is_post_type_viewable() ?> |
|
1633 |
||
1634 |
<?php endif; // $bulk ?> |
|
0 | 1635 |
|
16 | 1636 |
<?php endif; // post_type_supports( ... 'title' ) ?> |
1637 |
||
1638 |
<?php if ( ! $bulk ) : ?> |
|
1639 |
<fieldset class="inline-edit-date"> |
|
1640 |
<legend><span class="title"><?php _e( 'Date' ); ?></span></legend> |
|
1641 |
<?php touch_time( 1, 1, 0, 1 ); ?> |
|
1642 |
</fieldset> |
|
1643 |
<br class="clear" /> |
|
1644 |
<?php endif; // $bulk ?> |
|
1645 |
||
1646 |
<?php |
|
18 | 1647 |
if ( post_type_supports( $screen->post_type, 'author' ) ) { |
16 | 1648 |
$authors_dropdown = ''; |
0 | 1649 |
|
18 | 1650 |
if ( current_user_can( $post_type_object->cap->edit_others_posts ) ) { |
16 | 1651 |
$users_opt = array( |
1652 |
'hide_if_only_one_author' => false, |
|
1653 |
'who' => 'authors', |
|
1654 |
'name' => 'post_author', |
|
1655 |
'class' => 'authors', |
|
1656 |
'multi' => 1, |
|
1657 |
'echo' => 0, |
|
1658 |
'show' => 'display_name_with_login', |
|
1659 |
); |
|
0 | 1660 |
|
16 | 1661 |
if ( $bulk ) { |
1662 |
$users_opt['show_option_none'] = __( '— No Change —' ); |
|
1663 |
} |
|
1664 |
||
18 | 1665 |
/** |
1666 |
* Filters the arguments used to generate the Quick Edit authors drop-down. |
|
1667 |
* |
|
1668 |
* @since 5.6.0 |
|
1669 |
* |
|
1670 |
* @see wp_dropdown_users() |
|
1671 |
* |
|
1672 |
* @param array $users_opt An array of arguments passed to wp_dropdown_users(). |
|
1673 |
* @param bool $bulk A flag to denote if it's a bulk action. |
|
1674 |
*/ |
|
1675 |
$users_opt = apply_filters( 'quick_edit_dropdown_authors_args', $users_opt, $bulk ); |
|
1676 |
||
16 | 1677 |
$authors = wp_dropdown_users( $users_opt ); |
18 | 1678 |
|
1679 |
if ( $authors ) { |
|
16 | 1680 |
$authors_dropdown = '<label class="inline-edit-author">'; |
1681 |
$authors_dropdown .= '<span class="title">' . __( 'Author' ) . '</span>'; |
|
1682 |
$authors_dropdown .= $authors; |
|
1683 |
$authors_dropdown .= '</label>'; |
|
18 | 1684 |
} |
1685 |
} // current_user_can( 'edit_others_posts' ) |
|
0 | 1686 |
|
16 | 1687 |
if ( ! $bulk ) { |
1688 |
echo $authors_dropdown; |
|
9 | 1689 |
} |
18 | 1690 |
} // post_type_supports( ... 'author' ) |
9 | 1691 |
?> |
0 | 1692 |
|
16 | 1693 |
<?php if ( ! $bulk && $can_publish ) : ?> |
0 | 1694 |
|
16 | 1695 |
<div class="inline-edit-group wp-clearfix"> |
1696 |
<label class="alignleft"> |
|
1697 |
<span class="title"><?php _e( 'Password' ); ?></span> |
|
1698 |
<span class="input-text-wrap"><input type="text" name="post_password" class="inline-edit-password-input" value="" /></span> |
|
1699 |
</label> |
|
0 | 1700 |
|
16 | 1701 |
<span class="alignleft inline-edit-or"> |
1702 |
<?php |
|
1703 |
/* translators: Between password field and private checkbox on post quick edit interface. */ |
|
1704 |
_e( '–OR–' ); |
|
1705 |
?> |
|
1706 |
</span> |
|
1707 |
<label class="alignleft inline-edit-private"> |
|
1708 |
<input type="checkbox" name="keep_private" value="private" /> |
|
1709 |
<span class="checkbox-title"><?php _e( 'Private' ); ?></span> |
|
1710 |
</label> |
|
1711 |
</div> |
|
0 | 1712 |
|
9 | 1713 |
<?php endif; ?> |
0 | 1714 |
|
16 | 1715 |
</div> |
1716 |
</fieldset> |
|
0 | 1717 |
|
9 | 1718 |
<?php if ( count( $hierarchical_taxonomies ) && ! $bulk ) : ?> |
0 | 1719 |
|
16 | 1720 |
<fieldset class="inline-edit-col-center inline-edit-categories"> |
1721 |
<div class="inline-edit-col"> |
|
0 | 1722 |
|
16 | 1723 |
<?php foreach ( $hierarchical_taxonomies as $taxonomy ) : ?> |
0 | 1724 |
|
16 | 1725 |
<span class="title inline-edit-categories-label"><?php echo esc_html( $taxonomy->labels->name ); ?></span> |
1726 |
<input type="hidden" name="<?php echo ( 'category' === $taxonomy->name ) ? 'post_category[]' : 'tax_input[' . esc_attr( $taxonomy->name ) . '][]'; ?>" value="0" /> |
|
1727 |
<ul class="cat-checklist <?php echo esc_attr( $taxonomy->name ); ?>-checklist"> |
|
1728 |
<?php wp_terms_checklist( null, array( 'taxonomy' => $taxonomy->name ) ); ?> |
|
1729 |
</ul> |
|
0 | 1730 |
|
16 | 1731 |
<?php endforeach; // $hierarchical_taxonomies as $taxonomy ?> |
0 | 1732 |
|
16 | 1733 |
</div> |
1734 |
</fieldset> |
|
0 | 1735 |
|
16 | 1736 |
<?php endif; // count( $hierarchical_taxonomies ) && ! $bulk ?> |
0 | 1737 |
|
16 | 1738 |
<fieldset class="inline-edit-col-right"> |
1739 |
<div class="inline-edit-col"> |
|
0 | 1740 |
|
9 | 1741 |
<?php |
16 | 1742 |
if ( post_type_supports( $screen->post_type, 'author' ) && $bulk ) { |
1743 |
echo $authors_dropdown; |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1744 |
} |
9 | 1745 |
?> |
16 | 1746 |
|
1747 |
<?php if ( post_type_supports( $screen->post_type, 'page-attributes' ) ) : ?> |
|
1748 |
||
1749 |
<?php if ( $post_type_object->hierarchical ) : ?> |
|
1750 |
||
1751 |
<label> |
|
1752 |
<span class="title"><?php _e( 'Parent' ); ?></span> |
|
1753 |
<?php |
|
1754 |
$dropdown_args = array( |
|
1755 |
'post_type' => $post_type_object->name, |
|
1756 |
'selected' => $post->post_parent, |
|
1757 |
'name' => 'post_parent', |
|
1758 |
'show_option_none' => __( 'Main Page (no parent)' ), |
|
1759 |
'option_none_value' => 0, |
|
1760 |
'sort_column' => 'menu_order, post_title', |
|
1761 |
); |
|
1762 |
||
1763 |
if ( $bulk ) { |
|
1764 |
$dropdown_args['show_option_no_change'] = __( '— No Change —' ); |
|
1765 |
} |
|
1766 |
||
1767 |
/** |
|
1768 |
* Filters the arguments used to generate the Quick Edit page-parent drop-down. |
|
1769 |
* |
|
1770 |
* @since 2.7.0 |
|
18 | 1771 |
* @since 5.6.0 The `$bulk` parameter was added. |
16 | 1772 |
* |
1773 |
* @see wp_dropdown_pages() |
|
1774 |
* |
|
18 | 1775 |
* @param array $dropdown_args An array of arguments passed to wp_dropdown_pages(). |
1776 |
* @param bool $bulk A flag to denote if it's a bulk action. |
|
16 | 1777 |
*/ |
18 | 1778 |
$dropdown_args = apply_filters( 'quick_edit_dropdown_pages_args', $dropdown_args, $bulk ); |
16 | 1779 |
|
1780 |
wp_dropdown_pages( $dropdown_args ); |
|
1781 |
?> |
|
1782 |
</label> |
|
1783 |
||
1784 |
<?php endif; // hierarchical ?> |
|
1785 |
||
1786 |
<?php if ( ! $bulk ) : ?> |
|
1787 |
||
1788 |
<label> |
|
1789 |
<span class="title"><?php _e( 'Order' ); ?></span> |
|
1790 |
<span class="input-text-wrap"><input type="text" name="menu_order" class="inline-edit-menu-order-input" value="<?php echo $post->menu_order; ?>" /></span> |
|
1791 |
</label> |
|
1792 |
||
1793 |
<?php endif; // ! $bulk ?> |
|
1794 |
||
1795 |
<?php endif; // post_type_supports( ... 'page-attributes' ) ?> |
|
1796 |
||
1797 |
<?php if ( 0 < count( get_page_templates( null, $screen->post_type ) ) ) : ?> |
|
1798 |
||
1799 |
<label> |
|
1800 |
<span class="title"><?php _e( 'Template' ); ?></span> |
|
1801 |
<select name="page_template"> |
|
1802 |
<?php if ( $bulk ) : ?> |
|
1803 |
<option value="-1"><?php _e( '— No Change —' ); ?></option> |
|
1804 |
<?php endif; // $bulk ?> |
|
1805 |
<?php |
|
1806 |
/** This filter is documented in wp-admin/includes/meta-boxes.php */ |
|
1807 |
$default_title = apply_filters( 'default_page_template_title', __( 'Default template' ), 'quick-edit' ); |
|
1808 |
?> |
|
1809 |
<option value="default"><?php echo esc_html( $default_title ); ?></option> |
|
1810 |
<?php page_template_dropdown( '', $screen->post_type ); ?> |
|
1811 |
</select> |
|
1812 |
</label> |
|
1813 |
||
1814 |
<?php endif; ?> |
|
1815 |
||
1816 |
<?php if ( count( $flat_taxonomies ) && ! $bulk ) : ?> |
|
1817 |
||
1818 |
<?php foreach ( $flat_taxonomies as $taxonomy ) : ?> |
|
1819 |
||
1820 |
<?php if ( current_user_can( $taxonomy->cap->assign_terms ) ) : ?> |
|
1821 |
<?php $taxonomy_name = esc_attr( $taxonomy->name ); ?> |
|
1822 |
||
1823 |
<label class="inline-edit-tags"> |
|
1824 |
<span class="title"><?php echo esc_html( $taxonomy->labels->name ); ?></span> |
|
1825 |
<textarea data-wp-taxonomy="<?php echo $taxonomy_name; ?>" cols="22" rows="1" name="tax_input[<?php echo $taxonomy_name; ?>]" class="tax_input_<?php echo $taxonomy_name; ?>"></textarea> |
|
1826 |
</label> |
|
1827 |
||
1828 |
<?php endif; // current_user_can( 'assign_terms' ) ?> |
|
1829 |
||
1830 |
<?php endforeach; // $flat_taxonomies as $taxonomy ?> |
|
1831 |
||
1832 |
<?php endif; // count( $flat_taxonomies ) && ! $bulk ?> |
|
1833 |
||
1834 |
<?php if ( post_type_supports( $screen->post_type, 'comments' ) || post_type_supports( $screen->post_type, 'trackbacks' ) ) : ?> |
|
1835 |
||
1836 |
<?php if ( $bulk ) : ?> |
|
1837 |
||
1838 |
<div class="inline-edit-group wp-clearfix"> |
|
1839 |
||
1840 |
<?php if ( post_type_supports( $screen->post_type, 'comments' ) ) : ?> |
|
1841 |
||
1842 |
<label class="alignleft"> |
|
1843 |
<span class="title"><?php _e( 'Comments' ); ?></span> |
|
1844 |
<select name="comment_status"> |
|
1845 |
<option value=""><?php _e( '— No Change —' ); ?></option> |
|
1846 |
<option value="open"><?php _e( 'Allow' ); ?></option> |
|
1847 |
<option value="closed"><?php _e( 'Do not allow' ); ?></option> |
|
1848 |
</select> |
|
1849 |
</label> |
|
1850 |
||
1851 |
<?php endif; ?> |
|
1852 |
||
1853 |
<?php if ( post_type_supports( $screen->post_type, 'trackbacks' ) ) : ?> |
|
9 | 1854 |
|
16 | 1855 |
<label class="alignright"> |
1856 |
<span class="title"><?php _e( 'Pings' ); ?></span> |
|
1857 |
<select name="ping_status"> |
|
1858 |
<option value=""><?php _e( '— No Change —' ); ?></option> |
|
1859 |
<option value="open"><?php _e( 'Allow' ); ?></option> |
|
1860 |
<option value="closed"><?php _e( 'Do not allow' ); ?></option> |
|
1861 |
</select> |
|
1862 |
</label> |
|
1863 |
||
1864 |
<?php endif; ?> |
|
1865 |
||
1866 |
</div> |
|
1867 |
||
1868 |
<?php else : // $bulk ?> |
|
1869 |
||
1870 |
<div class="inline-edit-group wp-clearfix"> |
|
1871 |
||
1872 |
<?php if ( post_type_supports( $screen->post_type, 'comments' ) ) : ?> |
|
1873 |
||
1874 |
<label class="alignleft"> |
|
1875 |
<input type="checkbox" name="comment_status" value="open" /> |
|
1876 |
<span class="checkbox-title"><?php _e( 'Allow Comments' ); ?></span> |
|
1877 |
</label> |
|
1878 |
||
1879 |
<?php endif; ?> |
|
1880 |
||
1881 |
<?php if ( post_type_supports( $screen->post_type, 'trackbacks' ) ) : ?> |
|
1882 |
||
1883 |
<label class="alignleft"> |
|
1884 |
<input type="checkbox" name="ping_status" value="open" /> |
|
1885 |
<span class="checkbox-title"><?php _e( 'Allow Pings' ); ?></span> |
|
1886 |
</label> |
|
1887 |
||
1888 |
<?php endif; ?> |
|
1889 |
||
1890 |
</div> |
|
1891 |
||
1892 |
<?php endif; // $bulk ?> |
|
1893 |
||
1894 |
<?php endif; // post_type_supports( ... comments or pings ) ?> |
|
1895 |
||
1896 |
<div class="inline-edit-group wp-clearfix"> |
|
1897 |
||
1898 |
<label class="inline-edit-status alignleft"> |
|
1899 |
<span class="title"><?php _e( 'Status' ); ?></span> |
|
1900 |
<select name="_status"> |
|
1901 |
<?php if ( $bulk ) : ?> |
|
1902 |
<option value="-1"><?php _e( '— No Change —' ); ?></option> |
|
1903 |
<?php endif; // $bulk ?> |
|
9 | 1904 |
|
16 | 1905 |
<?php if ( $can_publish ) : // Contributors only get "Unpublished" and "Pending Review". ?> |
1906 |
<option value="publish"><?php _e( 'Published' ); ?></option> |
|
1907 |
<option value="future"><?php _e( 'Scheduled' ); ?></option> |
|
1908 |
<?php if ( $bulk ) : ?> |
|
1909 |
<option value="private"><?php _e( 'Private' ); ?></option> |
|
1910 |
<?php endif; // $bulk ?> |
|
1911 |
<?php endif; ?> |
|
1912 |
||
1913 |
<option value="pending"><?php _e( 'Pending Review' ); ?></option> |
|
1914 |
<option value="draft"><?php _e( 'Draft' ); ?></option> |
|
1915 |
</select> |
|
1916 |
</label> |
|
1917 |
||
1918 |
<?php if ( 'post' === $screen->post_type && $can_publish && current_user_can( $post_type_object->cap->edit_others_posts ) ) : ?> |
|
1919 |
||
1920 |
<?php if ( $bulk ) : ?> |
|
1921 |
||
1922 |
<label class="alignright"> |
|
1923 |
<span class="title"><?php _e( 'Sticky' ); ?></span> |
|
1924 |
<select name="sticky"> |
|
1925 |
<option value="-1"><?php _e( '— No Change —' ); ?></option> |
|
1926 |
<option value="sticky"><?php _e( 'Sticky' ); ?></option> |
|
1927 |
<option value="unsticky"><?php _e( 'Not Sticky' ); ?></option> |
|
1928 |
</select> |
|
1929 |
</label> |
|
1930 |
||
1931 |
<?php else : // $bulk ?> |
|
0 | 1932 |
|
16 | 1933 |
<label class="alignleft"> |
1934 |
<input type="checkbox" name="sticky" value="sticky" /> |
|
1935 |
<span class="checkbox-title"><?php _e( 'Make this post sticky' ); ?></span> |
|
1936 |
</label> |
|
1937 |
||
1938 |
<?php endif; // $bulk ?> |
|
1939 |
||
1940 |
<?php endif; // 'post' && $can_publish && current_user_can( 'edit_others_posts' ) ?> |
|
1941 |
||
1942 |
</div> |
|
1943 |
||
1944 |
<?php if ( $bulk && current_theme_supports( 'post-formats' ) && post_type_supports( $screen->post_type, 'post-formats' ) ) : ?> |
|
1945 |
<?php $post_formats = get_theme_support( 'post-formats' ); ?> |
|
1946 |
||
1947 |
<label class="alignleft"> |
|
1948 |
<span class="title"><?php _ex( 'Format', 'post format' ); ?></span> |
|
1949 |
<select name="post_format"> |
|
1950 |
<option value="-1"><?php _e( '— No Change —' ); ?></option> |
|
1951 |
<option value="0"><?php echo get_post_format_string( 'standard' ); ?></option> |
|
1952 |
<?php if ( is_array( $post_formats[0] ) ) : ?> |
|
1953 |
<?php foreach ( $post_formats[0] as $format ) : ?> |
|
1954 |
<option value="<?php echo esc_attr( $format ); ?>"><?php echo esc_html( get_post_format_string( $format ) ); ?></option> |
|
1955 |
<?php endforeach; ?> |
|
1956 |
<?php endif; ?> |
|
1957 |
</select> |
|
1958 |
</label> |
|
1959 |
||
1960 |
<?php endif; ?> |
|
1961 |
||
1962 |
</div> |
|
1963 |
</fieldset> |
|
0 | 1964 |
|
9 | 1965 |
<?php |
1966 |
list( $columns ) = $this->get_column_info(); |
|
0 | 1967 |
|
9 | 1968 |
foreach ( $columns as $column_name => $column_display_name ) { |
1969 |
if ( isset( $core_columns[ $column_name ] ) ) { |
|
1970 |
continue; |
|
1971 |
} |
|
5 | 1972 |
|
9 | 1973 |
if ( $bulk ) { |
5 | 1974 |
|
9 | 1975 |
/** |
1976 |
* Fires once for each column in Bulk Edit mode. |
|
1977 |
* |
|
1978 |
* @since 2.7.0 |
|
1979 |
* |
|
16 | 1980 |
* @param string $column_name Name of the column to edit. |
1981 |
* @param string $post_type The post type slug. |
|
9 | 1982 |
*/ |
1983 |
do_action( 'bulk_edit_custom_box', $column_name, $screen->post_type ); |
|
1984 |
} else { |
|
5 | 1985 |
|
9 | 1986 |
/** |
1987 |
* Fires once for each column in Quick Edit mode. |
|
1988 |
* |
|
1989 |
* @since 2.7.0 |
|
1990 |
* |
|
1991 |
* @param string $column_name Name of the column to edit. |
|
1992 |
* @param string $post_type The post type slug, or current screen name if this is a taxonomy list table. |
|
16 | 1993 |
* @param string $taxonomy The taxonomy name, if any. |
9 | 1994 |
*/ |
1995 |
do_action( 'quick_edit_custom_box', $column_name, $screen->post_type, '' ); |
|
1996 |
} |
|
5 | 1997 |
} |
9 | 1998 |
?> |
16 | 1999 |
|
2000 |
<div class="submit inline-edit-save"> |
|
2001 |
<button type="button" class="button cancel alignleft"><?php _e( 'Cancel' ); ?></button> |
|
2002 |
||
2003 |
<?php if ( ! $bulk ) : ?> |
|
2004 |
<?php wp_nonce_field( 'inlineeditnonce', '_inline_edit', false ); ?> |
|
2005 |
<button type="button" class="button button-primary save alignright"><?php _e( 'Update' ); ?></button> |
|
2006 |
<span class="spinner"></span> |
|
2007 |
<?php else : ?> |
|
2008 |
<?php submit_button( __( 'Update' ), 'primary alignright', 'bulk_edit', false ); ?> |
|
2009 |
<?php endif; ?> |
|
2010 |
||
2011 |
<input type="hidden" name="post_view" value="<?php echo esc_attr( $m ); ?>" /> |
|
2012 |
<input type="hidden" name="screen" value="<?php echo esc_attr( $screen->id ); ?>" /> |
|
2013 |
<?php if ( ! $bulk && ! post_type_supports( $screen->post_type, 'author' ) ) : ?> |
|
2014 |
<input type="hidden" name="post_author" value="<?php echo esc_attr( $post->post_author ); ?>" /> |
|
2015 |
<?php endif; ?> |
|
2016 |
<br class="clear" /> |
|
2017 |
||
2018 |
<div class="notice notice-error notice-alt inline hidden"> |
|
2019 |
<p class="error"></p> |
|
2020 |
</div> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
2021 |
</div> |
16 | 2022 |
|
2023 |
</td></tr> |
|
2024 |
||
9 | 2025 |
<?php |
2026 |
$bulk++; |
|
16 | 2027 |
endwhile; |
9 | 2028 |
?> |
16 | 2029 |
</tbody></table> |
2030 |
</form> |
|
9 | 2031 |
<?php |
0 | 2032 |
} |
2033 |
} |