mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
Fix insert, gallery, sizing, type queries, errors, thumbs, type fallback. Props andy. see #5911
git-svn-id: https://develop.svn.wordpress.org/trunk@7172 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -159,6 +159,9 @@ function wp_handle_upload( &$file, $overrides = false ) {
|
||||
|
||||
if ( !$ext )
|
||||
$ext = ltrim(strrchr($file['name'], '.'), '.');
|
||||
|
||||
if ( !$type )
|
||||
$type = $file['type'];
|
||||
}
|
||||
|
||||
// A writable uploads dir will pass this test. Again, there's no point overriding this one.
|
||||
|
||||
@@ -53,10 +53,9 @@ function get_image_send_to_editor($id, $alt, $title, $align, $url='', $rel = fal
|
||||
$html = get_image_tag($id, $alt, $title, $align, $rel, $size);
|
||||
|
||||
$rel = $rel ? ' rel="attachment wp-att-'.attribute_escape($id).'"' : '';
|
||||
|
||||
if ( $url )
|
||||
$html = "<a href='".attribute_escape($url)."'$rel>$html</a>";
|
||||
elseif ( $size == 'thumbnail' || $size == 'medium' )
|
||||
$html = '<a href="'.get_attachment_link($id).'"'.$rel.'>'.$html.'</a>';
|
||||
|
||||
$html = apply_filters( 'image_send_to_editor', $html, $id, $alt, $title, $align, $url );
|
||||
|
||||
@@ -238,14 +237,17 @@ function media_upload_form_handler() {
|
||||
wp_set_object_terms($attachment_id, array_map('trim', preg_split('/,+/', $attachment[$t])), $t, false);
|
||||
}
|
||||
|
||||
if ( isset($_POST['insert-media']) )
|
||||
if ( isset($_POST['insert-gallery']) )
|
||||
return media_send_to_editor('[gallery]');
|
||||
|
||||
if ( isset($_POST['send']) ) {
|
||||
$keys = array_keys($_POST['send']);
|
||||
$send_id = (int) array_shift($keys);
|
||||
$attachment = $_POST['attachments'][$send_id];
|
||||
$html = apply_filters('media_send_to_editor', get_the_attachment_link($send_id, 0, array(125,125), !empty($attachment['post_content'])), $send_id, $attachment);
|
||||
$html = $attachment['post_title'];
|
||||
if ( !empty($attachment['url']) )
|
||||
$html = "<a href='{$attachment['url']}'>$html</a>";
|
||||
$html = apply_filters('media_send_to_editor', $html, $send_id, $attachment);
|
||||
return media_send_to_editor($html);
|
||||
}
|
||||
|
||||
@@ -881,7 +883,7 @@ jQuery(function($){
|
||||
<?php echo get_media_items($post_id, $errors); ?>
|
||||
</div>
|
||||
<p class="submit">
|
||||
<input type="submit" class="submit insert-gallery" name="insert-media" value="<?php _e('Insert gallery into post'); ?>" />
|
||||
<input type="submit" class="submit insert-gallery" name="insert-gallery" value="<?php _e('Insert gallery into post'); ?>" />
|
||||
</p>
|
||||
<input type="hidden" name="post_id" id="post_id" value="<?php echo $post_id; ?>" />
|
||||
</form>
|
||||
|
||||
Reference in New Issue
Block a user