forked from SteamLUG/steamlug.org
-
Notifications
You must be signed in to change notification settings - Fork 0
/
news.php
93 lines (91 loc) · 4.27 KB
/
news.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
<?php
$pageTitle = "News";
include_once('includes/header.php');
include_once('includes/lastRSS.php');
?>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
<h1 class="text-center">News</h1>
<article class="panel panel-default tweets col-sm-4 col-sm-push-8">
<header class="panel-heading">
<h3 class="panel-title">Tweets</h3>
</header>
<div class="panel-body" id="twitter-here">
<span class="follow"><a href="https://twitter.com/SteamLUG" class="twitter-follow-button" data-show-count="false" data-lang="en">Follow @SteamLUG</a></span>
<a class="twitter-timeline" href="https://twitter.com/SteamLUG" data-widget-id="558698447109636097" data-link-color="#ebebeb" data-chrome="nofooter noheader transparent noborders" data-tweet-limit="3" lang="EN">Tweets by @SteamLUG</a>
</div>
</article>
<?php
$rss = new lastRSS;
$rss->cache_dir = './temp';
$rss->cache_time = 1200;
$rss->CDATA = 'content';
$rss->items_limit = 6;
$rssString = "";
$firstItem = true;
if ($rs = $rss->get($eventXMLPath . 'steamlug/rss.xml'))
{
foreach($rs['items'] as $item)
{
if (!preg_match("/steamlug\/events\//", $item['link']))
{
$item['description'] = str_replace(array("\r", "\r\n"), "\n", $item['description']);
$item['description'] = str_replace(" onclick=\"return AlertNonSteamSite( this );\"", "", $item['description']);
$item['description'] = str_replace(" class=\"bb_link\"", "", $item['description']);
$item['description'] = str_replace(" class=\"bb_ul\"", "", $item['description']);
$item['description'] = str_replace("<br><", "<", $item['description']);
$item['description'] = str_replace("<i>", "<em>", $item['description']);
$item['description'] = str_replace("</i>", "</em>", $item['description']);
$item['description'] = str_replace("<b>", "<strong>", $item['description']);
$item['description'] = str_replace("</b>", "</strong>", $item['description']);
$item['description'] = str_replace("<br>-----", "-----", $item['description']);
$item['description'] = str_replace("<br>\n<br>", "</p><p>", $item['description']);
$item['description'] = str_replace("</ul>\n\n<br>", "</ul>\n<p>", $item['description']);
$item['description'] = str_replace("<ul>", "</p>\n<ul>", $item['description']);
$item['description'] = str_replace("<blockquote>", "</p>\n<blockquote>", $item['description']);
$item['description'] = str_replace("</blockquote>", "</blockquote>\n<p>", $item['description']);
$item['description'] = str_replace("<br>", "<br />", $item['description']);
$item['description'] = str_replace("https://steamcommunity.com/linkfilter/?url=", "", $item['description']);
if (!isset($item['author']))
{
$item['author'] = "Author";
}
$addclass = "ourclearfix";
if ($firstItem == true) {
$addclass="col-sm-8 col-sm-pull-4 fixupbootstrap";
$firstItem = false;
}
?>
<article class="panel panel-default steam-parsed <?=$addclass?>">
<header class="panel-heading">
<h3 class="panel-title"><a href="<?=$item['link'];?>"><?=htmlspecialchars_decode($item['title'])?></a></h3>
</header>
<div class="panel-body">
<p><?=htmlspecialchars_decode($item['description']);?></p>
</div>
<footer class="panel-footer">
<p class="pull-left">By <?=$item['author'];?> on <?=str_replace("+0000", "UTC", $item['pubDate']);?></p>
<p class="pull-right"><a href ="<?=$item['link'];?>"><span class="hidden-xs">View and </span>comment<span class="hidden-sm hidden-xs"> on our Steam group</span></a></p>
<div class="clearfix"></div>
</footer>
</article>
<?php
}
}
}
else
{
?>
<article class="panel panel-default">
<header class="panel-heading">
<h3 class="panel-title"><a href = 'http://steamcommunity.com/groups/steamlug/announcements/'>Error</a></h3>
</header>
<div class="panel-body">
<p>RSS news source not found…</p>
<p>You can try viewing news on the Steam Group <a href = 'http://steamcommunity.com/groups/steamlug/announcements/'>Announcements page</a>.</p>
</div>
</article>
<?php
}
echo $rssString;
?>
<?php include_once('includes/footer.php'); ?>