Edit File by line
/home/barbar84/www/wp-admin
File: media-new.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* Manage media uploaded file.
[2] Fix | Delete
*
[3] Fix | Delete
* There are many filters in here for media. Plugins can extend functionality
[4] Fix | Delete
* by hooking into the filters.
[5] Fix | Delete
*
[6] Fix | Delete
* @package WordPress
[7] Fix | Delete
* @subpackage Administration
[8] Fix | Delete
*/
[9] Fix | Delete
[10] Fix | Delete
/** Load WordPress Administration Bootstrap */
[11] Fix | Delete
require_once __DIR__ . '/admin.php';
[12] Fix | Delete
[13] Fix | Delete
if ( ! current_user_can( 'upload_files' ) ) {
[14] Fix | Delete
wp_die( __( 'Sorry, you are not allowed to upload files.' ) );
[15] Fix | Delete
}
[16] Fix | Delete
[17] Fix | Delete
wp_enqueue_script( 'plupload-handlers' );
[18] Fix | Delete
[19] Fix | Delete
$post_id = 0;
[20] Fix | Delete
if ( isset( $_REQUEST['post_id'] ) ) {
[21] Fix | Delete
$post_id = absint( $_REQUEST['post_id'] );
[22] Fix | Delete
if ( ! get_post( $post_id ) || ! current_user_can( 'edit_post', $post_id ) ) {
[23] Fix | Delete
$post_id = 0;
[24] Fix | Delete
}
[25] Fix | Delete
}
[26] Fix | Delete
[27] Fix | Delete
if ( $_POST ) {
[28] Fix | Delete
if ( isset( $_POST['html-upload'] ) && ! empty( $_FILES ) ) {
[29] Fix | Delete
check_admin_referer( 'media-form' );
[30] Fix | Delete
// Upload File button was clicked.
[31] Fix | Delete
$upload_id = media_handle_upload( 'async-upload', $post_id );
[32] Fix | Delete
if ( is_wp_error( $upload_id ) ) {
[33] Fix | Delete
wp_die( $upload_id );
[34] Fix | Delete
}
[35] Fix | Delete
}
[36] Fix | Delete
wp_redirect( admin_url( 'upload.php' ) );
[37] Fix | Delete
exit;
[38] Fix | Delete
}
[39] Fix | Delete
[40] Fix | Delete
$title = __( 'Upload New Media' );
[41] Fix | Delete
$parent_file = 'upload.php';
[42] Fix | Delete
[43] Fix | Delete
get_current_screen()->add_help_tab(
[44] Fix | Delete
array(
[45] Fix | Delete
'id' => 'overview',
[46] Fix | Delete
'title' => __( 'Overview' ),
[47] Fix | Delete
'content' =>
[48] Fix | Delete
'<p>' . __( 'You can upload media files here without creating a post first. This allows you to upload files to use with posts and pages later and/or to get a web link for a particular file that you can share. There are three options for uploading files:' ) . '</p>' .
[49] Fix | Delete
'<ul>' .
[50] Fix | Delete
'<li>' . __( '<strong>Drag and drop</strong> your files into the area below. Multiple files are allowed.' ) . '</li>' .
[51] Fix | Delete
'<li>' . __( 'Clicking <strong>Select Files</strong> opens a navigation window showing you files in your operating system. Selecting <strong>Open</strong> after clicking on the file you want activates a progress bar on the uploader screen.' ) . '</li>' .
[52] Fix | Delete
'<li>' . __( 'Revert to the <strong>Browser Uploader</strong> by clicking the link below the drag and drop box.' ) . '</li>' .
[53] Fix | Delete
'</ul>',
[54] Fix | Delete
)
[55] Fix | Delete
);
[56] Fix | Delete
get_current_screen()->set_help_sidebar(
[57] Fix | Delete
'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
[58] Fix | Delete
'<p>' . __( '<a href="https://wordpress.org/support/article/media-add-new-screen/">Documentation on Uploading Media Files</a>' ) . '</p>' .
[59] Fix | Delete
'<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>'
[60] Fix | Delete
);
[61] Fix | Delete
[62] Fix | Delete
require_once ABSPATH . 'wp-admin/admin-header.php';
[63] Fix | Delete
[64] Fix | Delete
$form_class = 'media-upload-form type-form validate';
[65] Fix | Delete
[66] Fix | Delete
if ( get_user_setting( 'uploader' ) || isset( $_GET['browser-uploader'] ) ) {
[67] Fix | Delete
$form_class .= ' html-uploader';
[68] Fix | Delete
}
[69] Fix | Delete
?>
[70] Fix | Delete
<div class="wrap">
[71] Fix | Delete
<h1><?php echo esc_html( $title ); ?></h1>
[72] Fix | Delete
[73] Fix | Delete
<form enctype="multipart/form-data" method="post" action="<?php echo admin_url( 'media-new.php' ); ?>" class="<?php echo esc_attr( $form_class ); ?>" id="file-form">
[74] Fix | Delete
[75] Fix | Delete
<?php media_upload_form(); ?>
[76] Fix | Delete
[77] Fix | Delete
<script type="text/javascript">
[78] Fix | Delete
var post_id = <?php echo absint( $post_id ); ?>, shortform = 3;
[79] Fix | Delete
</script>
[80] Fix | Delete
<input type="hidden" name="post_id" id="post_id" value="<?php echo absint( $post_id ); ?>" />
[81] Fix | Delete
<?php wp_nonce_field( 'media-form' ); ?>
[82] Fix | Delete
<div id="media-items" class="hide-if-no-js"></div>
[83] Fix | Delete
</form>
[84] Fix | Delete
</div>
[85] Fix | Delete
[86] Fix | Delete
<?php
[87] Fix | Delete
require_once ABSPATH . 'wp-admin/admin-footer.php';
[88] Fix | Delete
[89] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function