This commit is contained in:
sebastian 2010-02-17 16:50:14 +00:00
parent d822e15219
commit 48f0dde017
3 changed files with 17 additions and 15 deletions

View File

@ -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;
}

View File

@ -2,7 +2,7 @@
<div class="container_elements" style="width: 607px;">
<h1>##Twitter settings##</h1>
Current tweet layout (sample length: {$twitter.samplefeed|strlen}): <br>
Current tweet layout (sample length: {$twitter.samplefeed_length}): <br>
<div style='border: 1px solid #aaa; padding: 5px 20px; background: #f6f9ff; font-size: 1.5em; margin: 20px 0px;'>{$twitter.samplefeed}</div>
{include file="sub/dynForm_plain.tpl"}

View File

@ -80,7 +80,7 @@ class uiTwitter {
array(
'element' => 'twitter-config-label',
'type' => 'static',
'text' => '<legend style="font-weight: bold;">Tweet configuration</legend>'
'text' => '<legend style="font-weight: bold;"></small>Tweet configuration<small></legend>'
),
array(
'element' => 'twitter-prefix',
@ -174,7 +174,7 @@ class uiTwitter {
array(
'element' => 'twitter-shortener-label',
'type' => 'static',
'text' => '<legend style="font-weight: bold;">URL shortener</legend>'
'text' => '<legend style="font-weight: bold;"></small>URL shortener<small></legend>'
),
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<a href=\"\\2\" target=\"_blank\">\\2</a>", $ret);
$ret = preg_replace("#(^|[\n ])((www|ftp)\.[^ \"\t\n\r< ]*)#", "\\1<a href=\"http://\\2\" target=\"_blank\">\\2</a>", $ret);
$ret = preg_replace("/@(\w+)/", "<a href=\"http://www.twitter.com/\\1\" target=\"_blank\">@\\1</a>", $ret);
$ret = preg_replace("/#(\w+)/", "<a href=\"http://search.twitter.com/search?q=\\1\" target=\"_blank\">#\\1</a>", $ret);
return $ret;
public function twitterify($p_string)
{
$string = preg_replace("#(^|[\n ])([\w]+?://[\w]+[^ \"\n\r\t< ]*)#", "\\1<a href=\"\\2\" target=\"_blank\">\\2</a>", $p_string);
$string = preg_replace("#(^|[\n ])((www|ftp)\.[^ \"\t\n\r< ]*)#", "\\1<a href=\"http://\\2\" target=\"_blank\">\\2</a>", $string);
$string = preg_replace("/@(\w+)/", "<a href=\"http://www.twitter.com/\\1\" target=\"_blank\">@\\1</a>", $string);
$string = preg_replace("/#(\w+)/", "<a href=\"http://search.twitter.com/search?q=\\1\" target=\"_blank\">#\\1</a>", $string);
return $string;
}
}