diff --git a/campcaster/src/modules/htmlUI/var/html/ui_browser.php b/campcaster/src/modules/htmlUI/var/html/ui_browser.php index 8ef88c8fa..243308581 100644 --- a/campcaster/src/modules/htmlUI/var/html/ui_browser.php +++ b/campcaster/src/modules/htmlUI/var/html/ui_browser.php @@ -413,7 +413,10 @@ if ($uiBrowser->userid) { case "twitter.settings": $Smarty->assign('dynform', $uiBrowser->TWITTER->getSettingsForm()); - $Smarty->assign('twitter', array('samplefeed' => $uiBrowser->TWITTER->getFeed(true, true))); + $Smarty->assign('twitter', array( + 'samplefeed' => uiTwitter::twitterify($uiBrowser->TWITTER->getFeed(true)), + 'samplefeed_length' => strlen($uiBrowser->TWITTER->getFeed(true))) + ); $Smarty->assign('act', $action); break; } diff --git a/campcaster/src/modules/htmlUI/var/templates/twitter/settings.tpl b/campcaster/src/modules/htmlUI/var/templates/twitter/settings.tpl index e318b79a1..324f6058c 100644 --- a/campcaster/src/modules/htmlUI/var/templates/twitter/settings.tpl +++ b/campcaster/src/modules/htmlUI/var/templates/twitter/settings.tpl @@ -2,7 +2,7 @@

##Twitter settings##

-Current tweet layout (sample length: {$twitter.samplefeed|strlen}):
+Current tweet layout (sample length: {$twitter.samplefeed_length}):
{$twitter.samplefeed}
{include file="sub/dynForm_plain.tpl"} diff --git a/campcaster/src/modules/htmlUI/var/ui_twitter.class.php b/campcaster/src/modules/htmlUI/var/ui_twitter.class.php index 350a84c28..ff507c4a6 100644 --- a/campcaster/src/modules/htmlUI/var/ui_twitter.class.php +++ b/campcaster/src/modules/htmlUI/var/ui_twitter.class.php @@ -80,7 +80,7 @@ class uiTwitter { array( 'element' => 'twitter-config-label', 'type' => 'static', - 'text' => 'Tweet configuration' + 'text' => 'Tweet configuration' ), array( 'element' => 'twitter-prefix', @@ -174,7 +174,7 @@ class uiTwitter { array( 'element' => 'twitter-shortener-label', 'type' => 'static', - 'text' => 'URL shortener' + 'text' => 'URL shortener' ), array( 'element' => 'twitter-shortener-provider', @@ -274,7 +274,7 @@ class uiTwitter { $this->Base->_retMsg('Twitter settings saved.'); } - public function getFeed($p_useSampledata = false, $p_twitterfy = false) + public function getFeed($p_useSampledata = false) { if ($p_useSampledata) { $whatsplaying = array( @@ -322,10 +322,7 @@ class uiTwitter { } $tweet = $tweetprefix . $tweetbody . $tweetsuffix; - - if ($p_twitterfy) { - $tweet = $this->twitterify($tweet); - } + return $tweet; } @@ -394,11 +391,13 @@ class uiTwitter { return false; } - public function twitterify($ret) { - $ret = preg_replace("#(^|[\n ])([\w]+?://[\w]+[^ \"\n\r\t< ]*)#", "\\1\\2", $ret); - $ret = preg_replace("#(^|[\n ])((www|ftp)\.[^ \"\t\n\r< ]*)#", "\\1\\2", $ret); - $ret = preg_replace("/@(\w+)/", "@\\1", $ret); - $ret = preg_replace("/#(\w+)/", "#\\1", $ret); - return $ret; + public function twitterify($p_string) + { + $string = preg_replace("#(^|[\n ])([\w]+?://[\w]+[^ \"\n\r\t< ]*)#", "\\1\\2", $p_string); + $string = preg_replace("#(^|[\n ])((www|ftp)\.[^ \"\t\n\r< ]*)#", "\\1\\2", $string); + $string = preg_replace("/@(\w+)/", "@\\1", $string); + $string = preg_replace("/#(\w+)/", "#\\1", $string); + + return $string; } } \ No newline at end of file