|
Re: Trying to allow param 'flashvars' in object/embed October 11, 2008 10:43PM |
Admin Registered: 6 years ago Posts: 2,652 |
Ok, I'm reposting the patch here. The patch looks really good! A cursory review follows below, inline with the patch:
From 4773d3d19dbfe1a456eaea31b6c2703f7883f276 Mon Sep 17 00:00:00 2001 From: Michael Jugan <mjugan@tds.net> Date: Mon, 6 Oct 2008 20:51:55 -0400 Subject: [PATCH] i This adds StandardFlash class. The last time I wrote a long description and this GIT thing crashed, so I am just going to say that this changes object and embed tags to pre-set format Signed-off-by: Michael Jugan <mjugan@tds.net> ESC wq ENTER --- library/HTMLPurifier.includes.php | 4 +- library/HTMLPurifier.safe-includes.php | 4 +- library/HTMLPurifier/ConfigSchema/schema.ser | 2 +- .../ConfigSchema/schema/HTML.StandardFlash.txt | 8 + library/HTMLPurifier/Generator.php | 9 + library/HTMLPurifier/HTMLModule/StandardFlash.php | 28 ++ library/HTMLPurifier/HTMLModule/_notes/dwsync.xml | 4 + library/HTMLPurifier/HTMLModuleManager.php | 4 + library/HTMLPurifier/Injector.php | 85 ++++- library/HTMLPurifier/Injector/AutoParagraph.php | 73 +---- library/HTMLPurifier/Injector/SafeObject.php | 5 +- library/HTMLPurifier/Injector/StandardFlash.php | 103 +++++ library/HTMLPurifier/Injector/_notes/dwsync.xml | 4 + library/HTMLPurifier/Strategy/MakeWellFormed.php | 422 +++++++++++--------- library/HTMLPurifier/Token.php | 7 + library/HTMLPurifier/Token/Span.php | 33 ++ library/HTMLPurifier/Token/_notes/dwsync.xml | 4 + library/HTMLPurifier/TokenFactory.php | 9 +- library/HTMLPurifier/_notes/dwsync.xml | 6 +
It looks like you've edited too many files here; HTMLModuleManager, Injector, AutoParagraph, SafeObject and MakeWellFormed should not have been modified. Also, there's some odd dwsync.xml files in the diff.
19 files changed, 545 insertions(+), 269 deletions(-) create mode 100644 library/HTMLPurifier/ConfigSchema/schema/HTML.StandardFlash.txt create mode 100644 library/HTMLPurifier/HTMLModule/StandardFlash.php create mode 100644 library/HTMLPurifier/HTMLModule/_notes/dwsync.xml create mode 100644 library/HTMLPurifier/Injector/StandardFlash.php create mode 100644 library/HTMLPurifier/Injector/_notes/dwsync.xml create mode 100644 library/HTMLPurifier/Token/Span.php create mode 100644 library/HTMLPurifier/Token/_notes/dwsync.xml create mode 100644 library/HTMLPurifier/_notes/dwsync.xml diff --git a/library/HTMLPurifier.includes.php b/library/HTMLPurifier.includes.php index 1533646..ce5d65b 100644 --- a/library/HTMLPurifier.includes.php +++ b/library/HTMLPurifier.includes.php @@ -154,8 +154,9 @@ require 'HTMLPurifier/HTMLModule/Proprietary.php'; require 'HTMLPurifier/HTMLModule/Ruby.php'; require 'HTMLPurifier/HTMLModule/SafeEmbed.php'; require 'HTMLPurifier/HTMLModule/SafeObject.php'; +require 'HTMLPurifier/HTMLModule/StandardFlash.php'; require 'HTMLPurifier/HTMLModule/Scripting.php'; -require 'HTMLPurifier/HTMLModule/StyleAttribute.php'; +require 'HTMLPurifier/HTMLModule/StyleAttribute.php';
This diff line is odd. What's going on here?
require 'HTMLPurifier/HTMLModule/Tables.php'; require 'HTMLPurifier/HTMLModule/Target.php'; require 'HTMLPurifier/HTMLModule/Text.php'; @@ -172,6 +173,7 @@ require 'HTMLPurifier/Injector/Linkify.php'; require 'HTMLPurifier/Injector/PurifierLinkify.php'; require 'HTMLPurifier/Injector/RemoveEmpty.php'; require 'HTMLPurifier/Injector/SafeObject.php'; +require 'HTMLPurifier/Injector/StandardFlash.php'; require 'HTMLPurifier/Lexer/DOMLex.php'; require 'HTMLPurifier/Lexer/DirectLex.php'; require 'HTMLPurifier/Strategy/Composite.php'; diff --git a/library/HTMLPurifier.safe-includes.php b/library/HTMLPurifier.safe-includes.php index 22e4fd0..07458c4 100644 --- a/library/HTMLPurifier.safe-includes.php +++ b/library/HTMLPurifier.safe-includes.php @@ -147,7 +147,8 @@ require_once $__dir . '/HTMLPurifier/HTMLModule/Presentation.php'; require_once $__dir . '/HTMLPurifier/HTMLModule/Proprietary.php'; require_once $__dir . '/HTMLPurifier/HTMLModule/Ruby.php'; require_once $__dir . '/HTMLPurifier/HTMLModule/SafeEmbed.php'; -require_once $__dir . '/HTMLPurifier/HTMLModule/SafeObject.php'; +require_once $__dir . '/HTMLPurifier/HTMLModule/SafeObject.php'; +require_once $__dir . '/HTMLPurifier/HTMLModule/StandardFlash.php'; require_once $__dir . '/HTMLPurifier/HTMLModule/Scripting.php'; require_once $__dir . '/HTMLPurifier/HTMLModule/StyleAttribute.php'; require_once $__dir . '/HTMLPurifier/HTMLModule/Tables.php'; @@ -166,6 +167,7 @@ require_once $__dir . '/HTMLPurifier/Injector/Linkify.php'; require_once $__dir . '/HTMLPurifier/Injector/PurifierLinkify.php'; require_once $__dir . '/HTMLPurifier/Injector/RemoveEmpty.php'; require_once $__dir . '/HTMLPurifier/Injector/SafeObject.php'; +require_once $__dir . '/HTMLPurifier/Injector/StandardFlash.php'; require_once $__dir . '/HTMLPurifier/Lexer/DOMLex.php'; require_once $__dir . '/HTMLPurifier/Lexer/DirectLex.php'; require_once $__dir . '/HTMLPurifier/Strategy/Composite.php'; diff --git a/library/HTMLPurifier/ConfigSchema/schema.ser b/library/HTMLPurifier/ConfigSchema/schema.ser index 0dac728..77da814 100644
truncated for brevity
diff --git a/library/HTMLPurifier/ConfigSchema/schema/HTML.StandardFlash.txt b/library/HTMLPurifier/ConfigSchema/schema/HTML.StandardFlash.txt new file mode 100644 index 0000000..a99a892 --- /dev/null +++ b/library/HTMLPurifier/ConfigSchema/schema/HTML.StandardFlash.txt @@ -0,0 +1,8 @@ +HTML.StandardFlash +TYPE: bool +VERSION: 3.1.1 +DEFAULT: false +--DESCRIPTION-- +<p> + Custom class that takes all the stuff in object tags and rewrites it to a new format +</p>
Grawr! We need docs!
diff --git a/library/HTMLPurifier/Generator.php b/library/HTMLPurifier/Generator.php
index d4c42fb..8980f97 100644
--- a/library/HTMLPurifier/Generator.php
+++ b/library/HTMLPurifier/Generator.php
@@ -120,6 +120,15 @@ class HTMLPurifier_Generator
} elseif ($token instanceof HTMLPurifier_Token_Comment) {
return '<!--' . $token->data . '-->';
+ } elseif ($token instanceof HTMLPurifier_Token_Span) {
+ $input_data = $token->attr["data"];
+ $input_width = $token->attr["width"];
+ $input_height = $token->attr["height"];
+ $input_movie = $token->attr["movie"];
+ $input_flashvars = $token->attr["flashvars"];
+
+ return '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'.$input_width.'" height="'.$input_height.'"><param name="movie" value="'.$input_movie.'" /><param name="flashvars" value="'.$input_flashvars.'" /><!--[if !IE]>--><object type="application/x-shockwave-flash" data="'.$input_data.'" width="'.$input_width.'" height="'.$input_height.'"><param name="flashvars" value="'.$input_flashvars.'" /></object><!--<![endif]--></object>';
+
It would be nice if this was split up into several lines.
} else {
return '';
diff --git a/library/HTMLPurifier/HTMLModule/StandardFlash.php b/library/HTMLPurifier/HTMLModule/StandardFlash.php
new file mode 100644
index 0000000..fce9271
--- /dev/null
+++ b/library/HTMLPurifier/HTMLModule/StandardFlash.php
@@ -0,0 +1,28 @@
+<?php
+
+class HTMLPurifier_HTMLModule_StandardFlash extends HTMLPurifier_HTMLModule
+{
+
+ public $name = 'StandardFlash';
+
+ public function setup($config) {
+
+ $object = $this->addElement(
+ 'object',
+ 'Inline',
+ 'Optional: param | Flow | #PCDATA',
+ 'Common'
+ );
+
+ $embed = $this->addElement(
+ 'embed', 'Inline', 'Empty', 'Common'
+ );
+
+ $param = $this->addElement('param', false, 'Empty', false
+ );
+
+ $this->info_injector[] = 'StandardFlash';
+
+ }
+
+}
diff --git a/library/HTMLPurifier/HTMLModule/_notes/dwsync.xml b/library/HTMLPurifier/HTMLModule/_notes/dwsync.xml
new file mode 100644
index 0000000..c17439c
--- /dev/null
+++ b/library/HTMLPurifier/HTMLModule/_notes/dwsync.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<dwsync>
+<file name="StandardFlash2.php" server="C:/Program Files/Apache Software Foundation/Apache2.2/htdocs/" local="128678095938125000" remote="128678095930000000" />
+</dwsync>
\ No newline at end of file
diff --git a/library/HTMLPurifier/HTMLModuleManager.php b/library/HTMLPurifier/HTMLModuleManager.php
index 63e0ebf..85e22ef 100644
--- a/library/HTMLPurifier/HTMLModuleManager.php
+++ b/library/HTMLPurifier/HTMLModuleManager.php
@@ -230,6 +230,10 @@ class HTMLPurifier_HTMLModuleManager
$modules[] = 'SafeEmbed';
}
+ if ($config->get('HTML', 'StandardFlash')) {
+ $modules[] = 'StandardFlash';
+ }
+
// merge in custom modules
$modules = array_merge($modules, $this->userModules);
diff --git a/library/HTMLPurifier/Injector.php b/library/HTMLPurifier/Injector.php
index ee10934..2d6a861 100644
--- a/library/HTMLPurifier/Injector.php
+++ b/library/HTMLPurifier/Injector.php
@@ -5,6 +5,11 @@
* This enables "formatter-like" functionality such as auto-paragraphing,
* smiley-ification and linkification to take place.
*
+ * A note on how handlers create changes; this is done by assigning a new
+ * value to the $token reference. These values can take a variety of forms and
+ * are best described HTMLPurifier_Strategy_MakeWellFormed->processToken()
+ * documentation.
+ *
* @todo Allow injectors to request a re-run on their output. This
* would help if an operation is recursive.
*/
@@ -17,13 +22,6 @@ abstract class HTMLPurifier_Injector
public $name;
So what it looks like happened is that the rebase didn't occur properly, and the changes I pushed later are duplicated in your diff. I have to double check with the history to see exactly what happened. I've truncated the rest of these changes for readability.
\ diff --git a/library/HTMLPurifier/Injector/StandardFlash.php b/library/HTMLPurifier/Injector/StandardFlash.php new file mode 100644 index 0000000..89453a5 --- /dev/null +++ b/library/HTMLPurifier/Injector/StandardFlash.php @@ -0,0 +1,103 @@ +<?php + +/** + * changes objects to a standard object + */
So, yeah. Better docs are always awesome. :-)
+class HTMLPurifier_Injector_StandardFlash extends HTMLPurifier_Injector
+{
+ //kept this stuff in here, not sure what it does
+ public $name = 'StandardFlash';
+ public $needed = array('object', 'param', 'embed');
+
+ protected $attribs_and_params = array();
Now that things are working, it might be a good idea to search replace this with a less wordy term.
+ + protected $depth = 0;
In theory, it should be possible (and desirable) to get rid of the depth counter and instead inspect the parent stack to figure out how deep in we are. I will look into this.
+ + protected $from_a_rewind = 0;
So, something I didn't mention earlier is that we now mark all tokens that are being processed during a rewind, so this technically isn't necessary. I can post some sample code taking advantage of this if you want.
+
+ public function prepare($config, $context) {
+ parent::prepare($config, $context);
+ }
This function is not necessary; remove the whole thing.
+
+ public function handleText(&$token) {
+ //if in an object, remove the text tokens
+ if($this->depth > 0){
+ $token = array();
+ }
+ return;
+ }
Use $token = 0;
+
+ public function handleElement(&$token) {
+
+ //this was called from a rewind (it is a start tag adjacent to the end tag)
+ if($this->from_a_rewind ==1){
+ $this->from_a_rewind = 0;
+ //if this is not the original object, delete it
+ if($this->depth > 0){
+ //echo ' DELETE';
+ $token = 2;
+ }else{
+ //if this is the original object, convert it
+ $token = new HTMLPurifier_Token_Span($this->attribs_and_params);
+ }
+ return;
+ }
+
+ //if a first embed
+ if($this->depth == 0 && $token->name == 'embed' && $token instanceof HTMLPurifier_Token_Empty){
+ $this->attribs_and_params = array();
+ $this->attribs_and_params["movie"] = $token->attr['src'];
+ $this->attribs_and_params["data"] = $token->attr['src'];
+ $this->attribs_and_params["width"] = $token->attr['width'];
+ $this->attribs_and_params["height"] = $token->attr['height'];
+ $this->attribs_and_params["flashvars"] = $token->attr['flashvars'];
You can probably just set $this->attribs_and_params = $token->attr, as long as you're ignoring all other attributes.
+
+ $token = new HTMLPurifier_Token_Span($this->attribs_and_params);
+
+ return;
+ }
+
+ //if a first object
+ if($this->depth == 0 && $token->name == 'object' && $token instanceof HTMLPurifier_Token_Start){
+ //now in an object
+ $this->depth++;
+ //remove the old attribs_and_params
+ $this->attribs_and_params = array();
+ //get the attribs
+ $this->attribs_and_params["data"] = $token->attr['data'];
+ $this->attribs_and_params["width"] = $token->attr['width'];
+ $this->attribs_and_params["height"] = $token->attr['height'];
Same goes here.
+
+ }elseif($this->depth == 1 && $token->name == 'param'){
+ //1st level param, store and delete
+ if($token->attr['name'] == 'movie' || $token->attr['name'] == 'flashvars'){
+ $this->attribs_and_params[$token->attr['name']] = $token->attr['value'];
+ }
+ $token = array();
+ }elseif($this->depth > 0 && $token instanceof HTMLPurifier_Token_Start){
+ //a nested start tag, increase depth
+
+ $this->depth++;
+ }elseif($this->depth > 0){
+ //anything else, delete
+
+ $token = array();
+ }
See my above comments.
+
+ return;
+
+ }
+
+ public function handleEnd($token) {
+ //if we are inside an object and hit an end tag, go to the corresponding start tag via rewind
+ if($this->depth > 0 ){
+ $this->depth--;
+ //echo 'rewind'.(($this->inputIndex)-1);
+ $this->from_a_rewind = 1;
+ $this->rewind((($this->inputIndex)-1)); All the parens are not necessary.
+ } + return; + } + +} + diff --git a/library/HTMLPurifier/Injector/_notes/dwsync.xml b/library/HTMLPurifier/Injector/_notes/dwsync.xml new file mode 100644 index 0000000..ff3fda5 --- /dev/null +++ b/library/HTMLPurifier/Injector/_notes/dwsync.xml @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8" ?> +<dwsync> +<file name="StandardFlash2.php" server="C:/Program Files/Apache Software Foundation/Apache2.2/htdocs/" local="128678093303437500" remote="128678093300000000" /> +</dwsync> \ No newline at end of file
Truncated more spurious changes.
diff --git a/library/HTMLPurifier/Token.php b/library/HTMLPurifier/Token.php
index 1248102..0a92d51 100644
--- a/library/HTMLPurifier/Token.php
+++ b/library/HTMLPurifier/Token.php
@@ -14,6 +14,12 @@ class HTMLPurifier_Token {
*/
public $armor = array();
+ /**
+ * Used during MakeWellFormed.
+ */
+ public $skip;
+ public $rewind;
+
public function __get($n) {
if ($n === 'type') {
trigger_error('Deprecated type property called; use instanceof', E_USER_NOTICE);
@@ -23,6 +29,7 @@ class HTMLPurifier_Token {
case 'HTMLPurifier_Token_End': return 'end';
case 'HTMLPurifier_Token_Text': return 'text';
case 'HTMLPurifier_Token_Comment': return 'comment';
+ case 'HTMLPurifier_Token_Span': return 'span';
default: return null;
}
}
I mentioned this previously, but adding this line here is really not necessary, since the entire method is deprecated anyway.
diff --git a/library/HTMLPurifier/Token/Span.php b/library/HTMLPurifier/Token/Span.php
new file mode 100644
index 0000000..fa5e850
--- /dev/null
+++ b/library/HTMLPurifier/Token/Span.php
@@ -0,0 +1,33 @@
+<?php
+
+/**
+ * Abstract class of a span token (start, end or empty), and its behavior.
+ */
+class HTMLPurifier_Token_Span extends HTMLPurifier_Token
+{
+ public $name = '#PCDATA'; /**< PCDATA tag name compatible with DTD. */
+ public $attr = array(); /**< Parsed character data of text. */
+ /**< Bool indicating if node is whitespace. */
+
+ /**
+ * Constructor, accepts data and determines if it is whitespace.
+ *
+ * @param $data String parsed character data.
+ */
+ public function __construct($attr = array(), $line = null) {
+ foreach ($attr as $key => $value) {
+ // normalization only necessary when key is not lowercase
+ if (!ctype_lower($key)) {
+ $new_key = strtolower($key);
+ if (!isset($attr[$new_key])) {
+ $attr[$new_key] = $attr[$key];
+ }
+ if ($new_key !== $key) {
+ unset($attr[$key]);
+ }
+ }
+ }
+ $this->attr = $attr;
+ $this->line = $line;
+ }
+}
Also mentioned previously; you should be able to use the parent constructor of HTMLPurifier_Token_Tag appropriately.
diff --git a/library/HTMLPurifier/Token/_notes/dwsync.xml b/library/HTMLPurifier/Token/_notes/dwsync.xml
new file mode 100644
index 0000000..e35351c
--- /dev/null
+++ b/library/HTMLPurifier/Token/_notes/dwsync.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<dwsync>
+<file name="Span.php" server="C:/Program Files/Apache Software Foundation/Apache2.2/htdocs/" local="128674653080312500" remote="128674653080000000" />
+</dwsync>
\ No newline at end of file
diff --git a/library/HTMLPurifier/TokenFactory.php b/library/HTMLPurifier/TokenFactory.php
index bff693f..4e53df5 100644
--- a/library/HTMLPurifier/TokenFactory.php
+++ b/library/HTMLPurifier/TokenFactory.php
@@ -19,7 +19,7 @@ class HTMLPurifier_TokenFactory
* @private
*/
// p stands for prototype
- private $p_start, $p_end, $p_empty, $p_text, $p_comment;
+ private $p_start, $p_end, $p_empty, $p_text, $p_comment, $p_span;
/**
* Generates blank prototypes for cloning.
@@ -30,6 +30,7 @@ class HTMLPurifier_TokenFactory
$this->p_empty = new HTMLPurifier_Token_Empty('', array());
$this->p_text = new HTMLPurifier_Token_Text('');
$this->p_comment= new HTMLPurifier_Token_Comment('');
+ $this->p_span= new HTMLPurifier_Token_Span(array());
}
/**
@@ -89,5 +90,11 @@ class HTMLPurifier_TokenFactory
return $p;
}
+ public function createSpan($attr = array()) {
+ $p = clone $this->p_span;
+ $p->__construct($attr);
+ return $p;
+ }
+
}
diff --git a/library/HTMLPurifier/_notes/dwsync.xml b/library/HTMLPurifier/_notes/dwsync.xml
new file mode 100644
index 0000000..6e12b78
--- /dev/null
+++ b/library/HTMLPurifier/_notes/dwsync.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<dwsync>
+<file name="TokenFactory.php" server="C:/Program Files/Apache Software Foundation/Apache2.2/htdocs/" local="128674653849062500" remote="128674653840000000" />
+<file name="Token.php" server="C:/Program Files/Apache Software Foundation/Apache2.2/htdocs/" local="128674654155468750" remote="128674654150000000" />
+<file name="Generator.php" server="C:/Program Files/Apache Software Foundation/Apache2.2/htdocs/" local="128678092000312500" remote="128678092000000000" />
+</dwsync>
\ No newline at end of file
--
1.5.6.1.1071.g76fb
And finally you've got a wonky mix of tabs and spaces in the diff; HTML Purifier uses four spaces.
|
Re: Trying to allow param 'flashvars' in object/embed October 11, 2008 11:01PM |
Admin Registered: 6 years ago Posts: 2,652 |
|
Re: Trying to allow param 'flashvars' in object/embed October 11, 2008 11:40PM |
Admin Registered: 6 years ago Posts: 2,652 |
Here is an updated patch for you to work off of. The way to apply it is to put it in a file, then run the following commands:
git reset --hard remotes/origin/master git checkout -b so git apply-patch patchname.patch
Let me know if it doesn't apply cleanly for you. You MUST save it with Unix-style newlines.
From 8eb0448a2f8d3319842b9418e2615ecea8bf6a1e Mon Sep 17 00:00:00 2001
From: Edward Z. Yang <edwardzyang@thewritingpot.com>
Date: Sat, 11 Oct 2008 23:36:56 -0400
Subject: [PATCH] Implement standardized object injector and related classes. This is not complete.
Signed-off-by: Michael Jugan <mjugan@tds.net>
---
configdoc/usage.xml | 9 ++-
library/HTMLPurifier.includes.php | 3 +
library/HTMLPurifier.safe-includes.php | 3 +
library/HTMLPurifier/ConfigSchema/schema.ser | 2 +-
.../ConfigSchema/schema/HTML.StandardFlash.txt | 8 ++
library/HTMLPurifier/Generator.php | 9 ++
library/HTMLPurifier/HTMLModule/StandardFlash.php | 28 ++++++
library/HTMLPurifier/HTMLModuleManager.php | 4 +
library/HTMLPurifier/Injector/StandardFlash.php | 102 ++++++++++++++++++++
library/HTMLPurifier/Token.php | 1 +
library/HTMLPurifier/Token/Span.php | 32 ++++++
library/HTMLPurifier/TokenFactory.php | 9 ++-
12 files changed, 206 insertions(+), 4 deletions(-)
create mode 100644 library/HTMLPurifier/ConfigSchema/schema/HTML.StandardFlash.txt
create mode 100644 library/HTMLPurifier/HTMLModule/StandardFlash.php
create mode 100644 library/HTMLPurifier/Injector/StandardFlash.php
create mode 100644 library/HTMLPurifier/Token/Span.php
diff --git a/configdoc/usage.xml b/configdoc/usage.xml
index 43e7332..770e31f 100644
--- a/configdoc/usage.xml
+++ b/configdoc/usage.xml
@@ -143,7 +143,7 @@
<line>202</line>
</file>
<file name="HTMLPurifier/Lexer.php">
- <line>252</line>
+ <line>258</line>
</file>
<file name="HTMLPurifier/HTMLModule/Image.php">
<line>27</line>
@@ -180,6 +180,11 @@
<line>229</line>
</file>
</directive>
+ <directive id="HTML.StandardFlash">
+ <file name="HTMLPurifier/HTMLModuleManager.php">
+ <line>233</line>
+ </file>
+ </directive>
<directive id="Attr.IDBlacklist">
<file name="HTMLPurifier/IDAccumulator.php">
<line>26</line>
@@ -205,7 +210,7 @@
</directive>
<directive id="Core.ConvertDocumentToFragment">
<file name="HTMLPurifier/Lexer.php">
- <line>261</line>
+ <line>267</line>
</file>
</directive>
<directive id="URI.Host">
diff --git a/library/HTMLPurifier.includes.php b/library/HTMLPurifier.includes.php
index 1533646..fd05a7c 100644
--- a/library/HTMLPurifier.includes.php
+++ b/library/HTMLPurifier.includes.php
@@ -155,6 +155,7 @@ require 'HTMLPurifier/HTMLModule/Ruby.php';
require 'HTMLPurifier/HTMLModule/SafeEmbed.php';
require 'HTMLPurifier/HTMLModule/SafeObject.php';
require 'HTMLPurifier/HTMLModule/Scripting.php';
+require 'HTMLPurifier/HTMLModule/StandardFlash.php';
require 'HTMLPurifier/HTMLModule/StyleAttribute.php';
require 'HTMLPurifier/HTMLModule/Tables.php';
require 'HTMLPurifier/HTMLModule/Target.php';
@@ -172,6 +173,7 @@ require 'HTMLPurifier/Injector/Linkify.php';
require 'HTMLPurifier/Injector/PurifierLinkify.php';
require 'HTMLPurifier/Injector/RemoveEmpty.php';
require 'HTMLPurifier/Injector/SafeObject.php';
+require 'HTMLPurifier/Injector/StandardFlash.php';
require 'HTMLPurifier/Lexer/DOMLex.php';
require 'HTMLPurifier/Lexer/DirectLex.php';
require 'HTMLPurifier/Strategy/Composite.php';
@@ -186,6 +188,7 @@ require 'HTMLPurifier/Token/Comment.php';
require 'HTMLPurifier/Token/Tag.php';
require 'HTMLPurifier/Token/Empty.php';
require 'HTMLPurifier/Token/End.php';
+require 'HTMLPurifier/Token/Span.php';
require 'HTMLPurifier/Token/Start.php';
require 'HTMLPurifier/Token/Text.php';
require 'HTMLPurifier/URIFilter/DisableExternal.php';
diff --git a/library/HTMLPurifier.safe-includes.php b/library/HTMLPurifier.safe-includes.php
index 22e4fd0..a96fb65 100644
--- a/library/HTMLPurifier.safe-includes.php
+++ b/library/HTMLPurifier.safe-includes.php
@@ -149,6 +149,7 @@ require_once $__dir . '/HTMLPurifier/HTMLModule/Ruby.php';
require_once $__dir . '/HTMLPurifier/HTMLModule/SafeEmbed.php';
require_once $__dir . '/HTMLPurifier/HTMLModule/SafeObject.php';
require_once $__dir . '/HTMLPurifier/HTMLModule/Scripting.php';
+require_once $__dir . '/HTMLPurifier/HTMLModule/StandardFlash.php';
require_once $__dir . '/HTMLPurifier/HTMLModule/StyleAttribute.php';
require_once $__dir . '/HTMLPurifier/HTMLModule/Tables.php';
require_once $__dir . '/HTMLPurifier/HTMLModule/Target.php';
@@ -166,6 +167,7 @@ require_once $__dir . '/HTMLPurifier/Injector/Linkify.php';
require_once $__dir . '/HTMLPurifier/Injector/PurifierLinkify.php';
require_once $__dir . '/HTMLPurifier/Injector/RemoveEmpty.php';
require_once $__dir . '/HTMLPurifier/Injector/SafeObject.php';
+require_once $__dir . '/HTMLPurifier/Injector/StandardFlash.php';
require_once $__dir . '/HTMLPurifier/Lexer/DOMLex.php';
require_once $__dir . '/HTMLPurifier/Lexer/DirectLex.php';
require_once $__dir . '/HTMLPurifier/Strategy/Composite.php';
@@ -180,6 +182,7 @@ require_once $__dir . '/HTMLPurifier/Token/Comment.php';
require_once $__dir . '/HTMLPurifier/Token/Tag.php';
require_once $__dir . '/HTMLPurifier/Token/Empty.php';
require_once $__dir . '/HTMLPurifier/Token/End.php';
+require_once $__dir . '/HTMLPurifier/Token/Span.php';
require_once $__dir . '/HTMLPurifier/Token/Start.php';
require_once $__dir . '/HTMLPurifier/Token/Text.php';
require_once $__dir . '/HTMLPurifier/URIFilter/DisableExternal.php';
diff --git a/library/HTMLPurifier/ConfigSchema/schema.ser b/library/HTMLPurifier/ConfigSchema/schema.ser
index 5319c3a..4c45aeb 100644
--- a/library/HTMLPurifier/ConfigSchema/schema.ser
+++ b/library/HTMLPurifier/ConfigSchema/schema.ser
@@ -1 +1 @@
-O:25:"HTMLPurifier_ConfigSchema":2:{s:8:"defaults";a:12:{s:4:"Attr";a:12:{s:19:"AllowedFrameTargets";a:0:{}s:10:"AllowedRel";a:0:{}s:10:"AllowedRev";a:0:{}s:15:"DefaultImageAlt";N;s:19:"DefaultInvalidImage";s:0:"";s:22:"DefaultInvalidImageAlt";s:13:"Invalid image";s:14:"DefaultTextDir";s:3:"ltr";s:8:"EnableID";b:0;s:11:"IDBlacklist";a:0:{}s:17:"IDBlacklistRegexp";N;s:8:"IDPrefix";s:0:"";s:13:"IDPrefixLocal";s:0:"";}s:10:"AutoFormat";a:5:{s:13:"AutoParagraph";b:0;s:6:"Custom";a:0:{}s:7:"Linkify";b:0;s:15:"PurifierLinkify";b:0;s:11:"RemoveEmpty";b:0;}s:15:"AutoFormatParam";a:1:{s:21:"PurifierLinkifyDocURL";s:3:"#%s";}s:3:"CSS";a:6:{s:14:"AllowImportant";b:0;s:11:"AllowTricky";b:0;s:17:"AllowedProperties";N;s:13:"DefinitionRev";i:1;s:12:"MaxImgLength";s:6:"1200px";s:11:"Proprietary";b:0;}s:5:"Cache";a:2:{s:14:"DefinitionImpl";s:10:"Serializer";s:14:"SerializerPath";N;}s:4:"Core";a:15:{s:17:"AggressivelyFixLt";b:1;s:13:"CollectErrors";b:0;s:13:"ColorKeywords";a:17:{s:6:"maroon";s:7:"#800000";s:3:"red";s:7:"#FF0000";s:6:"orange";s:7:"#FFA500";s:6:"yellow";s:7:"#FFFF00";s:5:"olive";s:7:"#808000";s:6:"purple";s:7:"#800080";s:7:"fuchsia";s:7:"#FF00FF";s:5:"white";s:7:"#FFFFFF";s:4:"lime";s:7:"#00FF00";s:5:"green";s:7:"#008000";s:4:"navy";s:7:"#000080";s:4:"blue";s:7:"#0000FF";s:4:"aqua";s:7:"#00FFFF";s:4:"teal";s:7:"#008080";s:5:"black";s:7:"#000000";s:6:"silver";s:7:"#C0C0C0";s:4:"gray";s:7:"#808080";}s:25:"ConvertDocumentToFragment";b:1;s:31:"DirectLexLineNumberSyncInterval";i:0;s:8:"Encoding";s:5:"utf-8";s:21:"EscapeInvalidChildren";b:0;s:17:"EscapeInvalidTags";b:0;s:24:"EscapeNonASCIICharacters";b:0;s:14:"HiddenElements";a:2:{s:6:"script";b:1;s:5:"style";b:1;}s:8:"Language";s:2:"en";s:9:"LexerImpl";N;s:19:"MaintainLineNumbers";N;s:16:"RemoveInvalidImg";b:1;s:20:"RemoveScriptContents";N;}s:6:"Filter";a:3:{s:6:"Custom";a:0:{}s:18:"ExtractStyleBlocks";b:0;s:7:"YouTube";b:0;}s:11:"FilterParam";a:3:{s:26:"ExtractStyleBlocksEscaping";b:1;s:23:"ExtractStyleBlocksScope";N;s:26:"ExtractStyleBlocksTidyImpl";N;}s:4:"HTML";a:23:{s:7:"Allowed";N;s:17:"AllowedAttributes";N;s:15:"AllowedElements";N;s:14:"AllowedModules";N;s:12:"BlockWrapper";s:1:"p";s:11:"CoreModules";a:7:{s:9:"Structure";b:1;s:4:"Text";b:1;s:9:"Hypertext";b:1;s:4:"List";b:1;s:22:"NonXMLCommonAttributes";b:1;s:19:"XMLCommonAttributes";b:1;s:16:"CommonAttributes";b:1;}s:13:"CustomDoctype";N;s:12:"DefinitionID";N;s:13:"DefinitionRev";i:1;s:7:"Doctype";N;s:19:"ForbiddenAttributes";a:0:{}s:17:"ForbiddenElements";a:0:{}s:12:"MaxImgLength";i:1200;s:6:"Parent";s:3:"div";s:11:"Proprietary";b:0;s:9:"SafeEmbed";b:0;s:10:"SafeObject";b:0;s:6:"Strict";b:0;s:7:"TidyAdd";a:0:{}s:9:"TidyLevel";s:6:"medium";s:10:"TidyRemove";a:0:{}s:7:"Trusted";b:0;s:5:"XHTML";b:1;}s:6:"Output";a:4:{s:21:"CommentScriptContents";b:1;s:7:"Newline";N;s:8:"SortAttr";b:0;s:10:"TidyFormat";b:0;}s:4:"Test";a:1:{s:12:"ForceNoIconv";b:0;}s:3:"URI";a:16:{s:14:"AllowedSchemes";a:6:{s:4:"http";b:1;s:5:"https";b:1;s:6:"mailto";b:1;s:3:"ftp";b:1;s:4:"nntp";b:1;s:4:"news";b:1;}s:4:"Base";N;s:13:"DefaultScheme";s:4:"http";s:12:"DefinitionID";N;s:13:"DefinitionRev";i:1;s:7:"Disable";b:0;s:15:"DisableExternal";b:0;s:24:"DisableExternalResources";b:0;s:16:"DisableResources";b:0;s:4:"Host";N;s:13:"HostBlacklist";a:0:{}s:12:"MakeAbsolute";b:0;s:5:"Munge";N;s:14:"MungeResources";b:0;s:14:"MungeSecretKey";N;s:22:"OverrideAllowedSchemes";b:1;}}s:4:"info";a:12:{s:4:"Attr";a:13:{s:19:"AllowedFrameTargets";i:8;s:10:"AllowedRel";i:8;s:10:"AllowedRev";i:8;s:15:"DefaultImageAlt";i:-1;s:19:"DefaultInvalidImage";i:1;s:22:"DefaultInvalidImageAlt";i:1;s:14:"DefaultTextDir";O:8:"stdClass":2:{s:4:"type";i:1;s:7:"allowed";a:2:{s:3:"ltr";b:1;s:3:"rtl";b:1;}}s:8:"EnableID";i:7;s:11:"IDBlacklist";i:9;s:17:"IDBlacklistRegexp";i:-1;s:8:"IDPrefix";i:1;s:13:"IDPrefixLocal";i:1;s:10:"DisableURI";O:8:"stdClass":3:{s:9:"namespace";s:3:"URI";s:4:"name";s:7:"Disable";s:7:"isAlias";b:1;}}s:10:"AutoFormat";a:5:{s:13:"AutoParagraph";i:7;s:6:"Custom";i:9;s:7:"Linkify";i:7;s:15:"PurifierLinkify";i:7;s:11:"RemoveEmpty";i:7;}s:15:"AutoFormatParam";a:1:{s:21:"PurifierLinkifyDocURL";i:1;}s:3:"CSS";a:6:{s:14:"AllowImportant";i:7;s:11:"AllowTricky";i:7;s:17:"AllowedProperties";i:-8;s:13:"DefinitionRev";i:5;s:12:"MaxImgLength";i:-1;s:11:"Proprietary";i:7;}s:5:"Cache";a:2:{s:14:"DefinitionImpl";i:-1;s:14:"SerializerPath";i:-1;}s:4:"Core";a:20:{s:15:"DefinitionCache";O:8:"stdClass":3:{s:9:"namespace";s:5:"Cache";s:4:"name";s:14:"DefinitionImpl";s:7:"isAlias";b:1;}s:17:"AggressivelyFixLt";i:7;s:13:"CollectErrors";i:7;s:13:"ColorKeywords";i:10;s:25:"ConvertDocumentToFragment";i:7;s:19:"AcceptFullDocuments";O:8:"stdClass":3:{s:9:"namespace";s:4:"Core";s:4:"name";s:25:"ConvertDocumentToFragment";s:7:"isAlias";b:1;}s:31:"DirectLexLineNumberSyncInterval";i:5;s:8:"Encoding";i:2;s:21:"EscapeInvalidChildren";i:7;s:17:"EscapeInvalidTags";i:7;s:24:"EscapeNonASCIICharacters";i:7;s:14:"HiddenElements";i:8;s:8:"Language";i:1;s:9:"LexerImpl";i:-11;s:19:"MaintainLineNumbers";i:-7;s:16:"RemoveInvalidImg";i:7;s:20:"RemoveScriptContents";i:-7;s:5:"XHTML";O:8:"stdClass":3:{s:9:"namespace";s:4:"HTML";s:4:"name";s:5:"XHTML";s:7:"isAlias";b:1;}s:21:"CommentScriptContents";O:8:"stdClass":3:{s:9:"namespace";s:6:"Output";s:4:"name";s:21:"CommentScriptContents";s:7:"isAlias";b:1;}s:10:"TidyFormat";O:8:"stdClass":3:{s:9:"namespace";s:6:"Output";s:4:"name";s:10:"TidyFormat";s:7:"isAlias";b:1;}}s:6:"Filter";a:5:{s:6:"Custom";i:9;s:18:"ExtractStyleBlocks";i:7;s:7:"YouTube";i:7;s:26:"ExtractStyleBlocksEscaping";O:8:"stdClass":3:{s:9:"namespace";s:11:"FilterParam";s:4:"name";s:26:"ExtractStyleBlocksEscaping";s:7:"isAlias";b:1;}s:23:"ExtractStyleBlocksScope";O:8:"stdClass":3:{s:9:"namespace";s:11:"FilterParam";s:4:"name";s:23:"ExtractStyleBlocksScope";s:7:"isAlias";b:1;}}s:11:"FilterParam";a:3:{s:26:"ExtractStyleBlocksEscaping";i:7;s:23:"ExtractStyleBlocksScope";i:-1;s:26:"ExtractStyleBlocksTidyImpl";i:-11;}s:4:"HTML";a:24:{s:12:"EnableAttrID";O:8:"stdClass":3:{s:9:"namespace";s:4:"Attr";s:4:"name";s:8:"EnableID";s:7:"isAlias";b:1;}s:7:"Allowed";i:-4;s:17:"AllowedAttributes";i:-8;s:15:"AllowedElements";i:-8;s:14:"AllowedModules";i:-8;s:12:"BlockWrapper";i:1;s:11:"CoreModules";i:8;s:13:"CustomDoctype";i:-1;s:12:"DefinitionID";i:-1;s:13:"DefinitionRev";i:5;s:7:"Doctype";O:8:"stdClass":3:{s:4:"type";i:1;s:10:"allow_null";b:1;s:7:"allowed";a:5:{s:22:"HTML 4.01 Transitional";b:1;s:16:"HTML 4.01 Strict";b:1;s:22:"XHTML 1.0 Transitional";b:1;s:16:"XHTML 1.0 Strict";b:1;s:9:"XHTML 1.1";b:1;}}s:19:"ForbiddenAttributes";i:8;s:17:"ForbiddenElements";i:8;s:12:"MaxImgLength";i:-5;s:6:"Parent";i:1;s:11:"Proprietary";i:7;s:9:"SafeEmbed";i:7;s:10:"SafeObject";i:7;s:6:"Strict";i:7;s:7:"TidyAdd";i:8;s:9:"TidyLevel";O:8:"stdClass":2:{s:4:"type";i:1;s:7:"allowed";a:4:{s:4:"none";b:1;s:5:"light";b:1;s:6:"medium";b:1;s:5:"heavy";b:1;}}s:10:"TidyRemove";i:8;s:7:"Trusted";i:7;s:5:"XHTML";i:7;}s:6:"Output";a:4:{s:21:"CommentScriptContents";i:7;s:7:"Newline";i:-1;s:8:"SortAttr";i:7;s:10:"TidyFormat";i:7;}s:4:"Test";a:1:{s:12:"ForceNoIconv";i:7;}s:3:"URI";a:16:{s:14:"AllowedSchemes";i:8;s:4:"Base";i:-1;s:13:"DefaultScheme";i:1;s:12:"DefinitionID";i:-1;s:13:"DefinitionRev";i:5;s:7:"Disable";i:7;s:15:"DisableExternal";i:7;s:24:"DisableExternalResources";i:7;s:16:"DisableResources";i:7;s:4:"Host";i:-1;s:13:"HostBlacklist";i:9;s:12:"MakeAbsolute";i:7;s:5:"Munge";i:-1;s:14:"MungeResources";i:7;s:14:"MungeSecretKey";i:-1;s:22:"OverrideAllowedSchemes";i:7;}}}
\ No newline at end of file
+O:25:"HTMLPurifier_ConfigSchema":2:{s:8:"defaults";a:12:{s:4:"Attr";a:12:{s:19:"AllowedFrameTargets";a:0:{}s:10:"AllowedRel";a:0:{}s:10:"AllowedRev";a:0:{}s:15:"DefaultImageAlt";N;s:19:"DefaultInvalidImage";s:0:"";s:22:"DefaultInvalidImageAlt";s:13:"Invalid image";s:14:"DefaultTextDir";s:3:"ltr";s:8:"EnableID";b:0;s:11:"IDBlacklist";a:0:{}s:17:"IDBlacklistRegexp";N;s:8:"IDPrefix";s:0:"";s:13:"IDPrefixLocal";s:0:"";}s:10:"AutoFormat";a:5:{s:13:"AutoParagraph";b:0;s:6:"Custom";a:0:{}s:7:"Linkify";b:0;s:15:"PurifierLinkify";b:0;s:11:"RemoveEmpty";b:0;}s:15:"AutoFormatParam";a:1:{s:21:"PurifierLinkifyDocURL";s:3:"#%s";}s:3:"CSS";a:6:{s:14:"AllowImportant";b:0;s:11:"AllowTricky";b:0;s:17:"AllowedProperties";N;s:13:"DefinitionRev";i:1;s:12:"MaxImgLength";s:6:"1200px";s:11:"Proprietary";b:0;}s:5:"Cache";a:2:{s:14:"DefinitionImpl";s:10:"Serializer";s:14:"SerializerPath";N;}s:4:"Core";a:15:{s:17:"AggressivelyFixLt";b:1;s:13:"CollectErrors";b:0;s:13:"ColorKeywords";a:17:{s:6:"maroon";s:7:"#800000";s:3:"red";s:7:"#FF0000";s:6:"orange";s:7:"#FFA500";s:6:"yellow";s:7:"#FFFF00";s:5:"olive";s:7:"#808000";s:6:"purple";s:7:"#800080";s:7:"fuchsia";s:7:"#FF00FF";s:5:"white";s:7:"#FFFFFF";s:4:"lime";s:7:"#00FF00";s:5:"green";s:7:"#008000";s:4:"navy";s:7:"#000080";s:4:"blue";s:7:"#0000FF";s:4:"aqua";s:7:"#00FFFF";s:4:"teal";s:7:"#008080";s:5:"black";s:7:"#000000";s:6:"silver";s:7:"#C0C0C0";s:4:"gray";s:7:"#808080";}s:25:"ConvertDocumentToFragment";b:1;s:31:"DirectLexLineNumberSyncInterval";i:0;s:8:"Encoding";s:5:"utf-8";s:21:"EscapeInvalidChildren";b:0;s:17:"EscapeInvalidTags";b:0;s:24:"EscapeNonASCIICharacters";b:0;s:14:"HiddenElements";a:2:{s:6:"script";b:1;s:5:"style";b:1;}s:8:"Language";s:2:"en";s:9:"LexerImpl";N;s:19:"MaintainLineNumbers";N;s:16:"RemoveInvalidImg";b:1;s:20:"RemoveScriptContents";N;}s:6:"Filter";a:3:{s:6:"Custom";a:0:{}s:18:"ExtractStyleBlocks";b:0;s:7:"YouTube";b:0;}s:11:"FilterParam";a:3:{s:26:"ExtractStyleBlocksEscaping";b:1;s:23:"ExtractStyleBlocksScope";N;s:26:"ExtractStyleBlocksTidyImpl";N;}s:4:"HTML";a:24:{s:7:"Allowed";N;s:17:"AllowedAttributes";N;s:15:"AllowedElements";N;s:14:"AllowedModules";N;s:12:"BlockWrapper";s:1:"p";s:11:"CoreModules";a:7:{s:9:"Structure";b:1;s:4:"Text";b:1;s:9:"Hypertext";b:1;s:4:"List";b:1;s:22:"NonXMLCommonAttributes";b:1;s:19:"XMLCommonAttributes";b:1;s:16:"CommonAttributes";b:1;}s:13:"CustomDoctype";N;s:12:"DefinitionID";N;s:13:"DefinitionRev";i:1;s:7:"Doctype";N;s:19:"ForbiddenAttributes";a:0:{}s:17:"ForbiddenElements";a:0:{}s:12:"MaxImgLength";i:1200;s:6:"Parent";s:3:"div";s:11:"Proprietary";b:0;s:9:"SafeEmbed";b:0;s:10:"SafeObject";b:0;s:13:"StandardFlash";b:0;s:6:"Strict";b:0;s:7:"TidyAdd";a:0:{}s:9:"TidyLevel";s:6:"medium";s:10:"TidyRemove";a:0:{}s:7:"Trusted";b:0;s:5:"XHTML";b:1;}s:6:"Output";a:4:{s:21:"CommentScriptContents";b:1;s:7:"Newline";N;s:8:"SortAttr";b:0;s:10:"TidyFormat";b:0;}s:4:"Test";a:1:{s:12:"ForceNoIconv";b:0;}s:3:"URI";a:16:{s:14:"AllowedSchemes";a:6:{s:4:"http";b:1;s:5:"https";b:1;s:6:"mailto";b:1;s:3:"ftp";b:1;s:4:"nntp";b:1;s:4:"news";b:1;}s:4:"Base";N;s:13:"DefaultScheme";s:4:"http";s:12:"DefinitionID";N;s:13:"DefinitionRev";i:1;s:7:"Disable";b:0;s:15:"DisableExternal";b:0;s:24:"DisableExternalResources";b:0;s:16:"DisableResources";b:0;s:4:"Host";N;s:13:"HostBlacklist";a:0:{}s:12:"MakeAbsolute";b:0;s:5:"Munge";N;s:14:"MungeResources";b:0;s:14:"MungeSecretKey";N;s:22:"OverrideAllowedSchemes";b:1;}}s:4:"info";a:12:{s:4:"Attr";a:13:{s:19:"AllowedFrameTargets";i:8;s:10:"AllowedRel";i:8;s:10:"AllowedRev";i:8;s:15:"DefaultImageAlt";i:-1;s:19:"DefaultInvalidImage";i:1;s:22:"DefaultInvalidImageAlt";i:1;s:14:"DefaultTextDir";O:8:"stdClass":2:{s:4:"type";i:1;s:7:"allowed";a:2:{s:3:"ltr";b:1;s:3:"rtl";b:1;}}s:8:"EnableID";i:7;s:11:"IDBlacklist";i:9;s:17:"IDBlacklistRegexp";i:-1;s:8:"IDPrefix";i:1;s:13:"IDPrefixLocal";i:1;s:10:"DisableURI";O:8:"stdClass":3:{s:9:"namespace";s:3:"URI";s:4:"name";s:7:"Disable";s:7:"isAlias";b:1;}}s:10:"AutoFormat";a:5:{s:13:"AutoParagraph";i:7;s:6:"Custom";i:9;s:7:"Linkify";i:7;s:15:"PurifierLinkify";i:7;s:11:"RemoveEmpty";i:7;}s:15:"AutoFormatParam";a:1:{s:21:"PurifierLinkifyDocURL";i:1;}s:3:"CSS";a:6:{s:14:"AllowImportant";i:7;s:11:"AllowTricky";i:7;s:17:"AllowedProperties";i:-8;s:13:"DefinitionRev";i:5;s:12:"MaxImgLength";i:-1;s:11:"Proprietary";i:7;}s:5:"Cache";a:2:{s:14:"DefinitionImpl";i:-1;s:14:"SerializerPath";i:-1;}s:4:"Core";a:20:{s:15:"DefinitionCache";O:8:"stdClass":3:{s:9:"namespace";s:5:"Cache";s:4:"name";s:14:"DefinitionImpl";s:7:"isAlias";b:1;}s:17:"AggressivelyFixLt";i:7;s:13:"CollectErrors";i:7;s:13:"ColorKeywords";i:10;s:25:"ConvertDocumentToFragment";i:7;s:19:"AcceptFullDocuments";O:8:"stdClass":3:{s:9:"namespace";s:4:"Core";s:4:"name";s:25:"ConvertDocumentToFragment";s:7:"isAlias";b:1;}s:31:"DirectLexLineNumberSyncInterval";i:5;s:8:"Encoding";i:2;s:21:"EscapeInvalidChildren";i:7;s:17:"EscapeInvalidTags";i:7;s:24:"EscapeNonASCIICharacters";i:7;s:14:"HiddenElements";i:8;s:8:"Language";i:1;s:9:"LexerImpl";i:-11;s:19:"MaintainLineNumbers";i:-7;s:16:"RemoveInvalidImg";i:7;s:20:"RemoveScriptContents";i:-7;s:5:"XHTML";O:8:"stdClass":3:{s:9:"namespace";s:4:"HTML";s:4:"name";s:5:"XHTML";s:7:"isAlias";b:1;}s:21:"CommentScriptContents";O:8:"stdClass":3:{s:9:"namespace";s:6:"Output";s:4:"name";s:21:"CommentScriptContents";s:7:"isAlias";b:1;}s:10:"TidyFormat";O:8:"stdClass":3:{s:9:"namespace";s:6:"Output";s:4:"name";s:10:"TidyFormat";s:7:"isAlias";b:1;}}s:6:"Filter";a:5:{s:6:"Custom";i:9;s:18:"ExtractStyleBlocks";i:7;s:7:"YouTube";i:7;s:26:"ExtractStyleBlocksEscaping";O:8:"stdClass":3:{s:9:"namespace";s:11:"FilterParam";s:4:"name";s:26:"ExtractStyleBlocksEscaping";s:7:"isAlias";b:1;}s:23:"ExtractStyleBlocksScope";O:8:"stdClass":3:{s:9:"namespace";s:11:"FilterParam";s:4:"name";s:23:"ExtractStyleBlocksScope";s:7:"isAlias";b:1;}}s:11:"FilterParam";a:3:{s:26:"ExtractStyleBlocksEscaping";i:7;s:23:"ExtractStyleBlocksScope";i:-1;s:26:"ExtractStyleBlocksTidyImpl";i:-11;}s:4:"HTML";a:25:{s:12:"EnableAttrID";O:8:"stdClass":3:{s:9:"namespace";s:4:"Attr";s:4:"name";s:8:"EnableID";s:7:"isAlias";b:1;}s:7:"Allowed";i:-4;s:17:"AllowedAttributes";i:-8;s:15:"AllowedElements";i:-8;s:14:"AllowedModules";i:-8;s:12:"BlockWrapper";i:1;s:11:"CoreModules";i:8;s:13:"CustomDoctype";i:-1;s:12:"DefinitionID";i:-1;s:13:"DefinitionRev";i:5;s:7:"Doctype";O:8:"stdClass":3:{s:4:"type";i:1;s:10:"allow_null";b:1;s:7:"allowed";a:5:{s:22:"HTML 4.01 Transitional";b:1;s:16:"HTML 4.01 Strict";b:1;s:22:"XHTML 1.0 Transitional";b:1;s:16:"XHTML 1.0 Strict";b:1;s:9:"XHTML 1.1";b:1;}}s:19:"ForbiddenAttributes";i:8;s:17:"ForbiddenElements";i:8;s:12:"MaxImgLength";i:-5;s:6:"Parent";i:1;s:11:"Proprietary";i:7;s:9:"SafeEmbed";i:7;s:10:"SafeObject";i:7;s:13:"StandardFlash";i:7;s:6:"Strict";i:7;s:7:"TidyAdd";i:8;s:9:"TidyLevel";O:8:"stdClass":2:{s:4:"type";i:1;s:7:"allowed";a:4:{s:4:"none";b:1;s:5:"light";b:1;s:6:"medium";b:1;s:5:"heavy";b:1;}}s:10:"TidyRemove";i:8;s:7:"Trusted";i:7;s:5:"XHTML";i:7;}s:6:"Output";a:4:{s:21:"CommentScriptContents";i:7;s:7:"Newline";i:-1;s:8:"SortAttr";i:7;s:10:"TidyFormat";i:7;}s:4:"Test";a:1:{s:12:"ForceNoIconv";i:7;}s:3:"URI";a:16:{s:14:"AllowedSchemes";i:8;s:4:"Base";i:-1;s:13:"DefaultScheme";i:1;s:12:"DefinitionID";i:-1;s:13:"DefinitionRev";i:5;s:7:"Disable";i:7;s:15:"DisableExternal";i:7;s:24:"DisableExternalResources";i:7;s:16:"DisableResources";i:7;s:4:"Host";i:-1;s:13:"HostBlacklist";i:9;s:12:"MakeAbsolute";i:7;s:5:"Munge";i:-1;s:14:"MungeResources";i:7;s:14:"MungeSecretKey";i:-1;s:22:"OverrideAllowedSchemes";i:7;}}}
\ No newline at end of file
diff --git a/library/HTMLPurifier/ConfigSchema/schema/HTML.StandardFlash.txt b/library/HTMLPurifier/ConfigSchema/schema/HTML.StandardFlash.txt
new file mode 100644
index 0000000..a99a892
--- /dev/null
+++ b/library/HTMLPurifier/ConfigSchema/schema/HTML.StandardFlash.txt
@@ -0,0 +1,8 @@
+HTML.StandardFlash
+TYPE: bool
+VERSION: 3.1.1
+DEFAULT: false
+--DESCRIPTION--
+<p>
+ Custom class that takes all the stuff in object tags and rewrites it to a new format
+</p>
diff --git a/library/HTMLPurifier/Generator.php b/library/HTMLPurifier/Generator.php
index d4c42fb..ba37316 100644
--- a/library/HTMLPurifier/Generator.php
+++ b/library/HTMLPurifier/Generator.php
@@ -120,6 +120,15 @@ class HTMLPurifier_Generator
} elseif ($token instanceof HTMLPurifier_Token_Comment) {
return '<!--' . $token->data . '-->';
+ } elseif ($token instanceof HTMLPurifier_Token_Span) {
+ $input_data = $token->attr["data"];
+ $input_width = $token->attr["width"];
+ $input_height = $token->attr["height"];
+ $input_movie = $token->attr["movie"];
+ $input_flashvars = $token->attr["flashvars"];
+
+ return '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'.$input_width.'" height="'.$input_height.'"><param name="movie" value="'.$input_movie.'" /><param name="flashvars" value="'.$input_flashvars.'" /><!--[if !IE]>--><object type="application/x-shockwave-flash" data="'.$input_data.'" width="'.$input_width.'" height="'.$input_height.'"><param name="flashvars" value="'.$input_flashvars.'" /></object><!--<![endif]--></object>';
+
} else {
return '';
diff --git a/library/HTMLPurifier/HTMLModule/StandardFlash.php b/library/HTMLPurifier/HTMLModule/StandardFlash.php
new file mode 100644
index 0000000..ab16660
--- /dev/null
+++ b/library/HTMLPurifier/HTMLModule/StandardFlash.php
@@ -0,0 +1,28 @@
+<?php
+
+class HTMLPurifier_HTMLModule_StandardFlash extends HTMLPurifier_HTMLModule
+{
+
+ public $name = 'StandardFlash';
+
+ public function setup($config) {
+
+ $object = $this->addElement(
+ 'object',
+ 'Inline',
+ 'Optional: param | Flow | #PCDATA',
+ 'Common'
+ );
+
+ $embed = $this->addElement(
+ 'embed', 'Inline', 'Empty', 'Common'
+ );
+
+ $param = $this->addElement('param', false, 'Empty', false
+ );
+
+ $this->info_injector[] = 'StandardFlash';
+
+ }
+
+}
diff --git a/library/HTMLPurifier/HTMLModuleManager.php b/library/HTMLPurifier/HTMLModuleManager.php
index 63e0ebf..a1a2fc2 100644
--- a/library/HTMLPurifier/HTMLModuleManager.php
+++ b/library/HTMLPurifier/HTMLModuleManager.php
@@ -230,6 +230,10 @@ class HTMLPurifier_HTMLModuleManager
$modules[] = 'SafeEmbed';
}
+ if ($config->get('HTML', 'StandardFlash')) {
+ $modules[] = 'StandardFlash';
+ }
+
// merge in custom modules
$modules = array_merge($modules, $this->userModules);
diff --git a/library/HTMLPurifier/Injector/StandardFlash.php b/library/HTMLPurifier/Injector/StandardFlash.php
new file mode 100644
index 0000000..fe8cabb
--- /dev/null
+++ b/library/HTMLPurifier/Injector/StandardFlash.php
@@ -0,0 +1,102 @@
+<?php
+
+/**
+ * changes objects to a standard object
+ */
+class HTMLPurifier_Injector_StandardFlash extends HTMLPurifier_Injector
+{
+ //kept this stuff in here, not sure what it does
+ public $name = 'StandardFlash';
+ public $needed = array('object', 'param', 'embed');
+
+ protected $attribs_and_params = array();
+
+ protected $depth = 0;
+
+ protected $from_a_rewind = 0;
+
+ public function prepare($config, $context) {
+ parent::prepare($config, $context);
+ }
+
+ public function handleText(&$token) {
+ //if in an object, remove the text tokens
+ if($this->depth > 0){
+ $token = array();
+ }
+ return;
+ }
+
+ public function handleElement(&$token) {
+
+ //this was called from a rewind (it is a start tag adjacent to the end tag)
+ if($this->from_a_rewind ==1){
+ $this->from_a_rewind = 0;
+ //if this is not the original object, delete it
+ if($this->depth > 0){
+ //echo ' DELETE';
+ $token = 2;
+ }else{
+ //if this is the original object, convert it
+ $token = new HTMLPurifier_Token_Span($this->attribs_and_params);
+ }
+ return;
+ }
+
+ //if a first embed
+ if($this->depth == 0 && $token->name == 'embed' && $token instanceof HTMLPurifier_Token_Empty){
+ $this->attribs_and_params = array();
+ $this->attribs_and_params["movie"] = $token->attr['src'];
+ $this->attribs_and_params["data"] = $token->attr['src'];
+ $this->attribs_and_params["width"] = $token->attr['width'];
+ $this->attribs_and_params["height"] = $token->attr['height'];
+ $this->attribs_and_params["flashvars"] = $token->attr['flashvars'];
+
+ $token = new HTMLPurifier_Token_Span($this->attribs_and_params);
+
+ return;
+ }
+
+ //if a first object
+ if($this->depth == 0 && $token->name == 'object' && $token instanceof HTMLPurifier_Token_Start){
+ //now in an object
+ $this->depth++;
+ //remove the old attribs_and_params
+ $this->attribs_and_params = array();
+ //get the attribs
+ $this->attribs_and_params["data"] = $token->attr['data'];
+ $this->attribs_and_params["width"] = $token->attr['width'];
+ $this->attribs_and_params["height"] = $token->attr['height'];
+
+ }elseif($this->depth == 1 && $token->name == 'param'){
+ //1st level param, store and delete
+ if($token->attr['name'] == 'movie' || $token->attr['name'] == 'flashvars'){
+ $this->attribs_and_params[$token->attr['name']] = $token->attr['value'];
+ }
+ $token = array();
+ }elseif($this->depth > 0 && $token instanceof HTMLPurifier_Token_Start){
+ //a nested start tag, increase depth
+
+ $this->depth++;
+ }elseif($this->depth > 0){
+ //anything else, delete
+ $token = array();
+ }
+
+ return;
+
+ }
+
+ public function handleEnd(&$token) {
+ //if we are inside an object and hit an end tag, go to the corresponding start tag via rewind
+ if($this->depth > 0 ){
+ $this->depth--;
+ //echo 'rewind'.(($this->inputIndex)-1);
+ $this->from_a_rewind = 1;
+ $this->rewind((($this->inputIndex)-1));
+ }
+ return;
+ }
+
+}
+
diff --git a/library/HTMLPurifier/Token.php b/library/HTMLPurifier/Token.php
index 942a61d..2448fbb 100644
--- a/library/HTMLPurifier/Token.php
+++ b/library/HTMLPurifier/Token.php
@@ -29,6 +29,7 @@ class HTMLPurifier_Token {
case 'HTMLPurifier_Token_End': return 'end';
case 'HTMLPurifier_Token_Text': return 'text';
case 'HTMLPurifier_Token_Comment': return 'comment';
+ case 'HTMLPurifier_Token_Span': return 'span';
default: return null;
}
}
diff --git a/library/HTMLPurifier/Token/Span.php b/library/HTMLPurifier/Token/Span.php
new file mode 100644
index 0000000..c254017
--- /dev/null
+++ b/library/HTMLPurifier/Token/Span.php
@@ -0,0 +1,32 @@
+<?php
+
+/**
+ * Abstract class of a span token (start, end or empty), and its behavior.
+ */
+class HTMLPurifier_Token_Span extends HTMLPurifier_Token
+{
+ public $name = '#PCDATA'; /**< PCDATA tag name compatible with DTD. */
+ public $attr = array(); /**< Parsed character data of text. */
+
+ /**
+ * Constructor, accepts data and determines if it is whitespace.
+ *
+ * @param $data String parsed character data.
+ */
+ public function __construct($attr = array(), $line = null) {
+ foreach ($attr as $key => $value) {
+ // normalization only necessary when key is not lowercase
+ if (!ctype_lower($key)) {
+ $new_key = strtolower($key);
+ if (!isset($attr[$new_key])) {
+ $attr[$new_key] = $attr[$key];
+ }
+ if ($new_key !== $key) {
+ unset($attr[$key]);
+ }
+ }
+ }
+ $this->attr = $attr;
+ $this->line = $line;
+ }
+}
diff --git a/library/HTMLPurifier/TokenFactory.php b/library/HTMLPurifier/TokenFactory.php
index bff693f..de3d65e 100644
--- a/library/HTMLPurifier/TokenFactory.php
+++ b/library/HTMLPurifier/TokenFactory.php
@@ -19,7 +19,7 @@ class HTMLPurifier_TokenFactory
* @private
*/
// p stands for prototype
- private $p_start, $p_end, $p_empty, $p_text, $p_comment;
+ private $p_start, $p_end, $p_empty, $p_text, $p_comment, $p_span;
/**
* Generates blank prototypes for cloning.
@@ -30,6 +30,7 @@ class HTMLPurifier_TokenFactory
$this->p_empty = new HTMLPurifier_Token_Empty('', array());
$this->p_text = new HTMLPurifier_Token_Text('');
$this->p_comment= new HTMLPurifier_Token_Comment('');
+ $this->p_span= new HTMLPurifier_Token_Span(array());
}
/**
@@ -89,5 +90,11 @@ class HTMLPurifier_TokenFactory
return $p;
}
+ public function createSpan($attr = array()) {
+ $p = clone $this->p_span;
+ $p->__construct($attr);
+ return $p;
+ }
+
}
--
1.6.0.2
|
iflores
Re: Trying to allow param 'flashvars' in object/embedMay 13, 2009 11:14AM |
Hello ,this code allow to insert youtube video :
global $charset;
$config = HTMLPurifier_Config::createDefault();
$config->set('Core', 'Encoding',$charset);
$config->set('HTML', 'Doctype', 'XHTML 1.0 Transitional');
if ($user_status==STUDENT) {
global $tag_student,$attribute_student;//$tag_student
$config->set('HTML', 'SafeEmbed',true);
$config->set('Filter', 'YouTube', true);
$config->set('HTML', 'AllowedElements',$tag_student);//'a,em,blockquote,p,code,pre,strong,b,img,span'
$config->set('HTML', 'AllowedAttributes',$attribute_student);//'a.href,a.title,img.src'
} elseif ($user_status==COURSEMANAGER) {
global $tag_teacher,$attribute_teacher;
$config->set('HTML', 'SafeEmbed',true);
$config->set('Filter', 'YouTube', true);
$config->set('HTML', 'AllowedElements',$tag_teacher);
$config->set('HTML', 'AllowedAttributes', $attribute_teacher);//'a.href,a.title,img.src'
} else {
global $tag_anonymous,$attribute_anonymous;
$config->set('HTML', 'AllowedElements', $tag_anonymous);
$config->set('HTML', 'AllowedAttributes',$attribute_anonymous);//'a.href,a.title,img.src'
}
$config->set('HTML', 'TidyLevel', 'light');
$this->config = HTMLPurifier_Config::create($config);
$this->strategy = new HTMLPurifier_Strategy_Core();
Edited 1 time(s). Last edit at 05/13/2009 01:07PM by Ambush Commander.
|
rocker
Re: Trying to allow param 'flashvars' in object/embedMarch 03, 2010 09:35AM |
|
Re: Trying to allow param 'flashvars' in object/embed March 03, 2010 11:37AM |
Admin Registered: 6 years ago Posts: 2,652 |
|
rocker
Re: Trying to allow param 'flashvars' in object/embedMarch 03, 2010 03:08PM |
|
Re: Trying to allow param 'flashvars' in object/embed March 07, 2010 09:42PM |
Admin Registered: 6 years ago Posts: 2,652 |
|
Re: Trying to allow param 'flashvars' in object/embed March 08, 2010 02:04AM |
Admin Registered: 6 years ago Posts: 2,652 |
I'm happy to report that a solution has hit the HTML Purifier development branch! You can check out the code from http://repo.or.cz/w/htmlpurifier.git and you can enable it using this code:
<pre><![CDATA[ $config->set('HTML.SafeObject', true); $config->set('Output.FlashCompat', true); ]]></pre>
If you were using %HTML.SafeEmbed, that code is no longer necessary and you should disable it. Please let me know if there are any bugs!
|
c
Re: Trying to allow param 'flashvars' in object/embedApril 14, 2010 05:10PM |
If you were using %HTML.SafeEmbed, that code is no longer necessary and you should disable it. Please let me know if there are any bugs!
so, basically this means that flashvars are only allowed for object and not for embed, right?
|
Re: Trying to allow param 'flashvars' in object/embed April 16, 2010 05:53PM |
Admin Registered: 6 years ago Posts: 2,652 |
|
jwaldek
Re: Trying to allow param 'flashvars' in object/embedApril 26, 2010 05:17AM |
when we can expect new stable version of htmlpurifier with "Output.FlashCompat" and all these object/embed features?
i'm testing the latest development version http://repo.or.cz/w/htmlpurifier.git with youtube code and google maps code and it works good but i need Standalone version for CMS.
|
Re: Trying to allow param 'flashvars' in object/embed April 26, 2010 11:46AM |
Admin Registered: 6 years ago Posts: 2,652 |