Index: branches/5.2.x/core/kernel/processors/tag_processor.php =================================================================== diff -u -N -r14244 -r14628 --- branches/5.2.x/core/kernel/processors/tag_processor.php (.../tag_processor.php) (revision 14244) +++ branches/5.2.x/core/kernel/processors/tag_processor.php (.../tag_processor.php) (revision 14628) @@ -1,6 +1,6 @@ ProcessParsedTag($tag->Tag, $tag->NP, $tag->getPrefixSpecial()); } - function CheckTag($tag, $prefix) + /** + * Checks, that tag is implemented in this tag processor + * + * @param string $tag + * @param string $prefix + * + * @return bool + * @access public + */ + public function CheckTag($tag, $prefix) { - $Method = $tag; - if(method_exists($this, $Method)) - { + $method = $tag; + + if ( method_exists($this, $method) ) { return true; } - 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) { - return true; - } + + if ( $this->Application->hasObject('TagsAggregator') ) { + $aggregator =& $this->Application->recallObject('TagsAggregator'); + /* @var $aggregator kArray */ + + $tmp = $this->Application->processPrefix($prefix); + $tag_mapping = $aggregator->GetArrayValue($tmp['prefix'], $method); + + if ( $tag_mapping ) { + return true; } } + + return false; } function FormCacheKey($tag, $params, $prefix) @@ -84,6 +97,7 @@ list ($prefix_only, ) = explode('.', $prefix); $this->Application->Parser->PrefixesInUse[$prefix_only] = 1; + $cache_key = ''; $backup_prefix = $this->Prefix; $backup_special = $this->Special; @@ -133,15 +147,18 @@ function processAggregatedTag($tag, $params, $prefix, $file = 'unknown', $line = 0) { - if ($this->Application->hasObject('TagsAggregator')) { + if ( $this->Application->hasObject('TagsAggregator') ) { $Method = $tag; $aggregator =& $this->Application->recallObject('TagsAggregator'); + /* @var $aggregator kArray */ + $tmp = $this->Application->processPrefix($prefix); $tag_mapping = $aggregator->GetArrayValue($tmp['prefix'], $Method); - if ($tag_mapping) { + + if ( $tag_mapping ) { // aggregated tag defined $tmp = $this->Application->processPrefix($tag_mapping[0]); - $__tag_processor = $tmp['prefix'].'_TagProcessor'; + $__tag_processor = $tmp['prefix'] . '_TagProcessor'; $processor =& $this->Application->recallObject($__tag_processor); /* @var $processor kTagProcessor */ @@ -151,7 +168,7 @@ $params['original_tag'] = $Method; // allows to define same method for different aggregated tags in same tag processor $params['PrefixSpecial'] = $this->getPrefixSpecial(); // $prefix; $ret = $processor->ProcessParsedTag($tag_mapping[1], $params, $prefix); - if (isset($params['result_to_var'])) { + if ( isset($params['result_to_var']) ) { $this->Application->Parser->SetParam($params['result_to_var'], $ret); $ret = ''; } @@ -213,46 +230,46 @@ } - /** - * 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 = null) - { - if (!isset($possible_names)) { - // select 1st parameter non-empty parameter value - $possible_names = explode(',', $params['possible_names']); - foreach ($possible_names as $param_name) { - $value = $this->Application->Parser->GetParam($param_name); - if (((string)$value != '') && ((string)$value != '0')) { - return $value; + /** + * Not tag, method for parameter + * selection from list in this TagProcessor + * + * @param Array $params + * @param string $possible_names + * @return string|bool + * @access protected + */ + protected function SelectParam($params, $possible_names = null) + { + if ( !isset($possible_names) ) { + // select 1st parameter non-empty parameter value + $possible_names = explode(',', $params['possible_names']); + + foreach ($possible_names as $param_name) { + $value = $this->Application->Parser->GetParam($param_name); + $string_value = (string)$value; + + if ( ($string_value != '') && ($string_value != '0') ) { + return $value; + } } + + return false; } - return ''; - } + if ( !is_array($possible_names) ) { + $possible_names = explode(',', $possible_names); + } - if (!is_array($params)) { - // really happens? - return; - } + foreach ($possible_names as $name) { + if ( isset($params[$name]) ) { + return $params[$name]; + } + } - if (!is_array($possible_names)) { - $possible_names = explode(',', $possible_names); + return false; } - foreach ($possible_names as $name) { - if( isset($params[$name]) ) return $params[$name]; - } - - return false; - } - /** * Returns templates path for module, which is gathered from prefix module *