WebsiteBaker 2.13.8 is now available!
R.I.P Dietmar (luisehahne) and thank you for all your valuable work for WBhttps://forum.websitebaker.org/index.php/topic,32355.0.html
<?php //use [[tweet?name=mytweetname&max=5]]if (isset($_SESSION['tweets'])) return $_SESSION['tweets']; //prevent too many callsif (!isset($name)) return true;if (!isset($max)) $max = 5;if (!function_exists('fetch_tweets')) { function fetch_tweets($username, $maxtweets) { $tweets = simplexml_load_file("http://twitter.com/statuses/user_timeline/" . $username . ".rss"); $tweet_array = array(); foreach ( $tweets->channel->item as $tweet ) { if ($maxtweets == 0) { break; } else { $twit = $tweet->description; $twit = substr(strstr($twit, ': '), 2, strlen($twit)); $twit = preg_replace("/([\w]+:\/\/[\w-?&;#~=\.\/\@]+[\w\/])/i","<a target=\"_blank\" href=\"$1\">$1</a>",$twit); $twit = preg_replace("(@([a-zA-Z0-9\_]+))", "<a target=\"_blank\" href=\"http://www.twitter.com/\\1\">\\0</a>", $twit); $twit = preg_replace('/(^|\s)#(\w+)/', '\1<a target=\"_blank\" href="http://search.twitter.com/search?q=%23\2">#\2</a>', $twit); $twit = iconv("UTF-8", DEFAULT_CHARSET, $twit); $pubdate = strtotime($tweet->pubDate); $propertime = date(DATE_FORMAT.', '.TIME_FORMAT, $pubdate); //Customize this to your liking $tweet_item = array('desc' => $twit,'date' => $propertime,); array_push($tweet_array, $tweet_item); $maxtweets--; } } return $tweet_array; }}$mytweets = fetch_tweets($name, $max);$rval = '<div class="twitter-updates">';foreach ($mytweets as $k => $v) { $rval .= '<div><p class="twitter-update">' .$v['desc']. '</p><p class="twitter-date">' .$v['date']. '</p></div>';}$rval .= '</div>';$_SESSION['tweets'] = $rval;return $rval;