Changeset 2648
- Timestamp:
- 08/09/08 17:09:55 (5 months ago)
- Location:
- trunk
- Files:
-
- 23 modified
- 32 copied
-
COPYRIGHT (modified) (1 diff)
-
LICENSE (modified) (1 diff)
-
LICENSE-SCHEMATRON (copied) (copied from branches/david-xml_only_config_system/LICENSE-SCHEMATRON)
-
samples/app/config/config_handlers.xml (modified) (1 diff)
-
samples/app/config/factories.xml (modified) (4 diffs)
-
samples/app/config/routing.xml (modified) (1 diff)
-
src/config/AgaviBaseConfigHandler.class.php (modified) (2 diffs)
-
src/config/AgaviConfigCache.class.php (modified) (4 diffs)
-
src/config/AgaviConfigHandler.class.php (modified) (2 diffs)
-
src/config/AgaviConfigHandlersConfigHandler.class.php (modified) (4 diffs)
-
src/config/AgaviConfigParser.class.php (modified) (3 diffs)
-
src/config/AgaviConfigValueHolder.class.php (modified) (1 diff)
-
src/config/AgaviFactoryConfigHandler.class.php (modified) (4 diffs)
-
src/config/AgaviIXmlConfigHandler.interface.php (modified) (2 diffs)
-
src/config/AgaviWsdlConfigHandler.class.php (modified) (2 diffs)
-
src/config/AgaviXmlConfigParser.class.php (modified) (7 diffs)
-
src/config/defaults/autoload.xml (modified) (1 diff)
-
src/config/defaults/config_handlers.xml (modified) (3 diffs)
-
src/config/rng (copied) (copied from branches/david-xml_only_config_system/src/config/rng)
-
src/config/rng/_common.rng (copied) (copied from branches/david-xml_only_config_system/src/config/rng/_common.rng)
-
src/config/rng/config_handlers.rng (copied) (copied from branches/david-xml_only_config_system/src/config/rng/config_handlers.rng)
-
src/config/rng/factories.rng (copied) (copied from branches/david-xml_only_config_system/src/config/rng/factories.rng)
-
src/config/sch (copied) (copied from branches/david-xml_only_config_system/src/config/sch)
-
src/config/sch/config_handlers.sch (copied) (copied from branches/david-xml_only_config_system/src/config/sch/config_handlers.sch)
-
src/config/schematron (copied) (copied from branches/david-xml_only_config_system/src/config/schematron)
-
src/config/schematron/iso_schematron_skeleton.xsl (copied) (copied from branches/david-xml_only_config_system/src/config/schematron/iso_schematron_skeleton.xsl)
-
src/config/schematron/iso_svrl.xsl (copied) (copied from branches/david-xml_only_config_system/src/config/schematron/iso_svrl.xsl)
-
src/config/util (copied) (copied from branches/david-xml_only_config_system/src/config/util)
-
src/config/util/dom (copied) (copied from branches/david-xml_only_config_system/src/config/util/dom)
-
src/config/util/dom/AgaviXmlConfigDomAttr.class.php (copied) (copied from branches/david-xml_only_config_system/src/config/util/dom/AgaviXmlConfigDomAttr.class.php)
-
src/config/util/dom/AgaviXmlConfigDomCharacterData.class.php (copied) (copied from branches/david-xml_only_config_system/src/config/util/dom/AgaviXmlConfigDomCharacterData.class.php)
-
src/config/util/dom/AgaviXmlConfigDomComment.class.php (copied) (copied from branches/david-xml_only_config_system/src/config/util/dom/AgaviXmlConfigDomComment.class.php)
-
src/config/util/dom/AgaviXmlConfigDomDocument.class.php (copied) (copied from branches/david-xml_only_config_system/src/config/util/dom/AgaviXmlConfigDomDocument.class.php)
-
src/config/util/dom/AgaviXmlConfigDomDocumentFragment.class.php (copied) (copied from branches/david-xml_only_config_system/src/config/util/dom/AgaviXmlConfigDomDocumentFragment.class.php)
-
src/config/util/dom/AgaviXmlConfigDomDocumentType.class.php (copied) (copied from branches/david-xml_only_config_system/src/config/util/dom/AgaviXmlConfigDomDocumentType.class.php)
-
src/config/util/dom/AgaviXmlConfigDomElement.class.php (copied) (copied from branches/david-xml_only_config_system/src/config/util/dom/AgaviXmlConfigDomElement.class.php)
-
src/config/util/dom/AgaviXmlConfigDomEntity.class.php (copied) (copied from branches/david-xml_only_config_system/src/config/util/dom/AgaviXmlConfigDomEntity.class.php)
-
src/config/util/dom/AgaviXmlConfigDomEntityReference.class.php (copied) (copied from branches/david-xml_only_config_system/src/config/util/dom/AgaviXmlConfigDomEntityReference.class.php)
-
src/config/util/dom/AgaviXmlConfigDomNode.class.php (copied) (copied from branches/david-xml_only_config_system/src/config/util/dom/AgaviXmlConfigDomNode.class.php)
-
src/config/util/dom/AgaviXmlConfigDomNodeListIterator.class.php (copied) (copied from branches/david-xml_only_config_system/src/config/util/dom/AgaviXmlConfigDomNodeListIterator.class.php)
-
src/config/util/dom/AgaviXmlConfigDomNotation.class.php (copied) (copied from branches/david-xml_only_config_system/src/config/util/dom/AgaviXmlConfigDomNotation.class.php)
-
src/config/util/dom/AgaviXmlConfigDomProcessingInstruction.class.php (copied) (copied from branches/david-xml_only_config_system/src/config/util/dom/AgaviXmlConfigDomProcessingInstruction.class.php)
-
src/config/util/dom/AgaviXmlConfigDomText.class.php (copied) (copied from branches/david-xml_only_config_system/src/config/util/dom/AgaviXmlConfigDomText.class.php)
-
src/config/util/xsl (copied) (copied from branches/david-xml_only_config_system/src/config/util/xsl)
-
src/config/util/xsl/AgaviXmlConfigXsltProcessor.class.php (copied) (copied from branches/david-xml_only_config_system/src/config/util/xsl/AgaviXmlConfigXsltProcessor.class.php)
-
src/config/xsd/config_handlers.xsd (modified) (2 diffs)
-
src/config/xsd/default_tags.xsd (modified) (1 diff)
-
src/config/xsd/routing.xsd (modified) (1 diff)
-
src/config/xsl (copied) (copied from branches/david-xml_only_config_system/src/config/xsl)
-
src/config/xsl/_common.xsl (copied) (copied from branches/david-xml_only_config_system/src/config/xsl/_common.xsl)
-
src/config/xsl/config_handlers.xsl (copied) (copied from branches/david-xml_only_config_system/src/config/xsl/config_handlers.xsl)
-
src/config/xsl/factories.xsl (copied) (copied from branches/david-xml_only_config_system/src/config/xsl/factories.xsl)
-
src/routing/soap/wsdl.xsl (modified) (2 diffs)
-
tests2/config/ConfigHandlersConfigHandlerTest.php (modified) (2 diffs)
-
tests2/sandbox2/config/tests/config_handlers.xml (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/COPYRIGHT
r2228 r2648 61 61 62 62 63 ISO Schematron 64 -------------- 65 66 This software uses the ISO Schematron Skeleton, and the ISO Schematron ISO SVRL 67 implementation, by Rick Jelliffe. 68 69 For more information about ISO Schematron, visit the homepage: 70 http://www.schematron.com/ 71 72 Copyright (c) 2000-2007 Rick Jelliffe and Academia Sinica Computing Center, TW 73 74 -- 75 76 63 77 Zoneinfo Database 64 78 ----------------- -
trunk/LICENSE
r2619 r2648 74 74 75 75 76 ISO Schematron 77 -------------- 78 79 This software uses the ISO Schematron Skeleton, and the ISO Schematron ISO SVRL 80 implementation, by Rick Jelliffe. 81 82 For more information about ISO Schematron, visit the homepage: 83 http://www.schematron.com/ 84 85 The corresponding license can be found in LICENSE-SCHEMATRON. 86 87 -- 88 89 76 90 Zoneinfo Database 77 91 ----------------- -
trunk/samples/app/config/config_handlers.xml
r1964 r2648 1 1 <?xml version="1.0" encoding="UTF-8"?> 2 <configurations xmlns="http://agavi.org/agavi/1.0/config" parent="%core.system_config_dir%/config_handlers.xml" >2 <configurations xmlns="http://agavi.org/agavi/1.0/config" parent="%core.system_config_dir%/config_handlers.xml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instanceZOMGNO" xsi:schemaLocation="http://agavi.org/agavi/1.0/config http://localhost/~dzuelke/Code/oss/agavi/branches/david-xml_only_config_system/src/config/xsd/autoload.xsd"> 3 3 </configurations> -
trunk/samples/app/config/factories.xml
r2396 r2648 1 1 <?xml version="1.0" encoding="UTF-8"?> 2 < configurationsxmlns="http://agavi.org/agavi/1.0/config">2 <a:configurations xmlns:a="http://agavi.org/agavi/1.0/config" xmlns="http://agavi.org/agavi/1.0/config"> 3 3 4 <configuration> 4 <foo:bar xmlns:foo="urn:bar" /> 5 6 <a:configuration> 5 7 6 8 <controller class="AgaviController" /> … … 33 35 34 36 <validation_manager class="AgaviValidationManager"> 35 < parameter name="mode">strict</parameter>37 <a:parameter name="mode">strict</a:parameter> 36 38 </validation_manager> 37 39 38 </ configuration>40 </a:configuration> 39 41 40 < configuration environment="development.*">42 <a:configuration environment="development.*"> 41 43 42 44 <validation_manager class="AgaviValidationManager"> 43 < parameter name="mode">conditional</parameter>45 <a:parameter name="mode">conditional</a:parameter> 44 46 </validation_manager> 45 47 46 </ configuration>48 </a:configuration> 47 49 48 < configuration context="web" environment="development.*">50 <a:configuration context="web" environment="development.*"> 49 51 50 52 <response class="AgaviWebResponse"> 51 < parameter name="send_content_length">false</parameter>53 <a:parameter name="send_content_length">false</a:parameter> 52 54 </response> 53 55 54 </ configuration>56 </a:configuration> 55 57 56 < configuration context="soap">58 <a:configuration context="soap"> 57 59 58 60 <controller class="AgaviSoapController" /> … … 63 65 64 66 <routing class="AgaviSoapRouting"> 65 < parameter name="wsdl_generator">66 < parameter name="soap">67 < parameter name="address">68 < parameter name="location">http://localhost/~dzuelke/_projects/agavi/branches/0.11/samples/pub/soap.php</parameter>69 </ parameter>70 </ parameter>71 </ parameter>67 <a:parameter name="wsdl_generator"> 68 <a:parameter name="soap"> 69 <a:parameter name="address"> 70 <a:parameter name="location">http://localhost/~dzuelke/_projects/agavi/branches/0.11/samples/pub/soap.php</a:parameter> 71 </a:parameter> 72 </a:parameter> 73 </a:parameter> 72 74 </routing> 73 75 74 76 <user class="AgaviSecurityUser" /> 75 77 76 </ configuration>78 </a:configuration> 77 79 78 < configuration context="wsdl">80 <a:configuration context="wsdl"> 79 81 80 82 <storage class="AgaviSessionStorage"> 81 < parameter name="auto_start">false</parameter>83 <a:parameter name="auto_start">false</a:parameter> 82 84 </storage> 83 85 84 86 <user class="AgaviSecurityUser" /> 85 87 86 </ configuration>88 </a:configuration> 87 89 88 < configuration context="xmlrpc">90 <a:configuration context="xmlrpc"> 89 91 90 92 <request class="AgaviXmlrpcepiphpRequest" /> … … 96 98 <user class="AgaviSecurityUser" /> 97 99 98 </ configuration>100 </a:configuration> 99 101 100 </ configurations>102 </a:configurations> -
trunk/samples/app/config/routing.xml
r2646 r2648 53 53 </configuration> 54 54 55 <configuration context="soap2"> 56 <routes> 57 <!-- SOAP calls include the name of a remote method to call. The WebserviceRouting applies patterns to this method name, not to the URL of the request. We set the request method to "read" here so executeRead() is run in the Action. --> 58 <route pattern="^getItemPrice2$" module="Default" action="SearchEngineSpam" method="read"> 59 <wsdl:input> 60 <wsdl:part name="name" type="xsd:string" /> 61 </wsdl:input> 62 <wsdl:output> 63 <wsdl:part name="price" type="xsd:float" /> 64 </wsdl:output> 65 </route> 66 </routes> 67 </configuration> 68 55 69 <configuration context="wsdl"> 56 70 <routes> -
trunk/src/config/AgaviBaseConfigHandler.class.php
r2481 r2648 35 35 abstract class AgaviBaseConfigHandler extends AgaviParameterHolder 36 36 { 37 /**38 * @var string An absolute filesystem path to a validation filename.39 */40 protected $validationFile = null;41 42 /**43 * @var string A class name of the class which should be used to parse44 * Input files of this config handler.45 */46 protected $parser = null;47 48 /**49 * Retrieves the stored validation filename.50 *51 * @return string An absolute filesystem path to a validation filename.52 *53 * @author Dominik del Bondio <ddb@bitxtender.com>54 * @since 0.11.055 */56 public function getValidationFile()57 {58 return $this->validationFile;59 }60 61 /**62 * Retrieve the parameter node values of the given item's parameters element.63 *64 * @param ConfigValueHolder The node that contains a parameters chiild.65 * @param array As associative array of parameters that will66 * be overwritten if appropriate.67 * @param boolean Whether or not values should be literalized.68 *69 * @return array An associative array of parameters70 *71 * @author Dominik del Bondio <ddb@bitxtender.com>72 * @since 0.11.073 */74 protected function getItemParameters($itemNode, $oldValues = array(), $literalize = true)75 {76 $data = array();77 if($itemNode->hasChildren('parameters')) {78 foreach($itemNode->parameters as $node) {79 if(!$node->hasAttribute('name')) {80 // create a new entry in in the array and get they key of the new81 // created entry (the last in the array). The value doesn't matter82 // since it will be overwritten anyways83 $data[] = 0;84 end($data);85 $name = key($data);86 } else {87 $name = $node->getAttribute('name');88 }89 if($node->hasChildren('parameters')) {90 $data[$name] = (isset($oldValues[$name]) && is_array($oldValues[$name])) ? $oldValues[$name] : array();91 $data[$name] = $this->getItemParameters($node, $data[$name], $literalize);92 } else {93 $data[$name] = $literalize ? AgaviToolkit::literalize($node->getValue()) : $node->getValue();94 }95 }96 }97 // we can NOT use array_merge here, since it would break numeric keys98 foreach($data as $key => $value) {99 $oldValues[$key] = $value;100 }101 return $oldValues;102 }103 104 37 /** 105 38 * Generate the code for returning from execute(). … … 183 116 return $path; 184 117 } 185 186 /**187 * Builds a proper regular expression from the input pattern to test against188 * the given subject. This is for "environment" and "context" attributes of189 * configuration blocks in the files.190 *191 * @param string A regular expression chunk without delimiters/anchors.192 *193 * @return bool Whether or not the subject matched the pattern.194 *195 * @author David Zülke <dz@bitxtender.com>196 * @since 0.11.0197 */198 public static function testPattern($pattern, $subject)199 {200 return (preg_match('/^(' . implode('|', array_map('trim', explode(' ', $pattern))) . ')$/', $subject) > 0);201 }202 203 /**204 * Returns a properly ordered array of AgaviConfigValueHolder configuration205 * elements for given env and context.206 *207 * @param AgaviConfigValueHolder The root config element208 * @param string An environment name.209 * @param string A context name.210 * @param bool Whether the parser class should be211 * autoloaded or not.212 *213 * @return array An array of ConfigValueHolder configuration elements.214 *215 * @author David Zülke <dz@bitxtender.com>216 * @since 0.11.0217 */218 public function orderConfigurations(AgaviConfigValueHolder $configurations, $environment = null, $context = null, $autoloadParser = true)219 {220 $configs = array();221 222 if($configurations->hasAttribute('parent')) {223 $parent = AgaviToolkit::literalize($configurations->getAttribute('parent'));224 $parentConfigs = $this->orderConfigurations(AgaviConfigCache::parseConfig($parent, $autoloadParser, $this->getValidationFile(), $this->parser)->configurations, $environment, $context, $autoloadParser);225 $configs = array_merge($configs, $parentConfigs);226 }227 228 foreach($configurations as $cfg) {229 if(!$cfg->hasAttribute('environment') && !$cfg->hasAttribute('context')) {230 $configs[] = $cfg;231 }232 }233 foreach($configurations as $cfg) {234 if($environment !== null && $cfg->hasAttribute('environment') && self::testPattern($cfg->getAttribute('environment'), $environment) && !$cfg->hasAttribute('context')) {235 $configs[] = $cfg;236 }237 }238 foreach($configurations as $cfg) {239 if(!$cfg->hasAttribute('environment') && $context !== null && $cfg->hasAttribute('context') && self::testPattern($cfg->getAttribute('context'), $context)) {240 $configs[] = $cfg;241 }242 }243 foreach($configurations as $cfg) {244 if($environment !== null && $cfg->hasAttribute('environment') && self::testPattern($cfg->getAttribute('environment'), $environment) && $context !== null && $cfg->hasAttribute('context') && self::testPattern($cfg->getAttribute('context'), $context)) {245 $configs[] = $cfg;246 }247 }248 249 return $configs;250 }251 118 } 252 119 -
trunk/src/config/AgaviConfigCache.class.php
r2509 r2648 100 100 if($handler instanceof AgaviIXmlConfigHandler) { 101 101 // a new-style config handler 102 // it does not parse the config itself; instead, it is given an array of parsed DOM documents (with parents!) 103 $parser = new AgaviXmlConfigParser(); 104 $docs = $parser->parseAll($config, $handlerInfo['validation']); 102 // it does not parse the config itself; instead, it is given a complete and merged DOM document 103 $doc = AgaviXmlConfigParser::run($config, AgaviConfig::get('core.environment'), $context, $handlerInfo['transformations'], $handlerInfo['validations']); 105 104 106 105 if($context !== null) { … … 111 110 112 111 try { 113 $data = $handler->execute($doc s);112 $data = $handler->execute($doc); 114 113 } catch(AgaviException $e) { 115 throw new $e(sprintf("Comp liation of configuration file '%s' failed for the following reason(s):\n\n%s", $config, $e->getMessage()));114 throw new $e(sprintf("Compilation of configuration file '%s' failed for the following reason(s):\n\n%s", $config, $e->getMessage())); 116 115 } 117 116 } else { 118 117 $validationFile = null; 119 if(isset($handlerInfo['validation '][AgaviXmlConfigParser::VALIDATION_TYPE_XMLSCHEMA][0])) {120 $validationFile = $handlerInfo['validation '][AgaviXmlConfigParser::VALIDATION_TYPE_XMLSCHEMA][0];118 if(isset($handlerInfo['validations'][AgaviXmlConfigParser::VALIDATION_TYPE_XMLSCHEMA][0])) { 119 $validationFile = $handlerInfo['validations'][AgaviXmlConfigParser::VALIDATION_TYPE_XMLSCHEMA][0]; 121 120 } 122 121 $handler->initialize($validationFile, null, $handlerInfo['parameters']); … … 272 271 private static function loadConfigHandlers() 273 272 { 273 $agaviDir = AgaviConfig::get('core.agavi_dir'); 274 274 // since we only need the parser and handlers when the config is not cached 275 275 // it is sufficient to include them at this stage 276 require_once(AgaviConfig::get('core.agavi_dir') . '/config/AgaviILegacyConfigHandler.interface.php'); 277 require(AgaviConfig::get('core.agavi_dir') . '/config/AgaviIXmlConfigHandler.interface.php'); 278 require_once(AgaviConfig::get('core.agavi_dir') . '/config/AgaviBaseConfigHandler.class.php'); 279 require_once(AgaviConfig::get('core.agavi_dir') . '/config/AgaviConfigHandler.class.php'); 280 require(AgaviConfig::get('core.agavi_dir') . '/config/AgaviXmlConfigHandler.class.php'); 281 require(AgaviConfig::get('core.agavi_dir') . '/config/AgaviAutoloadConfigHandler.class.php'); 282 require(AgaviConfig::get('core.agavi_dir') . '/config/AgaviConfigHandlersConfigHandler.class.php'); 283 require(AgaviConfig::get('core.agavi_dir') . '/config/AgaviConfigValueHolder.class.php'); 284 require(AgaviConfig::get('core.agavi_dir') . '/config/AgaviConfigParser.class.php'); 285 require(AgaviConfig::get('core.agavi_dir') . '/config/AgaviXmlConfigParser.class.php'); 286 276 require_once($agaviDir . '/config/AgaviILegacyConfigHandler.interface.php'); 277 require($agaviDir . '/config/AgaviIXmlConfigHandler.interface.php'); 278 require_once($agaviDir . '/config/AgaviBaseConfigHandler.class.php'); 279 require_once($agaviDir . '/config/AgaviConfigHandler.class.php'); 280 require($agaviDir . '/config/AgaviXmlConfigHandler.class.php'); 281 require($agaviDir . '/config/AgaviAutoloadConfigHandler.class.php'); 282 require($agaviDir . '/config/AgaviConfigHandlersConfigHandler.class.php'); 283 require($agaviDir . '/config/AgaviConfigValueHolder.class.php'); 284 require($agaviDir . '/config/AgaviConfigParser.class.php'); 285 require($agaviDir . '/config/AgaviXmlConfigParser.class.php'); 286 // extended DOM* classes 287 require($agaviDir . '/config/util/dom/AgaviXmlConfigDomAttr.class.php'); 288 require($agaviDir . '/config/util/dom/AgaviXmlConfigDomCharacterData.class.php'); 289 require($agaviDir . '/config/util/dom/AgaviXmlConfigDomComment.class.php'); 290 require($agaviDir . '/config/util/dom/AgaviXmlConfigDomDocument.class.php'); 291 require($agaviDir . '/config/util/dom/AgaviXmlConfigDomDocumentFragment.class.php'); 292 require($agaviDir . '/config/util/dom/AgaviXmlConfigDomDocumentType.class.php'); 293 require($agaviDir . '/config/util/dom/AgaviXmlConfigDomElement.class.php'); 294 require($agaviDir . '/config/util/dom/AgaviXmlConfigDomEntity.class.php'); 295 require($agaviDir . '/config/util/dom/AgaviXmlConfigDomEntityReference.class.php'); 296 require($agaviDir . '/config/util/dom/AgaviXmlConfigDomNode.class.php'); 297 require($agaviDir . '/config/util/dom/AgaviXmlConfigDomNotation.class.php'); 298 require($agaviDir . '/config/util/dom/AgaviXmlConfigDomProcessingInstruction.class.php'); 299 require($agaviDir . '/config/util/dom/AgaviXmlConfigDomText.class.php'); 300 // extended XSL* classes 301 if(!AgaviConfig::get('core.skip_config_transformations', false)) { 302 if(!extension_loaded('xsl')) { 303 throw new AgaviConfigurationException('The XSL extension is required for performing transformations in the configuration system; transformations may be disabled by setting the core.skip_config_transformations directive'); 304 } 305 require($agaviDir . '/config/util/xsl/AgaviXmlConfigXsltProcessor.class.php'); 306 } 307 287 308 // manually create our config_handlers.xml handler 288 309 self::$handlers['config_handlers.xml'] = array( … … 290 311 'parameters' => array( 291 312 ), 292 'validation' => array( 293 AgaviXmlConfigParser::VALIDATION_TYPE_XMLSCHEMA => array( 294 AgaviConfig::get('core.agavi_dir') . '/config/xsd/config_handlers.xsd', 313 'transformations' => array( 314 AgaviXmlConfigParser::STAGE_SINGLE => array( 315 $agaviDir . '/config/xsl/config_handlers.xsl', 316 ), 317 AgaviXmlConfigParser::STAGE_COMPILATION => array( 318 ), 319 ), 320 'validations' => array( 321 AgaviXmlConfigParser::STAGE_SINGLE => array( 322 AgaviXmlConfigParser::STEP_TRANSFORMATIONS_BEFORE => array( 323 ), 324 AgaviXmlConfigParser::STEP_TRANSFORMATIONS_AFTER => array( 325 AgaviXmlConfigParser::VALIDATION_TYPE_RELAXNG => array( 326 $agaviDir . '/config/rng/config_handlers.rng', 327 ), 328 ), 329 ), 330 AgaviXmlConfigParser::STAGE_COMPILATION => array( 331 AgaviXmlConfigParser::STEP_TRANSFORMATIONS_BEFORE => array(), 332 AgaviXmlConfigParser::STEP_TRANSFORMATIONS_AFTER => array() 295 333 ), 296 334 ), -
trunk/src/config/AgaviConfigHandler.class.php
r2509 r2648 38 38 { 39 39 /** 40 * @var string An absolute filesystem path to a validation filename. 41 */ 42 protected $validationFile = null; 43 44 /** 45 * @var string A class name of the class which should be used to parse 46 * Input files of this config handler. 47 */ 48 protected $parser = null; 49 50 /** 51 * Retrieve the parameter node values of the given item's parameters element. 52 * 53 * @param ConfigValueHolder The node that contains a parameters chiild. 54 * @param array As associative array of parameters that will 55 * be overwritten if appropriate. 56 * @param boolean Whether or not values should be literalized. 57 * 58 * @return array An associative array of parameters 59 * 60 * @author Dominik del Bondio <ddb@bitxtender.com> 61 * @since 0.11.0 62 */ 63 protected function getItemParameters($itemNode, $oldValues = array(), $literalize = true) 64 { 65 $data = array(); 66 if($itemNode->hasChildren('parameters')) { 67 foreach($itemNode->parameters as $node) { 68 if(!$node->hasAttribute('name')) { 69 // create a new entry in in the array and get they key of the new 70 // created entry (the last in the array). The value doesn't matter 71 // since it will be overwritten anyways 72 $data[] = 0; 73 end($data); 74 $name = key($data); 75 } else { 76 $name = $node->getAttribute('name'); 77 } 78 if($node->hasChildren('parameters')) { 79 $data[$name] = (isset($oldValues[$name]) && is_array($oldValues[$name])) ? $oldValues[$name] : array(); 80 $data[$name] = $this->getItemParameters($node, $data[$name], $literalize); 81 } else { 82 $data[$name] = $literalize ? AgaviToolkit::literalize($node->getValue()) : $node->getValue(); 83 } 84 } 85 } 86 // we can NOT use array_merge here, since it would break numeric keys 87 foreach($data as $key => $value) { 88 $oldValues[$key] = $value; 89 } 90 return $oldValues; 91 } 92 93 /** 40 94 * Initialize this ConfigHandler. 41 95 * … … 57 111 $this->setParameters($parameters); 58 112 } 113 114 /** 115 * Retrieves the stored validation filename.
