/** * inicia a controller conforme configurado em navigation e retorna o resultado do metodo chamado * @return HttpResultVO */ private function getControllerResult() { $ignore_name = Config::getAliasFolder(); if (Config::getLocale()) { $ignore_name .= "/" . Config::getLocale(); } //url com trata com regras de rota $url = explode("/", Config::rewriteUrl(Navigation::getURI($ignore_name, Navigation::URI_RETURN_TYPE_STRING))); //inicia a controller $retornoDaController = self::searchController($url, Config::FOLDER_REQUEST_CONTROLER); //afiliados ( afiliate) reconhecer aqui a poss�vel origem do internauta atrav�s do restFolder afiliate.N $arrayVariable = Navigation::getVariableArraySlug($retornoDaController->arrayRestFolder); if (!$retornoDaController->success) { //pega o nome da classe para instanciar e executa o init $tempExplode = explode("/", Config::URL_DEFAULT_CONTROLLER); $className = $tempExplode[count($tempExplode) - 1]; $className = str_replace(array(".class.php", ".php"), "", $className); $retornoDaController->className = $className; $retornoDaController->methodName = "init"; $retornoDaController->urlToInclude = Config::URL_DEFAULT_CONTROLLER; } $className = $retornoDaController->className; $methodName = $retornoDaController->methodName; //inclui a controller include_once $retornoDaController->urlToInclude; //instancia $instancia = new $className($retornoDaController->arrayRestFolder); //executa o metodo e este deve retornar sempre uma HttpResultVO if (!ClassHandler::isMethodPublic($instancia, $methodName)) { $methodName = "init"; } $HttpResultVO = $instancia->{$methodName}(); return $HttpResultVO; }
public function gerate() { foreach ($this->arrayContentVO as $ContentVO) { $idValues[] = $ContentVO->getId(); $activeValues[] = $ContentVO->getActive(); $nameValues[] = $ContentVO->getName(Config::getLocale()); $titleValues[] = $ContentVO->getTitle(Config::getLocale()); $descriptionValues[] = $ContentVO->getDescription(Config::getLocale()); $hatValues[] = $ContentVO->getHat(Config::getLocale()); $contentValues[] = $ContentVO->getContent(Config::getLocale()); $authorValues[] = $ContentVO->getAuthor(Config::getLocale()); $templateUrlValues[] = $ContentVO->getTemplateUrl(Config::getLocale()); $slugValues[] = $ContentVO->getSlug(Config::getLocale()); $keyWordsValues[] = $ContentVO->getKeyWords(Config::getLocale()); $dateValues[] = $ContentVO->getDate(); $dateInValues[] = $ContentVO->getDateIn(); $dateOutValues[] = $ContentVO->getDateOut(); $orderValues[] = $ContentVO->getOrder(); $this->count_total = $this->count_total + 1; $this->setId(array("value" => $idValues)); $this->setActive(array("value" => $activeValues)); $this->setName(array("value" => $nameValues)); $this->setTitle(array("value" => $titleValues)); $this->setHat(array("value" => $hatValues)); $this->setDescription(array("value" => $descriptionValues)); $this->setContent(array("value" => $contentValues)); $this->setAuthor(array("value" => $authorValues)); $this->setSlug(array("value" => $slugValues)); $this->setTemplateUrl(array("value" => $templateUrlValues)); $this->setDate(array("value" => $dateValues)); $this->setDateIn(array("value" => $dateInValues)); $this->setDateOut(array("value" => $dateOutValues)); $this->setOrder(array("value" => $orderValues)); } }
/** * Detects the most suitable output format to use. * * @param string $domain * @throws \RuntimeException * @return string the output format */ private function detectOutputFormat($currentDomain) { if (null !== $this->config->getOutputFormat()) { return $this->config->getOutputFormat(); } // check if which translation files in which format exist $otherDomainFormat = $localeFormat = $otherLocaleFormat = null; foreach (FileUtils::findTranslationFiles($this->config->getTranslationsDir()) as $domain => $locales) { foreach ($locales as $locale => $fileData) { list($format, ) = $fileData; if ($currentDomain !== $domain) { $otherDomainFormat = $format; continue 2; } if ($this->config->getLocale() === $locale) { $localeFormat = $format; continue; } $otherLocaleFormat = $format; } } if (null !== $localeFormat) { return $localeFormat; } if (null !== $otherLocaleFormat) { return $otherLocaleFormat; } if (null !== $otherDomainFormat) { return $otherDomainFormat; } return $this->config->getDefaultOutputFormat(); }
public function getFooter() { //iniciando o retorno padrao $ReturnResultVO $ReturnResultVO = new ReturnResultVO(); //inicia a DAO $DAO = CategoryDAO::getInstance(); $selectCategory = "footer"; //pesquisa pela categoria pai $ReturnDataVO = $DAO->select(CategoryDAO::RETURN_VO, NULL, NULL, NULL, NULL, $selectCategory); if ($ReturnDataVO->success && count($ReturnDataVO->result) > 0) { //pega a CategoriaVO pai da resposta $DadCategoryVO = $ReturnDataVO->result[0]; //traduz os compos da categoria pai conforme o locale $StdClassDadCategory = $DadCategoryVO->toStdClass(Config::getLocale()); //inicia um array para armazenar os contents da categoria pai $arrayStdClassHighlights = array(); //adiciona os conents encontrados no campo $array_highlights da categoria pai $StdClassDadCategory $StdClassDadCategory->array_highlights = $arrayStdClassHighlights; $arrayChildsCategoryVO = array(); //busca as categorias Filhas da pai $ReturnDataVO = $DAO->select(CategoryDAO::RETURN_VO, NULL, NULL, $StdClassDadCategory->id, NULL, NULL, "<"); if ($ReturnDataVO->success) { $arrayChildsCategoryVO = $ReturnDataVO->result; $StdClassArrayChildsCategoryVO = array(); foreach ($arrayChildsCategoryVO as $ChildsCategoryVO) { //traduz os compos da categoria filha conforme o locale $StdClassChildCategory = $ChildsCategoryVO->toStdClass(Config::getLocale()); //inicia a GenericHighLghtDAO para fazer a consulta $DAO = GenericHighLightsDAO::getInstance(); //busca highlightss vinculados a tabela e tabela id passados $ReturnDataVO = $DAO->selectByTableId("category", $StdClassChildCategory->id, GenericHighLightsDAO::RETURN_VO, "highlights"); //Debug::print_r($ReturnDataVO);exit(); //Debug::print_r($ReturnResultVO); //inicia um array para armazenar os contents da categoria filho $arrayStdClassHighlights = array(); //pega as imagens vinculadas ao content e tabem traduz os campos do mesmo content da categoria filho conforme o locale solicitado foreach ($ReturnDataVO->result as $HighLightsVO) { $arrayStdClassHighlights[] = $HighLightsVO->toStdClass(Config::getLocale()); } //adiciona os conents encontrados no campo $array_highlights da categoria pai $StdClassDadCategory $StdClassChildCategory->array_highlights = $arrayStdClassHighlights; //adiciona o a categoria filho no array de categorias filho $StdClassArrayChildsCategoryVO[] = $StdClassChildCategory; } //setando sucesso true caso tenha dado certo $ReturnResultVO->success = TRUE; $ReturnResultVO->result = $StdClassArrayChildsCategoryVO; } } //Debug::print_r($ReturnResultVO); return $ReturnResultVO; }
/** * BattleNetClient constructor. * * @param string $prefix */ public function __construct($prefix) { $this->prefix = $prefix; if (!Config::isValid()) { $this->throwException('Configuration not set via BattleNet\\Config.'); } $this->code = 200; $this->message = ''; $this->url = ''; $this->apiKey = Config::getApiKey(); $this->server = Config::getServer(); $this->locale = Config::getLocale(); }
/** * @static * @param Config $config * @return ConfigBuilder */ public static function fromConfig(Config $config) { $builder = new self(); $builder->setTranslationsDir($config->getTranslationsDir()); $builder->setLocale($config->getLocale()); $builder->setIgnoredDomains($config->getIgnoredDomains()); $builder->setDomains($config->getDomains()); $builder->setOutputFormat($config->getOutputFormat()); $builder->setDefaultOutputFormat($config->getDefaultOutputFormat()); $builder->setScanDirs($config->getScanDirs()); $builder->setExcludedDirs($config->getExcludedDirs()); $builder->setExcludedNames($config->getExcludedNames()); $builder->setEnabledExtractors($config->getEnabledExtractors()); $builder->setLoadResources($config->getLoadResources()); return $builder; }
public function show($_return = FALSE) { $url_config = Config::getRootPath("config"); $head = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' . "\n"; $head .= '<html xmlns="http://www.w3.org/1999/xhtml">' . "\n"; $head .= '<head>' . "\n"; $head .= '<meta http-equiv="X-UA-Compatible" content="IE=edge" >' . "\n"; $head .= '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />' . "\n"; $head .= '<meta name="description" content="' . $this->description . '" />' . "\n"; $head .= '<meta name="keywords" content="' . $this->keywords . '" />' . "\n"; $head .= '<title>' . $this->title . '</title>' . "\n"; $head .= '<link rel="shortcut icon" type="image/x-icon" href="' . Config::getImagePath("favicon.ico") . '" />'; $head .= "\n<script type=\"text/javascript\" >"; //pega as variaveis do config php e deixa visivel para js em contexto global $head .= "var ROOT_PATH = '" . Config::getRootPath() . "';"; $head .= "var NEXT_URL = '" . Config::getNextUrl() . "';"; $head .= "var LAST_URL = '" . Config::getLastUrl() . "';"; $head .= "var LOCALE = '" . Config::getLocale() . "';"; $head .= "</script>\n"; $head .= '<link rel="apple-touch-icon" href="' . Config::getImagePath("icon-ipad.jpg") . '" />'; foreach ($this->css as $slug => $data) { $file_path = $slug . '.css'; $uri_path = Config::getAsset('assets/css/' . $file_path); $sys_path = Config::getFolderView('assets/css/' . $file_path); if (!file_exists($sys_path)) { $file_path = strpos('.css', $data->path) === FALSE ? $data->path . '.css' : $data->path; $uri_path = Config::getAsset('assets/' . $file_path); $sys_path = Config::getFolderView('assets/' . $file_path); if (!file_exists($sys_path)) { var_dump($slug, '---', $data, $file_path); echo "<!-- arquivo CSS {$uri_path} não encontrado (tentando no file_system : {$sys_path} )-->\n"; exit; continue; } } if ($data->ieOnly) { $head .= "\n<!--[if IE]>"; } $head .= "\n<link type=\"text/css\" media=\"" . $data->media . "\" rel=\"stylesheet\" href=\"" . $uri_path . "\" />"; if ($data->ieOnly) { $head .= "\n<![endif]-->"; } } foreach ($this->js as $slug => $path) { $file_path = $slug . '.js'; $uri_path = Config::getAsset('assets/js/' . $file_path); $sys_path = Config::getFolderView('assets/js/' . $file_path); if (!file_exists($sys_path)) { $file_path = strpos('.js', $path) === FALSE ? $path . '.js' : $path; $uri_path = Config::getAsset('assets/' . $file_path); $sys_path = Config::getFolderView('assets/' . $file_path); if (!file_exists($sys_path)) { echo "<!-- arquivo JS {$uri_path} não encontrado (tentando no file_system : {$sys_path} )-->\n"; continue; } } $head .= "\n<script type=\"text/javascript\" src=\"" . $uri_path . "\"></script>"; } $head .= "\n</head>"; if ($_return) { return $head; } echo $head; }