Esempio n. 1
0
 function widget($args, $instance)
 {
     extract($args);
     if (!empty($instance['title'])) {
         $title = apply_filters('widget_title', $instance['title']);
     } else {
         $title = __('Latest Tweets', 'cosmotheme');
     }
     if (isset($instance['number'])) {
         $number = $instance['number'];
     } else {
         $number = 10;
     }
     if (isset($instance['username'])) {
         $username = $instance['username'];
     } else {
         $username = null;
     }
     echo $before_widget;
     if ($title) {
         echo $before_title . $title . $after_title;
     }
     tweets::the_tweets($username, $number);
     echo $after_widget;
 }
Esempio n. 2
0
<?php

/**
 * Get latest tweets that only have hashtags
 */
//Load configuration
include 'conf.php';
//Load twitter class
include '../tweets.php';
$tweets = new tweets();
$tweets->setUser(TWITTER_USERNAME);
$tweets->setNumTweets(TWITTER_NUM_TWEETS);
$tweets->setIncludeRetweets(TWITTER_INCLUDE_RETWEETS);
$tweets->setWithHashtags(true);
$res = $tweets->getTweets();
//display tweets
foreach ($res as $tweet) {
    echo "{$tweet}<br><br>";
}
?>


Esempio n. 3
0
<?php

/**
 * Get latest 20 tweets
 */
//Load configuration
include 'conf.php';
//Load twitter class
include '../tweets.php';
$tweets = new tweets();
$tweets->setUser(TWITTER_USERNAME);
$tweets->setNumTweets(TWITTER_NUM_TWEETS);
$tweets->setIncludeRetweets(TWITTER_INCLUDE_RETWEETS);
$tweets->setOrderDir('desc');
$res = $tweets->getTweets();
//display tweets
foreach ($res as $tweet) {
    echo "{$tweet}<br><br>";
}
?>


Esempio n. 4
0
<?php

/**
 * Get hashtags used in user's tweets
 */
//Load configuration
include 'conf.php';
//Load twitter class
include '../tweets.php';
$tweets = new tweets();
$tweets->setUser(TWITTER_USERNAME);
$tweets->setIncludeRetweets(TWITTER_INCLUDE_RETWEETS);
$tweets->getTweets();
$hashtags = $tweets->getHashtags();
//display tweets
foreach ($hashtags as $tag) {
    echo "{$tag}<br><br>";
}
?>