Fix media/audio/file URL insertion. Strip slashes off title text. Leave red X to images only. fixes #14996. fixes #17578.
git-svn-id: http://svn.automattic.com/wordpress/trunk@18992 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
f1ec92751f
commit
1387dfd1f2
|
@ -512,29 +512,29 @@ function wp_media_upload_handler() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !empty($_POST['insertonlybutton']) ) {
|
if ( !empty($_POST['insertonlybutton']) ) {
|
||||||
$src = $_POST['insertonly']['src'];
|
$src = $_POST['src'];
|
||||||
if ( !empty($src) && !strpos($src, '://') )
|
if ( !empty($src) && !strpos($src, '://') )
|
||||||
$src = "http://$src";
|
$src = "http://$src";
|
||||||
|
|
||||||
if ( isset( $_POST['media_type'] ) && 'image' != $_POST['media_type'] ) {
|
if ( isset( $_POST['media_type'] ) && 'image' != $_POST['media_type'] ) {
|
||||||
$title = esc_attr($_POST['insertonly']['title']);
|
$title = esc_html( stripslashes( $_POST['title'] ) );
|
||||||
if ( empty($title) )
|
if ( empty( $title ) )
|
||||||
$title = esc_attr( basename($src) );
|
$title = esc_html( basename( $src ) );
|
||||||
|
|
||||||
if ( !empty($title) && !empty($src) )
|
if ( $title && $src )
|
||||||
$html = "<a href='" . esc_url($src) . "' >$title</a>";
|
$html = "<a href='" . esc_url($src) . "' >$title</a>";
|
||||||
|
|
||||||
$type = 'file';
|
$type = 'file';
|
||||||
if ( $ext = preg_replace( '/^.+?\.([^.]+)$/', '$1', $src ) && $ext_type = wp_ext2type( $ext )
|
if ( ( $ext = preg_replace( '/^.+?\.([^.]+)$/', '$1', $src ) ) && ( $ext_type = wp_ext2type( $ext ) )
|
||||||
&& ( 'audio' == $ext_type || 'video' == $ext_type ) )
|
&& ( 'audio' == $ext_type || 'video' == $ext_type ) )
|
||||||
$type = $ext_type;
|
$type = $ext_type;
|
||||||
|
|
||||||
$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 {
|
} else {
|
||||||
$align = '';
|
$align = '';
|
||||||
$alt = esc_attr($_POST['insertonly']['alt']);
|
$alt = esc_attr( stripslashes( $_POST['alt'] ) );
|
||||||
if ( isset($_POST['insertonly']['align']) ) {
|
if ( isset($_POST['align']) ) {
|
||||||
$align = esc_attr($_POST['insertonly']['align']);
|
$align = esc_attr( stripslashes( $_POST['align'] ) );
|
||||||
$class = " class='align$align'";
|
$class = " class='align$align'";
|
||||||
}
|
}
|
||||||
if ( !empty($src) )
|
if ( !empty($src) )
|
||||||
|
@ -1517,9 +1517,12 @@ var addExtImage = {
|
||||||
},
|
},
|
||||||
|
|
||||||
getImageData : function() {
|
getImageData : function() {
|
||||||
|
if ( jQuery('table.describe').hasClass('not-image') )
|
||||||
|
return;
|
||||||
|
|
||||||
var t = addExtImage, src = document.forms[0].src.value;
|
var t = addExtImage, src = document.forms[0].src.value;
|
||||||
|
|
||||||
if ( ! src || jQuery('table.describe').hasClass('not-image') ) {
|
if ( ! src ) {
|
||||||
t.resetImageData();
|
t.resetImageData();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue