Make WordPress Core

Ticket #5641: kses.phpdoc.r6597.diff

File kses.phpdoc.r6597.diff, 24.1 KB (added by darkdragon, 17 years ago)

Almost complete documentation for kses.php external library based off of r6597

  • kses.php

     
    11<?php
     2/**
     3 * HTML/XHTML filter that only allows some elements and attributes
     4 *
     5 * Added wp_ prefix to avoid conflicts with existing kses users
     6 *
     7 * @version 0.2.2
     8 * @copyright (C) 2002, 2003, 2005  Ulf Harnhammar
     9 *
     10 * @package External
     11 * @subpackage KSES
     12 */
    213
    3 // Added wp_ prefix to avoid conflicts with existing kses users
    4 # kses 0.2.2 - HTML/XHTML filter that only allows some elements and attributes
    5 # Copyright (C) 2002, 2003, 2005  Ulf Harnhammar
    614# *** CONTACT INFORMATION ***
    715#
    816# E-mail:      metaur at users dot sourceforge dot net
     
    1826
    1927// You can override this in your my-hacks.php file
    2028if (!CUSTOM_TAGS) {
     29        /**
     30         * Kses global for default allowable HTML tags
     31         *
     32         * Can be override by using CUSTOM_TAGS constant
     33         * @global array $allowedposttags
     34         * @since 2.0.0
     35         */
    2136        $allowedposttags = array(
    2237                'address' => array(),
    2338                'a' => array(
     
    183198                'var' => array()
    184199        );
    185200
     201        /**
     202         * Kses allowed HTML elements
     203         * @global array $allowedtags
     204         * @since 1.0.0
     205         */
    186206        $allowedtags = array(
    187207                'a' => array(
    188208                        'href' => array(), 'title' => array()
     
    219239        );
    220240}
    221241
    222 function wp_kses($string, $allowed_html, $allowed_protocols = array ('http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet'))
    223         ###############################################################################
    224                 # This function makes sure that only the allowed HTML element names, attribute
    225                 # names and attribute values plus only sane HTML entities will occur in
    226                 # $string. You have to remove any slashes from PHP's magic quotes before you
    227                 # call this function.
    228                 ###############################################################################
    229         {
     242/**
     243 * wp_kses() - {@internal Missing Short Description}}
     244 *
     245 * This function makes sure that only the allowed HTML element names,
     246 * attribute names and attribute values plus only sane HTML entities
     247 * will occur in $string. You have to remove any slashes from PHP's
     248 * magic quotes before you call this function.
     249 *
     250 * The default allowed protocols are 'http', 'https', 'ftp', 'mailto',
     251 * 'news', 'irc', 'gopher', 'nntp', 'feed', and finally 'telnet. This
     252 * covers all common link protocols, except for 'javascript' which
     253 * should not be allowed for untrusted users.
     254 *
     255 * @since 1.0.0
     256 *
     257 * @param string $string Content to filter through kses
     258 * @param array $allowed_html List of allowed HTML elements
     259 * @param array $allowed_protocols Optional. Allowed protocol in links.
     260 * @return string {@internal Missing Description}}
     261 */
     262function wp_kses($string, $allowed_html, $allowed_protocols = array ('http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet')) {
    230263        $string = wp_kses_no_null($string);
    231264        $string = wp_kses_js_entities($string);
    232265        $string = wp_kses_normalize_entities($string);
    233266        $allowed_html_fixed = wp_kses_array_lc($allowed_html);
    234267        $string = wp_kses_hook($string, $allowed_html_fixed, $allowed_protocols); // WP changed the order of these funcs and added args to wp_kses_hook
    235268        return wp_kses_split($string, $allowed_html_fixed, $allowed_protocols);
    236 } # function wp_kses
     269}
    237270
    238 function wp_kses_hook($string, $allowed_html, $allowed_protocols)
    239 ###############################################################################
    240 # You add any kses hooks here.
    241 ###############################################################################
    242 {
     271/**
     272 * wp_kses_hook() - You add any kses hooks here.
     273 *
     274 * There is currently only one kses WordPress hook and it is
     275 * called here. All parameters are passed to the hooks and
     276 * expected to recieve a string.
     277 *
     278 * @since 1.0.0
     279 *
     280 * @param string $string Content to filter through kses
     281 * @param array $allowed_html List of allowed HTML elements
     282 * @param array $allowed_protocols Allowed protocol in links
     283 * @return string Filtered content through 'pre_kses' hook
     284 */
     285function wp_kses_hook($string, $allowed_html, $allowed_protocols) {
    243286        $string = apply_filters('pre_kses', $string, $allowed_html, $allowed_protocols);
    244287        return $string;
    245 } # function wp_kses_hook
     288}
    246289
    247 function wp_kses_version()
    248 ###############################################################################
    249 # This function returns kses' version number.
    250 ###############################################################################
    251 {
     290/**
     291 * wp_kses_version() - This function returns kses' version number.
     292 *
     293 * @since 1.0.0
     294 *
     295 * @return string Version Number
     296 */
     297function wp_kses_version() {
    252298        return '0.2.2';
    253 } # function wp_kses_version
     299}
    254300
    255 function wp_kses_split($string, $allowed_html, $allowed_protocols)
    256 ###############################################################################
    257 # This function searches for HTML tags, no matter how malformed. It also
    258 # matches stray ">" characters.
    259 ###############################################################################
    260 {
     301/**
     302 * wp_kses_split() - Searches for HTML tags, no matter how malformed
     303 *
     304 * It also matches stray ">" characters.
     305 *
     306 * @since 1.0.0
     307 *
     308 * @param string $string Content to filter
     309 * @param array $allowed_html Allowed HTML elements
     310 * @param array $allowed_protocols Allowed protocols to keep
     311 * @return string {@internal Missing Description}}
     312 */
     313function wp_kses_split($string, $allowed_html, $allowed_protocols) {
    261314        return preg_replace('%((<!--.*?(-->|$))|(<[^>]*(>|$)|>))%e',
    262315        "wp_kses_split2('\\1', \$allowed_html, ".'$allowed_protocols)', $string);
    263 } # function wp_kses_split
     316}
    264317
    265 function wp_kses_split2($string, $allowed_html, $allowed_protocols)
    266 ###############################################################################
    267 # This function does a lot of work. It rejects some very malformed things
    268 # like <:::>. It returns an empty string, if the element isn't allowed (look
    269 # ma, no strip_tags()!). Otherwise it splits the tag into an element and an
    270 # attribute list.
    271 ###############################################################################
    272 {
     318/**
     319 * wp_kses_split2() - {@internal Missing Short Description}}
     320 *
     321 * This function does a lot of work. It rejects some very malformed things
     322 * like <:::>. It returns an empty string, if the element isn't allowed (look
     323 * ma, no strip_tags()!). Otherwise it splits the tag into an element and an
     324 * attribute list.
     325 *
     326 * @since 1.0.0
     327 *
     328 * @param string $string Content to filter
     329 * @param array $allowed_html Allowed HTML elements
     330 * @param array $allowed_protocols Allowed protocols to keep
     331 * @return string {@internal Missing Description}}
     332 */
     333function wp_kses_split2($string, $allowed_html, $allowed_protocols) {
    273334        $string = wp_kses_stripslashes($string);
    274335
    275336        if (substr($string, 0, 1) != '<')
     
    303364        # No attributes are allowed for closing elements
    304365
    305366        return wp_kses_attr("$slash$elem", $attrlist, $allowed_html, $allowed_protocols);
    306 } # function wp_kses_split2
     367}
    307368
     369/**
     370 * wp_kses_attr() - Removes all attributes, if none are allowed for this element
     371 *
     372 * If some are allowed it calls wp_kses_hair() to split them further, and then
     373 * it builds up new HTML code from the data that kses_hair() returns. It also
     374 * removes "<" and ">" characters, if there are any left. One more thing it
     375 * does is to check if the tag has a closing XHTML slash, and if it does, it
     376 * puts one in the returned code as well.
     377 *
     378 * @since 1.0.0
     379 *
     380 * @param string $element {@internal Missing Description}}
     381 * @param string $attr {@internal Missing Description}}
     382 * @param array $allowed_html Allowed HTML elements
     383 * @param array $allowed_protocols Allowed protocols to keep
     384 * @return string {@internal Missing Description}}
     385 */
    308386function wp_kses_attr($element, $attr, $allowed_html, $allowed_protocols)
    309 ###############################################################################
    310 # This function removes all attributes, if none are allowed for this element.
    311 # If some are allowed it calls wp_kses_hair() to split them further, and then it
    312 # builds up new HTML code from the data that kses_hair() returns. It also
    313 # removes "<" and ">" characters, if there are any left. One more thing it
    314 # does is to check if the tag has a closing XHTML slash, and if it does,
    315 # it puts one in the returned code as well.
    316 ###############################################################################
    317387{
    318388        # Is there a closing XHTML slash at the end of the attributes?
    319389
     
    366436        $attr2 = preg_replace('/[<>]/', '', $attr2);
    367437
    368438        return "<$element$attr2$xhtml_slash>";
    369 } # function wp_kses_attr
     439}
    370440
     441/**
     442 * wp_kses_hair() - {@internal Missing Short Description}}
     443 *
     444 * This function does a lot of work. It parses an attribute list into an array
     445 * with attribute data, and tries to do the right thing even if it gets weird
     446 * input. It will add quotes around attribute values that don't have any quotes
     447 * or apostrophes around them, to make it easier to produce HTML code that will
     448 * conform to W3C's HTML specification. It will also remove bad URL protocols
     449 * from attribute values.
     450 *
     451 * @since 1.0.0
     452 *
     453 * @param string $attr {@internal Missing Description}}
     454 * @param array $allowed_protocols Allowed protocols to keep
     455 * @return string {@internal Missing Description}}
     456 */
    371457function wp_kses_hair($attr, $allowed_protocols)
    372 ###############################################################################
    373 # This function does a lot of work. It parses an attribute list into an array
    374 # with attribute data, and tries to do the right thing even if it gets weird
    375 # input. It will add quotes around attribute values that don't have any quotes
    376 # or apostrophes around them, to make it easier to produce HTML code that will
    377 # conform to W3C's HTML specification. It will also remove bad URL protocols
    378 # from attribute values.
    379 ###############################################################################
    380458{
    381459        $attrarr = array ();
    382460        $mode = 0;
     
    472550                $attrarr[] = array ('name' => $attrname, 'value' => '', 'whole' => $attrname, 'vless' => 'y');
    473551
    474552        return $attrarr;
    475 } # function wp_kses_hair
     553}
    476554
     555/**
     556 * wp_kses_check_attr_val() - Performs different checks for attribute values.
     557 *
     558 * The currently implemented checks are "maxlen", "minlen", "maxval", "minval"
     559 * and "valueless" with even more checks to come soon.
     560 *
     561 * @since 1.0.0
     562 *
     563 * @param string $value {@internal Missing Description}}
     564 * @param string $vless {@internal Missing Description}}
     565 * @param string $checkname What $checkvalue is checking for.
     566 * @param int $checkvalue {@internal Missing Description}}
     567 * @return bool Whether check passes (true) or not (false)
     568 */
    477569function wp_kses_check_attr_val($value, $vless, $checkname, $checkvalue)
    478 ###############################################################################
    479 # This function performs different checks for attribute values. The currently
    480 # implemented checks are "maxlen", "minlen", "maxval", "minval" and "valueless"
    481 # with even more checks to come soon.
    482 ###############################################################################
    483570{
    484571        $ok = true;
    485572
     
    536623        } # switch
    537624
    538625        return $ok;
    539 } # function wp_kses_check_attr_val
     626}
    540627
     628/**
     629 * wp_kses_bad_protocol() - Sanitize string from bad protocols
     630 *
     631 * This function removes all non-allowed protocols from the beginning
     632 * of $string. It ignores whitespace and the case of the letters, and
     633 * it does understand HTML entities. It does its work in a while loop,
     634 * so it won't be fooled by a string like "javascript:javascript:alert(57)".
     635 *
     636 * @since 1.0.0
     637 *
     638 * @param string $string Content to filter bad protocols from
     639 * @param array $allowed_protocols Allowed protocols to keep
     640 * @return string Filtered content
     641 */
    541642function wp_kses_bad_protocol($string, $allowed_protocols)
    542 ###############################################################################
    543 # This function removes all non-allowed protocols from the beginning of
    544 # $string. It ignores whitespace and the case of the letters, and it does
    545 # understand HTML entities. It does its work in a while loop, so it won't be
    546 # fooled by a string like "javascript:javascript:alert(57)".
    547 ###############################################################################
    548643{
    549644        $string = wp_kses_no_null($string);
    550645        $string = preg_replace('/\xad+/', '', $string); # deals with Opera "feature"
     
    556651        } # while
    557652
    558653        return $string;
    559 } # function wp_kses_bad_protocol
     654}
    560655
     656/**
     657 * wp_kses_no_null() - Removes any NULL characters in $string.
     658 *
     659 * @since 1.0.0
     660 *
     661 * @param string $string
     662 * @return string
     663 */
    561664function wp_kses_no_null($string)
    562 ###############################################################################
    563 # This function removes any NULL characters in $string.
    564 ###############################################################################
    565665{
    566666        $string = preg_replace('/\0+/', '', $string);
    567667        $string = preg_replace('/(\\\\0)+/', '', $string);
    568668
    569669        return $string;
    570 } # function wp_kses_no_null
     670}
    571671
     672/**
     673 * wp_kses_stripslashes() - Strips slashes from in front of quotes
     674 *
     675 * This function changes the character sequence  \"  to just  "
     676 * It leaves all other slashes alone. It's really weird, but the
     677 * quoting from preg_replace(//e) seems to require this.
     678 *
     679 * @since 1.0.0
     680 *
     681 * @param string $string String to strip slashes
     682 * @return string Fixed strings with quoted slashes
     683 */
    572684function wp_kses_stripslashes($string)
    573 ###############################################################################
    574 # This function changes the character sequence  \"  to just  "
    575 # It leaves all other slashes alone. It's really weird, but the quoting from
    576 # preg_replace(//e) seems to require this.
    577 ###############################################################################
    578685{
    579686        return preg_replace('%\\\\"%', '"', $string);
    580 } # function wp_kses_stripslashes
     687}
    581688
     689/**
     690 * wp_kses_array_lc() - Goes through an array and changes the keys to all lower case.
     691 *
     692 * @since 1.0.0
     693 *
     694 * @param array $inarray Unfiltered array
     695 * @return array Fixed array with all lowercase keys
     696 */
    582697function wp_kses_array_lc($inarray)
    583 ###############################################################################
    584 # This function goes through an array, and changes the keys to all lower case.
    585 ###############################################################################
    586698{
    587699        $outarray = array ();
    588700
     
    597709        } # foreach $inarray
    598710
    599711        return $outarray;
    600 } # function wp_kses_array_lc
     712}
    601713
    602 function wp_kses_js_entities($string)
    603 ###############################################################################
    604 # This function removes the HTML JavaScript entities found in early versions of
    605 # Netscape 4.
    606 ###############################################################################
    607 {
     714/**
     715 * wp_kses_js_entities() - Removes the HTML JavaScript entities found in early versions of Netscape 4.
     716 *
     717 * @since 1.0.0
     718 *
     719 * @param unknown_type $string
     720 * @return unknown
     721 */
     722function wp_kses_js_entities($string) {
    608723        return preg_replace('%&\s*\{[^}]*(\}\s*;?|$)%', '', $string);
    609 } # function wp_kses_js_entities
     724}
    610725
    611 function wp_kses_html_error($string)
    612 ###############################################################################
    613 # This function deals with parsing errors in wp_kses_hair(). The general plan is
    614 # to remove everything to and including some whitespace, but it deals with
    615 # quotes and apostrophes as well.
    616 ###############################################################################
    617 {
     726/**
     727 * wp_kses_html_error() - Handles parsing errors in wp_kses_hair()
     728 *
     729 * The general plan is to remove everything to and including some
     730 * whitespace, but it deals with quotes and apostrophes as well.
     731 *
     732 * @since 1.0.0
     733 *
     734 * @param string $string
     735 * @return string
     736 */
     737function wp_kses_html_error($string) {
    618738        return preg_replace('/^("[^"]*("|$)|\'[^\']*(\'|$)|\S)*\s*/', '', $string);
    619 } # function wp_kses_html_error
     739}
    620740
    621 function wp_kses_bad_protocol_once($string, $allowed_protocols)
    622 ###############################################################################
    623 # This function searches for URL protocols at the beginning of $string, while
    624 # handling whitespace and HTML entities.
    625 ###############################################################################
    626 {
     741/**
     742 * wp_kses_bad_protocol_once() - Sanitizes content from bad protocols and other characters
     743 *
     744 * This function searches for URL protocols at the beginning of $string,
     745 * while handling whitespace and HTML entities.
     746 *
     747 * @since 1.0.0
     748 *
     749 * @param string $string Content to check for bad protocols
     750 * @param string $allowed_protocols Allowed protocols
     751 * @return string Sanitized content
     752 */
     753function wp_kses_bad_protocol_once($string, $allowed_protocols) {
    627754        return preg_replace('/^((&[^;]*;|[\sA-Za-z0-9])*)'.'(:|&#58;|&#[Xx]3[Aa];)\s*/e', 'wp_kses_bad_protocol_once2("\\1", $allowed_protocols)', $string);
    628 } # function wp_kses_bad_protocol_once
     755}
    629756
    630 function wp_kses_bad_protocol_once2($string, $allowed_protocols)
    631 ###############################################################################
    632 # This function processes URL protocols, checks to see if they're in the white-
    633 # list or not, and returns different data depending on the answer.
    634 ###############################################################################
    635 {
     757/**
     758 * wp_kses_bad_protocol_once2() - Callback for wp_kses_bad_protocol_once() regular expression.
     759 *
     760 * This function processes URL protocols, checks to see if they're in the
     761 * white-list or not, and returns different data depending on the answer.
     762 *
     763 * @since 1.0.0
     764 *
     765 * @param string $string Content to check for bad protocols
     766 * @param array $allowed_protocols Allowed protocols
     767 * @return string Sanitized content
     768 */
     769function wp_kses_bad_protocol_once2($string, $allowed_protocols) {
    636770        $string2 = wp_kses_decode_entities($string);
    637771        $string2 = preg_replace('/\s/', '', $string2);
    638772        $string2 = wp_kses_no_null($string2);
     
    651785                return "$string2:";
    652786        else
    653787                return '';
    654 } # function wp_kses_bad_protocol_once2
     788}
    655789
    656 function wp_kses_normalize_entities($string)
    657 ###############################################################################
    658 # This function normalizes HTML entities. It will convert "AT&T" to the correct
    659 # "AT&amp;T", "&#00058;" to "&#58;", "&#XYZZY;" to "&amp;#XYZZY;" and so on.
    660 ###############################################################################
    661 {
     790/**
     791 * wp_kses_normalize_entities() - Converts and fixes HTML entities
     792 *
     793 * This function normalizes HTML entities. It will convert "AT&T" to the
     794 * correct "AT&amp;T", "&#00058;" to "&#58;", "&#XYZZY;" to "&amp;#XYZZY;"
     795 * and so on.
     796 *
     797 * @since 1.0.0
     798 *
     799 * @param string $string Content to normalize entities
     800 * @return string Content with normalized entities
     801 */
     802function wp_kses_normalize_entities($string) {
    662803        # Disarm all entities by converting & to &amp;
    663804
    664805        $string = str_replace('&', '&amp;', $string);
     
    670811        $string = preg_replace('/&amp;#([Xx])0*(([0-9A-Fa-f]{2}){1,2});/', '&#\\1\\2;', $string);
    671812
    672813        return $string;
    673 } # function wp_kses_normalize_entities
     814}
    674815
    675 function wp_kses_normalize_entities2($i)
    676 ###############################################################################
    677 # This function helps wp_kses_normalize_entities() to only accept 16 bit values
    678 # and nothing more for &#number; entities.
    679 ###############################################################################
    680 {
     816/**
     817 * wp_kses_normalize_entities2() - Callback for wp_kses_normalize_entities() regular expression
     818 *
     819 * This function helps wp_kses_normalize_entities() to only accept 16 bit
     820 * values and nothing more for &#number; entities.
     821 *
     822 * @since 1.0.0
     823 *
     824 * @param int $i Number encoded entity
     825 * @return string Correctly encoded entity
     826 */
     827function wp_kses_normalize_entities2($i) {
    681828        return (($i > 65535) ? "&amp;#$i;" : "&#$i;");
    682 } # function wp_kses_normalize_entities2
     829}
    683830
    684 function wp_kses_decode_entities($string)
    685 ###############################################################################
    686 # This function decodes numeric HTML entities (&#65; and &#x41;). It doesn't
    687 # do anything with other entities like &auml;, but we don't need them in the
    688 # URL protocol whitelisting system anyway.
    689 ###############################################################################
    690 {
     831/**
     832 * wp_kses_decode_entities() - Convert all entities to their character counterparts.
     833 *
     834 * This function decodes numeric HTML entities (&#65; and &#x41;). It
     835 * doesn't do anything with other entities like &auml;, but we don't need
     836 * them in the URL protocol whitelisting system anyway.
     837 *
     838 * @since 1.0.0
     839 *
     840 * @param string $string Content to change entities
     841 * @return string Content after decoded entities
     842 */
     843function wp_kses_decode_entities($string) {
    691844        $string = preg_replace('/&#([0-9]+);/e', 'chr("\\1")', $string);
    692845        $string = preg_replace('/&#[Xx]([0-9A-Fa-f]+);/e', 'chr(hexdec("\\1"))', $string);
    693846
    694847        return $string;
    695 } # function wp_kses_decode_entities
     848}
    696849
     850/**
     851 * wp_filter_kses() - Sanitize content with allowed HTML Kses rules
     852 *
     853 * @since 1.0.0
     854 * @uses $allowedtags
     855 *
     856 * @param string $data Content to filter
     857 * @return string Filtered content
     858 */
    697859function wp_filter_kses($data) {
    698860        global $allowedtags;
    699861        return addslashes( wp_kses(stripslashes( $data ), $allowedtags) );
    700862}
    701863
     864/**
     865 * wp_filter_post_kses() - Sanitize content for allowed HTML tags for post content
     866 *
     867 * Post content refers to the page contents of the 'post' type and not
     868 * $_POST data from forms.
     869 *
     870 * @since 2.0.0
     871 * @uses $allowedposttags
     872 *
     873 * @param string $data Post content to filter
     874 * @return string Filtered post content with allowed HTML tags and attributes intact.
     875 */
    702876function wp_filter_post_kses($data) {
    703877        global $allowedposttags;
    704878        return addslashes ( wp_kses(stripslashes( $data ), $allowedposttags) );
    705879}
    706880
     881/**
     882 * wp_filter_nohtml_kses() - Strips all of the HTML in the content
     883 *
     884 * @since 2.1.0
     885 *
     886 * @param string $data Content to strip all HTML from
     887 * @return string Filtered content without any HTML
     888 */
    707889function wp_filter_nohtml_kses($data) {
    708890        return addslashes ( wp_kses(stripslashes( $data ), array()) );
    709891}
    710892
     893/**
     894 * kses_init_filters() - Adds all Kses input form content filters
     895 *
     896 * All hooks have default priority. The wp_filter_kses() fucntion
     897 * is added to the 'pre_comment_content' and 'title_save_pre'
     898 * hooks. The wp_filter_post_kses() function is added to the
     899 * 'content_save_pre', 'excerpt_save_pre', and 'content_filtered_save_pre'
     900 * hooks.
     901 *
     902 * @since 2.0.0
     903 * @uses add_filter() See description for what functions are added to what hooks.
     904 */
    711905function kses_init_filters() {
    712906        // Normal filtering.
    713907        add_filter('pre_comment_content', 'wp_filter_kses');
     
    719913        add_filter('content_filtered_save_pre', 'wp_filter_post_kses');
    720914}
    721915
     916/**
     917 * kses_remove_filters() - Removes all Kses input form content filters
     918 *
     919 * A quick procedural method to removing all of the filters
     920 * that kses uses for content in WordPress Loop.
     921 *
     922 * Does not remove the kses_init() function from 'init' hook
     923 * (priority is default). Also does not remove kses_init()
     924 * function from 'set_current_user' hook (priority is also
     925 * default).
     926 *
     927 * @since 2.0.6
     928 *
     929 */
    722930function kses_remove_filters() {
    723931        // Normal filtering.
    724932        remove_filter('pre_comment_content', 'wp_filter_kses');
     
    730938        remove_filter('content_filtered_save_pre', 'wp_filter_post_kses');
    731939}
    732940
     941/**
     942 * kses_init() - Sets up most of the Kses filters for input form content
     943 *
     944 * If you remove the kses_init() function from 'init' hook and
     945 * 'set_current_user' (priority is default), then none of the
     946 * Kses filter hooks will be added.
     947 *
     948 * First removes all of the Kses filters in case the current user
     949 * does not need to have Kses filter the content. If the user does
     950 * not have unfiltered html capability, then Kses filters are added.
     951 *
     952 * @uses kses_remove_filters() Removes the Kses filters
     953 * @uses kses_init_filters() Adds the Kses filters back if the user
     954 *              does not have unfiltered HTML capability.
     955 * @since 2.0.0
     956 */
    733957function kses_init() {
    734958        kses_remove_filters();
    735959
     
    739963
    740964add_action('init', 'kses_init');
    741965add_action('set_current_user', 'kses_init');
    742 ?>
     966?>
     967 No newline at end of file