コード例 #1
0
ファイル: index.php プロジェクト: evgrishin/se1614
<?php

require_once 'twitterfeed/TwitterFeed.php';
$config = (include 'config.php');
$twitter = new TwitterFeed($config);
$type = isset($_GET['type']) ? $_GET['type'] : false;
switch ($type) {
    case 'list':
        $twitter->getList(array('list_id' => isset($_GET['list_id']) ? $_GET['list_id'] : '', 'slug' => isset($_GET['slug']) ? $_GET['slug'] : '', 'owner_screen_name' => isset($_GET['owner_screen_name']) ? $_GET['owner_screen_name'] : '', 'count' => isset($_GET['count']) ? $_GET['count'] : '', 'page' => isset($_GET['page']) ? $_GET['page'] : '', 'include_rts' => isset($_GET['include_rts']) ? $_GET['include_rts'] : ''));
        break;
    case 'favorites':
        $twitter->getFavorites(array('screen_name' => isset($_GET['screen_name']) ? $_GET['screen_name'] : '', 'count' => isset($_GET['count']) ? $_GET['count'] : '', 'page' => isset($_GET['page']) ? $_GET['page'] : ''));
        break;
    case 'usertimeline':
        $twitter->getUserTimeLine(array('screen_name' => isset($_GET['screen_name']) ? $_GET['screen_name'] : '', 'count' => isset($_GET['count']) ? $_GET['count'] : '', 'page' => isset($_GET['page']) ? $_GET['page'] : '', 'include_rts' => isset($_GET['include_rts']) ? $_GET['include_rts'] : ''));
        break;
    case 'search':
        $twitter->getSearch(array('count' => isset($_GET['count']) ? $_GET['count'] : '', 'q' => isset($_GET['q']) ? $_GET['q'] : ''));
        break;
    default:
        echo json_encode(array('errors' => array(array('message' => 'Sorry, please try with a correct type.'))));
        break;
}
コード例 #2
0
 public function start_aggregation()
 {
     $this->log('<<<<<<<<<<<<<<<<<<<<<<<<<< start aggregation..');
     // increasing maximum execution time to 3 min for this part, it can take more time
     // than the default 30 secs for the images to be downloaded and processed by PHP/WP..
     // set_time_limit(180);
     $feed_enabled = false;
     // fetch from Facebook..
     $options = get_option('facebook_page');
     if (isset($options[$this->prefix . 'enabled'])) {
         $feed_enabled = true;
         $fb = new FacebookFeed();
         $result = $fb->getFeed($options);
         if ($this->feed_error($result)) {
             return $result['message'];
         } else {
             $this->save_feed_items($result, $this->sections[$this->prefix . 'facebook']);
         }
     }
     // fetch from Twitter..
     $options = get_option('twitter_page');
     if (isset($options[$this->prefix . 'enabled'])) {
         $feed_enabled = true;
         $tw = new TwitterFeed();
         $result = $tw->getFeed($options);
         if ($this->feed_error($result)) {
             return $result['message'];
         } else {
             $this->save_feed_items($result, $this->sections[$this->prefix . 'twitter']);
         }
     }
     // fetch from Instagram..
     $options = get_option('instagram_page');
     if (isset($options[$this->prefix . 'enabled'])) {
         $feed_enabled = true;
         $in = new InstagramFeed();
         $result = $in->getFeed($options);
         if ($this->feed_error($result)) {
             return $result['message'];
         } else {
             $this->save_feed_items($result, $this->sections[$this->prefix . 'instagram']);
         }
     }
     // fetch from YouTube..
     $options = get_option('youtube_page');
     if (isset($options[$this->prefix . 'enabled'])) {
         $feed_enabled = true;
         $yt = new YouTubeFeed();
         $result = $yt->getFeed($options);
         if ($this->feed_error($result)) {
             return $result['message'];
         } else {
             $this->save_feed_items($result, $this->sections[$this->prefix . 'youtube']);
         }
     }
     // fetch from Vimeo..
     $options = get_option('vimeo_page');
     if (isset($options[$this->prefix . 'enabled'])) {
         $feed_enabled = true;
         $vim = new VimeoFeed();
         $result = $vim->getFeed($options);
         if ($this->feed_error($result)) {
             return $result['message'];
         } else {
             $this->save_feed_items($result, $this->sections[$this->prefix . 'vimeo']);
         }
     }
     // fetch from RSS Feed..
     $options = get_option('rss_page');
     if (isset($options[$this->prefix . 'enabled'])) {
         $feed_enabled = true;
         $rss = new RssFeed();
         $result = $rss->getFeed($options);
         if ($this->feed_error($result)) {
             return $result['message'];
         } else {
             $this->save_feed_items($result, $this->sections[$this->prefix . 'rss']);
         }
     }
     $this->log('>>>>>>>>>>>>>>>>>>>>>>>>>> aggregation complete..!');
     if (!$feed_enabled) {
         return 'No social feeds are enabled. <a href="edit.php?post_type=' . $this->post_type . '&page=' . $this->settings_slug . '">Enable some feeds.</a>';
     }
 }
コード例 #3
0
 public static function set_tweetcount($value)
 {
     self::$tweetcount = $value;
 }
コード例 #4
0
		jQuery(document).ready(function() {
			jQuery('.twitter-timeline-horizontal').twitterslide({
				slideWidth : 328,
				minItems   : 1,
				margin     : 15
			});
		});
	</script>
</head>
<body>
	<div id="wrapper-content" class="container">

<?php 
$twitterUser = '******';
require "twitterAPI.php";
$twitterAPI = new TwitterFeed();
$twitterAPI->init($twitterUser, 20, FALSE, FALSE);
$tweets = $twitterAPI->getTweets();
?>

		<div id="vertical-example" class="row clearfix">
			<div class="grid_12 last">
				<br />
<?php 
if (count($tweets) > 0) {
    ?>
				<div class="twitter-timeline twitter-timeline-horizontal clearfix">
					<div class="ts-carousel">
						<ul>
<?php 
    $count = 0;