2008-03-17 23:53:14 +01:00
< ? php
2008-08-16 09:27:34 +02:00
/**
* Media Library administration panel .
*
* @ package WordPress
* @ subpackage Administration
*/
/** WordPress Administration Bootstrap */
2020-02-06 07:33:11 +01:00
require_once __DIR__ . '/admin.php' ;
2008-03-17 23:53:14 +01:00
2017-12-01 00:11:00 +01:00
if ( ! current_user_can ( 'upload_files' ) ) {
2016-06-29 17:16:29 +02:00
wp_die ( __ ( 'Sorry, you are not allowed to upload files.' ) );
2017-12-01 00:11:00 +01:00
}
2010-12-16 09:43:22 +01:00
2023-02-01 20:47:12 +01:00
$message = '' ;
if ( ! empty ( $_GET [ 'posted' ] ) ) {
2023-04-06 19:39:24 +02:00
$message = __ ( 'Media file updated.' );
2023-02-01 20:47:12 +01:00
$_SERVER [ 'REQUEST_URI' ] = remove_query_arg ( array ( 'posted' ), $_SERVER [ 'REQUEST_URI' ] );
unset ( $_GET [ 'posted' ] );
}
if ( ! empty ( $_GET [ 'attached' ] ) && absint ( $_GET [ 'attached' ] ) ) {
$attached = absint ( $_GET [ 'attached' ] );
2023-04-06 19:39:24 +02:00
2023-02-01 20:47:12 +01:00
if ( 1 === $attached ) {
$message = __ ( 'Media file attached.' );
} else {
2023-04-06 19:39:24 +02:00
$message = sprintf (
/* translators: %s: Number of media files. */
_n ( '%s media file attached.' , '%s media files attached.' , $attached ),
number_format_i18n ( $attached )
);
2023-02-01 20:47:12 +01:00
}
2023-04-06 19:39:24 +02:00
2023-02-01 20:47:12 +01:00
$_SERVER [ 'REQUEST_URI' ] = remove_query_arg ( array ( 'detach' , 'attached' ), $_SERVER [ 'REQUEST_URI' ] );
unset ( $_GET [ 'detach' ], $_GET [ 'attached' ] );
}
if ( ! empty ( $_GET [ 'detach' ] ) && absint ( $_GET [ 'detach' ] ) ) {
$detached = absint ( $_GET [ 'detach' ] );
2023-04-06 19:39:24 +02:00
2023-02-01 20:47:12 +01:00
if ( 1 === $detached ) {
$message = __ ( 'Media file detached.' );
} else {
2023-04-06 19:39:24 +02:00
$message = sprintf (
/* translators: %s: Number of media files. */
_n ( '%s media file detached.' , '%s media files detached.' , $detached ),
number_format_i18n ( $detached )
);
2023-02-01 20:47:12 +01:00
}
2023-04-06 19:39:24 +02:00
2023-02-01 20:47:12 +01:00
$_SERVER [ 'REQUEST_URI' ] = remove_query_arg ( array ( 'detach' , 'attached' ), $_SERVER [ 'REQUEST_URI' ] );
unset ( $_GET [ 'detach' ], $_GET [ 'attached' ] );
}
if ( ! empty ( $_GET [ 'deleted' ] ) && absint ( $_GET [ 'deleted' ] ) ) {
$deleted = absint ( $_GET [ 'deleted' ] );
2023-04-06 19:39:24 +02:00
2023-02-01 20:47:12 +01:00
if ( 1 === $deleted ) {
$message = __ ( 'Media file permanently deleted.' );
} else {
2023-04-06 19:39:24 +02:00
$message = sprintf (
/* translators: %s: Number of media files. */
_n ( '%s media file permanently deleted.' , '%s media files permanently deleted.' , $deleted ),
number_format_i18n ( $deleted )
);
2023-02-01 20:47:12 +01:00
}
2023-04-06 19:39:24 +02:00
2023-02-01 20:47:12 +01:00
$_SERVER [ 'REQUEST_URI' ] = remove_query_arg ( array ( 'deleted' ), $_SERVER [ 'REQUEST_URI' ] );
unset ( $_GET [ 'deleted' ] );
}
if ( ! empty ( $_GET [ 'trashed' ] ) && absint ( $_GET [ 'trashed' ] ) ) {
$trashed = absint ( $_GET [ 'trashed' ] );
2023-04-06 19:39:24 +02:00
2023-02-01 20:47:12 +01:00
if ( 1 === $trashed ) {
$message = __ ( 'Media file moved to the Trash.' );
} else {
2023-04-06 19:39:24 +02:00
$message = sprintf (
/* translators: %s: Number of media files. */
_n ( '%s media file moved to the Trash.' , '%s media files moved to the Trash.' , $trashed ),
number_format_i18n ( $trashed )
);
2023-02-01 20:47:12 +01:00
}
2023-04-06 19:39:24 +02:00
$message .= sprintf (
' <a href="%1$s">%2$s</a>' ,
esc_url ( wp_nonce_url ( 'upload.php?doaction=undo&action=untrash&ids=' . ( isset ( $_GET [ 'ids' ] ) ? $_GET [ 'ids' ] : '' ), 'bulk-media' ) ),
__ ( 'Undo' )
);
2023-02-01 20:47:12 +01:00
$_SERVER [ 'REQUEST_URI' ] = remove_query_arg ( array ( 'trashed' ), $_SERVER [ 'REQUEST_URI' ] );
unset ( $_GET [ 'trashed' ] );
}
if ( ! empty ( $_GET [ 'untrashed' ] ) && absint ( $_GET [ 'untrashed' ] ) ) {
$untrashed = absint ( $_GET [ 'untrashed' ] );
2023-04-06 19:39:24 +02:00
2023-02-01 20:47:12 +01:00
if ( 1 === $untrashed ) {
$message = __ ( 'Media file restored from the Trash.' );
} else {
2023-04-06 19:39:24 +02:00
$message = sprintf (
/* translators: %s: Number of media files. */
_n ( '%s media file restored from the Trash.' , '%s media files restored from the Trash.' , $untrashed ),
number_format_i18n ( $untrashed )
);
2023-02-01 20:47:12 +01:00
}
2023-04-06 19:39:24 +02:00
2023-02-01 20:47:12 +01:00
$_SERVER [ 'REQUEST_URI' ] = remove_query_arg ( array ( 'untrashed' ), $_SERVER [ 'REQUEST_URI' ] );
unset ( $_GET [ 'untrashed' ] );
}
$messages [ 1 ] = __ ( 'Media file updated.' );
$messages [ 2 ] = __ ( 'Media file permanently deleted.' );
$messages [ 3 ] = __ ( 'Error saving media file.' );
2023-04-06 19:39:24 +02:00
$messages [ 4 ] = __ ( 'Media file moved to the Trash.' ) . sprintf (
' <a href="%1$s">%2$s</a>' ,
esc_url ( wp_nonce_url ( 'upload.php?doaction=undo&action=untrash&ids=' . ( isset ( $_GET [ 'ids' ] ) ? $_GET [ 'ids' ] : '' ), 'bulk-media' ) ),
__ ( 'Undo' )
);
2023-02-01 20:47:12 +01:00
$messages [ 5 ] = __ ( 'Media file restored from the Trash.' );
if ( ! empty ( $_GET [ 'message' ] ) && isset ( $messages [ $_GET [ 'message' ] ] ) ) {
2023-04-06 19:39:24 +02:00
$message = $messages [ $_GET [ 'message' ] ];
2023-02-01 20:47:12 +01:00
$_SERVER [ 'REQUEST_URI' ] = remove_query_arg ( array ( 'message' ), $_SERVER [ 'REQUEST_URI' ] );
}
2017-12-01 00:11:00 +01:00
$mode = get_user_option ( 'media_library_mode' , get_current_user_id () ) ? get_user_option ( 'media_library_mode' , get_current_user_id () ) : 'grid' ;
2014-06-06 00:01:18 +02:00
$modes = array ( 'grid' , 'list' );
2020-04-05 05:02:11 +02:00
if ( isset ( $_GET [ 'mode' ] ) && in_array ( $_GET [ 'mode' ], $modes , true ) ) {
2014-06-06 00:01:18 +02:00
$mode = $_GET [ 'mode' ];
update_user_option ( get_current_user_id (), 'media_library_mode' , $mode );
}
if ( 'grid' === $mode ) {
wp_enqueue_media ();
2014-07-04 04:18:14 +02:00
wp_enqueue_script ( 'media-grid' );
2014-06-06 00:01:18 +02:00
wp_enqueue_script ( 'media' );
2015-01-03 09:24:22 +01:00
2023-06-20 01:20:21 +02:00
// Remove the error parameter added by deprecation of wp-admin/media.php.
add_filter (
'removable_query_args' ,
2023-09-12 17:23:18 +02:00
function () {
2023-06-20 01:20:21 +02:00
return array ( 'error' );
},
10 ,
0
);
2015-09-17 04:30:26 +02:00
2015-02-27 00:01:25 +01:00
$q = $_GET ;
2020-01-29 01:45:18 +01:00
// Let JS handle this.
2015-02-27 00:01:25 +01:00
unset ( $q [ 's' ] );
2017-12-01 00:11:00 +01:00
$vars = wp_edit_attachments_query_vars ( $q );
2015-01-04 03:07:23 +01:00
$ignore = array ( 'mode' , 'post_type' , 'post_status' , 'posts_per_page' );
foreach ( $vars as $key => $value ) {
2020-04-05 05:02:11 +02:00
if ( ! $value || in_array ( $key , $ignore , true ) ) {
2015-01-04 03:07:23 +01:00
unset ( $vars [ $key ] );
}
}
2015-01-03 09:24:22 +01:00
2017-12-01 00:11:00 +01:00
wp_localize_script (
2018-08-17 03:51:36 +02:00
'media-grid' ,
'_wpMediaGridSettings' ,
array (
2017-12-01 00:11:00 +01:00
'adminUrl' => parse_url ( self_admin_url (), PHP_URL_PATH ),
'queryVars' => ( object ) $vars ,
)
);
get_current_screen () -> add_help_tab (
array (
'id' => 'overview' ,
'title' => __ ( 'Overview' ),
'content' =>
'<p>' . __ ( 'All the files you’ve uploaded are listed in the Media Library, with the most recent uploads listed first.' ) . '</p>' .
'<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>' .
'<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>' ,
)
);
get_current_screen () -> add_help_tab (
array (
'id' => 'attachment-details' ,
'title' => __ ( 'Attachment Details' ),
'content' =>
'<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>' .
'<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>' .
'<p>' . __ ( 'You can also delete individual items and access the extended edit screen from the details dialog.' ) . '</p>' ,
)
);
2014-07-13 18:16:15 +02:00
get_current_screen () -> set_help_sidebar (
'<p><strong>' . __ ( 'For more information:' ) . '</strong></p>' .
2023-02-23 11:38:21 +01:00
'<p>' . __ ( '<a href="https://wordpress.org/documentation/article/media-library-screen/">Documentation on Media Library</a>' ) . '</p>' .
'<p>' . __ ( '<a href="https://wordpress.org/support/forums/">Support forums</a>' ) . '</p>'
2014-07-13 18:16:15 +02:00
);
2021-07-22 15:53:00 +02:00
// Used in the HTML title tag.
2017-12-01 00:11:00 +01:00
$title = __ ( 'Media Library' );
2014-07-13 18:16:15 +02:00
$parent_file = 'upload.php' ;
2020-02-06 07:33:11 +01:00
require_once ABSPATH . 'wp-admin/admin-header.php' ;
2014-07-13 18:16:15 +02:00
?>
2017-12-01 00:11:00 +01:00
< div class = " wrap " id = " wp-media-grid " data - search = " <?php _admin_search_query(); ?> " >
2016-12-06 23:18:42 +01:00
< h1 class = " wp-heading-inline " >< ? php echo esc_html ( $title ); ?> </h1>
2014-07-13 18:16:15 +02:00
< ? php
2017-12-01 00:11:00 +01:00
if ( current_user_can ( 'upload_files' ) ) {
2018-08-17 03:51:36 +02:00
?>
2023-09-05 21:26:26 +02:00
< a href = " <?php echo esc_url( admin_url( 'media-new.php' ) ); ?> " class = " page-title-action aria-button-if-js " >< ? php echo esc_html__ ( 'Add New Media File' ); ?> </a>
2021-06-21 06:30:56 +02:00
< ? php
2014-07-13 18:16:15 +02:00
}
?>
2016-12-06 23:18:42 +01:00
< hr class = " wp-header-end " >
2023-02-01 20:47:12 +01:00
< ? php if ( ! empty ( $message ) ) : ?>
< div id = " message " class = " updated notice is-dismissible " >< p >< ? php echo $message ; ?> </p></div>
< ? php endif ; ?>
2014-07-15 22:45:15 +02:00
< div class = " error hide-if-js " >
2017-12-01 00:11:00 +01:00
< p >
< ? php
printf (
2019-09-03 02:41:05 +02:00
/* translators: %s: List view URL. */
2016-02-24 02:48:27 +01:00
__ ( 'The grid view for the Media Library requires JavaScript. <a href="%s">Switch to the list view</a>.' ),
'upload.php?mode=list'
2017-12-01 00:11:00 +01:00
);
?>
</ p >
2014-07-15 22:45:15 +02:00
</ div >
2014-07-13 18:16:15 +02:00
</ div >
< ? php
2020-02-06 07:33:11 +01:00
require_once ABSPATH . 'wp-admin/admin-footer.php' ;
2014-06-06 00:01:18 +02:00
exit ;
}
2017-12-01 00:11:00 +01:00
$wp_list_table = _get_list_table ( 'WP_Media_List_Table' );
$pagenum = $wp_list_table -> get_pagenum ();
2008-03-17 23:53:14 +01:00
2020-01-29 01:45:18 +01:00
// Handle bulk actions.
2010-09-22 02:10:39 +02:00
$doaction = $wp_list_table -> current_action ();
2008-09-16 06:24:28 +02:00
2010-09-22 02:10:39 +02:00
if ( $doaction ) {
2017-12-01 00:11:00 +01:00
check_admin_referer ( 'bulk-media' );
2021-06-15 19:04:56 +02:00
2021-06-09 00:08:09 +02:00
$post_ids = array ();
2009-09-14 16:03:32 +02:00
2020-05-16 20:42:12 +02:00
if ( 'delete_all' === $doaction ) {
2009-07-30 15:39:34 +02:00
$post_ids = $wpdb -> get_col ( " SELECT ID FROM $wpdb->posts WHERE post_type='attachment' AND post_status = 'trash' " );
$doaction = 'delete' ;
2010-09-22 02:10:39 +02:00
} elseif ( isset ( $_REQUEST [ 'media' ] ) ) {
$post_ids = $_REQUEST [ 'media' ];
} elseif ( isset ( $_REQUEST [ 'ids' ] ) ) {
$post_ids = explode ( ',' , $_REQUEST [ 'ids' ] );
2009-11-17 04:08:38 +01:00
}
2023-02-01 23:17:15 +01:00
$post_ids = array_map ( 'intval' , ( array ) $post_ids );
2009-09-14 16:03:32 +02:00
2009-07-30 15:39:34 +02:00
$location = 'upload.php' ;
2019-07-01 14:52:01 +02:00
$referer = wp_get_referer ();
if ( $referer ) {
Code Modernization: Replace usage of `strpos()` with `str_contains()`.
`str_contains()` was introduced in PHP 8.0 to perform a case-sensitive check indicating if the string to search in (haystack) contains the given substring (needle).
WordPress core includes a polyfill for `str_contains()` on PHP < 8.0 as of WordPress 5.9.
This commit replaces `false !== strpos( ... )` with `str_contains()` in core files, making the code more readable and consistent, as well as better aligned with modern development practices.
Follow-up to [52039], [52040], [52326], [55703], [55710], [55987].
Props Soean, spacedmonkey, costdev, dingo_d, azaozz, mikeschroder, flixos90, peterwilsoncc, SergeyBiryukov.
Fixes #58206.
Built from https://develop.svn.wordpress.org/trunk@55988
git-svn-id: http://core.svn.wordpress.org/trunk@55500 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-22 16:36:26 +02:00
if ( str_contains ( $referer , 'upload.php' ) ) {
2010-08-11 23:54:51 +02:00
$location = remove_query_arg ( array ( 'trashed' , 'untrashed' , 'deleted' , 'message' , 'ids' , 'posted' ), $referer );
2017-12-01 00:11:00 +01:00
}
2009-07-30 15:39:34 +02:00
}
2008-03-17 23:53:14 +01:00
2009-07-30 15:39:34 +02:00
switch ( $doaction ) {
2015-03-05 06:35:28 +01:00
case 'detach' :
wp_media_attach_action ( $_REQUEST [ 'parent_post_id' ], 'detach' );
break ;
2010-09-22 02:10:39 +02:00
2015-03-05 06:35:28 +01:00
case 'attach' :
wp_media_attach_action ( $_REQUEST [ 'found_post_id' ] );
2010-09-22 02:10:39 +02:00
break ;
2015-03-05 06:35:28 +01:00
2009-07-30 15:39:34 +02:00
case 'trash' :
2021-06-15 18:51:59 +02:00
if ( empty ( $post_ids ) ) {
2011-10-04 18:00:36 +02:00
break ;
2017-12-01 00:11:00 +01:00
}
2023-02-01 23:17:15 +01:00
foreach ( $post_ids as $post_id ) {
2017-12-01 00:11:00 +01:00
if ( ! current_user_can ( 'delete_post' , $post_id ) ) {
2016-06-29 17:16:29 +02:00
wp_die ( __ ( 'Sorry, you are not allowed to move this item to the Trash.' ) );
2017-12-01 00:11:00 +01:00
}
2009-09-14 16:03:32 +02:00
2017-12-01 00:11:00 +01:00
if ( ! wp_trash_post ( $post_id ) ) {
2020-07-05 12:41:10 +02:00
wp_die ( __ ( 'Error in moving the item to Trash.' ) );
2017-12-01 00:11:00 +01:00
}
2009-07-30 15:39:34 +02:00
}
2017-12-01 00:11:00 +01:00
$location = add_query_arg (
array (
'trashed' => count ( $post_ids ),
2020-10-18 19:27:06 +02:00
'ids' => implode ( ',' , $post_ids ),
2018-08-17 03:51:36 +02:00
),
$location
2017-12-01 00:11:00 +01:00
);
2009-07-30 15:39:34 +02:00
break ;
case 'untrash' :
2021-06-15 18:51:59 +02:00
if ( empty ( $post_ids ) ) {
2011-10-04 18:00:36 +02:00
break ;
2017-12-01 00:11:00 +01:00
}
2023-02-01 23:17:15 +01:00
foreach ( $post_ids as $post_id ) {
2017-12-01 00:11:00 +01:00
if ( ! current_user_can ( 'delete_post' , $post_id ) ) {
2016-07-04 23:48:28 +02:00
wp_die ( __ ( 'Sorry, you are not allowed to restore this item from the Trash.' ) );
2017-12-01 00:11:00 +01:00
}
2009-09-14 16:03:32 +02:00
2017-12-01 00:11:00 +01:00
if ( ! wp_untrash_post ( $post_id ) ) {
2020-07-05 12:41:10 +02:00
wp_die ( __ ( 'Error in restoring the item from Trash.' ) );
2017-12-01 00:11:00 +01:00
}
2009-07-30 15:39:34 +02:00
}
2010-08-11 23:54:51 +02:00
$location = add_query_arg ( 'untrashed' , count ( $post_ids ), $location );
2009-07-30 15:39:34 +02:00
break ;
case 'delete' :
2021-06-15 18:51:59 +02:00
if ( empty ( $post_ids ) ) {
2011-10-04 18:00:36 +02:00
break ;
2017-12-01 00:11:00 +01:00
}
2023-02-01 23:17:15 +01:00
foreach ( $post_ids as $post_id_del ) {
2017-12-01 00:11:00 +01:00
if ( ! current_user_can ( 'delete_post' , $post_id_del ) ) {
2016-06-29 17:16:29 +02:00
wp_die ( __ ( 'Sorry, you are not allowed to delete this item.' ) );
2017-12-01 00:11:00 +01:00
}
2009-09-14 16:03:32 +02:00
2017-12-01 00:11:00 +01:00
if ( ! wp_delete_attachment ( $post_id_del ) ) {
2020-07-05 12:41:10 +02:00
wp_die ( __ ( 'Error in deleting the attachment.' ) );
2017-12-01 00:11:00 +01:00
}
2009-07-30 15:39:34 +02:00
}
2010-08-11 23:54:51 +02:00
$location = add_query_arg ( 'deleted' , count ( $post_ids ), $location );
2009-07-30 15:39:34 +02:00
break ;
2016-09-23 22:33:30 +02:00
default :
2019-12-03 14:58:05 +01:00
$screen = get_current_screen () -> id ;
/** This action is documented in wp-admin/edit.php */
$location = apply_filters ( " handle_bulk_actions- { $screen } " , $location , $doaction , $post_ids ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
2008-08-20 06:06:36 +02:00
}
2009-07-30 15:39:34 +02:00
2010-08-11 23:54:51 +02:00
wp_redirect ( $location );
2009-07-30 15:39:34 +02:00
exit ;
2011-01-15 03:03:46 +01:00
} elseif ( ! empty ( $_GET [ '_wp_http_referer' ] ) ) {
2017-11-27 00:57:55 +01:00
wp_redirect ( remove_query_arg ( array ( '_wp_http_referer' , '_wpnonce' ), wp_unslash ( $_SERVER [ 'REQUEST_URI' ] ) ) );
exit ;
2008-03-17 23:53:14 +01:00
}
2010-08-22 13:22:46 +02:00
$wp_list_table -> prepare_items ();
2008-03-17 23:53:14 +01:00
2021-07-22 15:53:00 +02:00
// Used in the HTML title tag.
2017-12-01 00:11:00 +01:00
$title = __ ( 'Media Library' );
2010-08-11 23:54:51 +02:00
$parent_file = 'upload.php' ;
2009-07-30 15:39:34 +02:00
2010-08-11 23:54:51 +02:00
wp_enqueue_script ( 'media' );
2010-05-26 00:38:29 +02:00
2015-03-10 16:32:27 +01:00
add_screen_option ( 'per_page' );
2011-10-07 06:57:12 +02:00
2017-12-01 00:11:00 +01:00
get_current_screen () -> add_help_tab (
array (
'id' => 'overview' ,
'title' => __ ( 'Overview' ),
'content' =>
2019-07-05 07:21:56 +02:00
'<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>' .
'<p>' . __ ( 'You can narrow the list by file type/status or by date using the dropdown menus above the media table.' ) . '</p>' .
'<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>' ,
2017-12-01 00:11:00 +01:00
)
);
get_current_screen () -> add_help_tab (
array (
'id' => 'actions-links' ,
'title' => __ ( 'Available Actions' ),
'content' =>
2022-06-28 22:47:11 +02:00
'<p>' . __ ( 'Hovering over a row reveals action links that allow you to manage media items. You can perform the following actions:' ) . '</p>' .
'<ul>' .
2022-06-29 15:39:14 +02:00
'<li>' . __ ( '<strong>Edit</strong> takes you to a simple screen to edit that individual file’s metadata. You can also reach that screen by clicking on the media file name or thumbnail.' ) . '</li>' .
2022-06-28 22:47:11 +02:00
'<li>' . __ ( '<strong>Delete Permanently</strong> will delete the file from the media library (as well as from any posts to which it is currently attached).' ) . '</li>' .
'<li>' . __ ( '<strong>View</strong> will take you to a public display page for that file.' ) . '</li>' .
2023-02-02 23:48:16 +01:00
'<li>' . __ ( '<strong>Copy URL</strong> copies the URL for the media file to your clipboard.' ) . '</li>' .
'<li>' . __ ( '<strong>Download file</strong> downloads the original media file to your device.' ) . '</li>' .
2022-06-28 22:47:11 +02:00
'</ul>' ,
2017-12-01 00:11:00 +01:00
)
);
get_current_screen () -> add_help_tab (
array (
'id' => 'attaching-files' ,
'title' => __ ( 'Attaching Files' ),
'content' =>
2019-07-05 07:21:56 +02:00
'<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>' ,
2017-12-01 00:11:00 +01:00
)
);
2011-11-02 04:12:37 +01:00
2011-11-02 21:14:10 +01:00
get_current_screen () -> set_help_sidebar (
2011-10-07 06:57:12 +02:00
'<p><strong>' . __ ( 'For more information:' ) . '</strong></p>' .
2023-02-23 11:38:21 +01:00
'<p>' . __ ( '<a href="https://wordpress.org/documentation/article/media-library-screen/">Documentation on Media Library</a>' ) . '</p>' .
'<p>' . __ ( '<a href="https://wordpress.org/support/forums/">Support forums</a>' ) . '</p>'
2010-05-26 00:38:29 +02:00
);
2017-12-01 00:11:00 +01:00
get_current_screen () -> set_screen_reader_content (
array (
'heading_views' => __ ( 'Filter media items list' ),
'heading_pagination' => __ ( 'Media items list navigation' ),
'heading_list' => __ ( 'Media items list' ),
)
);
2015-10-07 03:28:25 +02:00
2020-02-06 07:33:11 +01:00
require_once ABSPATH . 'wp-admin/admin-header.php' ;
2009-09-19 03:06:17 +02:00
?>
< div class = " wrap " >
2016-12-06 23:18:42 +01:00
< h1 class = " wp-heading-inline " >< ? php echo esc_html ( $title ); ?> </h1>
2012-04-10 05:18:48 +02:00
< ? php
2017-12-01 00:11:00 +01:00
if ( current_user_can ( 'upload_files' ) ) {
2018-08-17 03:51:36 +02:00
?>
2023-09-05 21:26:26 +02:00
< a href = " <?php echo esc_url( admin_url( 'media-new.php' ) ); ?> " class = " page-title-action " >< ? php echo esc_html__ ( 'Add New Media File' ); ?> </a>
2017-12-01 00:11:00 +01:00
< ? php
2012-04-10 05:18:48 +02:00
}
2016-12-06 23:18:42 +01:00
2016-01-14 21:06:25 +01:00
if ( isset ( $_REQUEST [ 's' ] ) && strlen ( $_REQUEST [ 's' ] ) ) {
2020-10-23 19:19:14 +02:00
echo '<span class="subtitle">' ;
printf (
/* translators: %s: Search query. */
__ ( 'Search results for: %s' ),
'<strong>' . get_search_query () . '</strong>'
);
echo '</span>' ;
2016-01-14 21:06:25 +01:00
}
?>
2016-12-06 23:18:42 +01:00
< hr class = " wp-header-end " >
2009-09-19 03:06:17 +02:00
2023-02-01 20:47:12 +01:00
< ? php if ( ! empty ( $message ) ) : ?>
2015-04-02 00:06:28 +02:00
< div id = " message " class = " updated notice is-dismissible " >< p >< ? php echo $message ; ?> </p></div>
2023-02-01 20:47:12 +01:00
< ? php endif ; ?>
2008-11-05 21:30:26 +01:00
2015-01-16 05:16:24 +01:00
< form id = " posts-filter " method = " get " >
2010-12-10 21:22:34 +01:00
2014-08-26 17:58:15 +02:00
< ? php $wp_list_table -> views (); ?>
2010-12-10 21:22:34 +01:00
2010-08-22 13:22:46 +02:00
< ? php $wp_list_table -> display (); ?>
2010-12-10 21:22:34 +01:00
2014-03-05 04:54:15 +01:00
< div id = " ajax-response " ></ div >
2014-06-06 00:01:18 +02:00
< ? php find_posts_div (); ?>
2010-12-24 15:19:41 +01:00
</ form >
2008-03-17 23:53:14 +01:00
</ div >
2008-09-16 06:24:28 +02:00
< ? php
2020-02-06 07:33:11 +01:00
require_once ABSPATH . 'wp-admin/admin-footer.php' ;