preparation release

This commit is contained in:
nojhan 2008-01-31 21:24:09 +00:00
commit f5e3a62ee8
196 changed files with 64314 additions and 0 deletions

View file

@ -0,0 +1,35 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4: */
// +----------------------------------------------------------------------+
// | PHP Version 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: Else.php,v 1.3 2003/12/10 02:36:26 alan_k Exp $
//
/**
* Class to handle Else
*
*
*/
class HTML_Template_Flexy_Token_Else extends HTML_Template_Flexy_Token {
}

View file

@ -0,0 +1,33 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4: */
// +----------------------------------------------------------------------+
// | PHP Version 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: End.php,v 1.3 2003/12/10 02:36:26 alan_k Exp $
//
/**
* Class to handle End statements (eg. close brakets)
*
*
*/
class HTML_Template_Flexy_Token_End extends HTML_Template_Flexy_Token {
}

View file

@ -0,0 +1,35 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4: */
// +----------------------------------------------------------------------+
// | PHP Version 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: EndTag.php,v 1.2 2003/12/10 02:36:26 alan_k Exp $
//
/**
* The closing HTML Tag = eg. /Table or /Body etc.
*
* @abstract
* This just extends the generic HTML tag
*
*/
require_once 'HTML/Template/Flexy/Token/Tag.php';
class HTML_Template_Flexy_Token_EndTag extends HTML_Template_Flexy_Token_Tag { }

View file

@ -0,0 +1,72 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4: */
// +----------------------------------------------------------------------+
// | PHP Version 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: Foreach.php,v 1.3 2004/04/03 03:44:58 alan_k Exp $
//
/**
* Class to handle foreach statements
*
*
*/
class HTML_Template_Flexy_Token_Foreach extends HTML_Template_Flexy_Token {
/**
* variable to loop on.
*
* @var string
* @access public
*/
var $loopOn = '';
/**
* key value
*
* @var string
* @access public
*/
var $key = '';
/**
* optional value (in key=>value pair)
*
* @var string
* @access public
*/
var $value = '';
/**
* Setvalue - a array of all three (last one optional)
* @see parent::setValue()
*/
function setValue($value) {
$this->loopOn=$value[0];
if (!isset($value[1]) || !strlen(trim($value[1]))) {
// error condition.
return false;
}
$this->key=$value[1];
$this->value=@$value[2];
}
}

View file

@ -0,0 +1,62 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4: */
// +----------------------------------------------------------------------+
// | PHP Version 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: If.php,v 1.5 2003/12/10 02:36:26 alan_k Exp $
//
/**
* Class to handle If statements
*
*
*/
class HTML_Template_Flexy_Token_If extends HTML_Template_Flexy_Token{
/**
* Condition for the if statement.
* @var string // a variable
* @access public
*/
var $condition;
/**
* if the statement is negative = eg. !somevar..
* @var string
* @access public
*/
var $isNegative = '';
/**
* Setvalue - a string
* @see parent::setValue()
*/
function setValue($value) {
//var_dump($value);
if (strlen($value) && $value{0} == '!') {
$this->isNegative = '!';
$value = substr($value,1);
}
$this->condition=$value;
}
}

View file

@ -0,0 +1,95 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4: */
// +----------------------------------------------------------------------+
// | PHP Version 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: Method.php,v 1.14 2003/12/10 02:36:26 alan_k Exp $
//
/**
* Class to handle method calls
* *
*
*/
class HTML_Template_Flexy_Token_Method extends HTML_Template_Flexy_Token {
/**
* variable modifier (h = raw, u = urlencode, none = htmlspecialchars)
* TODO
* @var char
* @access public
*/
var $modifier;
/**
* Method name
*
* @var char
* @access public
*/
var $method;
/**
* is it in if statement with a method?
*
* @var boolean
* @access public
*/
var $isConditional;
/**
* if the statement is negative = eg. !somevar..
* @var string
* @access public
*/
var $isNegative = '';
/**
* arguments, either variables or literals eg. #xxxxx yyyy#
*
* @var array
* @access public
*/
var $args= array();
/**
* setvalue - at present array method, args (need to add modifier)
* @see parent::setValue()
*/
function setValue($value) {
// var_dump($value);
$method = $value[0];
if (substr($value[0],0,3) == 'if:') {
$this->isConditional = true;
if ($value[0]{3} == '!') {
$this->isNegative = '!';
$method = substr($value[0],4);
} else {
$method = substr($value[0],3);
}
}
if (strpos($method,":")) {
list($method,$this->modifier) = explode(':',$method);
}
$this->method = $method;
$this->args = $value[1];
// modifier TODO!
}
}

View file

@ -0,0 +1,34 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4: */
// +----------------------------------------------------------------------+
// | PHP Version 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: Processing.php,v 1.3 2003/12/10 02:36:26 alan_k Exp $
//
/**
* Class to handle Processing Directives = <?xml or <?php
*
*
*/
class HTML_Template_Flexy_Token_Processing extends HTML_Template_Flexy_Token {
}

View file

@ -0,0 +1,212 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4: */
// +----------------------------------------------------------------------+
// | PHP Version 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,v 1.49 2004/08/16 09:12:23 alan_k Exp $
$GLOBALS['_HTML_TEMPLATE_FLEXY_TOKEN_TAG']['activeSelect'] = false;
require_once 'HTML/Template/Flexy/Element.php';
/**
* A standard HTML Tag = eg. Table/Body etc.
*
* @abstract
* 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
*
* @var string
* @access public
*/
var $tag = '';
/**
* HTML Tag: (original case)
*
* @var string
* @access public
*/
var $oTag = '';
/**
* Associative array of attributes. (original case)
*
* key is the left, value is the right..
* note:
* values are raw (eg. include "")
* valuse can be
* text = standard
* array (a parsed value with flexy tags in)
* object (normally some PHP code that generates the key as well..)
*
*
* @var array
* @access public
*/
var $attributes = array();
/**
* Associative array of attributes ucase to Original Case for attributes..
*
* @var array
* @access public
*/
var $ucAttributes = array();
/**
* postfix tokens
* used to add code to end of tags "<xxxx>here....children .. <close tag>"
*
* @var array
* @access public
*/
var $postfix = '';
/**
* prefix tokens
* used to add code to beginning of tags TODO "here<xxxx>....children .. <close tag>"
*
* @var array
* @access public
*/
var $prefix = '';
/**
* Alias to closing tag (built externally).
* used to add < ? } ? > code to dynamic tags.
* @var object alias
* @access public
*/
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->tag = strtoupper($value[0]);
$this->oTag = $value[0];
if (isset($value[1])) {
$this->attributes = $value[1];
}
foreach(array_keys($this->attributes) as $k) {
$this->ucAttributes[strtoupper($k)] =& $this->attributes[$k];
}
}
/**
* getAttribute = reads an attribute value and strips the quotes
*
* TODO
* does not handle values with flexytags in them
*
* @return string (
* @access public
*/
function getAttribute($key) {
// all attribute keys are stored Upper Case,
// however just to make sure we have not done a typo :)
$key = strtoupper($key);
//echo "looking for $key\n";
//var_dump($this->attributes);
// this is weird case isset() returns false on this being null!
if (@$this->ucAttributes[$key] === true) {
return true;
}
if (!isset($this->ucAttributes[$key])) {
return false;
}
// general assumption - none of the tools can do much with dynamic
// attributes - eg. stuff with flexy tags in it.
if (!is_string($this->ucAttributes[$key])) {
return false;
}
$v = $this->ucAttributes[$key];
// unlikely :)
if ($v=='') {
return $v;
}
switch($v{0}) {
case "\"":
case "'":
return substr($v,1,-1);
default:
return $v;
}
}
/**
* getAttributes = returns all the attributes key/value without quotes
*
*
* @return array
* @access string
*/
function getAttributes() {
$ret = array();
foreach($this->attributes as $k=>$v) {
if (substr(strtoupper($k),0,6) == 'FLEXY:') {
continue;
}
$ret[$k] = $this->getAttribute($k);
}
return $ret;
}
/**
* clearAttributes = removes an attribute from the object.
*
*
* @return array
* @access string
*/
function clearAttribute($string) {
if (isset($this->attributes[$string])) {
unset($this->attributes[$string]);
}
}
}

View file

@ -0,0 +1,54 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4: */
// +----------------------------------------------------------------------+
// | PHP Version 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: Text.php,v 1.12 2004/12/22 02:22:03 alan_k Exp $
//
/**
* Class that represents a text string node.
*
*
*/
class HTML_Template_Flexy_Token_Text extends HTML_Template_Flexy_Token {
/**
* Simple check to see if this piece of text is a word
* so that gettext and the merging tricks dont try
* - merge white space with a flexy tag
* - gettext doesnt translate &nbsp; etc.
*
* @return boolean true if this is a word
* @access public
*/
function isWord() {
if (!strlen(trim($this->value))) {
return false;
}
if (preg_match('/^\&[a-z0-9]+;$/i',trim($this->value))) {
return false;
}
return preg_match('/[a-z]/i',$this->value);
}
}

View file

@ -0,0 +1,53 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4: */
// +----------------------------------------------------------------------+
// | PHP Version 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: Var.php,v 1.7 2003/12/10 02:36:26 alan_k Exp $
//
/**
* Class to handle variable output
* *
*
*/
class HTML_Template_Flexy_Token_Var extends HTML_Template_Flexy_Token {
/**
* variable modifier (h = raw, u = urlencode, none = htmlspecialchars)
*
* @var char
* @access public
*/
var $modifier;
/**
* Setvalue - at present raw text.. - needs sorting out..
* @see parent::setValue()
*/
function setValue($value) {
// comes in as raw {xxxx}, {xxxx:h} or {xxx.yyyy:h}
if (strpos($value,":")) {
list($value,$this->modifier) = explode(':',$value);
}
$this->value = $value;
}
}