X-Git-Url: http://git.shiar.net/minimedit.git/blobdiff_plain/c187ac6e57f58c4b3fb5e400e9ca3a61b5ec37f9..ead24d57321f965db99178336e9a72c03c966bd1:/nieuws.inc.php diff --git a/nieuws.inc.php b/nieuws.inc.php index 79f718d..35ae092 100644 --- a/nieuws.inc.php +++ b/nieuws.inc.php @@ -19,7 +19,7 @@ class ArchiveArticle function __construct($path) { $this->page = $path; - $this->link = preg_replace('/\.html$/', '', $path); + $this->link = preg_replace('{(?:/index)?\.html$}', '', $path); } function __get($col) @@ -29,6 +29,7 @@ class ArchiveArticle function file() { + if (!file_exists($this->page)) return; return fopen($this->page, 'r'); } @@ -39,7 +40,12 @@ class ArchiveArticle function safetitle() { - return strip_tags($this->title); + return trim(strip_tags($this->title)); + } + + function name() + { + return $this->safetitle ?: $this->link; } function last() @@ -54,7 +60,7 @@ class ArchiveArticle function dateparts() { - preg_match('', $this->page, $ymd); + preg_match('', $this->page, $ymd); return $ymd; }