git.shiar.nl
/
minimedit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
search: dedicated page with query form
[minimedit.git]
/
nieuws.inc.php
diff --git
a/nieuws.inc.php
b/nieuws.inc.php
index 438c282ec46ef311346592e5ab0a01af4fdc23da..35ae0925b87d443ccf1d6e722330599a692abe39 100644
(file)
--- a/
nieuws.inc.php
+++ b/
nieuws.inc.php
@@
-19,7
+19,7
@@
class ArchiveArticle
function __construct($path)
{
$this->page = $path;
function __construct($path)
{
$this->page = $path;
- $this->link = preg_replace('
/\.html$/
', '', $path);
+ $this->link = preg_replace('
{(?:/index)?\.html$}
', '', $path);
}
function __get($col)
}
function __get($col)
@@
-29,6
+29,7
@@
class ArchiveArticle
function file()
{
function file()
{
+ if (!file_exists($this->page)) return;
return fopen($this->page, 'r');
}
return fopen($this->page, 'r');
}
@@
-39,7
+40,12
@@
class ArchiveArticle
function safetitle()
{
function safetitle()
{
- return strip_tags($this->title);
+ return trim(strip_tags($this->title));
+ }
+
+ function name()
+ {
+ return $this->safetitle ?: $this->link;
}
function last()
}
function last()
@@
-54,7
+60,7
@@
class ArchiveArticle
function dateparts()
{
function dateparts()
{
- preg_match('</(\d{4})
/
(\d{2})-(\d{2})->', $this->page, $ymd);
+ preg_match('</(\d{4})
[/-]
(\d{2})-(\d{2})->', $this->page, $ymd);
return $ymd;
}
return $ymd;
}
@@
-96,7
+102,7
@@
class ArchiveArticle
function thumb($size = '300x')
{
if (!$this->image or $this->image[0] !== '/') return;
function thumb($size = '300x')
{
if (!$this->image or $this->image[0] !== '/') return;
- return
"thumb/$size{$this->image}"
;
+ return
preg_replace('{^(?:/thumb/[^/]*)?}', "thumb/$size", $this->image)
;
}
}
}
}