1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16:
17:
18: if (!class_exists('PHPTAL')) { require_once 'PHPTAL.php'; }
19: if (!class_exists('PHPTAL_Namespace')) { require_once 'PHPTAL/Namespace.php'; }
20: if (!class_exists('PHPTAL_Dom_Defs')) { require_once 'PHPTAL/Dom/Defs.php'; }
21:
22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37:
38: class Pinoco_PAL_Namespace extends PHPTAL_Namespace
39: {
40: public function __construct()
41: {
42:
43: parent::__construct('pal', 'http://pinoco.org/ns/pal');
44:
45: $this->addAttribute(new PHPTAL_NamespaceAttributeContent('content-nl2br', 11));
46: $this->addAttribute(new PHPTAL_NamespaceAttributeReplace('replace-nl2br', 9));
47: $this->addAttribute(new PHPTAL_NamespaceAttributeSurround('attr', 9));
48: }
49:
50: public function createAttributeHandler(PHPTAL_NamespaceAttribute $att, PHPTAL_Dom_Element $tag, $expression)
51: {
52: $attrNames = array(
53: 'content-nl2br' => 'Pinoco_PAL_ContentNl2br',
54: 'replace-nl2br' => 'Pinoco_PAL_ReplaceNl2br',
55: 'attr' => 'Pinoco_PAL_Attr',
56: );
57: $class = $attrNames[$att->getLocalName()];
58: return new $class($tag, $expression);
59: }
60: }
61:
62: PHPTAL_Dom_Defs::getInstance()->registerNamespace(new Pinoco_PAL_Namespace());
63:
64: