<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -9,22 +9,31 @@ Displays Twitter data via Twitalytic in a post or page via a shortcode.
 
 == Description ==
 
-Displays Twitter data pulled from the [Twitalytic](http://twitalytic.com) on your WordPress blog. Currently the only feature available
-is a chronological listing of your tweets.
+Displays Twitter data pulled from the [Twitalytic](http://twitalytic.com) on your WordPress blog. Currently it can list:
+
+* A chronological view of tweets for a given user without replies, start to finish
+* All replies assigned or associated to a given tweet
+* The reply count for a given tweet
 
 == Installation ==
 
 1. Upload `twitalytic` folder to the `/wp-content/plugins/` directory
-1. Activate the plugin through the 'Plugins' menu in WordPress
-1. Place `[twitalytic_chronological_archive twitter_username='ginatrapani']` in a post or page.
+2. Activate the plugin through the 'Plugins' menu in WordPress
+3. Place the right shortcode in a post or page. For example, `[twitalytic_chronological_archive twitter_username='ginatrapani']` lists
+all tweets for ginatrapani without replies. `[twitalytic_status_reply_count status_id=&quot;12345&quot;]` outputs the number of replies for tweet ID 12345.
+`[twitalytic_status_replies status_id=&quot;12345&quot;]` lists all replies for status id 12345.
 
 == Changelog ==
 
+= 0.2 =
+* Added reply count and reply listing. Added wpd-&gt;prep statement to protect against SQL injection attacks. Switched from echo'ing output
+to returning it.
+
 = 0.1 =
 * Release.
 
 == Things to know ==
 
-1. You must have [Twitalytic](http://twitalytic.com) installed on the same server as WordPress for this to work.
-2. Your Twitalytic tables must exist in the WordPress database, and the prefix must be &quot;ta_&quot;.
+* You must have [Twitalytic](http://twitalytic.com) installed on the same server as WordPress for this to work.
+* Your Twitalytic tables must exist in the WordPress database, and the prefix must be &quot;ta_&quot;.
 </diff>
      <filename>extras/wordpress/twitalytic/readme.txt</filename>
    </modified>
    <modified>
      <diff>@@ -22,11 +22,14 @@
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
+//TODO: Allow user to save default values for shortcode parameters in a plug-in settings area
+
 
 // [twitalytic_chronological_archive twitter_username=&quot;twitalytic&quot;]
+// Lists all the user's tweets in chronological order from beginning to end without replies
 function twitalytic_chron_archive_handler($atts) {
 
-    extract( shortcode_atts(array(
+    extract(shortcode_atts(array(
 		'twitter_username'=&gt;'twitalytic', 
 		'title'=&gt;'&lt;h3&gt;&lt;a href=&quot;http://twitter.com/#twitter_username#/&quot;&gt;@#twitter_username#&lt;/a&gt;\'s Tweets in Chronological Order (sans replies)&lt;/h3&gt;', 
 		'before'=&gt;'&lt;br /&gt;&lt;ul&gt;', 
@@ -38,38 +41,42 @@ function twitalytic_chron_archive_handler($atts) {
 		'before_tweet_html'=&gt;'', 
 		'after_tweet_html'=&gt;'', 
 		'date_format'=&gt;'Y.m.d, g:ia', 
-		'gmt_offset'=&gt;8, 
-	), $atts));
-        
+		'gmt_offset'=&gt;8, ), 
+	$atts));
+    
     global $wpdb;
     
-    $sql = $wpdb-&gt;prepare(&quot;select pub_date, tweet_html, status_id from ta_tweets where author_username='%s' and in_reply_to_user_id is null  order by pub_date asc&quot;,
-		$twitter_username);
-    //echo $sql;
+    $sql = $wpdb-&gt;prepare(&quot;select 
+		pub_date, tweet_html, status_id 
+		from ta_tweets 
+		where author_username='%s' and in_reply_to_user_id is null 
+		order by pub_date asc&quot;, $twitter_username);
     
     $tweets = $wpdb-&gt;get_results($sql);
     
+	$output = '';
     if ($tweets) {
-        echo str_replace('#twitter_username#', $twitter_username, $title);
-        echo &quot;{$before}&quot;;
+        $output .= str_replace('#twitter_username#', $twitter_username, $title);
+        $output .= &quot;{$before}&quot;;
         foreach ($tweets as $t) {
             $tweet_content = linkUrls($t-&gt;tweet_html);
             $tweet_content = linkTwitterUsers($tweet_content);
-            echo &quot;{$before_tweet}{$before_tweet_html}{$tweet_content}{$after_tweet_html} {$before_date}&lt;a href=\&quot;http://twitter.com/{$twitter_username}/statuses/{$t-&gt;status_id}/\&quot;&gt;&quot;.actual_time($date_format, $gmt_offset, strtotime($t-&gt;pub_date)).&quot;&lt;/a&gt;{$after_date}{$after_tweet}&quot;;
+            $output .= &quot;{$before_tweet}{$before_tweet_html}{$tweet_content}{$after_tweet_html} {$before_date}&lt;a href=\&quot;http://twitter.com/{$twitter_username}/statuses/{$t-&gt;status_id}/\&quot;&gt;&quot;.actual_time($date_format, $gmt_offset, strtotime($t-&gt;pub_date)).&quot;&lt;/a&gt;{$after_date}{$after_tweet}&quot;;
         }
-        echo &quot;{$after}&quot;;
+        $output .= &quot;{$after}&quot;;
     } else {
-        echo &quot;No tweets found in Twitalytic for {$twitter_username}.&quot;;
+        $output .= &quot;No tweets found in Twitalytic for {$twitter_username}.&quot;;
     }
+	return $output;
 }
 
 // [twitalytic_status_replies status_id=&quot;12345&quot;]
+// Lists all public replies to a given tweet
 function twitalytic_replies_handler($atts) {
 
-    extract( shortcode_atts(array(
-		'status_id'=&gt;0, 
-		//TOOD: get twitter username from result set, don't require it as a shortcode parameter
-		'twitter_username'=&gt;'', 
+    extract(shortcode_atts(array('status_id'=&gt;0,
+        //TOOD: get twitter username from result set, don't require it as a shortcode parameter
+        'twitter_username'=&gt;'', 
 		'title'=&gt;'&lt;h3&gt;Public Twitter replies to &lt;a href=&quot;http://twitter.com/#twitter_username#/statuses/#status_id#/&quot;&gt;@#twitter_username#\'s tweet&lt;/a&gt;:&lt;/h3&gt;', 
 		'before'=&gt;'&lt;br /&gt;&lt;ul&gt;', 
 		'after'=&gt;'&lt;/ul&gt;', 
@@ -80,12 +87,12 @@ function twitalytic_replies_handler($atts) {
 		'before_tweet_html'=&gt;'', 
 		'after_tweet_html'=&gt;'', 
 		'date_format'=&gt;'Y.m.d, g:ia', 
-		'gmt_offset'=&gt;8, 
-	), $atts));
-    
+		'gmt_offset'=&gt;8, ), 
+	$atts));
+        
     global $wpdb;
     
-    $sql = $wpdb-&gt;prepare( &quot;select 
+    $sql = $wpdb-&gt;prepare(&quot;select 
 				t.*, u.*
 			from 
 				ta_tweets t
@@ -97,33 +104,34 @@ function twitalytic_replies_handler($atts) {
 				in_reply_to_status_id = %0.0f 
 				AND u.is_protected = 0	
 			order by 
-				follower_count desc;&quot;,
-			$status_id );
-    //echo $sql;
-    
+				follower_count desc;&quot;, $status_id);
+				
     $replies = $wpdb-&gt;get_results($sql);
     
+    $output = '';
     if ($replies) {
         $modified_title = str_replace('#twitter_username#', $twitter_username, $title);
-		$modified_title = str_replace('#status_id#', $status_id, $modified_title );
-        echo &quot;{$before}&quot;;
-		echo &quot;{$modified_title}&quot;;
+        $modified_title = str_replace('#status_id#', $status_id, $modified_title);
+        $output .= &quot;{$before}&quot;;
+        $output .= &quot;{$modified_title}&quot;;
         foreach ($replies as $t) {
-			$tweet_content = strip_starter_username($t-&gt;tweet_html);
-			$tweet_content = linkUrls($tweet_content);
+            $tweet_content = strip_starter_username($t-&gt;tweet_html);
+            $tweet_content = linkUrls($tweet_content);
             $tweet_content = linkTwitterUsers($tweet_content);
-            echo &quot;{$before_tweet}{$before_user}&lt;a href=\&quot;http://twitter.com/{$t-&gt;author_username}/statuses/{$t-&gt;status_id}/\&quot;&gt;{$t-&gt;author_username}&lt;/a&gt;{$after_user}: {$before_tweet_html}{$tweet_content}{$after_tweet_html}{$after_tweet}&quot;;
+            $output .= &quot;{$before_tweet}{$before_user}&lt;a href=\&quot;http://twitter.com/{$t-&gt;author_username}/statuses/{$t-&gt;status_id}/\&quot;&gt;{$t-&gt;author_username}&lt;/a&gt;{$after_user}: {$before_tweet_html}{$tweet_content}{$after_tweet_html}{$after_tweet}&quot;;
         }
-        echo &quot;{$after}&quot;;
+        $output .= &quot;{$after}&quot;;
     } else {
-        echo &quot;No replies found for status {$status_id}.&quot;;
+        $output .= &quot;No replies found for status {$status_id}.&quot;;
     }
+    return $output;
 }
 
 // [twitalytic_status_reply_count status_id=&quot;12345&quot;]
+// Display the count of replies for a given tweet ID
 function twitalytic_reply_count_handler($atts) {
 
-    extract( shortcode_atts(array(
+    extract(shortcode_atts(array(
 		'status_id'=&gt;0, 
 		'before'=&gt;'&lt;a href=&quot;#permalink#&quot;&gt;', 
 		'after'=&gt;' Twitter replies&lt;/a&gt;', 
@@ -131,7 +139,7 @@ function twitalytic_reply_count_handler($atts) {
     
     global $wpdb;
     
-    $sql = $wpdb-&gt;prepare( &quot;select 
+    $sql = $wpdb-&gt;prepare(&quot;select 
 				count(*)
 			from 
 				ta_tweets t
@@ -143,13 +151,11 @@ function twitalytic_reply_count_handler($atts) {
 				in_reply_to_status_id=%0.0f
 				AND u.is_protected = 0	
 			order by 
-				follower_count desc;&quot;,
-			$status_id);
+				follower_count desc;&quot;, $status_id);
     //echo $sql;
     $count = $wpdb-&gt;get_var($sql);
-//	$plink = 
-	$before_mod = str_replace('#permalink#', get_permalink(), $before);
-    echo &quot;{$before_mod}{$count}{$after}&quot;;
+    $before_mod = str_replace('#permalink#', get_permalink(), $before);
+    return &quot;{$before_mod}{$count}{$after}&quot;;
 }
 
 function linkTwitterUsers($text) {
@@ -191,7 +197,7 @@ function actual_time($format, $offset, $timestamp) {
 }
 
 function strip_starter_username($text) {
-	return preg_replace(&quot;/^@[a-zA-Z0-9_]+/&quot;, '', $text);
+    return preg_replace(&quot;/^@[a-zA-Z0-9_]+/&quot;, '', $text);
 }
 
 </diff>
      <filename>extras/wordpress/twitalytic/twitalytic.php</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>89979c993f52e4a5e6c399dedb490d9758264556</id>
    </parent>
  </parents>
  <author>
    <name>Gina Trapani</name>
    <email>ginatrapani@gmail.com</email>
  </author>
  <url>http://github.com/ginatrapani/twitalytic/commit/4d6ba2a661a288db0fdff5662f8c059c39065067</url>
  <id>4d6ba2a661a288db0fdff5662f8c059c39065067</id>
  <committed-date>2009-09-29T16:19:16-07:00</committed-date>
  <authored-date>2009-09-29T16:19:16-07:00</authored-date>
  <message>WordPress plugin tweaks</message>
  <tree>0d1faba0c82604309fdc986d109e8b60570a6f46</tree>
  <committer>
    <name>Gina Trapani</name>
    <email>ginatrapani@gmail.com</email>
  </committer>
</commit>
