Make WordPress Core

Changeset 23365


Ignore:
Timestamp:
02/01/2013 06:07:08 PM (12 years ago)
Author:
SergeyBiryukov
Message:

PHPDoc fixes and additions. props bananastalktome, DrewAPicture. fixes #23313.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/formatting.php

    r23361 r23365  
    66 *
    77 * @package WordPress
    8  **/
     8 */
    99
    1010/**
     
    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
     
    263263 * @since 3.1.0
    264264 * @access private
     265 *
    265266 * @param array $matches preg_replace_callback matches array
    266267 * @return string
     
    364365 *
    365366 * @since 1.2.2
     367 * @access private
    366368 *
    367369 * @param string $string The text which is to be encoded.
     
    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.
     
    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.
     
    825827
    826828/**
    827  * Sanitizes a filename replacing whitespace with dashes
     829 * Sanitizes a filename, replacing whitespace with dashes.
    828830 *
    829831 * Removes special characters that are illegal in filenames on certain
    830832 * operating systems and special characters requiring special escaping
    831833 * to manipulate at the command line. Replaces spaces and consecutive
    832  * dashes with a single dash. Trim period, dash and underscore from beginning
     834 * dashes with a single dash. Trims period, dash and underscore from beginning
    833835 * and end of filename.
    834836 *
     
    882884
    883885/**
    884  * Sanitize username stripping out unsafe characters.
     886 * Sanitizes a username, stripping out unsafe characters.
    885887 *
    886888 * Removes tags, octets, entities, and if strict is enabled, will only keep
     
    917919
    918920/**
    919  * Sanitize a string key.
     921 * Sanitizes a string key.
    920922 *
    921923 * Keys are used as internal identifiers. Lowercase alphanumeric characters, dashes and underscores are allowed.
     
    934936
    935937/**
    936  * Sanitizes title or use fallback title.
     938 * Sanitizes a title, or returns a fallback title.
    937939 *
    938940 * Specifically, HTML and PHP tags are stripped. Further actions can be added
     
    947949 * @return string The sanitized string.
    948950 */
    949 function sanitize_title($title, $fallback_title = '', $context = 'save') {
     951function sanitize_title( $title, $fallback_title = '', $context = 'save' ) {
    950952    $raw_title = $title;
    951953
     
    961963}
    962964
    963 function sanitize_title_for_query($title) {
    964     return sanitize_title($title, '', 'query');
    965 }
    966 
    967 /**
    968  * Sanitizes title, replacing whitespace and a few other characters with dashes.
     965/**
     966 * Sanitizes a title with the 'query' context.
     967 *
     968 * Used for querying the database for a value from URL.
     969 *
     970 * @since 3.1.0
     971 * @uses sanitize_title()
     972 *
     973 * @param string $title The string to be sanitized.
     974 * @return string The sanitized string.
     975 */
     976function sanitize_title_for_query( $title ) {
     977    return sanitize_title( $title, '', 'query' );
     978}
     979
     980/**
     981 * Sanitizes a title, replacing whitespace and a few other characters with dashes.
    969982 *
    970983 * Limits the output to alphanumeric characters, underscore (_) and dash (-).
     
    978991 * @return string The sanitized title.
    979992 */
    980 function sanitize_title_with_dashes($title, $raw_title = '', $context = 'display') {
     993function sanitize_title_with_dashes( $title, $raw_title = '', $context = 'display' ) {
    981994    $title = strip_tags($title);
    982995    // Preserve escaped octets.
     
    10501063
    10511064/**
    1052  * Sanitizes a html classname to ensure it only contains valid characters
     1065 * Sanitizes an HTML classname to ensure it only contains valid characters.
    10531066 *
    10541067 * Strips the string down to A-Z,a-z,0-9,_,-. If this results in an empty
     
    18841897 * @since 3.1.0
    18851898 * @access private
     1899 *
    18861900 * @param array $match The preg_replace_callback matches array
    18871901 * @return array Converted chars
     
    27062720 * Escaping for textarea values.
    27072721 *
    2708  * @since 3.1
     2722 * @since 3.1.0
    27092723 *
    27102724 * @param string $text
     
    27172731
    27182732/**
    2719  * Escape a HTML tag name.
     2733 * Escape an HTML tag name.
    27202734 *
    27212735 * @since 2.5.0
     
    31903204}
    31913205
    3192 // normalize EOL characters and strip duplicate whitespace
     3206/**
     3207 * Normalize EOL characters and strip duplicate whitespace.
     3208 *
     3209 * @since 2.7.0
     3210 *
     3211 * @param string $str The string to normalize.
     3212 * @return string The normalized string.
     3213 */
    31933214function normalize_whitespace( $str ) {
    3194     $str  = trim($str);
    3195     $str  = str_replace("\r", "\n", $str);
     3215    $str  = trim( $str );
     3216    $str  = str_replace( "\r", "\n", $str );
    31963217    $str  = preg_replace( array( '/\n+/', '/[ \t]+/' ), array( "\n", ' ' ), $str );
    31973218    return $str;
Note: See TracChangeset for help on using the changeset viewer.