Index: trunk/core/kernel/processors/tag_processor.php =================================================================== diff -u -N --- trunk/core/kernel/processors/tag_processor.php (revision 0) +++ trunk/core/kernel/processors/tag_processor.php (revision 1560) @@ -0,0 +1,161 @@ +ProcessParsedTag($tag->Tag, $tag->NP, $tag->getPrefixSpecial()); + + /*$Method=$tag->Tag; + if(method_exists($this, $Method)) + { + //echo htmlspecialchars($tag->GetFullTag()).'
'; + return $this->$Method($tag->NP); + } + else + { + if ($this->Application->hasObject('TagsAggregator')) { + $aggregator = $this->Application->recallObject('TagsAggregator'); + $tag_mapping = $aggregator->GetArrayValue($tag->Prefix, $Method); + if ($tag_mapping) { + + $mapped_tag =& new Tag('', $this->Application->Parser); + $mapped_tag->CopyFrom($tag); + $mapped_tag->Processor = $tag_mapping[0]; + $mapped_tag->Tag = $tag_mapping[1]; + $mapped_tag->NP['PrefixSpecial'] = $tag->getPrefixSpecial(); + $mapped_tag->RebuildTagData(); + return $mapped_tag->DoProcessTag(); + } + } + trigger_error('Tag '.$Method.' Undefined in '.get_class($this).'[Agregated Tag]:
'.$tag->RebuildTagData().'',E_USER_WARNING); + return false; + }*/ + } + + function ProcessParsedTag($tag, $params, $prefix) + { + $Method=$tag; + if(method_exists($this, $Method)) + { + if( $this->Application->isDebugMode() && dbg_ConstOn('DBG_SHOW_TAGS') ) + { + global $debugger; + $debugger->appendHTML('Processing PreParsed Tag '.$Method.' in '.$this->Prefix); + } + + //echo htmlspecialchars($tag->GetFullTag()).'
'; + return $this->$Method($params); + } + else + { + if ($this->Application->hasObject('TagsAggregator')) { + $aggregator = $this->Application->recallObject('TagsAggregator'); + $tmp = $this->Application->processPrefix($prefix); + $tag_mapping = $aggregator->GetArrayValue($tmp['prefix'], $Method); + if ($tag_mapping) { + $tmp = $this->Application->processPrefix($tag_mapping[0]); + $__tag_processor = $tmp['prefix'].'_TagProcessor'; + $processor =& $this->Application->recallObject($__tag_processor); + $processor->Prefix = $tmp['prefix']; + $processor->Special = $tmp['special']; + $params['PrefixSpecial'] = $prefix; + return $processor->ProcessParsedTag($tag_mapping[1], $params, $prefix); + } + trigger_error('Tag '.$Method.' Undefined in '.get_class($this).'[Agregated Tag]:
'.$tag.'', E_USER_WARNING); + } + trigger_error('Tag Undefined:
'.$tag.'',E_USER_WARNING); + return false; + } + } + + /** + * Checks if object propery value matches value passed + * + * @param Array $params + * @return bool + */ + function PropertyEquals($params) + { + $object =& $this->Application->recallObject( $this->getPrefixSpecial(), $this->Prefix, $params ); + $property_name = $params['property']; + return $object->$property_name == $params['value']; + } + + /** + * Not tag, method for parameter + * selection from list in this TagProcessor + * + * @param Array $params + * @param string $possible_names + * @return string + * @access public + */ + function SelectParam($params, $possible_names) + { + if (!is_array($params)) return; + if (!is_array($possible_names)) + + $possible_names = explode(',', $possible_names); + foreach ($possible_names as $name) + { + if( isset($params[$name]) ) return $params[$name]; + } + return false; + } + } + +/*class ProcessorsPool { + var $Processors = Array(); + var $Application; + var $Prefixes = Array(); + var $S; + + function ProcessorsPool() + { + $this->Application =& KernelApplication::Instance(); + $this->S =& $this->Application->Session; + } + + function RegisterPrefix($prefix, $path, $class) + { + // echo " RegisterPrefix $prefix, $path, $class
"; + $prefix_item = Array( + 'path' => $path, + 'class' => $class + ); + $this->Prefixes[$prefix] = $prefix_item; + } + + function CreateProcessor($prefix, &$tag) + { + // echo " prefix : $prefix
"; + if (!isset($this->Prefixes[$prefix])) + die ("Filepath and ClassName for prefix $prefix not defined while processing ".htmlspecialchars($tag->GetFullTag())."!"); + include_once($this->Prefixes[$prefix]['path']); + $ClassName = $this->Prefixes[$prefix]['class']; + $a_processor =& new $ClassName($prefix); + $this->SetProcessor($prefix, $a_processor); + } + + function SetProcessor($prefix, &$a_processor) + { + $this->Processors[$prefix] =& $a_processor; + } + + function &GetProcessor($prefix, &$tag) + { + if (!isset($this->Processors[$prefix])) + $this->CreateProcessor($prefix, $tag); + return $this->Processors[$prefix]; + } +}*/ + +?> \ No newline at end of file