ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
HTMLPurifier_AttrTypes Class Reference

Provides lookup array of attribute types to HTMLPurifier_AttrDef objects. More...

+ Collaboration diagram for HTMLPurifier_AttrTypes:

Public Member Functions

 __construct ()
 Constructs the info array, supplying default implementations for attribute types.
 get ($type)
 Retrieves a type.
 set ($type, $impl)
 Sets a new implementation for a type.

Protected Attributes

 $info = array()
 Lookup array of attribute string identifiers to concrete implementations.

Detailed Description

Provides lookup array of attribute types to HTMLPurifier_AttrDef objects.

Definition at line 6 of file AttrTypes.php.

Constructor & Destructor Documentation

HTMLPurifier_AttrTypes::__construct ( )

Constructs the info array, supplying default implementations for attribute types.

Definition at line 17 of file AttrTypes.php.

{
// pseudo-types, must be instantiated via shorthand
$this->info['Enum'] = new HTMLPurifier_AttrDef_Enum();
$this->info['Bool'] = new HTMLPurifier_AttrDef_HTML_Bool();
$this->info['CDATA'] = new HTMLPurifier_AttrDef_Text();
$this->info['ID'] = new HTMLPurifier_AttrDef_HTML_ID();
$this->info['Length'] = new HTMLPurifier_AttrDef_HTML_Length();
$this->info['MultiLength'] = new HTMLPurifier_AttrDef_HTML_MultiLength();
$this->info['NMTOKENS'] = new HTMLPurifier_AttrDef_HTML_Nmtokens();
$this->info['Pixels'] = new HTMLPurifier_AttrDef_HTML_Pixels();
$this->info['Text'] = new HTMLPurifier_AttrDef_Text();
$this->info['URI'] = new HTMLPurifier_AttrDef_URI();
$this->info['LanguageCode'] = new HTMLPurifier_AttrDef_Lang();
$this->info['Color'] = new HTMLPurifier_AttrDef_HTML_Color();
// unimplemented aliases
$this->info['ContentType'] = new HTMLPurifier_AttrDef_Text();
$this->info['ContentTypes'] = new HTMLPurifier_AttrDef_Text();
$this->info['Charsets'] = new HTMLPurifier_AttrDef_Text();
$this->info['Character'] = new HTMLPurifier_AttrDef_Text();
// "proprietary" types
$this->info['Class'] = new HTMLPurifier_AttrDef_HTML_Class();
// number is really a positive integer (one or more digits)
// FIXME: ^^ not always, see start and value of list items
$this->info['Number'] = new HTMLPurifier_AttrDef_Integer(false, false, true);
}

Member Function Documentation

HTMLPurifier_AttrTypes::get (   $type)

Retrieves a type.

Parameters
$typeString type name
Returns
Object AttrDef for type

Definition at line 52 of file AttrTypes.php.

References $type.

{
// determine if there is any extra info tacked on
if (strpos($type, '#') !== false) list($type, $string) = explode('#', $type, 2);
else $string = '';
if (!isset($this->info[$type])) {
trigger_error('Cannot retrieve undefined attribute type ' . $type, E_USER_ERROR);
return;
}
return $this->info[$type]->make($string);
}
HTMLPurifier_AttrTypes::set (   $type,
  $impl 
)

Sets a new implementation for a type.

Parameters
$typeString type name
$implObject AttrDef for type

Definition at line 72 of file AttrTypes.php.

References $type.

{
$this->info[$type] = $impl;
}

Field Documentation

HTMLPurifier_AttrTypes::$info = array()
protected

Lookup array of attribute string identifiers to concrete implementations.

Definition at line 11 of file AttrTypes.php.


The documentation for this class was generated from the following file: