diff options
Diffstat (limited to 'lib/phptal/PHPTAL/Namespace')
-rw-r--r-- | lib/phptal/PHPTAL/Namespace/Builtin.php | 38 | ||||
-rw-r--r-- | lib/phptal/PHPTAL/Namespace/I18N.php | 32 | ||||
-rw-r--r-- | lib/phptal/PHPTAL/Namespace/METAL.php | 31 | ||||
-rw-r--r-- | lib/phptal/PHPTAL/Namespace/PHPTAL.php | 31 | ||||
-rw-r--r-- | lib/phptal/PHPTAL/Namespace/TAL.php | 36 |
5 files changed, 168 insertions, 0 deletions
diff --git a/lib/phptal/PHPTAL/Namespace/Builtin.php b/lib/phptal/PHPTAL/Namespace/Builtin.php new file mode 100644 index 0000000..5cec74d --- /dev/null +++ b/lib/phptal/PHPTAL/Namespace/Builtin.php @@ -0,0 +1,38 @@ +<?php +/** + * PHPTAL templating engine + * + * PHP Version 5 + * + * @category HTML + * @package PHPTAL + * @author Laurent Bedubourg <lbedubourg@motion-twin.com> + * @author Kornel Lesiński <kornel@aardvarkmedia.co.uk> + * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License + * @version SVN: $Id$ + * @link http://phptal.org/ + */ + +/** + * @package PHPTAL + * @subpackage Namespace + */ +class PHPTAL_Namespace_Builtin extends PHPTAL_Namespace +{ + public function createAttributeHandler(PHPTAL_NamespaceAttribute $att, PHPTAL_Dom_Element $tag, $expression) + { + $name = $att->getLocalName(); + + // change define-macro to "define macro" and capitalize words + $name = str_replace(' ', '', ucwords(strtr($name, '-', ' '))); + + // case is important when using autoload on case-sensitive filesystems + if (version_compare(PHP_VERSION, '5.3', '>=') && __NAMESPACE__) { + $class = 'PHPTALNAMESPACE\\Php\\Attribute\\'.strtoupper($this->getPrefix()).'\\'.$name; + } else { + $class = 'PHPTAL_Php_Attribute_'.strtoupper($this->getPrefix()).'_'.$name; + } + $result = new $class($tag, $expression); + return $result; + } +} diff --git a/lib/phptal/PHPTAL/Namespace/I18N.php b/lib/phptal/PHPTAL/Namespace/I18N.php new file mode 100644 index 0000000..81dd8e6 --- /dev/null +++ b/lib/phptal/PHPTAL/Namespace/I18N.php @@ -0,0 +1,32 @@ +<?php +/** + * PHPTAL templating engine + * + * PHP Version 5 + * + * @category HTML + * @package PHPTAL + * @author Laurent Bedubourg <lbedubourg@motion-twin.com> + * @author Kornel Lesiński <kornel@aardvarkmedia.co.uk> + * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License + * @version SVN: $Id$ + * @link http://phptal.org/ + */ + + +/** + * @package PHPTAL + * @subpackage Namespace + */ +class PHPTAL_Namespace_I18N extends PHPTAL_Namespace_Builtin +{ + public function __construct() + { + parent::__construct('i18n', 'http://xml.zope.org/namespaces/i18n'); + $this->addAttribute(new PHPTAL_NamespaceAttributeContent('translate', 5)); + $this->addAttribute(new PHPTAL_NamespaceAttributeSurround('name', 5)); + $this->addAttribute(new PHPTAL_NamespaceAttributeSurround('attributes', 10)); + $this->addAttribute(new PHPTAL_NamespaceAttributeSurround('domain', 3)); + } +} + diff --git a/lib/phptal/PHPTAL/Namespace/METAL.php b/lib/phptal/PHPTAL/Namespace/METAL.php new file mode 100644 index 0000000..2773667 --- /dev/null +++ b/lib/phptal/PHPTAL/Namespace/METAL.php @@ -0,0 +1,31 @@ +<?php +/** + * PHPTAL templating engine + * + * PHP Version 5 + * + * @category HTML + * @package PHPTAL + * @author Laurent Bedubourg <lbedubourg@motion-twin.com> + * @author Kornel Lesiński <kornel@aardvarkmedia.co.uk> + * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License + * @version SVN: $Id$ + * @link http://phptal.org/ + */ + + +/** + * @package PHPTAL + * @subpackage Namespace + */ +class PHPTAL_Namespace_METAL extends PHPTAL_Namespace_Builtin +{ + public function __construct() + { + parent::__construct('metal', 'http://xml.zope.org/namespaces/metal'); + $this->addAttribute(new PHPTAL_NamespaceAttributeSurround('define-macro', 1)); + $this->addAttribute(new PHPTAL_NamespaceAttributeReplace('use-macro', 9)); + $this->addAttribute(new PHPTAL_NamespaceAttributeSurround('define-slot', 9)); + $this->addAttribute(new PHPTAL_NamespaceAttributeSurround('fill-slot', 9)); + } +} diff --git a/lib/phptal/PHPTAL/Namespace/PHPTAL.php b/lib/phptal/PHPTAL/Namespace/PHPTAL.php new file mode 100644 index 0000000..4d4270a --- /dev/null +++ b/lib/phptal/PHPTAL/Namespace/PHPTAL.php @@ -0,0 +1,31 @@ +<?php +/** + * PHPTAL templating engine + * + * PHP Version 5 + * + * @category HTML + * @package PHPTAL + * @author Laurent Bedubourg <lbedubourg@motion-twin.com> + * @author Kornel Lesiński <kornel@aardvarkmedia.co.uk> + * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License + * @version SVN: $Id$ + * @link http://phptal.org/ + */ + + +/** + * @package PHPTAL + * @subpackage Namespace + */ +class PHPTAL_Namespace_PHPTAL extends PHPTAL_Namespace_Builtin +{ + public function __construct() + { + parent::__construct('phptal', 'http://phptal.org/ns/phptal'); + $this->addAttribute(new PHPTAL_NamespaceAttributeSurround('tales', -1)); + $this->addAttribute(new PHPTAL_NamespaceAttributeSurround('debug', -2)); + $this->addAttribute(new PHPTAL_NamespaceAttributeSurround('id', 7)); + $this->addAttribute(new PHPTAL_NamespaceAttributeSurround('cache', -3)); + } +} diff --git a/lib/phptal/PHPTAL/Namespace/TAL.php b/lib/phptal/PHPTAL/Namespace/TAL.php new file mode 100644 index 0000000..74cd90a --- /dev/null +++ b/lib/phptal/PHPTAL/Namespace/TAL.php @@ -0,0 +1,36 @@ +<?php +/** + * PHPTAL templating engine + * + * PHP Version 5 + * + * @category HTML + * @package PHPTAL + * @author Laurent Bedubourg <lbedubourg@motion-twin.com> + * @author Kornel Lesiński <kornel@aardvarkmedia.co.uk> + * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License + * @version SVN: $Id$ + * @link http://phptal.org/ + */ + + +/** + * @package PHPTAL + * @subpackage Namespace + */ +class PHPTAL_Namespace_TAL extends PHPTAL_Namespace_Builtin +{ + public function __construct() + { + parent::__construct('tal', 'http://xml.zope.org/namespaces/tal'); + $this->addAttribute(new PHPTAL_NamespaceAttributeSurround('define', 4)); + $this->addAttribute(new PHPTAL_NamespaceAttributeSurround('condition', 6)); + $this->addAttribute(new PHPTAL_NamespaceAttributeSurround('repeat', 8)); + $this->addAttribute(new PHPTAL_NamespaceAttributeContent('content', 11)); + $this->addAttribute(new PHPTAL_NamespaceAttributeReplace('replace', 9)); + $this->addAttribute(new PHPTAL_NamespaceAttributeSurround('attributes', 9)); + $this->addAttribute(new PHPTAL_NamespaceAttributeSurround('omit-tag', 0)); + $this->addAttribute(new PHPTAL_NamespaceAttributeSurround('comment', 12)); + $this->addAttribute(new PHPTAL_NamespaceAttributeSurround('on-error', 2)); + } +} |