Make WordPress Core

Ticket #23313: 23313.2.diff

File 23313.2.diff, 3.6 KB (added by DrewAPicture, 14 years ago)
  • wp-includes/formatting.php

     
    55 * Handles many functions for formatting output.
    66 *
    77 * @package WordPress
    8  **/
     8 */
    99
    1010/**
    1111 * Replaces common plain text characters into formatted entities
     
    134134 * Search for disabled element tags. Push element to stack on tag open and pop
    135135 * on tag close. Assumes first character of $text is tag opening.
    136136 *
     137 * @since 2.9.0
    137138 * @access private
    138  * @since 2.9.0
    139139 *
    140140 * @param string $text Text to check. First character is assumed to be $opening
    141141 * @param array $stack Array used as stack of opened tag elements
     
    262262 *
    263263 * @since 3.1.0
    264264 * @access private
     265 *
    265266 * @param array $matches preg_replace_callback matches array
    266267 * @return string
    267268 */
     
    363364 * ", or ENT_QUOTES to do both. Default is ENT_NOQUOTES where no quotes are encoded.
    364365 *
    365366 * @since 1.2.2
     367 * @access private
    366368 *
    367369 * @param string $string The text which is to be encoded.
    368370 * @param mixed $quote_style Optional. Converts double quotes if set to ENT_COMPAT, both single and double if set to ENT_QUOTES or none if set to ENT_NOQUOTES. Also compatible with old values; converting single quotes if set to 'single', double if set to 'double' or both if otherwise set. Default is ENT_NOQUOTES.
     
    442444 * $quote_style can be set to ENT_COMPAT to decode " entities,
    443445 * or ENT_QUOTES to do both " and '. Default is ENT_NOQUOTES where no quotes are decoded.
    444446 *
    445  * @since 2.8
     447 * @since 2.8.0
    446448 *
    447449 * @param string $string The text which is to be decoded.
    448450 * @param mixed $quote_style Optional. Converts double quotes if set to ENT_COMPAT, both single and double if set to ENT_QUOTES or none if set to ENT_NOQUOTES. Also compatible with old _wp_specialchars() values; converting single quotes if set to 'single', double if set to 'double' or both if otherwise set. Default is ENT_NOQUOTES.
     
    499501/**
    500502 * Checks for invalid UTF8 in a string.
    501503 *
    502  * @since 2.8
     504 * @since 2.8.0
    503505 *
    504506 * @param string $string The text which is to be checked.
    505507 * @param boolean $strip Optional. Whether to attempt to strip out invalid UTF8. Default is false.
     
    947949        return $title;
    948950}
    949951
    950 function sanitize_title_for_query($title) {
    951         return sanitize_title($title, '', 'query');
     952/**
     953 * Sanitizes title for use in a URL.
     954 *
     955 * @uses sanitize_title()
     956 *
     957 * @since 3.1.0
     958 *
     959 * @param string $title The string to be sanitized.
     960 * @return string The sanitized string.
     961 */
     962function sanitize_title_for_query( $title ) {
     963        return sanitize_title( $title, '', 'query' );
    952964}
    953965
    954966/**
     
    18701882 *
    18711883 * @since 3.1.0
    18721884 * @access private
     1885 *
    18731886 * @param array $match The preg_replace_callback matches array
    18741887 * @return array Converted chars
    18751888 */
     
    26922705/**
    26932706 * Escaping for textarea values.
    26942707 *
    2695  * @since 3.1
     2708 * @since 3.1.0
    26962709 *
    26972710 * @param string $text
    26982711 * @return string
     
    31763189        return '<' . $tag . $link . ' target="' . esc_attr( $_links_add_target ) . '">';
    31773190}
    31783191
    3179 // normalize EOL characters and strip duplicate whitespace
     3192/**
     3193 * Normalize EOL characters and strip duplicate whitespace.
     3194 *
     3195 * @since 2.7.0
     3196 *
     3197 * @param string $str The string to normalize.
     3198 * @return string The normalized string.
     3199 */
    31803200function normalize_whitespace( $str ) {
    3181         $str  = trim($str);
    3182         $str  = str_replace("\r", "\n", $str);
     3201        $str  = trim( $str );
     3202        $str  = str_replace( "\r", "\n", $str );
    31833203        $str  = preg_replace( array( '/\n+/', '/[ \t]+/' ), array( "\n", ' ' ), $str );
    31843204        return $str;
    31853205}