public function executeTag($tag, $token) { if ($tag->attributes) { foreach ($tag->attributes as $key => $value) { preg_match_all('/#\\s*([^#]+)\\s*#/', $value, $matches, PREG_SET_ORDER); foreach ($matches as $match) { $var = $match[1]; if (isset(CFML::$variables[$match[1]])) { $replacement =& CFML::$variables[$match[1]]; } elseif (CFML::$fallback instanceof ViewableData && CFML::$fallback->hasMethod($match[1])) { $replacement = CFML::$fallback->{$var}(); } elseif (CFML::$fallback instanceof ViewableData && CFML::$fallback->hasField($var)) { $replacement = CFML::$fallback->getField($var); } else { continue; //throw new CFML_Parser_Exception("Undefined variable {$match[1]}"); } if ($tag->attributes[$key] == $match[1]) { $tag->attributes[$key] =& $replacement; } else { $tag->attributes[$key] = str_replace($match[0], $replacement, $tag->attributes[$key]); } } } } switch ($token['mode']) { case 'start': CFMLTag::$current_tag = $tag; return $tag->open(); case 'end': $ret = $tag->close(); CFMLTag::$current_tag = null; return $ret; case 'selfclosing': CFMLTag::$current_tag = $tag; $ret = $tag->execute(); CFMLTag::$current_tag = null; return $ret; } }
public function close() { self::$current_tag = null; }