コード例 #1
0
 protected function parseConfiguration($configFile, $xslFile = null, $environment = null)
 {
     return AgaviXmlConfigParser::run($configFile, $environment ? $environment : AgaviConfig::get('core.environment'), '', array(AgaviXmlConfigParser::STAGE_SINGLE => $xslFile ? array($xslFile) : array(), AgaviXmlConfigParser::STAGE_COMPILATION => array()), array(AgaviXmlConfigParser::STAGE_SINGLE => array(AgaviXmlConfigParser::STEP_TRANSFORMATIONS_BEFORE => array(), AgaviXmlConfigParser::STEP_TRANSFORMATIONS_AFTER => array()), AgaviXmlConfigParser::STAGE_COMPILATION => array(AgaviXmlConfigParser::STEP_TRANSFORMATIONS_BEFORE => array(), AgaviXmlConfigParser::STEP_TRANSFORMATIONS_AFTER => array())));
 }
コード例 #2
0
 /**
  * Execute the config handler for the given file.
  * 
  * @param        string The path to the config file (full path).
  * @param        string The context which we're currently running.
  * @param        array  The config handler info.
  * 
  * @return       string The compiled data.
  * 
  * @author       Felix Gilcher <*****@*****.**>
  * @since        1.0.0
  */
 protected static function executeHandler($config, $context, array $handlerInfo)
 {
     // call the handler and retrieve the cache data
     $handler = new $handlerInfo['class']();
     if ($handler instanceof AgaviIXmlConfigHandler) {
         // a new-style config handler
         // it does not parse the config itself; instead, it is given a complete and merged DOM document
         $doc = AgaviXmlConfigParser::run($config, AgaviConfig::get('core.environment'), $context, $handlerInfo['transformations'], $handlerInfo['validations']);
         if ($context !== null) {
             $context = AgaviContext::getInstance($context);
         }
         $handler->initialize($context, $handlerInfo['parameters']);
         try {
             $data = $handler->execute($doc);
         } catch (AgaviException $e) {
             throw new $e(sprintf("Compilation of configuration file '%s' failed for the following reason(s):\n\n%s", $config, $e->getMessage()));
         }
     } else {
         $validationFile = null;
         if (isset($handlerInfo['validations'][AgaviXmlConfigParser::STAGE_SINGLE][AgaviXmlConfigParser::STEP_TRANSFORMATIONS_AFTER][AgaviXmlConfigParser::VALIDATION_TYPE_XMLSCHEMA][0])) {
             $validationFile = $handlerInfo['validations'][AgaviXmlConfigParser::STAGE_SINGLE][AgaviXmlConfigParser::STEP_TRANSFORMATIONS_AFTER][AgaviXmlConfigParser::VALIDATION_TYPE_XMLSCHEMA][0];
         }
         $handler->initialize($validationFile, null, $handlerInfo['parameters']);
         $data = $handler->execute($config, $context);
     }
     return $data;
 }