Ticket #1870: pingless.diff
File pingless.diff, 8.9 KB (added by , 19 years ago) |
---|
-
wp-includes/comment-functions.php
622 622 // We don't wanna ping first and second types, even if they have a valid <link/> 623 623 624 624 foreach($post_links_temp[0] as $link_test) : 625 if ( !in_array($link_test, $pung) && url_to_postid($link_test) != $post_ID) : // If we haven't pung it already and it isn't a link to itself 625 if ( !in_array($link_test, $pung) && (url_to_postid($link_test) != $post_ID) // If we haven't pung it already and it isn't a link to itself 626 && !is_local_attachment($link_test) ) : // Also, let's never ping local attachments. 626 627 $test = parse_url($link_test); 627 628 if (isset($test['query'])) 628 629 $post_links[] = $link_test; … … 753 754 return false; 754 755 } 755 756 757 function is_local_attachment($url) { 758 if ( !strstr($url, get_bloginfo('home') ) ) 759 return false; 760 if ( strstr($url, get_bloginfo('home') . '/?attachment_id=') ) 761 return true; 762 if ( $id = url_to_postid($url) ) { 763 $post = & get_post($id); 764 if ( 'attachment' == $post->post_status ) 765 return true; 766 } 767 return false; 768 } 756 769 757 770 function wp_set_comment_status($comment_id, $comment_status) { 758 771 global $wpdb; … … 788 801 } 789 802 } 790 803 791 792 804 function wp_get_comment_status($comment_id) { 793 805 global $wpdb; 794 806 -
wp-admin/inline-uploading.php
77 77 $imagedata['file'] = $file; 78 78 $imagedata['thumb'] = "thumb-$filename"; 79 79 80 add_post_meta($id, ' imagedata', $imagedata);80 add_post_meta($id, '_wp_attachment_metadata', $imagedata); 81 81 82 82 if ( $imagedata['width'] * $imagedata['height'] < 3 * 1024 * 1024 ) { 83 83 if ( $imagedata['width'] > 128 && $imagedata['width'] >= $imagedata['height'] * 4 / 3 ) … … 135 135 $back = false; 136 136 } 137 137 138 $i = 0;139 138 $uwidth_sum = 0; 140 139 $images_html = ''; 141 140 $images_style = ''; … … 154 153 $images_script .= "attachmenton = '$__attachment_on';\nattachmentoff = '$__attachment_off';\n"; 155 154 $images_script .= "thumbnailon = '$__thumbnail_on';\nthumbnailoff = '$__thumbnail_off';\n"; 156 155 foreach ( $images as $key => $image ) { 157 $meta = get_post_meta($image['ID'], 'imagedata', true); 156 $attachment_ID = $image['ID']; 157 $meta = get_post_meta($attachment_ID, '_wp_attachment_metadata', true); 158 158 if (!is_array($meta)) { 159 wp_delete_attachment($image['ID']); 160 continue; 159 $meta = get_post_meta($attachment_ID, 'imagedata', true); // Try 1.6 Alpha meta key 160 if (!is_array($meta)) { 161 continue; 162 } else { 163 add_post_meta($attachment_ID, '_wp_attachment_metadata', $meta); 164 } 161 165 } 162 166 $image = array_merge($image, $meta); 163 167 if ( ($image['width'] > 128 || $image['height'] > 96) && !empty($image['thumb']) && file_exists(dirname($image['file']).'/'.$image['thumb']) ) { 164 168 $src = str_replace(basename($image['guid']), '', $image['guid']) . $image['thumb']; 165 $images_script .= "src".$ i."a = '$src';\nsrc".$i."b = '".$image['guid']."';\n";169 $images_script .= "src".$attachment_ID."a = '$src';\nsrc".$attachment_ID."b = '".$image['guid']."';\n"; 166 170 $thumb = 'true'; 167 171 $thumbtext = $__thumbnail_on; 168 172 } else { … … 175 179 $uwidth_sum += 128; 176 180 $xpadding = (128 - $image['uwidth']) / 2; 177 181 $ypadding = (96 - $image['uheight']) / 2; 178 $attachment = $image['ID']; 179 $images_style .= "#target$i img { padding: {$ypadding}px {$xpadding}px; }\n"; 180 $href = get_attachment_link($attachment); 181 $images_script .= "href".$i."a = '$href';\nhref".$i."b = '{$image['guid']}';\n"; 182 $images_style .= "#target{$attachment_ID} img { padding: {$ypadding}px {$xpadding}px; }\n"; 183 $href = get_attachment_link($attachment_ID); 184 $images_script .= "href{$attachment_ID}a = '$href';\nhref{$attachment_ID}b = '{$image['guid']}';\n"; 182 185 $images_html .= " 183 <div id='target $i' class='imagewrap left'>184 <div id='popup $i' class='popup'>185 <a id=\"L $i\" onclick=\"toggleLink($i);return false;\" href=\"javascript:void();\">$__attachment_on</a>186 <a id=\"I $i\" onclick=\"if($thumb)toggleImage($i);else alert('$__nothumb');return false;\" href=\"javascript:void();\">$thumbtext</a>187 <a onclick=\"return confirm('$__confirmdelete')\" href=\"".basename(__FILE__)."?action=delete&attachment= $attachment&all=$all&start=$start&post=$post\">$__delete</a>186 <div id='target{$attachment_ID}' class='imagewrap left'> 187 <div id='popup{$attachment_ID}' class='popup'> 188 <a id=\"L{$attachment_ID}\" onclick=\"toggleLink({$attachment_ID});return false;\" href=\"javascript:void();\">$__attachment_on</a> 189 <a id=\"I{$attachment_ID}\" onclick=\"if($thumb)toggleImage({$attachment_ID});else alert('$__nothumb');return false;\" href=\"javascript:void();\">$thumbtext</a> 190 <a onclick=\"return confirm('$__confirmdelete')\" href=\"".basename(__FILE__)."?action=delete&attachment={$attachment_ID}&all=$all&start=$start&post=$post\">$__delete</a> 188 191 <a onclick=\"popup.style.display='none';return false;\" href=\"javascript:void()\">$__close</a> 189 192 </div> 190 <a id=\" link$i\" class=\"imagelink\" href=\"$href\" onclick=\"imagePopup($i);return false;\" title=\"{$image['post_title']}\">191 <img id= 'image$i' src='$src' alt='{$image['post_title']}'$height_width />193 <a id=\"{$attachment_ID}\" rel=\"attachment\" class=\"imagelink\" href=\"$href\" onclick=\"imagePopup({$attachment_ID});return false;\" title=\"{$image['post_title']}\"> 194 <img id=\"image{$attachment_ID}\" src=\"$src\" alt=\"{$attachment_ID}\" $height_width /> 192 195 </a> 193 196 </div> 194 197 "; 195 $i++;196 198 } 197 199 } 198 200 … … 242 244 popup = false; 243 245 } 244 246 function toggleLink(n) { 245 o=document.getElementById( 'link'+n);247 o=document.getElementById(n); 246 248 oi=document.getElementById('L'+n); 247 249 if ( oi.innerHTML == attachmenton ) { 248 250 o.href = eval('href'+n+'b'); -
wp-admin/admin-functions.php
63 63 if ( $_POST['temp_ID'] ) 64 64 relocate_children($_POST['temp_ID'], $post_ID); 65 65 66 // Now that we have an ID we can fix the attachment anchor hrefs 67 fix_attachment_links($post_ID); 68 66 69 return $post_ID; 67 70 } 68 71 … … 74 77 return $wpdb->query("UPDATE $wpdb->posts SET post_parent = $new_ID WHERE post_parent = $old_ID"); 75 78 } 76 79 80 // Replace hrefs of attachment anchors with up-to-date permalinks. 81 function fix_attachment_links($post_ID) { 82 global $wp_rewrite; 83 84 // Relevance check. 85 if ( false == $wp_rewrite->using_permalinks() ) 86 return; 87 88 $post = & get_post($post_ID); 89 90 $search = "#<a[^>]+rel=('|\")[^'\"]*attachment[^>]*>#ie"; 91 92 // See if we have any rel="attachment" links 93 if ( 0 == preg_match_all($search, $post->post_content, $anchor_matches, PREG_PATTERN_ORDER) ) 94 return; 95 96 $i = 0; 97 $search = "# id=(\"|)(\d+)\\1#i"; 98 foreach ( $anchor_matches[0] as $anchor ) { 99 echo "$search\n$anchor\n"; 100 if ( 0 == preg_match($search, $anchor, $id_matches) ) 101 continue; 102 103 $id = $id_matches[2]; 104 $post_search[$i] = $anchor; 105 $post_replace[$i] = preg_replace("#href=(\"|')[^'\"]*\\1#e", "stripslashes('href=\\1').get_attachment_link($id).stripslashes('\\1')", $anchor); 106 ++$i; 107 } 108 109 $post->post_content = str_replace($post_search, $post_replace, $post->post_content); 110 111 return wp_update_post($post); 112 } 113 77 114 // Update an existing post with values provided in $_POST. 78 115 function edit_post() { 79 116 global $user_ID; … … 1795 1832 return array('file' => $file, 'id' => $id); 1796 1833 } 1797 1834 1798 ?> 1799 No newline at end of file 1835 ?> -
wp-admin/admin-header.php
105 105 convert_newlines_to_brs : false, 106 106 remove_linebreaks : true, 107 107 save_callback : "wp_save_callback", 108 valid_elements : "-a[ href|title|rel],-strong/b,-em/i,-strike,-del,-u,p[class|align],-ol,-ul,-li,br,img[class|src|alt|title|width|height|align],-sub,-sup,-blockquote,-table[border=0|cellspacing|cellpadding|width|height|class|align],tr[class|rowspan|width|height|align|valign],td[dir|class|colspan|rowspan|width|height|align|valign],-div[dir|class|align],-span[class|align],-pre[class],address,-h1[class|align],-h2[class|align],-h3[class|align],-h4[class|align],-h5[class|align],-h6[class|align],hr",108 valid_elements : "-a[id|href|title|rel],-strong/b,-em/i,-strike,-del,-u,p[class|align],-ol,-ul,-li,br,img[class|src|alt|title|width|height|align],-sub,-sup,-blockquote,-table[border=0|cellspacing|cellpadding|width|height|class|align],tr[class|rowspan|width|height|align|valign],td[dir|class|colspan|rowspan|width|height|align|valign],-div[dir|class|align],-span[class|align],-pre[class],address,-h1[class|align],-h2[class|align],-h3[class|align],-h4[class|align],-h5[class|align],-h6[class|align],hr", 109 109 plugins : "wordpress,autosave" 110 110 <?php do_action('mce_options'); ?> 111 111 });