From 6584b204a6cec4951d81ccfda167fd758dea66f0 Mon Sep 17 00:00:00 2001 From: saxmatt Date: Thu, 6 Jan 2005 23:10:28 +0000 Subject: [PATCH] Some cleanup patches from Scott: http://www.coffee2code.com/archives/2005/01/06/walking-with-15/ git-svn-id: http://svn.automattic.com/wordpress/trunk@2060 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/import-mt.php | 6 ++--- wp-content/plugins/hello.php | 3 ++- wp-includes/comment-functions.php | 40 ++++++++++++------------------- xmlrpc.php | 12 +++------- 4 files changed, 23 insertions(+), 38 deletions(-) diff --git a/wp-admin/import-mt.php b/wp-admin/import-mt.php index b08405b1e2..e72867d4e2 100644 --- a/wp-admin/import-mt.php +++ b/wp-admin/import-mt.php @@ -382,13 +382,13 @@ foreach ($posts as $post) { if ('' != trim($post)) { $comment_content = addslashes(trim($ping)); $comment_content = str_replace('-----', '', $comment_content); - $comment_content = "$ping_title\n$comment_content"; + $comment_content = "$ping_title\n\n$comment_content"; // Check if it's already there if (!$wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_date = '$comment_date' AND comment_content = '$comment_content'")) { - $wpdb->query("INSERT INTO $wpdb->comments (comment_post_ID, comment_author, comment_author_email, comment_author_url, comment_author_IP, comment_date, comment_content, comment_approved) + $wpdb->query("INSERT INTO $wpdb->comments (comment_post_ID, comment_author, comment_author_email, comment_author_url, comment_author_IP, comment_date, comment_content, comment_approved, comment_type) VALUES - ($post_id, '$comment_author', '$comment_email', '$comment_url', '$comment_ip', '$comment_date', '$comment_content', '1')"); + ($post_id, '$comment_author', '$comment_email', '$comment_url', '$comment_ip', '$comment_date', '$comment_content', '1', 'trackback')"); echo " Comment added."; } diff --git a/wp-content/plugins/hello.php b/wp-content/plugins/hello.php index bf86344f7e..3eee83f94d 100644 --- a/wp-content/plugins/hello.php +++ b/wp-content/plugins/hello.php @@ -2,8 +2,9 @@ /* Plugin Name: Hello Dolly Plugin URI: http://wordpress.org/# -Description: This is not just a plugin, it symbolizes the hope and enthusiasm of an entire generation summed up in two words sung most famously by Louis Armstrong. Hello, Dolly. This is, by the way, the world's first official WordPress plugin. When enabled you will randomly see a lyric from Hello, Dolly in the upper right of your admin screen on every page but the plugins page. +Description: This is not just a plugin, it symbolizes the hope and enthusiasm of an entire generation summed up in two words sung most famously by Louis Armstrong. Hello, Dolly. This is, by the way, the world's first official WordPress plugin. When enabled you will randomly see a lyric from Hello, Dolly in the upper right of your admin screen on every page. Author: Matt Mullenweg +Version: 1.0 Author URI: http://photomatt.net/ */ diff --git a/wp-includes/comment-functions.php b/wp-includes/comment-functions.php index 9ef7f5dc48..4df4329bb5 100644 --- a/wp-includes/comment-functions.php +++ b/wp-includes/comment-functions.php @@ -237,9 +237,7 @@ function comment_author_IP() { function get_comment_text() { global $comment; - $comment_text = str_replace('', '', $comment->comment_content); - $comment_text = str_replace('', '', $comment_text); - return apply_filters('get_comment_text', $comment_text); + return apply_filters('get_comment_text', $comment->comment_content); } function comment_text() { @@ -254,9 +252,7 @@ function comment_text_rss() { function get_comment_excerpt() { global $comment; - $comment_text = str_replace('', '', $comment->comment_content); - $comment_text = str_replace('', '', $comment_text); - $comment_text = strip_tags($comment_text); + $comment_text = strip_tags($comment->comment_content); $blah = explode(' ', $comment_text); if (count($blah) > 20) { $k = 20; @@ -396,8 +392,8 @@ function get_lastcommentmodified($timezone = 'server') { return $lastcommentmodified; } -function get_commentdata($comment_ID,$no_cache=0,$include_unapproved=false) { // less flexible, but saves DB queries - global $postc,$id,$commentdata, $wpdb; +function get_commentdata( $comment_ID, $no_cache = 0, $include_unapproved = false ) { // less flexible, but saves DB queries + global $postc, $id, $commentdata, $wpdb; if ($no_cache) { $query = "SELECT * FROM $wpdb->comments WHERE comment_ID = '$comment_ID'"; if (false == $include_unapproved) { @@ -405,23 +401,17 @@ function get_commentdata($comment_ID,$no_cache=0,$include_unapproved=false) { // } $myrow = $wpdb->get_row($query, ARRAY_A); } else { - $myrow['comment_ID']=$postc->comment_ID; - $myrow['comment_post_ID']=$postc->comment_post_ID; - $myrow['comment_author']=$postc->comment_author; - $myrow['comment_author_email']=$postc->comment_author_email; - $myrow['comment_author_url']=$postc->comment_author_url; - $myrow['comment_author_IP']=$postc->comment_author_IP; - $myrow['comment_date']=$postc->comment_date; - $myrow['comment_content']=$postc->comment_content; - $myrow['comment_karma']=$postc->comment_karma; - $myrow['comment_approved']=$postc->comment_approved; - if (strstr($myrow['comment_content'], '')) { - $myrow['comment_type'] = 'trackback'; - } elseif (strstr($myrow['comment_content'], '')) { - $myrow['comment_type'] = 'pingback'; - } else { - $myrow['comment_type'] = 'comment'; - } + $myrow['comment_ID'] = $postc->comment_ID; + $myrow['comment_post_ID'] = $postc->comment_post_ID; + $myrow['comment_author'] = $postc->comment_author; + $myrow['comment_author_email'] = $postc->comment_author_email; + $myrow['comment_author_url'] = $postc->comment_author_url; + $myrow['comment_author_IP'] = $postc->comment_author_IP; + $myrow['comment_date'] = $postc->comment_date; + $myrow['comment_content'] = $postc->comment_content; + $myrow['comment_karma'] = $postc->comment_karma; + $myrow['comment_approved'] = $postc->comment_approved; + $myrow['comment_type'] = $postc->comment_type; } return $myrow; } diff --git a/xmlrpc.php b/xmlrpc.php index 8cb3febab4..67ca98a7b5 100644 --- a/xmlrpc.php +++ b/xmlrpc.php @@ -1020,12 +1020,8 @@ class wp_xmlrpc_server extends IXR_Server { $trackback_pings = array(); foreach($comments as $comment) { - if ((strpos($comment->comment_content, '') === 0) - || ('trackback' == $comment->comment_type)) { - // FIXME: would be nicer to have a comment_title field? - // FIXME: assumption: here we make the assumption that trackback - // titles are stored as title - $content = str_replace('', '', $comment->comment_content); + if ( 'trackback' == $comment->comment_type ) { + $content = $comment->comment_content; $title = substr($content, 8, (strpos($content, '') - 8)); $trackback_pings[] = array( 'pingTitle' => $title, @@ -1269,10 +1265,8 @@ class wp_xmlrpc_server extends IXR_Server { $pingbacks = array(); foreach($comments as $comment) { - if ((strpos($comment->comment_content, '') === 0) - || ('pingback' == $comment->comment_type)) { + if ( 'pingback' == $comment->comment_type ) $pingbacks[] = $comment->comment_author_url; - } } return $pingbacks;