Beispiel #1
0
 /**
  * Lists all pages
  */
 public function listPagesCommand()
 {
     $pageRepository = new PageRepository();
     $pages = $pageRepository->findAll();
     $tableData = array();
     /** @var Page $page */
     foreach ($pages as $page) {
         $tableData[] = array('identifier' => $page->getIdentifier(), 'title' => $page->getTitle(), 'is directory' => $page->getIsDirectory(), 'is virtual' => $page->getIsVirtual(), 'sorting' => $page->getSorting());
     }
     $this->outputTable($tableData);
 }
Beispiel #2
0
 /**
  * Returns the Page for the page URI or NULL if no data was found
  *
  * @param string $uri
  * @return Page
  */
 public function getPageForUri($uri)
 {
     $pageIdentifier = urldecode($uri);
     if ($pageIdentifier[0] === '/') {
         $pageIdentifier = substr($pageIdentifier, 1);
     }
     if (substr($pageIdentifier, -1) === '/') {
         $pageIdentifier = substr($pageIdentifier, 0, -1);
     }
     $pageRepository = new PageRepository();
     return $pageRepository->findByIdentifier($pageIdentifier);
 }