<?php
class AlertNode extends BaseNode
{
public function process()
{
return sprintf("echo '<script>alert("%s");</script>';", $this->getAttribute("message");
}
}
class AlertNodeFactory extends NodeFactory
{
public function getName()
{
return "Alert";
}
public function instantiate($blueprint)
{
return new AlertNode($blueprint, $this);
}
public function queryAttributeList()
{
return array(array("name" => "message", "required" => true));
}
}
NodeList::registerFactory(new AlertNodeFactory);
<?php function test(){for($i = 0; $i < 10; $i ++){echo "Привет, $i!";}}test(); ?>