Edit File by line
/home/barbar84/www/wp-admin/includes
File: media.php
*
[3000] Fix | Delete
* @since 2.6.0
[3001] Fix | Delete
*
[3002] Fix | Delete
* @global int $post_ID
[3003] Fix | Delete
*/
[3004] Fix | Delete
function media_upload_flash_bypass() {
[3005] Fix | Delete
$browser_uploader = admin_url( 'media-new.php?browser-uploader' );
[3006] Fix | Delete
[3007] Fix | Delete
$post = get_post();
[3008] Fix | Delete
if ( $post ) {
[3009] Fix | Delete
$browser_uploader .= '&post_id=' . (int) $post->ID;
[3010] Fix | Delete
} elseif ( ! empty( $GLOBALS['post_ID'] ) ) {
[3011] Fix | Delete
$browser_uploader .= '&post_id=' . (int) $GLOBALS['post_ID'];
[3012] Fix | Delete
}
[3013] Fix | Delete
[3014] Fix | Delete
?>
[3015] Fix | Delete
<p class="upload-flash-bypass">
[3016] Fix | Delete
<?php
[3017] Fix | Delete
printf(
[3018] Fix | Delete
/* translators: 1: URL to browser uploader, 2: Additional link attributes. */
[3019] Fix | Delete
__( 'You are using the multi-file uploader. Problems? Try the <a href="%1$s" %2$s>browser uploader</a> instead.' ),
[3020] Fix | Delete
$browser_uploader,
[3021] Fix | Delete
'target="_blank"'
[3022] Fix | Delete
);
[3023] Fix | Delete
?>
[3024] Fix | Delete
</p>
[3025] Fix | Delete
<?php
[3026] Fix | Delete
}
[3027] Fix | Delete
[3028] Fix | Delete
/**
[3029] Fix | Delete
* Displays the browser's built-in uploader message.
[3030] Fix | Delete
*
[3031] Fix | Delete
* @since 2.6.0
[3032] Fix | Delete
*/
[3033] Fix | Delete
function media_upload_html_bypass() {
[3034] Fix | Delete
?>
[3035] Fix | Delete
<p class="upload-html-bypass hide-if-no-js">
[3036] Fix | Delete
<?php _e( 'You are using the browser&#8217;s built-in file uploader. The WordPress uploader includes multiple file selection and drag and drop capability. <a href="#">Switch to the multi-file uploader</a>.' ); ?>
[3037] Fix | Delete
</p>
[3038] Fix | Delete
<?php
[3039] Fix | Delete
}
[3040] Fix | Delete
[3041] Fix | Delete
/**
[3042] Fix | Delete
* Used to display a "After a file has been uploaded..." help message.
[3043] Fix | Delete
*
[3044] Fix | Delete
* @since 3.3.0
[3045] Fix | Delete
*/
[3046] Fix | Delete
function media_upload_text_after() {}
[3047] Fix | Delete
[3048] Fix | Delete
/**
[3049] Fix | Delete
* Displays the checkbox to scale images.
[3050] Fix | Delete
*
[3051] Fix | Delete
* @since 3.3.0
[3052] Fix | Delete
*/
[3053] Fix | Delete
function media_upload_max_image_resize() {
[3054] Fix | Delete
$checked = get_user_setting( 'upload_resize' ) ? ' checked="true"' : '';
[3055] Fix | Delete
$a = '';
[3056] Fix | Delete
$end = '';
[3057] Fix | Delete
[3058] Fix | Delete
if ( current_user_can( 'manage_options' ) ) {
[3059] Fix | Delete
$a = '<a href="' . esc_url( admin_url( 'options-media.php' ) ) . '" target="_blank">';
[3060] Fix | Delete
$end = '</a>';
[3061] Fix | Delete
}
[3062] Fix | Delete
[3063] Fix | Delete
?>
[3064] Fix | Delete
<p class="hide-if-no-js"><label>
[3065] Fix | Delete
<input name="image_resize" type="checkbox" id="image_resize" value="true"<?php echo $checked; ?> />
[3066] Fix | Delete
<?php
[3067] Fix | Delete
/* translators: 1: Link start tag, 2: Link end tag, 3: Width, 4: Height. */
[3068] Fix | Delete
printf( __( 'Scale images to match the large size selected in %1$simage options%2$s (%3$d &times; %4$d).' ), $a, $end, (int) get_option( 'large_size_w', '1024' ), (int) get_option( 'large_size_h', '1024' ) );
[3069] Fix | Delete
[3070] Fix | Delete
?>
[3071] Fix | Delete
</label></p>
[3072] Fix | Delete
<?php
[3073] Fix | Delete
}
[3074] Fix | Delete
[3075] Fix | Delete
/**
[3076] Fix | Delete
* Displays the out of storage quota message in Multisite.
[3077] Fix | Delete
*
[3078] Fix | Delete
* @since 3.5.0
[3079] Fix | Delete
*/
[3080] Fix | Delete
function multisite_over_quota_message() {
[3081] Fix | Delete
echo '<p>' . sprintf(
[3082] Fix | Delete
/* translators: %s: Allowed space allocation. */
[3083] Fix | Delete
__( 'Sorry, you have used your space allocation of %s. Please delete some files to upload more files.' ),
[3084] Fix | Delete
size_format( get_space_allowed() * MB_IN_BYTES )
[3085] Fix | Delete
) . '</p>';
[3086] Fix | Delete
}
[3087] Fix | Delete
[3088] Fix | Delete
/**
[3089] Fix | Delete
* Displays the image and editor in the post editor
[3090] Fix | Delete
*
[3091] Fix | Delete
* @since 3.5.0
[3092] Fix | Delete
*
[3093] Fix | Delete
* @param WP_Post $post A post object.
[3094] Fix | Delete
*/
[3095] Fix | Delete
function edit_form_image_editor( $post ) {
[3096] Fix | Delete
$open = isset( $_GET['image-editor'] );
[3097] Fix | Delete
[3098] Fix | Delete
if ( $open ) {
[3099] Fix | Delete
require_once ABSPATH . 'wp-admin/includes/image-edit.php';
[3100] Fix | Delete
}
[3101] Fix | Delete
[3102] Fix | Delete
$thumb_url = false;
[3103] Fix | Delete
$attachment_id = (int) $post->ID;
[3104] Fix | Delete
[3105] Fix | Delete
if ( $attachment_id ) {
[3106] Fix | Delete
$thumb_url = wp_get_attachment_image_src( $attachment_id, array( 900, 450 ), true );
[3107] Fix | Delete
}
[3108] Fix | Delete
[3109] Fix | Delete
$alt_text = get_post_meta( $post->ID, '_wp_attachment_image_alt', true );
[3110] Fix | Delete
[3111] Fix | Delete
$att_url = wp_get_attachment_url( $post->ID );
[3112] Fix | Delete
?>
[3113] Fix | Delete
<div class="wp_attachment_holder wp-clearfix">
[3114] Fix | Delete
<?php
[3115] Fix | Delete
[3116] Fix | Delete
if ( wp_attachment_is_image( $post->ID ) ) :
[3117] Fix | Delete
$image_edit_button = '';
[3118] Fix | Delete
if ( wp_image_editor_supports( array( 'mime_type' => $post->post_mime_type ) ) ) {
[3119] Fix | Delete
$nonce = wp_create_nonce( "image_editor-$post->ID" );
[3120] Fix | Delete
$image_edit_button = "<input type='button' id='imgedit-open-btn-$post->ID' onclick='imageEdit.open( $post->ID, \"$nonce\" )' class='button' value='" . esc_attr__( 'Edit Image' ) . "' /> <span class='spinner'></span>";
[3121] Fix | Delete
}
[3122] Fix | Delete
[3123] Fix | Delete
$open_style = '';
[3124] Fix | Delete
$not_open_style = '';
[3125] Fix | Delete
[3126] Fix | Delete
if ( $open ) {
[3127] Fix | Delete
$open_style = ' style="display:none"';
[3128] Fix | Delete
} else {
[3129] Fix | Delete
$not_open_style = ' style="display:none"';
[3130] Fix | Delete
}
[3131] Fix | Delete
[3132] Fix | Delete
?>
[3133] Fix | Delete
<div class="imgedit-response" id="imgedit-response-<?php echo $attachment_id; ?>"></div>
[3134] Fix | Delete
[3135] Fix | Delete
<div<?php echo $open_style; ?> class="wp_attachment_image wp-clearfix" id="media-head-<?php echo $attachment_id; ?>">
[3136] Fix | Delete
<p id="thumbnail-head-<?php echo $attachment_id; ?>"><img class="thumbnail" src="<?php echo set_url_scheme( $thumb_url[0] ); ?>" style="max-width:100%" alt="" /></p>
[3137] Fix | Delete
<p><?php echo $image_edit_button; ?></p>
[3138] Fix | Delete
</div>
[3139] Fix | Delete
<div<?php echo $not_open_style; ?> class="image-editor" id="image-editor-<?php echo $attachment_id; ?>">
[3140] Fix | Delete
<?php
[3141] Fix | Delete
[3142] Fix | Delete
if ( $open ) {
[3143] Fix | Delete
wp_image_editor( $attachment_id );
[3144] Fix | Delete
}
[3145] Fix | Delete
[3146] Fix | Delete
?>
[3147] Fix | Delete
</div>
[3148] Fix | Delete
<?php
[3149] Fix | Delete
elseif ( $attachment_id && wp_attachment_is( 'audio', $post ) ) :
[3150] Fix | Delete
[3151] Fix | Delete
wp_maybe_generate_attachment_metadata( $post );
[3152] Fix | Delete
[3153] Fix | Delete
echo wp_audio_shortcode( array( 'src' => $att_url ) );
[3154] Fix | Delete
[3155] Fix | Delete
elseif ( $attachment_id && wp_attachment_is( 'video', $post ) ) :
[3156] Fix | Delete
[3157] Fix | Delete
wp_maybe_generate_attachment_metadata( $post );
[3158] Fix | Delete
[3159] Fix | Delete
$meta = wp_get_attachment_metadata( $attachment_id );
[3160] Fix | Delete
$w = ! empty( $meta['width'] ) ? min( $meta['width'], 640 ) : 0;
[3161] Fix | Delete
$h = ! empty( $meta['height'] ) ? $meta['height'] : 0;
[3162] Fix | Delete
[3163] Fix | Delete
if ( $h && $w < $meta['width'] ) {
[3164] Fix | Delete
$h = round( ( $meta['height'] * $w ) / $meta['width'] );
[3165] Fix | Delete
}
[3166] Fix | Delete
[3167] Fix | Delete
$attr = array( 'src' => $att_url );
[3168] Fix | Delete
[3169] Fix | Delete
if ( ! empty( $w ) && ! empty( $h ) ) {
[3170] Fix | Delete
$attr['width'] = $w;
[3171] Fix | Delete
$attr['height'] = $h;
[3172] Fix | Delete
}
[3173] Fix | Delete
[3174] Fix | Delete
$thumb_id = get_post_thumbnail_id( $attachment_id );
[3175] Fix | Delete
[3176] Fix | Delete
if ( ! empty( $thumb_id ) ) {
[3177] Fix | Delete
$attr['poster'] = wp_get_attachment_url( $thumb_id );
[3178] Fix | Delete
}
[3179] Fix | Delete
[3180] Fix | Delete
echo wp_video_shortcode( $attr );
[3181] Fix | Delete
[3182] Fix | Delete
elseif ( isset( $thumb_url[0] ) ) :
[3183] Fix | Delete
?>
[3184] Fix | Delete
<div class="wp_attachment_image wp-clearfix" id="media-head-<?php echo $attachment_id; ?>">
[3185] Fix | Delete
<p id="thumbnail-head-<?php echo $attachment_id; ?>">
[3186] Fix | Delete
<img class="thumbnail" src="<?php echo set_url_scheme( $thumb_url[0] ); ?>" style="max-width:100%" alt="" />
[3187] Fix | Delete
</p>
[3188] Fix | Delete
</div>
[3189] Fix | Delete
<?php
[3190] Fix | Delete
[3191] Fix | Delete
else :
[3192] Fix | Delete
[3193] Fix | Delete
/**
[3194] Fix | Delete
* Fires when an attachment type can't be rendered in the edit form.
[3195] Fix | Delete
*
[3196] Fix | Delete
* @since 4.6.0
[3197] Fix | Delete
*
[3198] Fix | Delete
* @param WP_Post $post A post object.
[3199] Fix | Delete
*/
[3200] Fix | Delete
do_action( 'wp_edit_form_attachment_display', $post );
[3201] Fix | Delete
[3202] Fix | Delete
endif;
[3203] Fix | Delete
[3204] Fix | Delete
?>
[3205] Fix | Delete
</div>
[3206] Fix | Delete
<div class="wp_attachment_details edit-form-section">
[3207] Fix | Delete
<?php if ( 'image' === substr( $post->post_mime_type, 0, 5 ) ) : ?>
[3208] Fix | Delete
<p class="attachment-alt-text">
[3209] Fix | Delete
<label for="attachment_alt"><strong><?php _e( 'Alternative Text' ); ?></strong></label><br />
[3210] Fix | Delete
<input type="text" class="widefat" name="_wp_attachment_image_alt" id="attachment_alt" aria-describedby="alt-text-description" value="<?php echo esc_attr( $alt_text ); ?>" />
[3211] Fix | Delete
</p>
[3212] Fix | Delete
<p class="attachment-alt-text-description" id="alt-text-description">
[3213] Fix | Delete
<?php
[3214] Fix | Delete
[3215] Fix | Delete
printf(
[3216] Fix | Delete
/* translators: 1: Link to tutorial, 2: Additional link attributes, 3: Accessibility text. */
[3217] Fix | Delete
__( '<a href="%1$s" %2$s>Describe the purpose of the image%3$s</a>. Leave empty if the image is purely decorative.' ),
[3218] Fix | Delete
esc_url( 'https://www.w3.org/WAI/tutorials/images/decision-tree' ),
[3219] Fix | Delete
'target="_blank" rel="noopener"',
[3220] Fix | Delete
sprintf(
[3221] Fix | Delete
'<span class="screen-reader-text"> %s</span>',
[3222] Fix | Delete
/* translators: Accessibility text. */
[3223] Fix | Delete
__( '(opens in a new tab)' )
[3224] Fix | Delete
)
[3225] Fix | Delete
);
[3226] Fix | Delete
[3227] Fix | Delete
?>
[3228] Fix | Delete
</p>
[3229] Fix | Delete
<?php endif; ?>
[3230] Fix | Delete
[3231] Fix | Delete
<p>
[3232] Fix | Delete
<label for="attachment_caption"><strong><?php _e( 'Caption' ); ?></strong></label><br />
[3233] Fix | Delete
<textarea class="widefat" name="excerpt" id="attachment_caption"><?php echo $post->post_excerpt; ?></textarea>
[3234] Fix | Delete
</p>
[3235] Fix | Delete
[3236] Fix | Delete
<?php
[3237] Fix | Delete
[3238] Fix | Delete
$quicktags_settings = array( 'buttons' => 'strong,em,link,block,del,ins,img,ul,ol,li,code,close' );
[3239] Fix | Delete
$editor_args = array(
[3240] Fix | Delete
'textarea_name' => 'content',
[3241] Fix | Delete
'textarea_rows' => 5,
[3242] Fix | Delete
'media_buttons' => false,
[3243] Fix | Delete
'tinymce' => false,
[3244] Fix | Delete
'quicktags' => $quicktags_settings,
[3245] Fix | Delete
);
[3246] Fix | Delete
[3247] Fix | Delete
?>
[3248] Fix | Delete
[3249] Fix | Delete
<label for="attachment_content" class="attachment-content-description"><strong><?php _e( 'Description' ); ?></strong>
[3250] Fix | Delete
<?php
[3251] Fix | Delete
[3252] Fix | Delete
if ( preg_match( '#^(audio|video)/#', $post->post_mime_type ) ) {
[3253] Fix | Delete
echo ': ' . __( 'Displayed on attachment pages.' );
[3254] Fix | Delete
}
[3255] Fix | Delete
[3256] Fix | Delete
?>
[3257] Fix | Delete
</label>
[3258] Fix | Delete
<?php wp_editor( format_to_edit( $post->post_content ), 'attachment_content', $editor_args ); ?>
[3259] Fix | Delete
[3260] Fix | Delete
</div>
[3261] Fix | Delete
<?php
[3262] Fix | Delete
[3263] Fix | Delete
$extras = get_compat_media_markup( $post->ID );
[3264] Fix | Delete
echo $extras['item'];
[3265] Fix | Delete
echo '<input type="hidden" id="image-edit-context" value="edit-attachment" />' . "\n";
[3266] Fix | Delete
}
[3267] Fix | Delete
[3268] Fix | Delete
/**
[3269] Fix | Delete
* Displays non-editable attachment metadata in the publish meta box.
[3270] Fix | Delete
*
[3271] Fix | Delete
* @since 3.5.0
[3272] Fix | Delete
*/
[3273] Fix | Delete
function attachment_submitbox_metadata() {
[3274] Fix | Delete
$post = get_post();
[3275] Fix | Delete
$attachment_id = $post->ID;
[3276] Fix | Delete
[3277] Fix | Delete
$file = get_attached_file( $attachment_id );
[3278] Fix | Delete
$filename = esc_html( wp_basename( $file ) );
[3279] Fix | Delete
[3280] Fix | Delete
$media_dims = '';
[3281] Fix | Delete
$meta = wp_get_attachment_metadata( $attachment_id );
[3282] Fix | Delete
[3283] Fix | Delete
if ( isset( $meta['width'], $meta['height'] ) ) {
[3284] Fix | Delete
$media_dims .= "<span id='media-dims-$attachment_id'>{$meta['width']}&nbsp;&times;&nbsp;{$meta['height']}</span> ";
[3285] Fix | Delete
}
[3286] Fix | Delete
/** This filter is documented in wp-admin/includes/media.php */
[3287] Fix | Delete
$media_dims = apply_filters( 'media_meta', $media_dims, $post );
[3288] Fix | Delete
[3289] Fix | Delete
$att_url = wp_get_attachment_url( $attachment_id );
[3290] Fix | Delete
[3291] Fix | Delete
$author = new WP_User( $post->post_author );
[3292] Fix | Delete
[3293] Fix | Delete
$uploaded_by_name = __( '(no author)' );
[3294] Fix | Delete
$uploaded_by_link = '';
[3295] Fix | Delete
[3296] Fix | Delete
if ( $author->exists() ) {
[3297] Fix | Delete
$uploaded_by_name = $author->display_name ? $author->display_name : $author->nickname;
[3298] Fix | Delete
$uploaded_by_link = get_edit_user_link( $author->ID );
[3299] Fix | Delete
}
[3300] Fix | Delete
?>
[3301] Fix | Delete
<div class="misc-pub-section misc-pub-uploadedby">
[3302] Fix | Delete
<?php if ( $uploaded_by_link ) { ?>
[3303] Fix | Delete
<?php _e( 'Uploaded by:' ); ?> <a href="<?php echo $uploaded_by_link; ?>"><strong><?php echo $uploaded_by_name; ?></strong></a>
[3304] Fix | Delete
<?php } else { ?>
[3305] Fix | Delete
<?php _e( 'Uploaded by:' ); ?> <strong><?php echo $uploaded_by_name; ?></strong>
[3306] Fix | Delete
<?php } ?>
[3307] Fix | Delete
</div>
[3308] Fix | Delete
[3309] Fix | Delete
<?php
[3310] Fix | Delete
if ( $post->post_parent ) {
[3311] Fix | Delete
$post_parent = get_post( $post->post_parent );
[3312] Fix | Delete
if ( $post_parent ) {
[3313] Fix | Delete
$uploaded_to_title = $post_parent->post_title ? $post_parent->post_title : __( '(no title)' );
[3314] Fix | Delete
$uploaded_to_link = get_edit_post_link( $post->post_parent, 'raw' );
[3315] Fix | Delete
?>
[3316] Fix | Delete
<div class="misc-pub-section misc-pub-uploadedto">
[3317] Fix | Delete
<?php if ( $uploaded_to_link ) { ?>
[3318] Fix | Delete
<?php _e( 'Uploaded to:' ); ?> <a href="<?php echo $uploaded_to_link; ?>"><strong><?php echo $uploaded_to_title; ?></strong></a>
[3319] Fix | Delete
<?php } else { ?>
[3320] Fix | Delete
<?php _e( 'Uploaded to:' ); ?> <strong><?php echo $uploaded_to_title; ?></strong>
[3321] Fix | Delete
<?php } ?>
[3322] Fix | Delete
</div>
[3323] Fix | Delete
<?php
[3324] Fix | Delete
}
[3325] Fix | Delete
}
[3326] Fix | Delete
?>
[3327] Fix | Delete
[3328] Fix | Delete
<div class="misc-pub-section misc-pub-attachment">
[3329] Fix | Delete
<label for="attachment_url"><?php _e( 'File URL:' ); ?></label>
[3330] Fix | Delete
<input type="text" class="widefat urlfield" readonly="readonly" name="attachment_url" id="attachment_url" value="<?php echo esc_attr( $att_url ); ?>" />
[3331] Fix | Delete
<span class="copy-to-clipboard-container">
[3332] Fix | Delete
<button type="button" class="button copy-attachment-url edit-media" data-clipboard-target="#attachment_url"><?php _e( 'Copy URL to clipboard' ); ?></button>
[3333] Fix | Delete
<span class="success hidden" aria-hidden="true"><?php _e( 'Copied!' ); ?></span>
[3334] Fix | Delete
</span>
[3335] Fix | Delete
</div>
[3336] Fix | Delete
<div class="misc-pub-section misc-pub-filename">
[3337] Fix | Delete
<?php _e( 'File name:' ); ?> <strong><?php echo $filename; ?></strong>
[3338] Fix | Delete
</div>
[3339] Fix | Delete
<div class="misc-pub-section misc-pub-filetype">
[3340] Fix | Delete
<?php _e( 'File type:' ); ?>
[3341] Fix | Delete
<strong>
[3342] Fix | Delete
<?php
[3343] Fix | Delete
[3344] Fix | Delete
if ( preg_match( '/^.*?\.(\w+)$/', get_attached_file( $post->ID ), $matches ) ) {
[3345] Fix | Delete
echo esc_html( strtoupper( $matches[1] ) );
[3346] Fix | Delete
list( $mime_type ) = explode( '/', $post->post_mime_type );
[3347] Fix | Delete
if ( 'image' !== $mime_type && ! empty( $meta['mime_type'] ) ) {
[3348] Fix | Delete
if ( "$mime_type/" . strtolower( $matches[1] ) !== $meta['mime_type'] ) {
[3349] Fix | Delete
echo ' (' . $meta['mime_type'] . ')';
[3350] Fix | Delete
}
[3351] Fix | Delete
}
[3352] Fix | Delete
} else {
[3353] Fix | Delete
echo strtoupper( str_replace( 'image/', '', $post->post_mime_type ) );
[3354] Fix | Delete
}
[3355] Fix | Delete
[3356] Fix | Delete
?>
[3357] Fix | Delete
</strong>
[3358] Fix | Delete
</div>
[3359] Fix | Delete
[3360] Fix | Delete
<?php
[3361] Fix | Delete
[3362] Fix | Delete
$file_size = false;
[3363] Fix | Delete
[3364] Fix | Delete
if ( isset( $meta['filesize'] ) ) {
[3365] Fix | Delete
$file_size = $meta['filesize'];
[3366] Fix | Delete
} elseif ( file_exists( $file ) ) {
[3367] Fix | Delete
$file_size = filesize( $file );
[3368] Fix | Delete
}
[3369] Fix | Delete
[3370] Fix | Delete
if ( ! empty( $file_size ) ) {
[3371] Fix | Delete
?>
[3372] Fix | Delete
<div class="misc-pub-section misc-pub-filesize">
[3373] Fix | Delete
<?php _e( 'File size:' ); ?> <strong><?php echo size_format( $file_size ); ?></strong>
[3374] Fix | Delete
</div>
[3375] Fix | Delete
<?php
[3376] Fix | Delete
}
[3377] Fix | Delete
[3378] Fix | Delete
if ( preg_match( '#^(audio|video)/#', $post->post_mime_type ) ) {
[3379] Fix | Delete
$fields = array(
[3380] Fix | Delete
'length_formatted' => __( 'Length:' ),
[3381] Fix | Delete
'bitrate' => __( 'Bitrate:' ),
[3382] Fix | Delete
);
[3383] Fix | Delete
[3384] Fix | Delete
/**
[3385] Fix | Delete
* Filters the audio and video metadata fields to be shown in the publish meta box.
[3386] Fix | Delete
*
[3387] Fix | Delete
* The key for each item in the array should correspond to an attachment
[3388] Fix | Delete
* metadata key, and the value should be the desired label.
[3389] Fix | Delete
*
[3390] Fix | Delete
* @since 3.7.0
[3391] Fix | Delete
* @since 4.9.0 Added the `$post` parameter.
[3392] Fix | Delete
*
[3393] Fix | Delete
* @param array $fields An array of the attachment metadata keys and labels.
[3394] Fix | Delete
* @param WP_Post $post WP_Post object for the current attachment.
[3395] Fix | Delete
*/
[3396] Fix | Delete
$fields = apply_filters( 'media_submitbox_misc_sections', $fields, $post );
[3397] Fix | Delete
[3398] Fix | Delete
foreach ( $fields as $key => $label ) {
[3399] Fix | Delete
if ( empty( $meta[ $key ] ) ) {
[3400] Fix | Delete
continue;
[3401] Fix | Delete
}
[3402] Fix | Delete
[3403] Fix | Delete
?>
[3404] Fix | Delete
<div class="misc-pub-section misc-pub-mime-meta misc-pub-<?php echo sanitize_html_class( $key ); ?>">
[3405] Fix | Delete
<?php echo $label; ?>
[3406] Fix | Delete
<strong>
[3407] Fix | Delete
<?php
[3408] Fix | Delete
[3409] Fix | Delete
switch ( $key ) {
[3410] Fix | Delete
case 'bitrate':
[3411] Fix | Delete
echo round( $meta['bitrate'] / 1000 ) . 'kb/s';
[3412] Fix | Delete
if ( ! empty( $meta['bitrate_mode'] ) ) {
[3413] Fix | Delete
echo ' ' . strtoupper( esc_html( $meta['bitrate_mode'] ) );
[3414] Fix | Delete
}
[3415] Fix | Delete
break;
[3416] Fix | Delete
default:
[3417] Fix | Delete
echo esc_html( $meta[ $key ] );
[3418] Fix | Delete
break;
[3419] Fix | Delete
}
[3420] Fix | Delete
[3421] Fix | Delete
?>
[3422] Fix | Delete
</strong>
[3423] Fix | Delete
</div>
[3424] Fix | Delete
<?php
[3425] Fix | Delete
}
[3426] Fix | Delete
[3427] Fix | Delete
$fields = array(
[3428] Fix | Delete
'dataformat' => __( 'Audio Format:' ),
[3429] Fix | Delete
'codec' => __( 'Audio Codec:' ),
[3430] Fix | Delete
);
[3431] Fix | Delete
[3432] Fix | Delete
/**
[3433] Fix | Delete
* Filters the audio attachment metadata fields to be shown in the publish meta box.
[3434] Fix | Delete
*
[3435] Fix | Delete
* The key for each item in the array should correspond to an attachment
[3436] Fix | Delete
* metadata key, and the value should be the desired label.
[3437] Fix | Delete
*
[3438] Fix | Delete
* @since 3.7.0
[3439] Fix | Delete
* @since 4.9.0 Added the `$post` parameter.
[3440] Fix | Delete
*
[3441] Fix | Delete
* @param array $fields An array of the attachment metadata keys and labels.
[3442] Fix | Delete
* @param WP_Post $post WP_Post object for the current attachment.
[3443] Fix | Delete
*/
[3444] Fix | Delete
$audio_fields = apply_filters( 'audio_submitbox_misc_sections', $fields, $post );
[3445] Fix | Delete
[3446] Fix | Delete
foreach ( $audio_fields as $key => $label ) {
[3447] Fix | Delete
if ( empty( $meta['audio'][ $key ] ) ) {
[3448] Fix | Delete
continue;
[3449] Fix | Delete
}
[3450] Fix | Delete
[3451] Fix | Delete
?>
[3452] Fix | Delete
<div class="misc-pub-section misc-pub-audio misc-pub-<?php echo sanitize_html_class( $key ); ?>">
[3453] Fix | Delete
<?php echo $label; ?> <strong><?php echo esc_html( $meta['audio'][ $key ] ); ?></strong>
[3454] Fix | Delete
</div>
[3455] Fix | Delete
<?php
[3456] Fix | Delete
}
[3457] Fix | Delete
}
[3458] Fix | Delete
[3459] Fix | Delete
if ( $media_dims ) {
[3460] Fix | Delete
?>
[3461] Fix | Delete
<div class="misc-pub-section misc-pub-dimensions">
[3462] Fix | Delete
<?php _e( 'Dimensions:' ); ?> <strong><?php echo $media_dims; ?></strong>
[3463] Fix | Delete
</div>
[3464] Fix | Delete
<?php
[3465] Fix | Delete
}
[3466] Fix | Delete
[3467] Fix | Delete
if ( ! empty( $meta['original_image'] ) ) {
[3468] Fix | Delete
?>
[3469] Fix | Delete
<div class="misc-pub-section misc-pub-original-image">
[3470] Fix | Delete
<?php _e( 'Original image:' ); ?>
[3471] Fix | Delete
<a href="<?php echo esc_url( wp_get_original_image_url( $attachment_id ) ); ?>">
[3472] Fix | Delete
<?php echo esc_html( wp_basename( wp_get_original_image_path( $attachment_id ) ) ); ?>
[3473] Fix | Delete
</a>
[3474] Fix | Delete
</div>
[3475] Fix | Delete
<?php
[3476] Fix | Delete
}
[3477] Fix | Delete
}
[3478] Fix | Delete
[3479] Fix | Delete
/**
[3480] Fix | Delete
* Parse ID3v2, ID3v1, and getID3 comments to extract usable data
[3481] Fix | Delete
*
[3482] Fix | Delete
* @since 3.6.0
[3483] Fix | Delete
*
[3484] Fix | Delete
* @param array $metadata An existing array with data
[3485] Fix | Delete
* @param array $data Data supplied by ID3 tags
[3486] Fix | Delete
*/
[3487] Fix | Delete
function wp_add_id3_tag_data( &$metadata, $data ) {
[3488] Fix | Delete
foreach ( array( 'id3v2', 'id3v1' ) as $version ) {
[3489] Fix | Delete
if ( ! empty( $data[ $version ]['comments'] ) ) {
[3490] Fix | Delete
foreach ( $data[ $version ]['comments'] as $key => $list ) {
[3491] Fix | Delete
if ( 'length' !== $key && ! empty( $list ) ) {
[3492] Fix | Delete
$metadata[ $key ] = wp_kses_post( reset( $list ) );
[3493] Fix | Delete
// Fix bug in byte stream analysis.
[3494] Fix | Delete
if ( 'terms_of_use' === $key && 0 === strpos( $metadata[ $key ], 'yright notice.' ) ) {
[3495] Fix | Delete
$metadata[ $key ] = 'Cop' . $metadata[ $key ];
[3496] Fix | Delete
}
[3497] Fix | Delete
}
[3498] Fix | Delete
}
[3499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function