requireAttributes('id');
$id = $renderer->doText($this->getAttribute('id'));
$html = '';
$html .= $renderer->doNode($node);
$html .= '';
return $html;
}
}
class k4CacheCanDoTag extends FATemplateTag
{
function parse(&$context, &$renderer, &$node)
{
$this->requireAttributes('object', 'perm');
$perm = $this->getAttribute('perm');
$object = $this->getAttribute('object');
$html = '';
$html .= $renderer->doNode($node);
$html .= '';
return $html;
}
}
class k4CacheIfTag extends FATemplateTag
{
function parse(&$context, &$renderer, &$node)
{
$this->requireAttributes('static');
$op = $this->requireOne('eq', 'neq', 'gt', 'lt', 'geq', 'leq');
$operations = array(
'eq' => '==',
'eqvar' => '==',
'neq' => '!=',
'neqvar' => '!=',
'gt' => '>',
'lt' => '<',
'geq' => '>=',
'geqvar' => '>=',
'leq' => '<=',
'leqvar' => '<=',
);
$a = $context->get($this->getAttribute('static'));
$b = $this->getAttribute($op);
// TODO:{[this is ugly[parse[FAIfTag}
if(strpos($op, 'var') !== FALSE)
{
$b = $context->get($b);
}
// the reason md5 is here is because you're
// probably comparing one object to another
// in this case. So, an md5 of the serialized
// object/array will do the trick.
if(is_object($a) || is_array($a))
{
$a = md5(serialize($a));
}
if(is_object($b) || is_array($b))
{
$b = md5(serialize($b));
}
// htmlentities them, it doesn't matter what they are,
// this will make it safe to plug them into the HTML
$a = htmlentities($a, ENT_QUOTES, K4_CHARSET);
$b = htmlentities($b, ENT_QUOTES, K4_CHARSET);
$html = '';
$html .= $renderer->doNode($node);
$html .= "";
return $html;
}
}
?>