-
-
Save gharlan/a70704b1c309cb1281c1 to your computer and use it in GitHub Desktop.
rex_yrewrite_scheme_gh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class rex_yrewrite_scheme_gh extends rex_yrewrite_scheme | |
{ | |
protected $suffix = '/'; | |
public function appendArticle($path, OOArticle $art) | |
{ | |
if ( | |
$art->isStartArticle() && | |
!rex_yrewrite::isDomainMountpoint($art->getId()) && | |
count(OOArticle::getArticlesOfCategory($art->getId(), true, $art->getClang())) <= 1 | |
) { | |
return $path . '.html'; | |
} | |
return $path . '/' . $this->normalize($art->getName()) . '.html'; | |
} | |
public function getRedirection(OOArticle $art) | |
{ | |
if ( | |
$art->isStartArticle() && | |
$cats = OOCategory::getChildrenById($art->getId(), true, $art->getClang()) | |
) { | |
return $cats[0]; | |
} | |
return false; | |
} | |
protected function normalize($string, $clang = 0) | |
{ | |
return str_replace(' ', '-', mb_strtolower($string)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment