Exemplo n.º 1
0
 /**
  * @param $info
  * @return array|null
  * @throws \Ip\Exception
  */
 public static function ipRouteAction_80($info)
 {
     if ($info['routeLanguage'] == null) {
         return null;
     }
     if ($info['relativeUri'] == '') {
         $pageId = ipContent()->getDefaultPageId();
         $page = \Ip\Internal\Pages\Service::getPage($pageId);
     } else {
         $languageCode = ipContent()->getCurrentLanguage()->getCode();
         $page = \Ip\Internal\Pages\Service::getPageByUrl($languageCode, $info['relativeUri']);
     }
     if (!$page || $page['isSecured'] && !ipAdminId()) {
         return null;
     }
     $result['page'] = new \Ip\Page($page);
     $result['plugin'] = 'Content';
     $result['controller'] = 'PublicController';
     $result['action'] = 'index';
     $result['urlParts'] = isset($urlParts[1]) ? explode('/', $urlParts[1]) : array();
     return $result;
 }
Exemplo n.º 2
0
 /**
  * @param $info
  * @return array|null
  * @throws \Ip\Exception
  */
 public static function ipRouteAction_70($info)
 {
     $result = \Ip\ServiceLocator::router()->match(rtrim($info['relativeUri'], '/'), ipRequest());
     if (!$result) {
         return null;
     }
     if (is_callable($result['action'])) {
         unset($result['plugin'], $result['controller']);
     }
     if (empty($result['page'])) {
         if ($info['relativeUri'] == '') {
             $pageId = ipContent()->getDefaultPageId();
             $page = \Ip\Internal\Pages\Service::getPage($pageId);
         } else {
             $languageCode = ipContent()->getCurrentLanguage()->getCode();
             $page = \Ip\Internal\Pages\Service::getPageByUrl($languageCode, $info['relativeUri']);
         }
         if ($page && (!$page['isSecured'] || !ipAdminId())) {
             $result['page'] = new \Ip\Page($page);
         }
     }
     return $result;
 }