-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathget_feed.php
58 lines (47 loc) · 2.24 KB
/
get_feed.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
<?php
require "get_favicon.php";
require "get_image.php";
if(isset($_POST["rss"])) {
$rss = simplexml_load_file($_POST["rss"] . ".xml");
$title = $rss->channel->title;
$link = $rss->channel->link;
$icon = get_favicon((string) $link);
foreach ($rss->channel->item as $item) {
$encoded_content = (string) $item->children('http://purl.org/rss/1.0/modules/content/')->encoded;
$thumbnail = isset($item->children()->thumbnail->attributes()->url) ? $item->children()->thumbnail->attributes()->url : "";
$image = get_image($encoded_content);
$src_img = "";
if(isset($image[0])) {
preg_match('/<img.*?src="(.*?)"/i', $image[0], $matches);
$src = $matches[1];
$src_img = "a><img src=$src width='50'></a>";
}
echo <<<HERE
<div class="event">
<div class="label">
<img src="$icon">
</div>
<div class="content">
<div class="summary">
<a href=$link>$title </a> <a href=$item->link >$item->title </a>
<div class="date">
3 days ago
</div>
</div>
<div class="extra text">
$item->description
</div>
<div class="extra images">
$src_img
</div>
<div class="meta">
<a class="like">
<i class="like icon"></i> 5 Likes
</a>
</div>
</div>
</div>
HERE;
}
}
?>