summaryrefslogtreecommitdiff
path: root/extensions/tmwa/frontend/news.php
diff options
context:
space:
mode:
Diffstat (limited to 'extensions/tmwa/frontend/news.php')
-rw-r--r--extensions/tmwa/frontend/news.php41
1 files changed, 41 insertions, 0 deletions
diff --git a/extensions/tmwa/frontend/news.php b/extensions/tmwa/frontend/news.php
new file mode 100644
index 0000000..a214ea2
--- /dev/null
+++ b/extensions/tmwa/frontend/news.php
@@ -0,0 +1,41 @@
+<?php
+class GameNewsPage extends SpecialPage {
+
+ public function __construct() {
+ parent::__construct('GameNews');
+ }
+
+ public function execute( $par ) {
+ $request = $this->getRequest();
+ $output = $this->getOutput();
+ $this->setHeaders();
+
+ $wikitext = self::printNews();
+
+ $output->addWikiText( $wikitext );
+ }
+ // Parses news.html
+ // displays feed
+ public function printNews($num='all') {
+ global $wgTMWNews;
+ $count = 0;
+ $content = "";
+ $handle = @fopen($wgTMWNews, "r");
+ if ($handle) {
+ while (($buffer = fgets($handle, 4096)) !== false) {
+ $content .= $buffer;
+ if (preg_match('/<\/div>/',$buffer)) {
+ $count++;
+ }
+ if ($count == $num && $num != 'all') {
+ $content .= '<div class="read-more"><a class="more" href="/news-feed.php">More News >></a></div>';
+ break 1;
+ }
+ }
+ }
+ $output = $this->getOutput();
+ $output->addHTML($content);
+ fclose($handle);
+ }
+}
+?>