Example #1
0
 /**
  * Does the resolving
  *
  * For modes other than 'frontend', no actual resolving is done,
  * resolver is just initialized in order to return the correct result
  * for $resolver->getUrl()
  * @todo Implement resolver for backend
  * @todo Is this useful in CLI mode?
  */
 protected function resolve()
 {
     $this->resolver = new \Cx\Core\Routing\Resolver($this->getRequest()->getUrl(), null, $this->getDb()->getEntityManager(), null, null);
     $this->request->getUrl()->setMode($this->mode);
     if ($this->mode == self::MODE_FRONTEND) {
         // TODO: Workaround for upload-component as it is loaded in preResolve-hook.
         // Remove this workaround once the Upload-component has been replaced
         // by the new Uploader-component which operates only through JsonData
         // and does therefore not depend on the resolved page any longer.
         if (isset($_GET['section']) && $_GET['section'] == 'Upload') {
             $this->resolvedPage = new \Cx\Core\ContentManager\Model\Entity\Page();
             $this->resolvedPage->setVirtual(true);
         } else {
             $this->resolvedPage = $this->resolver->resolve();
         }
     } else {
         global $cmd, $act, $isRegularPageRequest, $plainCmd;
         // resolve pretty url's
         $path = preg_replace('#^' . $this->getWebsiteOffsetPath() . '(' . $this->getBackendFolderName() . ')?/#', '', $_GET['__cap']);
         if ($path != 'index.php' && $path != '') {
             $path = explode('/', $path, 2);
             if (!isset($_GET['cmd'])) {
                 $_REQUEST['cmd'] = $path[0];
                 $_GET['cmd'] = $_REQUEST['cmd'];
             }
             if (isset($path[1])) {
                 if (substr($path[1], -1, 1) == '/') {
                     $path[1] = substr($path[1], 0, -1);
                 }
                 if (!isset($_GET['act'])) {
                     $_REQUEST['act'] = $path[1];
                     $_GET['act'] = $_REQUEST['act'];
                 }
             }
         }
         $this->resolvedPage = new \Cx\Core\ContentManager\Model\Entity\Page();
         $this->resolvedPage->setVirtual(true);
         if (!isset($plainCmd)) {
             $cmd = isset($_REQUEST['cmd']) ? $_REQUEST['cmd'] : 'Home';
             $act = isset($_REQUEST['act']) ? $_REQUEST['act'] : '';
             $plainCmd = $cmd;
         }
         // If standalone is set, then we will not have to initialize/load any content page related stuff
         $isRegularPageRequest = !isset($_REQUEST['standalone']) || $_REQUEST['standalone'] == 'false';
     }
 }
 /**
  * Adds a virtual page to the page repository.
  * @todo Remembering virtual pages is no longer necessary, rewrite method to create new virtual pages
  * @param  \Cx\Core\ContentManager\Model\Entity\Page  $virtualPage
  * @param  string                         $beforeSlug
  */
 public function addVirtualPage($virtualPage, $beforeSlug = '')
 {
     $virtualPage->setVirtual(true);
     if (!$virtualPage->getLang()) {
         $virtualPage->setLang(FRONTEND_LANG_ID);
     }
     $this->virtualPages[] = array('page' => $virtualPage, 'beforeSlug' => $beforeSlug);
 }
 public function setVirtual($virtual = true)
 {
     $this->_load();
     return parent::setVirtual($virtual);
 }