本文整理匯總了PHP中HTMLPurifier::__construct方法的典型用法代碼示例。如果您正苦於以下問題:PHP HTMLPurifier::__construct方法的具體用法?PHP HTMLPurifier::__construct怎麽用?PHP HTMLPurifier::__construct使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類HTMLPurifier
的用法示例。
在下文中一共展示了HTMLPurifier::__construct方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1:
function __construct($opt)
{
// prepare config
$config = HTMLPurifier_Config::createDefault();
// set cache directory
$config->set('Cache.SerializerPath', $opt['html_purifier']['cache_path']);
// create parent object with config
parent::__construct($config);
}
示例2: __construct
public function __construct($opt)
{
// prepare config
/** @var HTMLPurifier_Config $config */
$config = HTMLPurifier_Config::createDefault();
// set cache directory
$config->set('Cache.SerializerPath', $opt['html_purifier']['cache_path']);
// adjust URI filtering to fix issue #89 (enable special chars in URIs)
$config->set('Core.EnableIDNA', true);
// allow comments
$config->set('HTML.AllowedCommentsRegexp', '/.*/');
// enable href target='_blank'
$config->set('Attr.AllowedFrameTargets', ['_blank', 'blank']);
// enable ids/names with namespace 'custom_'
$config->set('Attr.EnableID', true);
$config->set('Attr.IDPrefix', 'custom_');
// enable 'display' and 'visibility' styles for mystery descriptions
$config->set('CSS.AllowTricky', true);
// + display, visibility, overflow
$config->set('CSS.ForbiddenProperties', 'overflow');
// - overflow
// prepare additional definitions
$def = $config->getHTMLDefinition(true);
// add tags
$def->addElement('fieldset', 'Block', 'Flow', 'Common');
// HTML5 attribs currently not supported by TinyMCE
$def->addElement('legend', 'Inline', 'Flow', 'Common');
$def->addElement('q', 'Inline', 'Inline', 'Common', ['cite' => 'URI']);
$def->addElement('strike', 'Inline', 'Inline', 'Common');
// -> wird in CSS umgewandelt
$def->addElement('area', 'Inline', 'Empty', 'Common', ['alt' => 'CDATA', 'coords' => 'CDATA', 'href' => 'URI', 'shape' => 'Enum#default,rect,circle,poly', 'target' => 'Enum#_blank,blank']);
$def->addElement('map', 'Block', new HTMLPurifier_ChildDef_Optional('area'), 'Common', ['name' => 'ID']);
// add attributes
$def->addAttribute('img', 'usemap', 'CDATA');
// create parent object with config
parent::__construct($config);
}
示例3: __construct
public function __construct()
{
$config = HTMLPurifier_Config::createDefault();
$config->set('HTML.Allowed', $this->getHTMLAllowed());
parent::__construct($config);
}