예제 #1
0
파일: index.php 프로젝트: ntulip/TwitApps
<?php 
    return;
}
// Obtain a request object for the request we want to make
$req = new OAuthRequester($server['server_uri'] . '/direct_messages.json', 'GET', array());
// Sign the request, perform a curl request and return the results, throws OAuthException exception on an error
try {
    $result = $req->doRequest($user_id);
} catch (OAuthException $e) {
    header('Location: /follows/manage/register');
    exit;
}
$page = 'follows';
$title = 'Follows';
require dirname(__FILE__) . '/../../header.tpl.php';
echo '<h1>Direct Messages</h1>';
echo '<p>Since this is currently just an OAuth test this just shows the results of a call to get your direct messages. This is an authenticated request so it serves to prove the point but has nothing to do with this application.</p>';
$result = json_decode($result['body']);
if (!$result) {
    die('Invalid response');
}
foreach ($result as $msg) {
    echo '<div style="clear:both; margin-bottom: 0.5em;">';
    echo '<img style="float:left;margin-right:0.5em;margin-bottom:0.25em;" src="' . htmlentities($msg->sender->profile_image_url) . '" />';
    echo Twitter::HTMLifyTweet($msg->text) . '<br />';
    echo '<small>';
    echo ucfirst(Twitter::FormatStamp(strtotime($msg->created_at)));
    echo '</small>';
    echo '<div style="clear:both;"></div></div>';
}
require dirname(__FILE__) . '/../../footer.tpl.php';
예제 #2
0
$url = 'http://twitter.com/' . rawurlencode($from_user) . '/statuses/' . rawurlencode($id);
?>
<div style="margin-bottom: 1em;">
	<div>
		<a href="<?php 
echo $url;
?>
"><img src="<?php 
echo $profile_image_url;
?>
" width="48" height="48" align="left" border="0" style="margin-right: 0.25em;" /></a>
		<strong><a href="http://twitter.com/<?php 
echo rawurlencode($from_user);
?>
" style="text-decoration:none;"><?php 
echo htmlentities($from_user);
?>
</a></strong> <?php 
echo Twitter::HTMLifyTweet($text);
?>
<br />
		<div style="font-size: small; font-style: italic;"><a href="<?php 
echo $url;
?>
" style="text-decoration:none;"><?php 
echo htmlentities(ucfirst(InDays(strtotime($created_at))));
?>
</a></div>
	</div><div style="clear:both;"></div>
</div>