friendica/vendor/ezyang/htmlpurifier/library/HTMLPurifier/ChildDef.php

53 lines
1.5 KiB
PHP
Raw Normal View History

2010-09-08 23:14:17 -04:00
<?php
/**
2016-02-09 05:06:17 -05:00
* Defines allowed child nodes and validates nodes against it.
2010-09-08 23:14:17 -04:00
*/
abstract class HTMLPurifier_ChildDef
{
/**
* Type of child definition, usually right-most part of class name lowercase.
* Used occasionally in terms of context.
2016-02-09 05:06:17 -05:00
* @type string
2010-09-08 23:14:17 -04:00
*/
public $type;
/**
2016-02-09 05:06:17 -05:00
* Indicates whether or not an empty array of children is okay.
2010-09-08 23:14:17 -04:00
*
* This is necessary for redundant checking when changes affecting
* a child node may cause a parent node to now be disallowed.
2016-02-09 05:06:17 -05:00
* @type bool
2010-09-08 23:14:17 -04:00
*/
public $allow_empty;
/**
2016-02-09 05:06:17 -05:00
* Lookup array of all elements that this definition could possibly allow.
* @type array
2010-09-08 23:14:17 -04:00
*/
public $elements = array();
/**
* Get lookup of tag names that should not close this element automatically.
* All other elements will do so.
2016-02-09 05:06:17 -05:00
* @param HTMLPurifier_Config $config HTMLPurifier_Config object
* @return array
2010-09-08 23:14:17 -04:00
*/
2016-02-09 05:06:17 -05:00
public function getAllowedElements($config)
{
2010-09-08 23:14:17 -04:00
return $this->elements;
}
/**
* Validates nodes according to definition and returns modification.
*
2016-02-09 05:06:17 -05:00
* @param HTMLPurifier_Node[] $children Array of HTMLPurifier_Node
* @param HTMLPurifier_Config $config HTMLPurifier_Config object
* @param HTMLPurifier_Context $context HTMLPurifier_Context object
* @return bool|array true to leave nodes as is, false to remove parent node, array of replacement children
2010-09-08 23:14:17 -04:00
*/
2016-02-09 05:06:17 -05:00
abstract public function validateChildren($children, $config, $context);
2010-09-08 23:14:17 -04:00
}
// vim: et sw=4 sts=4