public function getGasPrice()
 {
     try {
         $TweetPHP = new \TweetPHP(array('consumer_key' => \Settings::Twitter_ConsumerKey, 'consumer_secret' => \Settings::Twitter_ConsumerSecret, 'access_token' => \Settings::Twitter_AccessToken, 'access_token_secret' => \Settings::Twitter_AccessTokenSecret, 'twitter_screen_name' => 'St1Sverige', 'cache_dir' => __DIR__ . DIRECTORY_SEPARATOR . 'cache' . DIRECTORY_SEPARATOR, 'cache_time' => 60 * 60 * 24));
         $tweet_array = $TweetPHP->get_tweet_array();
         $gasPrice = new GasPrice($tweet_array);
         return $gasPrice;
     } catch (\Exception $e) {
         return false;
     }
 }
Example #2
0
 public function write($type = 'twitter', $limit = 4)
 {
     $TweetPHP = new TweetPHP($this->config + array('twitter_screen_name' => 'osmcz', 'tweets_to_display' => 40, 'tweets_to_retrieve' => 40, 'ignore_retweets' => false, 'date_lang' => 'cs_CZ', 'cachetime' => 120, 'cache_dir' => $this->parent->context->params['tempDir'] . '/'));
     $tweet_array = $TweetPHP->get_tweet_array();
     if (count($tweet_array) === 1) {
         //error message
         print_r($tweet_array);
         return;
     }
     $weeklys = array();
     $tweets = array();
     $all = array();
     foreach ($tweet_array as $t) {
         $t['retweet'] = false;
         if (isset($t['retweeted_status'])) {
             $orig = $t;
             $t = $t['retweeted_status'];
             $t['retweet'] = true;
             $t['orig'] = $orig;
         }
         if (preg_match('~^(WeeklyOSM \\d+[^:]*):~', $t['text'], $matches) && self::getWeeklyLink($t)) {
             $text = $t['text'];
             $text = str_replace(self::getWeeklyLink($t), '', $text);
             // remove weekly_link
             $text = str_replace($matches[0], '', $text);
             // remove "Weekly...:"
             $text = str_replace('OSM.cz ', 'OpenStreetMap.cz ', $text);
             $text = self::linkifiedText($t, $text);
             //images or other links(?)
             $t['weekly_text'] = $text;
             $t['weekly_title'] = $matches[1];
             $t['weekly_link'] = self::getWeeklyLink($t, 'expanded_url');
             $weeklys[] = $t;
         } else {
             $t['text'] = self::linkifiedText($t, $t['text']);
             $tweets[] = $t;
         }
     }
     $this->template->limit = isset($_GET['tweets']) ? $_GET['tweets'] : $limit;
     $this->template->tweets = $tweets;
     $this->template->w_limit = isset($_GET['weeklys']) ? $_GET['weeklys'] : 1;
     $this->template->weeklys = $weeklys;
     if ($type == 'weekly') {
         $this->template->setFile(dirname(__FILE__) . '/TwitterPlugin-weekly.latte');
     } else {
         $this->template->setFile(dirname(__FILE__) . '/TwitterPlugin.latte');
     }
     echo $this->template->render();
 }
Example #3
0
function porto_twitter_tweets()
{
    if (!isset($_POST['id'])) {
        die;
    }
    $widget_array = get_option('widget_tweets-widget');
    $instance = $widget_array[$_POST['id']];
    require_once dirname(__FILE__) . '/tweet-php/TweetPHP.php';
    $consumer_key = $instance['consumer_key'];
    $consumer_secret = $instance['consumer_secret'];
    $access_token = $instance['access_token'];
    $access_secret = $instance['access_token_secret'];
    $twitter_screen_name = $instance['screen_name'];
    $tweets_to_display = $instance['count'];
    $TweetPHP = new TweetPHP(array('consumer_key' => $consumer_key, 'consumer_secret' => $consumer_secret, 'access_token' => $access_token, 'access_token_secret' => $access_secret, 'twitter_screen_name' => $twitter_screen_name, 'cache_file' => dirname(__FILE__) . '/tweet-php/cache/twitter.txt', 'cache_file_raw' => dirname(__FILE__) . '/tweet-php/cache/twitter-array.txt', 'cachetime' => 60, 'tweets_to_display' => $tweets_to_display, 'ignore_replies' => true, 'ignore_retweets' => true, 'twitter_style_dates' => true, 'twitter_date_text' => array('seconds', 'minutes', 'about', 'hour', 'ago'), 'date_format' => '%I:%M %p %b %d%O', 'date_lang' => get_locale(), 'format' => 'array', 'twitter_wrap_open' => '<ul>', 'twitter_wrap_close' => '</ul>', 'tweet_wrap_open' => '<li><span class="status"><i class="fa fa-twitter"></i> ', 'meta_wrap_open' => '</span><span class="meta"> ', 'meta_wrap_close' => '</span>', 'tweet_wrap_close' => '</li>', 'error_message' => __('Oops, our twitter feed is unavailable right now.', 'porto'), 'error_link_text' => __('Follow us on Twitter', 'porto'), 'debug' => false));
    echo $TweetPHP->get_tweet_list();
    die;
}
<?php

pull_instagram('258284433', 'd93b5d133c354946845bece40ea08617', '1');
$TweetPHP = new TweetPHP();
echo $TweetPHP->get_tweet_list();
function tap_twitter_feed()
{
    $TweetPHP = new TweetPHP(array('consumer_key' => 'hAsxS7FEN9smQDWeV6OryRVq5', 'consumer_secret' => 'mZidJX9t5kGwht56c0iblQSrTjWVsA0685QKFPMxAXxiWTHA6f', 'access_token' => '263650827-N1HVtIfAIur0HlJ5hy0hgQ7HxcsuicMiVtOtVnhs', 'access_token_secret' => 'kl1MY7StYPGwUxMcBTzwfMuw1B8BQxn5zn8mYEBLc9euD', 'twitter_screen_name' => 'TapestryCare'));
    echo $TweetPHP->get_tweet_list();
}