wp/wp-admin/media-upload.php
changeset 16 a86126ab1dd4
parent 9 177826044cd9
child 18 be944660c56a
--- a/wp/wp-admin/media-upload.php	Tue Oct 22 16:11:46 2019 +0200
+++ b/wp/wp-admin/media-upload.php	Tue Dec 15 13:49:49 2020 +0100
@@ -14,7 +14,7 @@
 }
 
 /** Load WordPress Administration Bootstrap */
-require_once( dirname( __FILE__ ) . '/admin.php' );
+require_once __DIR__ . '/admin.php';
 
 if ( ! current_user_can( 'upload_files' ) ) {
 	wp_die( __( 'Sorry, you are not allowed to upload files.' ), 403 );
@@ -26,14 +26,14 @@
 wp_enqueue_style( 'imgareaselect' );
 wp_enqueue_script( 'media-gallery' );
 
-@header( 'Content-Type: ' . get_option( 'html_type' ) . '; charset=' . get_option( 'blog_charset' ) );
+header( 'Content-Type: ' . get_option( 'html_type' ) . '; charset=' . get_option( 'blog_charset' ) );
 
-// IDs should be integers
-$ID      = isset( $ID ) ? (int) $ID : 0;
+// IDs should be integers.
+$ID      = isset( $ID ) ? (int) $ID : 0; // phpcs:ignore WordPress.NamingConventions.ValidVariableName
 $post_id = isset( $post_id ) ? (int) $post_id : 0;
 
 // Require an ID for the edit screen.
-if ( isset( $action ) && $action == 'edit' && ! $ID ) {
+if ( isset( $action ) && 'edit' === $action && ! $ID ) { // phpcs:ignore WordPress.NamingConventions.ValidVariableName
 	wp_die(
 		'<h1>' . __( 'Something went wrong.' ) . '</h1>' .
 		'<p>' . __( 'Invalid item ID.' ) . '</p>',
@@ -49,7 +49,7 @@
 	);
 }
 
-// Upload type: image, video, file, ..?
+// Upload type: image, video, file, ...?
 if ( isset( $_GET['type'] ) ) {
 	$type = strval( $_GET['type'] );
 } else {
@@ -81,7 +81,7 @@
 $body_id = 'media-upload';
 
 // Let the action code decide how to handle the request.
-if ( $tab == 'type' || $tab == 'type_url' || ! array_key_exists( $tab, media_upload_tabs() ) ) {
+if ( 'type' === $tab || 'type_url' === $tab || ! array_key_exists( $tab, media_upload_tabs() ) ) {
 	/**
 	 * Fires inside specific upload-type views in the legacy (pre-3.5.0)
 	 * media popup based on the current tab.