Пример #1
0
	public static function compile(vB_Node $main_node, vB_TemplateParser $parser)
	{
		return 'htmlspecialchars(' . vB_TemplateParser_CurlyRaw::compile($main_node, $parser) . ')';
	}
 public static function compile(vB_Xml_Node $main_node, vB_TemplateParser $parser)
 {
     $arguments = array();
     $searchJSON = array_shift($main_node->attributes);
     foreach ($main_node->attributes as $attribute) {
         if ($attribute instanceof vB_CurlyNode) {
             // we need to check this: I am deliberately NOT concatenating the raw variable to empty strings, cause this may be an array
             $arguments[] = vB_TemplateParser_CurlyRaw::compile($attribute, $parser);
         } else {
             $arguments[] = "'{$attribute}'";
         }
     }
     if ($searchJSON instanceof vB_CurlyNode and in_array($searchJSON->value, array('raw', 'var'))) {
         $string = $searchJSON->attributes[0];
         $string = ($string[0] !== '$' ? '$' : '') . $string;
     } else {
         $string = $searchJSON;
     }
     $arguments = 'array(' . implode(', ', $arguments) . ')';
     return 'vB_Template_Runtime::parseJSON("' . $string . "\",{$arguments}" . ')';
 }