Exemplo n.º 1
0
 private static function getMenuAliases()
 {
     $cfgMenuString = ipGetOption('Sitemap.menuList');
     if ($cfgMenuString) {
         $menus = preg_split("/[\\s,]+/", $cfgMenuString);
     } else {
         $currLanguage = ipContent()->getCurrentLanguage()->getCode();
         $menusObj = \Ip\Internal\Pages\Service::getMenus($currLanguage);
         $menus = array();
         foreach ($menusObj as $menuObj) {
             $menus[] = $menuObj['alias'];
         }
     }
     return $menus;
 }
Exemplo n.º 2
0
 /**
  * @return mixed
  */
 public static function ipDefaultPageId_70($info)
 {
     $languageCode = $info['languageCode'];
     $defaultPageId = ipGetOption('Config.defaultPageId_' . $languageCode, null);
     if ($defaultPageId) {
         return $defaultPageId;
     }
     $menus = \Ip\Internal\Pages\Service::getMenus($languageCode);
     foreach ($menus as $menu) {
         $pages = \Ip\Internal\Pages\Service::getChildren($menu['id'], 0, 1);
         if (!empty($pages[0]['id'])) {
             return $pages[0]['id'];
         }
     }
     return null;
 }
Exemplo n.º 3
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;
 }
Exemplo n.º 4
0
 /**
  * @param $languageCode
  * @param $alias
  * @param $title
  * @param string $type 'tree' or 'list'
  * @return int
  */
 public function addMenu($languageCode, $alias, $title, $type = 'tree')
 {
     return \Ip\Internal\Pages\Service::createMenu($languageCode, $alias, $title, $type);
 }
Exemplo n.º 5
0
 public function emptyTrash()
 {
     ipRequest()->mustBePost();
     $data = ipRequest()->getPost();
     if (!isset($data['pages'])) {
         throw new \Ip\Exception('Missing required parameters');
     }
     $data['pages'] = explode('|', $data['pages']);
     unset($data['pages'][0]);
     \Ip\Internal\Pages\Service::emptyTrash($data['pages']);
     $answer = array('status' => 'success');
     return new \Ip\Response\Json($answer);
 }