-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtwitterSlide.php
59 lines (51 loc) · 2.3 KB
/
twitterSlide.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
class twitterSlide {
function __construct($init) {
$this->tweetArray = $init;
}
function getBox($feedData, ) {
return "
<div class='tweet-box'>
<h2>Latest Tweets</h2>
<div class='tweets-widget'>
<ul class='tweet-list'>
<?php
foreach($feedData as $tweet) {
$latestTweet = $tweet->text;
$latestTweet = preg_replace('/https:\/\/([a-z0-9_\.\-\+\&\!\#\~\/\,]+)/i', '<a href='https://$1' target='_blank'>https://$1</a>', $latestTweet);
$latestTweet = preg_replace('/@([a-z0-9_]+)/i', '<a class='tweet-author' href='https://twitter.com/$1' target='_blank'>@$1</a>', $latestTweet);
$tweetTime = date('D M d H:i:s',strtotime($tweet->created_at));
?>
<li class='tweet-wrapper'>
<div class='tweet-thumb'>
<span><a href='<?php echo $tweet->user->url; ?>' title='<?php echo $tweet->user->name; ?>'><img alt='' src='<?php echo $tweet->user->profile_image_url; ?>'></a></span>
</div>
<div class='tweet-content'>
<h3 class='title' title='<?php echo $tweet->text; ?>'><?php echo $latestTweet; ?></h3>
<span class='meta'><?php echo $tweetTime; ?> - <?php echo $tweet->favorite_count; ?> Favorite</span>
</div>
</li>
<?php } ?>
</ul>
</div>
</div>
";
}
function getUserInfo($profilePic, $userName, $userScreenName) {
return "
<div class='user-info'>
<img src='<?php echo $profilePic; ?>' class='img-thumbnail' />
<h2><?php echo $userName; ?></h2>
<a href='https://twitter.com/<?php echo $userScreenName; ?>' target='_blank'>@<?php echo $userScreenName; ?></a>
</div>
";
}
function getTweetInfo($tweetsNum, $followerNum) {
return "
<div class='tweet-info'>
<div class='fnum'><div>Tweets</div><div class='badge'><?php echo $tweetsNum; ?></div></div>
<div class='fnum'><div>Followers</div><div class='badge'><?php echo $followerNum; ?></div></div>
</div>
";
}
}