Example #1
0
 private function getAllPages()
 {
     $pages = buildAllPages();
     $tmp = array();
     foreach ($pages as $Page) {
         if ($Page->published()) {
             array_push($tmp, $Page->json($returnsArray = true));
         }
     }
     return json_encode($tmp);
 }
Example #2
0
}
// Build specific page.
if ($Url->whereAmI() === 'page' && $Url->notFound() === false) {
    $Page = buildPage($Url->slug());
    // The page doesn't exist.
    if ($Page === false) {
        $Url->setNotFound(true);
        unset($Page);
    } elseif (!$Page->published()) {
        $Url->setNotFound(true);
        unset($Page);
    }
}
// Homepage
if ($Url->whereAmI() === 'home' && $Url->notFound() === false) {
    // The user defined as homepage a particular page.
    if (Text::isNotEmpty($Site->homepage())) {
        $Url->setWhereAmI('page');
        $Page = buildPage($Site->homepage());
        if ($Page === false) {
            $Url->setWhereAmI('home');
        }
    }
}
if ($Url->notFound()) {
    $Url->setWhereAmI('page');
    $Page = new Page('error');
}
// Build all pages
$pages = buildAllPages();