-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #253 from seamuslee001/dev_core_976_5_13
dev/core#976 Move htmlpurfier back to within IDS to prevent issues wi…
- Loading branch information
Showing
376 changed files
with
32,224 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
/** | ||
* This is a stub include that automatically configures the include path. | ||
*/ | ||
|
||
set_include_path(dirname(__FILE__) . PATH_SEPARATOR . get_include_path() ); | ||
require_once 'HTMLPurifier/Bootstrap.php'; | ||
require_once 'HTMLPurifier.autoload.php'; | ||
|
||
// vim: et sw=4 sts=4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
/** | ||
* @file | ||
* Legacy autoloader for systems lacking spl_autoload_register | ||
* | ||
* Must be separate to prevent deprecation warning on PHP 7.2 | ||
*/ | ||
|
||
function __autoload($class) | ||
{ | ||
return HTMLPurifier_Bootstrap::autoload($class); | ||
} | ||
|
||
// vim: et sw=4 sts=4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
/** | ||
* @file | ||
* Convenience file that registers autoload handler for HTML Purifier. | ||
* It also does some sanity checks. | ||
*/ | ||
|
||
if (function_exists('spl_autoload_register') && function_exists('spl_autoload_unregister')) { | ||
// We need unregister for our pre-registering functionality | ||
HTMLPurifier_Bootstrap::registerAutoload(); | ||
if (function_exists('__autoload')) { | ||
// Be polite and ensure that userland autoload gets retained | ||
spl_autoload_register('__autoload'); | ||
} | ||
} elseif (!function_exists('__autoload')) { | ||
require dirname(__FILE__) . '/HTMLPurifier.autoload-legacy.php'; | ||
} | ||
|
||
if (ini_get('zend.ze1_compatibility_mode')) { | ||
trigger_error("HTML Purifier is not compatible with zend.ze1_compatibility_mode; please turn it off", E_USER_ERROR); | ||
} | ||
|
||
// vim: et sw=4 sts=4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?php | ||
if (!defined('HTMLPURIFIER_PREFIX')) { | ||
define('HTMLPURIFIER_PREFIX', dirname(__FILE__)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
/** | ||
* @file | ||
* Defines a function wrapper for HTML Purifier for quick use. | ||
* @note ''HTMLPurifier()'' is NOT the same as ''new HTMLPurifier()'' | ||
*/ | ||
|
||
/** | ||
* Purify HTML. | ||
* @param string $html String HTML to purify | ||
* @param mixed $config Configuration to use, can be any value accepted by | ||
* HTMLPurifier_Config::create() | ||
* @return string | ||
*/ | ||
function HTMLPurifier($html, $config = null) | ||
{ | ||
static $purifier = false; | ||
if (!$purifier) { | ||
$purifier = new HTMLPurifier(); | ||
} | ||
return $purifier->purify($html, $config); | ||
} | ||
|
||
// vim: et sw=4 sts=4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,234 @@ | ||
<?php | ||
|
||
/** | ||
* @file | ||
* This file was auto-generated by generate-includes.php and includes all of | ||
* the core files required by HTML Purifier. Use this if performance is a | ||
* primary concern and you are using an opcode cache. PLEASE DO NOT EDIT THIS | ||
* FILE, changes will be overwritten the next time the script is run. | ||
* | ||
* @version 4.10.0 | ||
* | ||
* @warning | ||
* You must *not* include any other HTML Purifier files before this file, | ||
* because 'require' not 'require_once' is used. | ||
* | ||
* @warning | ||
* This file requires that the include path contains the HTML Purifier | ||
* library directory; this is not auto-set. | ||
*/ | ||
|
||
require 'HTMLPurifier.php'; | ||
require 'HTMLPurifier/Arborize.php'; | ||
require 'HTMLPurifier/AttrCollections.php'; | ||
require 'HTMLPurifier/AttrDef.php'; | ||
require 'HTMLPurifier/AttrTransform.php'; | ||
require 'HTMLPurifier/AttrTypes.php'; | ||
require 'HTMLPurifier/AttrValidator.php'; | ||
require 'HTMLPurifier/Bootstrap.php'; | ||
require 'HTMLPurifier/Definition.php'; | ||
require 'HTMLPurifier/CSSDefinition.php'; | ||
require 'HTMLPurifier/ChildDef.php'; | ||
require 'HTMLPurifier/Config.php'; | ||
require 'HTMLPurifier/ConfigSchema.php'; | ||
require 'HTMLPurifier/ContentSets.php'; | ||
require 'HTMLPurifier/Context.php'; | ||
require 'HTMLPurifier/DefinitionCache.php'; | ||
require 'HTMLPurifier/DefinitionCacheFactory.php'; | ||
require 'HTMLPurifier/Doctype.php'; | ||
require 'HTMLPurifier/DoctypeRegistry.php'; | ||
require 'HTMLPurifier/ElementDef.php'; | ||
require 'HTMLPurifier/Encoder.php'; | ||
require 'HTMLPurifier/EntityLookup.php'; | ||
require 'HTMLPurifier/EntityParser.php'; | ||
require 'HTMLPurifier/ErrorCollector.php'; | ||
require 'HTMLPurifier/ErrorStruct.php'; | ||
require 'HTMLPurifier/Exception.php'; | ||
require 'HTMLPurifier/Filter.php'; | ||
require 'HTMLPurifier/Generator.php'; | ||
require 'HTMLPurifier/HTMLDefinition.php'; | ||
require 'HTMLPurifier/HTMLModule.php'; | ||
require 'HTMLPurifier/HTMLModuleManager.php'; | ||
require 'HTMLPurifier/IDAccumulator.php'; | ||
require 'HTMLPurifier/Injector.php'; | ||
require 'HTMLPurifier/Language.php'; | ||
require 'HTMLPurifier/LanguageFactory.php'; | ||
require 'HTMLPurifier/Length.php'; | ||
require 'HTMLPurifier/Lexer.php'; | ||
require 'HTMLPurifier/Node.php'; | ||
require 'HTMLPurifier/PercentEncoder.php'; | ||
require 'HTMLPurifier/PropertyList.php'; | ||
require 'HTMLPurifier/PropertyListIterator.php'; | ||
require 'HTMLPurifier/Queue.php'; | ||
require 'HTMLPurifier/Strategy.php'; | ||
require 'HTMLPurifier/StringHash.php'; | ||
require 'HTMLPurifier/StringHashParser.php'; | ||
require 'HTMLPurifier/TagTransform.php'; | ||
require 'HTMLPurifier/Token.php'; | ||
require 'HTMLPurifier/TokenFactory.php'; | ||
require 'HTMLPurifier/URI.php'; | ||
require 'HTMLPurifier/URIDefinition.php'; | ||
require 'HTMLPurifier/URIFilter.php'; | ||
require 'HTMLPurifier/URIParser.php'; | ||
require 'HTMLPurifier/URIScheme.php'; | ||
require 'HTMLPurifier/URISchemeRegistry.php'; | ||
require 'HTMLPurifier/UnitConverter.php'; | ||
require 'HTMLPurifier/VarParser.php'; | ||
require 'HTMLPurifier/VarParserException.php'; | ||
require 'HTMLPurifier/Zipper.php'; | ||
require 'HTMLPurifier/AttrDef/CSS.php'; | ||
require 'HTMLPurifier/AttrDef/Clone.php'; | ||
require 'HTMLPurifier/AttrDef/Enum.php'; | ||
require 'HTMLPurifier/AttrDef/Integer.php'; | ||
require 'HTMLPurifier/AttrDef/Lang.php'; | ||
require 'HTMLPurifier/AttrDef/Switch.php'; | ||
require 'HTMLPurifier/AttrDef/Text.php'; | ||
require 'HTMLPurifier/AttrDef/URI.php'; | ||
require 'HTMLPurifier/AttrDef/CSS/Number.php'; | ||
require 'HTMLPurifier/AttrDef/CSS/AlphaValue.php'; | ||
require 'HTMLPurifier/AttrDef/CSS/Background.php'; | ||
require 'HTMLPurifier/AttrDef/CSS/BackgroundPosition.php'; | ||
require 'HTMLPurifier/AttrDef/CSS/Border.php'; | ||
require 'HTMLPurifier/AttrDef/CSS/Color.php'; | ||
require 'HTMLPurifier/AttrDef/CSS/Composite.php'; | ||
require 'HTMLPurifier/AttrDef/CSS/DenyElementDecorator.php'; | ||
require 'HTMLPurifier/AttrDef/CSS/Filter.php'; | ||
require 'HTMLPurifier/AttrDef/CSS/Font.php'; | ||
require 'HTMLPurifier/AttrDef/CSS/FontFamily.php'; | ||
require 'HTMLPurifier/AttrDef/CSS/Ident.php'; | ||
require 'HTMLPurifier/AttrDef/CSS/ImportantDecorator.php'; | ||
require 'HTMLPurifier/AttrDef/CSS/Length.php'; | ||
require 'HTMLPurifier/AttrDef/CSS/ListStyle.php'; | ||
require 'HTMLPurifier/AttrDef/CSS/Multiple.php'; | ||
require 'HTMLPurifier/AttrDef/CSS/Percentage.php'; | ||
require 'HTMLPurifier/AttrDef/CSS/TextDecoration.php'; | ||
require 'HTMLPurifier/AttrDef/CSS/URI.php'; | ||
require 'HTMLPurifier/AttrDef/HTML/Bool.php'; | ||
require 'HTMLPurifier/AttrDef/HTML/Nmtokens.php'; | ||
require 'HTMLPurifier/AttrDef/HTML/Class.php'; | ||
require 'HTMLPurifier/AttrDef/HTML/Color.php'; | ||
require 'HTMLPurifier/AttrDef/HTML/FrameTarget.php'; | ||
require 'HTMLPurifier/AttrDef/HTML/ID.php'; | ||
require 'HTMLPurifier/AttrDef/HTML/Pixels.php'; | ||
require 'HTMLPurifier/AttrDef/HTML/Length.php'; | ||
require 'HTMLPurifier/AttrDef/HTML/LinkTypes.php'; | ||
require 'HTMLPurifier/AttrDef/HTML/MultiLength.php'; | ||
require 'HTMLPurifier/AttrDef/URI/Email.php'; | ||
require 'HTMLPurifier/AttrDef/URI/Host.php'; | ||
require 'HTMLPurifier/AttrDef/URI/IPv4.php'; | ||
require 'HTMLPurifier/AttrDef/URI/IPv6.php'; | ||
require 'HTMLPurifier/AttrDef/URI/Email/SimpleCheck.php'; | ||
require 'HTMLPurifier/AttrTransform/Background.php'; | ||
require 'HTMLPurifier/AttrTransform/BdoDir.php'; | ||
require 'HTMLPurifier/AttrTransform/BgColor.php'; | ||
require 'HTMLPurifier/AttrTransform/BoolToCSS.php'; | ||
require 'HTMLPurifier/AttrTransform/Border.php'; | ||
require 'HTMLPurifier/AttrTransform/EnumToCSS.php'; | ||
require 'HTMLPurifier/AttrTransform/ImgRequired.php'; | ||
require 'HTMLPurifier/AttrTransform/ImgSpace.php'; | ||
require 'HTMLPurifier/AttrTransform/Input.php'; | ||
require 'HTMLPurifier/AttrTransform/Lang.php'; | ||
require 'HTMLPurifier/AttrTransform/Length.php'; | ||
require 'HTMLPurifier/AttrTransform/Name.php'; | ||
require 'HTMLPurifier/AttrTransform/NameSync.php'; | ||
require 'HTMLPurifier/AttrTransform/Nofollow.php'; | ||
require 'HTMLPurifier/AttrTransform/SafeEmbed.php'; | ||
require 'HTMLPurifier/AttrTransform/SafeObject.php'; | ||
require 'HTMLPurifier/AttrTransform/SafeParam.php'; | ||
require 'HTMLPurifier/AttrTransform/ScriptRequired.php'; | ||
require 'HTMLPurifier/AttrTransform/TargetBlank.php'; | ||
require 'HTMLPurifier/AttrTransform/TargetNoopener.php'; | ||
require 'HTMLPurifier/AttrTransform/TargetNoreferrer.php'; | ||
require 'HTMLPurifier/AttrTransform/Textarea.php'; | ||
require 'HTMLPurifier/ChildDef/Chameleon.php'; | ||
require 'HTMLPurifier/ChildDef/Custom.php'; | ||
require 'HTMLPurifier/ChildDef/Empty.php'; | ||
require 'HTMLPurifier/ChildDef/List.php'; | ||
require 'HTMLPurifier/ChildDef/Required.php'; | ||
require 'HTMLPurifier/ChildDef/Optional.php'; | ||
require 'HTMLPurifier/ChildDef/StrictBlockquote.php'; | ||
require 'HTMLPurifier/ChildDef/Table.php'; | ||
require 'HTMLPurifier/DefinitionCache/Decorator.php'; | ||
require 'HTMLPurifier/DefinitionCache/Null.php'; | ||
require 'HTMLPurifier/DefinitionCache/Serializer.php'; | ||
require 'HTMLPurifier/DefinitionCache/Decorator/Cleanup.php'; | ||
require 'HTMLPurifier/DefinitionCache/Decorator/Memory.php'; | ||
require 'HTMLPurifier/HTMLModule/Bdo.php'; | ||
require 'HTMLPurifier/HTMLModule/CommonAttributes.php'; | ||
require 'HTMLPurifier/HTMLModule/Edit.php'; | ||
require 'HTMLPurifier/HTMLModule/Forms.php'; | ||
require 'HTMLPurifier/HTMLModule/Hypertext.php'; | ||
require 'HTMLPurifier/HTMLModule/Iframe.php'; | ||
require 'HTMLPurifier/HTMLModule/Image.php'; | ||
require 'HTMLPurifier/HTMLModule/Legacy.php'; | ||
require 'HTMLPurifier/HTMLModule/List.php'; | ||
require 'HTMLPurifier/HTMLModule/Name.php'; | ||
require 'HTMLPurifier/HTMLModule/Nofollow.php'; | ||
require 'HTMLPurifier/HTMLModule/NonXMLCommonAttributes.php'; | ||
require 'HTMLPurifier/HTMLModule/Object.php'; | ||
require 'HTMLPurifier/HTMLModule/Presentation.php'; | ||
require 'HTMLPurifier/HTMLModule/Proprietary.php'; | ||
require 'HTMLPurifier/HTMLModule/Ruby.php'; | ||
require 'HTMLPurifier/HTMLModule/SafeEmbed.php'; | ||
require 'HTMLPurifier/HTMLModule/SafeObject.php'; | ||
require 'HTMLPurifier/HTMLModule/SafeScripting.php'; | ||
require 'HTMLPurifier/HTMLModule/Scripting.php'; | ||
require 'HTMLPurifier/HTMLModule/StyleAttribute.php'; | ||
require 'HTMLPurifier/HTMLModule/Tables.php'; | ||
require 'HTMLPurifier/HTMLModule/Target.php'; | ||
require 'HTMLPurifier/HTMLModule/TargetBlank.php'; | ||
require 'HTMLPurifier/HTMLModule/TargetNoopener.php'; | ||
require 'HTMLPurifier/HTMLModule/TargetNoreferrer.php'; | ||
require 'HTMLPurifier/HTMLModule/Text.php'; | ||
require 'HTMLPurifier/HTMLModule/Tidy.php'; | ||
require 'HTMLPurifier/HTMLModule/XMLCommonAttributes.php'; | ||
require 'HTMLPurifier/HTMLModule/Tidy/Name.php'; | ||
require 'HTMLPurifier/HTMLModule/Tidy/Proprietary.php'; | ||
require 'HTMLPurifier/HTMLModule/Tidy/XHTMLAndHTML4.php'; | ||
require 'HTMLPurifier/HTMLModule/Tidy/Strict.php'; | ||
require 'HTMLPurifier/HTMLModule/Tidy/Transitional.php'; | ||
require 'HTMLPurifier/HTMLModule/Tidy/XHTML.php'; | ||
require 'HTMLPurifier/Injector/AutoParagraph.php'; | ||
require 'HTMLPurifier/Injector/DisplayLinkURI.php'; | ||
require 'HTMLPurifier/Injector/Linkify.php'; | ||
require 'HTMLPurifier/Injector/PurifierLinkify.php'; | ||
require 'HTMLPurifier/Injector/RemoveEmpty.php'; | ||
require 'HTMLPurifier/Injector/RemoveSpansWithoutAttributes.php'; | ||
require 'HTMLPurifier/Injector/SafeObject.php'; | ||
require 'HTMLPurifier/Lexer/DOMLex.php'; | ||
require 'HTMLPurifier/Lexer/DirectLex.php'; | ||
require 'HTMLPurifier/Node/Comment.php'; | ||
require 'HTMLPurifier/Node/Element.php'; | ||
require 'HTMLPurifier/Node/Text.php'; | ||
require 'HTMLPurifier/Strategy/Composite.php'; | ||
require 'HTMLPurifier/Strategy/Core.php'; | ||
require 'HTMLPurifier/Strategy/FixNesting.php'; | ||
require 'HTMLPurifier/Strategy/MakeWellFormed.php'; | ||
require 'HTMLPurifier/Strategy/RemoveForeignElements.php'; | ||
require 'HTMLPurifier/Strategy/ValidateAttributes.php'; | ||
require 'HTMLPurifier/TagTransform/Font.php'; | ||
require 'HTMLPurifier/TagTransform/Simple.php'; | ||
require 'HTMLPurifier/Token/Comment.php'; | ||
require 'HTMLPurifier/Token/Tag.php'; | ||
require 'HTMLPurifier/Token/Empty.php'; | ||
require 'HTMLPurifier/Token/End.php'; | ||
require 'HTMLPurifier/Token/Start.php'; | ||
require 'HTMLPurifier/Token/Text.php'; | ||
require 'HTMLPurifier/URIFilter/DisableExternal.php'; | ||
require 'HTMLPurifier/URIFilter/DisableExternalResources.php'; | ||
require 'HTMLPurifier/URIFilter/DisableResources.php'; | ||
require 'HTMLPurifier/URIFilter/HostBlacklist.php'; | ||
require 'HTMLPurifier/URIFilter/MakeAbsolute.php'; | ||
require 'HTMLPurifier/URIFilter/Munge.php'; | ||
require 'HTMLPurifier/URIFilter/SafeIframe.php'; | ||
require 'HTMLPurifier/URIScheme/data.php'; | ||
require 'HTMLPurifier/URIScheme/file.php'; | ||
require 'HTMLPurifier/URIScheme/ftp.php'; | ||
require 'HTMLPurifier/URIScheme/http.php'; | ||
require 'HTMLPurifier/URIScheme/https.php'; | ||
require 'HTMLPurifier/URIScheme/mailto.php'; | ||
require 'HTMLPurifier/URIScheme/news.php'; | ||
require 'HTMLPurifier/URIScheme/nntp.php'; | ||
require 'HTMLPurifier/URIScheme/tel.php'; | ||
require 'HTMLPurifier/VarParser/Flexible.php'; | ||
require 'HTMLPurifier/VarParser/Native.php'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
/** | ||
* @file | ||
* Emulation layer for code that used kses(), substituting in HTML Purifier. | ||
*/ | ||
|
||
require_once dirname(__FILE__) . '/HTMLPurifier.auto.php'; | ||
|
||
function kses($string, $allowed_html, $allowed_protocols = null) | ||
{ | ||
$config = HTMLPurifier_Config::createDefault(); | ||
$allowed_elements = array(); | ||
$allowed_attributes = array(); | ||
foreach ($allowed_html as $element => $attributes) { | ||
$allowed_elements[$element] = true; | ||
foreach ($attributes as $attribute => $x) { | ||
$allowed_attributes["$element.$attribute"] = true; | ||
} | ||
} | ||
$config->set('HTML.AllowedElements', $allowed_elements); | ||
$config->set('HTML.AllowedAttributes', $allowed_attributes); | ||
if ($allowed_protocols !== null) { | ||
$config->set('URI.AllowedSchemes', $allowed_protocols); | ||
} | ||
$purifier = new HTMLPurifier($config); | ||
return $purifier->purify($string); | ||
} | ||
|
||
// vim: et sw=4 sts=4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
/** | ||
* @file | ||
* Convenience stub file that adds HTML Purifier's library file to the path | ||
* without any other side-effects. | ||
*/ | ||
|
||
set_include_path(dirname(__FILE__) . PATH_SEPARATOR . get_include_path() ); | ||
|
||
// vim: et sw=4 sts=4 |
Oops, something went wrong.