Source for file Tag.php
Documentation is available at Tag.php
/* vim: set expandtab tabstop=4 shiftwidth=4: */
// +----------------------------------------------------------------------+
// +----------------------------------------------------------------------+
// | Copyright (c) 1997-2002 The PHP Group |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.02 of the PHP license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available at through the world-wide-web at |
// | http://www.php.net/license/2_02.txt. |
// | If you did not receive a copy of the PHP license and are unable to |
// | obtain it through the world-wide-web, please send a note to |
// | license@php.net so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// | Authors: Alan Knowles <alan@akbkhome> |
// +----------------------------------------------------------------------+
// $Id: Tag.php 329605 2013-03-01 01:59:25Z alan_k $
$GLOBALS['_HTML_TEMPLATE_FLEXY_TOKEN_TAG']['activeSelect'] = false;
require_once 'HTML/Template/Flexy/Element.php';
* A standard HTML Tag = eg. Table/Body etc.
* This is the generic HTML tag
* a simple one will have some attributes and a name.
class HTML_Template_Flexy_Token_Tag extends HTML_Template_Flexy_Token {
* HTML Tag: eg. Body or /Body - uppercase
* HTML Tag: (original case)
* Associative array of attributes. (original case)
* key is the left, value is the right..
* values are raw (eg. include "")
* array (a parsed value with flexy tags in)
* object (normally some PHP code that generates the key as well..)
var $attributes = array ();
* Associative array of attributes ucase to Original Case for attributes..
var $ucAttributes = array ();
* used to add code to end of tags "<xxxx>here....children .. <close tag>"
* used to add code to beginning of tags TODO "here<xxxx>....children .. <close tag>"
* Alias to closing tag (built externally).
* used to add < ? } ? > code to dynamic tags.
var $close; // alias to closing tag.
* Setvalue - gets name, attribute as an array
* @see parent::setValue()
function setValue ($value)
global $_HTML_TEMPLATE_FLEXY_TOKEN;
$this->attributes = $value[1 ];
$this->ucAttributes[strtoupper($k)] = & $this->attributes[$k];
* getAttribute = reads an attribute value and strips the quotes
* does not handle values with flexytags in them
function getAttribute ($key) {
// all attribute keys are stored Upper Case,
// however just to make sure we have not done a typo :)
//echo "looking for $key\n";
//var_dump($this->attributes);
// this is weird case isset() returns false on this being null!
if (array_key_exists($key, $this->ucAttributes) && $this->ucAttributes[$key] === true ) {
// if (@$this->ucAttributes[$key] === true) {
if (!isset ($this->ucAttributes[$key])) {
// general assumption - none of the tools can do much with dynamic
// attributes - eg. stuff with flexy tags in it.
$v = $this->ucAttributes[$key];
* getAttributes = returns all the attributes key/value without quotes
function getAttributes () {
foreach($this->attributes as $k=> $v) {
$ret[$k] = $this->getAttribute ($k);
* clearAttributes = removes an attribute from the object.
function clearAttribute ($string) {
if (isset ($this->attributes[$string])) {
unset ($this->attributes[$string]);
* used to get the contents..
foreach($this->attributes as $k=> $v) {
if (empty ($this->children)) {
foreach($this->children as $c) {
return $ret . '</'. $this->oTag . '>';
Documentation generated on Mon, 11 Mar 2019 15:59:59 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|