diff options
author | xue <> | 2006-03-13 02:38:47 +0000 |
---|---|---|
committer | xue <> | 2006-03-13 02:38:47 +0000 |
commit | 7770c298450237e092d6d801fd547609ba2db230 (patch) | |
tree | ddc92889b2f10256f59a4024f5bed5cc01d73bdf /framework/Web/UI/TTemplateManager.php | |
parent | 6ae6538555d45b3e947f5ce0d948d9b88d95364a (diff) |
TDataFieldAccessor can access public member variables now. Added implementation to cope with low PHP versions.
Diffstat (limited to 'framework/Web/UI/TTemplateManager.php')
-rw-r--r-- | framework/Web/UI/TTemplateManager.php | 43 |
1 files changed, 7 insertions, 36 deletions
diff --git a/framework/Web/UI/TTemplateManager.php b/framework/Web/UI/TTemplateManager.php index 7c32e6a1..33c2edc5 100644 --- a/framework/Web/UI/TTemplateManager.php +++ b/framework/Web/UI/TTemplateManager.php @@ -704,13 +704,13 @@ class TTemplate extends TApplicationComponent implements ITemplate {
// a subproperty, so the first segment must be readable
$subname=substr($name,0,$pos);
- if(!$class->containsMethod('get'.$subname))
+ if(!$class->hasMethod('get'.$subname))
throw new TConfigurationException('template_property_unknown',$type,$subname);
}
else if(strncasecmp($name,'on',2)===0)
{
// an event
- if(!$class->containsMethod($name))
+ if(!$class->hasMethod($name))
throw new TConfigurationException('template_event_unknown',$type,$name);
else if(!is_string($att))
throw new TConfigurationException('template_eventhandler_invalid',$type,$name);
@@ -718,9 +718,9 @@ class TTemplate extends TApplicationComponent implements ITemplate else
{
// a simple property
- if(!$class->containsMethod('set'.$name))
+ if(!$class->hasMethod('set'.$name))
{
- if($class->containsMethod('get'.$name))
+ if($class->hasMethod('get'.$name))
throw new TConfigurationException('template_property_readonly',$type,$name);
else
throw new TConfigurationException('template_property_unknown',$type,$name);
@@ -745,7 +745,7 @@ class TTemplate extends TApplicationComponent implements ITemplate {
// a subproperty, so the first segment must be readable
$subname=substr($name,0,$pos);
- if(!$class->containsMethod('get'.$subname))
+ if(!$class->hasMethod('get'.$subname))
throw new TConfigurationException('template_property_unknown',$type,$subname);
}
else if(strncasecmp($name,'on',2)===0)
@@ -753,9 +753,9 @@ class TTemplate extends TApplicationComponent implements ITemplate else
{
// id is still alowed for TComponent, even if id property doesn't exist
- if(strcasecmp($name,'id')!==0 && !$class->containsMethod('set'.$name))
+ if(strcasecmp($name,'id')!==0 && !$class->hasMethod('set'.$name))
{
- if($class->containsMethod('get'.$name))
+ if($class->hasMethod('get'.$name))
throw new TConfigurationException('template_property_readonly',$type,$name);
else
throw new TConfigurationException('template_property_unknown',$type,$name);
@@ -768,33 +768,4 @@ class TTemplate extends TApplicationComponent implements ITemplate }
}
-/**
- * TReflectionClass class.
- * This class is written to cope with the incompatibility between 5.1+ and earlier versions.
- * It mainly provides a way to detect if a method exists for a given class name.
- *
- * @author Qiang Xue <qiang.xue@gmail.com>
- * @version $Revision: $ $Date: $
- * @package System.Web.UI
- * @since 3.0
- */
-class TReflectionClass extends ReflectionClass
-{
- /**
- * @param string method name
- * @return boolean whether the method exists
- */
- public function containsMethod($method)
- {
- try
- {
- return $this->getMethod($method)!==null;
- }
- catch(Exception $e)
- {
- return false;
- }
- }
-}
-
?>
\ No newline at end of file |