summaryrefslogtreecommitdiff
path: root/extensions/tmwa/frontend/news.php
diff options
context:
space:
mode:
authorWushin <pasekei@gmail.com>2014-11-16 22:27:32 -0600
committerWushin <pasekei@gmail.com>2014-11-16 22:27:32 -0600
commit6f37a79665408c3531842851fc6c3efabfe50a07 (patch)
tree6e8dc2a26e61bfe6ba61af731208fc07a8b2536e /extensions/tmwa/frontend/news.php
parente41baa4c3aeb5f2b05fb928c1bf13e6a9bb130a7 (diff)
parent294e5d28e70d1709520c3fbb78464edb557f638b (diff)
downloadwebsite-6f37a79665408c3531842851fc6c3efabfe50a07.tar.gz
website-6f37a79665408c3531842851fc6c3efabfe50a07.tar.bz2
website-6f37a79665408c3531842851fc6c3efabfe50a07.tar.xz
website-6f37a79665408c3531842851fc6c3efabfe50a07.zip
Merge pull request #9 from wushin/www-to-wiki
Www to wiki
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);
+ }
+}
+?>