| 1 | Index: wp-includes/post-template.php |
|---|
| 2 | =================================================================== |
|---|
| 3 | --- wp-includes/post-template.php (revision 7162) |
|---|
| 4 | +++ wp-includes/post-template.php (working copy) |
|---|
| 5 | @@ -381,7 +381,7 @@ |
|---|
| 6 | |
|---|
| 7 | $post_title = attribute_escape($_post->post_title); |
|---|
| 8 | |
|---|
| 9 | - $link_text = wp_get_attachment_image($attachment_id, $size); |
|---|
| 10 | + $link_text = wp_get_attachment_image($id, $size); |
|---|
| 11 | if ( !$link_text ) |
|---|
| 12 | $link_text = $_post->post_title; |
|---|
| 13 | |
|---|
| 14 | Index: wp-includes/post.php |
|---|
| 15 | =================================================================== |
|---|
| 16 | --- wp-includes/post.php (revision 7162) |
|---|
| 17 | +++ wp-includes/post.php (working copy) |
|---|
| 18 | @@ -471,6 +471,7 @@ |
|---|
| 19 | $query .= empty( $post_parent ) ? '' : $wpdb->prepare("AND $wpdb->posts.post_parent = %d ", $post_parent); |
|---|
| 20 | // expected_slashed ($meta_key, $meta_value) -- Also, this looks really funky, doesn't seem like it works |
|---|
| 21 | $query .= empty( $meta_key ) | empty($meta_value) ? '' : " AND ($wpdb->posts.ID = $wpdb->postmeta.post_id AND $wpdb->postmeta.meta_key = '$meta_key' AND $wpdb->postmeta.meta_value = '$meta_value' )"; |
|---|
| 22 | + $query .= empty( $post_mime_type ) ? '' : wp_post_mime_type_where($post_mime_type); |
|---|
| 23 | $query .= " GROUP BY $wpdb->posts.ID ORDER BY " . $orderby . ' ' . $order; |
|---|
| 24 | if ( 0 < $numberposts ) |
|---|
| 25 | $query .= $wpdb->prepare(" LIMIT %d,%d", $offset, $numberposts); |
|---|
| 26 | Index: wp-includes/js/swfupload/handlers.js |
|---|
| 27 | =================================================================== |
|---|
| 28 | --- wp-includes/js/swfupload/handlers.js (revision 7162) |
|---|
| 29 | +++ wp-includes/js/swfupload/handlers.js (working copy) |
|---|
| 30 | @@ -20,7 +20,7 @@ |
|---|
| 31 | jQuery('#media-items').append('<div id="media-item-' + fileObj.id + '" class="media-item child-of-' + post_id + '"><div class="filename original">' + fileObj.name + '</div><div class="progress"><div class="bar"></div></div></div>'); |
|---|
| 32 | |
|---|
| 33 | // Disable the submit button |
|---|
| 34 | - jQuery('#insert-media').attr('disabled', 'disabled'); |
|---|
| 35 | + jQuery('#insert-gallery').attr('disabled', 'disabled'); |
|---|
| 36 | } |
|---|
| 37 | |
|---|
| 38 | function uploadStart(fileObj) { return true; } |
|---|
| 39 | @@ -107,7 +107,7 @@ |
|---|
| 40 | function uploadComplete(fileObj) { |
|---|
| 41 | // If no more uploads queued, enable the submit button |
|---|
| 42 | if ( swfu.getStats().files_queued == 0 ) |
|---|
| 43 | - jQuery('#insert-media').attr('disabled', ''); |
|---|
| 44 | + jQuery('#insert-gallery').attr('disabled', ''); |
|---|
| 45 | } |
|---|
| 46 | |
|---|
| 47 | |
|---|
| 48 | Index: wp-includes/shortcodes.php |
|---|
| 49 | =================================================================== |
|---|
| 50 | --- wp-includes/shortcodes.php (revision 7162) |
|---|
| 51 | +++ wp-includes/shortcodes.php (working copy) |
|---|
| 52 | @@ -128,64 +128,6 @@ |
|---|
| 53 | return $out; |
|---|
| 54 | } |
|---|
| 55 | |
|---|
| 56 | -add_shortcode('gallery', 'gallery_shortcode'); |
|---|
| 57 | - |
|---|
| 58 | -function gallery_shortcode($attr) { |
|---|
| 59 | - global $post; |
|---|
| 60 | - |
|---|
| 61 | - // Allow plugins/themes to override the default gallery template. |
|---|
| 62 | - $output = apply_filters('post_gallery', '', $attr); |
|---|
| 63 | - if ( $output != '' ) |
|---|
| 64 | - return $output; |
|---|
| 65 | - |
|---|
| 66 | - $attachments = get_children("post_parent=$post->ID&post_type=attachment&orderby=\"menu_order ASC, ID ASC\""); |
|---|
| 67 | -/* |
|---|
| 68 | - foreach ( $attachments as $id => $attachment ) { |
|---|
| 69 | - $meta = get_post_custom($id); |
|---|
| 70 | - if ( $meta ) foreach ( $meta as $k => $v ) |
|---|
| 71 | - $attachments[$id]->$k = $v; |
|---|
| 72 | - if ( isset($attachments[$id]->_wp_attachment_metadata[0]) ) |
|---|
| 73 | - $attachments[$id]->meta = unserialize($attachments[$id]->_wp_attachment_metadata[0]); |
|---|
| 74 | - } |
|---|
| 75 | -*/ |
|---|
| 76 | - |
|---|
| 77 | - $output = " |
|---|
| 78 | - <style type='text/css'> |
|---|
| 79 | - .gallery { |
|---|
| 80 | - margin: auto; |
|---|
| 81 | - } |
|---|
| 82 | - .gallery div { |
|---|
| 83 | - float: left; |
|---|
| 84 | - margin-top: 10px; |
|---|
| 85 | - text-align: center; |
|---|
| 86 | - width: 33%; } |
|---|
| 87 | - .gallery img { |
|---|
| 88 | - border: 2px solid #cfcfcf; |
|---|
| 89 | - } |
|---|
| 90 | - </style> |
|---|
| 91 | - <div class='gallery'> |
|---|
| 92 | -"; |
|---|
| 93 | - |
|---|
| 94 | - if ( !empty($attachments) ) foreach ( $attachments as $id => $attachment ) { |
|---|
| 95 | - $src = wp_get_attachment_thumb_url($id); |
|---|
| 96 | - $href = get_attachment_link($id); |
|---|
| 97 | - $output .= " |
|---|
| 98 | - <div> |
|---|
| 99 | - <a href='$href'><img src='$src' alt='$attachment->post_title' /></a> |
|---|
| 100 | - </div> |
|---|
| 101 | -"; |
|---|
| 102 | - if ( ++$i % 3 == 0 ) |
|---|
| 103 | - $output .= '<br style="clear: both" />'; |
|---|
| 104 | - } |
|---|
| 105 | - |
|---|
| 106 | - $output .= " |
|---|
| 107 | - <br style='clear: both;' > |
|---|
| 108 | - </div> |
|---|
| 109 | -"; |
|---|
| 110 | - |
|---|
| 111 | - return $output; |
|---|
| 112 | -} |
|---|
| 113 | - |
|---|
| 114 | add_filter('the_content', 'do_shortcode'); |
|---|
| 115 | |
|---|
| 116 | ?> |
|---|
| 117 | Index: wp-includes/media.php |
|---|
| 118 | =================================================================== |
|---|
| 119 | --- wp-includes/media.php (revision 7162) |
|---|
| 120 | +++ wp-includes/media.php (working copy) |
|---|
| 121 | @@ -290,4 +290,53 @@ |
|---|
| 122 | return $html; |
|---|
| 123 | } |
|---|
| 124 | |
|---|
| 125 | + |
|---|
| 126 | +add_shortcode('gallery', 'gallery_shortcode'); |
|---|
| 127 | + |
|---|
| 128 | +function gallery_shortcode($attr) { |
|---|
| 129 | + global $post; |
|---|
| 130 | + |
|---|
| 131 | + // Allow plugins/themes to override the default gallery template. |
|---|
| 132 | + $output = apply_filters('post_gallery', '', $attr); |
|---|
| 133 | + if ( $output != '' ) |
|---|
| 134 | + return $output; |
|---|
| 135 | + |
|---|
| 136 | + $attachments = get_children("post_parent=$post->ID&post_type=attachment&post_mime_type=image&orderby=\"menu_order ASC, ID ASC\""); |
|---|
| 137 | + |
|---|
| 138 | + if ( empty($attachments) ) |
|---|
| 139 | + return ''; |
|---|
| 140 | + |
|---|
| 141 | + $output = apply_filters('gallery_style', " |
|---|
| 142 | + <style type='text/css'> |
|---|
| 143 | + .gallery { |
|---|
| 144 | + margin: auto; |
|---|
| 145 | + } |
|---|
| 146 | + .gallery div { |
|---|
| 147 | + float: left; |
|---|
| 148 | + margin-top: 10px; |
|---|
| 149 | + text-align: center; |
|---|
| 150 | + width: 33%; } |
|---|
| 151 | + .gallery img { |
|---|
| 152 | + border: 2px solid #cfcfcf; |
|---|
| 153 | + } |
|---|
| 154 | + </style> |
|---|
| 155 | + <div class='gallery'>"); |
|---|
| 156 | + |
|---|
| 157 | + foreach ( $attachments as $id => $attachment ) { |
|---|
| 158 | + $link = get_the_attachment_link($id, false, array(128, 96), true); |
|---|
| 159 | + $output .= " |
|---|
| 160 | + <div> |
|---|
| 161 | + $link |
|---|
| 162 | + </div>"; |
|---|
| 163 | + if ( ++$i % 3 == 0 ) |
|---|
| 164 | + $output .= '<br style="clear: both" />'; |
|---|
| 165 | + } |
|---|
| 166 | + |
|---|
| 167 | + $output .= " |
|---|
| 168 | + <br style='clear: both;' > |
|---|
| 169 | + </div>\n"; |
|---|
| 170 | + |
|---|
| 171 | + return $output; |
|---|
| 172 | +} |
|---|
| 173 | + |
|---|
| 174 | ?> |
|---|
| 175 | Index: wp-includes/script-loader.php |
|---|
| 176 | =================================================================== |
|---|
| 177 | --- wp-includes/script-loader.php (revision 7162) |
|---|
| 178 | +++ wp-includes/script-loader.php (working copy) |
|---|
| 179 | @@ -98,8 +98,8 @@ |
|---|
| 180 | $this->localize( 'swfupload-handlers', 'swfuploadL10n', array( |
|---|
| 181 | 'queue_limit_exceeded' => __('You have attempted to queue too many files.'), |
|---|
| 182 | 'file_exceeds_size_limit' => sprintf(__('This file is too big. Your php.ini upload_max_filesize is %s.'), ini_get('upload_max_filesize')), |
|---|
| 183 | - 'zero_byte_file' => __('The file you selected is empty. Please select another file.'), |
|---|
| 184 | - 'invalid_filetype' => __('The file you choose is not an allowed file type.'), |
|---|
| 185 | + 'zero_byte_file' => __('This file is empty. Please try another.'), |
|---|
| 186 | + 'invalid_filetype' => __('This file type is not allowed. Please try another.'), |
|---|
| 187 | 'default_error' => __('An error occurred in the upload. Please try again later.'), |
|---|
| 188 | 'missing_upload_url' => __('There was a configuration error. Please contact the server administrator.'), |
|---|
| 189 | 'upload_limit_exceeded' => __('You may only upload 1 file.'), |
|---|
| 190 | Index: wp-admin/includes/media.php |
|---|
| 191 | =================================================================== |
|---|
| 192 | --- wp-admin/includes/media.php (revision 7162) |
|---|
| 193 | +++ wp-admin/includes/media.php (working copy) |
|---|
| 194 | @@ -53,10 +53,9 @@ |
|---|
| 195 | $html = get_image_tag($id, $alt, $title, $align, $rel, $size); |
|---|
| 196 | |
|---|
| 197 | $rel = $rel ? ' rel="attachment wp-att-'.attribute_escape($id).'"' : ''; |
|---|
| 198 | + |
|---|
| 199 | if ( $url ) |
|---|
| 200 | $html = "<a href='".attribute_escape($url)."'$rel>$html</a>"; |
|---|
| 201 | - elseif ( $size == 'thumbnail' || $size == 'medium' ) |
|---|
| 202 | - $html = '<a href="'.get_attachment_link($id).'"'.$rel.'>'.$html.'</a>'; |
|---|
| 203 | |
|---|
| 204 | $html = apply_filters( 'image_send_to_editor', $html, $id, $alt, $title, $align, $url ); |
|---|
| 205 | |
|---|
| 206 | @@ -238,14 +237,17 @@ |
|---|
| 207 | wp_set_object_terms($attachment_id, array_map('trim', preg_split('/,+/', $attachment[$t])), $t, false); |
|---|
| 208 | } |
|---|
| 209 | |
|---|
| 210 | - if ( isset($_POST['insert-media']) ) |
|---|
| 211 | + if ( isset($_POST['insert-gallery']) ) |
|---|
| 212 | return media_send_to_editor('[gallery]'); |
|---|
| 213 | |
|---|
| 214 | if ( isset($_POST['send']) ) { |
|---|
| 215 | $keys = array_keys($_POST['send']); |
|---|
| 216 | $send_id = (int) array_shift($keys); |
|---|
| 217 | $attachment = $_POST['attachments'][$send_id]; |
|---|
| 218 | - $html = apply_filters('media_send_to_editor', get_the_attachment_link($send_id, 0, array(125,125), !empty($attachment['post_content'])), $send_id, $attachment); |
|---|
| 219 | + $html = $attachment['post_title']; |
|---|
| 220 | + if ( !empty($attachment['url']) ) |
|---|
| 221 | + $html = "<a href='{$attachment['url']}'>$html</a>"; |
|---|
| 222 | + $html = apply_filters('media_send_to_editor', $html, $send_id, $attachment); |
|---|
| 223 | return media_send_to_editor($html); |
|---|
| 224 | } |
|---|
| 225 | |
|---|
| 226 | @@ -881,7 +883,7 @@ |
|---|
| 227 | <?php echo get_media_items($post_id, $errors); ?> |
|---|
| 228 | </div> |
|---|
| 229 | <p class="submit"> |
|---|
| 230 | - <input type="submit" class="submit insert-gallery" name="insert-media" value="<?php _e('Insert gallery into post'); ?>" /> |
|---|
| 231 | + <input type="submit" class="submit insert-gallery" name="insert-gallery" value="<?php _e('Insert gallery into post'); ?>" /> |
|---|
| 232 | </p> |
|---|
| 233 | <input type="hidden" name="post_id" id="post_id" value="<?php echo $post_id; ?>" /> |
|---|
| 234 | </form> |
|---|
| 235 | Index: wp-admin/includes/file.php |
|---|
| 236 | =================================================================== |
|---|
| 237 | --- wp-admin/includes/file.php (revision 7162) |
|---|
| 238 | +++ wp-admin/includes/file.php (working copy) |
|---|
| 239 | @@ -159,6 +159,9 @@ |
|---|
| 240 | |
|---|
| 241 | if ( !$ext ) |
|---|
| 242 | $ext = ltrim(strrchr($file['name'], '.'), '.'); |
|---|
| 243 | + |
|---|
| 244 | + if ( !$type ) |
|---|
| 245 | + $type = $file['type']; |
|---|
| 246 | } |
|---|
| 247 | |
|---|
| 248 | // A writable uploads dir will pass this test. Again, there's no point overriding this one. |
|---|
| 249 | Index: wp-admin/js/media-upload.js |
|---|
| 250 | =================================================================== |
|---|
| 251 | --- wp-admin/js/media-upload.js (revision 7162) |
|---|
| 252 | +++ wp-admin/js/media-upload.js (working copy) |
|---|
| 253 | @@ -4,7 +4,7 @@ |
|---|
| 254 | if ( !win ) |
|---|
| 255 | win = top; |
|---|
| 256 | tinyMCE = win.tinyMCE; |
|---|
| 257 | - if ( typeof tinyMCE != 'undefined' && tinyMCE.getInstanceById('content') ) { |
|---|
| 258 | + if ( typeof tinyMCE != 'undefined' && ( ed = tinyMCE.getInstanceById('content') ) && !ed.isHidden() ) { |
|---|
| 259 | tinyMCE.selectedInstance.getWin().focus(); |
|---|
| 260 | tinyMCE.execCommand('mceInsertContent', false, h); |
|---|
| 261 | } else |
|---|