[BUGFIX] Better handling for retweets 62/25262/2
authorNicole Cordes <cordes@cps-it.de>
Mon, 11 Nov 2013 12:20:33 +0000 (13:20 +0100)
committerNicole Cordes <typo3@cordes.co>
Mon, 11 Nov 2013 12:22:45 +0000 (13:22 +0100)
Sometimes the retweets are cut by twitter api. This patch rebuilts
retweets internally so they are not cut and links and tags are fully
available.

Release: 1.1
Change-Id: Id16b3a38640d4649fa271f107a0b11443cc10b31
Reviewed-on: https://review.typo3.org/25262
Reviewed-by: Nicole Cordes
Tested-by: Nicole Cordes
Classes/UserFunction/user_wttwitter_userfunction.php
Resources/Private/Partials/Tweets/Show.html

index 281fdd3..f921e16 100644 (file)
@@ -70,7 +70,7 @@ class user_wttwitteruserfunction {
        function user_wttwitter_link($content = '', $conf = array()) {
                // config
                $conf = $conf['userFunc.']; // ts config
-               $string = $this->cObj->data[$conf['field']]; // get date from typoscript
+               $string = $this->cObj->getCurrentVal(); // get date from typoscript
 
                // 1. rewrite URL with typolink
                $string = str_replace('http://www.', 'www.', $string); // replace all link beginnings to http://www (part 1)
@@ -138,7 +138,7 @@ class user_wttwitteruserfunction {
        function user_wttwitter_date($content = '', $conf = array()) {
                $conf = $conf['userFunc.']; // ts config
 
-               $date = $this->cObj->data[$conf['field']]; // get date from typoscript
+               $date = $this->cObj->getCurrentVal(); // get date from typoscript
                $timestamp = strtotime($date); // change to timestamp
                $date = strftime($conf['strftime'], $timestamp); // change back to readable format
 
index 6983767..6306de0 100644 (file)
@@ -9,7 +9,14 @@
 
                {tweet -> f:cObject(typoscriptObjectPath: 'plugin.tx_wttwitter.settings.setup.tweets.created_at', currentValueKey: 'created_at')}<br />
 
-               {tweet -> f:cObject(typoscriptObjectPath: 'plugin.tx_wttwitter.settings.setup.tweets.text', currentValueKey: 'text')}
+               <f:if condition="{tweet.retweeted_status}">
+                       <f:then>
+                               <f:cObject typoscriptObjectPath="plugin.tx_wttwitter.settings.setup.tweets.text">RT @{tweet.retweeted_status.user.screen_name} {tweet.retweeted_status.text}</f:cObject>
+                       </f:then>
+                       <f:else>
+                               {tweet -> f:cObject(typoscriptObjectPath: 'plugin.tx_wttwitter.settings.setup.tweets.text', currentValueKey: 'text')}
+                       </f:else>
+               </f:if>
 
                <div style="clear: both"></div>
        </li>