-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Possible truncation issue #19
Comments
When I retweet this: https://twitter.com/nrjeon/status/385997195335303168 |
The following patch fixes the problem: diff -urN a/classes/aktt_tweet.php b/classes/aktt_tweet.php
--- a/classes/aktt_tweet.php 2013-10-05 01:18:26.000000000 +0900
+++ b/classes/aktt_tweet.php 2013-10-05 01:19:38.000000000 +0900
@@ -90,6 +90,9 @@
* @return string
*/
public function content() {
+ if ($this->is_native_retweet()) {
+ return $this->data->retweeted_status->text;
+ }
if (isset($this->data) && isset($this->data->text)) {
return $this->data->text;
}
@@ -141,7 +144,11 @@
* @return string
*/
public function hashtags() {
- return (isset($this->data) && isset($this->data->entities) ? $this->data->entities->hashtags : array());
+ if ($this->is_native_retweet()) {
+ return (isset($this->data->retweeted_status->entities) ? $this->data->retweeted_status->entities->hashtags : array());
+ } else {
+ return (isset($this->data) && isset($this->data->entities) ? $this->data->entities->hashtags : array());
+ }
}
/**
@@ -150,7 +157,11 @@
* @return string
*/
public function mentions() {
- return (isset($this->data) && isset($this->data->entities) ? $this->data->entities->user_mentions : array());
+ if ($this->is_native_retweet()) {
+ return (isset($this->data->retweeted_status->entities) ? $this->data->retweeted_status->entities->user_mentions : array());
+ } else {
+ return (isset($this->data) && isset($this->data->entities) ? $this->data->entities->user_mentions : array());
+ }
}
/**
@@ -159,7 +170,11 @@
* @return string
*/
public function urls() {
- return (isset($this->data) && isset($this->data->entities) ? $this->data->entities->urls : array());
+ if ($this->is_native_retweet()) {
+ return (isset($this->data->retweeted_status->entities) ? $this->data->retweeted_status->entities->urls : array());
+ } else {
+ return (isset($this->data) && isset($this->data->entities) ? $this->data->entities->urls : array());
+ }
}
/**
@@ -287,12 +302,22 @@
/**
- * Is this a retweet?
+ * Is this a native retweet?
+ *
+ * @return bool
+ */
+ function is_native_retweet() {
+ return (bool) (isset($this->data) && !empty($this->data->retweeted_status));
+ }
+
+
+ /**
+ * Is this a retweet? (This includes both native and non-native retweets.)
*
* @return bool
*/
function is_retweet() {
- return (bool) (AKTT::substr($this->content(), 0, 2) == 'RT' || !empty($this->data->retweeted_status));
+ return (bool) (AKTT::substr($this->content(), 0, 2) == 'RT' || $this->is_native_retweet());
}
@@ -366,6 +391,12 @@
$str = AKTT::substr_replace($str, $entity['replace'], $start, ($end - $start));
$diff += AKTT::strlen($entity['replace']) - ($end - $start);
}
+
+ if ($this->is_native_retweet()) {
+ $orig_screen_name = $this->data->retweeted_status->user->screen_name;
+ $str = 'RT '.AKTT::profile_link($orig_screen_name).': '.$str;
+ }
+
return $str;
}
The patch basically does:
|
alexkingorg
added a commit
that referenced
this issue
Dec 30, 2013
Thanks, fixed in 959973d |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://wordpress.org/support/topic/incomplete-twitt-is-inserted-to-the-db?replies=2
The text was updated successfully, but these errors were encountered: