Răsfoiți Sursa

Allow video tag

jmontoyaa 7 ani în urmă
părinte
comite
db815152d6

+ 13 - 0
main/inc/lib/formvalidator/Rule/allowed_tags.inc.php

@@ -304,6 +304,19 @@ $allowed_tags_student['embed']['allowscriptaccess'] = array();
 //$allowed_tags_student['embed']['bgcolor'] = array();
 //$allowed_tags_student['embed']['pluginspage'] = array();
 
+
+// embed
+$allowed_tags_student['video'] = array();
+$allowed_tags_student['video']['height'] = array();
+$allowed_tags_student['video']['width'] = array();
+$allowed_tags_student['video']['type'] = array();
+$allowed_tags_student['video']['poster'] = array();
+$allowed_tags_student['video']['preload'] = array();
+$allowed_tags_student['video']['src'] = array();
+$allowed_tags_student['video']['controls'] = array();
+$allowed_tags_student['video']['id'] = array();
+
+
 // font
 $allowed_tags_student['font'] = array();
 $allowed_tags_student['font']['face'] = array();

+ 27 - 0
main/inc/lib/security.lib.php

@@ -315,6 +315,7 @@ class Security
                 $config->set('Filter.Custom', array(new AllowIframes()));
             }
 
+
             // Shows _target attribute in anchors
             $config->set('Attr.AllowedFrameTargets', array('_blank', '_top', '_self', '_parent'));
 
@@ -355,6 +356,32 @@ class Security
                 'data' => true,
             ));
 
+            // Allow <video> tag
+            //$config->set('HTML.Doctype', 'HTML 4.01 Transitional');
+            $config->set('HTML.SafeIframe', true);
+
+            // Set some HTML5 properties
+            $config->set('HTML.DefinitionID', 'html5-definitions'); // unqiue id
+            $config->set('HTML.DefinitionRev', 1);
+            if ($def = $config->maybeGetRawHTMLDefinition()) {
+                // http://developers.whatwg.org/the-video-element.html#the-video-element
+                $def->addElement(
+                    'video',
+                    'Block',
+                    'Optional: (source, Flow) | (Flow, source) | Flow',
+                    'Common',
+                    array(
+                        'src'      => 'URI',
+                        'type'     => 'Text',
+                        'width'    => 'Length',
+                        'height'   => 'Length',
+                        'poster'   => 'URI',
+                        'preload'  => 'Enum#auto,metadata,none',
+                        'controls' => 'Bool',
+                    )
+                );
+            }
+
             $purifier[$user_status] = new HTMLPurifier($config);
         }