public function getSearchDirs() { $return_value = array(); $template_dir_property = __CurrentContext::getInstance()->getPropertyContent('TEMPLATES_DIR'); $template_dirs_array = explode(',', $template_dir_property); foreach ($template_dirs_array as $template_dir) { $template_dir = __PathResolver::resolvePath($template_dir); if ($template_dir != null) { $return_value[] = $template_dir; } } return $return_value; }
public final function execute() { if ($this->_template_file == null) { throw __ExceptionFactory::getInstance()->createException('ERR_TEMPLATE_NOT_DEFINED'); } //Locate the template File $template_file = $this->locateTemplateFile($this->_template_file); $this->setCompileDir(__PathResolver::resolvePath(__ApplicationContext::getInstance()->getPropertyContent('TEMPLATES_COMPILE_DIR'), __ApplicationContext::getInstance()->getBaseDir())); //setup filters: //- The component filter is the filter in charge of parse the template for components. // Is just available on __TemplateEngineView classes: $component_filter = new __ComponentFilter(); $this->addFilter($component_filter); //render the ui: return $this->templatize($template_file); }
public function parse($content, __Configuration &$configuration) { $temp_dir = __PathResolver::resolvePath(__Lion::getInstance()->getRuntimeDirectives()->getDirective('TEMP_DIR')); $prefix = uniqid(); $filename = tempnam($temp_dir, $prefix); $fp = fopen($filename, 'w'); fwrite($fp, $content); fclose($fp); try { $this->load($filename, $configuration); } catch (Exception $e) { unlink($file); throw $e; } unlink($filename); }
private function _loadLog4PhpConf($log_id) { $lion_runtime_directives = __Lion::getInstance()->getRuntimeDirectives(); if (!defined('LOG4PHP_CONFIGURATION') && $lion_runtime_directives->hasDirective('LOG4PHP_CONFIG_FILE')) { $log4php_config_file = __PathResolver::resolvePath($lion_runtime_directives->getDirective('LOG4PHP_CONFIG_FILE')); define('LOG4PHP_CONFIGURATION', $log4php_config_file); } if (!defined('LOG4PHP_CONFIGURATOR_CLASS')) { if ($lion_runtime_directives->hasDirective('LOG4PHP_CONFIGURATION_TYPE')) { $configuration_type = $lion_runtime_directives->getDirective('LOG4PHP_CONFIGURATION_TYPE'); } else { $configuration_type = __Log4PhpLogger::DEFAULT_CONFIGURATION_TYPE; } switch (strtoupper($configuration_type)) { case 'XML': define('LOG4PHP_CONFIGURATOR_CLASS', LOG4PHP_DIR . '/xml/LoggerDOMConfigurator'); break; } } $this->_log4php_instance = LoggerManager::getLogger($log_id); }
private function &_parseIncludes(__Configuration &$configuration, $basedir) { $configuration_section = $configuration->getSection('configuration'); if ($configuration_section != null) { //read configuration directives before read other sections: $configuration_directives = $configuration_section->getSection('configuration-directives'); if ($configuration_directives != null) { $this->_readConfigurationDirectives($configuration_directives); } //read the other sections: $sections = $configuration_section->getSections(); foreach ($sections as $section) { switch (strtoupper($section->getName())) { case 'INCLUDE': $expression = $section->getProperty('#text')->getContent(); //finally, resolve the path: $expression = __PathResolver::resolvePath($expression, $basedir); if (__Lion::getInstance()->getRuntimeDirectives()->getDirective('DEBUG_MODE') && (strpos($expression, '...') !== false || strpos($expression, '*') !== false)) { $this->_configuration_locators[$expression] = $expression; } $files_to_include = __FileResolver::resolveFiles($expression); foreach ($files_to_include as $file_to_include) { $included_configuration = $this->loadConfigurationFile($file_to_include); $configuration->merge($included_configuration); unset($included_configuration); } break; } } } return $configuration; }
public function setLanguageDir($language_dir) { $this->_language_dir = __PathResolver::resolvePath($language_dir); }