mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-14 08:49:56 +09:00
merge from 1.6 ( html purifier lib )
git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@10579 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
8943ff97f3
commit
7ea7157ce7
813 changed files with 65203 additions and 0 deletions
|
|
@ -0,0 +1,60 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Records errors for particular segments of an HTML document such as tokens,
|
||||
* attributes or CSS properties. They can contain error structs (which apply
|
||||
* to components of what they represent), but their main purpose is to hold
|
||||
* errors applying to whatever struct is being used.
|
||||
*/
|
||||
class HTMLPurifier_ErrorStruct
|
||||
{
|
||||
|
||||
/**
|
||||
* Possible values for $children first-key. Note that top-level structures
|
||||
* are automatically token-level.
|
||||
*/
|
||||
const TOKEN = 0;
|
||||
const ATTR = 1;
|
||||
const CSSPROP = 2;
|
||||
|
||||
/**
|
||||
* Type of this struct.
|
||||
*/
|
||||
public $type;
|
||||
|
||||
/**
|
||||
* Value of the struct we are recording errors for. There are various
|
||||
* values for this:
|
||||
* - TOKEN: Instance of HTMLPurifier_Token
|
||||
* - ATTR: array('attr-name', 'value')
|
||||
* - CSSPROP: array('prop-name', 'value')
|
||||
*/
|
||||
public $value;
|
||||
|
||||
/**
|
||||
* Errors registered for this structure.
|
||||
*/
|
||||
public $errors = array();
|
||||
|
||||
/**
|
||||
* Child ErrorStructs that are from this structure. For example, a TOKEN
|
||||
* ErrorStruct would contain ATTR ErrorStructs. This is a multi-dimensional
|
||||
* array in structure: [TYPE]['identifier']
|
||||
*/
|
||||
public $children = array();
|
||||
|
||||
public function getChild($type, $id) {
|
||||
if (!isset($this->children[$type][$id])) {
|
||||
$this->children[$type][$id] = new HTMLPurifier_ErrorStruct();
|
||||
$this->children[$type][$id]->type = $type;
|
||||
}
|
||||
return $this->children[$type][$id];
|
||||
}
|
||||
|
||||
public function addError($severity, $message) {
|
||||
$this->errors[] = array($severity, $message);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// vim: et sw=4 sts=4
|
||||
Loading…
Add table
Add a link
Reference in a new issue