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 |
/** |
|
3 |
* Media Library administration panel. |
|
4 |
* |
|
5 |
* @package WordPress |
|
6 |
* @subpackage Administration |
|
7 |
*/ |
|
8 |
||
9 |
/** WordPress Administration Bootstrap */ |
|
16 | 10 |
require_once __DIR__ . '/admin.php'; |
0 | 11 |
|
9 | 12 |
if ( ! current_user_can( 'upload_files' ) ) { |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
13 |
wp_die( __( 'Sorry, you are not allowed to upload files.' ) ); |
9 | 14 |
} |
0 | 15 |
|
9 | 16 |
$mode = get_user_option( 'media_library_mode', get_current_user_id() ) ? get_user_option( 'media_library_mode', get_current_user_id() ) : 'grid'; |
5 | 17 |
$modes = array( 'grid', 'list' ); |
18 |
||
16 | 19 |
if ( isset( $_GET['mode'] ) && in_array( $_GET['mode'], $modes, true ) ) { |
5 | 20 |
$mode = $_GET['mode']; |
21 |
update_user_option( get_current_user_id(), 'media_library_mode', $mode ); |
|
22 |
} |
|
23 |
||
24 |
if ( 'grid' === $mode ) { |
|
25 |
wp_enqueue_media(); |
|
26 |
wp_enqueue_script( 'media-grid' ); |
|
27 |
wp_enqueue_script( 'media' ); |
|
28 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
29 |
remove_action( 'admin_head', 'wp_admin_canonical_url' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
30 |
|
5 | 31 |
$q = $_GET; |
16 | 32 |
// Let JS handle this. |
5 | 33 |
unset( $q['s'] ); |
9 | 34 |
$vars = wp_edit_attachments_query_vars( $q ); |
5 | 35 |
$ignore = array( 'mode', 'post_type', 'post_status', 'posts_per_page' ); |
36 |
foreach ( $vars as $key => $value ) { |
|
16 | 37 |
if ( ! $value || in_array( $key, $ignore, true ) ) { |
5 | 38 |
unset( $vars[ $key ] ); |
39 |
} |
|
40 |
} |
|
41 |
||
9 | 42 |
wp_localize_script( |
43 |
'media-grid', |
|
44 |
'_wpMediaGridSettings', |
|
45 |
array( |
|
46 |
'adminUrl' => parse_url( self_admin_url(), PHP_URL_PATH ), |
|
47 |
'queryVars' => (object) $vars, |
|
48 |
) |
|
49 |
); |
|
5 | 50 |
|
9 | 51 |
get_current_screen()->add_help_tab( |
52 |
array( |
|
53 |
'id' => 'overview', |
|
54 |
'title' => __( 'Overview' ), |
|
55 |
'content' => |
|
56 |
'<p>' . __( 'All the files you’ve uploaded are listed in the Media Library, with the most recent uploads listed first.' ) . '</p>' . |
|
57 |
'<p>' . __( 'You can view your media in a simple visual grid or a list with columns. Switch between these views using the icons to the left above the media.' ) . '</p>' . |
|
58 |
'<p>' . __( 'To delete media items, click the Bulk Select button at the top of the screen. Select any items you wish to delete, then click the Delete Selected button. Clicking the Cancel Selection button takes you back to viewing your media.' ) . '</p>', |
|
59 |
) |
|
60 |
); |
|
5 | 61 |
|
9 | 62 |
get_current_screen()->add_help_tab( |
63 |
array( |
|
64 |
'id' => 'attachment-details', |
|
65 |
'title' => __( 'Attachment Details' ), |
|
66 |
'content' => |
|
67 |
'<p>' . __( 'Clicking an item will display an Attachment Details dialog, which allows you to preview media and make quick edits. Any changes you make to the attachment details will be automatically saved.' ) . '</p>' . |
|
68 |
'<p>' . __( 'Use the arrow buttons at the top of the dialog, or the left and right arrow keys on your keyboard, to navigate between media items quickly.' ) . '</p>' . |
|
69 |
'<p>' . __( 'You can also delete individual items and access the extended edit screen from the details dialog.' ) . '</p>', |
|
70 |
) |
|
71 |
); |
|
5 | 72 |
|
73 |
get_current_screen()->set_help_sidebar( |
|
74 |
'<p><strong>' . __( 'For more information:' ) . '</strong></p>' . |
|
16 | 75 |
'<p>' . __( '<a href="https://wordpress.org/support/article/media-library-screen/">Documentation on Media Library</a>' ) . '</p>' . |
9 | 76 |
'<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>' |
5 | 77 |
); |
78 |
||
9 | 79 |
$title = __( 'Media Library' ); |
5 | 80 |
$parent_file = 'upload.php'; |
81 |
||
16 | 82 |
require_once ABSPATH . 'wp-admin/admin-header.php'; |
5 | 83 |
?> |
9 | 84 |
<div class="wrap" id="wp-media-grid" data-search="<?php _admin_search_query(); ?>"> |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
85 |
<h1 class="wp-heading-inline"><?php echo esc_html( $title ); ?></h1> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
86 |
|
5 | 87 |
<?php |
9 | 88 |
if ( current_user_can( 'upload_files' ) ) { |
89 |
?> |
|
18 | 90 |
<a href="<?php echo esc_url( admin_url( 'media-new.php' ) ); ?>" class="page-title-action aria-button-if-js"><?php echo esc_html_x( 'Add New', 'file' ); ?></a> |
91 |
<?php |
|
5 | 92 |
} |
93 |
?> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
94 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
95 |
<hr class="wp-header-end"> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
96 |
|
5 | 97 |
<div class="error hide-if-js"> |
9 | 98 |
<p> |
99 |
<?php |
|
100 |
printf( |
|
16 | 101 |
/* translators: %s: List view URL. */ |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
102 |
__( 'The grid view for the Media Library requires JavaScript. <a href="%s">Switch to the list view</a>.' ), |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
103 |
'upload.php?mode=list' |
9 | 104 |
); |
105 |
?> |
|
106 |
</p> |
|
5 | 107 |
</div> |
108 |
</div> |
|
109 |
<?php |
|
16 | 110 |
require_once ABSPATH . 'wp-admin/admin-footer.php'; |
5 | 111 |
exit; |
112 |
} |
|
113 |
||
9 | 114 |
$wp_list_table = _get_list_table( 'WP_Media_List_Table' ); |
115 |
$pagenum = $wp_list_table->get_pagenum(); |
|
0 | 116 |
|
16 | 117 |
// Handle bulk actions. |
0 | 118 |
$doaction = $wp_list_table->current_action(); |
119 |
||
120 |
if ( $doaction ) { |
|
9 | 121 |
check_admin_referer( 'bulk-media' ); |
0 | 122 |
|
18 | 123 |
$post_ids = array(); |
124 |
||
16 | 125 |
if ( 'delete_all' === $doaction ) { |
0 | 126 |
$post_ids = $wpdb->get_col( "SELECT ID FROM $wpdb->posts WHERE post_type='attachment' AND post_status = 'trash'" ); |
127 |
$doaction = 'delete'; |
|
128 |
} elseif ( isset( $_REQUEST['media'] ) ) { |
|
129 |
$post_ids = $_REQUEST['media']; |
|
130 |
} elseif ( isset( $_REQUEST['ids'] ) ) { |
|
131 |
$post_ids = explode( ',', $_REQUEST['ids'] ); |
|
132 |
} |
|
133 |
||
134 |
$location = 'upload.php'; |
|
16 | 135 |
$referer = wp_get_referer(); |
136 |
if ( $referer ) { |
|
9 | 137 |
if ( false !== strpos( $referer, 'upload.php' ) ) { |
0 | 138 |
$location = remove_query_arg( array( 'trashed', 'untrashed', 'deleted', 'message', 'ids', 'posted' ), $referer ); |
9 | 139 |
} |
0 | 140 |
} |
141 |
||
142 |
switch ( $doaction ) { |
|
5 | 143 |
case 'detach': |
144 |
wp_media_attach_action( $_REQUEST['parent_post_id'], 'detach' ); |
|
0 | 145 |
break; |
146 |
||
5 | 147 |
case 'attach': |
148 |
wp_media_attach_action( $_REQUEST['found_post_id'] ); |
|
149 |
break; |
|
0 | 150 |
|
151 |
case 'trash': |
|
18 | 152 |
if ( empty( $post_ids ) ) { |
0 | 153 |
break; |
9 | 154 |
} |
0 | 155 |
foreach ( (array) $post_ids as $post_id ) { |
9 | 156 |
if ( ! current_user_can( 'delete_post', $post_id ) ) { |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
157 |
wp_die( __( 'Sorry, you are not allowed to move this item to the Trash.' ) ); |
9 | 158 |
} |
0 | 159 |
|
9 | 160 |
if ( ! wp_trash_post( $post_id ) ) { |
16 | 161 |
wp_die( __( 'Error in moving the item to Trash.' ) ); |
9 | 162 |
} |
0 | 163 |
} |
9 | 164 |
$location = add_query_arg( |
165 |
array( |
|
166 |
'trashed' => count( $post_ids ), |
|
18 | 167 |
'ids' => implode( ',', $post_ids ), |
9 | 168 |
), |
169 |
$location |
|
170 |
); |
|
0 | 171 |
break; |
172 |
case 'untrash': |
|
18 | 173 |
if ( empty( $post_ids ) ) { |
0 | 174 |
break; |
9 | 175 |
} |
0 | 176 |
foreach ( (array) $post_ids as $post_id ) { |
9 | 177 |
if ( ! current_user_can( 'delete_post', $post_id ) ) { |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
178 |
wp_die( __( 'Sorry, you are not allowed to restore this item from the Trash.' ) ); |
9 | 179 |
} |
0 | 180 |
|
9 | 181 |
if ( ! wp_untrash_post( $post_id ) ) { |
16 | 182 |
wp_die( __( 'Error in restoring the item from Trash.' ) ); |
9 | 183 |
} |
0 | 184 |
} |
185 |
$location = add_query_arg( 'untrashed', count( $post_ids ), $location ); |
|
186 |
break; |
|
187 |
case 'delete': |
|
18 | 188 |
if ( empty( $post_ids ) ) { |
0 | 189 |
break; |
9 | 190 |
} |
0 | 191 |
foreach ( (array) $post_ids as $post_id_del ) { |
9 | 192 |
if ( ! current_user_can( 'delete_post', $post_id_del ) ) { |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
193 |
wp_die( __( 'Sorry, you are not allowed to delete this item.' ) ); |
9 | 194 |
} |
0 | 195 |
|
9 | 196 |
if ( ! wp_delete_attachment( $post_id_del ) ) { |
16 | 197 |
wp_die( __( 'Error in deleting the attachment.' ) ); |
9 | 198 |
} |
0 | 199 |
} |
200 |
$location = add_query_arg( 'deleted', count( $post_ids ), $location ); |
|
201 |
break; |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
202 |
default: |
16 | 203 |
$screen = get_current_screen()->id; |
204 |
||
205 |
/** This action is documented in wp-admin/edit.php */ |
|
206 |
$location = apply_filters( "handle_bulk_actions-{$screen}", $location, $doaction, $post_ids ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
0 | 207 |
} |
208 |
||
209 |
wp_redirect( $location ); |
|
210 |
exit; |
|
211 |
} elseif ( ! empty( $_GET['_wp_http_referer'] ) ) { |
|
9 | 212 |
wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), wp_unslash( $_SERVER['REQUEST_URI'] ) ) ); |
213 |
exit; |
|
0 | 214 |
} |
215 |
||
216 |
$wp_list_table->prepare_items(); |
|
217 |
||
9 | 218 |
$title = __( 'Media Library' ); |
0 | 219 |
$parent_file = 'upload.php'; |
220 |
||
221 |
wp_enqueue_script( 'media' ); |
|
222 |
||
5 | 223 |
add_screen_option( 'per_page' ); |
0 | 224 |
|
9 | 225 |
get_current_screen()->add_help_tab( |
226 |
array( |
|
227 |
'id' => 'overview', |
|
228 |
'title' => __( 'Overview' ), |
|
229 |
'content' => |
|
16 | 230 |
'<p>' . __( 'All the files you’ve uploaded are listed in the Media Library, with the most recent uploads listed first. You can use the Screen Options tab to customize the display of this screen.' ) . '</p>' . |
231 |
'<p>' . __( 'You can narrow the list by file type/status or by date using the dropdown menus above the media table.' ) . '</p>' . |
|
232 |
'<p>' . __( 'You can view your media in a simple visual grid or a list with columns. Switch between these views using the icons to the left above the media.' ) . '</p>', |
|
9 | 233 |
) |
234 |
); |
|
235 |
get_current_screen()->add_help_tab( |
|
236 |
array( |
|
237 |
'id' => 'actions-links', |
|
238 |
'title' => __( 'Available Actions' ), |
|
239 |
'content' => |
|
16 | 240 |
'<p>' . __( 'Hovering over a row reveals action links: Edit, Delete Permanently, and View. Clicking Edit or on the media file’s name displays a simple screen to edit that individual file’s metadata. Clicking Delete Permanently will delete the file from the media library (as well as from any posts to which it is currently attached). View will take you to the display page for that file.' ) . '</p>', |
9 | 241 |
) |
242 |
); |
|
243 |
get_current_screen()->add_help_tab( |
|
244 |
array( |
|
245 |
'id' => 'attaching-files', |
|
246 |
'title' => __( 'Attaching Files' ), |
|
247 |
'content' => |
|
16 | 248 |
'<p>' . __( 'If a media file has not been attached to any content, you will see that in the Uploaded To column, and can click on Attach to launch a small popup that will allow you to search for existing content and attach the file.' ) . '</p>', |
9 | 249 |
) |
250 |
); |
|
0 | 251 |
|
252 |
get_current_screen()->set_help_sidebar( |
|
253 |
'<p><strong>' . __( 'For more information:' ) . '</strong></p>' . |
|
16 | 254 |
'<p>' . __( '<a href="https://wordpress.org/support/article/media-library-screen/">Documentation on Media Library</a>' ) . '</p>' . |
9 | 255 |
'<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>' |
0 | 256 |
); |
257 |
||
9 | 258 |
get_current_screen()->set_screen_reader_content( |
259 |
array( |
|
260 |
'heading_views' => __( 'Filter media items list' ), |
|
261 |
'heading_pagination' => __( 'Media items list navigation' ), |
|
262 |
'heading_list' => __( 'Media items list' ), |
|
263 |
) |
|
264 |
); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
265 |
|
16 | 266 |
require_once ABSPATH . 'wp-admin/admin-header.php'; |
0 | 267 |
?> |
268 |
||
269 |
<div class="wrap"> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
270 |
<h1 class="wp-heading-inline"><?php echo esc_html( $title ); ?></h1> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
271 |
|
0 | 272 |
<?php |
9 | 273 |
if ( current_user_can( 'upload_files' ) ) { |
274 |
?> |
|
18 | 275 |
<a href="<?php echo esc_url( admin_url( 'media-new.php' ) ); ?>" class="page-title-action"><?php echo esc_html_x( 'Add New', 'file' ); ?></a> |
9 | 276 |
<?php |
0 | 277 |
} |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
278 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
279 |
if ( isset( $_REQUEST['s'] ) && strlen( $_REQUEST['s'] ) ) { |
18 | 280 |
echo '<span class="subtitle">'; |
281 |
printf( |
|
282 |
/* translators: %s: Search query. */ |
|
283 |
__( 'Search results for: %s' ), |
|
284 |
'<strong>' . get_search_query() . '</strong>' |
|
285 |
); |
|
286 |
echo '</span>'; |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
287 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
288 |
?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
289 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
290 |
<hr class="wp-header-end"> |
0 | 291 |
|
292 |
<?php |
|
293 |
$message = ''; |
|
294 |
if ( ! empty( $_GET['posted'] ) ) { |
|
9 | 295 |
$message = __( 'Media file updated.' ); |
296 |
$_SERVER['REQUEST_URI'] = remove_query_arg( array( 'posted' ), $_SERVER['REQUEST_URI'] ); |
|
0 | 297 |
} |
298 |
||
16 | 299 |
if ( ! empty( $_GET['attached'] ) && absint( $_GET['attached'] ) ) { |
300 |
$attached = absint( $_GET['attached'] ); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
301 |
if ( 1 == $attached ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
302 |
$message = __( 'Media file attached.' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
303 |
} else { |
16 | 304 |
/* translators: %s: Number of media files. */ |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
305 |
$message = _n( '%s media file attached.', '%s media files attached.', $attached ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
306 |
} |
9 | 307 |
$message = sprintf( $message, number_format_i18n( $attached ) ); |
5 | 308 |
$_SERVER['REQUEST_URI'] = remove_query_arg( array( 'detach', 'attached' ), $_SERVER['REQUEST_URI'] ); |
309 |
} |
|
310 |
||
16 | 311 |
if ( ! empty( $_GET['detach'] ) && absint( $_GET['detach'] ) ) { |
312 |
$detached = absint( $_GET['detach'] ); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
313 |
if ( 1 == $detached ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
314 |
$message = __( 'Media file detached.' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
315 |
} else { |
16 | 316 |
/* translators: %s: Number of media files. */ |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
317 |
$message = _n( '%s media file detached.', '%s media files detached.', $detached ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
318 |
} |
9 | 319 |
$message = sprintf( $message, number_format_i18n( $detached ) ); |
5 | 320 |
$_SERVER['REQUEST_URI'] = remove_query_arg( array( 'detach', 'attached' ), $_SERVER['REQUEST_URI'] ); |
0 | 321 |
} |
322 |
||
16 | 323 |
if ( ! empty( $_GET['deleted'] ) && absint( $_GET['deleted'] ) ) { |
324 |
$deleted = absint( $_GET['deleted'] ); |
|
5 | 325 |
if ( 1 == $deleted ) { |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
326 |
$message = __( 'Media file permanently deleted.' ); |
5 | 327 |
} else { |
16 | 328 |
/* translators: %s: Number of media files. */ |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
329 |
$message = _n( '%s media file permanently deleted.', '%s media files permanently deleted.', $deleted ); |
5 | 330 |
} |
9 | 331 |
$message = sprintf( $message, number_format_i18n( $deleted ) ); |
332 |
$_SERVER['REQUEST_URI'] = remove_query_arg( array( 'deleted' ), $_SERVER['REQUEST_URI'] ); |
|
0 | 333 |
} |
334 |
||
16 | 335 |
if ( ! empty( $_GET['trashed'] ) && absint( $_GET['trashed'] ) ) { |
336 |
$trashed = absint( $_GET['trashed'] ); |
|
5 | 337 |
if ( 1 == $trashed ) { |
16 | 338 |
$message = __( 'Media file moved to the Trash.' ); |
5 | 339 |
} else { |
16 | 340 |
/* translators: %s: Number of media files. */ |
341 |
$message = _n( '%s media file moved to the Trash.', '%s media files moved to the Trash.', $trashed ); |
|
5 | 342 |
} |
9 | 343 |
$message = sprintf( $message, number_format_i18n( $trashed ) ); |
344 |
$message .= ' <a href="' . esc_url( wp_nonce_url( 'upload.php?doaction=undo&action=untrash&ids=' . ( isset( $_GET['ids'] ) ? $_GET['ids'] : '' ), 'bulk-media' ) ) . '">' . __( 'Undo' ) . '</a>'; |
|
345 |
$_SERVER['REQUEST_URI'] = remove_query_arg( array( 'trashed' ), $_SERVER['REQUEST_URI'] ); |
|
0 | 346 |
} |
347 |
||
16 | 348 |
if ( ! empty( $_GET['untrashed'] ) && absint( $_GET['untrashed'] ) ) { |
349 |
$untrashed = absint( $_GET['untrashed'] ); |
|
5 | 350 |
if ( 1 == $untrashed ) { |
16 | 351 |
$message = __( 'Media file restored from the Trash.' ); |
5 | 352 |
} else { |
16 | 353 |
/* translators: %s: Number of media files. */ |
354 |
$message = _n( '%s media file restored from the Trash.', '%s media files restored from the Trash.', $untrashed ); |
|
5 | 355 |
} |
9 | 356 |
$message = sprintf( $message, number_format_i18n( $untrashed ) ); |
357 |
$_SERVER['REQUEST_URI'] = remove_query_arg( array( 'untrashed' ), $_SERVER['REQUEST_URI'] ); |
|
0 | 358 |
} |
359 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
360 |
$messages[1] = __( 'Media file updated.' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
361 |
$messages[2] = __( 'Media file permanently deleted.' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
362 |
$messages[3] = __( 'Error saving media file.' ); |
16 | 363 |
$messages[4] = __( 'Media file moved to the Trash.' ) . ' <a href="' . esc_url( wp_nonce_url( 'upload.php?doaction=undo&action=untrash&ids=' . ( isset( $_GET['ids'] ) ? $_GET['ids'] : '' ), 'bulk-media' ) ) . '">' . __( 'Undo' ) . '</a>'; |
364 |
$messages[5] = __( 'Media file restored from the Trash.' ); |
|
0 | 365 |
|
366 |
if ( ! empty( $_GET['message'] ) && isset( $messages[ $_GET['message'] ] ) ) { |
|
9 | 367 |
$message = $messages[ $_GET['message'] ]; |
368 |
$_SERVER['REQUEST_URI'] = remove_query_arg( array( 'message' ), $_SERVER['REQUEST_URI'] ); |
|
0 | 369 |
} |
370 |
||
9 | 371 |
if ( ! empty( $message ) ) { |
372 |
?> |
|
5 | 373 |
<div id="message" class="updated notice is-dismissible"><p><?php echo $message; ?></p></div> |
0 | 374 |
<?php } ?> |
375 |
||
5 | 376 |
<form id="posts-filter" method="get"> |
377 |
||
0 | 378 |
<?php $wp_list_table->views(); ?> |
379 |
||
380 |
<?php $wp_list_table->display(); ?> |
|
381 |
||
382 |
<div id="ajax-response"></div> |
|
383 |
<?php find_posts_div(); ?> |
|
384 |
</form> |
|
385 |
</div> |
|
386 |
||
387 |
<?php |
|
16 | 388 |
require_once ABSPATH . 'wp-admin/admin-footer.php'; |