コード例 #1
0
ファイル: SF.class.php プロジェクト: Miljankg/simplef
 /**
  * Loads page.
  */
 private function loadPage()
 {
     $this->lang = new Language("SF Global");
     $this->langPages = new Language("Pages lang");
     $currLang = $this->url->getCurrentLanguage();
     $this->lang->loadLang($this->config->get('main_lang_dir') . $currLang . "/{$currLang}.php");
     $this->langPages->loadLang($this->config->get('main_lang_dir') . $currLang . "/{$currLang}_pages.php");
     $currPageName = $this->url->getCurrentPageName();
     $actualPageName = $this->langPages->getIndex($currPageName);
     if ($actualPageName === null) {
         $actualPageName = $currPageName;
     }
     $tplDir = $this->tplEngine->getTemplateDir(0);
     $this->loadClassCheckInterface('component_loader', 'Framework\\Core\\FrameworkClasses\\Components\\IComponentLoader');
     $this->loadClassCheckInterface('page_loader', 'Framework\\Core\\FrameworkClasses\\Routing\\IPageLoader');
     $componentLoader = new SFComponentLoader($this->config->get('app_dir') . 'components/output/', $tplDir . 'out_components/', $this->config->get('output_components'), $this->config->get('out_comp_ns'), $this->config->get('logic_components'), $this->config->get('logic_comp_ns'), $this->tplEngine, $this->config->get('config_type'), $this->url->getCurrentLanguage(), $this->config->get('wrap_components'), $this->config->get('logic_components_dir'), $this->config->get('output_components_options'), $this->dbFactory, $this->config->get('common_output_components'), $this->config->get('current_page'), $this->logger, $this);
     $ajaxLevel = $this->getAjaxLevel();
     $loadSpecificComponent = false;
     if (!is_numeric($ajaxLevel)) {
         $loadSpecificComponent = $ajaxLevel;
     }
     $pageLoader = new PageLoader($this->config->get('pages'), $this->config->get('pages_out_components'), $this->config->get('pages_templates'), $this->config->get('empty_page_index'), $this->config->get('maintenance_mode'), $this->tplEngine, $tplDir . 'pages/', $componentLoader, $this->logger, $this->url, $this->config->get('output_components_url'), $this->config->get('pages_url'), $loadSpecificComponent);
     $pageLoader->pageNotFoundPage = $this->config->get('page_not_found_page');
     $pageLoader->pageMaintenance = $this->config->get('page_maintenance');
     $header = "";
     $content = $pageLoader->getCurrentPageContent($actualPageName, $header);
     if ($loadSpecificComponent !== false || $ajaxLevel == 2) {
         $ajaxData = array('content' => $content, 'header' => $header);
         $this->outputJsonEncoded($ajaxData);
     }
     $header = $this->genHeaderIndex() . $header;
     $this->tplEngine->assign('header', $header);
     // assign to the main tpl
     $this->tplEngine->assign('mainContent', $content);
 }
コード例 #2
0
 /**
  * Load component language.
  *
  * @param string $langDir Language directory.
  * @param string $lang Current language.
  * @param string $compName Component name.
  * @return Language Language object.
  */
 private function loadComponentLang($langDir, $lang, $compName)
 {
     $langObj = new Language($compName);
     $langObj->loadLang($langDir . $lang . "/{$lang}.php");
     return $langObj;
 }