'Recent Tweets', 'number' => '5', 'username' => 'twitter', 'link_title' => 'true', 'refresh' => '30', 'bird' => 'true', 'autolinks' => 'true', 'user_links' => 'true', 'date' => 'true' ); class Tweets extends WP_Widget { function __construct() { $widget_options = array('description' => 'Advanced widget for displaying the recent tweets'); $control_options = array( 'width' => 400); $this->WP_Widget('tweets', '» Twitter Widget', $widget_options, $control_options); } function widget($args, $instance) { extract( $args ); $title = apply_filters('widget_title', $instance['title']); $twitterFeed = $this->loadTwitterFeed($instance); if (!is_wp_error( $twitterFeed ) ) { $maxitems = $twitterFeed->get_item_quantity($instance['number']); $rss_items = $twitterFeed->get_items(0, $maxitems); if($maxitems > 0) { ?> ".$title.""; else echo $title?>
Display: latest tweets, refresh every minutes
Misc Options: value="true" /> Link the widget title to my Twitter profile homepage.
value="true" /> Display the bird icon.
value="true" /> Convert URLs to links
value="true" /> Convert @users to links
value="true" /> Show the date/time
set_feed_url($url); $feed->set_cache_class('WP_Feed_Cache'); $feed->set_file_class('WP_SimplePie_File'); $feed->set_cache_duration($cache_duration); $feed->init(); $feed->handle_content_type(); if ( $feed->error() ) { return new WP_Error('simplepie-error', $feed->error()); } return $feed; } function conver_hyperlinks($text) { $text = preg_replace('/\b([a-zA-Z]+:\/\/[\w_.\-]+\.[a-zA-Z]{2,6}[\/\w\-~.?=&%#+$*!]*)\b/i',"$1", $text); $text = preg_replace('/\b(?$1", $text); $text = preg_replace("/\b([a-zA-Z][a-zA-Z0-9\_\.\-]*[a-zA-Z]*\@[a-zA-Z][a-zA-Z0-9\_\.\-]*[a-zA-Z]{2,6})\b/i","$1", $text); $text = preg_replace('/([\.|\,|\:|\¡|\¿|\>|\{|\(]?)#{1}(\w*)([\.|\,|\:|\!|\?|\>|\}|\)]?)\s/i', "$1#$2$3 ", $text); return $text; } function conver_twitter_users($text) { $text = preg_replace('/([\.|\,|\:|\¡|\¿|\>|\{|\(]?)@{1}(\w*)([\.|\,|\:|\!|\?|\>|\}|\)]?)\s/i', "$1@$2$3 ", $text); return $text; } } add_action('widgets_init', create_function('', 'return register_widget("Tweets");')); ?>