mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-23 05:09:56 +09:00
HTMLPurifier update
약간 커스텀 된 부분 모두 반영. File lock 부분과 htmlspecialchars 부분.
This commit is contained in:
parent
ae7cbf51c0
commit
2957f8cebe
242 changed files with 11737 additions and 5915 deletions
|
|
@ -5,17 +5,33 @@
|
|||
*/
|
||||
class HTMLPurifier_Token_Comment extends HTMLPurifier_Token
|
||||
{
|
||||
public $data; /**< Character data within comment. */
|
||||
/**
|
||||
* Character data within comment.
|
||||
* @type string
|
||||
*/
|
||||
public $data;
|
||||
|
||||
/**
|
||||
* @type bool
|
||||
*/
|
||||
public $is_whitespace = true;
|
||||
|
||||
/**
|
||||
* Transparent constructor.
|
||||
*
|
||||
* @param $data String comment data.
|
||||
* @param string $data String comment data.
|
||||
* @param int $line
|
||||
* @param int $col
|
||||
*/
|
||||
public function __construct($data, $line = null, $col = null) {
|
||||
public function __construct($data, $line = null, $col = null)
|
||||
{
|
||||
$this->data = $data;
|
||||
$this->line = $line;
|
||||
$this->col = $col;
|
||||
$this->col = $col;
|
||||
}
|
||||
|
||||
public function toNode() {
|
||||
return new HTMLPurifier_Node_Comment($this->data, $this->line, $this->col);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,11 @@
|
|||
*/
|
||||
class HTMLPurifier_Token_Empty extends HTMLPurifier_Token_Tag
|
||||
{
|
||||
|
||||
public function toNode() {
|
||||
$n = parent::toNode();
|
||||
$n->empty = true;
|
||||
return $n;
|
||||
}
|
||||
}
|
||||
|
||||
// vim: et sw=4 sts=4
|
||||
|
|
|
|||
|
|
@ -10,10 +10,15 @@
|
|||
class HTMLPurifier_Token_End extends HTMLPurifier_Token_Tag
|
||||
{
|
||||
/**
|
||||
* Token that started this node. Added by MakeWellFormed. Please
|
||||
* do not edit this!
|
||||
* Token that started this node.
|
||||
* Added by MakeWellFormed. Please do not edit this!
|
||||
* @type HTMLPurifier_Token
|
||||
*/
|
||||
public $start;
|
||||
|
||||
public function toNode() {
|
||||
throw new Exception("HTMLPurifier_Token_End->toNode not supported!");
|
||||
}
|
||||
}
|
||||
|
||||
// vim: et sw=4 sts=4
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@
|
|||
*/
|
||||
class HTMLPurifier_Token_Start extends HTMLPurifier_Token_Tag
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// vim: et sw=4 sts=4
|
||||
|
|
|
|||
|
|
@ -3,13 +3,14 @@
|
|||
/**
|
||||
* Abstract class of a tag token (start, end or empty), and its behavior.
|
||||
*/
|
||||
class HTMLPurifier_Token_Tag extends HTMLPurifier_Token
|
||||
abstract class HTMLPurifier_Token_Tag extends HTMLPurifier_Token
|
||||
{
|
||||
/**
|
||||
* Static bool marker that indicates the class is a tag.
|
||||
*
|
||||
* This allows us to check objects with <tt>!empty($obj->is_tag)</tt>
|
||||
* without having to use a function call <tt>is_a()</tt>.
|
||||
* @type bool
|
||||
*/
|
||||
public $is_tag = true;
|
||||
|
||||
|
|
@ -19,21 +20,27 @@ class HTMLPurifier_Token_Tag extends HTMLPurifier_Token
|
|||
* @note Strictly speaking, XML tags are case sensitive, so we shouldn't
|
||||
* be lower-casing them, but these tokens cater to HTML tags, which are
|
||||
* insensitive.
|
||||
* @type string
|
||||
*/
|
||||
public $name;
|
||||
|
||||
/**
|
||||
* Associative array of the tag's attributes.
|
||||
* @type array
|
||||
*/
|
||||
public $attr = array();
|
||||
|
||||
/**
|
||||
* Non-overloaded constructor, which lower-cases passed tag name.
|
||||
*
|
||||
* @param $name String name.
|
||||
* @param $attr Associative array of attributes.
|
||||
* @param string $name String name.
|
||||
* @param array $attr Associative array of attributes.
|
||||
* @param int $line
|
||||
* @param int $col
|
||||
* @param array $armor
|
||||
*/
|
||||
public function __construct($name, $attr = array(), $line = null, $col = null, $armor = array()) {
|
||||
public function __construct($name, $attr = array(), $line = null, $col = null, $armor = array())
|
||||
{
|
||||
$this->name = ctype_lower($name) ? $name : strtolower($name);
|
||||
foreach ($attr as $key => $value) {
|
||||
// normalization only necessary when key is not lowercase
|
||||
|
|
@ -49,9 +56,13 @@ class HTMLPurifier_Token_Tag extends HTMLPurifier_Token
|
|||
}
|
||||
$this->attr = $attr;
|
||||
$this->line = $line;
|
||||
$this->col = $col;
|
||||
$this->col = $col;
|
||||
$this->armor = $armor;
|
||||
}
|
||||
|
||||
public function toNode() {
|
||||
return new HTMLPurifier_Node_Element($this->name, $this->attr, $this->line, $this->col, $this->armor);
|
||||
}
|
||||
}
|
||||
|
||||
// vim: et sw=4 sts=4
|
||||
|
|
|
|||
|
|
@ -12,22 +12,42 @@
|
|||
class HTMLPurifier_Token_Text extends HTMLPurifier_Token
|
||||
{
|
||||
|
||||
public $name = '#PCDATA'; /**< PCDATA tag name compatible with DTD. */
|
||||
public $data; /**< Parsed character data of text. */
|
||||
public $is_whitespace; /**< Bool indicating if node is whitespace. */
|
||||
/**
|
||||
* @type string
|
||||
*/
|
||||
public $name = '#PCDATA';
|
||||
/**< PCDATA tag name compatible with DTD. */
|
||||
|
||||
/**
|
||||
* @type string
|
||||
*/
|
||||
public $data;
|
||||
/**< Parsed character data of text. */
|
||||
|
||||
/**
|
||||
* @type bool
|
||||
*/
|
||||
public $is_whitespace;
|
||||
|
||||
/**< Bool indicating if node is whitespace. */
|
||||
|
||||
/**
|
||||
* Constructor, accepts data and determines if it is whitespace.
|
||||
*
|
||||
* @param $data String parsed character data.
|
||||
* @param string $data String parsed character data.
|
||||
* @param int $line
|
||||
* @param int $col
|
||||
*/
|
||||
public function __construct($data, $line = null, $col = null) {
|
||||
public function __construct($data, $line = null, $col = null)
|
||||
{
|
||||
$this->data = $data;
|
||||
$this->is_whitespace = ctype_space($data);
|
||||
$this->line = $line;
|
||||
$this->col = $col;
|
||||
$this->col = $col;
|
||||
}
|
||||
|
||||
public function toNode() {
|
||||
return new HTMLPurifier_Node_Text($this->data, $this->is_whitespace, $this->line, $this->col);
|
||||
}
|
||||
}
|
||||
|
||||
// vim: et sw=4 sts=4
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue