load() публичный Метод

Returns the most recent statuses.
public load ( $flags = self::ME, $count = 20, array $data = NULL ) : stdClass[]
$data array
Результат stdClass[]
Пример #1
0
 public static function twSlider($app, $data)
 {
     preg_match_all("/\\[\\[twitter\\]\\]/", $data, $res);
     $cfg = unserialize(TWITTER_CONFIG);
     try {
         $twitter = new Twitter($cfg['API_key'], $cfg['API_secret'], $cfg['token'], $cfg['secret']);
         $statuses = $twitter->load(Twitter::ME);
     } catch (Exception $e) {
         $statuses = null;
     }
     foreach ($res[0] as $tw) {
         $tw = $app['twig']->render('twitter.twig', array('twitter' => $statuses));
         $data = str_replace("[[twitter]]", $tw, $data);
     }
     return $data;
 }
 function widget($args, $instance)
 {
     extract($args, EXTR_SKIP);
     echo $before_widget;
     $twitter_username = empty($instance['twitter_username']) ? ' ' : apply_filters('widget_title', $instance['twitter_username']);
     $consumerKey = empty($instance['consumerKey']) ? ' ' : apply_filters('widget_title', $instance['consumerKey']);
     $consumerSecret = empty($instance['consumerSecret']) ? ' ' : apply_filters('widget_title', $instance['consumerSecret']);
     $accessToken = empty($instance['accessToken']) ? ' ' : apply_filters('widget_title', $instance['accessToken']);
     $accessTokenSecret = empty($instance['accessTokenSecret']) ? ' ' : apply_filters('widget_title', $instance['accessTokenSecret']);
     $title = $instance['title'];
     $items = empty($instance['items']) ? ' ' : apply_filters('widget_title', $instance['items']);
     if (!is_numeric($items)) {
         $items = 5;
     }
     if (empty($title)) {
         $title = 'Recent Tweets';
     }
     if (!empty($items) && !empty($twitter_username)) {
         // user timeline
         include_once TEMPLATEPATH . "/lib/twitter/twitter.class.php";
         // ENTER HERE YOUR CREDENTIALS (see readme.txt)
         $twitter = new Twitter($consumerKey, $consumerSecret, $accessToken, $accessTokenSecret);
         $tweets = $twitter->load(Twitter::ME);
         //$obj_twitter = new Twitter($twitter_username);
         //$tweets = $obj_twitter->get($items);
         if (!empty($tweets)) {
             echo '<h3 class="widget-title">' . $title . '</h3>';
             echo '<ul id="twitter_list">';
             $i = 1;
             foreach ($tweets as $tweet) {
                 if ($i > $items) {
                     break;
                 }
                 echo '<li>';
                 if (isset($tweet->text)) {
                     echo '<a class="tweet_link" href="http://twitter.com/' . $tweet->user->screen_name . '">' . $tweet->text . '</a>';
                 }
                 echo '</li>';
                 $i++;
             }
             echo '</ul>';
         }
     }
     echo $after_widget;
 }
Пример #3
0
					<input type="text" class="name" name="player" placeholder="Whats your name?" />
					<input type="submit" id="play" value="Sign me up" />
				</form>
			</div>
			
			<hr />
			<ul id="playing">
				<?php 
//CHECK TWITTER FOR PLAYERS
require_once 'admin/twitter/twitter.class.php';
$consumerKey = 'uOBcBmCYY5EVaFnOA8Ing';
$consumerSecret = '8Zl3k7UnmQaJSXNqIH7Ak9uirZvHZYMxDb6fI9hqx58';
$accessToken = '345583576-wzlN6lG4yFmAjyTqyVneQpVFoeTbXXLdESoe9nLP';
$accessTokenSecret = 'faR0Y7tP0zXOp8SzDQaICq5dlTf2dztJNbmis7RoQk';
$twitter = new Twitter($consumerKey, $consumerSecret, $accessToken, $accessTokenSecret);
$channel = $twitter->load(Twitter::REPLIES);
foreach ($channel->status as $status) {
    $con = strstr($status->text, '#');
    $from = strstr($status->text, '@');
    echo $status;
    if ($con === '#playing') {
    }
}
?>
				<?php 
$res = mysql_query("SELECT name,status FROM email");
$n = mysql_num_rows($res);
$i = 1;
if ($n < 10) {
    echo "<h2>Who's playing this week</h2>";
} else {
Пример #4
0
<?php

require_once '../twitter.class.php';
// enables caching (path must exists and must be writable!)
// Twitter::$cacheDir = dirname(__FILE__) . '/temp';
// ENTER HERE YOUR CREDENTIALS (see readme.txt)
$twitter = new Twitter($consumerKey, $consumerSecret, $accessToken, $accessTokenSecret);
$channel = $twitter->load(Twitter::ME_AND_FRIENDS);
?>
<!doctype html>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Twitter timeline demo</title>

<ul>
<?php 
foreach ($channel->status as $status) {
    ?>
	<li><a href="http://twitter.com/<?php 
    echo $status->user->screen_name;
    ?>
"><img src="<?php 
    echo htmlspecialchars($status->user->profile_image_url);
    ?>
">
		<?php 
    echo htmlspecialchars($status->user->name);
    ?>
</a>:
		<?php 
    echo Twitter::clickable($status->text);
    ?>
Пример #5
0
<?php

require_once '../src/twitter.class.php';
// ENTER HERE YOUR CREDENTIALS (see readme.txt)
$consumerKey = "NKqsayp5CblGxyTwMAtLTjynM";
$consumerSecret = "7Lq8HiP1gi7QYW93gvLNXAYV4eeISLLpull0bhOW6mH6TWSnam";
$accessToken = "276740008-7Tva3cvpI7NXJFT8ycgIkVjELJv5l23CDvJenmYE";
$accessTokenSecret = "5tMkO9Bg33o9oQVKPagrb0yXFbORNtGTABHTabwjVKPhr";
$twitter = new Twitter($consumerKey, $consumerSecret, $accessToken, $accessTokenSecret);
$statuses = $twitter->load(Twitter::ME_AND_FRIENDS);
?>

<html>
<head>
	<title>HyTweet</title>
</head>
<body>
	<center>
		<h1>HyTweet</h1>

		<h3>Enter Your Tweet Here!</h3>
		<form method="POST" action="actionBruh.php">
				<textarea name="userTweet" rows="4" cols="40"/></textarea>
				<br><br>
				<input type="submit" value="Send Tweet" />
				<br>
	</center>

		<!-- Code for loading the twitter feed. -->
		<ul>
		<?php 
Пример #6
0
 public static function findMessages($amount = 1)
 {
     global $consumerKey, $consumerSecret, $accessToken, $accessTokenSecret;
     $twitter = new Twitter($consumerKey, $consumerSecret, $accessToken, $accessTokenSecret);
     return $twitter->load(Twitter::ME_AND_FRIENDS, $amount);
 }
Пример #7
0
<?php

require __DIR__ . '/vendor/autoload.php';
define('_APP_', __DIR__);
$item = new \src\myframework\Sinhvien();
$item->toString();
//test
$test = new \src\laravel\Demo();
$test->String();
//include
$test = new myNameSpace\test();
$test->doSomething();
$db = new \Config\MyDB();
$db->myfunction();
//demo twitter connect
$tw = new Twitter("xJmK06x5ZrMAWQB9tATHLW15F", "KdeuIwErcp1I0se3fHBBqlGCbdQH8KmM6ZnY3Lmrz87hvFoLTz", "730571895565737984-y2SH4f6LYRV4eamUntS0Qj5GrfsyQYo", "FI4y8JWgnbOoHE6Pm9OlWHzOUxVw4Q8cj5ZoZnblbqFjO");
$data = $tw->load(Twitter::ME);
print_r($data[0]->user);
Пример #8
0
<?php

require_once 'twitter.class.php';
// enables caching (path must exists and must be writable!)
// Twitter::$cacheDir = dirname(__FILE__) . '/temp';
$twitter = new Twitter('pokusnyucet2', '123456');
$withFriends = FALSE;
$channel = $twitter->load($withFriends);
?>

<ul>
<?php 
foreach ($channel->status as $status) {
    ?>
	<li><a href="http://twitter.com/<?php 
    echo $status->user->screen_name;
    ?>
"><?php 
    echo $status->user->name;
    ?>
</a>:
	<?php 
    echo $status->text;
    ?>
	<small>at <?php 
    echo date("j.n.Y H:i", strtotime($status->created_at));
    ?>
</small>
	</li>
<?php 
}
Пример #9
0
<?php

require_once "../../shared-libraries/twitter/twitter.class.php";
$twitter = new Twitter($_GET['consumerKey'], $_GET['consumerSecret'], $_GET['accessToken'], $_GET['accessTokenSecret']);
try {
    if ($_GET["content"] == "replies") {
        $statuses = $twitter->load(Twitter::REPLIES);
        $label = "Tweets Mentioning @alazyreader";
    } elseif ($_GET["content"] == "me") {
        $statuses = $twitter->load(Twitter::ME);
        $label = "@alazyreader's Recent Tweets";
    }
} catch (Exception $e) {
    ?>
    <div>
        <div class="jumbo">Twitter Module</div>
        <div>Error getting tweets.</div>
        <!-- <?php 
    $e;
    ?>
 -->
    </div>
    <?php 
    return;
}
?>

<div class="twitter">
	<table>
        <tr><th class="jumbo header" colspan='2'><?php 
echo $label;
Пример #10
0
function twitter()
{
	header('Content-type: text/html; charset=utf-8');

	require_once(ROOT . 'interfase/twitter.php');

	$a = decode_ht('.htsa');

	foreach ($a as $i => $row) {
		$a[$i] = _decode($row);
	}

	$twitter = new Twitter($a[0], $a[1], $a[2], $a[3]);
	$channel = $twitter->load(Twitter::ME, 10);

	foreach ($channel->status as $status) {
		$in_reply = (int) $status->in_reply_to_user_id;

		if ($in_reply) {
			continue;
		}

		$sql = 'SELECT tw_status
			FROM _twitter
			WHERE tw_status = ?';


		// Mon Aug 22 03:31:16 +0000 2011
		$created_at = $status->created_at;
		$format = 'D M d H:i:s P Y';

		$at = date_parse_from_format($format, $created_at);

		/*
		 * int gmmktime ([ int $hour = gmdate("H") [, int $minute = gmdate("i") [, int $second = gmdate("s") [, i
		 * nt $month = gmdate("n") [, int $day = gmdate("j") [, int $year = gmdate("Y") [, int $is_dst = -1 ]]]]]]] )
		 * */

		$created_date = gmmktime($at['hour'], $at['minute'], $at['second'], $at['month'], $at['day'], $at['year']);
		$message = htmlentities(Twitter::clickable($status->text), ENT_NOQUOTES, 'UTF-8');
		$message = str_replace(array('&lt;', '&gt;'), array('<', '>'), $message);

		$sql_insert = array(
			'status' => (string) $status->id,
			'time' => $created_date,
			'message' => $message,
			'name' => (string) $status->user->screen_name,
			'followers' => (int) $status->user->followers_count,
			'friends' => (int) $status->user->friends_count
		);

		echo '<pre>';
		print_r($sql_insert);
		echo '</pre>';
		//exit;

		// id created_at text

		//echo $status->created_at . '<br /><br />';
		//echo  . '<br /><br />';
	}

	/*
	 * <li><a href="http://twitter.com/<?php echo $status->user->screen_name ?>"><img src="<?php echo htmlspecialchars($status->user->profile_image_url) ?>">
			<?php echo htmlspecialchars($status->user->name) ?></a>:
			<?php echo Twitter::clickable($status->text) ?>
			<small>at <?php echo date("j.n.Y H:i", strtotime($status->created_at)) ?></small>
		</li>
	 * */
}