]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Refs #1086: Deprecating kses and removing it from core. Version bump.
authormarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>
Wed, 1 Jul 2009 17:13:23 +0000 (17:13 +0000)
committermarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>
Wed, 1 Jul 2009 17:13:23 +0000 (17:13 +0000)
git-svn-id: https://code.elgg.org/elgg/trunk@3376 36083f99-b078-4883-b0ff-0f9b5a30f544

22 files changed:
engine/lib/upgrades/2009070101.php [new file with mode: 0644]
mod/kses/manifest.xml [deleted file]
mod/kses/start.php [deleted file]
mod/kses/vendors/kses/AUTHORS [deleted file]
mod/kses/vendors/kses/COPYING [deleted file]
mod/kses/vendors/kses/ChangeLog [deleted file]
mod/kses/vendors/kses/README [deleted file]
mod/kses/vendors/kses/TODO [deleted file]
mod/kses/vendors/kses/docs/attribute-value-checks [deleted file]
mod/kses/vendors/kses/docs/hooks [deleted file]
mod/kses/vendors/kses/docs/stripping-everything [deleted file]
mod/kses/vendors/kses/docs/supported-formats [deleted file]
mod/kses/vendors/kses/docs/whitelisted-url-protocols [deleted file]
mod/kses/vendors/kses/examples/filter.php [deleted file]
mod/kses/vendors/kses/examples/test.php [deleted file]
mod/kses/vendors/kses/kses.php [deleted file]
mod/kses/vendors/kses/oop/oop.kses.changelog.txt [deleted file]
mod/kses/vendors/kses/oop/oop.simple.api.txt [deleted file]
mod/kses/vendors/kses/oop/php4.class.kses.php [deleted file]
mod/kses/vendors/kses/oop/php5.class.kses.php [deleted file]
mod/kses/vendors/kses/oop/test.oop.kses.php [deleted file]
version.php

diff --git a/engine/lib/upgrades/2009070101.php b/engine/lib/upgrades/2009070101.php
new file mode 100644 (file)
index 0000000..edd8ce4
--- /dev/null
@@ -0,0 +1,11 @@
+<?php
+
+       global $CONFIG;
+       
+       /// Deprecate kses and activate htmlawed
+       /**
+        * Kses appears to be a dead project so we are deprecating it in favour of htmlawed.
+        */     
+       disable_plugin('kses', $CONFIG->site->guid);
+       enable_plugin('htmlawed', $CONFIG->site->guid);
+?>
\ No newline at end of file
diff --git a/mod/kses/manifest.xml b/mod/kses/manifest.xml
deleted file mode 100644 (file)
index 4457b22..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<plugin_manifest>
-       <field key="author" value="Curverider Ltd" />
-       <field key="version" value="1.5" />
-       <field key="description" value="Provide tag filtering for user input (highly recommended)." />
-       <field key="website" value="http://www.elgg.org/" />
-       <field key="copyright" value="(C) Curverider 2008-2009" />
-       <field key="licence" value="GNU Public License version 2" />
-       <field key="elgg_version" value="2009041701" />
-</plugin_manifest>
\ No newline at end of file
diff --git a/mod/kses/start.php b/mod/kses/start.php
deleted file mode 100644 (file)
index ed8a12e..0000000
+++ /dev/null
@@ -1,304 +0,0 @@
-<?php
-       /**
-        * Elgg kses tag filtering.
-        * 
-        * @package ElggKses
-        * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
-        * @author Curverider Ltd
-        * @copyright Curverider Ltd 2008-2009
-        * @link http://elgg.com/
-        */
-
-       /**
-        * Initialise kses
-        *
-        */
-       function kses_init()
-       {
-               /** For now declare allowed tags and protocols here, TODO: Make this configurable */
-               global $CONFIG;
-               $CONFIG->kses_allowedtags = array(
-               'address' => array(),
-               'a' => array(
-                       'class' => array (),
-                       'href' => array (),
-                       'id' => array (),
-                       'title' => array (),
-                       'rel' => array (),
-                       'rev' => array (),
-                       'name' => array (),
-                       'target' => array()),
-               'abbr' => array(
-                       'class' => array (),
-                       'title' => array ()),
-               'acronym' => array(
-                       'title' => array ()),
-               'b' => array(),
-               'big' => array(),
-               'blockquote' => array(
-                       'id' => array (),
-                       'cite' => array (),
-                       'class' => array(),
-                       'lang' => array(),
-                       'xml:lang' => array()),
-               'br' => array (
-                       'class' => array ()),
-               'button' => array(
-                       'disabled' => array (),
-                       'name' => array (),
-                       'type' => array (),
-                       'value' => array ()),
-               'caption' => array(
-                       'align' => array (),
-                       'class' => array ()),
-               'cite' => array (
-                       'class' => array(),
-                       'dir' => array(),
-                       'lang' => array(),
-                       'title' => array ()),
-               'code' => array (),
-//                     'style' => array()),
-//             'col' => array(
-//                     'align' => array (),
-//                     'char' => array (),
-//                     'charoff' => array (),
-//                     'span' => array (),
-//                     'dir' => array(),
-//                     'style' => array (),
-//                     'valign' => array (),
-//                     'width' => array ()),
-               'del' => array(
-                       'datetime' => array ()),
-               'dd' => array(),
-               'div' => array(
-                       'align' => array (),
-                       'class' => array (),
-                       'dir' => array (),
-                       'lang' => array(),
-//                     'style' => array (),
-                       'xml:lang' => array()),
-               'dl' => array(),
-               'dt' => array(),
-               'em' => array(),
-//             'fieldset' => array(),
-               'font' => array(
-                       'color' => array (),
-                       'face' => array (),
-                       'size' => array ()),
-//             'form' => array(
-//                     'action' => array (),
-//                     'accept' => array (),
-//                     'accept-charset' => array (),
-//                     'enctype' => array (),
-//                     'method' => array (),
-//                     'name' => array (),
-//                     'target' => array ()),
-               'h1' => array(
-                       'align' => array (),
-                       'class' => array ()),
-               'h2' => array(
-                       'align' => array (),
-                       'class' => array ()),
-               'h3' => array(
-                       'align' => array (),
-                       'class' => array ()),
-               'h4' => array(
-                       'align' => array (),
-                       'class' => array ()),
-               'h5' => array(
-                       'align' => array (),
-                       'class' => array ()),
-               'h6' => array(
-                       'align' => array (),
-                       'class' => array ()),
-               'hr' => array(
-                       'align' => array (),
-                       'class' => array (),
-                       'noshade' => array (),
-                       'size' => array (),
-                       'width' => array ()),
-               'i' => array(),
-               'img' => array(
-                       'alt' => array (),
-                       'align' => array (),
-                       'border' => array (),
-                       'class' => array (),
-                       'height' => array (),
-                       'hspace' => array (),
-                       'longdesc' => array (),
-                       'vspace' => array (),
-                       'src' => array (),
-//                     'style' => array (),
-                       'width' => array ()),
-               'ins' => array(
-                       'datetime' => array (),
-                       'cite' => array ()),
-               'kbd' => array(),
-               'label' => array(
-                       'for' => array ()),
-               'legend' => array(
-                       'align' => array ()),
-               'li' => array (
-                       'align' => array (),
-                       'class' => array ()),
-               'p' => array(
-                       'class' => array (),
-                       'align' => array (),
-                       'dir' => array(),
-                       'lang' => array(),
-//                     'style' => array (),
-                       'xml:lang' => array()),
-               'pre' => array(
-//                     'style' => array(),
-                       'width' => array ()),
-               'q' => array(
-                       'cite' => array ()),
-               's' => array(),
-               'span' => array (
-                       'class' => array (),
-                       'dir' => array (),
-                       'align' => array (),
-                       'lang' => array (),
-//                     'style' => array (),
-                       'title' => array (),
-                       'xml:lang' => array()),
-               'strike' => array(),
-               'strong' => array(),
-               'sub' => array(),
-               'sup' => array(),
-//             'table' => array(
-//                     'align' => array (),
-//                     'bgcolor' => array (),
-//                     'border' => array (),
-//                     'cellpadding' => array (),
-//                     'cellspacing' => array (),
-//                     'class' => array (),
-//                     'dir' => array(),
-//                     'id' => array(),
-//                     'rules' => array (),
-//                     'style' => array (),
-//                     'summary' => array (),
-//                     'width' => array ()),
-//             'tbody' => array(
-//                     'align' => array (),
-//                     'char' => array (),
-//                     'charoff' => array (),
-//                     'valign' => array ()),
-//             'td' => array(
-//                     'abbr' => array (),
-//                     'align' => array (),
-//                     'axis' => array (),
-//                     'bgcolor' => array (),
-//                     'char' => array (),
-//                     'charoff' => array (),
-//                     'class' => array (),
-//                     'colspan' => array (),
-//                     'dir' => array(),
-//                     'headers' => array (),
-//                     'height' => array (),
-//                     'nowrap' => array (),
-//                     'rowspan' => array (),
-//                     'scope' => array (),
-//                     'style' => array (),
-//                     'valign' => array (),
-//                     'width' => array ()),
-//             'textarea' => array(
-//                     'cols' => array (),
-//                     'rows' => array (),
-//                     'disabled' => array (),
-//                     'name' => array (),
-//                     'readonly' => array ()),
-//             'tfoot' => array(
-//                     'align' => array (),
-//                     'char' => array (),
-//                     'class' => array (),
-//                     'charoff' => array (),
-//                     'valign' => array ()),
-//             'th' => array(
-//                     'abbr' => array (),
-//                     'align' => array (),
-//                     'axis' => array (),
-//                     'bgcolor' => array (),
-//                     'char' => array (),
-//                     'charoff' => array (),
-//                     'class' => array (),
-//                     'colspan' => array (),
-//                     'headers' => array (),
-//                     'height' => array (),
-//                     'nowrap' => array (),
-//                     'rowspan' => array (),
-//                     'scope' => array (),
-//                     'valign' => array (),
-//                     'width' => array ()),
-//             'thead' => array(
-//                     'align' => array (),
-//                     'char' => array (),
-//                     'charoff' => array (),
-//                     'class' => array (),
-//                     'valign' => array ()),
-               'title' => array(),
-//             'tr' => array(
-//                     'align' => array (),
-//                     'bgcolor' => array (),
-//                     'char' => array (),
-//                     'charoff' => array (),
-//                     'class' => array (),
-//                     'style' => array (),
-//                     'valign' => array ()),
-               'tt' => array(),
-               'u' => array(),
-               'ul' => array (
-                       'class' => array (),
-//                     'style' => array (),
-                       'type' => array ()),
-               'ol' => array (
-                       'class' => array (),
-                       'start' => array (),
-//                     'style' => array (),
-                       'type' => array ()),
-               'var' => array ());
-               
-               $CONFIG->kses_allowedprotocols = array('http', 'https', 'ftp', 'news', 'mailto', 'rtsp', 'teamspeak', 'gopher', 'mms',
-                           'color', 'callto', 'cursor', 'text-align', 'font-size', 'font-weight', 'font-style', 
-                           'border', 'margin', 'padding', 'float');
-               
-               register_plugin_hook('validate', 'input', 'kses_filter_tags', 1);
-       }
-       
-       /**
-        * Kses filtering of tags, called on a plugin hook
-        *
-        * @param mixed $var Variable to filter
-        * @return mixed
-        */
-       function kses_filter_tags($hook, $entity_type, $returnvalue, $params)
-       {
-               $return = $returnvalue;
-               $var = $returnvalue;
-               
-               if (@include_once(dirname(__FILE__) . "/vendors/kses/kses.php")) {
-                       
-                       global $CONFIG;
-                       
-                       $allowedtags = $CONFIG->kses_allowedtags; 
-                       $allowedprotocols = $CONFIG->kses_allowedprotocols;
-                       
-                       if (!is_array($var)) {
-                               $return = "";
-                               $return = kses($var, $allowedtags, $allowedprotocols);
-                       } else {
-                               $return = array();
-                               
-                               foreach($var as $key => $el) {
-                                       $return[$key] = kses($el, $allowedtags, $allowedprotocols);
-                               }
-                       }
-               }
-       
-               return $return;
-       }
-       
-       
-       register_elgg_event_handler('init','system','kses_init');
-        
-?>
\ No newline at end of file
diff --git a/mod/kses/vendors/kses/AUTHORS b/mod/kses/vendors/kses/AUTHORS
deleted file mode 100644 (file)
index 2e03409..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-kses AUTHORS
-============
-
-* Ulf Harnhammar (main coder, project leader)
-  metaur at users dot sourceforge dot net
-  http://www.advogato.org/person/metaur/
-
-* Richard R. Vásquez, Jr. (coder of object-oriented kses)
-  contact him at http://chaos.org/contact/
-
-
-THANKS TO
-=========
-
-* Peter Valach (code review and feature suggestions)
-* Simon Cornelius P. Umacob (testing)
-* unitedhacker2000@yahoo.com (bug report)
-* Dirk Haun (feature suggestion)
-* Hendy Irawan (bug report and documentation suggestion)
-* dude21 (feature suggestion)
-* Christian Bolstad (documentation suggestion)
-* SourceForge (project hosting)
-
-Thanks also go to a lot of people who posted to the Bugtraq and
-Webappsec mailing lists about XSS or HTML filters. They gave us some
-valuable insights.
diff --git a/mod/kses/vendors/kses/COPYING b/mod/kses/vendors/kses/COPYING
deleted file mode 100644 (file)
index d60c31a..0000000
+++ /dev/null
@@ -1,340 +0,0 @@
-                   GNU GENERAL PUBLIC LICENSE
-                      Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
-     59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-                           Preamble
-
-  The licenses for most software are designed to take away your
-freedom to share and change it.  By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users.  This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it.  (Some other Free Software Foundation software is covered by
-the GNU Library General Public License instead.)  You can apply it to
-your programs, too.
-
-  When we speak of free software, we are referring to freedom, not
-price.  Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
-  To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
-  For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have.  You must make sure that they, too, receive or can get the
-source code.  And you must show them these terms so they know their
-rights.
-
-  We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
-  Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software.  If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
-  Finally, any free program is threatened constantly by software
-patents.  We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary.  To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
-  The precise terms and conditions for copying, distribution and
-modification follow.
-\f
-                   GNU GENERAL PUBLIC LICENSE
-   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
-  0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License.  The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language.  (Hereinafter, translation is included without limitation in
-the term "modification".)  Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope.  The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
-  1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
-  2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
-    a) You must cause the modified files to carry prominent notices
-    stating that you changed the files and the date of any change.
-
-    b) You must cause any work that you distribute or publish, that in
-    whole or in part contains or is derived from the Program or any
-    part thereof, to be licensed as a whole at no charge to all third
-    parties under the terms of this License.
-
-    c) If the modified program normally reads commands interactively
-    when run, you must cause it, when started running for such
-    interactive use in the most ordinary way, to print or display an
-    announcement including an appropriate copyright notice and a
-    notice that there is no warranty (or else, saying that you provide
-    a warranty) and that users may redistribute the program under
-    these conditions, and telling the user how to view a copy of this
-    License.  (Exception: if the Program itself is interactive but
-    does not normally print such an announcement, your work based on
-    the Program is not required to print an announcement.)
-\f
-These requirements apply to the modified work as a whole.  If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works.  But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
-  3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
-    a) Accompany it with the complete corresponding machine-readable
-    source code, which must be distributed under the terms of Sections
-    1 and 2 above on a medium customarily used for software interchange; or,
-
-    b) Accompany it with a written offer, valid for at least three
-    years, to give any third party, for a charge no more than your
-    cost of physically performing source distribution, a complete
-    machine-readable copy of the corresponding source code, to be
-    distributed under the terms of Sections 1 and 2 above on a medium
-    customarily used for software interchange; or,
-
-    c) Accompany it with the information you received as to the offer
-    to distribute corresponding source code.  (This alternative is
-    allowed only for noncommercial distribution and only if you
-    received the program in object code or executable form with such
-    an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it.  For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable.  However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-\f
-  4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License.  Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
-  5. You are not required to accept this License, since you have not
-signed it.  However, nothing else grants you permission to modify or
-distribute the Program or its derivative works.  These actions are
-prohibited by law if you do not accept this License.  Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
-  6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions.  You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
-  7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License.  If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all.  For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices.  Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-\f
-  8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded.  In such case, this License incorporates
-the limitation as if written in the body of this License.
-
-  9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time.  Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number.  If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation.  If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
-  10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission.  For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this.  Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
-                           NO WARRANTY
-
-  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
-  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
-                    END OF TERMS AND CONDITIONS
-\f
-           How to Apply These Terms to Your New Programs
-
-  If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
-  To do so, attach the following notices to the program.  It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-    <one line to give the program's name and a brief idea of what it does.>
-    Copyright (C) <year>  <name of author>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
-    Gnomovision version 69, Copyright (C) year  name of author
-    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
-    This is free software, and you are welcome to redistribute it
-    under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License.  Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary.  Here is a sample; alter the names:
-
-  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
-  `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
-  <signature of Ty Coon>, 1 April 1989
-  Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs.  If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library.  If this is what you want to do, use the GNU Library General
-Public License instead of this License.
diff --git a/mod/kses/vendors/kses/ChangeLog b/mod/kses/vendors/kses/ChangeLog
deleted file mode 100644 (file)
index 7102396..0000000
+++ /dev/null
@@ -1,168 +0,0 @@
-kses ChangeLog
-==============
-
-* 0.2.2 and 0.2.2-rc1
-
-0.2.2 was released on the 7th of February 2005. We also had a release
-candidate, 0.2.2-rc1, that was released on the 30th of January 2005.
-
-I (Ulf) am sorry for this long delay, but I lost interest in kses for a
-while and worked on auditing C/C++ code for buffer overflows and format
-string bugs in the Debian Security Audit Project instead
-( http://www.debian.org/security/audit/ ).
-
-This version has the following changes:
-
-- Richard contributed an additional object-oriented kses version for
-  PHP 5, which takes advantage of that PHP version's improved object
-  orientation. You can find it in the oop/ directory.
-
-- Richard added RemoveProtocol(), RemoveProtocols() and SetProtocols()
-  methods to both object-oriented kses versions. This closes SourceForge
-  bug #892477.
-
-- Richard also did other smaller changes to the object-oriented kses
-  versions. See oop/oop.kses.changelog.txt for the gory details.
-
-- The code that checks whether used elements and attributes are allowed
-  now uses isset() to avoid notices under certain configurations. This
-  hopefully closes SourceForge bug #918493.
-
-- The check for the Opera extra whitespace character #173 was moved so
-  it only affects attribute values and nothing else. This is helpful for
-  Asian kses users, who use that character in writing. (This is just a
-  temporary solution. A better one will show up in the next version, when
-  the parser is rewritten.) This closes SourceForge bug #834645, kind of.
-
-- Now the program will not even look at attributes and closing XHTML
-  slashes for closing HTML elements. This will make kses execute faster
-  and it won't accept atrocities like </br /> anymore.
-
-- Moved references in examples/test.php from function calls to the function
-  definition, making it better PHP.
-
-- The output of examples/test.php and examples/filter.php now conform fully
-  to W3C's HTML specification.
-
-- From now on, kses releases will be distributed both as .tar.gz and .zip
-  archives to please our Wintendo users. This closes SourceForge feature
-  request #900380.
-
-- Changed to new copyright year and paper mail address.
-
-
-* 0.2.1
-
-0.2.1 was released on the 29th of September 2003.
-It has the following changes:
-
-
-- There is now an additional version of kses, using the object-oriented
-  paradigm. Thanks a lot to Richard R. Vasquez, Jr., who created it! Anyone
-  who wants to make functional programming, logical programming or spaghetti
-  programming versions of kses as well (or any other programming paradigm that
-  you like), go ahead! All the people who like old procedural programming for
-  web applications shouldn't despair, though, as both versions will be
-  maintained with each release.
-
-- kses now has some new attribute value checks: minlen, minval and valueless.
-  See docs/attribute-value-checks for an explanation.
-
-- For some reason, the Opera developers decided to make chr(173) a whitespace
-  character in URL protocols, both when it occurs raw and in an entity. kses
-  now handles this.
-
-- The URL protocol whitelisting system now decodes entities before removing
-  NULLs and whitespaces.
-
-
-* 0.2.0
-
-0.2.0 was released on the 25th of July 2003.
-It has the following changes:
-
-
-- kses now supports checking of attribute values, and not just element names
-  and attribute names. The attribute value checks that exist so far are
-  'maxlen' (checks how long attribute values are, to avoid Buffer Overflows)
-  and 'maxval' (checks how big an integer value is, to avoid Denial of Service
-  attacks).
-
-  Buffer Overflows could both be a problem for WWW clients and different
-  servers on the Internet that an HTML document links to. One example is
-  <frame src="ftp://ftp.v1ct1m.com/AAAAAA..thousands_of_A's...">.
-
-  Denial of Service attacks can take the form of too big sizes of iframes or
-  other things. One example is <iframe src="http://some.web.server/"
-  width="20000" height="2000">, which makes some client machines completely
-  overloaded.
-
-- kses' old feature of removing "javascript:" from attribute values has been
-  improved. It now has a whole system for white listing of URL protocols, so
-  you can specify that it's acceptable with http:, https:, ftp: and gopher:,
-  but no other protocols in attribute values. The system tries pretty hard to
-  do the right thing with whitespace, upper/lower case, HTML entities
-  ("jav&#97;script:") and repeated entries ("javascript:javascript:alert(57)").
-
-- kses now supports both HTML and XHTML code, by allowing " /" at the end of
-  tags.
-
-- kses now removes Netscape 4's JavaScript entities, having the form
-  "&{alert(57)};". They don't even seem to work on all versions of Netscape 4,
-  but for completeness' sake it seemed like a good feature to add.
-
-- A bug with NULLs in javascript: URLs was fixed.
-  (Reported by Simon Cornelius P. Umacob - thanks!)
-
-- As a nice side effect of the white listing of URL protocols, kses now also
-  normalizes all HTML entities in documents. It will change HTML code with bad
-  entities to the right form, for example "AT&T" will be converted to
-  "AT&amp;T" and "<a href='lyrics.php?band=ladytron&lyrics=playgirl'>" will be
-  converted to "<a href='lyrics.php?band=ladytron&amp;lyrics=playgirl'>".
-  "&#000058;" will be converted to "&#58;", "&#XYZZY;" will be converted to
-  "&amp;#XYZZY;", "&auml!;" will be converted to "&amp;auml!;" and so on.
-
-  As shown above, it will process HTML entities that it doesn't understand.
-  It will also deal with too big numbers in numeric HTML entities, which is
-  helpful as many browsers seem to wrap them around at 2 ** 32, so the
-  characters 58, 58 + (2 ** 32), 58 + (2 ** 64) etcetera are all colons to the
-  web browser.
-
-- You can now use upper case letters in your $allowed_html array, in element
-  names, attribute names and attribute value check names. Version 0.1.0
-  required everything in that array to be in lower case, but that's not
-  necessary any more. You can also use upper case letters in
-  $allowed_protocols.
-
-- The "Really malformed thing" bug from the TODO file was fixed.
-  It used to convert this string:
-  x > 5 <a href="blah">
-  to:
-  x &gt; 5 &lt;a href=&quot;blah&quot;&gt;
-  and now it converts it to:
-  x &gt; 5 <a href="blah">
-
-- The "Weird malformed thing" bug from the TODO file was fixed.
-  It used to convert this string:
-  <a href="5 href=6>
-  to:
-  <a href="6">
-  because of the way kses restarts after a parse error in kses_hair(). Now it
-  converts it to:
-  <a>
-
-- A problem with slashes in HTML tags was fixed.
-
-- examples/filter.php used to use $SCRIPT_NAME, which doesn't work on
-  Windows.
-  (Reported by Simon Cornelius P. Umacob - thanks!)
-
-- kses now allows dashes in attribute names, for things like
-  <meta http-equiv=..>.
-
-
-* 0.1.0, first public version
-
-0.1.0 was released on the 9th of June 2003.
-It was announced on three security related mailing lists on Friday the 13th
-of June (nothing bad happened to it though).
diff --git a/mod/kses/vendors/kses/README b/mod/kses/vendors/kses/README
deleted file mode 100644 (file)
index 192524c..0000000
+++ /dev/null
@@ -1,206 +0,0 @@
-kses 0.2.2 README  [kses strips evil scripts!]
-=================
-
-
-* INTRODUCTION *
-
-
-Welcome to kses - an HTML/XHTML filter written in PHP. It removes all unwanted
-HTML elements and attributes, no matter how malformed HTML input you give it.
-It also does several checks on attribute values. kses can be used to avoid
-Cross-Site Scripting (XSS), Buffer Overflows and Denial of Service attacks,
-among other things.
-
-The program is released under the terms of the GNU General Public License. You
-should look into what that means, before using kses in your programs. You can
-find the full text of the license in the file COPYING.
-
-
-* FEATURES *
-
-
-Some of kses' current features are:
-
-* It will only allow the HTML elements and attributes that it was explicitly
-told to allow.
-
-* Element and attribute names are case-insensitive (a href vs A HREF).
-
-* It will understand and process whitespace correctly.
-
-* Attribute values can be surrounded with quotes, apostrophes or nothing.
-
-* It will accept valueless attributes with just names and no values (selected).
-
-* It will accept XHTML's closing " /" marks.
-
-* Attribute values that are surrounded with nothing will get quotes to avoid
-producing non-W3C conforming HTML
-(<a href=http://sourceforge.net/projects/kses> works but isn't valid HTML).
-
-* It handles lots of types of malformed HTML, by interpreting the existing
-code the best it can and then rebuilding new code from it. That's a better
-approach than trying to process existing code, as you're bound to forget about
-some weird special case somewhere. It handles problems like never-ending
-quotes and tags gracefully.
-
-* It will remove additional "<" and ">" characters that people may try to
-sneak in somewhere.
-
-* It supports checking attribute values for minimum/maximum length and
-minimum/maximum value, to protect against Buffer Overflows and Denial of
-Service attacks against WWW clients and various servers. You can stop
-<iframe src= width= height=> from having too high values for width and height,
-for instance.
-
-* It has got a system for whitelisting URL protocols. You can say that
-attribute values may only start with http:, https:, ftp: and gopher:, but no
-other URL protocols (javascript:, java:, about:, telnet:..). The functions that
-do this work handle whitespace, upper/lower case, HTML entities
-("jav&#97;script:") and repeated entries ("javascript:javascript:alert(57)").
-It also normalizes HTML entities as a nice side effect.
-
-* It removes Netscape 4's JavaScript entities ("&{alert(57)};").
-
-* It handles NULL bytes and Opera's chr(173) whitespace characters.
-
-* There is a procedural version and two object-oriented versions (for PHP 4
-  and PHP 5) of kses.
-
-
-* USE IT *
-
-
-It's very easy to use kses in your own PHP web application! Basic usage looks
-like this:
-
-
-<?php
-
-include 'kses.php';
-
-$allowed = array('b' => array(),
-                 'i' => array(),
-                 'a' => array('href' => 1, 'title' => 1),
-                 'p' => array('align' => 1),
-                 'br' => array());
-
-$val = $_POST['val'];
-if (get_magic_quotes_gpc())
-  $val = stripslashes($val);
-# You must strip slashes from magic quotes, or kses will get confused.
-
-$val = kses($val, $allowed); # The filtering takes place here.
-
-# Do something with $val.
-
-?>
-
-
-This definition of $allowed means that only the elements B, I, A, P and BR are
-allowed (along with their closing tags /B, /I, /A, /P and /BR). B, I and BR
-may not have any attributes. A may only have the attributes HREF and TITLE,
-while P may only have the attribute ALIGN. You can list the elements and
-attributes in the array in any mixture of upper and lower case. kses will also
-recognize HTML code that uses both lower and upper case.
-
-It's important to select the right allowed attributes, so you won't open up
-an XSS hole by mistake. Some important attributes that you mustn't allow
-include but are not limited to: 1) style, and 2) all intrinsic events
-attributes (onMouseOver and so on, on* really). I'll write more about this in
-the documentation that will be distributed with future versions of kses.
-
-It's also important to note that kses' HTML input must be cleaned of all
-slashes coming from magic quotes. If the rest of your code requires these
-slashes to be present, you can always add them again after calling kses with
-a simple addslashes() call.
-
-You should take a look at the documentation in the docs/ directory and the
-examples in the examples/ directory, to get more information on how to use
-kses. The object-oriented versions of kses are also worth checking out, and
-they're included in the oop/ directory.
-
-
-* UPGRADING TO 0.2.2 *
-
-
-kses 0.2.2 is backwards compatible with all previous releases, so upgrading
-should just be a matter of using a new version of kses.php instead of an old
-one.
-
-
-* NEW VERSIONS, MAILING LISTS AND BUG REPORTS *
-
-
-If you want to download new versions, subscribe to the kses-general mailing
-list or even take part in the development of kses, we refer you to its
-homepage at  http://sourceforge.net/projects/kses . New developers and beta
-testers are more than welcome!
-
-If you have any bug reports, suggestions for improvement or simply want to tell
-us that you use kses for some project, feel free to post to the kses-general
-mailing list. If you have found any security problems (particularly XSS,
-naturally) in kses, please contact Ulf privately at  metaur at users dot
-sourceforge dot net  so he can correct it before you or someone else tells the
-public about it.
-
-(No, it's not a security problem in kses if some program that uses it allows a
-bad attribute, silly. If kses is told to accept the element body with the
-attributes style and onLoad, it will accept them, even if that's a really bad
-idea, securitywise.)
-
-
-* OTHER HTML FILTERS *
-
-
-Here are the other stand-alone, open source HTML filters that we currently know
-of:
-
-* Htmlfilter for PHP - the filter from Squirrelmail
-  PHP
-  Konstantin Riabitsev
-  http://linux.duke.edu/projects/mini/htmlfilter/
-
-* HTML::StripScripts and related CPAN modules
-  Perl
-  Nick Cleaton
-  http://search.cpan.org/perldoc?HTML%3A%3AStripScripts
-
-* SafeHtmlChecker [is this really open source?]
-  PHP
-  Simon Willison
-  http://simon.incutio.com/archive/2003/02/23/safeHtmlChecker
-
-There are also a lot of HTML filters that were written specifically for some
-program. Some of them are better than others.
-
-Please write to the kses-general mailing list if you know of any other
-stand-alone, open-source filters.
-
-
-* DEDICATION *
-
-
-kses 0.2.2 is dedicated to Audrey Tautou and Jean-Pierre Jeunet.
-
-
-* MISC *
-
-
-The kses code is based on an HTML filter that Ulf wrote on his own back in 2002
-for the open-source project Gnuheter ( http://savannah.nongnu.org/projects/
-gnuheter ). Gnuheter is a fork from PHP-Nuke. The HTML filter has been
-improved a lot since then.
-
-To stop people from having sleepless nights, we feel the urgent need to state
-that kses doesn't have anything to do with the KDE project, despite having a
-name that starts with a K.
-
-In case someone was wondering, Ulf is available for kses-related consulting.
-
-Finally, the name kses comes from the terms XSS and access. It's also a
-recursive acronym (every open-source project should have one!) for "kses
-strips evil scripts".
-
-
-// Ulf and the kses development group, February 2005
diff --git a/mod/kses/vendors/kses/TODO b/mod/kses/vendors/kses/TODO
deleted file mode 100644 (file)
index 93652d4..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-kses TODO
-=========
-
-* create a nice homepage with interactive kses testing
-
-* remove stuff in between <script>..</script> and <style>..</style>
-
-* better fix for chr(173) bug and try to allow for "style:" where people
-  want to use it
-
-* XHTML tags of the style <br/> instead of <br />
-  This is related to a small bug with <a href="blah />
-  Solution: rewrite parser.
-
-(* rewrite document to XHTML or HTML)
-
-* more attribute value checks
-
-* more types of hooks
-
-* return array of removed elements and attributes
-
-* give the option of turning unacceptable elements to entities instead of
-  removing them (and turn unacceptable attributes to their own tag, which is
-  then turned to entities?) .. perhaps turn to comments as well?
-
-* ">" in HTML tags
-  <img src="blah.gif" alt="x > 5">
-  Not very important, but..
-
-(* make document well-formed.. there is HTML Tidy, but perhaps we want this
-   functionality in kses itself?)
-
-* port to other programming languages to achieve world domination
-
-* lots of testing
-
-* write better documentation
-
-* feedback from users
diff --git a/mod/kses/vendors/kses/docs/attribute-value-checks b/mod/kses/vendors/kses/docs/attribute-value-checks
deleted file mode 100644 (file)
index 8b0d645..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-kses attribute value checks
-===========================
-
-As you've probably already read in the README file, an $allowed_html array
-normally looks like this:
-
-$allowed = array('b' => array(),
-                 'i' => array(),
-                 'a' => array('href' => 1,
-                              'title' => 1),
-                 'p' => array('align' => 1),
-                 'br' => array());
-
-This sets what elements and attributes are allowed.
-
-From kses 0.2.0, you can also perform some checks on the attribute values. You
-do it like this:
-
-$allowed = array('b' => array(),
-                 'i' => array(),
-                 'a' => array('href' =>
-                                array('maxlen' => 100),
-                              'title' => 1),
-                 'p' => array('align' => 1),
-                 'font' => array('size' =>
-                                array('maxval' => 20)),
-                 'br' => array());
-
-This means that kses should perform the maxlen check with the value 100 on the
-<a href=> value, as well as the maxval check with the value 20 on the <font
-size=> value.
-
-The currently implemented checks (with more to come) are 'maxlen', 'maxval',
-'minlen', 'minval' and 'valueless'.
-
-'maxlen' checks that the length of the attribute value is not greater than the
-given value. It is helpful against Buffer Overflows in WWW clients and various
-servers on the Internet. In my example above, it would mean that
-"<a href='ftp://ftp.v1ct1m.com/AAAA..thousands_of_A's...'>" wouldn't be
-accepted.
-
-Of course, this problem is even worse if you put that long URL in a <frame>
-tag instead, so the WWW client will fetch it automatically without a user
-having to click it.
-
-'maxval' checks that the attribute value is an integer greater than or equal to
-zero, that it doesn't have an unreasonable amount of zeroes or whitespace (to
-avoid Buffer Overflows), and that it is not greater than the given value. In
-my example above, it would mean that "<font size='20'>" is accepted but
-"<font size='21'>" is not. This check helps against Denial of Service attacks
-against WWW clients.
-
-One example of this DoS problem is <iframe src="http://some.web.server/"
-width="20000" height="2000">, which makes some client machines completely
-overloaded.
-
-'minlen' and 'minval' works the same as 'maxlen' and 'maxval', except that they
-check for minimum lengths and values instead of maximum ones.
-
-'valueless' checks if an attribute has a value (like <a href="blah">) or not
-(<option selected>). If the given value is a "y" or a "Y", the attribute must
-not have a value to be accepted. If the given value is an "n" or an "N", the
-attribute must have a value. Note that <a href=""> is considered to have a
-value, so there's a difference between valueless attributes and attribute
-values with the length zero.
-
-You can combine more than one check, by putting one after the other in the
-inner array.
diff --git a/mod/kses/vendors/kses/docs/hooks b/mod/kses/vendors/kses/docs/hooks
deleted file mode 100644 (file)
index 971ff1c..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-kses hooks
-==========
-
-Sometimes you want to perform one more action on all data that kses will
-filter. There is a special function for that purpose called kses_hook(). kses
-calls it from its main function kses(), so if you insert some code in
-kses_hook(), it will always be called to change all data that kses sees.
diff --git a/mod/kses/vendors/kses/docs/stripping-everything b/mod/kses/vendors/kses/docs/stripping-everything
deleted file mode 100644 (file)
index f11742b..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-kses stripping everything
-=========================
-
-Sometimes you want to use kses for stripping all (X)HTML tags from a document.
-You do it by calling kses like this:
-
-$doc = kses($doc, array());
diff --git a/mod/kses/vendors/kses/docs/supported-formats b/mod/kses/vendors/kses/docs/supported-formats
deleted file mode 100644 (file)
index c0a9d97..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-kses supported formats
-======================
-
-It should be noted that kses doesn't deal with any smiley plus newline plus
-HTML format. It uses HTML or XHTML, both as input and as output.
-Conversions from the preferred format to or from HTML or XHTML is up to you.
diff --git a/mod/kses/vendors/kses/docs/whitelisted-url-protocols b/mod/kses/vendors/kses/docs/whitelisted-url-protocols
deleted file mode 100644 (file)
index a0032c4..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-kses whitelisted URL protocols
-==============================
-
-From kses 0.2.0, it has a function that checks all attribute values for URL
-protocols and only allows the protocols given in a whitelist.
-
-If you call kses the old way with two parameters - a string and an
-$allowed_html array - it will take its own default array, which whitelists the
-protocols http, https, ftp, news, nntp, telnet, gopher and mailto. Pretty
-reasonable, but anyone who wants to change it just calls the kses() function
-with a third parameter, like this:
-
-$string = kses($string, $allowed_html, array('http', 'https'));
-
-Note that you shouldn't include any colon after http or other protocol names.
diff --git a/mod/kses/vendors/kses/examples/filter.php b/mod/kses/vendors/kses/examples/filter.php
deleted file mode 100644 (file)
index 9a02679..0000000
+++ /dev/null
@@ -1,138 +0,0 @@
-<?php
-
-# filter - simple example script for kses
-# Copyright (C) 2003, 2005  Ulf Harnhammar
-#
-# This program is free software and open source software; you can redistribute
-# it and/or modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of the License,
-# or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
-# more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc.,
-# 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA  or visit
-# http://www.gnu.org/licenses/gpl.html
-#
-# *** CONTACT INFORMATION ***
-#
-# E-mail:      metaur at users dot sourceforge dot net
-# Web page:    http://sourceforge.net/projects/kses
-# Paper mail:  Ulf Harnhammar
-#              Ymergatan 17 C
-#              753 25  Uppsala
-#              SWEDEN
-
-# *** INCLUDE kses, DEFINE ELEMENTS+ATTRIBUTES, STRIP MAGIC QUOTES ***
-
-include '../kses.php';
-
-$allowed = array('b' => array(),
-                 'i' => array(),
-                 'a' => array('href'  => array('minlen' => 3, 'maxlen' => 50),
-                              'title' => array('valueless' => 'n')),
-                 'p' => array('align' => 1,
-                              'dummy' => array('valueless' => 'y')),
-                 'img' => array('src' => 1), # FIXME
-                 'font' => array('size' =>
-                                         array('minval' => 4, 'maxval' => 20)),
-                 'br' => array());
-
-$val = $_POST['val'];
-if (get_magic_quotes_gpc())
-  $val = stripslashes($val);
-
-# *** PRINT SOME HTML CODE ***
-
-?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
- "http://www.w3.org/TR/html4/loose.dtd">
-<html>
-<head>
-<title>kses example: HTML filter</title>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
-</head>
-
-<body>
-
-<?php
-
-# *** SHOW THE USER'S INPUT ***
-
-?>
-<h1>Input</h1>
-
-<pre><?= htmlspecialchars($val); ?></pre>
-
-<?php
-
-# *** SHOW IT AFTER FILTERING ***
-
-?>
-<h1>Output</h1>
-
-<pre><?php
-
-$val = kses($val, $allowed, array('http', 'https'));
-# The filtering takes place on the line above.
-echo htmlspecialchars($val);
-
-?></pre>
-
-<?php
-
-# *** DISPLAY A TEXTAREA FOR THE USER TO TYPE IN ***
-
-?>
-<h1>Type something</h1>
-
-<form method="POST" action="filter.php">
-<textarea name="val" rows=5 cols=50><?= htmlspecialchars($val); ?></textarea>
-<br>
-<input type="submit" value="Send it!">
-</form>
-
-<?php
-
-# *** SHOW ALLOWED ELEMENTS+ATTRIBUTES ***
-
-?>
-<p>
-Only the following HTML elements and attributes are allowed:
-</p>
-
-<p>
-<?php
-$first = 1;
-foreach ($allowed as $htmlkey => $htmlval)
-{
-  if (!$first)
-    echo ' ';
-  $first = 0;
-
-  echo "&lt;$htmlkey"; # element
-
-  foreach ($htmlval as $html2key => $html2val)
-    echo " <i>$html2key=</i>"; # attribute
-
-  echo "&gt;";
-}
-
-?>
-
-</p>
-
-<p>
-&lt;a href=&gt; must have a length in the range 3 to 50.<br>
-&lt;a title=&gt; must not be valueless.<br>
-&lt;p dummy&gt; must be valueless.<br>
-&lt;font size=&gt; must have a value in the range 4 to 20.<br>
-Only the URL protocols "http" and "https" are allowed.
-</p>
-
-</body>
-</html>
diff --git a/mod/kses/vendors/kses/examples/test.php b/mod/kses/vendors/kses/examples/test.php
deleted file mode 100644 (file)
index e0c6695..0000000
+++ /dev/null
@@ -1,224 +0,0 @@
-<?php
-
-# test - checks if a kses installation is working
-# Copyright (C) 2003, 2005  Ulf Harnhammar
-#
-# This program is free software and open source software; you can redistribute
-# it and/or modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of the License,
-# or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
-# more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc.,
-# 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA  or visit
-# http://www.gnu.org/licenses/gpl.html
-#
-# *** CONTACT INFORMATION ***
-#
-# E-mail:      metaur at users dot sourceforge dot net
-# Web page:    http://sourceforge.net/projects/kses
-# Paper mail:  Ulf Harnhammar
-#              Ymergatan 17 C
-#              753 25  Uppsala
-#              SWEDEN
-
-include '../kses.php';
-
-?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
- "http://www.w3.org/TR/html4/loose.dtd">
-<html>
-<head>
-<title>kses test</title>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
-</head>
-
-<body>
-<h1>kses test</h1>
-<p>
-
-<?php
-
-
-# *** FUNCTION DEFINITIONS ***
-
-
-function onetest($htmlbefore, $htmlafter, &$score, &$max, $allowed)
-###############################################################################
-# This function performs one kses test.
-###############################################################################
-{
-  $max++;
-
-  $htmlkses = kses($htmlbefore, $allowed);
-#  echo "htmlkses --".htmlspecialchars($htmlkses)."--<br>\n";
-
-  if ($htmlkses == $htmlafter)
-  {
-    echo 'OK';
-    $score++;
-  }
-  else
-    echo 'not OK';
-
-  echo "<br>\n";
-} # function onetest
-
-
-# *** MAIN PROGRAM ***
-
-
-$max = $score = 0;
-
-# Test #1
-
-echo 'Test #1.. ';
-$htmlbefore = 'kses \'kses\' kses "kses" kses \\kses\\';
-$htmlafter =  $htmlbefore;
-onetest($htmlbefore, $htmlafter, $score, $max, array());
-
-# Test #2
-
-echo 'Test #2.. ';
-$htmlbefore = 'kses <br>';
-$htmlafter =  'kses ';
-onetest($htmlbefore, $htmlafter, $score, $max, array());
-
-# Test #3
-
-echo 'Test #3.. ';
-$htmlbefore = 'kses <  BR  >';
-$htmlafter =  'kses <BR>';
-onetest($htmlbefore, $htmlafter, $score, $max, array('br' => array()));
-
-# Test #4
-
-echo 'Test #4.. ';
-$htmlbefore = 'kses > 5 <br>';
-$htmlafter =  'kses &gt; 5 <br>';
-onetest($htmlbefore, $htmlafter, $score, $max, array('br' => array()));
-
-# Test #5
-
-echo 'Test #5.. ';
-$htmlbefore = 'kses <  br';
-$htmlafter =  'kses <br>';
-onetest($htmlbefore, $htmlafter, $score, $max, array('br' => array()));
-
-# Test #6
-
-echo 'Test #6.. ';
-$htmlbefore = 'kses <a href=5>';
-$htmlafter =  'kses <a>';
-onetest($htmlbefore, $htmlafter, $score, $max, array('br' => array(),
-        'a' => array()));
-
-# Test #7
-
-echo 'Test #7.. ';
-$htmlbefore = 'kses <a href=5>';
-$htmlafter =  'kses <a href="5">';
-onetest($htmlbefore, $htmlafter, $score, $max,
-         array('a' => array('href' => 1)));
-
-# Test #8
-
-echo 'Test #8.. ';
-$htmlbefore = 'kses <a href>';
-$htmlafter =  $htmlbefore;
-onetest($htmlbefore, $htmlafter, $score, $max,
-        array('a' => array('href' => 1)));
-
-# Test #9
-
-echo 'Test #9.. ';
-$htmlbefore = 'kses <a href href=5 href=\'5\' href="5" dummy>';
-$htmlafter =  'kses <a href href="5" href=\'5\' href="5">';
-onetest($htmlbefore, $htmlafter, $score, $max,
-        array('a' => array('href' => 1)));
-
-# Test #10
-
-echo 'Test #10.. ';
-$htmlbefore = 'kses <a href="kses\\\\kses">';
-$htmlafter =  $htmlbefore;
-onetest($htmlbefore, $htmlafter, $score, $max,
-        array('a' => array('href' => 1)));
-
-# Test #11
-
-echo 'Test #11.. ';
-$htmlbefore = 'kses <a href="xxxxxx">';
-$htmlafter =  $htmlbefore;
-onetest($htmlbefore, $htmlafter, $score, $max,
-        array('a' => array('href' => array('maxlen' => 6))));
-
-# Test #12
-
-echo 'Test #12.. ';
-$htmlbefore = 'kses <a href="xxxxxxx">';
-$htmlafter =  'kses <a>';
-onetest($htmlbefore, $htmlafter, $score, $max,
-        array('a' => array('href' => array('maxlen' => 6))));
-
-# Test #13
-
-echo 'Test #13.. ';
-$htmlbefore = 'kses <a href="687">';
-$htmlafter =  'kses <a>';
-onetest($htmlbefore, $htmlafter, $score, $max,
-        array('a' => array('href' => array('maxval' => 686))));
-
-# Test #14
-
-echo 'Test #14.. ';
-$htmlbefore = 'kses <a href="xx"   /  >';
-$htmlafter =  'kses <a href="xx" />';
-onetest($htmlbefore, $htmlafter, $score, $max,
-        array('a' => array('href' => array('maxlen' => 6))));
-
-# Test #15
-
-echo 'Test #15.. ';
-$htmlbefore = 'kses <a href="JAVA java scrIpt : SCRIPT  :  alert(57)">';
-$htmlafter =  'kses <a href="alert(57)">';
-onetest($htmlbefore, $htmlafter, $score, $max,
-        array('a' => array('href' => 1)));
-
-# Test #16
-
-echo 'Test #16.. ';
-$htmlbefore = 'kses <a href="htt&#32; &#173;&#Xad;'.chr(173).'P://ulf">';
-$htmlafter =  'kses <a href="http://ulf">';
-onetest($htmlbefore, $htmlafter, $score, $max,
-        array('a' => array('href' => 1)));
-
-# Test #17
-
-echo 'Test #17.. ';
-$htmlbefore = 'kses <a href="/start.php"> kses <a href="start.php">';
-$htmlafter =  $htmlbefore;
-onetest($htmlbefore, $htmlafter, $score, $max,
-        array('a' => array('href' => 1)));
-
-
-# finished
-
-echo "<br>Score $score out of $max\n";
-
-if ($score != $max)
-  echo '<br>Something is wrong! Please contact '.
-       '<a href="mailto:kses-general@lists.sourceforge.net">'.
-       'the kses-general mailing list</a>, and tell us what '.
-       "operating system and PHP version you use.\n";
-
-?>
-
-</p>
-</body>
-</html>
diff --git a/mod/kses/vendors/kses/kses.php b/mod/kses/vendors/kses/kses.php
deleted file mode 100644 (file)
index 65da295..0000000
+++ /dev/null
@@ -1,555 +0,0 @@
-<?php
-
-# kses 0.2.2 - HTML/XHTML filter that only allows some elements and attributes
-# Copyright (C) 2002, 2003, 2005  Ulf Harnhammar
-#
-# This program is free software and open source software; you can redistribute
-# it and/or modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of the License,
-# or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
-# more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc.,
-# 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA  or visit
-# http://www.gnu.org/licenses/gpl.html
-#
-# *** CONTACT INFORMATION ***
-#
-# E-mail:      metaur at users dot sourceforge dot net
-# Web page:    http://sourceforge.net/projects/kses
-# Paper mail:  Ulf Harnhammar
-#              Ymergatan 17 C
-#              753 25  Uppsala
-#              SWEDEN
-#
-# [kses strips evil scripts!]
-
-
-function kses($string, $allowed_html, $allowed_protocols =
-               array('http', 'https', 'ftp', 'news', 'nntp', 'telnet',
-                     'gopher', 'mailto'))
-###############################################################################
-# This function makes sure that only the allowed HTML element names, attribute
-# names and attribute values plus only sane HTML entities will occur in
-# $string. You have to remove any slashes from PHP's magic quotes before you
-# call this function.
-###############################################################################
-{
-  $string = kses_no_null($string);
-  $string = kses_js_entities($string);
-  $string = kses_normalize_entities($string);
-  $string = kses_hook($string);
-  $allowed_html_fixed = kses_array_lc($allowed_html);
-  return kses_split($string, $allowed_html_fixed, $allowed_protocols);
-} # function kses
-
-
-function kses_hook($string)
-###############################################################################
-# You add any kses hooks here.
-###############################################################################
-{
-  return $string;
-} # function kses_hook
-
-
-function kses_version()
-###############################################################################
-# This function returns kses' version number.
-###############################################################################
-{
-  return '0.2.2';
-} # function kses_version
-
-
-function kses_split($string, $allowed_html, $allowed_protocols)
-###############################################################################
-# This function searches for HTML tags, no matter how malformed. It also
-# matches stray ">" characters.
-###############################################################################
-{
-  return preg_replace('%(<'.   # EITHER: <
-                      '[^>]*'. # things that aren't >
-                      '(>|$)'. # > or end of string
-                      '|>)%e', # OR: just a >
-                      "kses_split2('\\1', \$allowed_html, ".
-                      '$allowed_protocols)',
-                      $string);
-} # function kses_split
-
-
-function kses_split2($string, $allowed_html, $allowed_protocols)
-###############################################################################
-# This function does a lot of work. It rejects some very malformed things
-# like <:::>. It returns an empty string, if the element isn't allowed (look
-# ma, no strip_tags()!). Otherwise it splits the tag into an element and an
-# attribute list.
-###############################################################################
-{
-  $string = kses_stripslashes($string);
-
-  if (substr($string, 0, 1) != '<')
-    return '&gt;';
-    # It matched a ">" character
-
-  if (!preg_match('%^<\s*(/\s*)?([a-zA-Z0-9]+)([^>]*)>?$%', $string, $matches))
-    return '';
-    # It's seriously malformed
-
-  $slash = trim($matches[1]);
-  $elem = $matches[2];
-  $attrlist = $matches[3];
-
-  if (!@isset($allowed_html[strtolower($elem)]))
-    return '';
-    # They are using a not allowed HTML element
-
-  if ($slash != '')
-    return "<$slash$elem>";
-  # No attributes are allowed for closing elements
-
-  return kses_attr("$slash$elem", $attrlist, $allowed_html,
-                   $allowed_protocols);
-} # function kses_split2
-
-
-function kses_attr($element, $attr, $allowed_html, $allowed_protocols)
-###############################################################################
-# This function removes all attributes, if none are allowed for this element.
-# If some are allowed it calls kses_hair() to split them further, and then it
-# builds up new HTML code from the data that kses_hair() returns. It also
-# removes "<" and ">" characters, if there are any left. One more thing it
-# does is to check if the tag has a closing XHTML slash, and if it does,
-# it puts one in the returned code as well.
-###############################################################################
-{
-# Is there a closing XHTML slash at the end of the attributes?
-
-  $xhtml_slash = '';
-  if (preg_match('%\s/\s*$%', $attr))
-    $xhtml_slash = ' /';
-
-# Are any attributes allowed at all for this element?
-
-  if (@count($allowed_html[strtolower($element)]) == 0)
-    return "<$element$xhtml_slash>";
-
-# Split it
-
-  $attrarr = kses_hair($attr, $allowed_protocols);
-
-# Go through $attrarr, and save the allowed attributes for this element
-# in $attr2
-
-  $attr2 = '';
-
-  foreach ($attrarr as $arreach)
-  {
-    if (!@isset($allowed_html[strtolower($element)]
-                            [strtolower($arreach['name'])]))
-      continue; # the attribute is not allowed
-
-    $current = $allowed_html[strtolower($element)]
-                            [strtolower($arreach['name'])];
-
-    if (!is_array($current))
-      $attr2 .= ' '.$arreach['whole'];
-    # there are no checks
-
-    else
-    {
-    # there are some checks
-      $ok = true;
-      foreach ($current as $currkey => $currval)
-        if (!kses_check_attr_val($arreach['value'], $arreach['vless'],
-                                 $currkey, $currval))
-        { $ok = false; break; }
-
-      if ($ok)
-        $attr2 .= ' '.$arreach['whole']; # it passed them
-    } # if !is_array($current)
-  } # foreach
-
-# Remove any "<" or ">" characters
-
-  $attr2 = preg_replace('/[<>]/', '', $attr2);
-
-  return "<$element$attr2$xhtml_slash>";
-} # function kses_attr
-
-
-function kses_hair($attr, $allowed_protocols)
-###############################################################################
-# This function does a lot of work. It parses an attribute list into an array
-# with attribute data, and tries to do the right thing even if it gets weird
-# input. It will add quotes around attribute values that don't have any quotes
-# or apostrophes around them, to make it easier to produce HTML code that will
-# conform to W3C's HTML specification. It will also remove bad URL protocols
-# from attribute values.
-###############################################################################
-{
-  $attrarr = array();
-  $mode = 0;
-  $attrname = '';
-
-# Loop through the whole attribute list
-
-  while (strlen($attr) != 0)
-  {
-    $working = 0; # Was the last operation successful?
-
-    switch ($mode)
-    {
-      case 0: # attribute name, href for instance
-
-        if (preg_match('/^([-a-zA-Z]+)/', $attr, $match))
-        {
-          $attrname = $match[1];
-          $working = $mode = 1;
-          $attr = preg_replace('/^[-a-zA-Z]+/', '', $attr);
-        }
-
-        break;
-
-      case 1: # equals sign or valueless ("selected")
-
-        if (preg_match('/^\s*=\s*/', $attr)) # equals sign
-        {
-          $working = 1; $mode = 2;
-          $attr = preg_replace('/^\s*=\s*/', '', $attr);
-          break;
-        }
-
-        if (preg_match('/^\s+/', $attr)) # valueless
-        {
-          $working = 1; $mode = 0;
-          $attrarr[] = array
-                        ('name'  => $attrname,
-                         'value' => '',
-                         'whole' => $attrname,
-                         'vless' => 'y');
-          $attr = preg_replace('/^\s+/', '', $attr);
-        }
-
-        break;
-
-      case 2: # attribute value, a URL after href= for instance
-
-        if (preg_match('/^"([^"]*)"(\s+|$)/', $attr, $match))
-         # "value"
-        {
-          $thisval = kses_bad_protocol($match[1], $allowed_protocols);
-
-          $attrarr[] = array
-                        ('name'  => $attrname,
-                         'value' => $thisval,
-                         'whole' => "$attrname=\"$thisval\"",
-                         'vless' => 'n');
-          $working = 1; $mode = 0;
-          $attr = preg_replace('/^"[^"]*"(\s+|$)/', '', $attr);
-          break;
-        }
-
-        if (preg_match("/^'([^']*)'(\s+|$)/", $attr, $match))
-         # 'value'
-        {
-          $thisval = kses_bad_protocol($match[1], $allowed_protocols);
-
-          $attrarr[] = array
-                        ('name'  => $attrname,
-                         'value' => $thisval,
-                         'whole' => "$attrname='$thisval'",
-                         'vless' => 'n');
-          $working = 1; $mode = 0;
-          $attr = preg_replace("/^'[^']*'(\s+|$)/", '', $attr);
-          break;
-        }
-
-        if (preg_match("%^([^\s\"']+)(\s+|$)%", $attr, $match))
-         # value
-        {
-          $thisval = kses_bad_protocol($match[1], $allowed_protocols);
-
-          $attrarr[] = array
-                        ('name'  => $attrname,
-                         'value' => $thisval,
-                         'whole' => "$attrname=\"$thisval\"",
-                         'vless' => 'n');
-                         # We add quotes to conform to W3C's HTML spec.
-          $working = 1; $mode = 0;
-          $attr = preg_replace("%^[^\s\"']+(\s+|$)%", '', $attr);
-        }
-
-        break;
-    } # switch
-
-    if ($working == 0) # not well formed, remove and try again
-    {
-      $attr = kses_html_error($attr);
-      $mode = 0;
-    }
-  } # while
-
-  if ($mode == 1)
-  # special case, for when the attribute list ends with a valueless
-  # attribute like "selected"
-    $attrarr[] = array
-                  ('name'  => $attrname,
-                   'value' => '',
-                   'whole' => $attrname,
-                   'vless' => 'y');
-
-  return $attrarr;
-} # function kses_hair
-
-
-function kses_check_attr_val($value, $vless, $checkname, $checkvalue)
-###############################################################################
-# This function performs different checks for attribute values. The currently
-# implemented checks are "maxlen", "minlen", "maxval", "minval" and "valueless"
-# with even more checks to come soon.
-###############################################################################
-{
-  $ok = true;
-
-  switch (strtolower($checkname))
-  {
-    case 'maxlen':
-    # The maxlen check makes sure that the attribute value has a length not
-    # greater than the given value. This can be used to avoid Buffer Overflows
-    # in WWW clients and various Internet servers.
-
-      if (strlen($value) > $checkvalue)
-        $ok = false;
-      break;
-
-    case 'minlen':
-    # The minlen check makes sure that the attribute value has a length not
-    # smaller than the given value.
-
-      if (strlen($value) < $checkvalue)
-        $ok = false;
-      break;
-
-    case 'maxval':
-    # The maxval check does two things: it checks that the attribute value is
-    # an integer from 0 and up, without an excessive amount of zeroes or
-    # whitespace (to avoid Buffer Overflows). It also checks that the attribute
-    # value is not greater than the given value.
-    # This check can be used to avoid Denial of Service attacks.
-
-      if (!preg_match('/^\s{0,6}[0-9]{1,6}\s{0,6}$/', $value))
-        $ok = false;
-      if ($value > $checkvalue)
-        $ok = false;
-      break;
-
-    case 'minval':
-    # The minval check checks that the attribute value is a positive integer,
-    # and that it is not smaller than the given value.
-
-      if (!preg_match('/^\s{0,6}[0-9]{1,6}\s{0,6}$/', $value))
-        $ok = false;
-      if ($value < $checkvalue)
-        $ok = false;
-      break;
-
-    case 'valueless':
-    # The valueless check checks if the attribute has a value
-    # (like <a href="blah">) or not (<option selected>). If the given value
-    # is a "y" or a "Y", the attribute must not have a value.
-    # If the given value is an "n" or an "N", the attribute must have one.
-
-      if (strtolower($checkvalue) != $vless)
-        $ok = false;
-      break;
-  } # switch
-
-  return $ok;
-} # function kses_check_attr_val
-
-
-function kses_bad_protocol($string, $allowed_protocols)
-###############################################################################
-# This function removes all non-allowed protocols from the beginning of
-# $string. It ignores whitespace and the case of the letters, and it does
-# understand HTML entities. It does its work in a while loop, so it won't be
-# fooled by a string like "javascript:javascript:alert(57)".
-###############################################################################
-{
-  $string = kses_no_null($string);
-  $string = preg_replace('/\xad+/', '', $string); # deals with Opera "feature"
-  $string2 = $string.'a';
-
-  while ($string != $string2)
-  {
-    $string2 = $string;
-    $string = kses_bad_protocol_once($string, $allowed_protocols);
-  } # while
-
-  return $string;
-} # function kses_bad_protocol
-
-
-function kses_no_null($string)
-###############################################################################
-# This function removes any NULL characters in $string.
-###############################################################################
-{
-  $string = preg_replace('/\0+/', '', $string);
-  $string = preg_replace('/(\\\\0)+/', '', $string);
-
-  return $string;
-} # function kses_no_null
-
-
-function kses_stripslashes($string)
-###############################################################################
-# This function changes the character sequence  \"  to just  "
-# It leaves all other slashes alone. It's really weird, but the quoting from
-# preg_replace(//e) seems to require this.
-###############################################################################
-{
-  return preg_replace('%\\\\"%', '"', $string);
-} # function kses_stripslashes
-
-
-function kses_array_lc($inarray)
-###############################################################################
-# This function goes through an array, and changes the keys to all lower case.
-###############################################################################
-{
-  $outarray = array();
-\r
-  if (sizeof($inarray))
-  foreach ($inarray as $inkey => $inval)
-  {
-    $outkey = strtolower($inkey);
-    $outarray[$outkey] = array();
-
-    foreach ($inval as $inkey2 => $inval2)
-    {
-      $outkey2 = strtolower($inkey2);
-      $outarray[$outkey][$outkey2] = $inval2;
-    } # foreach $inval
-  } # foreach $inarray
-
-  return $outarray;
-} # function kses_array_lc
-
-
-function kses_js_entities($string)
-###############################################################################
-# This function removes the HTML JavaScript entities found in early versions of
-# Netscape 4.
-###############################################################################
-{
-  return preg_replace('%&\s*\{[^}]*(\}\s*;?|$)%', '', $string);
-} # function kses_js_entities
-
-
-function kses_html_error($string)
-###############################################################################
-# This function deals with parsing errors in kses_hair(). The general plan is
-# to remove everything to and including some whitespace, but it deals with
-# quotes and apostrophes as well.
-###############################################################################
-{
-  return preg_replace('/^("[^"]*("|$)|\'[^\']*(\'|$)|\S)*\s*/', '', $string);
-} # function kses_html_error
-
-
-function kses_bad_protocol_once($string, $allowed_protocols)
-###############################################################################
-# This function searches for URL protocols at the beginning of $string, while
-# handling whitespace and HTML entities.
-###############################################################################
-{
-  return preg_replace('/^((&[^;]*;|[\sA-Za-z0-9])*)'.
-                      '(:|&#58;|&#[Xx]3[Aa];)\s*/e',
-                      'kses_bad_protocol_once2("\\1", $allowed_protocols)',
-                      $string);
-} # function kses_bad_protocol_once
-
-
-function kses_bad_protocol_once2($string, $allowed_protocols)
-###############################################################################
-# This function processes URL protocols, checks to see if they're in the white-
-# list or not, and returns different data depending on the answer.
-###############################################################################
-{
-  $string2 = kses_decode_entities($string);
-  $string2 = preg_replace('/\s/', '', $string2);
-  $string2 = kses_no_null($string2);
-  $string2 = preg_replace('/\xad+/', '', $string2);
-   # deals with Opera "feature"
-  $string2 = strtolower($string2);
-
-  $allowed = false;
-  foreach ($allowed_protocols as $one_protocol)
-    if (strtolower($one_protocol) == $string2)
-    {
-      $allowed = true;
-      break;
-    }
-
-  if ($allowed)
-    return "$string2:";
-  else
-    return '';
-} # function kses_bad_protocol_once2
-
-
-function kses_normalize_entities($string)
-###############################################################################
-# This function normalizes HTML entities. It will convert "AT&T" to the correct
-# "AT&amp;T", "&#00058;" to "&#58;", "&#XYZZY;" to "&amp;#XYZZY;" and so on.
-###############################################################################
-{
-# Disarm all entities by converting & to &amp;
-
-  // $string = str_replace('&', '&amp;', $string); // [Marcus Povey 20090212: Commented out in ref #561. Needs a better solution. ]
-
-# Change back the allowed entities in our entity whitelist
-
-  $string = preg_replace('/&amp;([A-Za-z][A-Za-z0-9]{0,19});/',
-                         '&\\1;', $string);
-  $string = preg_replace('/&amp;#0*([0-9]{1,5});/e',
-                         'kses_normalize_entities2("\\1")', $string);
-  $string = preg_replace('/&amp;#([Xx])0*(([0-9A-Fa-f]{2}){1,2});/',
-                         '&#\\1\\2;', $string);
-
-  return $string;
-} # function kses_normalize_entities
-
-
-function kses_normalize_entities2($i)
-###############################################################################
-# This function helps kses_normalize_entities() to only accept 16 bit values
-# and nothing more for &#number; entities.
-###############################################################################
-{
-  return (($i > 65535) ? "&amp;#$i;" : "&#$i;");
-} # function kses_normalize_entities2
-
-
-function kses_decode_entities($string)
-###############################################################################
-# This function decodes numeric HTML entities (&#65; and &#x41;). It doesn't
-# do anything with other entities like &auml;, but we don't need them in the
-# URL protocol whitelisting system anyway.
-###############################################################################
-{
-  $string = preg_replace('/&#([0-9]+);/e', 'chr("\\1")', $string);
-  $string = preg_replace('/&#[Xx]([0-9A-Fa-f]+);/e', 'chr(hexdec("\\1"))',
-                         $string);
-
-  return $string;
-} # function kses_decode_entities
-
-?>
diff --git a/mod/kses/vendors/kses/oop/oop.kses.changelog.txt b/mod/kses/vendors/kses/oop/oop.kses.changelog.txt
deleted file mode 100644 (file)
index a82daf4..0000000
+++ /dev/null
@@ -1,204 +0,0 @@
-kses ChangeLog\r
-==============\r
-\r
-KSES5\r
-       * 1.0.2\r
-KSES4\r
-       * 0.2.2\r
-       - Folded in code from kses 0.2.2.\r
-\r
-KSES5\r
-       * 1.0.1rc\r
-KSES4\r
-       * 0.2.2rc\r
-       - Added SetProtocols() to make protocol replacement a single step\r
-         to fully answer concerns in bug #892477\r
-         \r
-KSES5\r
-       * 1.0.0\r
-       - Turned many methods private\r
-       \r
-       - Now using __construct default constructor\r
-       \r
-       - Only runs in PHP5 or better\r
-       \r
-       - All method names changed to reflect verb status\r
-       \r
-       - Folded sinlge line functions into calling methods\r
-       \r
-       - Deprecated _hook(), Protocols()\r
-       \r
-       - Added AddProtocols() to replace Protocols()\r
-       \r
-       - Added filterKsesTextHook() to replace _hook()\r
-       \r
-       - Added RemoveProtocol() and RemoveProtocols() to remove protocols\r
-         singly, or batch.  This should clear bug #892477\r
-\r
-       - Version number is 1.0.0\r
-\r
-KSES4\r
-       * 0.2.1\r
-       - Synced version number to procedural code\r
-       \r
-       - Deprecated _hook(), Protocols()\r
-       \r
-       - Added AddProtocols() to replace Protocols()\r
-       \r
-       - Added filterKsesTextHook() to replace _hook()\r
-       \r
-       - Added RemoveProtocol() and RemoveProtocols() to remove protocols singly,\r
-         or batch.  This should clear bug #892477\r
-\r
-OOP\r
-       - Forked code into PHP4 and PHP5 versions.  Use '$myKses = new kses[45]'\r
-         from now on.\r
-       \r
-       - Modified code to run in E_STRICT.  This should clear bug #918493\r
-       \r
-       - Added phpDoc commenting\r
-\r
-OOP\r
-       * 0.0.2\r
-       - Fixed a bug in AddProtocol that wasn't adding new protocols to\r
-         $this->allowed_protocols\r
-\r
-       - Modified internal methods to correspond to kses 0.2.1 modifications.\r
-\r
-       - Created a basic test suite that can be run via web or CLI.\r
-\r
-       - Started CVSing the code.\r
-\r
-OOP\r
-       * 0.0.1\r
-       - Turned all the kses_function_name functions to _function_name methods.\r
-\r
-       - Added a couple of properties (allowed_protocols, allowed_html) with\r
-         $this->allowed_protocols defaulting to the lion's share of usual\r
-         protocols.\r
-\r
-       - Modified the applicable use of preg_replace() functions to point to\r
-         internal class methods.\r
-\r
-       - Reduced the parameter list of some methods since internal properties\r
-         are now being used.\r
-\r
-       - Added "public" methods to set up the allowed protocols and HTML.\r
-\r
-Procedural\r
-       * 0.2.1\r
-\r
-       0.2.1 was released on the 29th of September 2003.\r
-       It has the following changes:\r
-\r
-       - There is now an additional version of kses, using the object-oriented\r
-         paradigm. Thanks a lot to Richard R. Vasquez, Jr., who created it!\r
-         Anyone who wants to make functional programming, logical programming or\r
-         spaghetti programming versions of kses as well (or any other programming\r
-         paradigm that you like), go ahead! All the people who like old\r
-         procedural programming for web applications shouldn't despair, though,\r
-         as both versions will be maintained with each release.\r
-\r
-       - kses now has some new attribute value checks: minlen, minval and\r
-         valueless.  See docs/attribute-value-checks for an explanation.\r
-\r
-       - For some reason, the Opera developers decided to make chr(173) a\r
-         whitespace character in URL protocols, both when it occurs raw and in an\r
-         entity. kses now handles this.\r
-\r
-       - The URL protocol whitelisting system now decodes entities before\r
-         removing NULLs and whitespaces.\r
-\r
-Procedural\r
-       * 0.2.0\r
-\r
-       0.2.0 was released on the 25th of July 2003.\r
-       It has the following changes:\r
-\r
-       - kses now supports checking of attribute values, and not just element\r
-         names and attribute names. The attribute value checks that exist so far\r
-         are 'maxlen' (checks how long attribute values are, to avoid Buffer\r
-         Overflows) and 'maxval' (checks how big an integer value is, to avoid\r
-         Denial of Service attacks).\r
-\r
-         Buffer Overflows could both be a problem for WWW clients and different\r
-         servers on the Internet that an HTML document links to. One example is\r
-         <frame src="ftp://ftp.v1ct1m.com/AAAAAA..thousands_of_A's...">.\r
-\r
-         Denial of Service attacks can take the form of too big sizes of iframes\r
-         or other things. One example is <iframe src="http://some.web.server/"\r
-         width="20000" height="2000">, which makes some client machines\r
-         completely overloaded.\r
-\r
-       - kses' old feature of removing "javascript:" from attribute values has\r
-         been improved. It now has a whole system for white listing of URL\r
-         protocols, so you can specify that it's acceptable with http:, https:,\r
-         ftp: and gopher:, but no other protocols in attribute values. The system\r
-         tries pretty hard to do the right thing with whitespace, upper/lower\r
-         case, HTML entities ("jav&#97;script:") and repeated entries\r
-         ("javascript:javascript:alert(57)").\r
-\r
-       - kses now supports both HTML and XHTML code, by allowing " /" at the end\r
-         of tags.\r
-\r
-       - kses now removes Netscape 4's JavaScript entities, having the form\r
-         "&{alert(57)};". They don't even seem to work on all versions of\r
-         Netscape 4, but for completeness' sake it seemed like a good feature to\r
-         add.\r
-\r
-       - A bug with NULLs in javascript: URLs was fixed.\r
-         (Reported by Simon Cornelius P. Umacob - thanks!)\r
-\r
-       - As a nice side effect of the white listing of URL protocols, kses now\r
-         also normalizes all HTML entities in documents. It will change HTML code\r
-         with bad entities to the right form, for example "AT&T" will be\r
-         converted to "AT&amp;T" and "<a href='lyrics.php?band=ladytron&lyrics=\r
-         playgirl'>" will be converted to "<a href='lyrics.php?band=\r
-         ladytron&amp;lyrics=playgirl'>". "&#000058;" will be converted to\r
-         "&#58;", "&#XYZZY;" will be converted to "&amp;#XYZZY;", "&auml!;" will\r
-         be converted to "&amp;auml!;" and so on.\r
-\r
-         As shown above, it will process HTML entities that it doesn't\r
-         understand.  It will also deal with too big numbers in numeric HTML\r
-         entities, which is helpful as many browsers seem to wrap them around at\r
-         2 ** 32, so the characters 58, 58 + (2 ** 32), 58 + (2 ** 64) etcetera\r
-         are all colons to the web browser.\r
-\r
-       - You can now use upper case letters in your $allowed_html array, in\r
-         element names, attribute names and attribute value check names. Version\r
-         0.1.0 required everything in that array to be in lower case, but that's\r
-         not necessary any more. You can also use upper case letters in\r
-         $allowed_protocols.\r
-\r
-       - The "Really malformed thing" bug from the TODO file was fixed.\r
-         It used to convert this string:\r
-         x > 5 <a href="blah">\r
-         to:\r
-         x &gt; 5 &lt;a href=&quot;blah&quot;&gt;\r
-         and now it converts it to:\r
-         x &gt; 5 <a href="blah">\r
-\r
-       - The "Weird malformed thing" bug from the TODO file was fixed.\r
-         It used to convert this string:\r
-         <a href="5 href=6>\r
-         to:\r
-         <a href="6">\r
-         because of the way kses restarts after a parse error in kses_hair().\r
-         Now it converts it to:\r
-         <a>\r
-\r
-       - A problem with slashes in HTML tags was fixed.\r
-\r
-       - examples/filter.php used to use $SCRIPT_NAME, which doesn't work on\r
-         Windows.\r
-         (Reported by Simon Cornelius P. Umacob - thanks!)\r
-\r
-       - kses now allows dashes in attribute names, for things like\r
-         <meta http-equiv=..>.\r
-\r
-Procedural\r
-       * 0.1.0, first public version\r
-\r
-       0.1.0 was released on the 9th of June 2003.\r
-       It was announced on three security related mailing lists on Friday the\r
-       13th of June (nothing bad happened to it though).\r
diff --git a/mod/kses/vendors/kses/oop/oop.simple.api.txt b/mod/kses/vendors/kses/oop/oop.simple.api.txt
deleted file mode 100644 (file)
index 144308a..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-Parse($string = "")\r
-       The basic function of kses.  Give it a $string, and it will strip\r
-       out the unwanted HTML and attributes.\r
-\r
-AddProtocols()\r
-       Add a protocol or list of protocols to the kses object to be\r
-       considered valid during a Parse().  The parameter can be a string\r
-       containing a single protocol, or an array of strings, each\r
-       containing a single protocol.\r
-\r
-Protocols()\r
-       Deprecated.  Use AddProtocols()\r
-\r
-AddProtocol($protocol = "")\r
-       Adds a single protocol to the kses object that will be considered\r
-       valid during a Parse().\r
-\r
-SetProtocols()\r
-       This is a straight setting/overwrite of existing protocols in the\r
-       kses object.  All existing protocols are removed, and the parameter\r
-       is used to determine what protocol(s) the kses object will consider\r
-       valid.  The parameter can be a string containing a single protocol,\r
-       or an array of strings, each constaining a single protocol.\r
-\r
-DumpProtocols()\r
-       This returns an indexed array of the valid protocols contained in\r
-       the kses object.\r
-\r
-DumpElements()\r
-       This returns an associative array of the valid (X)HTML elements in\r
-       the kses object along with attributes for each element, and tests\r
-       that will be performed on each attribute.\r
-\r
-AddHTML($tag = "", $attribs = array())\r
-       This allows the end user to add a single (X)HTML element to the\r
-       kses object along with the (if any) attributes that the specific\r
-       (X)HTML element is allowed to have.\r
-       \r
-       See the file 'attribute-value-checks' for more information as to\r
-       the format of the data to be provided to this method.\r
-\r
-RemoveProtocol($protocol = "")\r
-       This allows for the removal of a single protocol from the list of\r
-       valid protocols in the kses object.\r
-\r
-RemoveProtocols()\r
-       This allows for the single or batch removal of protocols from the\r
-       kses object.  The parameter is either a string containing a\r
-       protocol to be removed, or an array of strings that each contain\r
-       a protocol.\r
-\r
-filterKsesTextHook($string)\r
-       For the OOP version of kses, this is an additional hook that allows\r
-       the end user to perform additional postprocessing of a string\r
-       that's being run through Parse().\r
-\r
-_hook()\r
-       Deprecated.  Use filterKsesTextHook().
\ No newline at end of file
diff --git a/mod/kses/vendors/kses/oop/php4.class.kses.php b/mod/kses/vendors/kses/oop/php4.class.kses.php
deleted file mode 100644 (file)
index acb06cc..0000000
+++ /dev/null
@@ -1,1162 +0,0 @@
-<?php\r
-       /*\r
-        * ==========================================================================================\r
-        *\r
-        * This program is free software and open source software; you can redistribute\r
-        * it and/or modify it under the terms of the GNU General Public License as\r
-        * published by the Free Software Foundation; either version 2 of the License,\r
-        * or (at your option) any later version.\r
-        *\r
-        * This program is distributed in the hope that it will be useful, but WITHOUT\r
-        * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\r
-        * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for\r
-        * more details.\r
-        *\r
-        * You should have received a copy of the GNU General Public License along\r
-        * with this program; if not, write to the Free Software Foundation, Inc.,\r
-        * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA  or visit\r
-        * http://www.gnu.org/licenses/gpl.html\r
-        *\r
-        * ==========================================================================================\r
-        */\r
-\r
-       /**\r
-       *       Class file for PHP4 OOP version of kses\r
-       *\r
-       *       This is an updated version of kses to work with PHP4 that works under E_STRICT.\r
-       *\r
-       *       This upgrade provides the following:\r
-       *       + Version number synced to procedural version number\r
-       *       + PHPdoc style documentation has been added to the class.  See http://www.phpdoc.org/ for more info.\r
-       *       + Some methods are now deprecated due to nomenclature style change.  See method documentation for specifics.\r
-       *       + Kses4 now works in E_STRICT\r
-       *       + Addition of methods AddProtocols(), filterKsestextHook(), RemoveProtocol() and RemoveProtocols()\r
-       *       + Deprecated _hook(), Protocols()\r
-       *       + Integrated code from kses 0.2.2 into class.\r
-       *       + Added methods DumpProtocols(), DumpMethods()\r
-       *\r
-       *       @package    kses\r
-       *       @subpackage kses4\r
-       */\r
-\r
-       if(substr(phpversion(), 0, 1) < 4)\r
-       {\r
-               die("Class kses requires PHP 4 or higher.");\r
-       }\r
-\r
-       /**\r
-       *       Only install KSES4 once\r
-       */\r
-       if(!defined('KSES_CLASS_PHP4'))\r
-       {\r
-               define('KSES_CLASS_PHP4', true);\r
-\r
-       /**\r
-       *       Kses strips evil scripts!\r
-       *\r
-       *       This class provides the capability for removing unwanted HTML/XHTML, attributes from\r
-       *       tags, and protocols contained in links.  The net result is a much more powerful tool\r
-       *       than the PHP internal strip_tags()\r
-       *\r
-       *       This is a fork of a slick piece of procedural code called 'kses' written by Ulf Harnhammar\r
-       *       The entire set of functions was wrapped in a PHP object with some internal modifications\r
-       *       by Richard Vasquez (http://www.chaos.org/) 7/25/2003\r
-       *\r
-       *       This upgrade provides the following:\r
-       *       + Version number synced to procedural version number\r
-       *       + PHPdoc style documentation has been added to the class.  See http://www.phpdoc.org/ for more info.\r
-       *       + Some methods are now deprecated due to nomenclature style change.  See method documentation for specifics.\r
-       *       + Kses4 now works in E_STRICT\r
-       *       + Addition of methods AddProtocols(), filterKsestextHook(), RemoveProtocol(), RemoveProtocols() and SetProtocols()\r
-       *       + Deprecated _hook(), Protocols()\r
-       *       + Integrated code from kses 0.2.2 into class.\r
-       *\r
-       *       @author     Richard R. Vásquez, Jr. (Original procedural code by Ulf Härnhammar)\r
-       *       @link       http://sourceforge.net/projects/kses/ Home Page for Kses\r
-       *       @link       http://chaos.org/contact/ Contact page with current email address for Richard Vasquez\r
-       *       @copyright  Richard R. Vásquez, Jr. 2003-2005\r
-       *       @version    PHP4 OOP 0.2.2\r
-       *       @license    http://www.gnu.org/licenses/gpl.html GNU Public License\r
-       *       @package    kses\r
-       */\r
-               class kses4\r
-               {\r
-                       /**#@+\r
-                        *      @access private\r
-                        *      @var array\r
-                        */\r
-                       var $allowed_protocols = array();\r
-                       var $allowed_html      = array();\r
-                       /**#@-*/\r
-\r
-                       /**\r
-                        *      Constructor for kses.\r
-                        *\r
-                        *      This sets a default collection of protocols allowed in links, and creates an\r
-                        *      empty set of allowed HTML tags.\r
-                        *      @since PHP4 OOP 0.0.1\r
-                        */\r
-                       function kses4()\r
-                       {\r
-                               /**\r
-                                *      You could add protocols such as ftp, new, gopher, mailto, irc, etc.\r
-                                *\r
-                                *      The base values the original kses provided were:\r
-                                *              'http', 'https', 'ftp', 'news', 'nntp', 'telnet', 'gopher', 'mailto'\r
-                                */\r
-                               $this->allowed_protocols = array('http', 'ftp', 'mailto');\r
-                               $this->allowed_html      = array();\r
-                       }\r
-\r
-                       /**\r
-                        *      Basic task of kses - parses $string and strips it as required.\r
-                        *\r
-                        *      This method strips all the disallowed (X)HTML tags, attributes\r
-                        *      and protocols from the input $string.\r
-                        *\r
-                        *      @access public\r
-                        *      @param string $string String to be stripped of 'evil scripts'\r
-                        *      @return string The stripped string\r
-                        *      @since PHP4 OOP 0.2.1\r
-                        */\r
-                       function Parse($string = "")\r
-                       {\r
-                               if (get_magic_quotes_gpc())\r
-                               {\r
-                                       $string = stripslashes($string);\r
-                               }\r
-                               $string = $this->_no_null($string);\r
-                               $string = $this->_js_entities($string);\r
-                               $string = $this->_normalize_entities($string);\r
-                               $string = $this->filterKsesTextHook($string);\r
-                               return    $this->_split($string);\r
-                       }\r
-\r
-                       /**\r
-                        *      Allows for single/batch addition of protocols\r
-                        *\r
-                        *      This method accepts one argument that can be either a string\r
-                        *      or an array of strings.  Invalid data will be ignored.\r
-                        *\r
-                        *      The argument will be processed, and each string will be added\r
-                        *      via AddProtocol().\r
-                        *\r
-                        *      @access public\r
-                        *      @param mixed , A string or array of protocols that will be added to the internal list of allowed protocols.\r
-                        *      @return bool Status of adding valid protocols.\r
-                        *      @see AddProtocol()\r
-                        *      @since PHP4 OOP 0.2.1\r
-                        */\r
-                       function AddProtocols()\r
-                       {\r
-                               $c_args = func_num_args();\r
-                               if($c_args != 1)\r
-                               {\r
-                                       trigger_error("kses4::AddProtocols() did not receive an argument.", E_USER_WARNING);\r
-                                       return false;\r
-                               }\r
-\r
-                               $protocol_data = func_get_arg(0);\r
-\r
-                               if(is_array($protocol_data) && count($protocol_data) > 0)\r
-                               {\r
-                                       foreach($protocol_data as $protocol)\r
-                                       {\r
-                                               $this->AddProtocol($protocol);\r
-                                       }\r
-                                       return true;\r
-                               }\r
-                               elseif(is_string($protocol_data))\r
-                               {\r
-                                       $this->AddProtocol($protocol_data);\r
-                                       return true;\r
-                               }\r
-                               else\r
-                               {\r
-                                       trigger_error("kses4::AddProtocols() did not receive a string or an array.", E_USER_WARNING);\r
-                                       return false;\r
-                               }\r
-                       }\r
-\r
-                       /**\r
-                        *      Allows for single/batch addition of protocols\r
-                        *\r
-                        *      @deprecated Use AddProtocols()\r
-                        *      @see AddProtocols()\r
-                        *      @return bool\r
-                        *      @since PHP4 OOP 0.0.1\r
-                        */\r
-                       function Protocols()\r
-                       {\r
-                               $c_args = func_num_args();\r
-                               if($c_args != 1)\r
-                               {\r
-                                       trigger_error("kses4::Protocols() did not receive an argument.", E_USER_WARNING);\r
-                                       return false;\r
-                               }\r
-\r
-                               return $this->AddProtocols(func_get_arg(0));\r
-                       }\r
-\r
-                       /**\r
-                        *      Adds a single protocol to $this->allowed_protocols.\r
-                        *\r
-                        *      This method accepts a string argument and adds it to\r
-                        *      the list of allowed protocols to keep when performing\r
-                        *      Parse().\r
-                        *\r
-                        *      @access public\r
-                        *      @param string $protocol The name of the protocol to be added.\r
-                        *      @return bool Status of adding valid protocol.\r
-                        *      @since PHP4 OOP 0.0.1\r
-                        */\r
-                       function AddProtocol($protocol = "")\r
-                       {\r
-                               if(!is_string($protocol))\r
-                               {\r
-                                       trigger_error("kses4::AddProtocol() requires a string.", E_USER_WARNING);\r
-                                       return false;\r
-                               }\r
-\r
-                               $protocol = strtolower(trim($protocol));\r
-                               if($protocol == "")\r
-                               {\r
-                                       trigger_error("kses4::AddProtocol() tried to add an empty/NULL protocol.", E_USER_WARNING);\r
-                                       return false;\r
-                               }\r
-\r
-                               // Remove any inadvertent ':' at the end of the protocol.\r
-                               if(substr($protocol, strlen($protocol) - 1, 1) == ":")\r
-                               {\r
-                                       $protocol = substr($protocol, 0, strlen($protocol) - 1);\r
-                               }\r
-\r
-                               if(!in_array($protocol, $this->allowed_protocols))\r
-                               {\r
-                                       array_push($this->allowed_protocols, $protocol);\r
-                                       sort($this->allowed_protocols);\r
-                               }\r
-                               return true;\r
-                       }\r
-\r
-                       /**\r
-                        *      Allows for single/batch replacement of protocols\r
-                        *\r
-                        *      This method accepts one argument that can be either a string\r
-                        *      or an array of strings.  Invalid data will be ignored.\r
-                        *\r
-                        *      Existing protocols will be removed, then the argument will be\r
-                        *      processed, and each string will be added via AddProtocol().\r
-                        *\r
-                        *      @access public\r
-                        *      @param mixed , A string or array of protocols that will be the new internal list of allowed protocols.\r
-                        *      @return bool Status of replacing valid protocols.\r
-                        *      @since PHP4 OOP 0.2.2\r
-                        *      @see AddProtocol()\r
-                        */\r
-                       function SetProtocols()\r
-                       {\r
-                               $c_args = func_num_args();\r
-                               if($c_args != 1)\r
-                               {\r
-                                       trigger_error("kses4::SetProtocols() did not receive an argument.", E_USER_WARNING);\r
-                                       return false;\r
-                               }\r
-\r
-                               $protocol_data = func_get_arg(0);\r
-\r
-                               if(is_array($protocol_data) && count($protocol_data) > 0)\r
-                               {\r
-                                       $this->allowed_protocols = array();\r
-                                       foreach($protocol_data as $protocol)\r
-                                       {\r
-                                               $this->AddProtocol($protocol);\r
-                                       }\r
-                                       return true;\r
-                               }\r
-                               elseif(is_string($protocol_data))\r
-                               {\r
-                                       $this->allowed_protocols = array();\r
-                                       $this->AddProtocol($protocol_data);\r
-                                       return true;\r
-                               }\r
-                               else\r
-                               {\r
-                                       trigger_error("kses4::SetProtocols() did not receive a string or an array.", E_USER_WARNING);\r
-                                       return false;\r
-                               }\r
-                       }\r
-\r
-                       /**\r
-                        *      Raw dump of allowed protocols\r
-                        *\r
-                        *      This returns an indexed array of allowed protocols for a particular KSES\r
-                        *      instantiation.\r
-                        *\r
-                        *      @access public\r
-                        *      @return array The list of allowed protocols.\r
-                        *      @since PHP4 OOP 0.2.2\r
-                        */\r
-                       function DumpProtocols()\r
-                       {\r
-                               return $this->allowed_protocols;\r
-                       }\r
-\r
-                       /**\r
-                        *      Raw dump of allowed (X)HTML elements\r
-                        *\r
-                        *      This returns an indexed array of allowed (X)HTML elements and attributes\r
-                        *      for a particular KSES instantiation.\r
-                        *\r
-                        *      @access public\r
-                        *      @return array The list of allowed elements.\r
-                        *      @since PHP4 OOP 0.2.2\r
-                        */\r
-                       function DumpElements()\r
-                       {\r
-                               return $this->allowed_html;\r
-                       }\r
-\r
-                       /**\r
-                        *      Adds valid (X)HTML with corresponding attributes that will be kept when stripping 'evil scripts'.\r
-                        *\r
-                        *      This method accepts one argument that can be either a string\r
-                        *      or an array of strings.  Invalid data will be ignored.\r
-                        *\r
-                        *      @access public\r
-                        *      @param string $tag (X)HTML tag that will be allowed after stripping text.\r
-                        *      @param array $attribs Associative array of allowed attributes - key => attribute name - value => attribute parameter\r
-                        *      @return bool Status of Adding (X)HTML and attributes.\r
-                        *      @since PHP4 OOP 0.0.1\r
-                        */\r
-                       function AddHTML($tag = "", $attribs = array())\r
-                       {\r
-                               if(!is_string($tag))\r
-                               {\r
-                                       trigger_error("kses4::AddHTML() requires the tag to be a string", E_USER_WARNING);\r
-                                       return false;\r
-                               }\r
-\r
-                               $tag = strtolower(trim($tag));\r
-                               if($tag == "")\r
-                               {\r
-                                       trigger_error("kses4::AddHTML() tried to add an empty/NULL tag", E_USER_WARNING);\r
-                                       return false;\r
-                               }\r
-\r
-                               if(!is_array($attribs))\r
-                               {\r
-                                       trigger_error("kses4::AddHTML() requires an array (even an empty one) of attributes for '$tag'", E_USER_WARNING);\r
-                                       return false;\r
-                               }\r
-\r
-                               $new_attribs = array();\r
-                               if(is_array($attribs) && count($attribs) > 0)\r
-                               {\r
-                                       foreach($attribs as $idx1 => $val1)\r
-                                       {\r
-                                               $new_idx1 = strtolower($idx1);\r
-                                               $new_val1 = $attribs[$idx1];\r
-\r
-                                               if(is_array($new_val1) && count($new_val1) > 0)\r
-                                               {\r
-                                                       $tmp_val = array();\r
-                                                       foreach($new_val1 as $idx2 => $val2)\r
-                                                       {\r
-                                                               $new_idx2 = strtolower($idx2);\r
-                                                               $tmp_val[$new_idx2] = $val2;\r
-                                                       }\r
-                                                       $new_val1 = $tmp_val;\r
-                                               }\r
-\r
-                                               $new_attribs[$new_idx1] = $new_val1;\r
-                                       }\r
-                               }\r
-\r
-                               $this->allowed_html[$tag] = $new_attribs;\r
-                               return true;\r
-                       }\r
-\r
-                       /**\r
-                        *      Removes a single protocol from $this->allowed_protocols.\r
-                        *\r
-                        *      This method accepts a string argument and removes it from\r
-                        *      the list of allowed protocols to keep when performing\r
-                        *      Parse().\r
-                        *\r
-                        *      @access public\r
-                        *      @param string $protocol The name of the protocol to be removed.\r
-                        *      @return bool Status of removing valid protocol.\r
-                        *      @since PHP4 OOP 0.2.1\r
-                        */\r
-                       function RemoveProtocol($protocol = "")\r
-                       {\r
-                               if(!is_string($protocol))\r
-                               {\r
-                                       trigger_error("kses4::RemoveProtocol() requires a string.", E_USER_WARNING);\r
-                                       return false;\r
-                               }\r
-\r
-                               // Remove any inadvertent ':' at the end of the protocol.\r
-                               if(substr($protocol, strlen($protocol) - 1, 1) == ":")\r
-                               {\r
-                                       $protocol = substr($protocol, 0, strlen($protocol) - 1);\r
-                               }\r
-\r
-                               $protocol = strtolower(trim($protocol));\r
-                               if($protocol == "")\r
-                               {\r
-                                       trigger_error("kses4::RemoveProtocol() tried to remove an empty/NULL protocol.", E_USER_WARNING);\r
-                                       return false;\r
-                               }\r
-\r
-                               //      Ensures that the protocol exists before removing it.\r
-                               if(in_array($protocol, $this->allowed_protocols))\r
-                               {\r
-                                       $this->allowed_protocols = array_diff($this->allowed_protocols, array($protocol));\r
-                                       sort($this->allowed_protocols);\r
-                               }\r
-\r
-                               return true;\r
-                       }\r
-\r
-                       /**\r
-                        *      Allows for single/batch removal of protocols\r
-                        *\r
-                        *      This method accepts one argument that can be either a string\r
-                        *      or an array of strings.  Invalid data will be ignored.\r
-                        *\r
-                        *      The argument will be processed, and each string will be removed\r
-                        *      via RemoveProtocol().\r
-                        *\r
-                        *      @access public\r
-                        *      @param mixed , A string or array of protocols that will be removed from the internal list of allowed protocols.\r
-                        *      @return bool Status of removing valid protocols.\r
-                        *      @see RemoveProtocol()\r
-                        *      @since PHP5 OOP 0.2.1\r
-                        */\r
-                       function RemoveProtocols()\r
-                       {\r
-                               $c_args = func_num_args();\r
-                               if($c_args != 1)\r
-                               {\r
-                                       return false;\r
-                               }\r
-\r
-                               $protocol_data = func_get_arg(0);\r
-\r
-                               if(is_array($protocol_data) && count($protocol_data) > 0)\r
-                               {\r
-                                       foreach($protocol_data as $protocol)\r
-                                       {\r
-                                               $this->RemoveProtocol($protocol);\r
-                                       }\r
-                               }\r
-                               elseif(is_string($protocol_data))\r
-                               {\r
-                                       $this->RemoveProtocol($protocol_data);\r
-                                       return true;\r
-                               }\r
-                               else\r
-                               {\r
-                                       trigger_error("kses4::RemoveProtocols() did not receive a string or an array.", E_USER_WARNING);\r
-                                       return false;\r
-                               }\r
-                       }\r
-\r
-                       /**\r
-                        *      This method removes any NULL or characters in $string.\r
-                        *\r
-                        *      @access private\r
-                        *      @param string $string\r
-                        *      @return string String without any NULL/chr(173)\r
-                        *      @since PHP4 OOP 0.0.1\r
-                        */\r
-                       function _no_null($string)\r
-                       {\r
-                               $string = preg_replace('/\0+/', '', $string);\r
-                               $string = preg_replace('/(\\\\0)+/', '', $string);\r
-                               return $string;\r
-                       }\r
-\r
-                       /**\r
-                        *      This function removes the HTML JavaScript entities found in early versions of\r
-                        *      Netscape 4.\r
-                        *\r
-                        *      @access private\r
-                        *      @param string $string\r
-                        *      @return string String without any NULL/chr(173)\r
-                        *      @since PHP4 OOP 0.0.1\r
-                        */\r
-                       function _js_entities($string)\r
-                       {\r
-                         return preg_replace('%&\s*\{[^}]*(\}\s*;?|$)%', '', $string);\r
-                       }\r
-\r
-                       /**\r
-                        *      Normalizes HTML entities\r
-                        *\r
-                        *      This function normalizes HTML entities. It will convert "AT&T" to the correct\r
-                        *      "AT&amp;T", "&#00058;" to "&#58;", "&#XYZZY;" to "&amp;#XYZZY;" and so on.\r
-                        *\r
-                        *      @access private\r
-                        *      @param string $string\r
-                        *      @return string String with normalized entities\r
-                        *      @since PHP4 OOP 0.0.1\r
-                        */\r
-                       function _normalize_entities($string)\r
-                       {\r
-                               # Disarm all entities by converting & to &amp;\r
-                         $string = str_replace('&', '&amp;', $string);\r
-\r
-                               # Change back the allowed entities in our entity white list\r
-\r
-                         $string = preg_replace('/&amp;([A-Za-z][A-Za-z0-9]{0,19});/', '&\\1;', $string);\r
-                         $string = preg_replace('/&amp;#0*([0-9]{1,5});/e', '\$this->_normalize_entities2("\\1")', $string);\r
-                         $string = preg_replace('/&amp;#([Xx])0*(([0-9A-Fa-f]{2}){1,2});/', '&#\\1\\2;', $string);\r
-\r
-                         return $string;\r
-                       }\r
-\r
-                       /**\r
-                        *      Helper method used by normalizeEntites()\r
-                        *\r
-                        *      This method helps normalizeEntities() to only accept 16 bit values\r
-                        *      and nothing more for &#number; entities.\r
-                        *\r
-                        *      This method helps normalize_entities() during a preg_replace()\r
-                        *      where a &#(0)*XXXXX; occurs.  The '(0)*XXXXXX' value is converted to\r
-                        *      a number and the result is returned as a numeric entity if the number\r
-                        *      is less than 65536.  Otherwise, the value is returned 'as is'.\r
-                        *\r
-                        *      @access private\r
-                        *      @param string $i\r
-                        *      @return string Normalized numeric entity\r
-                        *      @see _normalize_entities()\r
-                        *      @since PHP4 OOP 0.0.1\r
-                        */\r
-                       function _normalize_entities2($i)\r
-                       {\r
-                         return (($i > 65535) ? "&amp;#$i;" : "&#$i;");\r
-                       }\r
-\r
-                       /**\r
-                        *      Allows for additional user defined modifications to text.\r
-                        *\r
-                        *      @deprecated use filterKsesTextHook()\r
-                        *      @param string $string\r
-                        *      @see filterKsesTextHook()\r
-                        *      @return string\r
-                        *      @since PHP4 OOP 0.0.1\r
-                        */\r
-                       function _hook($string)\r
-                       {\r
-                         return $this->filterKsesTextHook($string);\r
-                       }\r
-\r
-                       /**\r
-                        *      Allows for additional user defined modifications to text.\r
-                        *\r
-                        *      This method allows for additional modifications to be performed on\r
-                        *      a string that's being run through Parse().  Currently, it returns the\r
-                        *      input string 'as is'.\r
-                        *\r
-                        *      This method is provided for users to extend the kses class for their own\r
-                        *      requirements.\r
-                        *\r
-                        *      @access public\r
-                        *      @param string $string String to perfrom additional modifications on.\r
-                        *      @return string User modified string.\r
-                        *      @see Parse()\r
-                        *      @since PHP5 OOP 1.0.0\r
-                        */\r
-                       function filterKsesTextHook($string)\r
-                       {\r
-                         return $string;\r
-                       }\r
-\r
-                       /**\r
-                        *      This method goes through an array, and changes the keys to all lower case.\r
-                        *\r
-                        *      @access private\r
-                        *      @param array $in_array Associative array\r
-                        *      @return array Modified array\r
-                        *      @since PHP4 OOP 0.0.1\r
-                        */\r
-                       function _array_lc($inarray)\r
-                       {\r
-                         $outarray = array();\r
-\r
-                               if(is_array($inarray) && count($inarray) > 0)\r
-                               {\r
-                                       foreach ($inarray as $inkey => $inval)\r
-                                       {\r
-                                               $outkey = strtolower($inkey);\r
-                                               $outarray[$outkey] = array();\r
-\r
-                                               if(is_array($inval) && count($inval) > 0)\r
-                                               {\r
-                                                       foreach ($inval as $inkey2 => $inval2)\r
-                                                       {\r
-                                                               $outkey2 = strtolower($inkey2);\r
-                                                               $outarray[$outkey][$outkey2] = $inval2;\r
-                                                       }\r
-                                               }\r
-                                       }\r
-                               }\r
-\r
-                         return $outarray;\r
-                       }\r
-\r
-                       /**\r
-                        *      This method searched for HTML tags, no matter how malformed.  It also\r
-                        *      matches stray ">" characters.\r
-                        *\r
-                        *      @access private\r
-                        *      @param string $string\r
-                        *      @return string HTML tags\r
-                        *      @since PHP4 OOP 0.0.1\r
-                        */\r
-                       function _split($string)\r
-                       {\r
-                               return preg_replace(\r
-                                       '%(<'.   # EITHER: <\r
-                                       '[^>]*'. # things that aren't >\r
-                                       '(>|$)'. # > or end of string\r
-                                       '|>)%e', # OR: just a >\r
-                                       "\$this->_split2('\\1')",\r
-                                       $string);\r
-                       }\r
-\r
-                       /**\r
-                        *      This method strips out disallowed and/or mangled (X)HTML tags along with assigned attributes.\r
-                        *\r
-                        *      This method does a lot of work. It rejects some very malformed things\r
-                        *      like <:::>. It returns an empty string if the element isn't allowed (look\r
-                        *      ma, no strip_tags()!). Otherwise it splits the tag into an element and an\r
-                        *      allowed attribute list.\r
-                        *\r
-                        *      @access private\r
-                        *      @param string $string\r
-                        *      @return string Modified string minus disallowed/mangled (X)HTML and attributes\r
-                        *      @since PHP4 OOP 0.0.1\r
-                        */\r
-                       function _split2($string)\r
-                       {\r
-                               $string = $this->_stripslashes($string);\r
-\r
-                               if (substr($string, 0, 1) != '<')\r
-                               {\r
-                                       # It matched a ">" character\r
-                                       return '&gt;';\r
-                               }\r
-\r
-                               if (!preg_match('%^<\s*(/\s*)?([a-zA-Z0-9]+)([^>]*)>?$%', $string, $matches))\r
-                               {\r
-                                       # It's seriously malformed\r
-                                       return '';\r
-                               }\r
-\r
-                               $slash    = trim($matches[1]);\r
-                               $elem     = $matches[2];\r
-                               $attrlist = $matches[3];\r
-\r
-                               if (\r
-                                       !isset($this->allowed_html[strtolower($elem)]) ||\r
-                                       !is_array($this->allowed_html[strtolower($elem)])\r
-                               )\r
-                               {\r
-                                       # They are using a not allowed HTML element\r
-                                       return '';\r
-                               }\r
-\r
-                               if ($slash != '')\r
-                               {\r
-                                       return "<$slash$elem>";\r
-                               }\r
-                               # No attributes are allowed for closing elements\r
-\r
-                               return $this->_attr("$slash$elem", $attrlist);\r
-                       }\r
-\r
-                       /**\r
-                        *      This method strips out disallowed attributes for (X)HTML tags.\r
-                        *\r
-                        *      This method removes all attributes if none are allowed for this element.\r
-                        *      If some are allowed it calls $this->_hair() to split them further, and then it\r
-                        *      builds up new HTML code from the data that $this->_hair() returns. It also\r
-                        *      removes "<" and ">" characters, if there are any left. One more thing it\r
-                        *      does is to check if the tag has a closing XHTML slash, and if it does,\r
-                        *      it puts one in the returned code as well.\r
-                        *\r
-                        *      @access private\r
-                        *      @param string $element (X)HTML tag to check\r
-                        *      @param string $attr Text containing attributes to check for validity.\r
-                        *      @return string Resulting valid (X)HTML or ''\r
-                        *      @see _hair()\r
-                        *      @since PHP4 OOP 0.0.1\r
-                        */\r
-                       function _attr($element, $attr)\r
-                       {\r
-                               # Is there a closing XHTML slash at the end of the attributes?\r
-                               $xhtml_slash = '';\r
-                               if (preg_match('%\s/\s*$%', $attr))\r
-                               {\r
-                                       $xhtml_slash = ' /';\r
-                               }\r
-\r
-                               # Are any attributes allowed at all for this element?\r
-                               if (\r
-                                       !isset($this->allowed_html[strtolower($element)]) ||\r
-                                       count($this->allowed_html[strtolower($element)]) == 0\r
-                               )\r
-                               {\r
-                                       return "<$element$xhtml_slash>";\r
-                               }\r
-\r
-                               # Split it\r
-                               $attrarr = $this->_hair($attr);\r
-\r
-                               # Go through $attrarr, and save the allowed attributes for this element\r
-                               # in $attr2\r
-                               $attr2 = '';\r
-                               if(is_array($attrarr) && count($attrarr) > 0)\r
-                               {\r
-                                       foreach ($attrarr as $arreach)\r
-                                       {\r
-                                               if(!isset($this->allowed_html[strtolower($element)][strtolower($arreach['name'])]))\r
-                                               {\r
-                                                       continue;\r
-                                               }\r
-\r
-                                               $current = $this->allowed_html[strtolower($element)][strtolower($arreach['name'])];\r
-                                               if ($current == '')\r
-                                               {\r
-                                                       # the attribute is not allowed\r
-                                                       continue;\r
-                                               }\r
-\r
-                                               if (!is_array($current))\r
-                                               {\r
-                                                       # there are no checks\r
-                                                       $attr2 .= ' '.$arreach['whole'];\r
-                                               }\r
-                                               else\r
-                                               {\r
-                                                       # there are some checks\r
-                                                       $ok = true;\r
-                                                       if(is_array($current) && count($current) > 0)\r
-                                                       {\r
-                                                               foreach ($current as $currkey => $currval)\r
-                                                               {\r
-                                                                       if (!$this->_check_attr_val($arreach['value'], $arreach['vless'], $currkey, $currval))\r
-                                                                       {\r
-                                                                               $ok = false;\r
-                                                                               break;\r
-                                                                       }\r
-                                                               }\r
-\r
-                                                               if ($ok)\r
-                                                               {\r
-                                                                       # it passed them\r
-                                                                       $attr2 .= ' '.$arreach['whole'];\r
-                                                               }\r
-                                                       }\r
-                                               }\r
-                                       }\r
-                               }\r
-\r
-                               # Remove any "<" or ">" characters\r
-                               $attr2 = preg_replace('/[<>]/', '', $attr2);\r
-                               return "<$element$attr2$xhtml_slash>";\r
-                       }\r
-\r
-                       /**\r
-                        *      This method combs through an attribute list string and returns an associative array of attributes and values.\r
-                        *\r
-                        *      This method does a lot of work. It parses an attribute list into an array\r
-                        *      with attribute data, and tries to do the right thing even if it gets weird\r
-                        *      input. It will add quotes around attribute values that don't have any quotes\r
-                        *      or apostrophes around them, to make it easier to produce HTML code that will\r
-                        *      conform to W3C's HTML specification. It will also remove bad URL protocols\r
-                        *      from attribute values.\r
-                        *\r
-                        *      @access private\r
-                        *      @param string $attr Text containing tag attributes for parsing\r
-                        *      @return array Associative array containing data on attribute and value\r
-                        *      @since PHP4 OOP 0.0.1\r
-                        */\r
-                       function _hair($attr)\r
-                       {\r
-                               $attrarr  = array();\r
-                               $mode     = 0;\r
-                               $attrname = '';\r
-\r
-                               # Loop through the whole attribute list\r
-\r
-                               while (strlen($attr) != 0)\r
-                               {\r
-                                       # Was the last operation successful?\r
-                                       $working = 0;\r
-\r
-                                       switch ($mode)\r
-                                       {\r
-                                               case 0: # attribute name, href for instance\r
-                                                       if (preg_match('/^([-a-zA-Z]+)/', $attr, $match))\r
-                                                       {\r
-                                                               $attrname = $match[1];\r
-                                                               $working = $mode = 1;\r
-                                                               $attr = preg_replace('/^[-a-zA-Z]+/', '', $attr);\r
-                                                       }\r
-                                                       break;\r
-                                               case 1: # equals sign or valueless ("selected")\r
-                                                       if (preg_match('/^\s*=\s*/', $attr)) # equals sign\r
-                                                       {\r
-                                                               $working = 1;\r
-                                                               $mode    = 2;\r
-                                                               $attr    = preg_replace('/^\s*=\s*/', '', $attr);\r
-                                                               break;\r
-                                                       }\r
-                                                       if (preg_match('/^\s+/', $attr)) # valueless\r
-                                                       {\r
-                                                               $working   = 1;\r
-                                                               $mode      = 0;\r
-                                                               $attrarr[] = array(\r
-                                                                       'name'  => $attrname,\r
-                                                                       'value' => '',\r
-                                                                       'whole' => $attrname,\r
-                                                                       'vless' => 'y'\r
-                                                               );\r
-                                                               $attr      = preg_replace('/^\s+/', '', $attr);\r
-                                                       }\r
-                                                       break;\r
-                                               case 2: # attribute value, a URL after href= for instance\r
-                                                       if (preg_match('/^"([^"]*)"(\s+|$)/', $attr, $match)) # "value"\r
-                                                       {\r
-                                                               $thisval   = $this->_bad_protocol($match[1]);\r
-                                                               $attrarr[] = array(\r
-                                                                       'name'  => $attrname,\r
-                                                                       'value' => $thisval,\r
-                                                                       'whole' => "$attrname=\"$thisval\"",\r
-                                                                       'vless' => 'n'\r
-                                                               );\r
-                                                               $working   = 1;\r
-                                                               $mode      = 0;\r
-                                                               $attr      = preg_replace('/^"[^"]*"(\s+|$)/', '', $attr);\r
-                                                               break;\r
-                                                       }\r
-                                                       if (preg_match("/^'([^']*)'(\s+|$)/", $attr, $match)) # 'value'\r
-                                                       {\r
-                                                               $thisval   = $this->_bad_protocol($match[1]);\r
-                                                               $attrarr[] = array(\r
-                                                                       'name'  => $attrname,\r
-                                                                       'value' => $thisval,\r
-                                                                       'whole' => "$attrname='$thisval'",\r
-                                                                       'vless' => 'n'\r
-                                                               );\r
-                                                               $working   = 1;\r
-                                                               $mode      = 0;\r
-                                                               $attr      = preg_replace("/^'[^']*'(\s+|$)/", '', $attr);\r
-                                                               break;\r
-                                                       }\r
-                                                       if (preg_match("%^([^\s\"']+)(\s+|$)%", $attr, $match)) # value\r
-                                                       {\r
-                                                               $thisval   = $this->_bad_protocol($match[1]);\r
-                                                               $attrarr[] = array(\r
-                                                                       'name'  => $attrname,\r
-                                                                       'value' => $thisval,\r
-                                                                       'whole' => "$attrname=\"$thisval\"",\r
-                                                                       'vless' => 'n'\r
-                                                               );\r
-                                                               # We add quotes to conform to W3C's HTML spec.\r
-                                                               $working   = 1;\r
-                                                               $mode      = 0;\r
-                                                               $attr      = preg_replace("%^[^\s\"']+(\s+|$)%", '', $attr);\r
-                                                       }\r
-                                                       break;\r
-                                       }\r
-\r
-                                       if ($working == 0) # not well formed, remove and try again\r
-                                       {\r
-                                               $attr = $this->_html_error($attr);\r
-                                               $mode = 0;\r
-                                       }\r
-                               }\r
-\r
-                               # special case, for when the attribute list ends with a valueless\r
-                               # attribute like "selected"\r
-                               if ($mode == 1)\r
-                               {\r
-                                       $attrarr[] = array(\r
-                                               'name'  => $attrname,\r
-                                               'value' => '',\r
-                                               'whole' => $attrname,\r
-                                               'vless' => 'y'\r
-                                       );\r
-                               }\r
-\r
-                               return $attrarr;\r
-                       }\r
-\r
-                       /**\r
-                        *      This method removes disallowed protocols.\r
-                        *\r
-                        *      This method removes all non-allowed protocols from the beginning of\r
-                        *      $string. It ignores whitespace and the case of the letters, and it does\r
-                        *      understand HTML entities. It does its work in a while loop, so it won't be\r
-                        *      fooled by a string like "javascript:javascript:alert(57)".\r
-                        *\r
-                        *      @access private\r
-                        *      @param string $string String to check for protocols\r
-                        *      @return string String with removed protocols\r
-                        *      @since PHP4 OOP 0.0.1\r
-                        */\r
-                       function _bad_protocol($string)\r
-                       {\r
-                               $string  = $this->_no_null($string);\r
-                               $string = preg_replace('/\xad+/', '', $string); # deals with Opera "feature"\r
-                               $string2 = $string.'a';\r
-\r
-                               while ($string != $string2)\r
-                               {\r
-                                       $string2 = $string;\r
-                                       $string  = $this->_bad_protocol_once($string);\r
-                               } # while\r
-\r
-                               return $string;\r
-                       }\r
-\r
-                       /**\r
-                        *      Helper method used by _bad_protocol()\r
-                        *\r
-                        *      This function searches for URL protocols at the beginning of $string, while\r
-                        *      handling whitespace and HTML entities.\r
-                        *\r
-                        *      @access private\r
-                        *      @param string $string String to check for protocols\r
-                        *      @return string String with removed protocols\r
-                        *      @see _bad_protocol()\r
-                        *      @since PHP4 OOP 0.0.1\r
-                        */\r
-                       function _bad_protocol_once($string)\r
-                       {\r
-                               return preg_replace(\r
-                                       '/^((&[^;]*;|[\sA-Za-z0-9])*)'.\r
-                                       '(:|&#58;|&#[Xx]3[Aa];)\s*/e',\r
-                                       '\$this->_bad_protocol_once2("\\1")',\r
-                                       $string\r
-                               );\r
-                       }\r
-\r
-                       /**\r
-                        *      Helper method used by _bad_protocol_once() regex\r
-                        *\r
-                        *      This function processes URL protocols, checks to see if they're in the white-\r
-                        *      list or not, and returns different data depending on the answer.\r
-                        *\r
-                        *      @access private\r
-                        *      @param string $string String to check for protocols\r
-                        *      @return string String with removed protocols\r
-                        *      @see _bad_protocol()\r
-                        *      @see _bad_protocol_once()\r
-                        *      @since PHP4 OOP 0.0.1\r
-                        */\r
-                       function _bad_protocol_once2($string)\r
-                       {\r
-                               $string = $this->_decode_entities($string);\r
-                               $string = preg_replace('/\s/', '', $string);\r
-                               $string = $this->_no_null($string);\r
-                               $string = preg_replace('/\xad+/', '', $string); # deals with Opera "feature"\r
-                               $string = strtolower($string);\r
-\r
-                               $allowed = false;\r
-                               if(is_array($this->allowed_protocols) && count($this->allowed_protocols) > 0)\r
-                               {\r
-                                       foreach ($this->allowed_protocols as $one_protocol)\r
-                                       {\r
-                                               if (strtolower($one_protocol) == $string)\r
-                                               {\r
-                                                       $allowed = true;\r
-                                                       break;\r
-                                               }\r
-                                       }\r
-                               }\r
-\r
-                               if ($allowed)\r
-                               {\r
-                                       return "$string:";\r
-                               }\r
-                               else\r
-                               {\r
-                                       return '';\r
-                               }\r
-                       }\r
-\r
-                       /**\r
-                        *      This function performs different checks for attribute values.\r
-                        *\r
-                        *      The currently implemented checks are "maxlen", "minlen", "maxval",\r
-                        *      "minval" and "valueless" with even more checks to come soon.\r
-                        *\r
-                        *      @access private\r
-                        *      @param string $value The value of the attribute to be checked.\r
-                        *      @param string $vless Indicates whether the the value is supposed to be valueless\r
-                        *      @param string $checkname The check to be performed\r
-                        *      @param string $checkvalue The value that is to be checked against\r
-                        *      @return bool Indicates whether the check passed or not\r
-                        *      @since PHP4 OOP 0.0.1\r
-                        */\r
-                       function _check_attr_val($value, $vless, $checkname, $checkvalue)\r
-                       {\r
-                               $ok = true;\r
-\r
-                               switch (strtolower($checkname))\r
-                               {\r
-                                       /**\r
-                                       *       The maxlen check makes sure that the attribute value has a length not\r
-                                       *       greater than the given value. This can be used to avoid Buffer Overflows\r
-                                       *       in WWW clients and various Internet servers.\r
-                                       */\r
-                                       case 'maxlen':\r
-                                               if (strlen($value) > $checkvalue)\r
-                                               {\r
-                                                       $ok = false;\r
-                                               }\r
-                                               break;\r
-\r
-                                       /**\r
-                                       *       The minlen check makes sure that the attribute value has a length not\r
-                                       *       smaller than the given value.\r
-                                       */\r
-                                       case 'minlen':\r
-                                               if (strlen($value) < $checkvalue)\r
-                                               {\r
-                                                       $ok = false;\r
-                                               }\r
-                                               break;\r
-\r
-                                       /**\r
-                                       *       The maxval check does two things: it checks that the attribute value is\r
-                                       *       an integer from 0 and up, without an excessive amount of zeroes or\r
-                                       *       whitespace (to avoid Buffer Overflows). It also checks that the attribute\r
-                                       *       value is not greater than the given value.\r
-                                       *       This check can be used to avoid Denial of Service attacks.\r
-                                       */\r
-                                       case 'maxval':\r
-                                               if (!preg_match('/^\s{0,6}[0-9]{1,6}\s{0,6}$/', $value))\r
-                                               {\r
-                                                       $ok = false;\r
-                                               }\r
-                                               if ($value > $checkvalue)\r
-                                               {\r
-                                                       $ok = false;\r
-                                               }\r
-                                               break;\r
-\r
-                                       /**\r
-                                       *       The minval check checks that the attribute value is a positive integer,\r
-                                       *       and that it is not smaller than the given value.\r
-                                       */\r
-                                       case 'minval':\r
-                                               if (!preg_match('/^\s{0,6}[0-9]{1,6}\s{0,6}$/', $value))\r
-                                               {\r
-                                                       $ok = false;\r
-                                               }\r
-                                               if ($value < $checkvalue)\r
-                                               {\r
-                                                       $ok = false;\r
-                                               }\r
-                                               break;\r
-\r
-                                       /**\r
-                                       *       The valueless check checks if the attribute has a value\r
-                                       *       (like <a href="blah">) or not (<option selected>). If the given value\r
-                                       *       is a "y" or a "Y", the attribute must not have a value.\r
-                                       *       If the given value is an "n" or an "N", the attribute must have one.\r
-                                       */\r
-                                       case 'valueless':\r
-                                       if (strtolower($checkvalue) != $vless)\r
-                                       {\r
-                                               $ok = false;\r
-                                       }\r
-                                       break;\r
-\r
-                               }\r
-\r
-                               return $ok;\r
-                       }\r
-\r
-                       /**\r
-                        *      Changes \" to "\r
-                        *\r
-                        *      This function changes the character sequence  \"  to just  "\r
-                        *      It leaves all other slashes alone. It's really weird, but the quoting from\r
-                        *      preg_replace(//e) seems to require this.\r
-                        *\r
-                        *      @access private\r
-                        *      @param string $string The string to be stripped.\r
-                        *      @return string string stripped of \"\r
-                        *      @since PHP4 OOP 0.0.1\r
-                        */\r
-                       function _stripslashes($string)\r
-                       {\r
-                               return preg_replace('%\\\\"%', '"', $string);\r
-                       }\r
-\r
-                       /**\r
-                        *      helper method for _hair()\r
-                        *\r
-                        *      This function deals with parsing errors in _hair(). The general plan is\r
-                        *      to remove everything to and including some whitespace, but it deals with\r
-                        *      quotes and apostrophes as well.\r
-                        *\r
-                        *      @access private\r
-                        *      @param string $string The string to be stripped.\r
-                        *      @return string string stripped of whitespace\r
-                        *      @see _hair()\r
-                        *      @since PHP4 OOP 0.0.1\r
-                        */\r
-                       function _html_error($string)\r
-                       {\r
-                               return preg_replace('/^("[^"]*("|$)|\'[^\']*(\'|$)|\S)*\s*/', '', $string);\r
-                       }\r
-\r
-                       /**\r
-                        *      Decodes numeric HTML entities\r
-                        *\r
-                        *      This method decodes numeric HTML entities (&#65; and &#x41;). It doesn't\r
-                        *      do anything with other entities like &auml;, but we don't need them in the\r
-                        *      URL protocol white listing system anyway.\r
-                        *\r
-                        *      @access private\r
-                        *      @param string $value The entitiy to be decoded.\r
-                        *      @return string Decoded entity\r
-                        *      @since PHP4 OOP 0.0.1\r
-                        */\r
-                       function _decode_entities($string)\r
-                       {\r
-                               $string = preg_replace('/&#([0-9]+);/e', 'chr("\\1")', $string);\r
-                               $string = preg_replace('/&#[Xx]([0-9A-Fa-f]+);/e', 'chr(hexdec("\\1"))', $string);\r
-                               return $string;\r
-                       }\r
-\r
-                       /**\r
-                        *      Returns PHP4 OOP version # of kses.\r
-                        *\r
-                        *      Since this class has been refactored and documented and proven to work,\r
-                        *      I'm syncing the version number to procedural kses.\r
-                        *\r
-                        *      @access public\r
-                        *      @return string Version number\r
-                        *      @since PHP4 OOP 0.0.1\r
-                        */\r
-                       function _version()\r
-                       {\r
-                               return 'PHP4 0.2.2 (OOP fork of procedural kses 0.2.2)';\r
-                       }\r
-               }\r
-\r
-\r
-\r
-       }\r
-?>
\ No newline at end of file
diff --git a/mod/kses/vendors/kses/oop/php5.class.kses.php b/mod/kses/vendors/kses/oop/php5.class.kses.php
deleted file mode 100644 (file)
index 541f1bd..0000000
+++ /dev/null
@@ -1,1172 +0,0 @@
-<?php\r
-\r
-       /*\r
-        * ==========================================================================================\r
-        *\r
-        * This program is free software and open source software; you can redistribute\r
-        * it and/or modify it under the terms of the GNU General Public License as\r
-        * published by the Free Software Foundation; either version 2 of the License,\r
-        * or (at your option) any later version.\r
-        *\r
-        * This program is distributed in the hope that it will be useful, but WITHOUT\r
-        * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\r
-        * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for\r
-        * more details.\r
-        *\r
-        * You should have received a copy of the GNU General Public License along\r
-        * with this program; if not, write to the Free Software Foundation, Inc.,\r
-        * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA  or visit\r
-        * http://www.gnu.org/licenses/gpl.html\r
-        *\r
-        * ==========================================================================================\r
-        */\r
-\r
-       /**\r
-       *       Class file for PHP5 OOP version of kses\r
-       *\r
-       *       This is an updated version of kses to work with PHP5 that works under E_STRICT.\r
-       *\r
-       *       This version is a bit of a rewrite to match my own coding style and use some of the\r
-       *       capabilities allowed in PHP5.  Since this was a significant rewrite, but it still\r
-       *       maintains backward compatibility syntax-wise, the version number is now 1.0.0.  Any\r
-       *       minor changes that do not break compatibility will be indicated in the second or third\r
-       *       digits.  Anything that breaks compatibility will change the major version number.\r
-       *\r
-       *       PHP5 specific changes:\r
-       *       + Private methods are now in place\r
-       *       + __construct() is now used rather then the standard class name 'kses()'\r
-       *       + Kses will not load in any version less that PHP5\r
-       *       Other modifications:\r
-       *       + PHPdoc style documentation has been added to the class.  See http://www.phpdoc.org/ for more info.\r
-       *       + Method names have been changed to reflect status as verbs\r
-       *       + One line methods have been folded into the code\r
-       *       + Some methods are now deprecated due to nomenclature style change.  See method documentation for specifics.\r
-       *       + Kses5 now works in E_STRICT\r
-       *       + Version number is 1.0.0 to reflect serious code changes\r
-       *       + Addition of methods AddProtocols(), filterKsestextHook(), RemoveProtocol(), RemoveProtocols() and SetProtocols()\r
-       *       + Deprecated _hook(), Protocols()\r
-       *\r
-       *       @package    kses\r
-       *       @subpackage kses5\r
-       */\r
-\r
-       if(substr(phpversion(), 0, 1) < 5)\r
-       {\r
-               die("Class kses requires PHP 5 or higher.");\r
-       }\r
-\r
-       /**\r
-       *       Only install KSES5 once\r
-       */\r
-       if(!defined('KSES_CLASS_PHP5'))\r
-       {\r
-               define('KSES_CLASS_PHP5', true);\r
-\r
-       /**\r
-       *       Kses strips evil scripts!\r
-       *\r
-       *       This class provides the capability for removing unwanted HTML/XHTML, attributes from\r
-       *       tags, and protocols contained in links.  The net result is a much more powerful tool\r
-       *       than the PHP internal strip_tags()\r
-       *\r
-       *       This is a fork of a slick piece of procedural code called 'kses' written by Ulf Harnhammar.\r
-       *\r
-       *       The original class for PHP4 was basically a wrapper around all of the functions in\r
-       *       the procedural code written by Ulf, and was released 7/25/2003.\r
-       *\r
-       *       This version is a bit of a rewrite to match my own coding style and use some of the\r
-       *       capabilities allowed in PHP5.  Since this was a significant rewrite, but it still\r
-       *       maintains backward compatibility syntax-wise, the version number is now 1.0.0.  Any\r
-       *       minor changes that do not break compatibility will be indicated in the second or third\r
-       *       digits.  Anything that breaks compatibility will change the major version number.\r
-       *\r
-       *       PHP5 specific changes:\r
-       *       + Private methods are now in place\r
-       *       + __construct() is now used rather then the standard class name 'kses()'\r
-       *       + Kses5 will not load in any version less that PHP5\r
-       *       Other modifications:\r
-       *       + PHPdoc style documentation has been added to the class.  See http://www.phpdoc.org/ for more info.\r
-       *       + Method names have been changed to reflect status as verbs\r
-       *       + One line methods have been folded into the code\r
-       *       + Some methods are now deprecated due to nomenclature style change.  See method documentation for specifics.\r
-       *       + Kses now works in E_STRICT\r
-       *       + Initial Version number set to 1.0.0 to reflect serious code changes\r
-       *       + Addition of methods AddProtocols(), filterKsestextHook(), RemoveProtocol(), RemoveProtocols() and SetProtocols()\r
-       *       + Deprecated _hook(), Protocols()\r
-       *       + Integrated code from kses 0.2.2 into class.\r
-       *       + Added methods DumpProtocols(), DumpMethods()\r
-       *\r
-       *       @author     Richard R. Vásquez, Jr. (Original procedural code by Ulf Härnhammar)\r
-       *       @link       http://sourceforge.net/projects/kses/ Home Page for Kses\r
-       *       @link       http://chaos.org/contact/ Contact page with current email address for Richard Vasquez\r
-       *       @copyright  Richard R. Vásquez, Jr. 2005\r
-       *       @version    PHP5 OOP 1.0.2\r
-       *       @license    http://www.gnu.org/licenses/gpl.html GNU Public License\r
-       *       @package    kses\r
-       */\r
-               class kses5\r
-               {\r
-                       /**#@+\r
-                        *      @access private\r
-                        *      @var array\r
-                        */\r
-                       private $allowed_protocols;\r
-                       private $allowed_html;\r
-                       /**#@-*/\r
-\r
-                       /**\r
-                        *      Constructor for kses.\r
-                        *\r
-                        *      This sets a default collection of protocols allowed in links, and creates an\r
-                        *      empty set of allowed HTML tags.\r
-                        *      @since PHP5 OOP 1.0.0\r
-                        */\r
-                       public function __construct()\r
-                       {\r
-                               /**\r
-                                *      You could add protocols such as ftp, new, gopher, mailto, irc, etc.\r
-                                *\r
-                                *      The base values the original kses provided were:\r
-                                *              'http', 'https', 'ftp', 'news', 'nntp', 'telnet', 'gopher', 'mailto'\r
-                                */\r
-                               $this->allowed_protocols = array('http', 'ftp', 'mailto');\r
-                               $this->allowed_html      = array();\r
-                       }\r
-\r
-                       /**\r
-                        *      Basic task of kses - parses $string and strips it as required.\r
-                        *\r
-                        *      This method strips all the disallowed (X)HTML tags, attributes\r
-                        *      and protocols from the input $string.\r
-                        *\r
-                        *      @access public\r
-                        *      @param string $string String to be stripped of 'evil scripts'\r
-                        *      @return string The stripped string\r
-                        *      @since PHP4 OOP 0.0.1\r
-                        */\r
-                       public function Parse($string = "")\r
-                       {\r
-                               if (get_magic_quotes_gpc())\r
-                               {\r
-                                       $string = stripslashes($string);\r
-                               }\r
-                               $string = $this->removeNulls($string);\r
-                               //      Remove JavaScript entities from early Netscape 4 versions\r
-                               $string = preg_replace('%&\s*\{[^}]*(\}\s*;?|$)%', '', $string);\r
-                               $string = $this->normalizeEntities($string);\r
-                               $string = $this->filterKsesTextHook($string);\r
-                               $string = preg_replace('%(<' . '[^>]*' . '(>|$)' . '|>)%e', "\$this->stripTags('\\1')", $string);\r
-                               return $string;\r
-                       }\r
-\r
-                       /**\r
-                        *      Allows for single/batch addition of protocols\r
-                        *\r
-                        *      This method accepts one argument that can be either a string\r
-                        *      or an array of strings.  Invalid data will be ignored.\r
-                        *\r
-                        *      The argument will be processed, and each string will be added\r
-                        *      via AddProtocol().\r
-                        *\r
-                        *      @access public\r
-                        *      @param mixed , A string or array of protocols that will be added to the internal list of allowed protocols.\r
-                        *      @return bool Status of adding valid protocols.\r
-                        *      @see AddProtocol()\r
-                        *      @since PHP5 OOP 1.0.0\r
-                        */\r
-                       public function AddProtocols()\r
-                       {\r
-                               $c_args = func_num_args();\r
-                               if($c_args != 1)\r
-                               {\r
-                                       trigger_error("kses5::AddProtocols() did not receive an argument.", E_USER_WARNING);\r
-                                       return false;\r
-                               }\r
-\r
-                               $protocol_data = func_get_arg(0);\r
-\r
-                               if(is_array($protocol_data) && count($protocol_data) > 0)\r
-                               {\r
-                                       foreach($protocol_data as $protocol)\r
-                                       {\r
-                                               $this->AddProtocol($protocol);\r
-                                       }\r
-                                       return true;\r
-                               }\r
-                               elseif(is_string($protocol_data))\r
-                               {\r
-                                       $this->AddProtocol($protocol_data);\r
-                                       return true;\r
-                               }\r
-                               else\r
-                               {\r
-                                       trigger_error("kses5::AddProtocols() did not receive a string or an array.", E_USER_WARNING);\r
-                                       return false;\r
-                               }\r
-                       }\r
-\r
-                       /**\r
-                        *      Allows for single/batch addition of protocols\r
-                        *\r
-                        *      @deprecated Use AddProtocols()\r
-                        *      @see AddProtocols()\r
-                        *      @return bool\r
-                        *      @since PHP4 OOP 0.0.1\r
-                        */\r
-                       public function Protocols()\r
-                       {\r
-                               $c_args = func_num_args();\r
-                               if($c_args != 1)\r
-                               {\r
-                                       trigger_error("kses5::Protocols() did not receive an argument.", E_USER_WARNING);\r
-                                       return false;\r
-                               }\r
-\r
-                               return $this->AddProtocols(func_get_arg(0));\r
-                       }\r
-\r
-                       /**\r
-                        *      Adds a single protocol to $this->allowed_protocols.\r
-                        *\r
-                        *      This method accepts a string argument and adds it to\r
-                        *      the list of allowed protocols to keep when performing\r
-                        *      Parse().\r
-                        *\r
-                        *      @access public\r
-                        *      @param string $protocol The name of the protocol to be added.\r
-                        *      @return bool Status of adding valid protocol.\r
-                        *      @since PHP4 OOP 0.0.1\r
-                        */\r
-                       public function AddProtocol($protocol = "")\r
-                       {\r
-                               if(!is_string($protocol))\r
-                               {\r
-                                       trigger_error("kses5::AddProtocol() requires a string.", E_USER_WARNING);\r
-                                       return false;\r
-                               }\r
-\r
-                               // Remove any inadvertent ':' at the end of the protocol.\r
-                               if(substr($protocol, strlen($protocol) - 1, 1) == ":")\r
-                               {\r
-                                       $protocol = substr($protocol, 0, strlen($protocol) - 1);\r
-                               }\r
-\r
-                               $protocol = strtolower(trim($protocol));\r
-                               if($protocol == "")\r
-                               {\r
-                                       trigger_error("kses5::AddProtocol() tried to add an empty/NULL protocol.", E_USER_WARNING);\r
-                                       return false;\r
-                               }\r
-\r
-                               //      prevent duplicate protocols from being added.\r
-                               if(!in_array($protocol, $this->allowed_protocols))\r
-                               {\r
-                                       array_push($this->allowed_protocols, $protocol);\r
-                                       sort($this->allowed_protocols);\r
-                               }\r
-                               return true;\r
-                       }\r
-\r
-                       /**\r
-                        *      Removes a single protocol from $this->allowed_protocols.\r
-                        *\r
-                        *      This method accepts a string argument and removes it from\r
-                        *      the list of allowed protocols to keep when performing\r
-                        *      Parse().\r
-                        *\r
-                        *      @access public\r
-                        *      @param string $protocol The name of the protocol to be removed.\r
-                        *      @return bool Status of removing valid protocol.\r
-                        *      @since PHP5 OOP 1.0.0\r
-                        */\r
-                       public function RemoveProtocol($protocol = "")\r
-                       {\r
-                               if(!is_string($protocol))\r
-                               {\r
-                                       trigger_error("kses5::RemoveProtocol() requires a string.", E_USER_WARNING);\r
-                                       return false;\r
-                               }\r
-\r
-                               // Remove any inadvertent ':' at the end of the protocol.\r
-                               if(substr($protocol, strlen($protocol) - 1, 1) == ":")\r
-                               {\r
-                                       $protocol = substr($protocol, 0, strlen($protocol) - 1);\r
-                               }\r
-\r
-                               $protocol = strtolower(trim($protocol));\r
-                               if($protocol == "")\r
-                               {\r
-                                       trigger_error("kses5::RemoveProtocol() tried to remove an empty/NULL protocol.", E_USER_WARNING);\r
-                                       return false;\r
-                               }\r
-\r
-                               //      Ensures that the protocol exists before removing it.\r
-                               if(in_array($protocol, $this->allowed_protocols))\r
-                               {\r
-                                       $this->allowed_protocols = array_diff($this->allowed_protocols, array($protocol));\r
-                                       sort($this->allowed_protocols);\r
-                               }\r
-\r
-                               return true;\r
-                       }\r
-\r
-                       /**\r
-                        *      Allows for single/batch removal of protocols\r
-                        *\r
-                        *      This method accepts one argument that can be either a string\r
-                        *      or an array of strings.  Invalid data will be ignored.\r
-                        *\r
-                        *      The argument will be processed, and each string will be removed\r
-                        *      via RemoveProtocol().\r
-                        *\r
-                        *      @access public\r
-                        *      @param mixed , A string or array of protocols that will be removed from the internal list of allowed protocols.\r
-                        *      @return bool Status of removing valid protocols.\r
-                        *      @see RemoveProtocol()\r
-                        *      @since PHP5 OOP 1.0.0\r
-                        */\r
-                       public function RemoveProtocols()\r
-                       {\r
-                               $c_args = func_num_args();\r
-                               if($c_args != 1)\r
-                               {\r
-                                       return false;\r
-                               }\r
-\r
-                               $protocol_data = func_get_arg(0);\r
-\r
-                               if(is_array($protocol_data) && count($protocol_data) > 0)\r
-                               {\r
-                                       foreach($protocol_data as $protocol)\r
-                                       {\r
-                                               $this->RemoveProtocol($protocol);\r
-                                       }\r
-                               }\r
-                               elseif(is_string($protocol_data))\r
-                               {\r
-                                       $this->RemoveProtocol($protocol_data);\r
-                                       return true;\r
-                               }\r
-                               else\r
-                               {\r
-                                       trigger_error("kses5::RemoveProtocols() did not receive a string or an array.", E_USER_WARNING);\r
-                                       return false;\r
-                               }\r
-                       }\r
-\r
-                       /**\r
-                        *      Allows for single/batch replacement of protocols\r
-                        *\r
-                        *      This method accepts one argument that can be either a string\r
-                        *      or an array of strings.  Invalid data will be ignored.\r
-                        *\r
-                        *      Existing protocols will be removed, then the argument will be\r
-                        *      processed, and each string will be added via AddProtocol().\r
-                        *\r
-                        *      @access public\r
-                        *      @param mixed , A string or array of protocols that will be the new internal list of allowed protocols.\r
-                        *      @return bool Status of replacing valid protocols.\r
-                        *      @since PHP5 OOP 1.0.1\r
-                        *      @see AddProtocol()\r
-                        */\r
-                       public function SetProtocols()\r
-                       {\r
-                               $c_args = func_num_args();\r
-                               if($c_args != 1)\r
-                               {\r
-                                       trigger_error("kses5::SetProtocols() did not receive an argument.", E_USER_WARNING);\r
-                                       return false;\r
-                               }\r
-\r
-                               $protocol_data = func_get_arg(0);\r
-\r
-                               if(is_array($protocol_data) && count($protocol_data) > 0)\r
-                               {\r
-                                       $this->allowed_protocols = array();\r
-                                       foreach($protocol_data as $protocol)\r
-                                       {\r
-                                               $this->AddProtocol($protocol);\r
-                                       }\r
-                                       return true;\r
-                               }\r
-                               elseif(is_string($protocol_data))\r
-                               {\r
-                                       $this->allowed_protocols = array();\r
-                                       $this->AddProtocol($protocol_data);\r
-                                       return true;\r
-                               }\r
-                               else\r
-                               {\r
-                                       trigger_error("kses5::SetProtocols() did not receive a string or an array.", E_USER_WARNING);\r
-                                       return false;\r
-                               }\r
-                       }\r
-\r
-                       /**\r
-                        *      Raw dump of allowed protocols\r
-                        *\r
-                        *      This returns an indexed array of allowed protocols for a particular KSES\r
-                        *      instantiation.\r
-                        *\r
-                        *      @access public\r
-                        *      @return array The list of allowed protocols.\r
-                        *      @since PHP5 OOP 1.0.2\r
-                        */\r
-                       public function DumpProtocols()\r
-                       {\r
-                               return $this->allowed_protocols;\r
-                       }\r
-\r
-                       /**\r
-                        *      Raw dump of allowed (X)HTML elements\r
-                        *\r
-                        *      This returns an indexed array of allowed (X)HTML elements and attributes\r
-                        *      for a particular KSES instantiation.\r
-                        *\r
-                        *      @access public\r
-                        *      @return array The list of allowed elements.\r
-                        *      @since PHP5 OOP 1.0.2\r
-                        */\r
-                       public function DumpElements()\r
-                       {\r
-                               return $this->allowed_html;\r
-                       }\r
-\r
-\r
-                       /**\r
-                        *      Adds valid (X)HTML with corresponding attributes that will be kept when stripping 'evil scripts'.\r
-                        *\r
-                        *      This method accepts one argument that can be either a string\r
-                        *      or an array of strings.  Invalid data will be ignored.\r
-                        *\r
-                        *      @access public\r
-                        *      @param string $tag (X)HTML tag that will be allowed after stripping text.\r
-                        *      @param array $attribs Associative array of allowed attributes - key => attribute name - value => attribute parameter\r
-                        *      @return bool Status of Adding (X)HTML and attributes.\r
-                        *      @since PHP4 OOP 0.0.1\r
-                        */\r
-                       public function AddHTML($tag = "", $attribs = array())\r
-                       {\r
-                               if(!is_string($tag))\r
-                               {\r
-                                       trigger_error("kses5::AddHTML() requires the tag to be a string", E_USER_WARNING);\r
-                                       return false;\r
-                               }\r
-\r
-                               $tag = strtolower(trim($tag));\r
-                               if($tag == "")\r
-                               {\r
-                                       trigger_error("kses5::AddHTML() tried to add an empty/NULL tag", E_USER_WARNING);\r
-                                       return false;\r
-                               }\r
-\r
-                               if(!is_array($attribs))\r
-                               {\r
-                                       trigger_error("kses5::AddHTML() requires an array (even an empty one) of attributes for '$tag'", E_USER_WARNING);\r
-                                       return false;\r
-                               }\r
-\r
-                               $new_attribs = array();\r
-                               if(is_array($attribs) && count($attribs) > 0)\r
-                               {\r
-                                       foreach($attribs as $idx1 => $val1)\r
-                                       {\r
-                                               $new_idx1 = strtolower($idx1);\r
-                                               $new_val1 = $attribs[$idx1];\r
-\r
-                                               if(is_array($new_val1) && count($attribs) > 0)\r
-                                               {\r
-                                                       $tmp_val = array();\r
-                                                       foreach($new_val1 as $idx2 => $val2)\r
-                                                       {\r
-                                                               $new_idx2 = strtolower($idx2);\r
-                                                               $tmp_val[$new_idx2] = $val2;\r
-                                                       }\r
-                                                       $new_val1 = $tmp_val;\r
-                                               }\r
-\r
-                                               $new_attribs[$new_idx1] = $new_val1;\r
-                                       }\r
-                               }\r
-\r
-                               $this->allowed_html[$tag] = $new_attribs;\r
-                               return true;\r
-                       }\r
-\r
-                       /**\r
-                        *      This method removes any NULL characters in $string.\r
-                        *\r
-                        *      @access private\r
-                        *      @param string $string\r
-                        *      @return string String without any NULL/chr(173)\r
-                        *      @since PHP4 OOP 0.0.1\r
-                        */\r
-                       private function removeNulls($string)\r
-                       {\r
-                               $string = preg_replace('/\0+/', '', $string);\r
-                               $string = preg_replace('/(\\\\0)+/', '', $string);\r
-                               return $string;\r
-                       }\r
-\r
-                       /**\r
-                        *      Normalizes HTML entities\r
-                        *\r
-                        *      This function normalizes HTML entities. It will convert "AT&T" to the correct\r
-                        *      "AT&amp;T", "&#00058;" to "&#58;", "&#XYZZY;" to "&amp;#XYZZY;" and so on.\r
-                        *\r
-                        *      @access private\r
-                        *      @param string $string\r
-                        *      @return string String with normalized entities\r
-                        *      @since PHP4 OOP 0.0.1\r
-                        */\r
-                       private function normalizeEntities($string)\r
-                       {\r
-                               # Disarm all entities by converting & to &amp;\r
-                               $string = str_replace('&', '&amp;', $string);\r
-\r
-                               #       TODO: Change back (Keep?) the allowed entities in our entity white list\r
-\r
-                               #       Keeps entities that start with [A-Za-z]\r
-                               $string = preg_replace(\r
-                                       '/&amp;([A-Za-z][A-Za-z0-9]{0,19});/',\r
-                                       '&\\1;',\r
-                                       $string\r
-                               );\r
-\r
-                               #       Change numeric entities to valid 16 bit values\r
-\r
-                               $string = preg_replace(\r
-                                       '/&amp;#0*([0-9]{1,5});/e',\r
-                                       '\$this->normalizeEntities16bit("\\1")',\r
-                                       $string\r
-                               );\r
-\r
-                               #       Change &XHHHHHHH (Hex digits) to 16 bit hex values\r
-                               $string = preg_replace(\r
-                                       '/&amp;#([Xx])0*(([0-9A-Fa-f]{2}){1,2});/',\r
-                                       '&#\\1\\2;',\r
-                                       $string\r
-                               );\r
-\r
-                               return $string;\r
-                       }\r
-\r
-                       /**\r
-                        *      Helper method used by normalizeEntites()\r
-                        *\r
-                        *      This method helps normalizeEntities() to only accept 16 bit values\r
-                        *      and nothing more for &#number; entities.\r
-                        *\r
-                        *      This method helps normalize_entities() during a preg_replace()\r
-                        *      where a &#(0)*XXXXX; occurs.  The '(0)*XXXXXX' value is converted to\r
-                        *      a number and the result is returned as a numeric entity if the number\r
-                        *      is less than 65536.  Otherwise, the value is returned 'as is'.\r
-                        *\r
-                        *      @access private\r
-                        *      @param string $i\r
-                        *      @return string Normalized numeric entity\r
-                        *      @see normalizeEntities()\r
-                        *      @since PHP4 OOP 0.0.1\r
-                        */\r
-                       private function normalizeEntities16bit($i)\r
-                       {\r
-                         return (($i > 65535) ? "&amp;#$i;" : "&#$i;");\r
-                       }\r
-\r
-                       /**\r
-                        *      Allows for additional user defined modifications to text.\r
-                        *\r
-                        *      This method allows for additional modifications to be performed on\r
-                        *      a string that's being run through Parse().  Currently, it returns the\r
-                        *      input string 'as is'.\r
-                        *\r
-                        *      This method is provided for users to extend the kses class for their own\r
-                        *      requirements.\r
-                        *\r
-                        *      @access public\r
-                        *      @param string $string String to perfrom additional modifications on.\r
-                        *      @return string User modified string.\r
-                        *      @see Parse()\r
-                        *      @since PHP5 OOP 1.0.0\r
-                        */\r
-                       private function filterKsesTextHook($string)\r
-                       {\r
-                         return $string;\r
-                       }\r
-\r
-                       /**\r
-                        *      Allows for additional user defined modifications to text.\r
-                        *\r
-                        *      @deprecated use filterKsesTextHook()\r
-                        *      @param string $string\r
-                        *      @return string\r
-                        *      @see filterKsesTextHook()\r
-                        *      @since PHP4 OOP 0.0.1\r
-                        */\r
-                       private function _hook($string)\r
-                       {\r
-                               return $this->filterKsesTextHook($string);\r
-                       }\r
-\r
-                       /**\r
-                        *      This method goes through an array, and changes the keys to all lower case.\r
-                        *\r
-                        *      @access private\r
-                        *      @param array $in_array Associative array\r
-                        *      @return array Modified array\r
-                        *      @since PHP4 OOP 0.0.1\r
-                        */\r
-                       private function makeArrayKeysLowerCase($in_array)\r
-                       {\r
-                               $out_array = array();\r
-\r
-                               if(is_array($in_array) && count($in_array) > 0)\r
-                               {\r
-                                       foreach ($in_array as $in_key => $in_val)\r
-                                       {\r
-                                               $out_key = strtolower($in_key);\r
-                                               $out_array[$out_key] = array();\r
-\r
-                                               if(is_array($in_val) && count($in_val) > 0)\r
-                                               {\r
-                                                       foreach ($in_val as $in_key2 => $in_val2)\r
-                                                       {\r
-                                                               $out_key2 = strtolower($in_key2);\r
-                                                               $out_array[$out_key][$out_key2] = $in_val2;\r
-                                                       }\r
-                                               }\r
-                                       }\r
-                               }\r
-\r
-                               return $out_array;\r
-                       }\r
-\r
-                       /**\r
-                        *      This method strips out disallowed and/or mangled (X)HTML tags along with assigned attributes.\r
-                        *\r
-                        *      This method does a lot of work. It rejects some very malformed things\r
-                        *      like <:::>. It returns an empty string if the element isn't allowed (look\r
-                        *      ma, no strip_tags()!). Otherwise it splits the tag into an element and an\r
-                        *      allowed attribute list.\r
-                        *\r
-                        *      @access private\r
-                        *      @param string $string\r
-                        *      @return string Modified string minus disallowed/mangled (X)HTML and attributes\r
-                        *      @since PHP4 OOP 0.0.1\r
-                        */\r
-                       private function stripTags($string)\r
-                       {\r
-                               $string = preg_replace('%\\\\"%', '"', $string);\r
-\r
-                               if (substr($string, 0, 1) != '<')\r
-                               {\r
-                                       # It matched a ">" character\r
-                                       return '&gt;';\r
-                               }\r
-\r
-                               if (!preg_match('%^<\s*(/\s*)?([a-zA-Z0-9]+)([^>]*)>?$%', $string, $matches))\r
-                               {\r
-                                       # It's seriously malformed\r
-                                       return '';\r
-                               }\r
-\r
-                               $slash    = trim($matches[1]);\r
-                               $elem     = $matches[2];\r
-                               $attrlist = $matches[3];\r
-\r
-                               if (\r
-                                       !isset($this->allowed_html[strtolower($elem)]) ||\r
-                                       !is_array($this->allowed_html[strtolower($elem)]))\r
-                               {\r
-                                       #       Found an HTML element not in the white list\r
-                                       return '';\r
-                               }\r
-\r
-                               if ($slash != '')\r
-                               {\r
-                                       return "<$slash$elem>";\r
-                               }\r
-                               # No attributes are allowed for closing elements\r
-\r
-                               return $this->stripAttributes("$slash$elem", $attrlist);\r
-                       }\r
-\r
-                       /**\r
-                        *      This method strips out disallowed attributes for (X)HTML tags.\r
-                        *\r
-                        *      This method removes all attributes if none are allowed for this element.\r
-                        *      If some are allowed it calls combAttributes() to split them further, and then it\r
-                        *      builds up new HTML code from the data that combAttributes() returns. It also\r
-                        *      removes "<" and ">" characters, if there are any left. One more thing it\r
-                        *      does is to check if the tag has a closing XHTML slash, and if it does,\r
-                        *      it puts one in the returned code as well.\r
-                        *\r
-                        *      @access private\r
-                        *      @param string $element (X)HTML tag to check\r
-                        *      @param string $attr Text containing attributes to check for validity.\r
-                        *      @return string Resulting valid (X)HTML or ''\r
-                        *      @see combAttributes()\r
-                        *      @since PHP4 OOP 0.0.1\r
-                        */\r
-                       private function stripAttributes($element, $attr)\r
-                       {\r
-                               # Is there a closing XHTML slash at the end of the attributes?\r
-                               $xhtml_slash = '';\r
-                               if (preg_match('%\s/\s*$%', $attr))\r
-                               {\r
-                                       $xhtml_slash = ' /';\r
-                               }\r
-\r
-                               # Are any attributes allowed at all for this element?\r
-                               if (\r
-                                       !isset($this->allowed_html[strtolower($element)]) ||\r
-                                       count($this->allowed_html[strtolower($element)]) == 0\r
-                               )\r
-                               {\r
-                                       return "<$element$xhtml_slash>";\r
-                               }\r
-\r
-                               # Split it\r
-                               $attrarr = $this->combAttributes($attr);\r
-\r
-                               # Go through $attrarr, and save the allowed attributes for this element\r
-                               # in $attr2\r
-                               $attr2 = '';\r
-                               if(is_array($attrarr) && count($attrarr) > 0)\r
-                               {\r
-                                       foreach ($attrarr as $arreach)\r
-                                       {\r
-                                               if(!isset($this->allowed_html[strtolower($element)][strtolower($arreach['name'])]))\r
-                                               {\r
-                                                       continue;\r
-                                               }\r
-\r
-                                               $current = $this->allowed_html[strtolower($element)][strtolower($arreach['name'])];\r
-\r
-                                               if (!is_array($current))\r
-                                               {\r
-                                                       # there are no checks\r
-                                                       $attr2 .= ' '.$arreach['whole'];\r
-                                               }\r
-                                               else\r
-                                               {\r
-                                                       # there are some checks\r
-                                                       $ok = true;\r
-                                                       if(is_array($current) && count($current) > 0)\r
-                                                       {\r
-                                                               foreach ($current as $currkey => $currval)\r
-                                                               {\r
-                                                                       if (!$this->checkAttributeValue($arreach['value'], $arreach['vless'], $currkey, $currval))\r
-                                                                       {\r
-                                                                               $ok = false;\r
-                                                                               break;\r
-                                                                       }\r
-                                                               }\r
-                                                       }\r
-\r
-                                                       if ($ok)\r
-                                                       {\r
-                                                               # it passed them\r
-                                                               $attr2 .= ' '.$arreach['whole'];\r
-                                                       }\r
-                                               }\r
-                                       }\r
-                               }\r
-\r
-                               # Remove any "<" or ">" characters\r
-                               $attr2 = preg_replace('/[<>]/', '', $attr2);\r
-                               return "<$element$attr2$xhtml_slash>";\r
-                       }\r
-\r
-                       /**\r
-                        *      This method combs through an attribute list string and returns an associative array of attributes and values.\r
-                        *\r
-                        *      This method does a lot of work. It parses an attribute list into an array\r
-                        *      with attribute data, and tries to do the right thing even if it gets weird\r
-                        *      input. It will add quotes around attribute values that don't have any quotes\r
-                        *      or apostrophes around them, to make it easier to produce HTML code that will\r
-                        *      conform to W3C's HTML specification. It will also remove bad URL protocols\r
-                        *      from attribute values.\r
-                        *\r
-                        *      @access private\r
-                        *      @param string $attr Text containing tag attributes for parsing\r
-                        *      @return array Associative array containing data on attribute and value\r
-                        *      @since PHP4 OOP 0.0.1\r
-                        */\r
-                       private function combAttributes($attr)\r
-                       {\r
-                               $attrarr  = array();\r
-                               $mode     = 0;\r
-                               $attrname = '';\r
-\r
-                               # Loop through the whole attribute list\r
-\r
-                               while (strlen($attr) != 0)\r
-                               {\r
-                                       # Was the last operation successful?\r
-                                       $working = 0;\r
-\r
-                                       switch ($mode)\r
-                                       {\r
-                                               case 0: # attribute name, href for instance\r
-                                                       if (preg_match('/^([-a-zA-Z]+)/', $attr, $match))\r
-                                                       {\r
-                                                               $attrname = $match[1];\r
-                                                               $working = $mode = 1;\r
-                                                               $attr = preg_replace('/^[-a-zA-Z]+/', '', $attr);\r
-                                                       }\r
-                                                       break;\r
-                                               case 1: # equals sign or valueless ("selected")\r
-                                                       if (preg_match('/^\s*=\s*/', $attr)) # equals sign\r
-                                                       {\r
-                                                               $working = 1;\r
-                                                               $mode    = 2;\r
-                                                               $attr    = preg_replace('/^\s*=\s*/', '', $attr);\r
-                                                               break;\r
-                                                       }\r
-                                                       if (preg_match('/^\s+/', $attr)) # valueless\r
-                                                       {\r
-                                                               $working   = 1;\r
-                                                               $mode      = 0;\r
-                                                               $attrarr[] = array(\r
-                                                                       'name'  => $attrname,\r
-                                                                       'value' => '',\r
-                                                                       'whole' => $attrname,\r
-                                                                       'vless' => 'y'\r
-                                                               );\r
-                                                               $attr      = preg_replace('/^\s+/', '', $attr);\r
-                                                       }\r
-                                                       break;\r
-                                               case 2: # attribute value, a URL after href= for instance\r
-                                                       if (preg_match('/^"([^"]*)"(\s+|$)/', $attr, $match)) # "value"\r
-                                                       {\r
-                                                               $thisval   = $this->removeBadProtocols($match[1]);\r
-                                                               $attrarr[] = array(\r
-                                                                       'name'  => $attrname,\r
-                                                                       'value' => $thisval,\r
-                                                                       'whole' => $attrname . '="' . $thisval . '"',\r
-                                                                       'vless' => 'n'\r
-                                                               );\r
-                                                               $working   = 1;\r
-                                                               $mode      = 0;\r
-                                                               $attr      = preg_replace('/^"[^"]*"(\s+|$)/', '', $attr);\r
-                                                               break;\r
-                                                       }\r
-                                                       if (preg_match("/^'([^']*)'(\s+|$)/", $attr, $match)) # 'value'\r
-                                                       {\r
-                                                               $thisval   = $this->removeBadProtocols($match[1]);\r
-                                                               $attrarr[] = array(\r
-                                                                       'name'  => $attrname,\r
-                                                                       'value' => $thisval,\r
-                                                                       'whole' => "$attrname='$thisval'",\r
-                                                                       'vless' => 'n'\r
-                                                               );\r
-                                                               $working   = 1;\r
-                                                               $mode      = 0;\r
-                                                               $attr      = preg_replace("/^'[^']*'(\s+|$)/", '', $attr);\r
-                                                               break;\r
-                                                       }\r
-                                                       if (preg_match("%^([^\s\"']+)(\s+|$)%", $attr, $match)) # value\r
-                                                       {\r
-                                                               $thisval   = $this->removeBadProtocols($match[1]);\r
-                                                               $attrarr[] = array(\r
-                                                                       'name'  => $attrname,\r
-                                                                       'value' => $thisval,\r
-                                                                       'whole' => $attrname . '="' . $thisval . '"',\r
-                                                                       'vless' => 'n'\r
-                                                               );\r
-                                                               # We add quotes to conform to W3C's HTML spec.\r
-                                                               $working   = 1;\r
-                                                               $mode      = 0;\r
-                                                               $attr      = preg_replace("%^[^\s\"']+(\s+|$)%", '', $attr);\r
-                                                       }\r
-                                                       break;\r
-                                       }\r
-\r
-                                       if ($working == 0) # not well formed, remove and try again\r
-                                       {\r
-                                               $attr = preg_replace('/^("[^"]*("|$)|\'[^\']*(\'|$)|\S)*\s*/', '', $attr);\r
-                                               $mode = 0;\r
-                                       }\r
-                               }\r
-\r
-                               # special case, for when the attribute list ends with a valueless\r
-                               # attribute like "selected"\r
-                               if ($mode == 1)\r
-                               {\r
-                                       $attrarr[] = array(\r
-                                               'name'  => $attrname,\r
-                                               'value' => '',\r
-                                               'whole' => $attrname,\r
-                                               'vless' => 'y'\r
-                                       );\r
-                               }\r
-\r
-                               return $attrarr;\r
-                       }\r
-\r
-                       /**\r
-                        *      This method removes disallowed protocols.\r
-                        *\r
-                        *      This method removes all non-allowed protocols from the beginning of\r
-                        *      $string. It ignores whitespace and the case of the letters, and it does\r
-                        *      understand HTML entities. It does its work in a while loop, so it won't be\r
-                        *      fooled by a string like "javascript:javascript:alert(57)".\r
-                        *\r
-                        *      @access private\r
-                        *      @param string $string String to check for protocols\r
-                        *      @return string String with removed protocols\r
-                        *      @since PHP4 OOP 0.0.1\r
-                        */\r
-                       private function removeBadProtocols($string)\r
-                       {\r
-                               $string  = $this->RemoveNulls($string);\r
-                               $string = preg_replace('/\xad+/', '', $string); # deals with Opera "feature"\r
-                               $string2 = $string . 'a';\r
-\r
-                               while ($string != $string2)\r
-                               {\r
-                                       $string2 = $string;\r
-                                       $string  =  preg_replace(\r
-                                                                               '/^((&[^;]*;|[\sA-Za-z0-9])*)'.\r
-                                                                               '(:|&#58;|&#[Xx]3[Aa];)\s*/e',\r
-                                                                               '\$this->filterProtocols("\\1")',\r
-                                                                               $string\r
-                                                                       );\r
-                               }\r
-\r
-                               return $string;\r
-                       }\r
-\r
-                       /**\r
-                        *      Helper method used by removeBadProtocols()\r
-                        *\r
-                        *      This function processes URL protocols, checks to see if they're in the white-\r
-                        *      list or not, and returns different data depending on the answer.\r
-                        *\r
-                        *      @access private\r
-                        *      @param string $string String to check for protocols\r
-                        *      @return string String with removed protocols\r
-                        *      @see removeBadProtocols()\r
-                        *      @since PHP4 OOP 0.0.1\r
-                        */\r
-                       private function filterProtocols($string)\r
-                       {\r
-                               $string = $this->decodeEntities($string);\r
-                               $string = preg_replace('/\s/', '', $string);\r
-                               $string = $this->removeNulls($string);\r
-                               $string = preg_replace('/\xad+/', '', $string2); # deals with Opera "feature"\r
-                               $string = strtolower($string);\r
-\r
-                               if(is_array($this->allowed_protocols) && count($this->allowed_protocols) > 0)\r
-                               {\r
-                                       foreach ($this->allowed_protocols as $one_protocol)\r
-                                       {\r
-                                               if (strtolower($one_protocol) == $string)\r
-                                               {\r
-                                                       return "$string:";\r
-                                               }\r
-                                       }\r
-                               }\r
-\r
-                               return '';\r
-                       }\r
-\r
-                       /**\r
-                        *      Controller method for performing checks on attribute values.\r
-                        *\r
-                        *      This method calls the appropriate method as specified by $checkname with\r
-                        *      the parameters $value, $vless, and $checkvalue, and returns the result\r
-                        *      of the call.\r
-                        *\r
-                        *      This method's functionality can be expanded by creating new methods\r
-                        *      that would match checkAttributeValue[$checkname].\r
-                        *\r
-                        *      Current checks implemented are: "maxlen", "minlen", "maxval", "minval" and "valueless"\r
-                        *\r
-                        *      @access private\r
-                        *      @param string $value The value of the attribute to be checked.\r
-                        *      @param string $vless Indicates whether the the value is supposed to be valueless\r
-                        *      @param string $checkname The check to be performed\r
-                        *      @param string $checkvalue The value that is to be checked against\r
-                        *      @return bool Indicates whether the check passed or not\r
-                        *      @since PHP5 OOP 1.0.0\r
-                        */\r
-                       private function checkAttributeValue($value, $vless, $checkname, $checkvalue)\r
-                       {\r
-                               $ok = true;\r
-                               $check_attribute_method_name  = 'checkAttributeValue' . ucfirst(strtolower($checkname));\r
-                               if(method_exists($this, $check_attribute_method_name))\r
-                               {\r
-                                       $ok = $this->$check_attribute_method_name($value, $checkvalue, $vless);\r
-                               }\r
-\r
-                               return $ok;\r
-                       }\r
-\r
-                       /**\r
-                        *      Helper method invoked by checkAttributeValue().\r
-                        *\r
-                        *      The maxlen check makes sure that the attribute value has a length not\r
-                        *      greater than the given value. This can be used to avoid Buffer Overflows\r
-                        *      in WWW clients and various Internet servers.\r
-                        *\r
-                        *      @access private\r
-                        *      @param string $value The value of the attribute to be checked.\r
-                        *      @param int $checkvalue The maximum value allowed\r
-                        *      @return bool Indicates whether the check passed or not\r
-                        *      @see checkAttributeValue()\r
-                        *      @since PHP5 OOP 1.0.0\r
-                        */\r
-                       private function checkAttributeValueMaxlen($value, $checkvalue)\r
-                       {\r
-                               if (strlen($value) > intval($checkvalue))\r
-                               {\r
-                                       return false;\r
-                               }\r
-                               return true;\r
-                       }\r
-\r
-                       /**\r
-                        *      Helper method invoked by checkAttributeValue().\r
-                        *\r
-                        *      The minlen check makes sure that the attribute value has a length not\r
-                        *      smaller than the given value.\r
-                        *\r
-                        *      @access private\r
-                        *      @param string $value The value of the attribute to be checked.\r
-                        *      @param int $checkvalue The minimum value allowed\r
-                        *      @return bool Indicates whether the check passed or not\r
-                        *      @see checkAttributeValue()\r
-                        *      @since PHP5 OOP 1.0.0\r
-                        */\r
-                       private function checkAttributeValueMinlen($value, $checkvalue)\r
-                       {\r
-                               if (strlen($value) < intval($checkvalue))\r
-                               {\r
-                                       return false;\r
-                               }\r
-                               return true;\r
-                       }\r
-\r
-                       /**\r
-                        *      Helper method invoked by checkAttributeValue().\r
-                        *\r
-                        *      The maxval check does two things: it checks that the attribute value is\r
-                        *      an integer from 0 and up, without an excessive amount of zeroes or\r
-                        *      whitespace (to avoid Buffer Overflows). It also checks that the attribute\r
-                        *      value is not greater than the given value.\r
-                        *\r
-                        *      This check can be used to avoid Denial of Service attacks.\r
-                        *\r
-                        *      @access private\r
-                        *      @param int $value The value of the attribute to be checked.\r
-                        *      @param int $checkvalue The maximum numeric value allowed\r
-                        *      @return bool Indicates whether the check passed or not\r
-                        *      @see checkAttributeValue()\r
-                        *      @since PHP5 OOP 1.0.0\r
-                        */\r
-                       private function checkAttributeValueMaxval($value, $checkvalue)\r
-                       {\r
-                               if (!preg_match('/^\s{0,6}[0-9]{1,6}\s{0,6}$/', $value))\r
-                               {\r
-                                       return false;\r
-                               }\r
-                               if (intval($value) > intval($checkvalue))\r
-                               {\r
-                                       return false;\r
-                               }\r
-                               return true;\r
-                       }\r
-\r
-                       /**\r
-                        *      Helper method invoked by checkAttributeValue().\r
-                        *\r
-                        *      The minval check checks that the attribute value is a positive integer,\r
-                        *      and that it is not smaller than the given value.\r
-                        *\r
-                        *      @access private\r
-                        *      @param int $value The value of the attribute to be checked.\r
-                        *      @param int $checkvalue The minimum numeric value allowed\r
-                        *      @return bool Indicates whether the check passed or not\r
-                        *      @see checkAttributeValue()\r
-                        *      @since PHP5 OOP 1.0.0\r
-                        */\r
-                       private function checkAttributeValueMinval($value, $checkvalue)\r
-                       {\r
-                               if (!preg_match('/^\s{0,6}[0-9]{1,6}\s{0,6}$/', $value))\r
-                               {\r
-                                       return false;\r
-                               }\r
-                               if (intval($value) < ($checkvalue))\r
-                               {\r
-                                       return false;\r
-                               }\r
-                               return true;\r
-                       }\r
-\r
-                       /**\r
-                        *      Helper method invoked by checkAttributeValue().\r
-                        *\r
-                        *      The valueless check checks if the attribute has a value\r
-                        *      (like <a href="blah">) or not (<option selected>). If the given value\r
-                        *      is a "y" or a "Y", the attribute must not have a value.\r
-                        *\r
-                        *      If the given value is an "n" or an "N", the attribute must have one.\r
-                        *\r
-                        *      @access private\r
-                        *      @param int $value The value of the attribute to be checked.\r
-                        *      @param mixed $checkvalue This variable is ignored for this test\r
-                        *      @param string $vless Flag indicating if this attribute is not supposed to have an attribute\r
-                        *      @return bool Indicates whether the check passed or not\r
-                        *      @see checkAttributeValue()\r
-                        *      @since PHP5 OOP 1.0.0\r
-                        */\r
-                       private function checkAttributeValueValueless($value, $checkvalue, $vless)\r
-                       {\r
-                               if (strtolower($checkvalue) != $vless)\r
-                               {\r
-                                       return false;\r
-                               }\r
-                               return true;\r
-                       }\r
-\r
-                       /**\r
-                        *      Decodes numeric HTML entities\r
-                        *\r
-                        *      This method decodes numeric HTML entities (&#65; and &#x41;). It doesn't\r
-                        *      do anything with other entities like &auml;, but we don't need them in the\r
-                        *      URL protocol white listing system anyway.\r
-                        *\r
-                        *      @access private\r
-                        *      @param string $value The entitiy to be decoded.\r
-                        *      @return string Decoded entity\r
-                        *      @since PHP4 OOP 0.0.1\r
-                        */\r
-                       private function decodeEntities($string)\r
-                       {\r
-                               $string = preg_replace('/&#([0-9]+);/e', 'chr("\\1")', $string);\r
-                               $string = preg_replace('/&#[Xx]([0-9A-Fa-f]+);/e', 'chr(hexdec("\\1"))', $string);\r
-                               return $string;\r
-                       }\r
-\r
-                       /**\r
-                        *      Returns PHP5 OOP version # of kses.\r
-                        *\r
-                        *      Since this class has been refactored and documented and proven to work,\r
-                        *      I'm fixing the version number at 1.0.0.\r
-                        *\r
-                        *      This version is syntax compatible with the PHP4 OOP version 0.0.2.  Future\r
-                        *      versions may not be syntax compatible.\r
-                        *\r
-                        *      @access public\r
-                        *      @return string Version number\r
-                        *      @since PHP4 OOP 0.0.1\r
-                        */\r
-                       public function Version()\r
-                       {\r
-                               return 'PHP5 OOP 1.0.2';\r
-                       }\r
-               }\r
-       }\r
-?>
\ No newline at end of file
diff --git a/mod/kses/vendors/kses/oop/test.oop.kses.php b/mod/kses/vendors/kses/oop/test.oop.kses.php
deleted file mode 100644 (file)
index 8c6e885..0000000
+++ /dev/null
@@ -1,507 +0,0 @@
-<?php\r
-\r
-       //      This is a q&d program that shows some of the results of\r
-       //      running KSES.  If you have further questions, check the\r
-       //      current valid email address at http://chaos.org/contact/\r
-\r
-       //      Make sure we're in a usable PHP environment\r
-       if(substr(phpversion(), 0, 1) < 4)\r
-       {\r
-               define('KSESTEST_VER', 0);\r
-       }\r
-       elseif(substr(phpversion(), 0, 1) >= 5)\r
-       {\r
-               define('KSESTEST_VER', 5);\r
-       }\r
-       else\r
-       {\r
-               define('KSESTEST_VER', 4);\r
-       }\r
-\r
-       //      See if we're in command line or web\r
-       if($_SERVER["DOCUMENT_ROOT"] == "")\r
-       {\r
-               define('KSESTEST_ENV', 'CLI');\r
-       }\r
-       else\r
-       {\r
-               define('KSESTEST_ENV', 'WEB');\r
-       }\r
-\r
-       if(KSESTEST_VER == 0)\r
-       {\r
-               $message = array(\r
-                       "Error: Not using a current version of PHP!",\r
-                       "You are using PHP version " . phpversion() . ".",\r
-                       "KSES Class version requires PHP4 or better.",\r
-                       "KSES test program ending."\r
-                       );\r
-\r
-               displayPage(\r
-                       array("title" => "Error running KSES test", "message" => $message)\r
-               );\r
-\r
-               exit();\r
-       }\r
-\r
-       $include_file = "php" . KSESTEST_VER . ".class.kses.php";\r
-       if(file_exists($include_file) && is_readable($include_file))\r
-       {\r
-               include_once($include_file);\r
-       }\r
-       else\r
-       {\r
-               $message = array(\r
-                       "Error:  Unable to find '" . $include_file . "'.",\r
-                       "Please check your include path and make sure the file is available.",\r
-                       "Path: " . ini_get('include_path')\r
-               );\r
-\r
-               displayPage(\r
-                       array('title' => 'Unable to include ' . $include_file, 'message' => $message)\r
-               );\r
-\r
-               exit();\r
-       }\r
-\r
-       $kses_type = "kses" . KSESTEST_VER;\r
-       $myKses = new $kses_type;\r
-\r
-       $test_text = array();\r
-       $test_text = test1_protocols($myKses);\r
-       $test_text = array_merge($test_text, test1_html($myKses));\r
-       $test_text = array_merge($test_text, test1_kses($myKses));\r
-\r
-       displayPage(\r
-               array('title' => 'New Test', 'message' => $test_text)\r
-       );\r
-\r
-       function test1_kses(&$myKses)\r
-       {\r
-               $out = array(output_hr(), "Testing current configuration");\r
-\r
-               $test_tags = array(\r
-                       '<a href="http://www.chaos.org/">www.chaos.org</a>',\r
-                       '<a name="X">Short \'a name\' tag</a>',\r
-                       '<td colspan="3" rowspan="5">Foo</td>',\r
-                       '<td rowspan="2" class="mugwump" style="background-color: rgb(255, 204 204);">Bar</td>',\r
-                       '<td nowrap>Very Long String running to 1000 characters...</td>',\r
-                       '<td bgcolor="#00ff00" nowrap>Very Long String with a blue background</td>',\r
-                       '<a href="proto1://www.foo.com">New protocol test</a>',\r
-                       '<img src="proto2://www.foo.com" />',\r
-                       '<a href="javascript:javascript:javascript:javascript:javascript:alert(\'Boo!\');">bleep</a>',\r
-                       '<a href="proto4://abc.xyz.foo.com">Another new protocol</a>',\r
-                       '<a href="proto9://foo.foo.foo.foo.foo.org/">Test of "proto9"</a>',\r
-                       '<td width="75">Bar!</td>',\r
-                       '<td width="200">Long Cell</td>'\r
-               );\r
-\r
-               $out_li = array();\r
-               // Keep only allowed HTML from the presumed 'form'.\r
-               foreach($test_tags as $tag)\r
-               {\r
-                       $temp  = $myKses->Parse($tag);\r
-                       $check = ($temp == $tag) ? true : false;\r
-                       $text  = ($temp == $tag) ? 'pass' : 'fail';\r
-\r
-                       $li_text  = output_testresult($check, $text) . output_newline();\r
-                       $li_text .= "Input: &nbsp;" . output_translate($tag) . output_newline();\r
-                       $li_text .= "Output: " . output_translate($temp);\r
-                       if(KSESTEST_ENV == 'CLI')\r
-                       {\r
-                               $li_text .= output_newline();\r
-                       }\r
-\r
-                       array_push($out_li, output_code_wrap($li_text));\r
-               }\r
-\r
-               $out = array_merge($out, array(output_ul($out_li)));\r
-               array_push($out, output_hr());\r
-               array_push($out, "Testing is now finished.");\r
-               return $out;\r
-       }\r
-\r
-       function output_code_wrap($text)\r
-       {\r
-               if(KSESTEST_ENV == 'CLI')\r
-               {\r
-                       return $text;\r
-               }\r
-               else\r
-               {\r
-                       return "<code>\n$text<code>\n";\r
-               }\r
-       }\r
-\r
-       function output_translate($text)\r
-       {\r
-               if(KSESTEST_ENV == 'CLI')\r
-               {\r
-                       return $text;\r
-               }\r
-               else\r
-               {\r
-                       return htmlentities($text);\r
-               }\r
-       }\r
-\r
-       function output_testresult($pass = false, $text = "")\r
-       {\r
-               if(KSESTEST_ENV == 'CLI')\r
-               {\r
-                       return '[' . $text . ']';\r
-               }\r
-               else\r
-               {\r
-                       if($pass == true)\r
-                       {\r
-                               return '<span style="color: green;">[' . $text . ']</span>';\r
-                       }\r
-                       else\r
-                       {\r
-                               return '<span style="color: red;">[' . $text . ']</span>';\r
-                       }\r
-               }\r
-       }\r
-\r
-       function output_spaces()\r
-       {\r
-               if(KSESTEST_ENV == 'WEB')\r
-               {\r
-                       $out = "&nbsp;&nbsp;&nbsp;";\r
-               }\r
-               else\r
-               {\r
-                       $out = "   ";\r
-               }\r
-\r
-               return $out;\r
-       }\r
-\r
-       function output_newline()\r
-       {\r
-               if(KSESTEST_ENV == 'WEB')\r
-               {\r
-                       $out = "<br />\n";\r
-               }\r
-               else\r
-               {\r
-                       $out = "\n";\r
-               }\r
-\r
-               return $out;\r
-       }\r
-\r
-       function displayPage($data = array())\r
-       {\r
-               $title   = ($data['title'] == '') ? 'No title' : $data['title'];\r
-               $message = ($data['message'] == '') ? array('No message') : $data['message'];\r
-\r
-               $out = "";\r
-\r
-               foreach($message as $text)\r
-               {\r
-                       if(KSESTEST_ENV == 'WEB')\r
-                       {\r
-                               $header = "\t\t<h1>$title</h1>\n\t\t<hr />\n";\r
-                               $out .= "\t\t<p>\n";\r
-                               $out .= "\t\t\t$text\n";\r
-                               $out .= "\t\t</p>\n";\r
-                       }\r
-                       else\r
-                       {\r
-                               $header = "$title\n" . str_repeat('-', 60) . "\n\n";\r
-                               $out .= "\t$text\n\n";\r
-                       }\r
-               }\r
-\r
-               if(KSESTEST_ENV == 'WEB')\r
-               {\r
-                       echo "<html>\n";\r
-                       echo "\t<head>\n";\r
-                       echo "\t\t<title>$title</title>\n";\r
-                       echo "\t</head>\n";\r
-                       echo "\t<body>\n";\r
-                       echo $header;\r
-                       echo $out;\r
-                       echo "\t</body>\n";\r
-                       echo "</html>\n";\r
-               }\r
-               else\r
-               {\r
-                       echo $header;\r
-                       echo $out;\r
-               }\r
-       }\r
-\r
-       function output_hr()\r
-       {\r
-               if(KSESTEST_ENV == 'WEB')\r
-               {\r
-                       return "\t\t\t<hr />\n";\r
-               }\r
-               else\r
-               {\r
-                       return str_repeat(60, '-') . "\n";\r
-               }\r
-       }\r
-\r
-       function output_ul($data = array(), $padding = "")\r
-       {\r
-               if(!is_array($data) || count($data) < 1)\r
-               {\r
-                       return "";\r
-               }\r
-\r
-               $text = "";\r
-               if(KSESTEST_ENV == 'WEB')\r
-               {\r
-                       $text = "\t\t\t<ul>\n";\r
-                       foreach($data as $li)\r
-                       {\r
-                               $text .= "\t\t\t\t<li>$li</li>\n";\r
-                       }\r
-                       $text .= "\t\t\t</ul>\n";\r
-               }\r
-               else\r
-               {\r
-                       foreach($data as $li)\r
-                       {\r
-                               $text .= $padding . "   * $li\n";\r
-                       }\r
-               }\r
-\r
-               return $text;\r
-       }\r
-\r
-       function test1_protocols(&$myKses)\r
-       {\r
-               $default_prots = $myKses->dumpProtocols();\r
-               $out_text = array();\r
-               if(count($default_prots) > 0)\r
-               {\r
-                       array_push($out_text, "Initial protocols from KSES" . KSESTEST_VER . ":");\r
-                       array_push($out_text, output_ul($default_prots));\r
-                       array_push($out_text, output_hr());\r
-               }\r
-\r
-               $myKses->AddProtocols(array("proto1", "proto2:", "proto3"));   // Add a list of protocols\r
-               $myKses->AddProtocols("proto4:");  // Add a single protocol (Note ':' is optional at end)\r
-               $myKses->AddProtocol("proto9", "mystery:", "anarchy");\r
-               $myKses->AddProtocol("alpha", "beta", "gamma:");\r
-\r
-               $add_protocol  = "\t\t\t<ol>\n";\r
-               $add_protocol .= "\t\t\t\t" . '<li>$myKses->AddProtocols(array("proto1", "proto2:", "proto3"));</li>' . "\n";\r
-               $add_protocol .= "\t\t\t\t" . '<li>$myKses->AddProtocols("proto4:");</li>' . "\n";\r
-               $add_protocol .= "\t\t\t\t" . '<li>$myKses->AddProtocols("proto4:");</li>' . "\n";\r
-               $add_protocol .= "\t\t\t\t" . '<li>$myKses->AddProtocol("proto9", "mystery:", "anarchy");</li>' . "\n";\r
-               $add_protocol .= "\t\t\t\t" . '<li>$myKses->AddProtocol("alpha", "beta", "gamma:");</li>' . "\n";\r
-               $add_protocol .= "\t\t\t</ol>\n";\r
-\r
-               array_push($out_text, $add_protocol);\r
-\r
-               $new_prots = $myKses->dumpProtocols();\r
-               if(count($new_prots) > 0)\r
-               {\r
-                       array_push($out_text, "New protocols from KSES" . KSESTEST_VER . " after using AddProtocol(s):");\r
-                       array_push($out_text, output_ul($new_prots));\r
-                       array_push($out_text, output_hr());\r
-               }\r
-\r
-               $myKses->RemoveProtocols(array("mystery", "anarchy:"));\r
-               $myKses->RemoveProtocols("alpha:");\r
-               $myKses->RemoveProtocol("beta:");\r
-               $myKses->RemoveProtocol("gamma");\r
-\r
-               $remove_protocol  = "\t\t\t<ol>\n";\r
-               $remove_protocol .= "\t\t\t\t" . '<li>$myKses->RemoveProtocols(array("mystery", "anarchy:"));</li>' . "\n";\r
-               $remove_protocol .= "\t\t\t\t" . '<li>$myKses->RemoveProtocols("alpha:");</li>' . "\n";\r
-               $remove_protocol .= "\t\t\t\t" . '<li>$myKses->RemoveProtocol("beta:");</li>' . "\n";\r
-               $remove_protocol .= "\t\t\t\t" . '<li>$myKses->RemoveProtocol("gamma");</li>' . "\n";\r
-               $remove_protocol .= "\t\t\t</ol>\n";\r
-               array_push($out_text, $remove_protocol);\r
-\r
-               $new_prots = $myKses->dumpProtocols();\r
-               if(count($new_prots) > 0)\r
-               {\r
-                       array_push($out_text, "Resulting protocols from KSES" . KSESTEST_VER . " after using RemoveProtocol(s):");\r
-                       array_push($out_text, output_ul($new_prots));\r
-                       array_push($out_text, output_hr());\r
-               }\r
-\r
-               $myKses->SetProtocols(array("https", "gopher", "news"));\r
-               $set_protocol  = "\t\t\t<ol>\n";\r
-               $set_protocol .= "\t\t\t\t" . '<li>$myKses->SetProtocols(array("https", "gopher", "news"));</li>' . "\n";\r
-               $set_protocol .= "\t\t\t</ol>\n";\r
-               array_push($out_text, $set_protocol);\r
-\r
-               $new_prots = $myKses->dumpProtocols();\r
-               if(count($new_prots) > 0)\r
-               {\r
-                       array_push($out_text, "Resulting protocols from KSES" . KSESTEST_VER . " after using SetProtocols:");\r
-                       array_push($out_text, output_ul($new_prots));\r
-                       array_push($out_text, output_hr());\r
-               }\r
-\r
-               //      Invisible reset\r
-               $myKses->SetProtocols(array("http", "proto1", "proto2", "proto9"));\r
-\r
-               return $out_text;\r
-       }\r
-\r
-       function test1_html(&$myKses)\r
-       {\r
-               $out = array();\r
-\r
-               //      Allows <p>|</p> tag\r
-               $myKses->AddHTML("p");\r
-\r
-               //      Allows 'a' tag with href|name attributes,\r
-               //      href has minlen of 10 chars, and maxlen of 25 chars\r
-               //      name has minlen of  2 chars\r
-               $myKses->AddHTML(\r
-                       "a",\r
-                       array(\r
-                               "href" => array('maxlen' => 25, 'minlen' => 10),\r
-                               "name" => array('minlen' => 2)\r
-                       )\r
-               );\r
-\r
-               //      Allows 'td' tag with colspan|rowspan|class|style|width|nowrap attributes,\r
-               //              colspan has minval of   2       and maxval of 5\r
-               //              rowspan has minval of   3       and maxval of 6\r
-               //              class   has minlen of   1 char  and maxlen of   10 chars\r
-               //              style   has minlen of  10 chars and maxlen of 100 chars\r
-               //              width   has maxval of 100\r
-               //              nowrap  is valueless\r
-               $myKses->AddHTML(\r
-                       "td",\r
-                       array(\r
-                               "colspan" => array('minval' =>   2, 'maxval' =>   5),\r
-                               "rowspan" => array('minval' =>   3, 'maxval' =>   6),\r
-                               "class"   => array("minlen" =>   1, 'maxlen' =>  10),\r
-                               "width"   => array("maxval" => 100),\r
-                               "style"   => array('minlen' =>  10, 'maxlen' => 100),\r
-                               "nowrap"  => array('valueless' => 'y')\r
-                       )\r
-               );\r
-\r
-               array_push($out, "Modifying HTML Tests:");\r
-               $code_text  = "<pre>\n";\r
-               $code_text .= "      //   Allows &lt;p&gt;|&lt;/p&gt; tag\n";\r
-               $code_text .= "      \$myKses-&gt;AddHTML(\"p\");\n";\r
-               $code_text .= "\n";\r
-               $code_text .= "      //   Allows 'a' tag with href|name attributes,\n";\r
-               $code_text .= "      //   href has minlen of 10 chars, and maxlen of 25 chars\n";\r
-               $code_text .= "      //   name has minlen of  2 chars\n";\r
-               $code_text .= "      \$myKses-&gt;AddHTML(\n";\r
-               $code_text .= "         \"a\",\n";\r
-               $code_text .= "         array(\n";\r
-               $code_text .= "            \"href\" =&gt; array('maxlen' =&gt; 25, 'minlen' =&gt; 10),\n";\r
-               $code_text .= "            \"name\" =&gt; array('minlen' =&gt; 2)\n";\r
-               $code_text .= "         )\n";\r
-               $code_text .= "      );\n";\r
-               $code_text .= "\n";\r
-               $code_text .= "      //   Allows 'td' tag with colspan|rowspan|class|style|width|nowrap attributes,\n";\r
-               $code_text .= "      //      colspan has minval of   2       and maxval of 5\n";\r
-               $code_text .= "      //      rowspan has minval of   3       and maxval of 6\n";\r
-               $code_text .= "      //      class   has minlen of   1 char  and maxlen of   10 chars\n";\r
-               $code_text .= "      //      style   has minlen of  10 chars and maxlen of 100 chars\n";\r
-               $code_text .= "      //      width   has maxval of 100\n";\r
-               $code_text .= "      //      nowrap  is valueless\n";\r
-               $code_text .= "      \$myKses-&gt;AddHTML(\n";\r
-               $code_text .= "         \"td\",\n";\r
-               $code_text .= "         array(\n";\r
-               $code_text .= "            \"colspan\" =&gt; array('minval' =&gt;   2, 'maxval' =&gt;   5),\n";\r
-               $code_text .= "            \"rowspan\" =&gt; array('minval' =&gt;   3, 'maxval' =&gt;   6),\n";\r
-               $code_text .= "            \"class\"   =&gt; array(\"minlen\" =&gt;   1, 'maxlen' =&gt;  10),\n";\r
-               $code_text .= "            \"width\"   =&gt; array(\"maxval\" =&gt; 100),\n";\r
-               $code_text .= "            \"style\"   =&gt; array('minlen' =&gt;  10, 'maxlen' =&gt; 100),\n";\r
-               $code_text .= "            \"nowrap\"  =&gt; array('valueless' =&gt; 'y')\n";\r
-               $code_text .= "         )\n";\r
-               $code_text .= "      );\n";\r
-               $code_text .= "</pre>\n";\r
-\r
-               array_push($out, $code_text);\r
-               array_push($out, output_hr());\r
-               array_push($out, "Net results:");\r
-\r
-               $out_elems = $myKses->DumpElements();\r
-               if(count($out_elems) > 0)\r
-               {\r
-                       //array_push($out, "\t\t\t<ul>\n");\r
-                       foreach($out_elems as $tag => $attr_data)\r
-                       {\r
-                               $out_li_elems = array();\r
-                               $elem_text = "(X)HTML element $tag";\r
-                               $allow = "";\r
-                               if(isset($attr_data) && is_array($attr_data) && count($attr_data) > 0)\r
-                               {\r
-                                       $allow = " allows attribute";\r
-                                       if(count($attr_data) > 1)\r
-                                       {\r
-                                               $allow .= "s";\r
-                                       }\r
-                                       $allow .= ":\n";\r
-                               }\r
-\r
-                               array_push($out_li_elems, "$elem_text$allow");\r
-\r
-                               $attr_test_li = array();\r
-                               if(isset($attr_data) && is_array($attr_data) && count($attr_data) > 0)\r
-                               {\r
-                                       foreach($attr_data as $attr_name => $attr_tests)\r
-                                       {\r
-                                               $li_text = $attr_name;\r
-                                               if(isset($attr_tests) && count($attr_tests) > 0)\r
-                                               {\r
-                                                       foreach($attr_tests as $test_name => $test_val)\r
-                                                       {\r
-                                                               switch($test_name)\r
-                                                               {\r
-                                                                       case "maxlen":\r
-                                                                               $li_text .= " - maximum length of '" . $test_val . "' characters";\r
-                                                                               break;\r
-                                                                       case "minlen":\r
-                                                                               $li_text .= " - minimum length of '" . $test_val . "' characters";\r
-                                                                               break;\r
-                                                                       case "minval":\r
-                                                                               $li_text .= " - minimum value of '" . $test_val . "'";\r
-                                                                               break;\r
-                                                                       case "maxval":\r
-                                                                               $li_text .= " - maximum value of '" . $test_val . "'";\r
-                                                                               break;\r
-                                                                       case "valueless":\r
-                                                                               switch(strtolower($test_val))\r
-                                                                               {\r
-                                                                                       case 'n':\r
-                                                                                               $li_text .= " - must not be valueless";\r
-                                                                                               break;\r
-                                                                                       case 'y':\r
-                                                                                               $li_text .= " - must be valueless";\r
-                                                                                               break;\r
-                                                                                       default:\r
-                                                                                               break;\r
-                                                                               }\r
-                                                                               break;\r
-                                                                       default:\r
-                                                                               break;\r
-                                                               }\r
-                                                       }\r
-                                               }\r
-                                               array_push($attr_test_li, $li_text);\r
-                                       }\r
-                                       if(count($attr_test_li) > 0)\r
-                                       {\r
-                                               $attr_test_li = output_ul($attr_test_li, "   ");\r
-                                               $out_li_elems = array("$elem_text$allow$attr_test_li");\r
-                                       }\r
-                               }\r
-                               $out = array_merge($out, $out_li_elems);\r
-                       }\r
-               }\r
-\r
-               return $out;\r
-       }\r
-\r
-?>
\ No newline at end of file
index a171c2e8ce801970a8405526a25d3d56ee385957..e71b2b059b80f85aa1f3a10028b59e956d5082b6 100644 (file)
@@ -13,7 +13,7 @@
         * @link http://elgg.org/\r
         */\r
 
-          $version = 2009062401;  // YYYYMMDD   = Elgg Date
+          $version = 2009070101;  // YYYYMMDD   = Elgg Date
                                   //         XX = Interim incrementer\r
        \r
           $release = '1.5';    // Human-friendly version name\r