Ticket #5911: 5911-17.diff
File 5911-17.diff, 9.2 KB (added by , 16 years ago) |
---|
-
wp-includes/post-template.php
381 381 382 382 $post_title = attribute_escape($_post->post_title); 383 383 384 $link_text = wp_get_attachment_image($ attachment_id, $size);384 $link_text = wp_get_attachment_image($id, $size); 385 385 if ( !$link_text ) 386 386 $link_text = $_post->post_title; 387 387 -
wp-includes/post.php
471 471 $query .= empty( $post_parent ) ? '' : $wpdb->prepare("AND $wpdb->posts.post_parent = %d ", $post_parent); 472 472 // expected_slashed ($meta_key, $meta_value) -- Also, this looks really funky, doesn't seem like it works 473 473 $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' )"; 474 $query .= empty( $post_mime_type ) ? '' : wp_post_mime_type_where($post_mime_type); 474 475 $query .= " GROUP BY $wpdb->posts.ID ORDER BY " . $orderby . ' ' . $order; 475 476 if ( 0 < $numberposts ) 476 477 $query .= $wpdb->prepare(" LIMIT %d,%d", $offset, $numberposts); -
wp-includes/js/swfupload/handlers.js
20 20 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>'); 21 21 22 22 // Disable the submit button 23 jQuery('#insert- media').attr('disabled', 'disabled');23 jQuery('#insert-gallery').attr('disabled', 'disabled'); 24 24 } 25 25 26 26 function uploadStart(fileObj) { return true; } … … 107 107 function uploadComplete(fileObj) { 108 108 // If no more uploads queued, enable the submit button 109 109 if ( swfu.getStats().files_queued == 0 ) 110 jQuery('#insert- media').attr('disabled', '');110 jQuery('#insert-gallery').attr('disabled', ''); 111 111 } 112 112 113 113 -
wp-includes/shortcodes.php
128 128 return $out; 129 129 } 130 130 131 add_shortcode('gallery', 'gallery_shortcode');132 133 function gallery_shortcode($attr) {134 global $post;135 136 // Allow plugins/themes to override the default gallery template.137 $output = apply_filters('post_gallery', '', $attr);138 if ( $output != '' )139 return $output;140 141 $attachments = get_children("post_parent=$post->ID&post_type=attachment&orderby=\"menu_order ASC, ID ASC\"");142 /*143 foreach ( $attachments as $id => $attachment ) {144 $meta = get_post_custom($id);145 if ( $meta ) foreach ( $meta as $k => $v )146 $attachments[$id]->$k = $v;147 if ( isset($attachments[$id]->_wp_attachment_metadata[0]) )148 $attachments[$id]->meta = unserialize($attachments[$id]->_wp_attachment_metadata[0]);149 }150 */151 152 $output = "153 <style type='text/css'>154 .gallery {155 margin: auto;156 }157 .gallery div {158 float: left;159 margin-top: 10px;160 text-align: center;161 width: 33%; }162 .gallery img {163 border: 2px solid #cfcfcf;164 }165 </style>166 <div class='gallery'>167 ";168 169 if ( !empty($attachments) ) foreach ( $attachments as $id => $attachment ) {170 $src = wp_get_attachment_thumb_url($id);171 $href = get_attachment_link($id);172 $output .= "173 <div>174 <a href='$href'><img src='$src' alt='$attachment->post_title' /></a>175 </div>176 ";177 if ( ++$i % 3 == 0 )178 $output .= '<br style="clear: both" />';179 }180 181 $output .= "182 <br style='clear: both;' >183 </div>184 ";185 186 return $output;187 }188 189 131 add_filter('the_content', 'do_shortcode'); 190 132 191 133 ?> -
wp-includes/media.php
290 290 return $html; 291 291 } 292 292 293 294 add_shortcode('gallery', 'gallery_shortcode'); 295 296 function gallery_shortcode($attr) { 297 global $post; 298 299 // Allow plugins/themes to override the default gallery template. 300 $output = apply_filters('post_gallery', '', $attr); 301 if ( $output != '' ) 302 return $output; 303 304 $attachments = get_children("post_parent=$post->ID&post_type=attachment&post_mime_type=image&orderby=\"menu_order ASC, ID ASC\""); 305 306 if ( empty($attachments) ) 307 return ''; 308 309 $output = apply_filters('gallery_style', " 310 <style type='text/css'> 311 .gallery { 312 margin: auto; 313 } 314 .gallery div { 315 float: left; 316 margin-top: 10px; 317 text-align: center; 318 width: 33%; } 319 .gallery img { 320 border: 2px solid #cfcfcf; 321 } 322 </style> 323 <div class='gallery'>"); 324 325 foreach ( $attachments as $id => $attachment ) { 326 $link = get_the_attachment_link($id, false, array(128, 96), true); 327 $output .= " 328 <div> 329 $link 330 </div>"; 331 if ( ++$i % 3 == 0 ) 332 $output .= '<br style="clear: both" />'; 333 } 334 335 $output .= " 336 <br style='clear: both;' > 337 </div>\n"; 338 339 return $output; 340 } 341 293 342 ?> -
wp-includes/script-loader.php
98 98 $this->localize( 'swfupload-handlers', 'swfuploadL10n', array( 99 99 'queue_limit_exceeded' => __('You have attempted to queue too many files.'), 100 100 'file_exceeds_size_limit' => sprintf(__('This file is too big. Your php.ini upload_max_filesize is %s.'), ini_get('upload_max_filesize')), 101 'zero_byte_file' => __('Th e file you selected is empty. Please select another file.'),102 'invalid_filetype' => __('Th e file you choose is not an allowed file type.'),101 'zero_byte_file' => __('This file is empty. Please try another.'), 102 'invalid_filetype' => __('This file type is not allowed. Please try another.'), 103 103 'default_error' => __('An error occurred in the upload. Please try again later.'), 104 104 'missing_upload_url' => __('There was a configuration error. Please contact the server administrator.'), 105 105 'upload_limit_exceeded' => __('You may only upload 1 file.'), -
wp-admin/includes/media.php
53 53 $html = get_image_tag($id, $alt, $title, $align, $rel, $size); 54 54 55 55 $rel = $rel ? ' rel="attachment wp-att-'.attribute_escape($id).'"' : ''; 56 56 57 if ( $url ) 57 58 $html = "<a href='".attribute_escape($url)."'$rel>$html</a>"; 58 elseif ( $size == 'thumbnail' || $size == 'medium' )59 $html = '<a href="'.get_attachment_link($id).'"'.$rel.'>'.$html.'</a>';60 59 61 60 $html = apply_filters( 'image_send_to_editor', $html, $id, $alt, $title, $align, $url ); 62 61 … … 238 237 wp_set_object_terms($attachment_id, array_map('trim', preg_split('/,+/', $attachment[$t])), $t, false); 239 238 } 240 239 241 if ( isset($_POST['insert- media']) )240 if ( isset($_POST['insert-gallery']) ) 242 241 return media_send_to_editor('[gallery]'); 243 242 244 243 if ( isset($_POST['send']) ) { 245 244 $keys = array_keys($_POST['send']); 246 245 $send_id = (int) array_shift($keys); 247 246 $attachment = $_POST['attachments'][$send_id]; 248 $html = apply_filters('media_send_to_editor', get_the_attachment_link($send_id, 0, array(125,125), !empty($attachment['post_content'])), $send_id, $attachment); 247 $html = $attachment['post_title']; 248 if ( !empty($attachment['url']) ) 249 $html = "<a href='{$attachment['url']}'>$html</a>"; 250 $html = apply_filters('media_send_to_editor', $html, $send_id, $attachment); 249 251 return media_send_to_editor($html); 250 252 } 251 253 … … 881 883 <?php echo get_media_items($post_id, $errors); ?> 882 884 </div> 883 885 <p class="submit"> 884 <input type="submit" class="submit insert-gallery" name="insert- media" value="<?php _e('Insert gallery into post'); ?>" />886 <input type="submit" class="submit insert-gallery" name="insert-gallery" value="<?php _e('Insert gallery into post'); ?>" /> 885 887 </p> 886 888 <input type="hidden" name="post_id" id="post_id" value="<?php echo $post_id; ?>" /> 887 889 </form> -
wp-admin/includes/file.php
159 159 160 160 if ( !$ext ) 161 161 $ext = ltrim(strrchr($file['name'], '.'), '.'); 162 163 if ( !$type ) 164 $type = $file['type']; 162 165 } 163 166 164 167 // A writable uploads dir will pass this test. Again, there's no point overriding this one. -
wp-admin/js/media-upload.js
4 4 if ( !win ) 5 5 win = top; 6 6 tinyMCE = win.tinyMCE; 7 if ( typeof tinyMCE != 'undefined' && tinyMCE.getInstanceById('content') ) {7 if ( typeof tinyMCE != 'undefined' && ( ed = tinyMCE.getInstanceById('content') ) && !ed.isHidden() ) { 8 8 tinyMCE.selectedInstance.getWin().focus(); 9 9 tinyMCE.execCommand('mceInsertContent', false, h); 10 10 } else