WordPress.org

Make WordPress Core

Changeset 32603


Ignore:
Timestamp:
05/26/2015 06:05:22 PM (6 years ago)
Author:
wonderboymusic
Message:

Add missing doc blocks to kses.php - also fix some unfortunate whitespace issues in related funcs.

See #32444.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/kses.php

    r31205 r32603  
    514514 * @since 1.0.0
    515515 *
    516  * @param string $string Content to filter through kses
    517  * @param array $allowed_html List of allowed HTML elements
    518  * @param array $allowed_protocols Optional. Allowed protocol in links.
     516 * @param string $string            Content to filter through kses
     517 * @param array  $allowed_html      List of allowed HTML elements
     518 * @param array  $allowed_protocols Optional. Allowed protocol in links.
    519519 * @return string Filtered content with only allowed HTML elements
    520520 */
     
    534534 * @since 3.5.0
    535535 *
    536  * @param string $context The context for which to retrieve tags. Allowed values are
    537  *  post | strip | data | entities or the name of a field filter such as pre_user_description.
     536 * @global array $allowedposttags
     537 * @global array $allowedtags
     538 * @global array $allowedentitynames
     539 *
     540 * @param string $context The context for which to retrieve tags.
     541 *                        Allowed values are post, strip, data,entities, or
     542 *                        the name of a field filter such as pre_user_description.
    538543 * @return array List of allowed tags and their allowed attributes.
    539544 */
     
    589594 * @since 1.0.0
    590595 *
    591  * @param string $string Content to filter through kses
    592  * @param array $allowed_html List of allowed HTML elements
    593  * @param array $allowed_protocols Allowed protocol in links
     596 * @param string $string            Content to filter through kses
     597 * @param array  $allowed_html      List of allowed HTML elements
     598 * @param array  $allowed_protocols Allowed protocol in links
    594599 * @return string Filtered content through 'pre_kses' hook
    595600 */
     
    604609     * @param array  $allowed_protocols Allowed protocol in links.
    605610     */
    606     $string = apply_filters( 'pre_kses', $string, $allowed_html, $allowed_protocols );
    607     return $string;
     611    return apply_filters( 'pre_kses', $string, $allowed_html, $allowed_protocols );
    608612}
    609613
     
    626630 * @since 1.0.0
    627631 *
    628  * @param string $string Content to filter
    629  * @param array $allowed_html Allowed HTML elements
    630  * @param array $allowed_protocols Allowed protocols to keep
     632 * @global array $pass_allowed_html
     633 * @global array $pass_allowed_protocols
     634 *
     635 * @param string $string            Content to filter
     636 * @param array  $allowed_html      Allowed HTML elements
     637 * @param array  $allowed_protocols Allowed protocols to keep
    631638 * @return string Content with fixed HTML tags
    632639 */
     
    643650 * @since 3.1.0
    644651 * @access private
     652 *
     653 * @global array $pass_allowed_html
     654 * @global array $pass_allowed_protocols
     655 *
     656 * @return string
    645657 */
    646658function _wp_kses_split_callback( $match ) {
     
    664676 * @since 1.0.0
    665677 *
    666  * @param string $string Content to filter
    667  * @param array $allowed_html Allowed HTML elements
    668  * @param array $allowed_protocols Allowed protocols to keep
     678 * @param string $string            Content to filter
     679 * @param array  $allowed_html      Allowed HTML elements
     680 * @param array  $allowed_protocols Allowed protocols to keep
    669681 * @return string Fixed HTML element
    670682 */
     
    723735 * @since 1.0.0
    724736 *
    725  * @param string $element HTML element/tag
    726  * @param string $attr HTML attributes from HTML element to closing HTML element tag
    727  * @param array $allowed_html Allowed HTML elements
    728  * @param array $allowed_protocols Allowed protocols to keep
     737 * @param string $element           HTML element/tag
     738 * @param string $attr              HTML attributes from HTML element to closing HTML element tag
     739 * @param array  $allowed_html      Allowed HTML elements
     740 * @param array  $allowed_protocols Allowed protocols to keep
    729741 * @return string Sanitized HTML element
    730742 */
     
    808820 * @since 1.0.0
    809821 *
    810  * @param string $attr Attribute list from HTML element to closing HTML element tag
    811  * @param array $allowed_protocols Allowed protocols to keep
     822 * @param string $attr              Attribute list from HTML element to closing HTML element tag
     823 * @param array  $allowed_protocols Allowed protocols to keep
    812824 * @return array List of attributes after parsing
    813825 */
     
    932944 * @since 1.0.0
    933945 *
    934  * @param string $value Attribute value
    935  * @param string $vless Whether the value is valueless. Use 'y' or 'n'
    936  * @param string $checkname What $checkvalue is checking for.
    937  * @param mixed $checkvalue What constraint the value should pass
     946 * @param string $value      Attribute value
     947 * @param string $vless      Whether the value is valueless. Use 'y' or 'n'
     948 * @param string $checkname  What $checkvalue is checking for.
     949 * @param mixed  $checkvalue What constraint the value should pass
    938950 * @return bool Whether check passes
    939951 */
     
    10061018 * @since 1.0.0
    10071019 *
    1008  * @param string $string Content to filter bad protocols from
    1009  * @param array $allowed_protocols Allowed protocols to keep
     1020 * @param string $string            Content to filter bad protocols from
     1021 * @param array  $allowed_protocols Allowed protocols to keep
    10101022 * @return string Filtered content
    10111023 */
     
    11171129 * @since 1.0.0
    11181130 *
    1119  * @param string $string Content to check for bad protocols
     1131 * @param string $string            Content to check for bad protocols
    11201132 * @param string $allowed_protocols Allowed protocols
    11211133 * @return string Sanitized content
     
    11481160 * @since 1.0.0
    11491161 *
    1150  * @param string $string URI scheme to check against the whitelist
     1162 * @param string $string            URI scheme to check against the whitelist
    11511163 * @param string $allowed_protocols Allowed protocols
    11521164 * @return string Sanitized content
     
    11841196function wp_kses_normalize_entities($string) {
    11851197    // Disarm all entities by converting & to &
    1186 
    11871198    $string = str_replace('&', '&', $string);
    11881199
    11891200    // Change back the allowed entities in our entity whitelist
    1190 
    11911201    $string = preg_replace_callback('/&([A-Za-z]{2,8}[0-9]{0,2});/', 'wp_kses_named_entities', $string);
    11921202    $string = preg_replace_callback('/&#(0*[0-9]{1,7});/', 'wp_kses_normalize_entities2', $string);
     
    12041214 * @since 3.0.0
    12051215 *
     1216 * @global array $allowedentitynames
     1217 *
    12061218 * @param array $matches preg_replace_callback() matches array
    12071219 * @return string Correctly encoded entity
     
    12141226
    12151227    $i = $matches[1];
    1216     return ( ( ! in_array($i, $allowedentitynames) ) ? "&$i;" : "&$i;" );
     1228    return ( ! in_array( $i, $allowedentitynames ) ) ? "&$i;" : "&$i;";
    12171229}
    12181230
     
    12601272
    12611273    $hexchars = $matches[1];
    1262     return ( ( ! valid_unicode(hexdec($hexchars)) ) ? "&#x$hexchars;" : '&#x'.ltrim($hexchars,'0').';' );
     1274    return ( ! valid_unicode( hexdec( $hexchars ) ) ) ? "&#x$hexchars;" : '&#x'.ltrim($hexchars,'0').';';
    12631275}
    12641276
     
    13361348 */
    13371349function wp_kses_data( $data ) {
    1338     return wp_kses( $data , current_filter() );
     1350    return wp_kses( $data, current_filter() );
    13391351}
    13401352
     
    13501362 * @return string Filtered post content with allowed HTML tags and attributes intact.
    13511363 */
    1352 function wp_filter_post_kses($data) {
    1353     return addslashes ( wp_kses( stripslashes( $data ), 'post' ) );
     1364function wp_filter_post_kses( $data ) {
     1365    return addslashes( wp_kses( stripslashes( $data ), 'post' ) );
    13541366}
    13551367
     
    13651377 * @return string Filtered post content with allowed HTML tags and attributes intact.
    13661378 */
    1367 function wp_kses_post($data) {
    1368     return wp_kses( $data , 'post' );
     1379function wp_kses_post( $data ) {
     1380    return wp_kses( $data, 'post' );
    13691381}
    13701382
     
    13781390 */
    13791391function wp_filter_nohtml_kses( $data ) {
    1380     return addslashes ( wp_kses( stripslashes( $data ), 'strip' ) );
     1392    return addslashes( wp_kses( stripslashes( $data ), 'strip' ) );
    13811393}
    13821394
Note: See TracChangeset for help on using the changeset viewer.