예제 #1
0
 /**
  * vrati instanci configu stranky podle URL
  * @param string $url
  * @return LBoxConfigItemStructure
  */
 protected function getPageCFGByURL($url = "")
 {
     try {
         if (strlen($url) < 1) {
             $url = substr(LBOX_REQUEST_URL, -1) == "/" ? LBOX_REQUEST_URL : LBOX_REQUEST_URL . "/";
             $url = str_replace("?/", "/", $url);
             $url = str_replace("//", "/", $url);
         }
         // vycistime URL od parametru a hostu
         $url = preg_replace("/" . LBOX_REQUEST_URL_SCHEME . ":(\\/+)/", "", $url);
         $url = substr($url, strpos($url, "/"));
         $url = preg_replace("/(\\?|\\:)(.+)/", "", $url);
         $displayLanguage = LBoxFront::getDisplayLanguage();
         foreach (LBoxConfigManagerLangdomains::getInstance()->getLangsDomains() as $lang => $domain) {
             try {
                 LBoxFront::setDisplayLanguage($lang);
                 $configItemStructure = LBoxConfigManagerStructure::getInstance()->getPageByUrl($url);
                 if ($configItemStructure instanceof LBoxConfigItemStructure) {
                     break;
                 }
             } catch (Exception $e) {
                 $exception = $e;
             }
         }
         LBoxFront::setDisplayLanguage($displayLanguage);
         return $configItemStructure;
     } catch (Exception $e) {
         throw $e;
     }
 }