$html = '<a href="' . esc_attr( $url ) . '"' . $rel . '>' . $html . '</a>';
/**
- * Filters the image HTML markup to send to the editor.
+ * Filters the image HTML markup to send to the editor when inserting an image.
*
* @since 2.5.0
*
$time = $post->post_date;
}
- $name = $_FILES[$file_id]['name'];
$file = wp_handle_upload($_FILES[$file_id], $overrides, $time);
if ( isset($file['error']) )
return new WP_Error( 'upload_error', $file['error'] );
- $name_parts = pathinfo($name);
- $name = trim( substr( $name, 0, -(1 + strlen($name_parts['extension'])) ) );
+ $name = $_FILES[$file_id]['name'];
+ $ext = pathinfo( $name, PATHINFO_EXTENSION );
+ $name = wp_basename( $name, ".$ext" );
$url = $file['url'];
$type = $file['type'];
/* translators: 1: audio track title, 2: artist name */
$content .= sprintf( __( '"%1$s" by %2$s.' ), $title, $meta['artist'] );
} else {
+ /* translators: 1: audio track title */
$content .= sprintf( __( '"%s".' ), $title );
}
}
- if ( ! empty( $meta['year'] ) )
+ if ( ! empty( $meta['year'] ) ) {
+ /* translators: Audio file track information. 1: Year of audio track release */
$content .= ' ' . sprintf( __( 'Released: %d.' ), $meta['year'] );
+ }
if ( ! empty( $meta['track_number'] ) ) {
$track_number = explode( '/', $meta['track_number'] );
- if ( isset( $track_number[1] ) )
+ if ( isset( $track_number[1] ) ) {
+ /* translators: Audio file track information. 1: Audio track number, 2: Total audio tracks */
$content .= ' ' . sprintf( __( 'Track %1$s of %2$s.' ), number_format_i18n( $track_number[0] ), number_format_i18n( $track_number[1] ) );
- else
+ } else {
+ /* translators: Audio file track information. 1: Audio track number */
$content .= ' ' . sprintf( __( 'Track %1$s.' ), number_format_i18n( $track_number[0] ) );
+ }
}
- if ( ! empty( $meta['genre'] ) )
+ if ( ! empty( $meta['genre'] ) ) {
+ /* translators: Audio file genre information. 1: Audio genre name */
$content .= ' ' . sprintf( __( 'Genre: %s.' ), $meta['genre'] );
+ }
// Use image exif/iptc data for title and caption defaults if possible.
} elseif ( 0 === strpos( $type, 'image/' ) && $image_meta = @wp_read_image_metadata( $file ) ) {
*
* @param string $upload_iframe_src The upload iframe source URL by type.
*/
- $upload_iframe_src = apply_filters( $type . '_upload_iframe_src', $upload_iframe_src );
+ $upload_iframe_src = apply_filters( "{$type}_upload_iframe_src", $upload_iframe_src );
return add_query_arg('TB_iframe', true, $upload_iframe_src);
}
* @param string $src Media source URL.
* @param string $title Media title.
*/
- $html = apply_filters( $type . '_send_to_editor_url', $html, esc_url_raw( $src ), $title );
+ $html = apply_filters( "{$type}_send_to_editor_url", $html, esc_url_raw( $src ), $title );
} else {
$align = '';
$alt = esc_attr( wp_unslash( $_POST['alt'] ) );
);
if ( $r['send'] ) {
- $r['send'] = get_submit_button( __( 'Insert into Post' ), 'button', "send[$attachment_id]", false );
+ $r['send'] = get_submit_button( __( 'Insert into Post' ), '', "send[$attachment_id]", false );
}
$delete = empty( $r['delete'] ) ? '' : $r['delete'];
?></div>
<p class="savebutton ml-submit">
-<?php submit_button( __( 'Save all changes' ), 'button', 'save', false ); ?>
+<?php submit_button( __( 'Save all changes' ), '', 'save', false ); ?>
</p>
</form>
<?php
</div>
<p class="ml-submit">
-<?php submit_button( __( 'Save all changes' ), 'button savebutton', 'save', false, array( 'id' => 'save-all', 'style' => 'display: none;' ) ); ?>
+<?php submit_button( __( 'Save all changes' ), 'savebutton', 'save', false, array( 'id' => 'save-all', 'style' => 'display: none;' ) ); ?>
<input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" />
<input type="hidden" name="type" value="<?php echo esc_attr( $GLOBALS['type'] ); ?>" />
<input type="hidden" name="tab" value="<?php echo esc_attr( $GLOBALS['tab'] ); ?>" />
<p id="media-search" class="search-box">
<label class="screen-reader-text" for="media-search-input"><?php _e('Search Media');?>:</label>
<input type="search" id="media-search-input" name="s" value="<?php the_search_query(); ?>" />
- <?php submit_button( __( 'Search Media' ), 'button', '', false ); ?>
+ <?php submit_button( __( 'Search Media' ), '', '', false ); ?>
</p>
<ul class="subsubsub">
</select>
<?php } ?>
-<?php submit_button( __( 'Filter »' ), 'button', 'post-query-submit', false ); ?>
+<?php submit_button( __( 'Filter »' ), '', 'post-query-submit', false ); ?>
</div>
<?php echo get_media_items(null, $errors); ?>
</div>
<p class="ml-submit">
-<?php submit_button( __( 'Save all changes' ), 'button savebutton', 'save', false ); ?>
+<?php submit_button( __( 'Save all changes' ), 'savebutton', 'save', false ); ?>
<input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" />
</p>
</form>
<tr class="not-image">
<td></td>
<td>
- ' . get_submit_button( __( 'Insert into Post' ), 'button', 'insertonlybutton', false ) . '
+ ' . get_submit_button( __( 'Insert into Post' ), '', 'insertonlybutton', false ) . '
</td>
</tr>
</tbody></table>
echo wp_video_shortcode( $attr );
- else :
+ elseif ( isset( $thumb_url[0] ) ):
+
+ ?>
+ <div class="wp_attachment_image wp-clearfix" id="media-head-<?php echo $attachment_id; ?>">
+ <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>
+ </div>
+ <?php
+
+ else:
/**
* Fires when an attachment type can't be rendered in the edit form.