diff options
author | ctrlaltca@gmail.com <> | 2011-06-20 10:48:45 +0000 |
---|---|---|
committer | ctrlaltca@gmail.com <> | 2011-06-20 10:48:45 +0000 |
commit | 656c339879a071f2f875831281ed833b876e4361 (patch) | |
tree | b6f11d3ad8cb1f61b10b4e3b9fcb0a7d4d30f9e1 /framework/Util | |
parent | 0956370d34e2eefd0b5e556a6aaca6297ce1e3ce (diff) |
removed useless calls to empty contructor; reverted some additional undocumented changes; upported the "cgi workaround" to trunk/; large (fake) changeset are due to mixed cr/crlf used previously
Diffstat (limited to 'framework/Util')
-rw-r--r-- | framework/Util/TParameterModule.php | 58 | ||||
-rw-r--r-- | framework/Util/TRpcClient.php | 1 |
2 files changed, 23 insertions, 36 deletions
diff --git a/framework/Util/TParameterModule.php b/framework/Util/TParameterModule.php index 265bdd38..0109ca32 100644 --- a/framework/Util/TParameterModule.php +++ b/framework/Util/TParameterModule.php @@ -4,7 +4,7 @@ *
* @author Qiang Xue <qiang.xue@gmail.com>
* @link http://www.pradosoft.com/
- * @copyright Copyright © 2005-2010 PradoSoft
+ * @copyright Copyright © 2005-2008 PradoSoft
* @license http://www.pradosoft.com/license/
* @version $Id$
* @package System.Util
@@ -24,7 +24,6 @@ * <parameters>
* <parameter id="param1" value="paramValue1" />
* <parameter id="param2" Property1="Value1" Property2="Value2" ... />
- * <parameter id="param3" value="cannot be changed" final="true" />
* </parameters>
* </code>
*
@@ -34,19 +33,12 @@ * <module class="System.Util.TParameterModule">
* <parameter id="param1" value="paramValue1" />
* <parameter id="param2" Property1="Value1" Property2="Value2" ... />
- * <parameter id="param3" value="cannot be changed" final="true" />
* </module>
* </code>
*
- * Setting the final attribute to true will cause that parameter to be unchangable
- * by any future mergeParameters.
- *
* If a parameter is defined both in the external file and within the module
* tag, the former takes precedence.
*
- * the application parameters are processed first before the modules parameters
- * are processed.
- *
* @author Qiang Xue <qiang.xue@gmail.com>
* @author Carl G. Mathisen <carlgmathisen@gmail.com>
* @version $Id$
@@ -101,7 +93,7 @@ class TParameterModule extends TModule /**
* Loads parameters into application.
- * @param mixed XML or PHP representation of the parameters
+ * @param mixed XML of PHP representation of the parameters
* @throws TConfigurationException if the parameter file format is invalid
*/
protected function loadParameters($config)
@@ -111,23 +103,10 @@ class TParameterModule extends TModule {
foreach($config as $id => $parameter)
{
- if(is_array($parameter))
+ if(is_array($parameter) && isset($parameter['class']))
{
- $final = TPropertyValue::ensureBoolean($parameter['final']);
- unset($parameter['final']);
- if(isset($parameter['class']))
- {
- $properties = isset($parameter['properties']) ? $parameter['properties'] : array();
- $properties['id'] = $id;
- $parameters[$id] = array('type'=>0, 'class' => $parameter['class'], 'properties' => $properties,
- 'final' => $final, 'value' => $parameter);
- } else {
- if(!isset($parameter['value'])) {
- $parameters[$id]=array('type'=>1, 'value' => $parameter, 'final' => $final);
- } else {
- $parameters[$id]=array('type'=>2, 'value' => $value, 'final' => $final);
- }
- }
+ $properties = isset($parameter['properties'])?$parameter['properties']:array();
+ $parameters[$id]=array($parameter['class'],$properties);
}
else
{
@@ -142,22 +121,31 @@ class TParameterModule extends TModule $properties=$node->getAttributes();
if(($id=$properties->remove('id'))===null)
throw new TConfigurationException('parametermodule_parameterid_required');
- $final = TPropertyValue::ensureBoolean($properties->remove('final'));
if(($type=$properties->remove('class'))===null)
{
if(($value=$properties->remove('value'))===null)
- $parameters[$id]=array('type'=>1, 'value' => $node, 'final' => $final);
+ $parameters[$id]=$node;
else
- $parameters[$id]=array('type'=>2, 'value' => $value, 'final' => $final);
- }
- else {
- $parameters[$id]=array('type'=>0, 'class' => $type, 'properties' => $properties->toArray(),
- 'final' => $final, 'value' => $node);
+ $parameters[$id]=$value;
}
+ else
+ $parameters[$id]=array($type,$properties->toArray());
+ }
+ }
+
+ $appParams=$this->getApplication()->getParameters();
+ foreach($parameters as $id=>$parameter)
+ {
+ if(is_array($parameter))
+ {
+ $component=Prado::createComponent($parameter[0]);
+ foreach($parameter[1] as $name=>$value)
+ $component->setSubProperty($name,$value);
+ $appParams->add($id,$component);
}
+ else
+ $appParams->add($id,$parameter);
}
-
- $this->getApplication()->mergeParameters($parameters);
}
/**
diff --git a/framework/Util/TRpcClient.php b/framework/Util/TRpcClient.php index dbda931e..fbfb528a 100644 --- a/framework/Util/TRpcClient.php +++ b/framework/Util/TRpcClient.php @@ -66,7 +66,6 @@ class TRpcClient extends TApplicationComponent */ public function __construct($serverUrl, $isNotification = false) { - parent::__construct(); $this->_serverUrl = $serverUrl; $this->_isNotification = TPropertyValue::ensureBoolean($isNotification); } |