#2362 twitter
This commit is contained in:
parent
d822e15219
commit
48f0dde017
|
@ -413,7 +413,10 @@ if ($uiBrowser->userid) {
|
||||||
|
|
||||||
case "twitter.settings":
|
case "twitter.settings":
|
||||||
$Smarty->assign('dynform', $uiBrowser->TWITTER->getSettingsForm());
|
$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);
|
$Smarty->assign('act', $action);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<div class="container_elements" style="width: 607px;">
|
<div class="container_elements" style="width: 607px;">
|
||||||
<h1>##Twitter settings##</h1>
|
<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>
|
<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"}
|
{include file="sub/dynForm_plain.tpl"}
|
||||||
|
|
|
@ -80,7 +80,7 @@ class uiTwitter {
|
||||||
array(
|
array(
|
||||||
'element' => 'twitter-config-label',
|
'element' => 'twitter-config-label',
|
||||||
'type' => 'static',
|
'type' => 'static',
|
||||||
'text' => '<legend style="font-weight: bold;">Tweet configuration</legend>'
|
'text' => '<legend style="font-weight: bold;"></small>Tweet configuration<small></legend>'
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'element' => 'twitter-prefix',
|
'element' => 'twitter-prefix',
|
||||||
|
@ -174,7 +174,7 @@ class uiTwitter {
|
||||||
array(
|
array(
|
||||||
'element' => 'twitter-shortener-label',
|
'element' => 'twitter-shortener-label',
|
||||||
'type' => 'static',
|
'type' => 'static',
|
||||||
'text' => '<legend style="font-weight: bold;">URL shortener</legend>'
|
'text' => '<legend style="font-weight: bold;"></small>URL shortener<small></legend>'
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'element' => 'twitter-shortener-provider',
|
'element' => 'twitter-shortener-provider',
|
||||||
|
@ -274,7 +274,7 @@ class uiTwitter {
|
||||||
$this->Base->_retMsg('Twitter settings saved.');
|
$this->Base->_retMsg('Twitter settings saved.');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getFeed($p_useSampledata = false, $p_twitterfy = false)
|
public function getFeed($p_useSampledata = false)
|
||||||
{
|
{
|
||||||
if ($p_useSampledata) {
|
if ($p_useSampledata) {
|
||||||
$whatsplaying = array(
|
$whatsplaying = array(
|
||||||
|
@ -322,10 +322,7 @@ class uiTwitter {
|
||||||
}
|
}
|
||||||
|
|
||||||
$tweet = $tweetprefix . $tweetbody . $tweetsuffix;
|
$tweet = $tweetprefix . $tweetbody . $tweetsuffix;
|
||||||
|
|
||||||
if ($p_twitterfy) {
|
|
||||||
$tweet = $this->twitterify($tweet);
|
|
||||||
}
|
|
||||||
return $tweet;
|
return $tweet;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -394,11 +391,13 @@ class uiTwitter {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function twitterify($ret) {
|
public function twitterify($p_string)
|
||||||
$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);
|
$string = preg_replace("#(^|[\n ])([\w]+?://[\w]+[^ \"\n\r\t< ]*)#", "\\1<a href=\"\\2\" target=\"_blank\">\\2</a>", $p_string);
|
||||||
$ret = preg_replace("/@(\w+)/", "<a href=\"http://www.twitter.com/\\1\" target=\"_blank\">@\\1</a>", $ret);
|
$string = preg_replace("#(^|[\n ])((www|ftp)\.[^ \"\t\n\r< ]*)#", "\\1<a href=\"http://\\2\" target=\"_blank\">\\2</a>", $string);
|
||||||
$ret = preg_replace("/#(\w+)/", "<a href=\"http://search.twitter.com/search?q=\\1\" target=\"_blank\">#\\1</a>", $ret);
|
$string = preg_replace("/@(\w+)/", "<a href=\"http://www.twitter.com/\\1\" target=\"_blank\">@\\1</a>", $string);
|
||||||
return $ret;
|
$string = preg_replace("/#(\w+)/", "<a href=\"http://search.twitter.com/search?q=\\1\" target=\"_blank\">#\\1</a>", $string);
|
||||||
|
|
||||||
|
return $string;
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue