-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
151 lines (116 loc) · 5.36 KB
/
index.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
<?php
require_once 'vendor/autoload.php';
if (!$_GET['tag']) {
include 'start.php';
exit;
}
$RFTeesHashtag = new \RFTeesHashtag\RFTeesHashtag(file_get_contents(__DIR__ . '/config/settings.json'));
$RFTeesHashtag->setTags($_GET['tag']);
if ($_GET['block']) {
$RFTeesHashtag->setBlockedUsers($_GET['block']);
}
$RFTeesHashtag->setBlockedUsers(array('jamesmills', 'refreshteesside', 'benjam_es', 'xocs'));
$RFTeesHashtag->doSearch();
$RFTeesHashtag->pickWinner();
$RFTeesHashtag->sendTweet();
$RFTeesHashtag->tweetWinner();
function formatDate($date)
{
return date('l jS M Y g:ia', strtotime($date));
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Refresh Teesside</title>
<link href="assets/css/bootstrap.css" rel="stylesheet" media="screen">
<link href="assets/css/custom.css" rel="stylesheet" media="screen">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript" src="assets/js/bootstrap.min.js"></script>
<script type="text/javascript" src="assets/js/custom.js"></script>
</head>
<body>
<div class="container">
<div class="loading"></div>
<div id="winnerModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<h3 id="myModalLabel"><?php echo $RFTeesHashtag->winner['user']['name']; ?></h3>
</div>
<div class="modal-body">
<div class="media entry">
<a class="pull-left" href="#">
<img class="media-object" src="<?php echo $RFTeesHashtag->winner['user']['profile_image_url']; ?>">
</a>
<div class="media-body">
<h4 class="media-heading"><?php echo $RFTeesHashtag->winner['user']['name']; ?> (@<?php echo $RFTeesHashtag->winner['user']['screen_name']; ?>)</h4>
<p class="tweet"><?php echo $RFTeesHashtag->winner['text']; ?></p>
<p>
<span class="badge"><?php echo formatDate($RFTeesHashtag->winner['created_at']); ?></span>
<?php echo ($RFTeesHashtag->winner['favorited'] > 0) ? '<span class="badge">Favorited:' . $RFTeesHashtag->winner['favorited'] . '</span>' : '' ; ?>
<?php echo ($RFTeesHashtag->winner['retweeted'] > 0) ? '<span class="badge">Retweeted:' . $RFTeesHashtag->winner['retweeted'] . '</span>' : '' ; ?>
<?php
foreach ($RFTeesHashtag->winner['entities']['hashtags'] as $hashtag) {
echo '<span class="badge badge-info">#' . $hashtag['text'] . '</span> ';
}
?>
</p>
</div><!-- /.media-body -->
</div><!-- /.media entry -->
</div>
</div>
<div class="page-header">
<h1>
<?php echo $RFTeesHashtag->getAllEntriesCount();?> entries in total
<span style="color: #468847"><?php echo $RFTeesHashtag->getValidEntriesCount();?> valid</span>
<span style="color: #b94a48"><?php echo $RFTeesHashtag->getNotValidEntriesCount();?> not valid</span>
</h1>
</div>
<?php
foreach ($RFTeesHashtag->tags as $tag) {
echo '<span class="btn btn-large btn-primary">#' . $tag . '</span> ';
}
echo '<hr />';
?>
<?php
foreach ($RFTeesHashtag->allEntries as $result) {
if ($result['valid'] === 'yes') {
$alert = 'success';
$badge = 'success';
} else {
$alert = 'error';
$badge = 'important';
}
echo '
<div class="screen-entry alert alert-' . $alert . '">
<img src="' . $result['user']['profile_image_url'] . '"><br>
<span class="badge badge-' . $badge . '">@' . $result['user']['screen_name'] . '</span>
</div>
';
}
?>
<div style="clear:both; height:20px;"></div>
<div class="page-header"><h1>All Tweets</h1></div>
<?php foreach ($RFTeesHashtag->allEntries as $result) { ?>
<div class="media entry">
<a class="pull-left" href="#">
<img class="media-object" src="<?php echo $result['user']['profile_image_url']; ?>">
</a>
<div class="media-body">
<h4 class="media-heading"><?php echo $result['user']['name']; ?> (@<?php echo $result['user']['screen_name']; ?>)</h4>
<p class="tweet"><?php echo $result['text']; ?></p>
<p>
<span class="badge"><?php echo formatDate($result['created_at']); ?></span>
<?php echo ($result['favorited'] > 0) ? '<span class="badge">Favorited:' . $result['favorited'] . '</span>' : '' ; ?>
<?php echo ($$result['retweeted'] > 0) ? '<span class="badge">Retweeted:' . $result['retweeted'] . '</span>' : '' ; ?>
<?php
foreach ($result['entities']['hashtags'] as $hashtag) {
echo '<span class="badge badge-info">#' . $hashtag['text'] . '</span> ';
}
?>
</p>
</div><!-- /.media-body -->
</div><!-- /.media entry -->
<?php } ?>
</div>
</body>
</html>