blob: a214ea2a7f25cc1efda4c6b4eef572b1e9529fc3 (
plain) (
blame)
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
|
<?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);
}
}
?>
|