WordPress.org

Make WordPress Core

Ticket #25518: 25518.4.diff

File 25518.4.diff, 24.0 KB (added by DrewAPicture, 6 years ago)

Various small tweaks

  • src/wp-includes/formatting.php

     
    101101
    102102        // Transform into regexp sub-expression used in _wptexturize_pushpop_element
    103103        // Must do this every time in case plugins use these filters in a context sensitive manner
    104         $no_texturize_tags = '(' . implode('|', apply_filters('no_texturize_tags', $default_no_texturize_tags) ) . ')';
    105         $no_texturize_shortcodes = '(' . implode('|', apply_filters('no_texturize_shortcodes', $default_no_texturize_shortcodes) ) . ')';
     104        /**
     105         * Filter the list of HTML elements not to texturize.
     106         *
     107         * @since 2.8.0
     108         *
     109         * @param array $default_no_texturize_tags An array of HTML element names.
     110         */
     111        $no_texturize_tags = '(' . implode( '|', apply_filters( 'no_texturize_tags', $default_no_texturize_tags ) ) . ')';
     112        /**
     113         * Filter the list of shortcodes not to texturize.
     114         *
     115         * @since 2.8.0
     116         *
     117         * @param array $default_no_texturize_shortcodes An array of shortcode names.
     118         */
     119        $no_texturize_shortcodes = '(' . implode( '|', apply_filters( 'no_texturize_shortcodes', $default_no_texturize_shortcodes ) ) . ')';
    106120
    107121        $no_texturize_tags_stack = array();
    108122        $no_texturize_shortcodes_stack = array();
     
    842856function sanitize_file_name( $filename ) {
    843857        $filename_raw = $filename;
    844858        $special_chars = array("?", "[", "]", "/", "\\", "=", "<", ">", ":", ";", ",", "'", "\"", "&", "$", "#", "*", "(", ")", "|", "~", "`", "!", "{", "}", chr(0));
    845         $special_chars = apply_filters('sanitize_file_name_chars', $special_chars, $filename_raw);
     859        /**
     860         * Filter the list of characters to remove from a filename.
     861         *
     862         * @since 2.8.0
     863         *
     864         * @param array  $special_chars Characters to remove.
     865         * @param string $filename_raw  Filename as it was passed into sanitize_file_name().
     866         */
     867        $special_chars = apply_filters( 'sanitize_file_name_chars', $special_chars, $filename_raw );
    846868        $filename = str_replace($special_chars, '', $filename);
    847869        $filename = preg_replace('/[\s-]+/', '-', $filename);
    848870        $filename = trim($filename, '.-_');
     
    851873        $parts = explode('.', $filename);
    852874
    853875        // Return if only one extension
    854         if ( count($parts) <= 2 )
    855                 return apply_filters('sanitize_file_name', $filename, $filename_raw);
     876        if ( count( $parts ) <= 2 ) {
     877                /**
     878                 * Filter a sanitized filename string.
     879                 *
     880                 * @since 2.8.0
     881                 *
     882                 * @param string $filename     Sanitized filename.
     883                 * @param string $filename_raw The filename prior to sanitization.
     884                 */
     885                return apply_filters( 'sanitize_file_name', $filename, $filename_raw );
     886        }
    856887
    857888        // Process multiple extensions
    858889        $filename = array_shift($parts);
    859890        $extension = array_pop($parts);
    860891        $mimes = get_allowed_mime_types();
    861892
    862         // Loop over any intermediate extensions. Munge them with a trailing underscore if they are a 2 - 5 character
    863         // long alpha string not in the extension whitelist.
     893        /*
     894         * Loop over any intermediate extensions. Postfix them with a trailing underscore
     895         * if they are a 2 - 5 character long alpha string not in the extension whitelist.
     896         */
    864897        foreach ( (array) $parts as $part) {
    865898                $filename .= '.' . $part;
    866899
     
    878911                }
    879912        }
    880913        $filename .= '.' . $extension;
    881 
     914        /** This filter is documented in wp-includes/formatting.php */
    882915        return apply_filters('sanitize_file_name', $filename, $filename_raw);
    883916}
    884917
     
    891924 * parameters for the 'sanitize_user' filter.
    892925 *
    893926 * @since 2.0.0
    894  * @uses apply_filters() Calls 'sanitize_user' hook on username, raw username,
    895  *              and $strict parameter.
    896927 *
    897928 * @param string $username The username to be sanitized.
    898929 * @param bool $strict If set limits $username to specific characters. Default false.
     
    914945        // Consolidate contiguous whitespace
    915946        $username = preg_replace( '|\s+|', ' ', $username );
    916947
     948        /**
     949         * Filter a sanitized username string.
     950         *
     951         * @since 2.0.11
     952         *
     953         * @param string $username     Sanitized username.
     954         * @param string $raw_username The username prior to sanitization.
     955         * @param bool   $strict       Whether to limit the sanitization to specific characters. Default false.
     956         */
    917957        return apply_filters( 'sanitize_user', $username, $raw_username, $strict );
    918958}
    919959
     
    931971        $raw_key = $key;
    932972        $key = strtolower( $key );
    933973        $key = preg_replace( '/[^a-z0-9_\-]/', '', $key );
     974
     975        /**
     976         * Filter a sanitized key string.
     977         *
     978         * @since 3.0.0
     979         *
     980         * @param string $key     Sanitized key.
     981         * @param string $raw_key The key prior to sanitization.
     982         */
    934983        return apply_filters( 'sanitize_key', $key, $raw_key );
    935984}
    936985
     
    9541003        if ( 'save' == $context )
    9551004                $title = remove_accents($title);
    9561005
    957         $title = apply_filters('sanitize_title', $title, $raw_title, $context);
     1006        /**
     1007         * Filter a sanitized title string.
     1008         *
     1009         * @since 1.2.1
     1010         *
     1011         * @param string $title     Sanitized title.
     1012         * @param string $raw_title The title prior to sanitization.
     1013         * @param string $context   The context for which the title is being sanitized.
     1014         */
     1015        $title = apply_filters( 'sanitize_title', $title, $raw_title, $context );
    9581016
    9591017        if ( '' === $title || false === $title )
    9601018                $title = $fallback_title;
     
    10861144        if ( '' == $sanitized )
    10871145                $sanitized = $fallback;
    10881146
     1147        /**
     1148         * Filter a sanitized HTML class string.
     1149         *
     1150         * @since 2.8.0
     1151         *
     1152         * @param string $sanitized The sanitized HTML class.
     1153         * @param string $class     HTML class before sanitization.
     1154         * @param string $fallback  The fallback string.
     1155         */
    10891156        return apply_filters( 'sanitize_html_class', $sanitized, $class, $fallback );
    10901157}
    10911158
     
    11701237 */
    11711238function balanceTags( $text, $force = false ) {
    11721239        if ( $force || get_option('use_balanceTags') == 1 ) {
     1240                /**
     1241                 * Filter the list of delimiters to be used before tags are balanced.
     1242                 *
     1243                 * @since 3.8.0
     1244                 *
     1245                 * @param array $delimiters An array of delimiters, e.g '<!--more.*?-->', '<!--nextpage-->'.
     1246                 */
    11731247                $balance_tags_delimiters = apply_filters( 'balance_tags_delimiters', array( '<!--more.*?-->', '<!--nextpage-->' ) );
    11741248                // Capture lets PREG_SPLIT_DELIM_CAPTURE return the delimiters
    11751249                $delimiters_regex = '/(' . implode( '|', $balance_tags_delimiters ) . ')/';
     
    13251399 * @return string The text after the filter (and possibly htmlspecialchars()) has been run.
    13261400 */
    13271401function format_to_edit( $content, $richedit = false ) {
     1402        /**
     1403         * Filter the text to be formatted for editing.
     1404         *
     1405         * @since 1.2.1
     1406         *
     1407         * @param string $content The text, prior to formatting for editing.
     1408         */
    13281409        $content = apply_filters( 'format_to_edit', $content );
    13291410        if ( ! $richedit )
    13301411                $content = esc_textarea( $content );
     
    13401421 * @return string Text returned from the 'format_to_post' filter.
    13411422 */
    13421423function format_to_post($content) {
    1343         $content = apply_filters('format_to_post', $content);
     1424        /**
     1425         * Filter the string returned by format_to_post().
     1426         *
     1427         * @since 1.2.1
     1428         *
     1429         * @param string $content The string to format.
     1430         */
     1431        $content = apply_filters( 'format_to_post', $content );
    13441432        return $content;
    13451433}
    13461434
     
    17761864        $img = $wpsmiliestrans[ $smiley ];
    17771865        $smiley_masked = esc_attr( $smiley );
    17781866
     1867        /**
     1868         * Filter the Smiley image URL before it's used in the image element.
     1869         *
     1870         * @since 2.9.0
     1871         *
     1872         * @param string $smiley_url URL for the smiley image.
     1873         * @param string $img        Filename for the smiley image.
     1874         * @param string $site_url   Site URL, as returned by site_url().
     1875         */     
    17791876        $src_url = apply_filters( 'smilies_src', includes_url( "images/smilies/$img" ), $img, site_url() );
    17801877
    17811878        return " <img src='$src_url' alt='$smiley_masked' class='wp-smiley' /> ";
     
    18491946
    18501947        // Test for the minimum length the email can be
    18511948        if ( strlen( $email ) < 3 ) {
     1949                /**
     1950                 * Filter whether an email address is valid.
     1951                 *
     1952                 * This filter is evaluated under several different contexts, such as 'email_too_short',
     1953                 * 'email_no_at', 'local_invalid_chars', 'domain_period_sequence', 'domain_period_limits',
     1954                 * 'domain_no_periods', 'sub_hyphen_limits', 'sub_invalid_chars', or no specific context.
     1955                 *
     1956                 * @since 2.8.0
     1957                 *
     1958                 * @param bool   $is_email Whether the email address has passed the is_email() checks. Default false.
     1959                 * @param string $email    The email address being checked.
     1960                 * @param string $message  An explanatory message to the user.
     1961                 * @param string $context  Context under which the email was tested.
     1962                 */
    18521963                return apply_filters( 'is_email', false, $email, 'email_too_short' );
    18531964        }
    18541965
    18551966        // Test for an @ character after the first position
    18561967        if ( strpos( $email, '@', 1 ) === false ) {
     1968                /** This filter is documented in wp-includes/formatting.php */
    18571969                return apply_filters( 'is_email', false, $email, 'email_no_at' );
    18581970        }
    18591971
     
    18631975        // LOCAL PART
    18641976        // Test for invalid characters
    18651977        if ( !preg_match( '/^[a-zA-Z0-9!#$%&\'*+\/=?^_`{|}~\.-]+$/', $local ) ) {
     1978                /** This filter is documented in wp-includes/formatting.php */
    18661979                return apply_filters( 'is_email', false, $email, 'local_invalid_chars' );
    18671980        }
    18681981
    18691982        // DOMAIN PART
    18701983        // Test for sequences of periods
    18711984        if ( preg_match( '/\.{2,}/', $domain ) ) {
     1985                /** This filter is documented in wp-includes/formatting.php */
    18721986                return apply_filters( 'is_email', false, $email, 'domain_period_sequence' );
    18731987        }
    18741988
    18751989        // Test for leading and trailing periods and whitespace
    18761990        if ( trim( $domain, " \t\n\r\0\x0B." ) !== $domain ) {
     1991                /** This filter is documented in wp-includes/formatting.php */
    18771992                return apply_filters( 'is_email', false, $email, 'domain_period_limits' );
    18781993        }
    18791994
     
    18821997
    18831998        // Assume the domain will have at least two subs
    18841999        if ( 2 > count( $subs ) ) {
     2000                /** This filter is documented in wp-includes/formatting.php */
    18852001                return apply_filters( 'is_email', false, $email, 'domain_no_periods' );
    18862002        }
    18872003
     
    18892005        foreach ( $subs as $sub ) {
    18902006                // Test for leading and trailing hyphens and whitespace
    18912007                if ( trim( $sub, " \t\n\r\0\x0B-" ) !== $sub ) {
     2008                        /** This filter is documented in wp-includes/formatting.php */
    18922009                        return apply_filters( 'is_email', false, $email, 'sub_hyphen_limits' );
    18932010                }
    18942011
    18952012                // Test for invalid characters
    18962013                if ( !preg_match('/^[a-z0-9-]+$/i', $sub ) ) {
     2014                        /** This filter is documented in wp-includes/formatting.php */
    18972015                        return apply_filters( 'is_email', false, $email, 'sub_invalid_chars' );
    18982016                }
    18992017        }
    19002018
    19012019        // Congratulations your email made it!
     2020        /** This filter is documented in wp-includes/formatting.php */
    19022021        return apply_filters( 'is_email', $email, $email, null );
    19032022}
    19042023
     
    20782197function sanitize_email( $email ) {
    20792198        // Test for the minimum length the email can be
    20802199        if ( strlen( $email ) < 3 ) {
     2200                /**
     2201                 * Filter a sanitized email address.
     2202                 *
     2203                 * This filter is evaluated under several contexts, including 'email_too_short',
     2204                 * 'email_no_at', 'local_invalid_chars', 'domain_period_sequence', 'domain_period_limits',
     2205                 * 'domain_no_periods', 'domain_no_valid_subs', or no context.
     2206                 *
     2207                 * @since 2.8.0
     2208                 *
     2209                 * @param string $email   The sanitized email address.
     2210                 * @param string $email   The email address, as provided to sanitize_email().
     2211                 * @param string $message A message to pass to the user.
     2212                 */
    20812213                return apply_filters( 'sanitize_email', '', $email, 'email_too_short' );
    20822214        }
    20832215
    20842216        // Test for an @ character after the first position
    20852217        if ( strpos( $email, '@', 1 ) === false ) {
     2218                /** This filter is documented in wp-includes/formatting.php */
    20862219                return apply_filters( 'sanitize_email', '', $email, 'email_no_at' );
    20872220        }
    20882221
     
    20932226        // Test for invalid characters
    20942227        $local = preg_replace( '/[^a-zA-Z0-9!#$%&\'*+\/=?^_`{|}~\.-]/', '', $local );
    20952228        if ( '' === $local ) {
     2229                /** This filter is documented in wp-includes/formatting.php */
    20962230                return apply_filters( 'sanitize_email', '', $email, 'local_invalid_chars' );
    20972231        }
    20982232
     
    21002234        // Test for sequences of periods
    21012235        $domain = preg_replace( '/\.{2,}/', '', $domain );
    21022236        if ( '' === $domain ) {
     2237                /** This filter is documented in wp-includes/formatting.php */
    21032238                return apply_filters( 'sanitize_email', '', $email, 'domain_period_sequence' );
    21042239        }
    21052240
    21062241        // Test for leading and trailing periods and whitespace
    21072242        $domain = trim( $domain, " \t\n\r\0\x0B." );
    21082243        if ( '' === $domain ) {
     2244                /** This filter is documented in wp-includes/formatting.php */
    21092245                return apply_filters( 'sanitize_email', '', $email, 'domain_period_limits' );
    21102246        }
    21112247
     
    21142250
    21152251        // Assume the domain will have at least two subs
    21162252        if ( 2 > count( $subs ) ) {
     2253                /** This filter is documented in wp-includes/formatting.php */
    21172254                return apply_filters( 'sanitize_email', '', $email, 'domain_no_periods' );
    21182255        }
    21192256
     
    21362273
    21372274        // If there aren't 2 or more valid subs
    21382275        if ( 2 > count( $new_subs ) ) {
     2276                /** This filter is documented in wp-includes/formatting.php */
    21392277                return apply_filters( 'sanitize_email', '', $email, 'domain_no_valid_subs' );
    21402278        }
    21412279
     
    21462284        $email = $local . '@' . $domain;
    21472285
    21482286        // Congratulations your email made it!
     2287        /** This filter is documented in wp-includes/formatting.php */
    21492288        return apply_filters( 'sanitize_email', $email, $email, null );
    21502289}
    21512290
     
    22252364
    22262365                $text = strip_shortcodes( $text );
    22272366
    2228                 $text = apply_filters('the_content', $text);
     2367                /** This filter is documented in wp-includes/post-template.php */
     2368                $text = apply_filters( 'the_content', $text );
    22292369                $text = str_replace(']]>', ']]&gt;', $text);
    2230                 $excerpt_length = apply_filters('excerpt_length', 55);
    2231                 $excerpt_more = apply_filters('excerpt_more', ' ' . '[&hellip;]');
     2370
     2371                /**
     2372                 * Filter the number of words in an excerpt.
     2373                 *
     2374                 * @since 2.7.0
     2375                 *
     2376                 * @param int $number The number of words. Default 55.
     2377                 */
     2378                $excerpt_length = apply_filters( 'excerpt_length', 55 );
     2379                /**
     2380                 * Filter the string in the "more" link displayed after a trimmed excerpt.
     2381                 *
     2382                 * @since 2.9.0
     2383                 *
     2384                 * @param string $more_string The string shown within the more link.
     2385                 */
     2386                $excerpt_more = apply_filters( 'excerpt_more', ' ' . '[&hellip;]' );
    22322387                $text = wp_trim_words( $text, $excerpt_length, $excerpt_more );
    22332388        }
    2234         return apply_filters('wp_trim_excerpt', $text, $raw_excerpt);
     2389        /**
     2390         * Filter the trimmed excerpt string.
     2391         *
     2392         * @since 2.8.0
     2393         *
     2394         * @param string $text        The trimmed text.
     2395         * @param string $raw_excerpt The text prior to trimming.
     2396         */
     2397        return apply_filters( 'wp_trim_excerpt', $text, $raw_excerpt );
    22352398}
    22362399
    22372400/**
     
    22712434        } else {
    22722435                $text = implode( $sep, $words_array );
    22732436        }
     2437        /**
     2438         * Filter the text content after words have been trimmed.
     2439         *
     2440         * @since 3.3.0
     2441         *
     2442         * @param string $text          The trimmed text.
     2443         * @param int    $num_words     The number of words to trim the text to. Default 5.
     2444         * @param string $more          An optional string to append to the end of the trimmed text, e.g. &hellip;.
     2445         * @param string $original_text The text before it was trimmed.
     2446         */
    22742447        return apply_filters( 'wp_trim_words', $text, $num_words, $more, $original_text );
    22752448}
    22762449
     
    22842457 */
    22852458function ent2ncr($text) {
    22862459
    2287         // Allow a plugin to short-circuit and override the mappings.
     2460        /**
     2461         * Filter text before named entities are converted into numbered entities.
     2462         *
     2463         * A non-null string must be returned for the filter to be evaluated.
     2464         *
     2465         * @since 3.3.0
     2466         *
     2467         * @param null   $converted_text The text to be converted. Default null.
     2468         * @param string $text           The text prior to entity conversion.
     2469         */
    22882470        $filtered = apply_filters( 'pre_ent2ncr', null, $text );
    22892471        if( null !== $filtered )
    22902472                return $filtered;
     
    25632745 * @return string The formatted text after filter is applied.
    25642746 */
    25652747function wp_richedit_pre($text) {
    2566         // Filtering a blank results in an annoying <br />\n
    2567         if ( empty($text) ) return apply_filters('richedit_pre', '');
     2748        if ( empty( $text ) ) {
     2749                /**
     2750                 * Filter text returned for the rich text editor.
     2751                 *
     2752                 * This filter is first evaluated, and the value returned, if an empty string
     2753                 * is passed to wp_richedit_pre(). If an empty string is passed, it results
     2754                 * in a break tag and line feed.
     2755                 *
     2756                 * If a non-empty string is passed, the filter is evaluated on the wp_richedit_pre()
     2757                 * return after being formatted.
     2758                 *
     2759                 * @since 2.0.0
     2760                 *
     2761                 * @param string $output Text for the rich text editor.
     2762                 */
     2763                return apply_filters( 'richedit_pre', '' );
     2764        }
    25682765
    25692766        $output = convert_chars($text);
    25702767        $output = wpautop($output);
    25712768        $output = htmlspecialchars($output, ENT_NOQUOTES, get_option( 'blog_charset' ) );
    25722769
    2573         return apply_filters('richedit_pre', $output);
     2770        /** This filter is documented in wp-includes/formatting.php */
     2771        return apply_filters( 'richedit_pre', $output );
    25742772}
    25752773
    25762774/**
     
    25882786        if ( !empty($output) )
    25892787                $output = htmlspecialchars($output, ENT_NOQUOTES, get_option( 'blog_charset' ) ); // convert only < > &
    25902788
    2591         return apply_filters('htmledit_pre', $output);
     2789        /**
     2790         * Filter the text before it is formatted for the HTML editor.
     2791         *
     2792         * @since 2.5.0
     2793         *
     2794         * @param string $output The HTML-formatted text.
     2795         */
     2796        return apply_filters( 'htmledit_pre', $output );
    25922797}
    25932798
    25942799/**
     
    26832888                        return '';
    26842889        }
    26852890
    2686         return apply_filters('clean_url', $good_protocol_url, $original_url, $_context);
     2891        /**
     2892         * Filter a string cleaned and escaped for output as a URL.
     2893         *
     2894         * @since 2.3.0
     2895         *
     2896         * @param string $good_protocol_url The cleaned URL to be returned.
     2897         * @param string $original_url      The URL prior to cleaning.
     2898         * @param string $_context          If 'display', replace ampersands and single quotes only.
     2899         */
     2900        return apply_filters( 'clean_url', $good_protocol_url, $original_url, $_context );
    26872901}
    26882902
    26892903/**
     
    27342948        $safe_text = preg_replace( '/&#(x)?0*(?(1)27|39);?/i', "'", stripslashes( $safe_text ) );
    27352949        $safe_text = str_replace( "\r", '', $safe_text );
    27362950        $safe_text = str_replace( "\n", '\\n', addslashes( $safe_text ) );
     2951        /**
     2952         * Filter a string cleaned and escaped for output in JavaScript.
     2953         *
     2954         * Text passed to esc_js() is stripped of invalid or special characters,
     2955         * and properly slashed for output.
     2956         *
     2957         * @since 2.0.11
     2958         *
     2959         * @param string $safe_text The text after it has been escaped.
     2960         * @param string $text      The text prior to being escaped.
     2961         */
    27372962        return apply_filters( 'js_escape', $safe_text, $text );
    27382963}
    27392964
     
    27482973function esc_html( $text ) {
    27492974        $safe_text = wp_check_invalid_utf8( $text );
    27502975        $safe_text = _wp_specialchars( $safe_text, ENT_QUOTES );
     2976        /**
     2977         * Filter a string cleaned and escaped for output in HTML.
     2978         *
     2979         * Text passed to esc_html() is stripped of invalid or special characters
     2980         * before output.
     2981         *
     2982         * @since 2.8.0
     2983         *
     2984         * @param string $safe_text The text after it has been escaped.
     2985         * @param string $text      The text prior to being escaped.
     2986         */
    27512987        return apply_filters( 'esc_html', $safe_text, $text );
    27522988}
    27532989
     
    27622998function esc_attr( $text ) {
    27632999        $safe_text = wp_check_invalid_utf8( $text );
    27643000        $safe_text = _wp_specialchars( $safe_text, ENT_QUOTES );
     3001        /**
     3002         * Filter a string cleaned and escaped for output in an HTML attribute.
     3003         *
     3004         * Text passed to esc_attr() is stripped of invalid or special characters
     3005         * before output.
     3006         *
     3007         * @since 2.0.11
     3008         *
     3009         * @param string $safe_text The text after it has been escaped.
     3010         * @param string $text      The text prior to being escaped.
     3011         */
    27653012        return apply_filters( 'attribute_escape', $safe_text, $text );
    27663013}
    27673014
     
    27753022 */
    27763023function esc_textarea( $text ) {
    27773024        $safe_text = htmlspecialchars( $text, ENT_QUOTES, get_option( 'blog_charset' ) );
     3025        /**
     3026         * Filter a string cleaned and escaped for output in a textarea element.
     3027         *
     3028         * @since 3.1.0
     3029         *
     3030         * @param string $safe_text The text after it has been escaped.
     3031         * @param string $text      The text prior to being escaped.
     3032         */
    27783033        return apply_filters( 'esc_textarea', $safe_text, $text );
    27793034}
    27803035
     
    27883043 */
    27893044function tag_escape($tag_name) {
    27903045        $safe_tag = strtolower( preg_replace('/[^a-zA-Z0-9_:]/', '', $tag_name) );
    2791         return apply_filters('tag_escape', $safe_tag, $tag_name);
     3046        /**
     3047         * Filter a string cleaned and escaped for output as an HTML tag.
     3048         *
     3049         * @since 2.8.0
     3050         *
     3051         * @param string $safe_tag The tag name after it has been escaped.
     3052         * @param string $tag_name The text before it was escaped.
     3053         */
     3054        return apply_filters( 'tag_escape', $safe_tag, $tag_name );
    27923055}
    27933056
    27943057/**
     
    29943257                        break;
    29953258        }
    29963259
    2997         $value = apply_filters("sanitize_option_{$option}", $value, $option);
     3260        /**
     3261         * Filter an option value following sanitization.
     3262         *
     3263         * @since 2.3.0
     3264         *
     3265         * @param string $value  The sanitized option value.
     3266         * @param string $option The option name.
     3267         */
     3268        $value = apply_filters( "sanitize_option_{$option}", $value, $option );
    29983269
    29993270        return $value;
    30003271}
     
    30063277 * {@link http://www.php.net/magic_quotes magic_quotes_gpc} is on.
    30073278 *
    30083279 * @since 2.2.1
    3009  * @uses apply_filters() for the 'wp_parse_str' filter.
    30103280 *
    30113281 * @param string $string The string to be parsed.
    30123282 * @param array $array Variables will be stored in this array.
     
    30153285        parse_str( $string, $array );
    30163286        if ( get_magic_quotes_gpc() )
    30173287                $array = stripslashes_deep( $array );
     3288        /**
     3289         * Filter the array of variables derived from a parsed string.
     3290         *
     3291         * @since 2.3.0
     3292         *
     3293         * @param array $array The array populated with variables.
     3294         */
    30183295        $array = apply_filters( 'wp_parse_str', $array );
    30193296}
    30203297
     
    30953372                                $arg = isset($args[$arg_index]) ? $args[$arg_index] : '';
    30963373                        }
    30973374
    3098                         // Apply filters OR sprintf
     3375                        /**
     3376                         * Filter a fragment from the pattern passed to wp_sprintf().
     3377                         *
     3378                         * If the fragment is unchanged, then sprintf() will be run on the fragment.
     3379                         *
     3380                         * @since 2.5.0
     3381                         *
     3382                         * @param string $fragment A fragment from the pattern.
     3383                         * @param string $arg      The argument.
     3384                         */
    30993385                        $_fragment = apply_filters( 'wp_sprintf', $fragment, $arg );
    31003386                        if ( $_fragment != $fragment )
    31013387                                $fragment = $_fragment;
     
    31323418        if ( empty($args) )
    31333419                return '';
    31343420
    3135         // Translate and filter the delimiter set (avoid ampersands and entities here)
    3136         $l = apply_filters('wp_sprintf_l', array(
     3421        /**
     3422         * Filter the translated delimiters used by wp_sprintf_l().
     3423         *
     3424         * Please note: Ampersands and entities should be avoided here.
     3425         *
     3426         * @since 2.5.0
     3427         *
     3428         * @param array $delimiters An array of translated delimiters.
     3429         */
     3430        $l = apply_filters( 'wp_sprintf_l', array(
    31373431                /* translators: used between list items, there is a space after the comma */
    31383432                'between'          => __(', '),
    31393433                /* translators: used between list items, there is a space after the and */
    31403434                'between_last_two' => __(', and '),
    31413435                /* translators: used between only two list items, there is a space after the and */
    31423436                'between_only_two' => __(' and '),
    3143                 ));
     3437        ) );
    31443438
    31453439        $args = (array) $args;
    31463440        $result = array_shift($args);
     
    33323626                $filtered = trim( preg_replace('/ +/', ' ', $filtered) );
    33333627        }
    33343628
    3335         return apply_filters('sanitize_text_field', $filtered, $str);
     3629        /**
     3630         * Filter a sanitized text field string.
     3631         *
     3632         * @since 2.9.0
     3633         *
     3634         * @param string $filtered The sanitized string.
     3635         * @param string $str      The string prior to being sanitized.
     3636         */
     3637        return apply_filters( 'sanitize_text_field', $filtered, $str );
    33363638}
    33373639
    33383640/**
     
    33813683 */
    33823684function sanitize_mime_type( $mime_type ) {
    33833685        $sani_mime_type = preg_replace( '/[^-+*.a-zA-Z0-9\/]/', '', $mime_type );
     3686        /**
     3687         * Filter a mime type following sanitization.
     3688         *
     3689         * @since 3.1.3
     3690         *
     3691         * @param string $sani_mime_type The sanitized mime type.
     3692         * @param string $mime_type      The mime type prior to sanitization.
     3693         */
    33843694        return apply_filters( 'sanitize_mime_type', $sani_mime_type, $mime_type );
    33853695}
    33863696
     
    34003710        }
    34013711        $urls_to_ping = array_map( 'esc_url_raw', $urls_to_ping );
    34023712        $urls_to_ping = implode( "\n", $urls_to_ping );
     3713        /**
     3714         * Filter a list of trackback URLs following sanitization.
     3715         *
     3716         * The string returned here consists of a space or carriage return-delimited list
     3717         * of trackback URLs.
     3718         *
     3719         * @since 3.4.0
     3720         *
     3721         * @param string $urls_to_ping Sanitized space or carriage return separated URLs.
     3722         * @param string $to_ping      Space or carriage return separated URLs before sanitization.
     3723         */
    34033724        return apply_filters( 'sanitize_trackback_urls', $urls_to_ping, $to_ping );
    34043725}
    34053726