28 remove_action( 'admin_head', 'wp_admin_canonical_url' ); |
29 remove_action( 'admin_head', 'wp_admin_canonical_url' ); |
29 |
30 |
30 $q = $_GET; |
31 $q = $_GET; |
31 // let JS handle this |
32 // let JS handle this |
32 unset( $q['s'] ); |
33 unset( $q['s'] ); |
33 $vars = wp_edit_attachments_query_vars( $q ); |
34 $vars = wp_edit_attachments_query_vars( $q ); |
34 $ignore = array( 'mode', 'post_type', 'post_status', 'posts_per_page' ); |
35 $ignore = array( 'mode', 'post_type', 'post_status', 'posts_per_page' ); |
35 foreach ( $vars as $key => $value ) { |
36 foreach ( $vars as $key => $value ) { |
36 if ( ! $value || in_array( $key, $ignore ) ) { |
37 if ( ! $value || in_array( $key, $ignore ) ) { |
37 unset( $vars[ $key ] ); |
38 unset( $vars[ $key ] ); |
38 } |
39 } |
39 } |
40 } |
40 |
41 |
41 wp_localize_script( 'media-grid', '_wpMediaGridSettings', array( |
42 wp_localize_script( |
42 'adminUrl' => parse_url( self_admin_url(), PHP_URL_PATH ), |
43 'media-grid', |
43 'queryVars' => (object) $vars |
44 '_wpMediaGridSettings', |
44 ) ); |
45 array( |
45 |
46 'adminUrl' => parse_url( self_admin_url(), PHP_URL_PATH ), |
46 get_current_screen()->add_help_tab( array( |
47 'queryVars' => (object) $vars, |
47 'id' => 'overview', |
48 ) |
48 'title' => __( 'Overview' ), |
49 ); |
49 'content' => |
50 |
50 '<p>' . __( 'All the files you’ve uploaded are listed in the Media Library, with the most recent uploads listed first.' ) . '</p>' . |
51 get_current_screen()->add_help_tab( |
51 '<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>' . |
52 array( |
52 '<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>' |
53 'id' => 'overview', |
53 ) ); |
54 'title' => __( 'Overview' ), |
54 |
55 'content' => |
55 get_current_screen()->add_help_tab( array( |
56 '<p>' . __( 'All the files you’ve uploaded are listed in the Media Library, with the most recent uploads listed first.' ) . '</p>' . |
56 'id' => 'attachment-details', |
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>' . |
57 'title' => __( 'Attachment Details' ), |
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>', |
58 'content' => |
59 ) |
59 '<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>' . |
60 ); |
60 '<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>' . |
61 |
61 '<p>' . __( 'You can also delete individual items and access the extended edit screen from the details dialog.' ) . '</p>' |
62 get_current_screen()->add_help_tab( |
62 ) ); |
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 ); |
63 |
72 |
64 get_current_screen()->set_help_sidebar( |
73 get_current_screen()->set_help_sidebar( |
65 '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . |
74 '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . |
66 '<p>' . __( '<a href="https://codex.wordpress.org/Media_Library_Screen">Documentation on Media Library</a>' ) . '</p>' . |
75 '<p>' . __( '<a href="https://codex.wordpress.org/Media_Library_Screen">Documentation on Media Library</a>' ) . '</p>' . |
67 '<p>' . __( '<a href="https://wordpress.org/support/">Support Forums</a>' ) . '</p>' |
76 '<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>' |
68 ); |
77 ); |
69 |
78 |
70 $title = __('Media Library'); |
79 $title = __( 'Media Library' ); |
71 $parent_file = 'upload.php'; |
80 $parent_file = 'upload.php'; |
72 |
81 |
73 require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
82 require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
74 ?> |
83 ?> |
75 <div class="wrap" id="wp-media-grid" data-search="<?php _admin_search_query() ?>"> |
84 <div class="wrap" id="wp-media-grid" data-search="<?php _admin_search_query(); ?>"> |
76 <h1 class="wp-heading-inline"><?php echo esc_html( $title ); ?></h1> |
85 <h1 class="wp-heading-inline"><?php echo esc_html( $title ); ?></h1> |
77 |
86 |
78 <?php |
87 <?php |
79 if ( current_user_can( 'upload_files' ) ) { ?> |
88 if ( current_user_can( 'upload_files' ) ) { |
80 <a href="<?php echo admin_url( 'media-new.php' ); ?>" class="page-title-action aria-button-if-js"><?php echo esc_html_x( 'Add New', 'file' ); ?></a><?php |
89 ?> |
|
90 <a href="<?php echo admin_url( 'media-new.php' ); ?>" class="page-title-action aria-button-if-js"><?php echo esc_html_x( 'Add New', 'file' ); ?></a> |
|
91 <?php |
81 } |
92 } |
82 ?> |
93 ?> |
83 |
94 |
84 <hr class="wp-header-end"> |
95 <hr class="wp-header-end"> |
85 |
96 |
86 <div class="error hide-if-js"> |
97 <div class="error hide-if-js"> |
87 <p><?php printf( |
98 <p> |
|
99 <?php |
|
100 printf( |
88 /* translators: %s: list view URL */ |
101 /* translators: %s: list view URL */ |
89 __( 'The grid view for the Media Library requires JavaScript. <a href="%s">Switch to the list view</a>.' ), |
102 __( 'The grid view for the Media Library requires JavaScript. <a href="%s">Switch to the list view</a>.' ), |
90 'upload.php?mode=list' |
103 'upload.php?mode=list' |
91 ); ?></p> |
104 ); |
|
105 ?> |
|
106 </p> |
92 </div> |
107 </div> |
93 </div> |
108 </div> |
94 <?php |
109 <?php |
95 include( ABSPATH . 'wp-admin/admin-footer.php' ); |
110 include( ABSPATH . 'wp-admin/admin-footer.php' ); |
96 exit; |
111 exit; |
97 } |
112 } |
98 |
113 |
99 $wp_list_table = _get_list_table('WP_Media_List_Table'); |
114 $wp_list_table = _get_list_table( 'WP_Media_List_Table' ); |
100 $pagenum = $wp_list_table->get_pagenum(); |
115 $pagenum = $wp_list_table->get_pagenum(); |
101 |
116 |
102 // Handle bulk actions |
117 // Handle bulk actions |
103 $doaction = $wp_list_table->current_action(); |
118 $doaction = $wp_list_table->current_action(); |
104 |
119 |
105 if ( $doaction ) { |
120 if ( $doaction ) { |
106 check_admin_referer('bulk-media'); |
121 check_admin_referer( 'bulk-media' ); |
107 |
122 |
108 if ( 'delete_all' == $doaction ) { |
123 if ( 'delete_all' == $doaction ) { |
109 $post_ids = $wpdb->get_col( "SELECT ID FROM $wpdb->posts WHERE post_type='attachment' AND post_status = 'trash'" ); |
124 $post_ids = $wpdb->get_col( "SELECT ID FROM $wpdb->posts WHERE post_type='attachment' AND post_status = 'trash'" ); |
110 $doaction = 'delete'; |
125 $doaction = 'delete'; |
111 } elseif ( isset( $_REQUEST['media'] ) ) { |
126 } elseif ( isset( $_REQUEST['media'] ) ) { |
128 case 'attach': |
144 case 'attach': |
129 wp_media_attach_action( $_REQUEST['found_post_id'] ); |
145 wp_media_attach_action( $_REQUEST['found_post_id'] ); |
130 break; |
146 break; |
131 |
147 |
132 case 'trash': |
148 case 'trash': |
133 if ( !isset( $post_ids ) ) |
149 if ( ! isset( $post_ids ) ) { |
134 break; |
150 break; |
|
151 } |
135 foreach ( (array) $post_ids as $post_id ) { |
152 foreach ( (array) $post_ids as $post_id ) { |
136 if ( !current_user_can( 'delete_post', $post_id ) ) |
153 if ( ! current_user_can( 'delete_post', $post_id ) ) { |
137 wp_die( __( 'Sorry, you are not allowed to move this item to the Trash.' ) ); |
154 wp_die( __( 'Sorry, you are not allowed to move this item to the Trash.' ) ); |
138 |
155 } |
139 if ( !wp_trash_post( $post_id ) ) |
156 |
|
157 if ( ! wp_trash_post( $post_id ) ) { |
140 wp_die( __( 'Error in moving to Trash.' ) ); |
158 wp_die( __( 'Error in moving to Trash.' ) ); |
141 } |
159 } |
142 $location = add_query_arg( array( 'trashed' => count( $post_ids ), 'ids' => join( ',', $post_ids ) ), $location ); |
160 } |
|
161 $location = add_query_arg( |
|
162 array( |
|
163 'trashed' => count( $post_ids ), |
|
164 'ids' => join( ',', $post_ids ), |
|
165 ), |
|
166 $location |
|
167 ); |
143 break; |
168 break; |
144 case 'untrash': |
169 case 'untrash': |
145 if ( !isset( $post_ids ) ) |
170 if ( ! isset( $post_ids ) ) { |
146 break; |
171 break; |
|
172 } |
147 foreach ( (array) $post_ids as $post_id ) { |
173 foreach ( (array) $post_ids as $post_id ) { |
148 if ( !current_user_can( 'delete_post', $post_id ) ) |
174 if ( ! current_user_can( 'delete_post', $post_id ) ) { |
149 wp_die( __( 'Sorry, you are not allowed to restore this item from the Trash.' ) ); |
175 wp_die( __( 'Sorry, you are not allowed to restore this item from the Trash.' ) ); |
150 |
176 } |
151 if ( !wp_untrash_post( $post_id ) ) |
177 |
|
178 if ( ! wp_untrash_post( $post_id ) ) { |
152 wp_die( __( 'Error in restoring from Trash.' ) ); |
179 wp_die( __( 'Error in restoring from Trash.' ) ); |
|
180 } |
153 } |
181 } |
154 $location = add_query_arg( 'untrashed', count( $post_ids ), $location ); |
182 $location = add_query_arg( 'untrashed', count( $post_ids ), $location ); |
155 break; |
183 break; |
156 case 'delete': |
184 case 'delete': |
157 if ( !isset( $post_ids ) ) |
185 if ( ! isset( $post_ids ) ) { |
158 break; |
186 break; |
|
187 } |
159 foreach ( (array) $post_ids as $post_id_del ) { |
188 foreach ( (array) $post_ids as $post_id_del ) { |
160 if ( !current_user_can( 'delete_post', $post_id_del ) ) |
189 if ( ! current_user_can( 'delete_post', $post_id_del ) ) { |
161 wp_die( __( 'Sorry, you are not allowed to delete this item.' ) ); |
190 wp_die( __( 'Sorry, you are not allowed to delete this item.' ) ); |
162 |
191 } |
163 if ( !wp_delete_attachment( $post_id_del ) ) |
192 |
|
193 if ( ! wp_delete_attachment( $post_id_del ) ) { |
164 wp_die( __( 'Error in deleting.' ) ); |
194 wp_die( __( 'Error in deleting.' ) ); |
|
195 } |
165 } |
196 } |
166 $location = add_query_arg( 'deleted', count( $post_ids ), $location ); |
197 $location = add_query_arg( 'deleted', count( $post_ids ), $location ); |
167 break; |
198 break; |
168 default: |
199 default: |
169 /** This action is documented in wp-admin/edit-comments.php */ |
200 /** This action is documented in wp-admin/edit-comments.php */ |
171 } |
202 } |
172 |
203 |
173 wp_redirect( $location ); |
204 wp_redirect( $location ); |
174 exit; |
205 exit; |
175 } elseif ( ! empty( $_GET['_wp_http_referer'] ) ) { |
206 } elseif ( ! empty( $_GET['_wp_http_referer'] ) ) { |
176 wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), wp_unslash( $_SERVER['REQUEST_URI'] ) ) ); |
207 wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), wp_unslash( $_SERVER['REQUEST_URI'] ) ) ); |
177 exit; |
208 exit; |
178 } |
209 } |
179 |
210 |
180 $wp_list_table->prepare_items(); |
211 $wp_list_table->prepare_items(); |
181 |
212 |
182 $title = __('Media Library'); |
213 $title = __( 'Media Library' ); |
183 $parent_file = 'upload.php'; |
214 $parent_file = 'upload.php'; |
184 |
215 |
185 wp_enqueue_script( 'media' ); |
216 wp_enqueue_script( 'media' ); |
186 |
217 |
187 add_screen_option( 'per_page' ); |
218 add_screen_option( 'per_page' ); |
188 |
219 |
189 get_current_screen()->add_help_tab( array( |
220 get_current_screen()->add_help_tab( |
190 'id' => 'overview', |
221 array( |
191 'title' => __('Overview'), |
222 'id' => 'overview', |
192 'content' => |
223 'title' => __( 'Overview' ), |
193 '<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>' . |
224 'content' => |
194 '<p>' . __( 'You can narrow the list by file type/status or by date using the dropdown menus above the media table.' ) . '</p>' . |
225 '<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>' . |
195 '<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>' |
226 '<p>' . __( 'You can narrow the list by file type/status or by date using the dropdown menus above the media table.' ) . '</p>' . |
196 ) ); |
227 '<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>', |
197 get_current_screen()->add_help_tab( array( |
228 ) |
198 'id' => 'actions-links', |
229 ); |
199 'title' => __('Available Actions'), |
230 get_current_screen()->add_help_tab( |
200 'content' => |
231 array( |
201 '<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>' |
232 'id' => 'actions-links', |
202 ) ); |
233 'title' => __( 'Available Actions' ), |
203 get_current_screen()->add_help_tab( array( |
234 'content' => |
204 'id' => 'attaching-files', |
235 '<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>', |
205 'title' => __('Attaching Files'), |
236 ) |
206 'content' => |
237 ); |
207 '<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>' |
238 get_current_screen()->add_help_tab( |
208 ) ); |
239 array( |
|
240 'id' => 'attaching-files', |
|
241 'title' => __( 'Attaching Files' ), |
|
242 'content' => |
|
243 '<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>', |
|
244 ) |
|
245 ); |
209 |
246 |
210 get_current_screen()->set_help_sidebar( |
247 get_current_screen()->set_help_sidebar( |
211 '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . |
248 '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . |
212 '<p>' . __( '<a href="https://codex.wordpress.org/Media_Library_Screen">Documentation on Media Library</a>' ) . '</p>' . |
249 '<p>' . __( '<a href="https://codex.wordpress.org/Media_Library_Screen">Documentation on Media Library</a>' ) . '</p>' . |
213 '<p>' . __( '<a href="https://wordpress.org/support/">Support Forums</a>' ) . '</p>' |
250 '<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>' |
214 ); |
251 ); |
215 |
252 |
216 get_current_screen()->set_screen_reader_content( array( |
253 get_current_screen()->set_screen_reader_content( |
217 'heading_views' => __( 'Filter media items list' ), |
254 array( |
218 'heading_pagination' => __( 'Media items list navigation' ), |
255 'heading_views' => __( 'Filter media items list' ), |
219 'heading_list' => __( 'Media items list' ), |
256 'heading_pagination' => __( 'Media items list navigation' ), |
220 ) ); |
257 'heading_list' => __( 'Media items list' ), |
|
258 ) |
|
259 ); |
221 |
260 |
222 require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
261 require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
223 ?> |
262 ?> |
224 |
263 |
225 <div class="wrap"> |
264 <div class="wrap"> |
226 <h1 class="wp-heading-inline"><?php echo esc_html( $title ); ?></h1> |
265 <h1 class="wp-heading-inline"><?php echo esc_html( $title ); ?></h1> |
227 |
266 |
228 <?php |
267 <?php |
229 if ( current_user_can( 'upload_files' ) ) { ?> |
268 if ( current_user_can( 'upload_files' ) ) { |
230 <a href="<?php echo admin_url( 'media-new.php' ); ?>" class="page-title-action"><?php echo esc_html_x( 'Add New', 'file' ); ?></a><?php |
269 ?> |
|
270 <a href="<?php echo admin_url( 'media-new.php' ); ?>" class="page-title-action"><?php echo esc_html_x( 'Add New', 'file' ); ?></a> |
|
271 <?php |
231 } |
272 } |
232 |
273 |
233 if ( isset( $_REQUEST['s'] ) && strlen( $_REQUEST['s'] ) ) { |
274 if ( isset( $_REQUEST['s'] ) && strlen( $_REQUEST['s'] ) ) { |
234 /* translators: %s: search keywords */ |
275 /* translators: %s: search keywords */ |
235 printf( '<span class="subtitle">' . __( 'Search results for “%s”' ) . '</span>', get_search_query() ); |
276 printf( '<span class="subtitle">' . __( 'Search results for “%s”' ) . '</span>', get_search_query() ); |
239 <hr class="wp-header-end"> |
280 <hr class="wp-header-end"> |
240 |
281 |
241 <?php |
282 <?php |
242 $message = ''; |
283 $message = ''; |
243 if ( ! empty( $_GET['posted'] ) ) { |
284 if ( ! empty( $_GET['posted'] ) ) { |
244 $message = __( 'Media file updated.' ); |
285 $message = __( 'Media file updated.' ); |
245 $_SERVER['REQUEST_URI'] = remove_query_arg(array('posted'), $_SERVER['REQUEST_URI']); |
286 $_SERVER['REQUEST_URI'] = remove_query_arg( array( 'posted' ), $_SERVER['REQUEST_URI'] ); |
246 } |
287 } |
247 |
288 |
248 if ( ! empty( $_GET['attached'] ) && $attached = absint( $_GET['attached'] ) ) { |
289 if ( ! empty( $_GET['attached'] ) && $attached = absint( $_GET['attached'] ) ) { |
249 if ( 1 == $attached ) { |
290 if ( 1 == $attached ) { |
250 $message = __( 'Media file attached.' ); |
291 $message = __( 'Media file attached.' ); |
251 } else { |
292 } else { |
252 /* translators: %s: number of media files */ |
293 /* translators: %s: number of media files */ |
253 $message = _n( '%s media file attached.', '%s media files attached.', $attached ); |
294 $message = _n( '%s media file attached.', '%s media files attached.', $attached ); |
254 } |
295 } |
255 $message = sprintf( $message, number_format_i18n( $attached ) ); |
296 $message = sprintf( $message, number_format_i18n( $attached ) ); |
256 $_SERVER['REQUEST_URI'] = remove_query_arg( array( 'detach', 'attached' ), $_SERVER['REQUEST_URI'] ); |
297 $_SERVER['REQUEST_URI'] = remove_query_arg( array( 'detach', 'attached' ), $_SERVER['REQUEST_URI'] ); |
257 } |
298 } |
258 |
299 |
259 if ( ! empty( $_GET['detach'] ) && $detached = absint( $_GET['detach'] ) ) { |
300 if ( ! empty( $_GET['detach'] ) && $detached = absint( $_GET['detach'] ) ) { |
260 if ( 1 == $detached ) { |
301 if ( 1 == $detached ) { |
261 $message = __( 'Media file detached.' ); |
302 $message = __( 'Media file detached.' ); |
262 } else { |
303 } else { |
263 /* translators: %s: number of media files */ |
304 /* translators: %s: number of media files */ |
264 $message = _n( '%s media file detached.', '%s media files detached.', $detached ); |
305 $message = _n( '%s media file detached.', '%s media files detached.', $detached ); |
265 } |
306 } |
266 $message = sprintf( $message, number_format_i18n( $detached ) ); |
307 $message = sprintf( $message, number_format_i18n( $detached ) ); |
267 $_SERVER['REQUEST_URI'] = remove_query_arg( array( 'detach', 'attached' ), $_SERVER['REQUEST_URI'] ); |
308 $_SERVER['REQUEST_URI'] = remove_query_arg( array( 'detach', 'attached' ), $_SERVER['REQUEST_URI'] ); |
268 } |
309 } |
269 |
310 |
270 if ( ! empty( $_GET['deleted'] ) && $deleted = absint( $_GET['deleted'] ) ) { |
311 if ( ! empty( $_GET['deleted'] ) && $deleted = absint( $_GET['deleted'] ) ) { |
271 if ( 1 == $deleted ) { |
312 if ( 1 == $deleted ) { |
272 $message = __( 'Media file permanently deleted.' ); |
313 $message = __( 'Media file permanently deleted.' ); |
273 } else { |
314 } else { |
274 /* translators: %s: number of media files */ |
315 /* translators: %s: number of media files */ |
275 $message = _n( '%s media file permanently deleted.', '%s media files permanently deleted.', $deleted ); |
316 $message = _n( '%s media file permanently deleted.', '%s media files permanently deleted.', $deleted ); |
276 } |
317 } |
277 $message = sprintf( $message, number_format_i18n( $deleted ) ); |
318 $message = sprintf( $message, number_format_i18n( $deleted ) ); |
278 $_SERVER['REQUEST_URI'] = remove_query_arg(array('deleted'), $_SERVER['REQUEST_URI']); |
319 $_SERVER['REQUEST_URI'] = remove_query_arg( array( 'deleted' ), $_SERVER['REQUEST_URI'] ); |
279 } |
320 } |
280 |
321 |
281 if ( ! empty( $_GET['trashed'] ) && $trashed = absint( $_GET['trashed'] ) ) { |
322 if ( ! empty( $_GET['trashed'] ) && $trashed = absint( $_GET['trashed'] ) ) { |
282 if ( 1 == $trashed ) { |
323 if ( 1 == $trashed ) { |
283 $message = __( 'Media file moved to the trash.' ); |
324 $message = __( 'Media file moved to the trash.' ); |
284 } else { |
325 } else { |
285 /* translators: %s: number of media files */ |
326 /* translators: %s: number of media files */ |
286 $message = _n( '%s media file moved to the trash.', '%s media files moved to the trash.', $trashed ); |
327 $message = _n( '%s media file moved to the trash.', '%s media files moved to the trash.', $trashed ); |
287 } |
328 } |
288 $message = sprintf( $message, number_format_i18n( $trashed ) ); |
329 $message = sprintf( $message, number_format_i18n( $trashed ) ); |
289 $message .= ' <a href="' . esc_url( wp_nonce_url( 'upload.php?doaction=undo&action=untrash&ids='.(isset($_GET['ids']) ? $_GET['ids'] : ''), "bulk-media" ) ) . '">' . __('Undo') . '</a>'; |
330 $message .= ' <a href="' . esc_url( wp_nonce_url( 'upload.php?doaction=undo&action=untrash&ids=' . ( isset( $_GET['ids'] ) ? $_GET['ids'] : '' ), 'bulk-media' ) ) . '">' . __( 'Undo' ) . '</a>'; |
290 $_SERVER['REQUEST_URI'] = remove_query_arg(array('trashed'), $_SERVER['REQUEST_URI']); |
331 $_SERVER['REQUEST_URI'] = remove_query_arg( array( 'trashed' ), $_SERVER['REQUEST_URI'] ); |
291 } |
332 } |
292 |
333 |
293 if ( ! empty( $_GET['untrashed'] ) && $untrashed = absint( $_GET['untrashed'] ) ) { |
334 if ( ! empty( $_GET['untrashed'] ) && $untrashed = absint( $_GET['untrashed'] ) ) { |
294 if ( 1 == $untrashed ) { |
335 if ( 1 == $untrashed ) { |
295 $message = __( 'Media file restored from the trash.' ); |
336 $message = __( 'Media file restored from the trash.' ); |
296 } else { |
337 } else { |
297 /* translators: %s: number of media files */ |
338 /* translators: %s: number of media files */ |
298 $message = _n( '%s media file restored from the trash.', '%s media files restored from the trash.', $untrashed ); |
339 $message = _n( '%s media file restored from the trash.', '%s media files restored from the trash.', $untrashed ); |
299 } |
340 } |
300 $message = sprintf( $message, number_format_i18n( $untrashed ) ); |
341 $message = sprintf( $message, number_format_i18n( $untrashed ) ); |
301 $_SERVER['REQUEST_URI'] = remove_query_arg(array('untrashed'), $_SERVER['REQUEST_URI']); |
342 $_SERVER['REQUEST_URI'] = remove_query_arg( array( 'untrashed' ), $_SERVER['REQUEST_URI'] ); |
302 } |
343 } |
303 |
344 |
304 $messages[1] = __( 'Media file updated.' ); |
345 $messages[1] = __( 'Media file updated.' ); |
305 $messages[2] = __( 'Media file permanently deleted.' ); |
346 $messages[2] = __( 'Media file permanently deleted.' ); |
306 $messages[3] = __( 'Error saving media file.' ); |
347 $messages[3] = __( 'Error saving media file.' ); |
307 $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>'; |
348 $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>'; |
308 $messages[5] = __( 'Media file restored from the trash.' ); |
349 $messages[5] = __( 'Media file restored from the trash.' ); |
309 |
350 |
310 if ( ! empty( $_GET['message'] ) && isset( $messages[ $_GET['message'] ] ) ) { |
351 if ( ! empty( $_GET['message'] ) && isset( $messages[ $_GET['message'] ] ) ) { |
311 $message = $messages[ $_GET['message'] ]; |
352 $message = $messages[ $_GET['message'] ]; |
312 $_SERVER['REQUEST_URI'] = remove_query_arg(array('message'), $_SERVER['REQUEST_URI']); |
353 $_SERVER['REQUEST_URI'] = remove_query_arg( array( 'message' ), $_SERVER['REQUEST_URI'] ); |
313 } |
354 } |
314 |
355 |
315 if ( !empty($message) ) { ?> |
356 if ( ! empty( $message ) ) { |
|
357 ?> |
316 <div id="message" class="updated notice is-dismissible"><p><?php echo $message; ?></p></div> |
358 <div id="message" class="updated notice is-dismissible"><p><?php echo $message; ?></p></div> |
317 <?php } ?> |
359 <?php } ?> |
318 |
360 |
319 <form id="posts-filter" method="get"> |
361 <form id="posts-filter" method="get"> |
320 |
362 |