![]() |
DOMbasic
1.0
DOMBasic es un Framework PHP para la creación de elementos DOM que generan contenido HTML dinámico y permite su modificación 'al vuelo' (Websites). Está escrito entéramente en PHP y sigue el paradigma POO.
|
Métodos públicos | |
__construct ($asocArrayAttribs=null) | |
setReadOnly ($readOnly) | |
getReadOnly () | |
reinicializar () | |
__get ($attrib) | |
__set ($attrib, $value) | |
__isset ($attrib) | |
__unset ($attrib) | |
offsetExists ($attrib) | |
offsetGet ($attrib) | |
offsetSet ($attrib, $value) | |
offsetUnset ($attrib) | |
getIterator () | |
setAttribs ($asocArrayAttribs) | |
getAttribs () | |
getAttribsStr () | |
addAttrib ($attrib, $valorAttrib) | |
addAttribs ($arrayAttribs) | |
removeAttrib ($attrib) | |
removeAttribs ($arrayAttribs) | |
clearAttribs () | |
countAttrs () | |
equals ($objAttribs) | |
__toString () | |
toJSON ($return=true, $base64values=true) | |
fromJSON ($arrJSON) | |
setEjemplo () | |
Métodos públicos estáticos | |
static | arrayFromURL ($strURLquery) |
static | filtrarStrJSON ($str="") |
static | writeLog ($mensaje, $trace) |
Campos de datos | |
const | N_C = __CLASS__ |
const | ENCODE_RFC_1738 ="RFC_1738" |
const | ENCODE_RFC_3986 ="RFC_3986" |
Métodos protegidos | |
tryingWrite ($arg="") | |
toURL ($encode=self::ENCODE_RFC_3986) | |
fromURL ($strURLquery) | |
Atributos protegidos | |
$_READ_ONLY =false | |
$AVISO_GET =false | |
$_attribs =array() | |
Interfaz para crear atributos de elementos DOM. Para que objetos derivados del DOM (como links, ...) implementen atributos HTML.
El programador debe asegurarse que son nombres estandarizados para los atributos de elementos DOM. (W3C)
TODO: FILTRADO: <del>Solo se admitiran nombres estandarizados para los atributos de elementos DOM. (W3C)</del>
Admite CONCATENACION DE METODOS mediante el retorno de la construccion '$this' en todos los metodos 'NO-GETTER': … $this->setAttrib('href','http://www.uno.com/')->removeAttrib('href');
…
__construct | ( | $asocArrayAttribs = null | ) |
El parametro sera un array asociativo de atributos con pares correctos 'clave=valor'.
El programador debe asegurarse que son nombres estandarizados para los atributos de elementos DOM.(W3C)
TODO: FILTRADO: <del>Solo se admitiran nombres estandarizados para los atributos de elementos DOM. (W3C)</del>
$asocArrayAttribs | Array de pares 'clave=valor' de atributos DOM. |
__get | ( | $attrib | ) |
Property get access. Simply returns a given attrib.
DOMAttribNotFoundException | If a the value for the property attrib is not an instance of |
string | $attrib | The name of the attrib to get. |
DOMBasicAttribNotFoundException | if the given property does not exist. |
DOMBasicAttribReadOnlyException | if the attrib to be set is a write-only property. |
__isset | ( | $attrib | ) |
Returns if an attrib exists. (Desde PHP 5.1.0 )
string | $attrib | Attrib name to check for. |
__set | ( | $attrib, | |
$value | |||
) |
Sets an attrib. This method is called when an attrib is set.
string | $attribName | The name of the attrib to set. |
mixed | $attribValue | The attrib value. |
DOMBasicAttribNotFoundException | if the given attrib does not exist. |
DOMBasicValueException | if the value to be assigned to a attrib is invalid. |
DOMBasicAttribReadOnlyException | if the attrib to be set is a read-only attrib. |
__unset | ( | $attrib | ) |
DOMBasicAttribReadOnlyException | If 'Read Only' ON. |
DOMBasicAttribNotFoundException | If $attrib is not a key in the $_attribs array. |
string | $attrib | The name of the attrib to unset. |
addAttrib | ( | $attrib, | |
$valorAttrib | |||
) |
El programador debe asegurarse que los atributos aportados son nombres estandarizados y valores validos para los atributos de elementos DOM.(W3C)
Retorna <del>el total de los atributos establecidos si no hay exceptcion.</del> $this
TODO: FILTRADO: <del>Solo se admitiran nombres estandarizados para los atributos de elementos DOM. (W3C)</del>
DOMBasicAttribNotFoundException | If $attrib is not a key in the $_attribs array. |
DOMBasicValueException | If the value for a attrib is out of range. |
string | $attrib | The name of the attrib to add. |
mixed | $valorAttrib | The value of the attrib to add. |
addAttribs | ( | $arrayAttribs | ) |
Añade atributos (si no existian previamente). El parametro sera un array asociativo de atributos con pares correctos 'clave=valor'.
Retorna <del>el total de los atributos establecidos.</del> $this
El programador debe asegurarse que son nombres estandarizados (y valores validos) para los atributos de elementos DOM.(W3C)
TODO: FILTRADO: <del>Solo se admitiran nombres estandarizados para los atributos de elementos DOM. (W3C)</del>
DOMBasicAttribNotFoundException | If $attrib is not a key in the $_attribs array. |
DOMBasicValueException | If the value for a attrib is out of range. |
array | $arrayAttribs | The array of the attribs to add. |
|
static |
Retorna un array de atributos con sus correspondientes valores extraidos de una cadena con el formato de las URL's.
El parametro es la cadena desde la que se extraeran los atributos y sus valores, esta cadena tendra el formato de las URL's (relativa o absoluta) donde debe incluirsele una 'queryString' (entre '?' y '#'), Igual a la generada por el metodo toURL().
$strURLquery | Cadena desde la que se extraeran los atributos y sus valores, esta cadena tendra el formato entregado en las URL's como parte de su 'queryString' (entre '?' y '#'). |
clearAttribs | ( | ) |
Suprime o elimina todos los atributos. Retorna <del>el numero de atributos que quedan.</del> $this
DOMBasicAttribNotFoundException | If $attrib is not a key in the $_attribs array. |
DOMBasicValueException | If the value for a attrib is out of range. |
countAttrs | ( | ) |
Retorna el total de los atribuos establecidos.
equals | ( | $objAttribs | ) |
Compara si otro objeto es igual a este (no si es el mismo); para esto se tienen que cumplir las siguientes normas:
DOM_attribs | $objAttribs | Algun objeto instancia de esta Clase |
|
static |
Limpia una cadena de RETORNOS DE CARRO, AVANCES DE LINEA y TABULACIONES, preparandola asi para datos JSON
|
protected |
Establece y retorna un array de atributos con sus correspondientes valores extraidos de una cadena con el formato de las URL's, para construir Atributos de este Objeto.
El parametro es la cadena desde la que se extraeran los atributos y sus valores, esta cadena tendra el formato de las URL's (relativa o absoluta) donde debe incluirsele una 'queryString' (entre '?' y '#'), Igual a la generada por el metodo toURL().
$strURLquery | Cadena desde la que se extraeran los atributos y sus valores, esta cadena tendra el formato entregado en las URL's como parte de su 'queryString' (entre '?' y '#'). |
getAttribs | ( | ) |
Retorna todos los atributos establecidos como un array asociativo 'clave=valor'.
getAttribsStr | ( | ) |
Retorna todos los atributos establecidos como una cadena con los pares 'clave=valor' separados por espacios.
Si el atributo comienza con la palabra reservada '_null' entonces solo imprimira el valor entrecomillado, por el contrario si el valor es 'nulo' entonces solo imprimira la clave (sin comillas).
Este metodo esta pensado para poder retornar atributos de etiquetas XHTML (y XML), donde existen casos de atributos sin valor y otros de atributos sin clave (por ej. en la etiqueta 'DOCTYPE')
Es sinonimo de '__toString()'.
OJO !!: Que sea sinonimo no significa que pueda llamarse dentro de esta funcion a '__toString()' ya que crearia una REFERENCIA CIRCULAR!..
;
|
abstract |
Comprueba si los atributos de este elemento son DE SOLO LECTURA O ESCRIBIBLES.
offsetExists | ( | $attrib | ) |
Returns if an attrib exists. Allows isset() using ArrayAccess.
string | $attrib | The name of the attrib to get. |
offsetGet | ( | $attrib | ) |
Returns an attrib value. Get an attrib value by ArrayAccess.
DOMBasicAttribNotFoundException | If $attrib is not a key in the $_attribs array. |
string | $attrib | The name of the attrib to get. |
offsetSet | ( | $attrib, | |
$value | |||
) |
Set an attrib. Sets an attrib using ArrayAccess.
DOMBasicAttribNotFoundException | If $attrib is not a key in the $_attribs array. |
DOMBasicValueException | If the value for a attrib is out of range. |
string | $attrib | The name of the attrib to set. |
mixed | $attrib | The value for the attrib. |
offsetUnset | ( | $attrib | ) |
Unset an attrib. Unsets an attrib using ArrayAccess.
DOMBasicAttribNotFoundException | If $attrib is not a key in the $_attribs array. |
DOMBasicValueException | If the value for a attrib is out of range. |
string | $attrib | The name of the option to unset. |
|
abstract |
Pone a cero los elementos de arrays de este Objeto.
removeAttrib | ( | $attrib | ) |
Suprime o elimina el atributo indicado (si es que existe). Retorna <del>el numero de atributos que quedan.</del> $this
DOMBasicAttribNotFoundException | If $attrib is not a key in the $_attribs array. |
DOMBasicValueException | If the value for a attrib is out of range. |
string | $attrib | The name of the attrib to remove. |
removeAttribs | ( | $arrayAttribs | ) |
Suprime o elimina todos los atributos indicados (si es que existen). Retorna <del>el numero de atributos que quedan.</del> $this
DOMBasicAttribNotFoundException | If $attrib is not a key in the $_attribs array. |
DOMBasicValueException | If the value for a attrib is out of range. |
array | string $arrayAttribs Array with the attribs's name to remove. |
setAttribs | ( | $asocArrayAttribs | ) |
El parametro sera un array asociativo de atributos con pares correctos 'clave=valor'.
El programador debe asegurarse que son nombres estandarizados para los atributos de elementos DOM.(W3C)
TODO: FILTRADO: <del>Solo se admitiran nombres estandarizados para los atributos de elementos DOM.(W3C)</del>
DOMBasicAttribNotFoundException | If $attrib is not a key in the $_attribs array. |
DOMBasicValueException | If the value for a attrib is out of range. |
array | $asocArrayAttribs | The array of the attribs to set. |
|
abstract |
Establece si los atributos de este elemento son DE SOLO LECTURA O ESCRIBIBLES.
boolean |
toJSON | ( | $return = true , |
|
$base64values = true |
|||
) |
Metodo para retornar la cadena JSON que representa estos atributos en la forma '{"clave1":"valor1", "clave2":"valor2"}'.
Aporta un segundo parametro para codificar todos los valores (no las claves) en 'base64', (DEFECTO=true), asi podriamos evitar el problema de los tipos de codificacion empleados (JSON solo admite UTF-8).
NO UTILIZA LA FUNCION PHP 'json_encode(..)'
<del>Utiliza las siguientes constantes PHP 5.3: JSON_HEX_QUOT && JSON_HEX_TAG && JSON_HEX_AMP && JSON_HEX_APOS</del>
boolean | $return | Indica si retornar el resultado (TRUE) o imprimirlo (FALSE). |
boolean | $base64values | Indica si codificar los textos en 'base64' o no. |
|
protected |
Retorna una cadena con el formato de las URL's, construida con los Atributos de este Objeto.
Contiene un parametro $encode indicando el tipo de codificacion a aplicar: 'RFC_1738' (espacios=+) o 'RFC_3986' (espacions=%20), las cuales estan implementadas como cadenas staticas de esta clase.
$encode | Cadena indicando el tipo de codificacion (alguna de las dos constantes de esta clase RFC_1738 o RFC_3986). |
|
protected |
Notifica una accion de escritura al objeto. Si es de solo-lectura lanzara una Excepcion.
DOMBasicAttribReadOnlyException; |
|
protected |
¿ Lanzar Aviso cuando se lee un atributo que no existe ?