diff --git a/assets/comments.css b/assets/comments.css
index 33065507..c29cc77b 100755
--- a/assets/comments.css
+++ b/assets/comments.css
@@ -802,4 +802,28 @@ override submit styles in TwentyEleven theme */
}
.social-aggregation-results {
white-space: nowrap;
+}
+
+/**
+ * Social items display (retweets, likes, etc...)
+ */
+.social-items {
+ clear: both;
+}
+
+#social .social-items-icon {
+ float: left;
+ margin: 2px 5px;
+}
+
+#social .social-items-comments img {
+ float: left;
+ margin: 2px;
+}
+
+#social .social-items-and-more {
+ float: left;
+ margin: 8px 0 0 5px;
+ font-size: 11px;
+ color: #666;
}
\ No newline at end of file
diff --git a/assets/retweet.png b/assets/retweet.png
new file mode 100644
index 00000000..b74317b3
Binary files /dev/null and b/assets/retweet.png differ
diff --git a/assets/social.js b/assets/social.js
index 87bdcc31..a53f6ffd 100755
--- a/assets/social.js
+++ b/assets/social.js
@@ -268,5 +268,16 @@
T.hovercards();
});
}
+
+ /**
+ * Social items
+ */
+ if ($('.social-items-and-more').length) {
+ $('.social-items-and-more').click(function(e){
+ e.preventDefault();
+
+ $(this).hide().parent().find('img').show();
+ });
+ }
});
})(jQuery);
diff --git a/lib/social/plugin.php b/lib/social/plugin.php
index f365ddc3..8d99b510 100644
--- a/lib/social/plugin.php
+++ b/lib/social/plugin.php
@@ -47,7 +47,7 @@ public static function add_to_social_items($key, $comment_id, array &$comments,
$comments['social_items']['parent'][$key] = array();
}
- $comments['social_items']['parent'][$key][] = $object;
+ $comments['social_items']['parent'][$key][$comment_id] = $object;
}
else {
if (!isset($comments['social_items'])) {
diff --git a/lib/social/service/twitter.php b/lib/social/service/twitter.php
index afe7f78c..f44f7733 100755
--- a/lib/social/service/twitter.php
+++ b/lib/social/service/twitter.php
@@ -387,6 +387,32 @@ public function response_id_key() {
return 'id_str';
}
+ /**
+ * Returns the Social items icon.
+ *
+ * @return string
+ */
+ public function social_items_icon() {
+ $icon = apply_filters('social_items_icon', Social::$plugins_url.'assets/retweet.png', $this->_key);
+ return '
';
+ }
+
+ /**
+ * Returns the avatar of the retweeted status.
+ *
+ * @param object $item
+ * @param int $count
+ * @return string
+ */
+ public function social_item_output($item, $count = 0) {
+ $style = '';
+ if ($count >= 10) {
+ $style = ' style="display:none"';
+ }
+ $image = sprintf('
', $item->social_profile_image_url, $style);
+ return sprintf('%s', $this->status_url($item->comment_author, $item->social_status_id), $image);
+ }
+
/**
* Returns the status URL to a broadcasted item.
*
diff --git a/social-twitter.php b/social-twitter.php
index 1bb359c8..9ab8de75 100755
--- a/social-twitter.php
+++ b/social-twitter.php
@@ -58,6 +58,7 @@ public static function comments_array(array $comments, $post_id) {
AND meta_key = 'social_in_reply_to_status_id'
OR meta_key = 'social_status_id'
OR meta_key = 'social_raw_data'
+ OR meta_key = 'social_profile_image_url'
");
$broadcasted_ids = get_post_meta($post_id, '_social_broadcasted_ids', true);
@@ -92,11 +93,18 @@ public static function comments_array(array $comments, $post_id) {
if (count($_results)) {
$parents = array();
foreach ($_results as $result) {
- if (isset($in_reply_ids[$result->meta_value])) {
- foreach ($in_reply_ids[$result->meta_value] AS $comment_id) {
- $parents[$comment_id] = $result->comment_id;
- }
- }
+ if (in_array($result->meta_key, array('social_status_id', 'social_profile_image_url')) and isset($comments['social_items'])) {
+ if (isset($comments['social_items']['parent']) and
+ isset($comments['social_items']['parent']['twitter']) and
+ isset($comments['social_items']['parent']['twitter'][$result->comment_id])) {
+ $comments['social_items']['parent']['twitter'][$result->comment_id]->{$result->meta_key} = $result->meta_value;
+ }
+ }
+ else if (isset($in_reply_ids[$result->meta_value])) {
+ foreach ($in_reply_ids[$result->meta_value] AS $comment_id) {
+ $parents[$comment_id] = $result->comment_id;
+ }
+ }
}
}
diff --git a/views/comment/social_item.php b/views/comment/social_item.php
index c25400d3..5be7e129 100644
--- a/views/comment/social_item.php
+++ b/views/comment/social_item.php
@@ -4,11 +4,12 @@
social_item_output($item, $i);
+ echo $service->social_item_output($item, $i);
+ ++$i;
}
if ($i >= 10) {
- echo sprintf(__('... and %s more', Social::$i18n), '', ($i - 10));
+ echo sprintf(__('... and %s more', Social::$i18n), '', ($i - 10));
}
?>