Make WordPress Core

Ticket #40419: 40419.patch

File 40419.patch, 160.5 KB (added by sebastian.pisula, 8 years ago)
  • wp-includes/formatting.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    3535 * @staticvar bool  $run_texturize
    3636 *
    3737 * @param string $text The text to be formatted
    38  * @param bool   $reset Set to true for unit testing. Translated patterns will reset.
     38 * @param bool $reset Set to true for unit testing. Translated patterns will reset.
     39 *
    3940 * @return string The string replaced with html entities
    4041 */
    4142function wptexturize( $text, $reset = false ) {
    4243        global $wp_cockneyreplace, $shortcode_tags;
    4344        static $static_characters = null,
    44                 $static_replacements = null,
    45                 $dynamic_characters = null,
    46                 $dynamic_replacements = null,
    47                 $default_no_texturize_tags = null,
    48                 $default_no_texturize_shortcodes = null,
    49                 $run_texturize = true,
    50                 $apos = null,
    51                 $prime = null,
    52                 $double_prime = null,
    53                 $opening_quote = null,
    54                 $closing_quote = null,
    55                 $opening_single_quote = null,
    56                 $closing_single_quote = null,
    57                 $open_q_flag = '<!--oq-->',
    58                 $open_sq_flag = '<!--osq-->',
    59                 $apos_flag = '<!--apos-->';
     45        $static_replacements = null,
     46        $dynamic_characters = null,
     47        $dynamic_replacements = null,
     48        $default_no_texturize_tags = null,
     49        $default_no_texturize_shortcodes = null,
     50        $run_texturize = true,
     51        $apos = null,
     52        $prime = null,
     53        $double_prime = null,
     54        $opening_quote = null,
     55        $closing_quote = null,
     56        $opening_single_quote = null,
     57        $closing_single_quote = null,
     58        $open_q_flag = '<!--oq-->',
     59        $open_sq_flag = '<!--osq-->',
     60        $apos_flag = '<!--apos-->';
    6061
    6162        // If there's nothing to do, just stop.
    6263        if ( empty( $text ) || false === $run_texturize ) {
     
    107108                /* translators: em dash */
    108109                $em_dash = _x( '&#8212;', 'em dash' );
    109110
    110                 $default_no_texturize_tags = array('pre', 'code', 'kbd', 'style', 'script', 'tt');
    111                 $default_no_texturize_shortcodes = array('code');
     111                $default_no_texturize_tags       = array( 'pre', 'code', 'kbd', 'style', 'script', 'tt' );
     112                $default_no_texturize_shortcodes = array( 'code' );
    112113
    113114                // if a plugin has provided an autocorrect array, use it
    114                 if ( isset($wp_cockneyreplace) ) {
    115                         $cockney = array_keys( $wp_cockneyreplace );
     115                if ( isset( $wp_cockneyreplace ) ) {
     116                        $cockney        = array_keys( $wp_cockneyreplace );
    116117                        $cockneyreplace = array_values( $wp_cockneyreplace );
    117118                } else {
    118119                        /* translators: This is a comma-separated list of words that defy the syntax of quotations in normal use,
     
    126127                                'Comma-separated list of replacement words in your language' ) );
    127128                }
    128129
    129                 $static_characters = array_merge( array( '...', '``', '\'\'', ' (tm)' ), $cockney );
    130                 $static_replacements = array_merge( array( '&#8230;', $opening_quote, $closing_quote, ' &#8482;' ), $cockneyreplace );
     130                $static_characters   = array_merge( array( '...', '``', '\'\'', ' (tm)' ), $cockney );
     131                $static_replacements = array_merge( array(
     132                        '&#8230;',
     133                        $opening_quote,
     134                        $closing_quote,
     135                        ' &#8482;'
     136                ), $cockneyreplace );
    131137
    132138
    133139                // Pattern-based replacements of characters.
    134140                // Sort the remaining patterns into several arrays for performance tuning.
    135                 $dynamic_characters = array( 'apos' => array(), 'quote' => array(), 'dash' => array() );
     141                $dynamic_characters   = array( 'apos' => array(), 'quote' => array(), 'dash' => array() );
    136142                $dynamic_replacements = array( 'apos' => array(), 'quote' => array(), 'dash' => array() );
    137                 $dynamic = array();
    138                 $spaces = wp_spaces_regexp();
     143                $dynamic              = array();
     144                $spaces               = wp_spaces_regexp();
    139145
    140146                // '99' and '99" are ambiguous among other patterns; assume it's an abbreviated year at the end of a quotation.
    141147                if ( "'" !== $apos || "'" !== $closing_single_quote ) {
     
    147153
    148154                // '99 '99s '99's (apostrophe)  But never '9 or '99% or '999 or '99.0.
    149155                if ( "'" !== $apos ) {
    150                         $dynamic[ '/\'(?=\d\d(?:\Z|(?![%\d]|[.,]\d)))/' ] = $apos_flag;
     156                        $dynamic['/\'(?=\d\d(?:\Z|(?![%\d]|[.,]\d)))/'] = $apos_flag;
    151157                }
    152158
    153159                // Quoted Numbers like '0.42'
     
    165171                        $dynamic[ '/(?<!' . $spaces . ')\'(?!\Z|[.,:;!?"\'(){}[\]\-]|&[lg]t;|' . $spaces . ')/' ] = $apos_flag;
    166172                }
    167173
    168                 $dynamic_characters['apos'] = array_keys( $dynamic );
     174                $dynamic_characters['apos']   = array_keys( $dynamic );
    169175                $dynamic_replacements['apos'] = array_values( $dynamic );
    170                 $dynamic = array();
     176                $dynamic                      = array();
    171177
    172178                // Quoted Numbers like "42"
    173179                if ( '"' !== $opening_quote && '"' !== $closing_quote ) {
     
    179185                        $dynamic[ '/(?<=\A|[([{\-]|&lt;|' . $spaces . ')"(?!' . $spaces . ')/' ] = $open_q_flag;
    180186                }
    181187
    182                 $dynamic_characters['quote'] = array_keys( $dynamic );
     188                $dynamic_characters['quote']   = array_keys( $dynamic );
    183189                $dynamic_replacements['quote'] = array_values( $dynamic );
    184                 $dynamic = array();
     190                $dynamic                       = array();
    185191
    186192                // Dashes and spaces
    187                 $dynamic[ '/---/' ] = $em_dash;
     193                $dynamic['/---/']                                            = $em_dash;
    188194                $dynamic[ '/(?<=^|' . $spaces . ')--(?=$|' . $spaces . ')/' ] = $em_dash;
    189                 $dynamic[ '/(?<!xn)--/' ] = $en_dash;
    190                 $dynamic[ '/(?<=^|' . $spaces . ')-(?=$|' . $spaces . ')/' ] = $en_dash;
     195                $dynamic['/(?<!xn)--/']                                      = $en_dash;
     196                $dynamic[ '/(?<=^|' . $spaces . ')-(?=$|' . $spaces . ')/' ]  = $en_dash;
    191197
    192                 $dynamic_characters['dash'] = array_keys( $dynamic );
     198                $dynamic_characters['dash']   = array_keys( $dynamic );
    193199                $dynamic_replacements['dash'] = array_values( $dynamic );
    194200        }
    195201
     
    211217         */
    212218        $no_texturize_shortcodes = apply_filters( 'no_texturize_shortcodes', $default_no_texturize_shortcodes );
    213219
    214         $no_texturize_tags_stack = array();
     220        $no_texturize_tags_stack       = array();
    215221        $no_texturize_shortcodes_stack = array();
    216222
    217223        // Look for shortcodes and HTML elements.
    218224
    219225        preg_match_all( '@\[/?([^<>&/\[\]\x00-\x20=]++)@', $text, $matches );
    220         $tagnames = array_intersect( array_keys( $shortcode_tags ), $matches[1] );
     226        $tagnames         = array_intersect( array_keys( $shortcode_tags ), $matches[1] );
    221227        $found_shortcodes = ! empty( $tagnames );
    222         $shortcode_regex = $found_shortcodes ? _get_wptexturize_shortcode_regex( $tagnames ) : '';
    223         $regex = _get_wptexturize_split_regex( $shortcode_regex );
     228        $shortcode_regex  = $found_shortcodes ? _get_wptexturize_shortcode_regex( $tagnames ) : '';
     229        $regex            = _get_wptexturize_split_regex( $shortcode_regex );
    224230
    225         $textarr = preg_split( $regex, $text, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY );
     231        $textarr = preg_split( $regex, $text, - 1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY );
    226232
    227233        foreach ( $textarr as &$curl ) {
    228234                // Only call _wptexturize_pushpop_element if $curl is a delimiter.
     
    247253                } elseif ( '[' === $first && $found_shortcodes && 1 === preg_match( '/^' . $shortcode_regex . '$/', $curl ) ) {
    248254                        // This is a shortcode delimiter.
    249255
    250                         if ( '[[' !== substr( $curl, 0, 2 ) && ']]' !== substr( $curl, -2 ) ) {
     256                        if ( '[[' !== substr( $curl, 0, 2 ) && ']]' !== substr( $curl, - 2 ) ) {
    251257                                // Looks like a normal shortcode.
    252258                                _wptexturize_pushpop_element( $curl, $no_texturize_shortcodes_stack, $no_texturize_shortcodes );
    253259                        } else {
     
    295301 *
    296302 * @since 4.3.0
    297303 *
    298  * @param string $haystack    The plain text to be searched.
    299  * @param string $needle      The character to search for such as ' or ".
    300  * @param string $prime       The prime char to use for replacement.
    301  * @param string $open_quote  The opening quote char. Opening quote replacement must be
     304 * @param string $haystack The plain text to be searched.
     305 * @param string $needle The character to search for such as ' or ".
     306 * @param string $prime The prime char to use for replacement.
     307 * @param string $open_quote The opening quote char. Opening quote replacement must be
    302308 *                            accomplished already.
    303309 * @param string $close_quote The closing quote char to use for replacement.
     310 *
    304311 * @return string The $haystack value after primes and quotes replacements.
    305312 */
    306313function wptexturize_primes( $haystack, $needle, $prime, $open_quote, $close_quote ) {
    307         $spaces = wp_spaces_regexp();
    308         $flag = '<!--wp-prime-or-quote-->';
    309         $quote_pattern = "/$needle(?=\\Z|[.,:;!?)}\\-\\]]|&gt;|" . $spaces . ")/";
     314        $spaces           = wp_spaces_regexp();
     315        $flag             = '<!--wp-prime-or-quote-->';
     316        $quote_pattern    = "/$needle(?=\\Z|[.,:;!?)}\\-\\]]|&gt;|" . $spaces . ")/";
    310317        $prime_pattern    = "/(?<=\\d)$needle/";
    311318        $flag_after_digit = "/(?<=\\d)$flag/";
    312319        $flag_no_digit    = "/(?<!\\d)$flag/";
     
    317324                if ( false === strpos( $sentence, $needle ) ) {
    318325                        continue;
    319326                } elseif ( 0 !== $key && 0 === substr_count( $sentence, $close_quote ) ) {
    320                         $sentence = preg_replace( $quote_pattern, $flag, $sentence, -1, $count );
     327                        $sentence = preg_replace( $quote_pattern, $flag, $sentence, - 1, $count );
    321328                        if ( $count > 1 ) {
    322329                                // This sentence appears to have multiple closing quotes.  Attempt Vulcan logic.
    323                                 $sentence = preg_replace( $flag_no_digit, $close_quote, $sentence, -1, $count2 );
     330                                $sentence = preg_replace( $flag_no_digit, $close_quote, $sentence, - 1, $count2 );
    324331                                if ( 0 === $count2 ) {
    325332                                        // Try looking for a quote followed by a period.
    326333                                        $count2 = substr_count( $sentence, "$flag." );
     
    369376 * @access private
    370377 *
    371378 * @param string $text Text to check. Must be a tag like `<html>` or `[shortcode]`.
    372  * @param array  $stack List of open tag elements.
    373  * @param array  $disabled_elements The tag names to match against. Spaces are not allowed in tag names.
     379 * @param array $stack List of open tag elements.
     380 * @param array $disabled_elements The tag names to match against. Spaces are not allowed in tag names.
    374381 */
    375382function _wptexturize_pushpop_element( $text, &$stack, $disabled_elements ) {
    376383        // Is it an opening tag or closing tag?
     
    388395        // Parse out the tag name.
    389396        $space = strpos( $text, ' ' );
    390397        if ( false === $space ) {
    391                 $space = -1;
     398                $space = - 1;
    392399        } else {
    393400                $space -= $name_offset;
    394401        }
     
    422429 * @since 0.71
    423430 *
    424431 * @param string $pee The text which has to be formatted.
    425  * @param bool   $br Optional. If set, this will convert all remaining line-breaks
     432 * @param bool $br Optional. If set, this will convert all remaining line-breaks
    426433 *                    after paragraphing. Default true.
     434 *
    427435 * @return string Text which has been converted into correct paragraph tags.
    428436 */
    429437function wpautop( $pee, $br = true ) {
    430438        $pre_tags = array();
    431439
    432         if ( trim($pee) === '' )
     440        if ( trim( $pee ) === '' ) {
    433441                return '';
     442        }
    434443
    435444        // Just to make things a little easier, pad the end.
    436445        $pee = $pee . "\n";
     
    439448         * Pre tags shouldn't be touched by autop.
    440449         * Replace pre tags with placeholders and bring them back after autop.
    441450         */
    442         if ( strpos($pee, '<pre') !== false ) {
     451        if ( strpos( $pee, '<pre' ) !== false ) {
    443452                $pee_parts = explode( '</pre>', $pee );
    444                 $last_pee = array_pop($pee_parts);
    445                 $pee = '';
    446                 $i = 0;
     453                $last_pee  = array_pop( $pee_parts );
     454                $pee       = '';
     455                $i         = 0;
    447456
    448457                foreach ( $pee_parts as $pee_part ) {
    449                         $start = strpos($pee_part, '<pre');
     458                        $start = strpos( $pee_part, '<pre' );
    450459
    451460                        // Malformed html?
    452461                        if ( $start === false ) {
     
    454463                                continue;
    455464                        }
    456465
    457                         $name = "<pre wp-pre-tag-$i></pre>";
    458                         $pre_tags[$name] = substr( $pee_part, $start ) . '</pre>';
     466                        $name              = "<pre wp-pre-tag-$i></pre>";
     467                        $pre_tags[ $name ] = substr( $pee_part, $start ) . '</pre>';
    459468
    460469                        $pee .= substr( $pee_part, 0, $start ) . $name;
    461                         $i++;
     470                        $i ++;
    462471                }
    463472
    464473                $pee .= $last_pee;
    465474        }
    466475        // Change multiple <br>s into two line breaks, which will turn into paragraphs.
    467         $pee = preg_replace('|<br\s*/?>\s*<br\s*/?>|', "\n\n", $pee);
     476        $pee = preg_replace( '|<br\s*/?>\s*<br\s*/?>|', "\n\n", $pee );
    468477
    469478        $allblocks = '(?:table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|form|map|area|blockquote|address|math|style|p|h[1-6]|hr|fieldset|legend|section|article|aside|hgroup|header|footer|nav|figure|figcaption|details|menu|summary)';
    470479
    471480        // Add a double line break above block-level opening tags.
    472         $pee = preg_replace('!(<' . $allblocks . '[\s/>])!', "\n\n$1", $pee);
     481        $pee = preg_replace( '!(<' . $allblocks . '[\s/>])!', "\n\n$1", $pee );
    473482
    474483        // Add a double line break below block-level closing tags.
    475         $pee = preg_replace('!(</' . $allblocks . '>)!', "$1\n\n", $pee);
     484        $pee = preg_replace( '!(</' . $allblocks . '>)!', "$1\n\n", $pee );
    476485
    477486        // Standardize newline characters to "\n".
    478         $pee = str_replace(array("\r\n", "\r"), "\n", $pee);
     487        $pee = str_replace( array( "\r\n", "\r" ), "\n", $pee );
    479488
    480489        // Find newlines in all elements and add placeholders.
    481490        $pee = wp_replace_in_html_tags( $pee, array( "\n" => " <!-- wpnl --> " ) );
     
    513522        }
    514523
    515524        // Remove more than two contiguous line breaks.
    516         $pee = preg_replace("/\n\n+/", "\n\n", $pee);
     525        $pee = preg_replace( "/\n\n+/", "\n\n", $pee );
    517526
    518527        // Split up the contents into an array of strings, separated by double line breaks.
    519         $pees = preg_split('/\n\s*\n/', $pee, -1, PREG_SPLIT_NO_EMPTY);
     528        $pees = preg_split( '/\n\s*\n/', $pee, - 1, PREG_SPLIT_NO_EMPTY );
    520529
    521530        // Reset $pee prior to rebuilding.
    522531        $pee = '';
    523532
    524533        // Rebuild the content as a string, wrapping every bit with a <p>.
    525534        foreach ( $pees as $tinkle ) {
    526                 $pee .= '<p>' . trim($tinkle, "\n") . "</p>\n";
     535                $pee .= '<p>' . trim( $tinkle, "\n" ) . "</p>\n";
    527536        }
    528537
    529538        // Under certain strange conditions it could create a P of entirely whitespace.
    530         $pee = preg_replace('|<p>\s*</p>|', '', $pee);
     539        $pee = preg_replace( '|<p>\s*</p>|', '', $pee );
    531540
    532541        // Add a closing <p> inside <div>, <address>, or <form> tag if missing.
    533         $pee = preg_replace('!<p>([^<]+)</(div|address|form)>!', "<p>$1</p></$2>", $pee);
     542        $pee = preg_replace( '!<p>([^<]+)</(div|address|form)>!', "<p>$1</p></$2>", $pee );
    534543
    535544        // If an opening or closing block element tag is wrapped in a <p>, unwrap it.
    536         $pee = preg_replace('!<p>\s*(</?' . $allblocks . '[^>]*>)\s*</p>!', "$1", $pee);
     545        $pee = preg_replace( '!<p>\s*(</?' . $allblocks . '[^>]*>)\s*</p>!', "$1", $pee );
    537546
    538547        // In some cases <li> may get wrapped in <p>, fix them.
    539         $pee = preg_replace("|<p>(<li.+?)</p>|", "$1", $pee);
     548        $pee = preg_replace( "|<p>(<li.+?)</p>|", "$1", $pee );
    540549
    541550        // If a <blockquote> is wrapped with a <p>, move it inside the <blockquote>.
    542         $pee = preg_replace('|<p><blockquote([^>]*)>|i', "<blockquote$1><p>", $pee);
    543         $pee = str_replace('</blockquote></p>', '</p></blockquote>', $pee);
     551        $pee = preg_replace( '|<p><blockquote([^>]*)>|i', "<blockquote$1><p>", $pee );
     552        $pee = str_replace( '</blockquote></p>', '</p></blockquote>', $pee );
    544553
    545554        // If an opening or closing block element tag is preceded by an opening <p> tag, remove it.
    546         $pee = preg_replace('!<p>\s*(</?' . $allblocks . '[^>]*>)!', "$1", $pee);
     555        $pee = preg_replace( '!<p>\s*(</?' . $allblocks . '[^>]*>)!', "$1", $pee );
    547556
    548557        // If an opening or closing block element tag is followed by a closing <p> tag, remove it.
    549         $pee = preg_replace('!(</?' . $allblocks . '[^>]*>)\s*</p>!', "$1", $pee);
     558        $pee = preg_replace( '!(</?' . $allblocks . '[^>]*>)\s*</p>!', "$1", $pee );
    550559
    551560        // Optionally insert line breaks.
    552561        if ( $br ) {
    553562                // Replace newlines that shouldn't be touched with a placeholder.
    554                 $pee = preg_replace_callback('/<(script|style).*?<\/\\1>/s', '_autop_newline_preservation_helper', $pee);
     563                $pee = preg_replace_callback( '/<(script|style).*?<\/\\1>/s', '_autop_newline_preservation_helper', $pee );
    555564
    556565                // Normalize <br>
    557566                $pee = str_replace( array( '<br>', '<br/>' ), '<br />', $pee );
    558567
    559568                // Replace any new line characters that aren't preceded by a <br /> with a <br />.
    560                 $pee = preg_replace('|(?<!<br />)\s*\n|', "<br />\n", $pee);
     569                $pee = preg_replace( '|(?<!<br />)\s*\n|', "<br />\n", $pee );
    561570
    562571                // Replace newline placeholders with newlines.
    563                 $pee = str_replace('<WPPreserveNewline />', "\n", $pee);
     572                $pee = str_replace( '<WPPreserveNewline />', "\n", $pee );
    564573        }
    565574
    566575        // If a <br /> tag is after an opening or closing block tag, remove it.
    567         $pee = preg_replace('!(</?' . $allblocks . '[^>]*>)\s*<br />!', "$1", $pee);
     576        $pee = preg_replace( '!(</?' . $allblocks . '[^>]*>)\s*<br />!', "$1", $pee );
    568577
    569578        // If a <br /> tag is before a subset of opening or closing block tags, remove it.
    570         $pee = preg_replace('!<br />(\s*</?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)[^>]*>)!', '$1', $pee);
     579        $pee = preg_replace( '!<br />(\s*</?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)[^>]*>)!', '$1', $pee );
    571580        $pee = preg_replace( "|\n</p>$|", '</p>', $pee );
    572581
    573582        // Replace placeholder <pre> tags with their original content.
    574         if ( !empty($pre_tags) )
    575                 $pee = str_replace(array_keys($pre_tags), array_values($pre_tags), $pee);
     583        if ( ! empty( $pre_tags ) ) {
     584                $pee = str_replace( array_keys( $pre_tags ), array_values( $pre_tags ), $pee );
     585        }
    576586
    577587        // Restore newlines in all elements.
    578588        if ( false !== strpos( $pee, '<!-- wpnl -->' ) ) {
     
    588598 * @since 4.2.4
    589599 *
    590600 * @param string $input The text which has to be formatted.
     601 *
    591602 * @return array The formatted text.
    592603 */
    593604function wp_html_split( $input ) {
    594         return preg_split( get_html_split_regex(), $input, -1, PREG_SPLIT_DELIM_CAPTURE );
     605        return preg_split( get_html_split_regex(), $input, - 1, PREG_SPLIT_DELIM_CAPTURE );
    595606}
    596607
    597608/**
     
    606617
    607618        if ( ! isset( $regex ) ) {
    608619                $comments =
    609                           '!'           // Start of comment, after the <.
     620                        '!'           // Start of comment, after the <.
    610621                        . '(?:'         // Unroll the loop: Consume everything until --> is found.
    611                         .     '-(?!->)' // Dash not followed by end of comment.
    612                         .     '[^\-]*+' // Consume non-dashes.
     622                        . '-(?!->)' // Dash not followed by end of comment.
     623                        . '[^\-]*+' // Consume non-dashes.
    613624                        . ')*+'         // Loop possessively.
    614625                        . '(?:-->)?';   // End of comment. If not found, match all input.
    615626
    616627                $cdata =
    617                           '!\[CDATA\['  // Start of comment, after the <.
     628                        '!\[CDATA\['  // Start of comment, after the <.
    618629                        . '[^\]]*+'     // Consume non-].
    619630                        . '(?:'         // Unroll the loop: Consume everything until ]]> is found.
    620                         .     '](?!]>)' // One ] not followed by end of comment.
    621                         .     '[^\]]*+' // Consume non-].
     631                        . '](?!]>)' // One ] not followed by end of comment.
     632                        . '[^\]]*+' // Consume non-].
    622633                        . ')*+'         // Loop possessively.
    623634                        . '(?:]]>)?';   // End of comment. If not found, match all input.
    624635
    625636                $escaped =
    626                           '(?='           // Is the element escaped?
    627                         .    '!--'
     637                        '(?='           // Is the element escaped?
     638                        . '!--'
    628639                        . '|'
    629                         .    '!\[CDATA\['
     640                        . '!\[CDATA\['
    630641                        . ')'
    631642                        . '(?(?=!-)'      // If yes, which type?
    632                         .     $comments
     643                        . $comments
    633644                        . '|'
    634                         .     $cdata
     645                        . $cdata
    635646                        . ')';
    636647
    637648                $regex =
    638                           '/('              // Capture the entire match.
    639                         .     '<'           // Find start of element.
    640                         .     '(?'          // Conditional expression follows.
    641                         .         $escaped  // Find end of escaped element.
    642                         .     '|'           // ... else ...
    643                         .         '[^>]*>?' // Find end of normal element.
    644                         .     ')'
     649                        '/('              // Capture the entire match.
     650                        . '<'           // Find start of element.
     651                        . '(?'          // Conditional expression follows.
     652                        . $escaped  // Find end of escaped element.
     653                        . '|'           // ... else ...
     654                        . '[^>]*>?' // Find end of normal element.
     655                        . ')'
    645656                        . ')/';
    646657        }
    647658
     
    657668 * @since 4.4.0
    658669 *
    659670 * @param string $shortcode_regex The result from _get_wptexturize_shortcode_regex().  Optional.
     671 *
    660672 * @return string The regular expression
    661673 */
    662674function _get_wptexturize_split_regex( $shortcode_regex = '' ) {
     
    664676
    665677        if ( ! isset( $html_regex ) ) {
    666678                $comment_regex =
    667                           '!'           // Start of comment, after the <.
     679                        '!'           // Start of comment, after the <.
    668680                        . '(?:'         // Unroll the loop: Consume everything until --> is found.
    669                         .     '-(?!->)' // Dash not followed by end of comment.
    670                         .     '[^\-]*+' // Consume non-dashes.
     681                        . '-(?!->)' // Dash not followed by end of comment.
     682                        . '[^\-]*+' // Consume non-dashes.
    671683                        . ')*+'         // Loop possessively.
    672684                        . '(?:-->)?';   // End of comment. If not found, match all input.
    673685
    674                 $html_regex =                    // Needs replaced with wp_html_split() per Shortcode API Roadmap.
    675                           '<'                // Find start of element.
     686                $html_regex =            // Needs replaced with wp_html_split() per Shortcode API Roadmap.
     687                        '<'                // Find start of element.
    676688                        . '(?(?=!--)'        // Is this a comment?
    677                         .     $comment_regex // Find end of comment.
     689                        . $comment_regex // Find end of comment.
    678690                        . '|'
    679                         .     '[^>]*>?'      // Find end of element. If not found, match all input.
     691                        . '[^>]*>?'      // Find end of element. If not found, match all input.
    680692                        . ')';
    681693        }
    682694
     
    698710 * @since 4.4.0
    699711 *
    700712 * @param array $tagnames List of shortcodes to find.
     713 *
    701714 * @return string The regular expression
    702715 */
    703716function _get_wptexturize_shortcode_regex( $tagnames ) {
    704717        $tagregexp = join( '|', array_map( 'preg_quote', $tagnames ) );
    705718        $tagregexp = "(?:$tagregexp)(?=[\\s\\]\\/])"; // Excerpt of get_shortcode_regex().
    706         $regex =
    707                   '\['              // Find start of shortcode.
     719        $regex     =
     720                '\['              // Find start of shortcode.
    708721                . '[\/\[]?'         // Shortcodes may begin with [/ or [[
    709722                . $tagregexp        // Only match registered shortcodes, because performance.
    710723                . '(?:'
    711                 .     '[^\[\]<>]+'  // Shortcodes do not contain other shortcodes. Quantifier critical.
     724                . '[^\[\]<>]+'  // Shortcodes do not contain other shortcodes. Quantifier critical.
    712725                . '|'
    713                 .     '<[^\[\]>]*>' // HTML elements permitted. Prevents matching ] before >.
     726                . '<[^\[\]>]*>' // HTML elements permitted. Prevents matching ] before >.
    714727                . ')*+'             // Possessive critical.
    715728                . '\]'              // Find end of shortcode.
    716729                . '\]?';            // Shortcodes may end with ]]
     
    725738 *
    726739 * @param string $haystack The text which has to be formatted.
    727740 * @param array $replace_pairs In the form array('from' => 'to', ...).
     741 *
    728742 * @return string The formatted text.
    729743 */
    730744function wp_replace_in_html_tags( $haystack, $replace_pairs ) {
     
    735749        // Optimize when searching for one item.
    736750        if ( 1 === count( $replace_pairs ) ) {
    737751                // Extract $needle and $replace.
    738                 foreach ( $replace_pairs as $needle => $replace );
     752                foreach ( $replace_pairs as $needle => $replace ) {
     753                        ;
     754                }
    739755
    740756                // Loop through delimiters (elements) only.
    741757                for ( $i = 1, $c = count( $textarr ); $i < $c; $i += 2 ) {
    742                         if ( false !== strpos( $textarr[$i], $needle ) ) {
    743                                 $textarr[$i] = str_replace( $needle, $replace, $textarr[$i] );
    744                                 $changed = true;
     758                        if ( false !== strpos( $textarr[ $i ], $needle ) ) {
     759                                $textarr[ $i ] = str_replace( $needle, $replace, $textarr[ $i ] );
     760                                $changed       = true;
    745761                        }
    746762                }
    747763        } else {
     
    751767                // Loop through delimiters (elements) only.
    752768                for ( $i = 1, $c = count( $textarr ); $i < $c; $i += 2 ) {
    753769                        foreach ( $needles as $needle ) {
    754                                 if ( false !== strpos( $textarr[$i], $needle ) ) {
    755                                         $textarr[$i] = strtr( $textarr[$i], $replace_pairs );
    756                                         $changed = true;
     770                                if ( false !== strpos( $textarr[ $i ], $needle ) ) {
     771                                        $textarr[ $i ] = strtr( $textarr[ $i ], $replace_pairs );
     772                                        $changed       = true;
    757773                                        // After one strtr() break out of the foreach loop and look at next element.
    758774                                        break;
    759775                                }
     
    775791 * @access private
    776792 *
    777793 * @param array $matches preg_replace_callback matches array
     794 *
    778795 * @return string
    779796 */
    780797function _autop_newline_preservation_helper( $matches ) {
     
    791808 * @global array $shortcode_tags
    792809 *
    793810 * @param string $pee The content.
     811 *
    794812 * @return string The filtered content.
    795813 */
    796814function shortcode_unautop( $pee ) {
    797815        global $shortcode_tags;
    798816
    799         if ( empty( $shortcode_tags ) || !is_array( $shortcode_tags ) ) {
     817        if ( empty( $shortcode_tags ) || ! is_array( $shortcode_tags ) ) {
    800818                return $pee;
    801819        }
    802820
    803821        $tagregexp = join( '|', array_map( 'preg_quote', array_keys( $shortcode_tags ) ) );
    804         $spaces = wp_spaces_regexp();
     822        $spaces    = wp_spaces_regexp();
    805823
    806824        $pattern =
    807                   '/'
     825                '/'
    808826                . '<p>'                              // Opening paragraph
    809827                . '(?:' . $spaces . ')*+'            // Optional leading whitespace
    810828                . '('                                // 1: The shortcode
    811                 .     '\\['                          // Opening bracket
    812                 .     "($tagregexp)"                 // 2: Shortcode name
    813                 .     '(?![\\w-])'                   // Not followed by word character or hyphen
    814                                                      // Unroll the loop: Inside the opening shortcode tag
    815                 .     '[^\\]\\/]*'                   // Not a closing bracket or forward slash
    816                 .     '(?:'
    817                 .         '\\/(?!\\])'               // A forward slash not followed by a closing bracket
    818                 .         '[^\\]\\/]*'               // Not a closing bracket or forward slash
    819                 .     ')*?'
    820                 .     '(?:'
    821                 .         '\\/\\]'                   // Self closing tag and closing bracket
    822                 .     '|'
    823                 .         '\\]'                      // Closing bracket
    824                 .         '(?:'                      // Unroll the loop: Optionally, anything between the opening and closing shortcode tags
    825                 .             '[^\\[]*+'             // Not an opening bracket
    826                 .             '(?:'
    827                 .                 '\\[(?!\\/\\2\\])' // An opening bracket not followed by the closing shortcode tag
    828                 .                 '[^\\[]*+'         // Not an opening bracket
    829                 .             ')*+'
    830                 .             '\\[\\/\\2\\]'         // Closing shortcode tag
    831                 .         ')?'
    832                 .     ')'
     829                . '\\['                          // Opening bracket
     830                . "($tagregexp)"                 // 2: Shortcode name
     831                . '(?![\\w-])'                   // Not followed by word character or hyphen
     832                // Unroll the loop: Inside the opening shortcode tag
     833                . '[^\\]\\/]*'                   // Not a closing bracket or forward slash
     834                . '(?:'
     835                . '\\/(?!\\])'               // A forward slash not followed by a closing bracket
     836                . '[^\\]\\/]*'               // Not a closing bracket or forward slash
     837                . ')*?'
     838                . '(?:'
     839                . '\\/\\]'                   // Self closing tag and closing bracket
     840                . '|'
     841                . '\\]'                      // Closing bracket
     842                . '(?:'                      // Unroll the loop: Optionally, anything between the opening and closing shortcode tags
     843                . '[^\\[]*+'             // Not an opening bracket
     844                . '(?:'
     845                . '\\[(?!\\/\\2\\])' // An opening bracket not followed by the closing shortcode tag
     846                . '[^\\[]*+'         // Not an opening bracket
     847                . ')*+'
     848                . '\\[\\/\\2\\]'         // Closing shortcode tag
     849                . ')?'
     850                . ')'
    833851                . ')'
    834852                . '(?:' . $spaces . ')*+'            // optional trailing whitespace
    835853                . '<\\/p>'                           // closing paragraph
     
    848866 * @since 1.2.1
    849867 *
    850868 * @param string $str The string to be checked
     869 *
    851870 * @return bool True if $str fits a UTF-8 model, false otherwise.
    852871 */
    853872function seems_utf8( $str ) {
    854873        mbstring_binary_safe_encoding();
    855         $length = strlen($str);
     874        $length = strlen( $str );
    856875        reset_mbstring_encoding();
    857         for ($i=0; $i < $length; $i++) {
    858                 $c = ord($str[$i]);
    859                 if ($c < 0x80) $n = 0; // 0bbbbbbb
    860                 elseif (($c & 0xE0) == 0xC0) $n=1; // 110bbbbb
    861                 elseif (($c & 0xF0) == 0xE0) $n=2; // 1110bbbb
    862                 elseif (($c & 0xF8) == 0xF0) $n=3; // 11110bbb
    863                 elseif (($c & 0xFC) == 0xF8) $n=4; // 111110bb
    864                 elseif (($c & 0xFE) == 0xFC) $n=5; // 1111110b
    865                 else return false; // Does not match any model
    866                 for ($j=0; $j<$n; $j++) { // n bytes matching 10bbbbbb follow ?
    867                         if ((++$i == $length) || ((ord($str[$i]) & 0xC0) != 0x80))
     876        for ( $i = 0; $i < $length; $i ++ ) {
     877                $c = ord( $str[ $i ] );
     878                if ( $c < 0x80 ) {
     879                        $n = 0;
     880                } // 0bbbbbbb
     881        elseif ( ( $c & 0xE0 ) == 0xC0 ) {
     882                        $n = 1;
     883                } // 110bbbbb
     884        elseif ( ( $c & 0xF0 ) == 0xE0 ) {
     885                        $n = 2;
     886                } // 1110bbbb
     887        elseif ( ( $c & 0xF8 ) == 0xF0 ) {
     888                        $n = 3;
     889                } // 11110bbb
     890        elseif ( ( $c & 0xFC ) == 0xF8 ) {
     891                        $n = 4;
     892                } // 111110bb
     893        elseif ( ( $c & 0xFE ) == 0xFC ) {
     894                        $n = 5;
     895                } // 1111110b
     896                else {
     897                        return false;
     898                } // Does not match any model
     899                for ( $j = 0; $j < $n; $j ++ ) { // n bytes matching 10bbbbbb follow ?
     900                        if ( ( ++ $i == $length ) || ( ( ord( $str[ $i ] ) & 0xC0 ) != 0x80 ) ) {
    868901                                return false;
     902                        }
    869903                }
    870904        }
     905
    871906        return true;
    872907}
    873908
     
    884919 *
    885920 * @staticvar string $_charset
    886921 *
    887  * @param string     $string        The text which is to be encoded.
    888  * @param int|string $quote_style    Optional. Converts double quotes if set to ENT_COMPAT,
     922 * @param string $string The text which is to be encoded.
     923 * @param int|string $quote_style Optional. Converts double quotes if set to ENT_COMPAT,
    889924 *                                   both single and double if set to ENT_QUOTES or none if set to ENT_NOQUOTES.
    890925 *                                   Also compatible with old values; converting single quotes if set to 'single',
    891926 *                                   double if set to 'double' or both if otherwise set.
    892927 *                                   Default is ENT_NOQUOTES.
    893  * @param string     $charset        Optional. The character encoding of the string. Default is false.
    894  * @param bool       $double_encode  Optional. Whether to encode existing html entities. Default is false.
     928 * @param string $charset Optional. The character encoding of the string. Default is false.
     929 * @param bool $double_encode Optional. Whether to encode existing html entities. Default is false.
     930 *
    895931 * @return string The encoded text with HTML entities.
    896932 */
    897933function _wp_specialchars( $string, $quote_style = ENT_NOQUOTES, $charset = false, $double_encode = false ) {
    898934        $string = (string) $string;
    899935
    900         if ( 0 === strlen( $string ) )
     936        if ( 0 === strlen( $string ) ) {
    901937                return '';
     938        }
    902939
    903940        // Don't bother if there are no specialchars - saves some processing
    904         if ( ! preg_match( '/[&<>"\']/', $string ) )
     941        if ( ! preg_match( '/[&<>"\']/', $string ) ) {
    905942                return $string;
     943        }
    906944
    907945        // Account for the previous behaviour of the function when the $quote_style is not an accepted value
    908         if ( empty( $quote_style ) )
     946        if ( empty( $quote_style ) ) {
    909947                $quote_style = ENT_NOQUOTES;
    910         elseif ( ! in_array( $quote_style, array( 0, 2, 3, 'single', 'double' ), true ) )
     948        } elseif ( ! in_array( $quote_style, array( 0, 2, 3, 'single', 'double' ), true ) ) {
    911949                $quote_style = ENT_QUOTES;
     950        }
    912951
    913952        // Store the site charset as a static to avoid multiple calls to wp_load_alloptions()
    914953        if ( ! $charset ) {
    915954                static $_charset = null;
    916955                if ( ! isset( $_charset ) ) {
    917956                        $alloptions = wp_load_alloptions();
    918                         $_charset = isset( $alloptions['blog_charset'] ) ? $alloptions['blog_charset'] : '';
     957                        $_charset   = isset( $alloptions['blog_charset'] ) ? $alloptions['blog_charset'] : '';
    919958                }
    920959                $charset = $_charset;
    921960        }
    922961
    923         if ( in_array( $charset, array( 'utf8', 'utf-8', 'UTF8' ) ) )
     962        if ( in_array( $charset, array( 'utf8', 'utf-8', 'UTF8' ) ) ) {
    924963                $charset = 'UTF-8';
     964        }
    925965
    926966        $_quote_style = $quote_style;
    927967
    928968        if ( $quote_style === 'double' ) {
    929                 $quote_style = ENT_COMPAT;
     969                $quote_style  = ENT_COMPAT;
    930970                $_quote_style = ENT_COMPAT;
    931971        } elseif ( $quote_style === 'single' ) {
    932972                $quote_style = ENT_NOQUOTES;
     
    941981        $string = @htmlspecialchars( $string, $quote_style, $charset, $double_encode );
    942982
    943983        // Back-compat.
    944         if ( 'single' === $_quote_style )
     984        if ( 'single' === $_quote_style ) {
    945985                $string = str_replace( "'", '&#039;', $string );
     986        }
    946987
    947988        return $string;
    948989}
     
    957998 *
    958999 * @since 2.8.0
    9591000 *
    960  * @param string     $string The text which is to be decoded.
     1001 * @param string $string The text which is to be decoded.
    9611002 * @param string|int $quote_style Optional. Converts double quotes if set to ENT_COMPAT,
    9621003 *                                both single and double if set to ENT_QUOTES or
    9631004 *                                none if set to ENT_NOQUOTES.
     
    9651006 *                                converting single quotes if set to 'single',
    9661007 *                                double if set to 'double' or both if otherwise set.
    9671008 *                                Default is ENT_NOQUOTES.
     1009 *
    9681010 * @return string The decoded text without HTML entities.
    9691011 */
    9701012function wp_specialchars_decode( $string, $quote_style = ENT_NOQUOTES ) {
     
    9821024        // Match the previous behaviour of _wp_specialchars() when the $quote_style is not an accepted value
    9831025        if ( empty( $quote_style ) ) {
    9841026                $quote_style = ENT_NOQUOTES;
    985         } elseif ( !in_array( $quote_style, array( 0, 2, 3, 'single', 'double' ), true ) ) {
     1027        } elseif ( ! in_array( $quote_style, array( 0, 2, 3, 'single', 'double' ), true ) ) {
    9861028                $quote_style = ENT_QUOTES;
    9871029        }
    9881030
    9891031        // More complete than get_html_translation_table( HTML_SPECIALCHARS )
    990         $single = array( '&#039;'  => '\'', '&#x27;' => '\'' );
    991         $single_preg = array( '/&#0*39;/'  => '&#039;', '/&#x0*27;/i' => '&#x27;' );
    992         $double = array( '&quot;' => '"', '&#034;'  => '"', '&#x22;' => '"' );
    993         $double_preg = array( '/&#0*34;/'  => '&#034;', '/&#x0*22;/i' => '&#x22;' );
    994         $others = array( '&lt;'   => '<', '&#060;'  => '<', '&gt;'   => '>', '&#062;'  => '>', '&amp;'  => '&', '&#038;'  => '&', '&#x26;' => '&' );
    995         $others_preg = array( '/&#0*60;/'  => '&#060;', '/&#0*62;/'  => '&#062;', '/&#0*38;/'  => '&#038;', '/&#x0*26;/i' => '&#x26;' );
     1032        $single      = array( '&#039;' => '\'', '&#x27;' => '\'' );
     1033        $single_preg = array( '/&#0*39;/' => '&#039;', '/&#x0*27;/i' => '&#x27;' );
     1034        $double      = array( '&quot;' => '"', '&#034;' => '"', '&#x22;' => '"' );
     1035        $double_preg = array( '/&#0*34;/' => '&#034;', '/&#x0*22;/i' => '&#x22;' );
     1036        $others      = array(
     1037                '&lt;'   => '<',
     1038                '&#060;' => '<',
     1039                '&gt;'   => '>',
     1040                '&#062;' => '>',
     1041                '&amp;'  => '&',
     1042                '&#038;' => '&',
     1043                '&#x26;' => '&'
     1044        );
     1045        $others_preg = array(
     1046                '/&#0*60;/'   => '&#060;',
     1047                '/&#0*62;/'   => '&#062;',
     1048                '/&#0*38;/'   => '&#038;',
     1049                '/&#x0*26;/i' => '&#x26;'
     1050        );
    9961051
    9971052        if ( $quote_style === ENT_QUOTES ) {
    998                 $translation = array_merge( $single, $double, $others );
     1053                $translation      = array_merge( $single, $double, $others );
    9991054                $translation_preg = array_merge( $single_preg, $double_preg, $others_preg );
    10001055        } elseif ( $quote_style === ENT_COMPAT || $quote_style === 'double' ) {
    1001                 $translation = array_merge( $double, $others );
     1056                $translation      = array_merge( $double, $others );
    10021057                $translation_preg = array_merge( $double_preg, $others_preg );
    10031058        } elseif ( $quote_style === 'single' ) {
    1004                 $translation = array_merge( $single, $others );
     1059                $translation      = array_merge( $single, $others );
    10051060                $translation_preg = array_merge( $single_preg, $others_preg );
    10061061        } elseif ( $quote_style === ENT_NOQUOTES ) {
    1007                 $translation = $others;
     1062                $translation      = $others;
    10081063                $translation_preg = $others_preg;
    10091064        }
    10101065
     
    10231078 * @staticvar bool $is_utf8
    10241079 * @staticvar bool $utf8_pcre
    10251080 *
    1026  * @param string  $string The text which is to be checked.
    1027  * @param bool    $strip Optional. Whether to attempt to strip out invalid UTF8. Default is false.
     1081 * @param string $string The text which is to be checked.
     1082 * @param bool $strip Optional. Whether to attempt to strip out invalid UTF8. Default is false.
     1083 *
    10281084 * @return string The checked text.
    10291085 */
    10301086function wp_check_invalid_utf8( $string, $strip = false ) {
     
    10491105                $utf8_pcre = @preg_match( '/^./u', 'a' );
    10501106        }
    10511107        // We can't demand utf8 in the PCRE installation, so just return the string in those cases
    1052         if ( !$utf8_pcre ) {
     1108        if ( ! $utf8_pcre ) {
    10531109                return $string;
    10541110        }
    10551111
     
    10721128 * @since 1.5.0
    10731129 *
    10741130 * @param string $utf8_string
    1075  * @param int    $length Max  length of the string
     1131 * @param int $length Max  length of the string
     1132 *
    10761133 * @return string String with Unicode encoded for URI.
    10771134 */
    10781135function utf8_uri_encode( $utf8_string, $length = 0 ) {
    1079         $unicode = '';
    1080         $values = array();
    1081         $num_octets = 1;
     1136        $unicode        = '';
     1137        $values         = array();
     1138        $num_octets     = 1;
    10821139        $unicode_length = 0;
    10831140
    10841141        mbstring_binary_safe_encoding();
    10851142        $string_length = strlen( $utf8_string );
    10861143        reset_mbstring_encoding();
    10871144
    1088         for ($i = 0; $i < $string_length; $i++ ) {
     1145        for ( $i = 0; $i < $string_length; $i ++ ) {
    10891146
    10901147                $value = ord( $utf8_string[ $i ] );
    10911148
    10921149                if ( $value < 128 ) {
    1093                         if ( $length && ( $unicode_length >= $length ) )
     1150                        if ( $length && ( $unicode_length >= $length ) ) {
    10941151                                break;
    1095                         $unicode .= chr($value);
    1096                         $unicode_length++;
     1152                        }
     1153                        $unicode .= chr( $value );
     1154                        $unicode_length ++;
    10971155                } else {
    10981156                        if ( count( $values ) == 0 ) {
    10991157                                if ( $value < 224 ) {
     
    11071165
    11081166                        $values[] = $value;
    11091167
    1110                         if ( $length && ( $unicode_length + ($num_octets * 3) ) > $length )
     1168                        if ( $length && ( $unicode_length + ( $num_octets * 3 ) ) > $length ) {
    11111169                                break;
     1170                        }
    11121171                        if ( count( $values ) == $num_octets ) {
    1113                                 for ( $j = 0; $j < $num_octets; $j++ ) {
     1172                                for ( $j = 0; $j < $num_octets; $j ++ ) {
    11141173                                        $unicode .= '%' . dechex( $values[ $j ] );
    11151174                                }
    11161175
    11171176                                $unicode_length += $num_octets * 3;
    11181177
    1119                                 $values = array();
     1178                                $values     = array();
    11201179                                $num_octets = 1;
    11211180                        }
    11221181                }
     
    15091568 * @since 4.8.0 Added locale support for `bs_BA`.
    15101569 *
    15111570 * @param string $string Text that might have accent characters
     1571 *
    15121572 * @return string Filtered string with replaced "nice" characters.
    15131573 */
    15141574function remove_accents( $string ) {
    1515         if ( !preg_match('/[\x80-\xff]/', $string) )
     1575        if ( ! preg_match( '/[\x80-\xff]/', $string ) ) {
    15161576                return $string;
     1577        }
    15171578
    1518         if (seems_utf8($string)) {
     1579        if ( seems_utf8( $string ) ) {
    15191580                $chars = array(
    1520                 // Decompositions for Latin-1 Supplement
    1521                 'ª' => 'a', 'º' => 'o',
    1522                 'À' => 'A', 'Á' => 'A',
    1523                 'Â' => 'A', 'Ã' => 'A',
    1524                 'Ä' => 'A', 'Å' => 'A',
    1525                 'Æ' => 'AE','Ç' => 'C',
    1526                 'È' => 'E', 'É' => 'E',
    1527                 'Ê' => 'E', 'Ë' => 'E',
    1528                 'Ì' => 'I', 'Í' => 'I',
    1529                 'Î' => 'I', 'Ï' => 'I',
    1530                 'Ð' => 'D', 'Ñ' => 'N',
    1531                 'Ò' => 'O', 'Ó' => 'O',
    1532                 'Ô' => 'O', 'Õ' => 'O',
    1533                 'Ö' => 'O', 'Ù' => 'U',
    1534                 'Ú' => 'U', 'Û' => 'U',
    1535                 'Ü' => 'U', 'Ý' => 'Y',
    1536                 'Þ' => 'TH','ß' => 's',
    1537                 'à' => 'a', 'á' => 'a',
    1538                 'â' => 'a', 'ã' => 'a',
    1539                 'ä' => 'a', 'å' => 'a',
    1540                 'æ' => 'ae','ç' => 'c',
    1541                 'è' => 'e', 'é' => 'e',
    1542                 'ê' => 'e', 'ë' => 'e',
    1543                 'ì' => 'i', 'í' => 'i',
    1544                 'î' => 'i', 'ï' => 'i',
    1545                 'ð' => 'd', 'ñ' => 'n',
    1546                 'ò' => 'o', 'ó' => 'o',
    1547                 'ô' => 'o', 'õ' => 'o',
    1548                 'ö' => 'o', 'ø' => 'o',
    1549                 'ù' => 'u', 'ú' => 'u',
    1550                 'û' => 'u', 'ü' => 'u',
    1551                 'ý' => 'y', 'þ' => 'th',
    1552                 'ÿ' => 'y', 'Ø' => 'O',
    1553                 // Decompositions for Latin Extended-A
    1554                 'Ā' => 'A', 'ā' => 'a',
    1555                 'Ă' => 'A', 'ă' => 'a',
    1556                 'Ą' => 'A', 'ą' => 'a',
    1557                 'Ć' => 'C', 'ć' => 'c',
    1558                 'Ĉ' => 'C', 'ĉ' => 'c',
    1559                 'Ċ' => 'C', 'ċ' => 'c',
    1560                 'Č' => 'C', 'č' => 'c',
    1561                 'Ď' => 'D', 'ď' => 'd',
    1562                 'Đ' => 'D', 'đ' => 'd',
    1563                 'Ē' => 'E', 'ē' => 'e',
    1564                 'Ĕ' => 'E', 'ĕ' => 'e',
    1565                 'Ė' => 'E', 'ė' => 'e',
    1566                 'Ę' => 'E', 'ę' => 'e',
    1567                 'Ě' => 'E', 'ě' => 'e',
    1568                 'Ĝ' => 'G', 'ĝ' => 'g',
    1569                 'Ğ' => 'G', 'ğ' => 'g',
    1570                 'Ġ' => 'G', 'ġ' => 'g',
    1571                 'Ģ' => 'G', 'ģ' => 'g',
    1572                 'Ĥ' => 'H', 'ĥ' => 'h',
    1573                 'Ħ' => 'H', 'ħ' => 'h',
    1574                 'Ĩ' => 'I', 'ĩ' => 'i',
    1575                 'Ī' => 'I', 'ī' => 'i',
    1576                 'Ĭ' => 'I', 'ĭ' => 'i',
    1577                 'Į' => 'I', 'į' => 'i',
    1578                 'İ' => 'I', 'ı' => 'i',
    1579                 'IJ' => 'IJ','ij' => 'ij',
    1580                 'Ĵ' => 'J', 'ĵ' => 'j',
    1581                 'Ķ' => 'K', 'ķ' => 'k',
    1582                 'ĸ' => 'k', 'Ĺ' => 'L',
    1583                 'ĺ' => 'l', 'Ļ' => 'L',
    1584                 'ļ' => 'l', 'Ľ' => 'L',
    1585                 'ľ' => 'l', 'Ŀ' => 'L',
    1586                 'ŀ' => 'l', 'Ł' => 'L',
    1587                 'ł' => 'l', 'Ń' => 'N',
    1588                 'ń' => 'n', 'Ņ' => 'N',
    1589                 'ņ' => 'n', 'Ň' => 'N',
    1590                 'ň' => 'n', 'ʼn' => 'n',
    1591                 'Ŋ' => 'N', 'ŋ' => 'n',
    1592                 'Ō' => 'O', 'ō' => 'o',
    1593                 'Ŏ' => 'O', 'ŏ' => 'o',
    1594                 'Ő' => 'O', 'ő' => 'o',
    1595                 'Œ' => 'OE','œ' => 'oe',
    1596                 'Ŕ' => 'R','ŕ' => 'r',
    1597                 'Ŗ' => 'R','ŗ' => 'r',
    1598                 'Ř' => 'R','ř' => 'r',
    1599                 'Ś' => 'S','ś' => 's',
    1600                 'Ŝ' => 'S','ŝ' => 's',
    1601                 'Ş' => 'S','ş' => 's',
    1602                 'Š' => 'S', 'š' => 's',
    1603                 'Ţ' => 'T', 'ţ' => 't',
    1604                 'Ť' => 'T', 'ť' => 't',
    1605                 'Ŧ' => 'T', 'ŧ' => 't',
    1606                 'Ũ' => 'U', 'ũ' => 'u',
    1607                 'Ū' => 'U', 'ū' => 'u',
    1608                 'Ŭ' => 'U', 'ŭ' => 'u',
    1609                 'Ů' => 'U', 'ů' => 'u',
    1610                 'Ű' => 'U', 'ű' => 'u',
    1611                 'Ų' => 'U', 'ų' => 'u',
    1612                 'Ŵ' => 'W', 'ŵ' => 'w',
    1613                 'Ŷ' => 'Y', 'ŷ' => 'y',
    1614                 'Ÿ' => 'Y', 'Ź' => 'Z',
    1615                 'ź' => 'z', 'Ż' => 'Z',
    1616                 'ż' => 'z', 'Ž' => 'Z',
    1617                 'ž' => 'z', 'ſ' => 's',
    1618                 // Decompositions for Latin Extended-B
    1619                 'Ș' => 'S', 'ș' => 's',
    1620                 'Ț' => 'T', 'ț' => 't',
    1621                 // Euro Sign
    1622                 '€' => 'E',
    1623                 // GBP (Pound) Sign
    1624                 '£' => '',
    1625                 // Vowels with diacritic (Vietnamese)
    1626                 // unmarked
    1627                 'Ơ' => 'O', 'ơ' => 'o',
    1628                 'Ư' => 'U', 'ư' => 'u',
    1629                 // grave accent
    1630                 'Ầ' => 'A', 'ầ' => 'a',
    1631                 'Ằ' => 'A', 'ằ' => 'a',
    1632                 'Ề' => 'E', 'ề' => 'e',
    1633                 'Ồ' => 'O', 'ồ' => 'o',
    1634                 'Ờ' => 'O', 'ờ' => 'o',
    1635                 'Ừ' => 'U', 'ừ' => 'u',
    1636                 'Ỳ' => 'Y', 'ỳ' => 'y',
    1637                 // hook
    1638                 'Ả' => 'A', 'ả' => 'a',
    1639                 'Ẩ' => 'A', 'ẩ' => 'a',
    1640                 'Ẳ' => 'A', 'ẳ' => 'a',
    1641                 'Ẻ' => 'E', 'ẻ' => 'e',
    1642                 'Ể' => 'E', 'ể' => 'e',
    1643                 'Ỉ' => 'I', 'ỉ' => 'i',
    1644                 'Ỏ' => 'O', 'ỏ' => 'o',
    1645                 'Ổ' => 'O', 'ổ' => 'o',
    1646                 'Ở' => 'O', 'ở' => 'o',
    1647                 'Ủ' => 'U', 'ủ' => 'u',
    1648                 'Ử' => 'U', 'ử' => 'u',
    1649                 'Ỷ' => 'Y', 'ỷ' => 'y',
    1650                 // tilde
    1651                 'Ẫ' => 'A', 'ẫ' => 'a',
    1652                 'Ẵ' => 'A', 'ẵ' => 'a',
    1653                 'Ẽ' => 'E', 'ẽ' => 'e',
    1654                 'Ễ' => 'E', 'ễ' => 'e',
    1655                 'Ỗ' => 'O', 'ỗ' => 'o',
    1656                 'Ỡ' => 'O', 'ỡ' => 'o',
    1657                 'Ữ' => 'U', 'ữ' => 'u',
    1658                 'Ỹ' => 'Y', 'ỹ' => 'y',
    1659                 // acute accent
    1660                 'Ấ' => 'A', 'ấ' => 'a',
    1661                 'Ắ' => 'A', 'ắ' => 'a',
    1662                 'Ế' => 'E', 'ế' => 'e',
    1663                 'Ố' => 'O', 'ố' => 'o',
    1664                 'Ớ' => 'O', 'ớ' => 'o',
    1665                 'Ứ' => 'U', 'ứ' => 'u',
    1666                 // dot below
    1667                 'Ạ' => 'A', 'ạ' => 'a',
    1668                 'Ậ' => 'A', 'ậ' => 'a',
    1669                 'Ặ' => 'A', 'ặ' => 'a',
    1670                 'Ẹ' => 'E', 'ẹ' => 'e',
    1671                 'Ệ' => 'E', 'ệ' => 'e',
    1672                 'Ị' => 'I', 'ị' => 'i',
    1673                 'Ọ' => 'O', 'ọ' => 'o',
    1674                 'Ộ' => 'O', 'ộ' => 'o',
    1675                 'Ợ' => 'O', 'ợ' => 'o',
    1676                 'Ụ' => 'U', 'ụ' => 'u',
    1677                 'Ự' => 'U', 'ự' => 'u',
    1678                 'Ỵ' => 'Y', 'ỵ' => 'y',
    1679                 // Vowels with diacritic (Chinese, Hanyu Pinyin)
    1680                 'ɑ' => 'a',
    1681                 // macron
    1682                 'Ǖ' => 'U', 'ǖ' => 'u',
    1683                 // acute accent
    1684                 'Ǘ' => 'U', 'ǘ' => 'u',
    1685                 // caron
    1686                 'Ǎ' => 'A', 'ǎ' => 'a',
    1687                 'Ǐ' => 'I', 'ǐ' => 'i',
    1688                 'Ǒ' => 'O', 'ǒ' => 'o',
    1689                 'Ǔ' => 'U', 'ǔ' => 'u',
    1690                 'Ǚ' => 'U', 'ǚ' => 'u',
    1691                 // grave accent
    1692                 'Ǜ' => 'U', 'ǜ' => 'u',
     1581                        // Decompositions for Latin-1 Supplement
     1582                        'ª' => 'a',
     1583                        'º' => 'o',
     1584                        'À' => 'A',
     1585                        'Á' => 'A',
     1586                        'Â' => 'A',
     1587                        'Ã' => 'A',
     1588                        'Ä' => 'A',
     1589                        'Å' => 'A',
     1590                        'Æ' => 'AE',
     1591                        'Ç' => 'C',
     1592                        'È' => 'E',
     1593                        'É' => 'E',
     1594                        'Ê' => 'E',
     1595                        'Ë' => 'E',
     1596                        'Ì' => 'I',
     1597                        'Í' => 'I',
     1598                        'Î' => 'I',
     1599                        'Ï' => 'I',
     1600                        'Ð' => 'D',
     1601                        'Ñ' => 'N',
     1602                        'Ò' => 'O',
     1603                        'Ó' => 'O',
     1604                        'Ô' => 'O',
     1605                        'Õ' => 'O',
     1606                        'Ö' => 'O',
     1607                        'Ù' => 'U',
     1608                        'Ú' => 'U',
     1609                        'Û' => 'U',
     1610                        'Ü' => 'U',
     1611                        'Ý' => 'Y',
     1612                        'Þ' => 'TH',
     1613                        'ß' => 's',
     1614                        'à' => 'a',
     1615                        'á' => 'a',
     1616                        'â' => 'a',
     1617                        'ã' => 'a',
     1618                        'ä' => 'a',
     1619                        'å' => 'a',
     1620                        'æ' => 'ae',
     1621                        'ç' => 'c',
     1622                        'è' => 'e',
     1623                        'é' => 'e',
     1624                        'ê' => 'e',
     1625                        'ë' => 'e',
     1626                        'ì' => 'i',
     1627                        'í' => 'i',
     1628                        'î' => 'i',
     1629                        'ï' => 'i',
     1630                        'ð' => 'd',
     1631                        'ñ' => 'n',
     1632                        'ò' => 'o',
     1633                        'ó' => 'o',
     1634                        'ô' => 'o',
     1635                        'õ' => 'o',
     1636                        'ö' => 'o',
     1637                        'ø' => 'o',
     1638                        'ù' => 'u',
     1639                        'ú' => 'u',
     1640                        'û' => 'u',
     1641                        'ü' => 'u',
     1642                        'ý' => 'y',
     1643                        'þ' => 'th',
     1644                        'ÿ' => 'y',
     1645                        'Ø' => 'O',
     1646                        // Decompositions for Latin Extended-A
     1647                        'Ā' => 'A',
     1648                        'ā' => 'a',
     1649                        'Ă' => 'A',
     1650                        'ă' => 'a',
     1651                        'Ą' => 'A',
     1652                        'ą' => 'a',
     1653                        'Ć' => 'C',
     1654                        'ć' => 'c',
     1655                        'Ĉ' => 'C',
     1656                        'ĉ' => 'c',
     1657                        'Ċ' => 'C',
     1658                        'ċ' => 'c',
     1659                        'Č' => 'C',
     1660                        'č' => 'c',
     1661                        'Ď' => 'D',
     1662                        'ď' => 'd',
     1663                        'Đ' => 'D',
     1664                        'đ' => 'd',
     1665                        'Ē' => 'E',
     1666                        'ē' => 'e',
     1667                        'Ĕ' => 'E',
     1668                        'ĕ' => 'e',
     1669                        'Ė' => 'E',
     1670                        'ė' => 'e',
     1671                        'Ę' => 'E',
     1672                        'ę' => 'e',
     1673                        'Ě' => 'E',
     1674                        'ě' => 'e',
     1675                        'Ĝ' => 'G',
     1676                        'ĝ' => 'g',
     1677                        'Ğ' => 'G',
     1678                        'ğ' => 'g',
     1679                        'Ġ' => 'G',
     1680                        'ġ' => 'g',
     1681                        'Ģ' => 'G',
     1682                        'ģ' => 'g',
     1683                        'Ĥ' => 'H',
     1684                        'ĥ' => 'h',
     1685                        'Ħ' => 'H',
     1686                        'ħ' => 'h',
     1687                        'Ĩ' => 'I',
     1688                        'ĩ' => 'i',
     1689                        'Ī' => 'I',
     1690                        'ī' => 'i',
     1691                        'Ĭ' => 'I',
     1692                        'ĭ' => 'i',
     1693                        'Į' => 'I',
     1694                        'į' => 'i',
     1695                        'İ' => 'I',
     1696                        'ı' => 'i',
     1697                        'IJ' => 'IJ',
     1698                        'ij' => 'ij',
     1699                        'Ĵ' => 'J',
     1700                        'ĵ' => 'j',
     1701                        'Ķ' => 'K',
     1702                        'ķ' => 'k',
     1703                        'ĸ' => 'k',
     1704                        'Ĺ' => 'L',
     1705                        'ĺ' => 'l',
     1706                        'Ļ' => 'L',
     1707                        'ļ' => 'l',
     1708                        'Ľ' => 'L',
     1709                        'ľ' => 'l',
     1710                        'Ŀ' => 'L',
     1711                        'ŀ' => 'l',
     1712                        'Ł' => 'L',
     1713                        'ł' => 'l',
     1714                        'Ń' => 'N',
     1715                        'ń' => 'n',
     1716                        'Ņ' => 'N',
     1717                        'ņ' => 'n',
     1718                        'Ň' => 'N',
     1719                        'ň' => 'n',
     1720                        'ʼn' => 'n',
     1721                        'Ŋ' => 'N',
     1722                        'ŋ' => 'n',
     1723                        'Ō' => 'O',
     1724                        'ō' => 'o',
     1725                        'Ŏ' => 'O',
     1726                        'ŏ' => 'o',
     1727                        'Ő' => 'O',
     1728                        'ő' => 'o',
     1729                        'Œ' => 'OE',
     1730                        'œ' => 'oe',
     1731                        'Ŕ' => 'R',
     1732                        'ŕ' => 'r',
     1733                        'Ŗ' => 'R',
     1734                        'ŗ' => 'r',
     1735                        'Ř' => 'R',
     1736                        'ř' => 'r',
     1737                        'Ś' => 'S',
     1738                        'ś' => 's',
     1739                        'Ŝ' => 'S',
     1740                        'ŝ' => 's',
     1741                        'Ş' => 'S',
     1742                        'ş' => 's',
     1743                        'Š' => 'S',
     1744                        'š' => 's',
     1745                        'Ţ' => 'T',
     1746                        'ţ' => 't',
     1747                        'Ť' => 'T',
     1748                        'ť' => 't',
     1749                        'Ŧ' => 'T',
     1750                        'ŧ' => 't',
     1751                        'Ũ' => 'U',
     1752                        'ũ' => 'u',
     1753                        'Ū' => 'U',
     1754                        'ū' => 'u',
     1755                        'Ŭ' => 'U',
     1756                        'ŭ' => 'u',
     1757                        'Ů' => 'U',
     1758                        'ů' => 'u',
     1759                        'Ű' => 'U',
     1760                        'ű' => 'u',
     1761                        'Ų' => 'U',
     1762                        'ų' => 'u',
     1763                        'Ŵ' => 'W',
     1764                        'ŵ' => 'w',
     1765                        'Ŷ' => 'Y',
     1766                        'ŷ' => 'y',
     1767                        'Ÿ' => 'Y',
     1768                        'Ź' => 'Z',
     1769                        'ź' => 'z',
     1770                        'Ż' => 'Z',
     1771                        'ż' => 'z',
     1772                        'Ž' => 'Z',
     1773                        'ž' => 'z',
     1774                        'ſ' => 's',
     1775                        // Decompositions for Latin Extended-B
     1776                        'Ș' => 'S',
     1777                        'ș' => 's',
     1778                        'Ț' => 'T',
     1779                        'ț' => 't',
     1780                        // Euro Sign
     1781                        '€' => 'E',
     1782                        // GBP (Pound) Sign
     1783                        '£' => '',
     1784                        // Vowels with diacritic (Vietnamese)
     1785                        // unmarked
     1786                        'Ơ' => 'O',
     1787                        'ơ' => 'o',
     1788                        'Ư' => 'U',
     1789                        'ư' => 'u',
     1790                        // grave accent
     1791                        'Ầ' => 'A',
     1792                        'ầ' => 'a',
     1793                        'Ằ' => 'A',
     1794                        'ằ' => 'a',
     1795                        'Ề' => 'E',
     1796                        'ề' => 'e',
     1797                        'Ồ' => 'O',
     1798                        'ồ' => 'o',
     1799                        'Ờ' => 'O',
     1800                        'ờ' => 'o',
     1801                        'Ừ' => 'U',
     1802                        'ừ' => 'u',
     1803                        'Ỳ' => 'Y',
     1804                        'ỳ' => 'y',
     1805                        // hook
     1806                        'Ả' => 'A',
     1807                        'ả' => 'a',
     1808                        'Ẩ' => 'A',
     1809                        'ẩ' => 'a',
     1810                        'Ẳ' => 'A',
     1811                        'ẳ' => 'a',
     1812                        'Ẻ' => 'E',
     1813                        'ẻ' => 'e',
     1814                        'Ể' => 'E',
     1815                        'ể' => 'e',
     1816                        'Ỉ' => 'I',
     1817                        'ỉ' => 'i',
     1818                        'Ỏ' => 'O',
     1819                        'ỏ' => 'o',
     1820                        'Ổ' => 'O',
     1821                        'ổ' => 'o',
     1822                        'Ở' => 'O',
     1823                        'ở' => 'o',
     1824                        'Ủ' => 'U',
     1825                        'ủ' => 'u',
     1826                        'Ử' => 'U',
     1827                        'ử' => 'u',
     1828                        'Ỷ' => 'Y',
     1829                        'ỷ' => 'y',
     1830                        // tilde
     1831                        'Ẫ' => 'A',
     1832                        'ẫ' => 'a',
     1833                        'Ẵ' => 'A',
     1834                        'ẵ' => 'a',
     1835                        'Ẽ' => 'E',
     1836                        'ẽ' => 'e',
     1837                        'Ễ' => 'E',
     1838                        'ễ' => 'e',
     1839                        'Ỗ' => 'O',
     1840                        'ỗ' => 'o',
     1841                        'Ỡ' => 'O',
     1842                        'ỡ' => 'o',
     1843                        'Ữ' => 'U',
     1844                        'ữ' => 'u',
     1845                        'Ỹ' => 'Y',
     1846                        'ỹ' => 'y',
     1847                        // acute accent
     1848                        'Ấ' => 'A',
     1849                        'ấ' => 'a',
     1850                        'Ắ' => 'A',
     1851                        'ắ' => 'a',
     1852                        'Ế' => 'E',
     1853                        'ế' => 'e',
     1854                        'Ố' => 'O',
     1855                        'ố' => 'o',
     1856                        'Ớ' => 'O',
     1857                        'ớ' => 'o',
     1858                        'Ứ' => 'U',
     1859                        'ứ' => 'u',
     1860                        // dot below
     1861                        'Ạ' => 'A',
     1862                        'ạ' => 'a',
     1863                        'Ậ' => 'A',
     1864                        'ậ' => 'a',
     1865                        'Ặ' => 'A',
     1866                        'ặ' => 'a',
     1867                        'Ẹ' => 'E',
     1868                        'ẹ' => 'e',
     1869                        'Ệ' => 'E',
     1870                        'ệ' => 'e',
     1871                        'Ị' => 'I',
     1872                        'ị' => 'i',
     1873                        'Ọ' => 'O',
     1874                        'ọ' => 'o',
     1875                        'Ộ' => 'O',
     1876                        'ộ' => 'o',
     1877                        'Ợ' => 'O',
     1878                        'ợ' => 'o',
     1879                        'Ụ' => 'U',
     1880                        'ụ' => 'u',
     1881                        'Ự' => 'U',
     1882                        'ự' => 'u',
     1883                        'Ỵ' => 'Y',
     1884                        'ỵ' => 'y',
     1885                        // Vowels with diacritic (Chinese, Hanyu Pinyin)
     1886                        'ɑ' => 'a',
     1887                        // macron
     1888                        'Ǖ' => 'U',
     1889                        'ǖ' => 'u',
     1890                        // acute accent
     1891                        'Ǘ' => 'U',
     1892                        'ǘ' => 'u',
     1893                        // caron
     1894                        'Ǎ' => 'A',
     1895                        'ǎ' => 'a',
     1896                        'Ǐ' => 'I',
     1897                        'ǐ' => 'i',
     1898                        'Ǒ' => 'O',
     1899                        'ǒ' => 'o',
     1900                        'Ǔ' => 'U',
     1901                        'ǔ' => 'u',
     1902                        'Ǚ' => 'U',
     1903                        'ǚ' => 'u',
     1904                        // grave accent
     1905                        'Ǜ' => 'U',
     1906                        'ǜ' => 'u',
    16931907                );
    16941908
    16951909                // Used for locale-specific rules
    16961910                $locale = get_locale();
    16971911
    16981912                if ( 'de_DE' == $locale || 'de_DE_formal' == $locale || 'de_CH' == $locale || 'de_CH_informal' == $locale ) {
    1699                         $chars[ 'Ä' ] = 'Ae';
    1700                         $chars[ 'ä' ] = 'ae';
    1701                         $chars[ 'Ö' ] = 'Oe';
    1702                         $chars[ 'ö' ] = 'oe';
    1703                         $chars[ 'Ü' ] = 'Ue';
    1704                         $chars[ 'ü' ] = 'ue';
    1705                         $chars[ 'ß' ] = 'ss';
     1913                        $chars['Ä'] = 'Ae';
     1914                        $chars['ä'] = 'ae';
     1915                        $chars['Ö'] = 'Oe';
     1916                        $chars['ö'] = 'oe';
     1917                        $chars['Ü'] = 'Ue';
     1918                        $chars['ü'] = 'ue';
     1919                        $chars['ß'] = 'ss';
    17061920                } elseif ( 'da_DK' === $locale ) {
    1707                         $chars[ 'Æ' ] = 'Ae';
    1708                         $chars[ 'æ' ] = 'ae';
    1709                         $chars[ 'Ø' ] = 'Oe';
    1710                         $chars[ 'ø' ] = 'oe';
    1711                         $chars[ 'Å' ] = 'Aa';
    1712                         $chars[ 'å' ] = 'aa';
     1921                        $chars['Æ'] = 'Ae';
     1922                        $chars['æ'] = 'ae';
     1923                        $chars['Ø'] = 'Oe';
     1924                        $chars['ø'] = 'oe';
     1925                        $chars['Å'] = 'Aa';
     1926                        $chars['å'] = 'aa';
    17131927                } elseif ( 'ca' === $locale ) {
    1714                         $chars[ 'l·l' ] = 'll';
     1928                        $chars['l·l'] = 'll';
    17151929                } elseif ( 'sr_RS' === $locale || 'bs_BA' === $locale ) {
    1716                         $chars[ 'Đ' ] = 'DJ';
    1717                         $chars[ 'đ' ] = 'dj';
     1930                        $chars['Đ'] = 'DJ';
     1931                        $chars['đ'] = 'dj';
    17181932                }
    17191933
    1720                 $string = strtr($string, $chars);
     1934                $string = strtr( $string, $chars );
    17211935        } else {
    17221936                $chars = array();
    17231937                // Assume ISO-8859-1 if not UTF-8
    17241938                $chars['in'] = "\x80\x83\x8a\x8e\x9a\x9e"
    1725                         ."\x9f\xa2\xa5\xb5\xc0\xc1\xc2"
    1726                         ."\xc3\xc4\xc5\xc7\xc8\xc9\xca"
    1727                         ."\xcb\xcc\xcd\xce\xcf\xd1\xd2"
    1728                         ."\xd3\xd4\xd5\xd6\xd8\xd9\xda"
    1729                         ."\xdb\xdc\xdd\xe0\xe1\xe2\xe3"
    1730                         ."\xe4\xe5\xe7\xe8\xe9\xea\xeb"
    1731                         ."\xec\xed\xee\xef\xf1\xf2\xf3"
    1732                         ."\xf4\xf5\xf6\xf8\xf9\xfa\xfb"
    1733                         ."\xfc\xfd\xff";
     1939                               . "\x9f\xa2\xa5\xb5\xc0\xc1\xc2"
     1940                               . "\xc3\xc4\xc5\xc7\xc8\xc9\xca"
     1941                               . "\xcb\xcc\xcd\xce\xcf\xd1\xd2"
     1942                               . "\xd3\xd4\xd5\xd6\xd8\xd9\xda"
     1943                               . "\xdb\xdc\xdd\xe0\xe1\xe2\xe3"
     1944                               . "\xe4\xe5\xe7\xe8\xe9\xea\xeb"
     1945                               . "\xec\xed\xee\xef\xf1\xf2\xf3"
     1946                               . "\xf4\xf5\xf6\xf8\xf9\xfa\xfb"
     1947                               . "\xfc\xfd\xff";
    17341948
    17351949                $chars['out'] = "EfSZszYcYuAAAAAACEEEEIIIINOOOOOOUUUUYaaaaaaceeeeiiiinoooooouuuuyy";
    17361950
    1737                 $string = strtr($string, $chars['in'], $chars['out']);
    1738                 $double_chars = array();
    1739                 $double_chars['in'] = array("\x8c", "\x9c", "\xc6", "\xd0", "\xde", "\xdf", "\xe6", "\xf0", "\xfe");
    1740                 $double_chars['out'] = array('OE', 'oe', 'AE', 'DH', 'TH', 'ss', 'ae', 'dh', 'th');
    1741                 $string = str_replace($double_chars['in'], $double_chars['out'], $string);
     1951                $string              = strtr( $string, $chars['in'], $chars['out'] );
     1952                $double_chars        = array();
     1953                $double_chars['in']  = array( "\x8c", "\x9c", "\xc6", "\xd0", "\xde", "\xdf", "\xe6", "\xf0", "\xfe" );
     1954                $double_chars['out'] = array( 'OE', 'oe', 'AE', 'DH', 'TH', 'ss', 'ae', 'dh', 'th' );
     1955                $string              = str_replace( $double_chars['in'], $double_chars['out'], $string );
    17421956        }
    17431957
    17441958        return $string;
     
    17571971 * @since 2.1.0
    17581972 *
    17591973 * @param string $filename The filename to be sanitized
     1974 *
    17601975 * @return string The sanitized filename
    17611976 */
    17621977function sanitize_file_name( $filename ) {
    1763         $filename_raw = $filename;
    1764         $special_chars = array("?", "[", "]", "/", "\\", "=", "<", ">", ":", ";", ",", "'", "\"", "&", "$", "#", "*", "(", ")", "|", "~", "`", "!", "{", "}", "%", "+", chr(0));
     1978        $filename_raw  = $filename;
     1979        $special_chars = array(
     1980                "?",
     1981                "[",
     1982                "]",
     1983                "/",
     1984                "\\",
     1985                "=",
     1986                "<",
     1987                ">",
     1988                ":",
     1989                ";",
     1990                ",",
     1991                "'",
     1992                "\"",
     1993                "&",
     1994                "$",
     1995                "#",
     1996                "*",
     1997                "(",
     1998                ")",
     1999                "|",
     2000                "~",
     2001                "`",
     2002                "!",
     2003                "{",
     2004                "}",
     2005                "%",
     2006                "+",
     2007                chr( 0 )
     2008        );
    17652009        /**
    17662010         * Filters the list of characters to remove from a filename.
    17672011         *
    17682012         * @since 2.8.0
    17692013         *
    1770          * @param array  $special_chars Characters to remove.
    1771          * @param string $filename_raw  Filename as it was passed into sanitize_file_name().
     2014         * @param array $special_chars Characters to remove.
     2015         * @param string $filename_raw Filename as it was passed into sanitize_file_name().
    17722016         */
    17732017        $special_chars = apply_filters( 'sanitize_file_name_chars', $special_chars, $filename_raw );
    1774         $filename = preg_replace( "#\x{00a0}#siu", ' ', $filename );
    1775         $filename = str_replace( $special_chars, '', $filename );
    1776         $filename = str_replace( array( '%20', '+' ), '-', $filename );
    1777         $filename = preg_replace( '/[\r\n\t -]+/', '-', $filename );
    1778         $filename = trim( $filename, '.-_' );
     2018        $filename      = preg_replace( "#\x{00a0}#siu", ' ', $filename );
     2019        $filename      = str_replace( $special_chars, '', $filename );
     2020        $filename      = str_replace( array( '%20', '+' ), '-', $filename );
     2021        $filename      = preg_replace( '/[\r\n\t -]+/', '-', $filename );
     2022        $filename      = trim( $filename, '.-_' );
    17792023
    17802024        if ( false === strpos( $filename, '.' ) ) {
    17812025                $mime_types = wp_get_mime_types();
    1782                 $filetype = wp_check_filetype( 'test.' . $filename, $mime_types );
     2026                $filetype   = wp_check_filetype( 'test.' . $filename, $mime_types );
    17832027                if ( $filetype['ext'] === $filename ) {
    17842028                        $filename = 'unnamed-file.' . $filetype['ext'];
    17852029                }
    17862030        }
    17872031
    17882032        // Split the filename into a base and extension[s]
    1789         $parts = explode('.', $filename);
     2033        $parts = explode( '.', $filename );
    17902034
    17912035        // Return if only one extension
    17922036        if ( count( $parts ) <= 2 ) {
     
    17952039                 *
    17962040                 * @since 2.8.0
    17972041                 *
    1798                  * @param string $filename     Sanitized filename.
     2042                 * @param string $filename Sanitized filename.
    17992043                 * @param string $filename_raw The filename prior to sanitization.
    18002044                 */
    18012045                return apply_filters( 'sanitize_file_name', $filename, $filename_raw );
    18022046        }
    18032047
    18042048        // Process multiple extensions
    1805         $filename = array_shift($parts);
    1806         $extension = array_pop($parts);
    1807         $mimes = get_allowed_mime_types();
     2049        $filename  = array_shift( $parts );
     2050        $extension = array_pop( $parts );
     2051        $mimes     = get_allowed_mime_types();
    18082052
    18092053        /*
    18102054         * Loop over any intermediate extensions. Postfix them with a trailing underscore
    18112055         * if they are a 2 - 5 character long alpha string not in the extension whitelist.
    18122056         */
    1813         foreach ( (array) $parts as $part) {
     2057        foreach ( (array) $parts as $part ) {
    18142058                $filename .= '.' . $part;
    18152059
    1816                 if ( preg_match("/^[a-zA-Z]{2,5}\d?$/", $part) ) {
     2060                if ( preg_match( "/^[a-zA-Z]{2,5}\d?$/", $part ) ) {
    18172061                        $allowed = false;
    18182062                        foreach ( $mimes as $ext_preg => $mime_match ) {
    18192063                                $ext_preg = '!^(' . $ext_preg . ')$!i';
     
    18222066                                        break;
    18232067                                }
    18242068                        }
    1825                         if ( !$allowed )
     2069                        if ( ! $allowed ) {
    18262070                                $filename .= '_';
     2071                        }
    18272072                }
    18282073        }
    18292074        $filename .= '.' . $extension;
     2075
    18302076        /** This filter is documented in wp-includes/formatting.php */
    1831         return apply_filters('sanitize_file_name', $filename, $filename_raw);
     2077        return apply_filters( 'sanitize_file_name', $filename, $filename_raw );
    18322078}
    18332079
    18342080/**
     
    18422088 * @since 2.0.0
    18432089 *
    18442090 * @param string $username The username to be sanitized.
    1845  * @param bool   $strict   If set limits $username to specific characters. Default false.
     2091 * @param bool $strict If set limits $username to specific characters. Default false.
     2092 *
    18462093 * @return string The sanitized username, after passing through filters.
    18472094 */
    18482095function sanitize_user( $username, $strict = false ) {
    18492096        $raw_username = $username;
    1850         $username = wp_strip_all_tags( $username );
    1851         $username = remove_accents( $username );
     2097        $username     = wp_strip_all_tags( $username );
     2098        $username     = remove_accents( $username );
    18522099        // Kill octets
    18532100        $username = preg_replace( '|%([a-fA-F0-9][a-fA-F0-9])|', '', $username );
    18542101        $username = preg_replace( '/&.+?;/', '', $username ); // Kill entities
    18552102
    18562103        // If strict, reduce to ASCII for max portability.
    1857         if ( $strict )
     2104        if ( $strict ) {
    18582105                $username = preg_replace( '|[^a-z0-9 _.\-@]|i', '', $username );
     2106        }
    18592107
    18602108        $username = trim( $username );
    18612109        // Consolidate contiguous whitespace
     
    18662114         *
    18672115         * @since 2.0.1
    18682116         *
    1869          * @param string $username     Sanitized username.
     2117         * @param string $username Sanitized username.
    18702118         * @param string $raw_username The username prior to sanitization.
    1871          * @param bool   $strict      Whether to limit the sanitization to specific characters. Default false.
     2119         * @param bool $strict Whether to limit the sanitization to specific characters. Default false.
    18722120         */
    18732121        return apply_filters( 'sanitize_user', $username, $raw_username, $strict );
    18742122}
     
    18812129 * @since 3.0.0
    18822130 *
    18832131 * @param string $key String key
     2132 *
    18842133 * @return string Sanitized key
    18852134 */
    18862135function sanitize_key( $key ) {
    18872136        $raw_key = $key;
    1888         $key = strtolower( $key );
    1889         $key = preg_replace( '/[^a-z0-9_\-]/', '', $key );
     2137        $key     = strtolower( $key );
     2138        $key     = preg_replace( '/[^a-z0-9_\-]/', '', $key );
    18902139
    18912140        /**
    18922141         * Filters a sanitized key string.
    18932142         *
    18942143         * @since 3.0.0
    18952144         *
    1896          * @param string $key     Sanitized key.
     2145         * @param string $key Sanitized key.
    18972146         * @param string $raw_key The key prior to sanitization.
    18982147         */
    18992148        return apply_filters( 'sanitize_key', $key, $raw_key );
     
    19082157 *
    19092158 * @since 1.0.0
    19102159 *
    1911  * @param string $title          The string to be sanitized.
     2160 * @param string $title The string to be sanitized.
    19122161 * @param string $fallback_title Optional. A title to use if $title is empty.
    1913  * @param string $context        Optional. The operation for which the string is sanitized
     2162 * @param string $context Optional. The operation for which the string is sanitized
     2163 *
    19142164 * @return string The sanitized string.
    19152165 */
    19162166function sanitize_title( $title, $fallback_title = '', $context = 'save' ) {
    19172167        $raw_title = $title;
    19182168
    1919         if ( 'save' == $context )
    1920                 $title = remove_accents($title);
     2169        if ( 'save' == $context ) {
     2170                $title = remove_accents( $title );
     2171        }
    19212172
    19222173        /**
    19232174         * Filters a sanitized title string.
    19242175         *
    19252176         * @since 1.2.0
    19262177         *
    1927          * @param string $title     Sanitized title.
     2178         * @param string $title Sanitized title.
    19282179         * @param string $raw_title The title prior to sanitization.
    1929          * @param string $context   The context for which the title is being sanitized.
     2180         * @param string $context The context for which the title is being sanitized.
    19302181         */
    19312182        $title = apply_filters( 'sanitize_title', $title, $raw_title, $context );
    19322183
    1933         if ( '' === $title || false === $title )
     2184        if ( '' === $title || false === $title ) {
    19342185                $title = $fallback_title;
     2186        }
    19352187
    19362188        return $title;
    19372189}
     
    19442196 * @since 3.1.0
    19452197 *
    19462198 * @param string $title The string to be sanitized.
     2199 *
    19472200 * @return string The sanitized string.
    19482201 */
    19492202function sanitize_title_for_query( $title ) {
     
    19582211 *
    19592212 * @since 1.2.0
    19602213 *
    1961  * @param string $title     The title to be sanitized.
     2214 * @param string $title The title to be sanitized.
    19622215 * @param string $raw_title Optional. Not used.
    1963  * @param string $context   Optional. The operation for which the string is sanitized.
     2216 * @param string $context Optional. The operation for which the string is sanitized.
     2217 *
    19642218 * @return string The sanitized title.
    19652219 */
    19662220function sanitize_title_with_dashes( $title, $raw_title = '', $context = 'display' ) {
    1967         $title = strip_tags($title);
     2221        $title = strip_tags( $title );
    19682222        // Preserve escaped octets.
    1969         $title = preg_replace('|%([a-fA-F0-9][a-fA-F0-9])|', '---$1---', $title);
     2223        $title = preg_replace( '|%([a-fA-F0-9][a-fA-F0-9])|', '---$1---', $title );
    19702224        // Remove percent signs that are not part of an octet.
    1971         $title = str_replace('%', '', $title);
     2225        $title = str_replace( '%', '', $title );
    19722226        // Restore octets.
    1973         $title = preg_replace('|---([a-fA-F0-9][a-fA-F0-9])---|', '%$1', $title);
     2227        $title = preg_replace( '|---([a-fA-F0-9][a-fA-F0-9])---|', '%$1', $title );
    19742228
    1975         if (seems_utf8($title)) {
    1976                 if (function_exists('mb_strtolower')) {
    1977                         $title = mb_strtolower($title, 'UTF-8');
     2229        if ( seems_utf8( $title ) ) {
     2230                if ( function_exists( 'mb_strtolower' ) ) {
     2231                        $title = mb_strtolower( $title, 'UTF-8' );
    19782232                }
    1979                 $title = utf8_uri_encode($title, 200);
     2233                $title = utf8_uri_encode( $title, 200 );
    19802234        }
    19812235
    1982         $title = strtolower($title);
     2236        $title = strtolower( $title );
    19832237
    19842238        if ( 'save' == $context ) {
    19852239                // Convert nbsp, ndash and mdash to hyphens
     
    19902244                // Strip these characters entirely
    19912245                $title = str_replace( array(
    19922246                        // iexcl and iquest
    1993                         '%c2%a1', '%c2%bf',
     2247                        '%c2%a1',
     2248                        '%c2%bf',
    19942249                        // angle quotes
    1995                         '%c2%ab', '%c2%bb', '%e2%80%b9', '%e2%80%ba',
     2250                        '%c2%ab',
     2251                        '%c2%bb',
     2252                        '%e2%80%b9',
     2253                        '%e2%80%ba',
    19962254                        // curly quotes
    1997                         '%e2%80%98', '%e2%80%99', '%e2%80%9c', '%e2%80%9d',
    1998                         '%e2%80%9a', '%e2%80%9b', '%e2%80%9e', '%e2%80%9f',
     2255                        '%e2%80%98',
     2256                        '%e2%80%99',
     2257                        '%e2%80%9c',
     2258                        '%e2%80%9d',
     2259                        '%e2%80%9a',
     2260                        '%e2%80%9b',
     2261                        '%e2%80%9e',
     2262                        '%e2%80%9f',
    19992263                        // copy, reg, deg, hellip and trade
    2000                         '%c2%a9', '%c2%ae', '%c2%b0', '%e2%80%a6', '%e2%84%a2',
     2264                        '%c2%a9',
     2265                        '%c2%ae',
     2266                        '%c2%b0',
     2267                        '%e2%80%a6',
     2268                        '%e2%84%a2',
    20012269                        // acute accents
    2002                         '%c2%b4', '%cb%8a', '%cc%81', '%cd%81',
     2270                        '%c2%b4',
     2271                        '%cb%8a',
     2272                        '%cc%81',
     2273                        '%cd%81',
    20032274                        // grave accent, macron, caron
    2004                         '%cc%80', '%cc%84', '%cc%8c',
     2275                        '%cc%80',
     2276                        '%cc%84',
     2277                        '%cc%8c',
    20052278                ), '', $title );
    20062279
    20072280                // Convert times to x
    20082281                $title = str_replace( '%c3%97', 'x', $title );
    20092282        }
    20102283
    2011         $title = preg_replace('/&.+?;/', '', $title); // kill entities
    2012         $title = str_replace('.', '-', $title);
     2284        $title = preg_replace( '/&.+?;/', '', $title ); // kill entities
     2285        $title = str_replace( '.', '-', $title );
    20132286
    2014         $title = preg_replace('/[^%a-z0-9 _-]/', '', $title);
    2015         $title = preg_replace('/\s+/', '-', $title);
    2016         $title = preg_replace('|-+|', '-', $title);
    2017         $title = trim($title, '-');
     2287        $title = preg_replace( '/[^%a-z0-9 _-]/', '', $title );
     2288        $title = preg_replace( '/\s+/', '-', $title );
     2289        $title = preg_replace( '|-+|', '-', $title );
     2290        $title = trim( $title, '-' );
    20182291
    20192292        return $title;
    20202293}
     
    20302303 * @since 2.5.1
    20312304 *
    20322305 * @param string $orderby Order by clause to be validated.
     2306 *
    20332307 * @return string|false Returns $orderby if valid, false otherwise.
    20342308 */
    20352309function sanitize_sql_orderby( $orderby ) {
    20362310        if ( preg_match( '/^\s*(([a-z0-9_]+|`[a-z0-9_]+`)(\s+(ASC|DESC))?\s*(,\s*(?=[a-z0-9_`])|$))+$/i', $orderby ) || preg_match( '/^\s*RAND\(\s*\)\s*$/i', $orderby ) ) {
    20372311                return $orderby;
    20382312        }
     2313
    20392314        return false;
    20402315}
    20412316
     
    20492324 *
    20502325 * @since 2.8.0
    20512326 *
    2052  * @param string $class    The classname to be sanitized
     2327 * @param string $class The classname to be sanitized
    20532328 * @param string $fallback Optional. The value to return if the sanitization ends up as an empty string.
    2054  *      Defaults to an empty string.
     2329 *    Defaults to an empty string.
     2330 *
    20552331 * @return string The sanitized value
    20562332 */
    20572333function sanitize_html_class( $class, $fallback = '' ) {
     
    20642340        if ( '' == $sanitized && $fallback ) {
    20652341                return sanitize_html_class( $fallback );
    20662342        }
     2343
    20672344        /**
    20682345         * Filters a sanitized HTML class string.
    20692346         *
    20702347         * @since 2.8.0
    20712348         *
    20722349         * @param string $sanitized The sanitized HTML class.
    2073          * @param string $class     HTML class before sanitization.
    2074          * @param string $fallback  The fallback string.
     2350         * @param string $class HTML class before sanitization.
     2351         * @param string $fallback The fallback string.
    20752352         */
    20762353        return apply_filters( 'sanitize_html_class', $sanitized, $class, $fallback );
    20772354}
     
    20812358 *
    20822359 * @since 0.71
    20832360 *
    2084  * @param string $content    String of characters to be converted.
     2361 * @param string $content String of characters to be converted.
    20852362 * @param string $deprecated Not used.
     2363 *
    20862364 * @return string Converted string.
    20872365 */
    20882366function convert_chars( $content, $deprecated = '' ) {
     
    21032381 * @since 4.3.0
    21042382 *
    21052383 * @param string $content String with entities that need converting.
     2384 *
    21062385 * @return string Converted string.
    21072386 */
    21082387function convert_invalid_entities( $content ) {
     
    21532432 *
    21542433 * @since 0.71
    21552434 *
    2156  * @param string $text  Text to be balanced
    2157  * @param bool   $force If true, forces balancing, ignoring the value of the option. Default false.
     2435 * @param string $text Text to be balanced
     2436 * @param bool $force If true, forces balancing, ignoring the value of the option. Default false.
     2437 *
    21582438 * @return string Balanced text
    21592439 */
    21602440function balanceTags( $text, $force = false ) {
    2161         if ( $force || get_option('use_balanceTags') == 1 ) {
     2441        if ( $force || get_option( 'use_balanceTags' ) == 1 ) {
    21622442                return force_balance_tags( $text );
    21632443        } else {
    21642444                return $text;
     
    21762456 * @version 1.1
    21772457 * @todo Make better - change loop condition to $text in 1.2
    21782458 * @internal Modified by Scott Reilly (coffee2code) 02 Aug 2004
    2179  *              1.1  Fixed handling of append/stack pop order of end text
    2180  *                      Added Cleaning Hooks
    2181  *              1.0  First Version
     2459 *        1.1  Fixed handling of append/stack pop order of end text
     2460 *            Added Cleaning Hooks
     2461 *        1.0  First Version
    21822462 *
    21832463 * @param string $text Text to be balanced.
     2464 *
    21842465 * @return string Balanced text.
    21852466 */
    21862467function force_balance_tags( $text ) {
    2187         $tagstack = array();
     2468        $tagstack  = array();
    21882469        $stacksize = 0;
    2189         $tagqueue = '';
    2190         $newtext = '';
     2470        $tagqueue  = '';
     2471        $newtext   = '';
    21912472        // Known single-entity/self-closing tags
    2192         $single_tags = array( 'area', 'base', 'basefont', 'br', 'col', 'command', 'embed', 'frame', 'hr', 'img', 'input', 'isindex', 'link', 'meta', 'param', 'source' );
     2473        $single_tags = array(
     2474                'area',
     2475                'base',
     2476                'basefont',
     2477                'br',
     2478                'col',
     2479                'command',
     2480                'embed',
     2481                'frame',
     2482                'hr',
     2483                'img',
     2484                'input',
     2485                'isindex',
     2486                'link',
     2487                'meta',
     2488                'param',
     2489                'source'
     2490        );
    21932491        // Tags that can be immediately nested within themselves
    21942492        $nestable_tags = array( 'blockquote', 'div', 'object', 'q', 'span' );
    21952493
    21962494        // WP bug fix for comments - in case you REALLY meant to type '< !--'
    2197         $text = str_replace('< !--', '<    !--', $text);
     2495        $text = str_replace( '< !--', '<    !--', $text );
    21982496        // WP bug fix for LOVE <3 (and other situations with '<' before a number)
    2199         $text = preg_replace('#<([0-9]{1})#', '&lt;$1', $text);
     2497        $text = preg_replace( '#<([0-9]{1})#', '&lt;$1', $text );
    22002498
    2201         while ( preg_match("/<(\/?[\w:]*)\s*([^>]*)>/", $text, $regex) ) {
     2499        while ( preg_match( "/<(\/?[\w:]*)\s*([^>]*)>/", $text, $regex ) ) {
    22022500                $newtext .= $tagqueue;
    22032501
    2204                 $i = strpos($text, $regex[0]);
    2205                 $l = strlen($regex[0]);
     2502                $i = strpos( $text, $regex[0] );
     2503                $l = strlen( $regex[0] );
    22062504
    22072505                // clear the shifter
    22082506                $tagqueue = '';
    22092507                // Pop or Push
    2210                 if ( isset($regex[1][0]) && '/' == $regex[1][0] ) { // End Tag
    2211                         $tag = strtolower(substr($regex[1],1));
     2508                if ( isset( $regex[1][0] ) && '/' == $regex[1][0] ) { // End Tag
     2509                        $tag = strtolower( substr( $regex[1], 1 ) );
    22122510                        // if too many closing tags
    22132511                        if ( $stacksize <= 0 ) {
    22142512                                $tag = '';
    22152513                                // or close to be safe $tag = '/' . $tag;
    2216                         }
    2217                         // if stacktop value = tag close value then pop
    2218                         elseif ( $tagstack[$stacksize - 1] == $tag ) { // found closing tag
     2514                        } // if stacktop value = tag close value then pop
     2515            elseif ( $tagstack[ $stacksize - 1 ] == $tag ) { // found closing tag
    22192516                                $tag = '</' . $tag . '>'; // Close Tag
    22202517                                // Pop
    22212518                                array_pop( $tagstack );
    2222                                 $stacksize--;
     2519                                $stacksize --;
    22232520                        } else { // closing tag not at top, search for it
    2224                                 for ( $j = $stacksize-1; $j >= 0; $j-- ) {
    2225                                         if ( $tagstack[$j] == $tag ) {
    2226                                         // add tag to tagqueue
    2227                                                 for ( $k = $stacksize-1; $k >= $j; $k--) {
     2521                                for ( $j = $stacksize - 1; $j >= 0; $j -- ) {
     2522                                        if ( $tagstack[ $j ] == $tag ) {
     2523                                                // add tag to tagqueue
     2524                                                for ( $k = $stacksize - 1; $k >= $j; $k -- ) {
    22282525                                                        $tagqueue .= '</' . array_pop( $tagstack ) . '>';
    2229                                                         $stacksize--;
     2526                                                        $stacksize --;
    22302527                                                }
    22312528                                                break;
    22322529                                        }
     
    22342531                                $tag = '';
    22352532                        }
    22362533                } else { // Begin Tag
    2237                         $tag = strtolower($regex[1]);
     2534                        $tag = strtolower( $regex[1] );
    22382535
    22392536                        // Tag Cleaning
    22402537
    22412538                        // If it's an empty tag "< >", do nothing
    22422539                        if ( '' == $tag ) {
    22432540                                // do nothing
    2244                         }
    2245                         // ElseIf it presents itself as a self-closing tag...
    2246                         elseif ( substr( $regex[2], -1 ) == '/' ) {
     2541                        } // ElseIf it presents itself as a self-closing tag...
     2542            elseif ( substr( $regex[2], - 1 ) == '/' ) {
    22472543                                // ...but it isn't a known single-entity self-closing tag, then don't let it be treated as such and
    22482544                                // immediately close it with a closing tag (the tag will encapsulate no text as a result)
    2249                                 if ( ! in_array( $tag, $single_tags ) )
    2250                                         $regex[2] = trim( substr( $regex[2], 0, -1 ) ) . "></$tag";
    2251                         }
    2252                         // ElseIf it's a known single-entity tag but it doesn't close itself, do so
    2253                         elseif ( in_array($tag, $single_tags) ) {
     2545                                if ( ! in_array( $tag, $single_tags ) ) {
     2546                                        $regex[2] = trim( substr( $regex[2], 0, - 1 ) ) . "></$tag";
     2547                                }
     2548                        } // ElseIf it's a known single-entity tag but it doesn't close itself, do so
     2549            elseif ( in_array( $tag, $single_tags ) ) {
    22542550                                $regex[2] .= '/';
    2255                         }
    2256                         // Else it's not a single-entity tag
     2551                        } // Else it's not a single-entity tag
    22572552                        else {
    22582553                                // If the top of the stack is the same as the tag we want to push, close previous tag
    2259                                 if ( $stacksize > 0 && !in_array($tag, $nestable_tags) && $tagstack[$stacksize - 1] == $tag ) {
     2554                                if ( $stacksize > 0 && ! in_array( $tag, $nestable_tags ) && $tagstack[ $stacksize - 1 ] == $tag ) {
    22602555                                        $tagqueue = '</' . array_pop( $tagstack ) . '>';
    2261                                         $stacksize--;
     2556                                        $stacksize --;
    22622557                                }
    22632558                                $stacksize = array_push( $tagstack, $tag );
    22642559                        }
    22652560
    22662561                        // Attributes
    22672562                        $attributes = $regex[2];
    2268                         if ( ! empty( $attributes ) && $attributes[0] != '>' )
     2563                        if ( ! empty( $attributes ) && $attributes[0] != '>' ) {
    22692564                                $attributes = ' ' . $attributes;
     2565                        }
    22702566
    22712567                        $tag = '<' . $tag . $attributes . '>';
    22722568                        //If already queuing a close tag, then put this tag on, too
    2273                         if ( !empty($tagqueue) ) {
     2569                        if ( ! empty( $tagqueue ) ) {
    22742570                                $tagqueue .= $tag;
    2275                                 $tag = '';
     2571                                $tag      = '';
    22762572                        }
    22772573                }
    2278                 $newtext .= substr($text, 0, $i) . $tag;
    2279                 $text = substr($text, $i + $l);
     2574                $newtext .= substr( $text, 0, $i ) . $tag;
     2575                $text    = substr( $text, $i + $l );
    22802576        }
    22812577
    22822578        // Clear Tag Queue
     
    22862582        $newtext .= $text;
    22872583
    22882584        // Empty Stack
    2289         while( $x = array_pop($tagstack) )
    2290                 $newtext .= '</' . $x . '>'; // Add remaining tags to close
     2585        while ( $x = array_pop( $tagstack ) ) {
     2586                $newtext .= '</' . $x . '>';
     2587        } // Add remaining tags to close
    22912588
    22922589        // WP fix for the bug with HTML comments
    2293         $newtext = str_replace("< !--","<!--",$newtext);
    2294         $newtext = str_replace("<    !--","< !--",$newtext);
     2590        $newtext = str_replace( "< !--", "<!--", $newtext );
     2591        $newtext = str_replace( "<    !--", "< !--", $newtext );
    22952592
    22962593        return $newtext;
    22972594}
     
    23062603 * @since 0.71
    23072604 * @since 4.4.0 The `$richedit` parameter was renamed to `$rich_text` for clarity.
    23082605 *
    2309  * @param string $content   The text about to be edited.
    2310  * @param bool   $rich_text Optional. Whether `$content` should be considered rich text,
     2606 * @param string $content The text about to be edited.
     2607 * @param bool $rich_text Optional. Whether `$content` should be considered rich text,
    23112608 *                          in which case it would not be passed through esc_textarea().
    23122609 *                          Default false.
     2610 *
    23132611 * @return string The text after the filter (and possibly htmlspecialchars()) has been run.
    23142612 */
    23152613function format_to_edit( $content, $rich_text = false ) {
     
    23212619         * @param string $content The text, prior to formatting for editing.
    23222620         */
    23232621        $content = apply_filters( 'format_to_edit', $content );
    2324         if ( ! $rich_text )
     2622        if ( ! $rich_text ) {
    23252623                $content = esc_textarea( $content );
     2624        }
     2625
    23262626        return $content;
    23272627}
    23282628
     
    23392639 *
    23402640 * @since 0.71
    23412641 *
    2342  * @param int $number     Number to append zeros to if not greater than threshold.
    2343  * @param int $threshold  Digit places number needs to be to not have zeros added.
     2642 * @param int $number Number to append zeros to if not greater than threshold.
     2643 * @param int $threshold Digit places number needs to be to not have zeros added.
     2644 *
    23442645 * @return string Adds leading zeros to number if needed.
    23452646 */
    23462647function zeroise( $number, $threshold ) {
     
    23532654 * @since 0.71
    23542655 *
    23552656 * @param string $string Value to which backslashes will be added.
     2657 *
    23562658 * @return string String with backslashes inserted.
    23572659 */
    23582660function backslashit( $string ) {
    2359         if ( isset( $string[0] ) && $string[0] >= '0' && $string[0] <= '9' )
     2661        if ( isset( $string[0] ) && $string[0] >= '0' && $string[0] <= '9' ) {
    23602662                $string = '\\\\' . $string;
     2663        }
     2664
    23612665        return addcslashes( $string, 'A..Za..z' );
    23622666}
    23632667
     
    23732677 * @since 1.2.0
    23742678 *
    23752679 * @param string $string What to add the trailing slash to.
     2680 *
    23762681 * @return string String with trailing slash added.
    23772682 */
    23782683function trailingslashit( $string ) {
     
    23882693 * @since 2.2.0
    23892694 *
    23902695 * @param string $string What to remove the trailing slashes from.
     2696 *
    23912697 * @return string String without the trailing slashes.
    23922698 */
    23932699function untrailingslashit( $string ) {
     
    24032709 * @since 0.71
    24042710 *
    24052711 * @param string $gpc The string returned from HTTP request data.
     2712 *
    24062713 * @return string Returns a string escaped with slashes.
    24072714 */
    2408 function addslashes_gpc($gpc) {
    2409         if ( get_magic_quotes_gpc() )
    2410                 $gpc = stripslashes($gpc);
     2715function addslashes_gpc( $gpc ) {
     2716        if ( get_magic_quotes_gpc() ) {
     2717                $gpc = stripslashes( $gpc );
     2718        }
    24112719
    2412         return wp_slash($gpc);
     2720        return wp_slash( $gpc );
    24132721}
    24142722
    24152723/**
     
    24182726 * @since 2.0.0
    24192727 *
    24202728 * @param mixed $value The value to be stripped.
     2729 *
    24212730 * @return mixed Stripped value.
    24222731 */
    24232732function stripslashes_deep( $value ) {
     
    24302739 * @since 4.4.0
    24312740 *
    24322741 * @param mixed $value The array or string to be stripped.
     2742 *
    24332743 * @return mixed $value The stripped value.
    24342744 */
    24352745function stripslashes_from_strings_only( $value ) {
     
    24422752 * @since 2.2.0
    24432753 *
    24442754 * @param mixed $value The array or string to be encoded.
     2755 *
    24452756 * @return mixed $value The encoded value.
    24462757 */
    24472758function urlencode_deep( $value ) {
     
    24542765 * @since 3.4.0
    24552766 *
    24562767 * @param mixed $value The array or string to be encoded.
     2768 *
    24572769 * @return mixed $value The encoded value.
    24582770 */
    24592771function rawurlencode_deep( $value ) {
     
    24662778 * @since 4.4.0
    24672779 *
    24682780 * @param mixed $value The array or string to be decoded.
     2781 *
    24692782 * @return mixed $value The decoded value.
    24702783 */
    24712784function urldecode_deep( $value ) {
     
    24782791 * @since 0.71
    24792792 *
    24802793 * @param string $email_address Email address.
    2481  * @param int    $hex_encoding  Optional. Set to 1 to enable hex encoding.
     2794 * @param int $hex_encoding Optional. Set to 1 to enable hex encoding.
     2795 *
    24822796 * @return string Converted email address.
    24832797 */
    24842798function antispambot( $email_address, $hex_encoding = 0 ) {
    24852799        $email_no_spam_address = '';
    2486         for ( $i = 0, $len = strlen( $email_address ); $i < $len; $i++ ) {
     2800        for ( $i = 0, $len = strlen( $email_address ); $i < $len; $i ++ ) {
    24872801                $j = rand( 0, 1 + $hex_encoding );
    24882802                if ( $j == 0 ) {
    2489                         $email_no_spam_address .= '&#' . ord( $email_address[$i] ) . ';';
     2803                        $email_no_spam_address .= '&#' . ord( $email_address[ $i ] ) . ';';
    24902804                } elseif ( $j == 1 ) {
    2491                         $email_no_spam_address .= $email_address[$i];
     2805                        $email_no_spam_address .= $email_address[ $i ];
    24922806                } elseif ( $j == 2 ) {
    2493                         $email_no_spam_address .= '%' . zeroise( dechex( ord( $email_address[$i] ) ), 2 );
     2807                        $email_no_spam_address .= '%' . zeroise( dechex( ord( $email_address[ $i ] ) ), 2 );
    24942808                }
    24952809        }
    24962810
     
    25062820 * @access private
    25072821 *
    25082822 * @param array $matches Single Regex Match.
     2823 *
    25092824 * @return string HTML A element with URI address.
    25102825 */
    25112826function _make_url_clickable_cb( $matches ) {
     
    25142829        if ( ')' == $matches[3] && strpos( $url, '(' ) ) {
    25152830                // If the trailing character is a closing parethesis, and the URL has an opening parenthesis in it, add the closing parenthesis to the URL.
    25162831                // Then we can let the parenthesis balancer do its thing below.
    2517                 $url .= $matches[3];
     2832                $url    .= $matches[3];
    25182833                $suffix = '';
    25192834        } else {
    25202835                $suffix = $matches[3];
     
    25232838        // Include parentheses in the URL only if paired
    25242839        while ( substr_count( $url, '(' ) < substr_count( $url, ')' ) ) {
    25252840                $suffix = strrchr( $url, ')' ) . $suffix;
    2526                 $url = substr( $url, 0, strrpos( $url, ')' ) );
     2841                $url    = substr( $url, 0, strrpos( $url, ')' ) );
    25272842        }
    25282843
    2529         $url = esc_url($url);
    2530         if ( empty($url) )
     2844        $url = esc_url( $url );
     2845        if ( empty( $url ) ) {
    25312846                return $matches[0];
     2847        }
    25322848
    25332849        return $matches[1] . "<a href=\"$url\" rel=\"nofollow\">$url</a>" . $suffix;
    25342850}
     
    25422858 * @access private
    25432859 *
    25442860 * @param array $matches Single Regex Match.
     2861 *
    25452862 * @return string HTML A element with URL address.
    25462863 */
    25472864function _make_web_ftp_clickable_cb( $matches ) {
    2548         $ret = '';
     2865        $ret  = '';
    25492866        $dest = $matches[2];
    25502867        $dest = 'http://' . $dest;
    25512868
    25522869        // removed trailing [.,;:)] from URL
    2553         if ( in_array( substr($dest, -1), array('.', ',', ';', ':', ')') ) === true ) {
    2554                 $ret = substr($dest, -1);
    2555                 $dest = substr($dest, 0, strlen($dest)-1);
     2870        if ( in_array( substr( $dest, - 1 ), array( '.', ',', ';', ':', ')' ) ) === true ) {
     2871                $ret  = substr( $dest, - 1 );
     2872                $dest = substr( $dest, 0, strlen( $dest ) - 1 );
    25562873        }
    25572874
    2558         $dest = esc_url($dest);
    2559         if ( empty($dest) )
     2875        $dest = esc_url( $dest );
     2876        if ( empty( $dest ) ) {
    25602877                return $matches[0];
     2878        }
    25612879
    25622880        return $matches[1] . "<a href=\"$dest\" rel=\"nofollow\">$dest</a>$ret";
    25632881}
     
    25712889 * @access private
    25722890 *
    25732891 * @param array $matches Single Regex Match.
     2892 *
    25742893 * @return string HTML A element with email address.
    25752894 */
    25762895function _make_email_clickable_cb( $matches ) {
    25772896        $email = $matches[2] . '@' . $matches[3];
     2897
    25782898        return $matches[1] . "<a href=\"mailto:$email\">$email</a>";
    25792899}
    25802900
     
    25872907 * @since 0.71
    25882908 *
    25892909 * @param string $text Content to convert URIs.
     2910 *
    25902911 * @return string Content with converted URIs.
    25912912 */
    25922913function make_clickable( $text ) {
    2593         $r = '';
    2594         $textarr = preg_split( '/(<[^<>]+>)/', $text, -1, PREG_SPLIT_DELIM_CAPTURE ); // split out HTML tags
     2914        $r               = '';
     2915        $textarr         = preg_split( '/(<[^<>]+>)/', $text, - 1, PREG_SPLIT_DELIM_CAPTURE ); // split out HTML tags
    25952916        $nested_code_pre = 0; // Keep track of how many levels link is nested inside <pre> or <code>
    25962917        foreach ( $textarr as $piece ) {
    25972918
    2598                 if ( preg_match( '|^<code[\s>]|i', $piece ) || preg_match( '|^<pre[\s>]|i', $piece ) || preg_match( '|^<script[\s>]|i', $piece ) || preg_match( '|^<style[\s>]|i', $piece ) )
    2599                         $nested_code_pre++;
    2600                 elseif ( $nested_code_pre && ( '</code>' === strtolower( $piece ) || '</pre>' === strtolower( $piece ) || '</script>' === strtolower( $piece ) || '</style>' === strtolower( $piece ) ) )
    2601                         $nested_code_pre--;
     2919                if ( preg_match( '|^<code[\s>]|i', $piece ) || preg_match( '|^<pre[\s>]|i', $piece ) || preg_match( '|^<script[\s>]|i', $piece ) || preg_match( '|^<style[\s>]|i', $piece ) ) {
     2920                        $nested_code_pre ++;
     2921                } elseif ( $nested_code_pre && ( '</code>' === strtolower( $piece ) || '</pre>' === strtolower( $piece ) || '</script>' === strtolower( $piece ) || '</style>' === strtolower( $piece ) ) ) {
     2922                        $nested_code_pre --;
     2923                }
    26022924
    26032925                if ( $nested_code_pre || empty( $piece ) || ( $piece[0] === '<' && ! preg_match( '|^<\s*[\w]{1,20}+://|', $piece ) ) ) {
    26042926                        $r .= $piece;
     
    26312953                                )
    26322954                                (\)?)                                                  # 3: Trailing closing parenthesis (for parethesis balancing post processing)
    26332955                        ~xS'; // The regex is a non-anchored pattern and does not have a single fixed starting character.
    2634                               // Tell PCRE to spend more time optimizing since, when used on a page load, it will probably be used several times.
     2956                        // Tell PCRE to spend more time optimizing since, when used on a page load, it will probably be used several times.
    26352957
    26362958                        $ret = preg_replace_callback( $url_clickable, '_make_url_clickable_cb', $ret );
    26372959
    26382960                        $ret = preg_replace_callback( '#([\s>])((www|ftp)\.[\w\\x80-\\xff\#$%&~/.\-;:=,?@\[\]+]+)#is', '_make_web_ftp_clickable_cb', $ret );
    26392961                        $ret = preg_replace_callback( '#([\s>])([.0-9a-z_+-]+)@(([0-9a-z-]+\.)+[0-9a-z]{2,})#i', '_make_email_clickable_cb', $ret );
    26402962
    2641                         $ret = substr( $ret, 1, -1 ); // Remove our whitespace padding.
    2642                         $r .= $ret;
     2963                        $ret = substr( $ret, 1, - 1 ); // Remove our whitespace padding.
     2964                        $r   .= $ret;
    26432965                }
    26442966        }
    26452967
     
    26732995 * @access private
    26742996 *
    26752997 * @param string $string The string to split.
    2676  * @param int    $goal   The desired chunk length.
     2998 * @param int $goal The desired chunk length.
     2999 *
    26773000 * @return array Numeric array of chunks.
    26783001 */
    26793002function _split_str_by_whitespace( $string, $goal ) {
     
    26913014                        }
    26923015                }
    26933016
    2694                 $chunks[] = substr( $string, 0, $pos + 1 );
    2695                 $string = substr( $string, $pos + 1 );
     3017                $chunks[]         = substr( $string, 0, $pos + 1 );
     3018                $string           = substr( $string, $pos + 1 );
    26963019                $string_nullspace = substr( $string_nullspace, $pos + 1 );
    26973020        }
    26983021
     
    27093032 * @since 1.5.0
    27103033 *
    27113034 * @param string $text Content that may contain HTML A elements.
     3035 *
    27123036 * @return string Converted content.
    27133037 */
    27143038function wp_rel_nofollow( $text ) {
    27153039        // This is a pre save filter, so text is already escaped.
    2716         $text = stripslashes($text);
    2717         $text = preg_replace_callback('|<a (.+?)>|i', 'wp_rel_nofollow_callback', $text);
     3040        $text = stripslashes( $text );
     3041        $text = preg_replace_callback( '|<a (.+?)>|i', 'wp_rel_nofollow_callback', $text );
     3042
    27183043        return wp_slash( $text );
    27193044}
    27203045
     
    27273052 * @since 2.3.0
    27283053 *
    27293054 * @param array $matches Single Match
     3055 *
    27303056 * @return string HTML A Element with rel nofollow.
    27313057 */
    27323058function wp_rel_nofollow_callback( $matches ) {
     
    27543080                }
    27553081                $text = trim( $html );
    27563082        }
     3083
    27573084        return "<a $text rel=\"$rel\">";
    27583085}
    27593086
     
    27703097 * @global array $wpsmiliestrans
    27713098 *
    27723099 * @param array $matches Single match. Smiley code to convert to image.
     3100 *
    27733101 * @return string Image string for smiley.
    27743102 */
    27753103function translate_smiley( $matches ) {
    27763104        global $wpsmiliestrans;
    27773105
    2778         if ( count( $matches ) == 0 )
     3106        if ( count( $matches ) == 0 ) {
    27793107                return '';
     3108        }
    27803109
    27813110        $smiley = trim( reset( $matches ) );
    2782         $img = $wpsmiliestrans[ $smiley ];
     3111        $img    = $wpsmiliestrans[ $smiley ];
    27833112
    2784         $matches = array();
    2785         $ext = preg_match( '/\.([^.]+)$/', $img, $matches ) ? strtolower( $matches[1] ) : false;
     3113        $matches    = array();
     3114        $ext        = preg_match( '/\.([^.]+)$/', $img, $matches ) ? strtolower( $matches[1] ) : false;
    27863115        $image_exts = array( 'jpg', 'jpeg', 'jpe', 'gif', 'png' );
    27873116
    27883117        // Don't convert smilies that aren't images - they're probably emoji.
     
    27963125         * @since 2.9.0
    27973126         *
    27983127         * @param string $smiley_url URL for the smiley image.
    2799          * @param string $img        Filename for the smiley image.
    2800          * @param string $site_url   Site URL, as returned by site_url().
     3128         * @param string $img Filename for the smiley image.
     3129         * @param string $site_url Site URL, as returned by site_url().
    28013130         */
    28023131        $src_url = apply_filters( 'smilies_src', includes_url( "images/smilies/$img" ), $img, site_url() );
    28033132
     
    28153144 * @global string|array $wp_smiliessearch
    28163145 *
    28173146 * @param string $text Content to convert smilies from text.
     3147 *
    28183148 * @return string Converted content with text smilies replaced with images.
    28193149 */
    28203150function convert_smilies( $text ) {
     
    28223152        $output = '';
    28233153        if ( get_option( 'use_smilies' ) && ! empty( $wp_smiliessearch ) ) {
    28243154                // HTML loop taken from texturize function, could possible be consolidated
    2825                 $textarr = preg_split( '/(<.*>)/U', $text, -1, PREG_SPLIT_DELIM_CAPTURE ); // capture the tags as well as in between
    2826                 $stop = count( $textarr );// loop stuff
     3155                $textarr = preg_split( '/(<.*>)/U', $text, - 1, PREG_SPLIT_DELIM_CAPTURE ); // capture the tags as well as in between
     3156                $stop    = count( $textarr );// loop stuff
    28273157
    28283158                // Ignore proessing of specific tags
    2829                 $tags_to_ignore = 'code|pre|style|script|textarea';
     3159                $tags_to_ignore       = 'code|pre|style|script|textarea';
    28303160                $ignore_block_element = '';
    28313161
    2832                 for ( $i = 0; $i < $stop; $i++ ) {
    2833                         $content = $textarr[$i];
     3162                for ( $i = 0; $i < $stop; $i ++ ) {
     3163                        $content = $textarr[ $i ];
    28343164
    28353165                        // If we're in an ignore block, wait until we find its closing tag
    2836                         if ( '' == $ignore_block_element && preg_match( '/^<(' . $tags_to_ignore . ')>/', $content, $matches ) )  {
     3166                        if ( '' == $ignore_block_element && preg_match( '/^<(' . $tags_to_ignore . ')>/', $content, $matches ) ) {
    28373167                                $ignore_block_element = $matches[1];
    28383168                        }
    28393169
    28403170                        // If it's not a tag and not in ignore block
    2841                         if ( '' ==  $ignore_block_element && strlen( $content ) > 0 && '<' != $content[0] ) {
     3171                        if ( '' == $ignore_block_element && strlen( $content ) > 0 && '<' != $content[0] ) {
    28423172                                $content = preg_replace_callback( $wp_smiliessearch, 'translate_smiley', $content );
    28433173                        }
    28443174
    28453175                        // did we exit ignore block
    2846                         if ( '' != $ignore_block_element && '</' . $ignore_block_element . '>' == $content )  {
     3176                        if ( '' != $ignore_block_element && '</' . $ignore_block_element . '>' == $content ) {
    28473177                                $ignore_block_element = '';
    28483178                        }
    28493179
     
    28533183                // return default text.
    28543184                $output = $text;
    28553185        }
     3186
    28563187        return $output;
    28573188}
    28583189
     
    28633194 *
    28643195 * @since 0.71
    28653196 *
    2866  * @param string $email      Email address to verify.
    2867  * @param bool   $deprecated Deprecated.
     3197 * @param string $email Email address to verify.
     3198 * @param bool $deprecated Deprecated.
     3199 *
    28683200 * @return string|bool Either false or the valid email address.
    28693201 */
    28703202function is_email( $email, $deprecated = false ) {
    2871         if ( ! empty( $deprecated ) )
     3203        if ( ! empty( $deprecated ) ) {
    28723204                _deprecated_argument( __FUNCTION__, '3.0.0' );
     3205        }
    28733206
    28743207        // Test for the minimum length the email can be
    28753208        if ( strlen( $email ) < 3 ) {
     
    28823215                 *
    28833216                 * @since 2.8.0
    28843217                 *
    2885                  * @param bool   $is_email Whether the email address has passed the is_email() checks. Default false.
    2886                  * @param string $email    The email address being checked.
    2887                  * @param string $context  Context under which the email was tested.
     3218                 * @param bool $is_email Whether the email address has passed the is_email() checks. Default false.
     3219                 * @param string $email The email address being checked.
     3220                 * @param string $context Context under which the email was tested.
    28883221                 */
    28893222                return apply_filters( 'is_email', false, $email, 'email_too_short' );
    28903223        }
     
    29003233
    29013234        // LOCAL PART
    29023235        // Test for invalid characters
    2903         if ( !preg_match( '/^[a-zA-Z0-9!#$%&\'*+\/=?^_`{|}~\.-]+$/', $local ) ) {
     3236        if ( ! preg_match( '/^[a-zA-Z0-9!#$%&\'*+\/=?^_`{|}~\.-]+$/', $local ) ) {
    29043237                /** This filter is documented in wp-includes/formatting.php */
    29053238                return apply_filters( 'is_email', false, $email, 'local_invalid_chars' );
    29063239        }
     
    29363269                }
    29373270
    29383271                // Test for invalid characters
    2939                 if ( !preg_match('/^[a-z0-9-]+$/i', $sub ) ) {
     3272                if ( ! preg_match( '/^[a-z0-9-]+$/i', $sub ) ) {
    29403273                        /** This filter is documented in wp-includes/formatting.php */
    29413274                        return apply_filters( 'is_email', false, $email, 'sub_invalid_chars' );
    29423275                }
    29433276        }
    29443277
    29453278        // Congratulations your email made it!
     3279
    29463280        /** This filter is documented in wp-includes/formatting.php */
    29473281        return apply_filters( 'is_email', $email, $email, null );
    29483282}
     
    29533287 * @since 1.2.0
    29543288 *
    29553289 * @param string $string Subject line
     3290 *
    29563291 * @return string Converted string to ASCII
    29573292 */
    29583293function wp_iso_descrambler( $string ) {
    29593294        /* this may only work with iso-8859-1, I'm afraid */
    2960         if (!preg_match('#\=\?(.+)\?Q\?(.+)\?\=#i', $string, $matches)) {
     3295        if ( ! preg_match( '#\=\?(.+)\?Q\?(.+)\?\=#i', $string, $matches ) ) {
    29613296                return $string;
    29623297        } else {
    2963                 $subject = str_replace('_', ' ', $matches[2]);
     3298                $subject = str_replace( '_', ' ', $matches[2] );
     3299
    29643300                return preg_replace_callback( '#\=([0-9a-f]{2})#i', '_wp_iso_convert', $subject );
    29653301        }
    29663302}
     
    29723308 * @access private
    29733309 *
    29743310 * @param array $match The preg_replace_callback matches array
     3311 *
    29753312 * @return string Converted chars
    29763313 */
    29773314function _wp_iso_convert( $match ) {
     
    29903327 *
    29913328 * @param string $string The date to be converted.
    29923329 * @param string $format The format string for the returned date (default is Y-m-d H:i:s)
     3330 *
    29933331 * @return string GMT version of the date provided.
    29943332 */
    29953333function get_gmt_from_date( $string, $format = 'Y-m-d H:i:s' ) {
     
    30073345                        if ( false === $datetime ) {
    30083346                                return gmdate( $format, 0 );
    30093347                        }
     3348
    30103349                        return gmdate( $format, $datetime );
    30113350                }
    30123351                $string_time = gmmktime( $matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1] );
    3013                 $string_gmt = gmdate( $format, $string_time - get_option( 'gmt_offset' ) * HOUR_IN_SECONDS );
     3352                $string_gmt  = gmdate( $format, $string_time - get_option( 'gmt_offset' ) * HOUR_IN_SECONDS );
    30143353        }
     3354
    30153355        return $string_gmt;
    30163356}
    30173357
     
    30273367 *
    30283368 * @param string $string The date to be converted.
    30293369 * @param string $format The format string for the returned date (default is Y-m-d H:i:s)
     3370 *
    30303371 * @return string Formatted date relative to the timezone / GMT offset.
    30313372 */
    30323373function get_date_from_gmt( $string, $format = 'Y-m-d H:i:s' ) {
    30333374        $tz = get_option( 'timezone_string' );
    30343375        if ( $tz ) {
    30353376                $datetime = date_create( $string, new DateTimeZone( 'UTC' ) );
    3036                 if ( ! $datetime )
     3377                if ( ! $datetime ) {
    30373378                        return date( $format, 0 );
     3379                }
    30383380                $datetime->setTimezone( new DateTimeZone( $tz ) );
    30393381                $string_localtime = $datetime->format( $format );
    30403382        } else {
    3041                 if ( ! preg_match('#([0-9]{1,4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})#', $string, $matches) )
     3383                if ( ! preg_match( '#([0-9]{1,4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})#', $string, $matches ) ) {
    30423384                        return date( $format, 0 );
    3043                 $string_time = gmmktime( $matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1] );
     3385                }
     3386                $string_time      = gmmktime( $matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1] );
    30443387                $string_localtime = gmdate( $format, $string_time + get_option( 'gmt_offset' ) * HOUR_IN_SECONDS );
    30453388        }
     3389
    30463390        return $string_localtime;
    30473391}
    30483392
     
    30523396 * @since 1.5.0
    30533397 *
    30543398 * @param string $timezone Either 'Z' for 0 offset or '±hhmm'.
     3399 *
    30553400 * @return int|float The offset in seconds.
    30563401 */
    30573402function iso8601_timezone_to_offset( $timezone ) {
    30583403        // $timezone is either 'Z' or '[+|-]hhmm'
    3059         if ($timezone == 'Z') {
     3404        if ( $timezone == 'Z' ) {
    30603405                $offset = 0;
    30613406        } else {
    3062                 $sign    = (substr($timezone, 0, 1) == '+') ? 1 : -1;
    3063                 $hours   = intval(substr($timezone, 1, 2));
    3064                 $minutes = intval(substr($timezone, 3, 4)) / 60;
    3065                 $offset  = $sign * HOUR_IN_SECONDS * ($hours + $minutes);
     3407                $sign    = ( substr( $timezone, 0, 1 ) == '+' ) ? 1 : - 1;
     3408                $hours   = intval( substr( $timezone, 1, 2 ) );
     3409                $minutes = intval( substr( $timezone, 3, 4 ) ) / 60;
     3410                $offset  = $sign * HOUR_IN_SECONDS * ( $hours + $minutes );
    30663411        }
     3412
    30673413        return $offset;
    30683414}
    30693415
     
    30733419 * @since 1.5.0
    30743420 *
    30753421 * @param string $date_string Date and time in ISO 8601 format {@link https://en.wikipedia.org/wiki/ISO_8601}.
    3076  * @param string $timezone    Optional. If set to GMT returns the time minus gmt_offset. Default is 'user'.
     3422 * @param string $timezone Optional. If set to GMT returns the time minus gmt_offset. Default is 'user'.
     3423 *
    30773424 * @return string The date and time in MySQL DateTime format - Y-m-d H:i:s.
    30783425 */
    30793426function iso8601_to_datetime( $date_string, $timezone = 'user' ) {
    3080         $timezone = strtolower($timezone);
     3427        $timezone = strtolower( $timezone );
    30813428
    3082         if ($timezone == 'gmt') {
     3429        if ( $timezone == 'gmt' ) {
    30833430
    3084                 preg_match('#([0-9]{4})([0-9]{2})([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(Z|[\+|\-][0-9]{2,4}){0,1}#', $date_string, $date_bits);
     3431                preg_match( '#([0-9]{4})([0-9]{2})([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(Z|[\+|\-][0-9]{2,4}){0,1}#', $date_string, $date_bits );
    30853432
    3086                 if (!empty($date_bits[7])) { // we have a timezone, so let's compute an offset
    3087                         $offset = iso8601_timezone_to_offset($date_bits[7]);
     3433                if ( ! empty( $date_bits[7] ) ) { // we have a timezone, so let's compute an offset
     3434                        $offset = iso8601_timezone_to_offset( $date_bits[7] );
    30883435                } else { // we don't have a timezone, so we assume user local timezone (not server's!)
    3089                         $offset = HOUR_IN_SECONDS * get_option('gmt_offset');
     3436                        $offset = HOUR_IN_SECONDS * get_option( 'gmt_offset' );
    30903437                }
    30913438
    3092                 $timestamp = gmmktime($date_bits[4], $date_bits[5], $date_bits[6], $date_bits[2], $date_bits[3], $date_bits[1]);
     3439                $timestamp = gmmktime( $date_bits[4], $date_bits[5], $date_bits[6], $date_bits[2], $date_bits[3], $date_bits[1] );
    30933440                $timestamp -= $offset;
    30943441
    3095                 return gmdate('Y-m-d H:i:s', $timestamp);
     3442                return gmdate( 'Y-m-d H:i:s', $timestamp );
    30963443
    3097         } elseif ($timezone == 'user') {
    3098                 return preg_replace('#([0-9]{4})([0-9]{2})([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(Z|[\+|\-][0-9]{2,4}){0,1}#', '$1-$2-$3 $4:$5:$6', $date_string);
     3444        } elseif ( $timezone == 'user' ) {
     3445                return preg_replace( '#([0-9]{4})([0-9]{2})([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(Z|[\+|\-][0-9]{2,4}){0,1}#', '$1-$2-$3 $4:$5:$6', $date_string );
    30993446        }
    31003447}
    31013448
     
    31053452 * @since 1.5.0
    31063453 *
    31073454 * @param string $email Email address to filter.
     3455 *
    31083456 * @return string Filtered email address.
    31093457 */
    31103458function sanitize_email( $email ) {
     
    31193467                 *
    31203468                 * @since 2.8.0
    31213469                 *
    3122                  * @param string $email   The sanitized email address.
    3123                  * @param string $email   The email address, as provided to sanitize_email().
     3470                 * @param string $email The sanitized email address.
     3471                 * @param string $email The email address, as provided to sanitize_email().
    31243472                 * @param string $message A message to pass to the user.
    31253473                 */
    31263474                return apply_filters( 'sanitize_email', '', $email, 'email_too_short' );
     
    31973545        $email = $local . '@' . $domain;
    31983546
    31993547        // Congratulations your email made it!
     3548
    32003549        /** This filter is documented in wp-includes/formatting.php */
    32013550        return apply_filters( 'sanitize_email', $email, $email, null );
    32023551}
     
    32103559 * @since 1.5.0
    32113560 *
    32123561 * @param int $from Unix timestamp from which the difference begins.
    3213  * @param int $to   Optional. Unix timestamp to end the time difference. Default becomes time() if not set.
     3562 * @param int $to Optional. Unix timestamp to end the time difference. Default becomes time() if not set.
     3563 *
    32143564 * @return string Human readable time difference.
    32153565 */
    32163566function human_time_diff( $from, $to = '' ) {
     
    32223572
    32233573        if ( $diff < HOUR_IN_SECONDS ) {
    32243574                $mins = round( $diff / MINUTE_IN_SECONDS );
    3225                 if ( $mins <= 1 )
     3575                if ( $mins <= 1 ) {
    32263576                        $mins = 1;
     3577                }
    32273578                /* translators: Time difference between two dates, in minutes (min=minute). 1: Number of minutes */
    32283579                $since = sprintf( _n( '%s min', '%s mins', $mins ), $mins );
    32293580        } elseif ( $diff < DAY_IN_SECONDS && $diff >= HOUR_IN_SECONDS ) {
    32303581                $hours = round( $diff / HOUR_IN_SECONDS );
    3231                 if ( $hours <= 1 )
     3582                if ( $hours <= 1 ) {
    32323583                        $hours = 1;
     3584                }
    32333585                /* translators: Time difference between two dates, in hours. 1: Number of hours */
    32343586                $since = sprintf( _n( '%s hour', '%s hours', $hours ), $hours );
    32353587        } elseif ( $diff < WEEK_IN_SECONDS && $diff >= DAY_IN_SECONDS ) {
    32363588                $days = round( $diff / DAY_IN_SECONDS );
    3237                 if ( $days <= 1 )
     3589                if ( $days <= 1 ) {
    32383590                        $days = 1;
     3591                }
    32393592                /* translators: Time difference between two dates, in days. 1: Number of days */
    32403593                $since = sprintf( _n( '%s day', '%s days', $days ), $days );
    32413594        } elseif ( $diff < MONTH_IN_SECONDS && $diff >= WEEK_IN_SECONDS ) {
    32423595                $weeks = round( $diff / WEEK_IN_SECONDS );
    3243                 if ( $weeks <= 1 )
     3596                if ( $weeks <= 1 ) {
    32443597                        $weeks = 1;
     3598                }
    32453599                /* translators: Time difference between two dates, in weeks. 1: Number of weeks */
    32463600                $since = sprintf( _n( '%s week', '%s weeks', $weeks ), $weeks );
    32473601        } elseif ( $diff < YEAR_IN_SECONDS && $diff >= MONTH_IN_SECONDS ) {
    32483602                $months = round( $diff / MONTH_IN_SECONDS );
    3249                 if ( $months <= 1 )
     3603                if ( $months <= 1 ) {
    32503604                        $months = 1;
     3605                }
    32513606                /* translators: Time difference between two dates, in months. 1: Number of months */
    32523607                $since = sprintf( _n( '%s month', '%s months', $months ), $months );
    32533608        } elseif ( $diff >= YEAR_IN_SECONDS ) {
    32543609                $years = round( $diff / YEAR_IN_SECONDS );
    3255                 if ( $years <= 1 )
     3610                if ( $years <= 1 ) {
    32563611                        $years = 1;
     3612                }
    32573613                /* translators: Time difference between two dates, in years. 1: Number of years */
    32583614                $since = sprintf( _n( '%s year', '%s years', $years ), $years );
    32593615        }
     
    32643620         * @since 4.0.0
    32653621         *
    32663622         * @param string $since The difference in human readable text.
    3267          * @param int    $diff The difference in seconds.
    3268          * @param int    $from Unix timestamp from which the difference begins.
    3269          * @param int    $to    Unix timestamp to end the time difference.
     3623         * @param int $diff The difference in seconds.
     3624         * @param int $from Unix timestamp from which the difference begins.
     3625         * @param int $to Unix timestamp to end the time difference.
    32703626         */
    32713627        return apply_filters( 'human_time_diff', $since, $diff, $from, $to );
    32723628}
     
    32843640 * @since 1.5.0
    32853641 *
    32863642 * @param string $text Optional. The excerpt. If set to empty, an excerpt is generated.
     3643 *
    32873644 * @return string The excerpt.
    32883645 */
    32893646function wp_trim_excerpt( $text = '' ) {
    32903647        $raw_excerpt = $text;
    32913648        if ( '' == $text ) {
    3292                 $text = get_the_content('');
     3649                $text = get_the_content( '' );
    32933650
    32943651                $text = strip_shortcodes( $text );
    32953652
    32963653                /** This filter is documented in wp-includes/post-template.php */
    32973654                $text = apply_filters( 'the_content', $text );
    3298                 $text = str_replace(']]>', ']]&gt;', $text);
     3655                $text = str_replace( ']]>', ']]&gt;', $text );
    32993656
    33003657                /**
    33013658                 * Filters the number of words in an excerpt.
     
    33133670                 * @param string $more_string The string shown within the more link.
    33143671                 */
    33153672                $excerpt_more = apply_filters( 'excerpt_more', ' ' . '[&hellip;]' );
    3316                 $text = wp_trim_words( $text, $excerpt_length, $excerpt_more );
     3673                $text         = wp_trim_words( $text, $excerpt_length, $excerpt_more );
    33173674        }
     3675
    33183676        /**
    33193677         * Filters the trimmed excerpt string.
    33203678         *
    33213679         * @since 2.8.0
    33223680         *
    3323          * @param string $text        The trimmed text.
     3681         * @param string $text The trimmed text.
    33243682         * @param string $raw_excerpt The text prior to trimming.
    33253683         */
    33263684        return apply_filters( 'wp_trim_excerpt', $text, $raw_excerpt );
     
    33353693 *
    33363694 * @since 3.3.0
    33373695 *
    3338  * @param string $text      Text to trim.
    3339  * @param int    $num_words Number of words. Default 55.
    3340  * @param string $more      Optional. What to append if $text needs to be trimmed. Default '&hellip;'.
     3696 * @param string $text Text to trim.
     3697 * @param int $num_words Number of words. Default 55.
     3698 * @param string $more Optional. What to append if $text needs to be trimmed. Default '&hellip;'.
     3699 *
    33413700 * @return string Trimmed text.
    33423701 */
    33433702function wp_trim_words( $text, $num_words = 55, $more = null ) {
     
    33463705        }
    33473706
    33483707        $original_text = $text;
    3349         $text = wp_strip_all_tags( $text );
     3708        $text          = wp_strip_all_tags( $text );
    33503709
    33513710        /*
    33523711         * translators: If your word count is based on single characters (e.g. East Asian characters),
     
    33573716                $text = trim( preg_replace( "/[\n\r\t ]+/", ' ', $text ), ' ' );
    33583717                preg_match_all( '/./u', $text, $words_array );
    33593718                $words_array = array_slice( $words_array[0], 0, $num_words + 1 );
    3360                 $sep = '';
     3719                $sep         = '';
    33613720        } else {
    33623721                $words_array = preg_split( "/[\n\r\t ]+/", $text, $num_words + 1, PREG_SPLIT_NO_EMPTY );
    3363                 $sep = ' ';
     3722                $sep         = ' ';
    33643723        }
    33653724
    33663725        if ( count( $words_array ) > $num_words ) {
     
    33763735         *
    33773736         * @since 3.3.0
    33783737         *
    3379          * @param string $text          The trimmed text.
    3380          * @param int    $num_words    The number of words to trim the text to. Default 55.
    3381          * @param string $more          An optional string to append to the end of the trimmed text, e.g. &hellip;.
     3738         * @param string $text The trimmed text.
     3739         * @param int $num_words The number of words to trim the text to. Default 55.
     3740         * @param string $more An optional string to append to the end of the trimmed text, e.g. &hellip;.
    33823741         * @param string $original_text The text before it was trimmed.
    33833742         */
    33843743        return apply_filters( 'wp_trim_words', $text, $num_words, $more, $original_text );
     
    33903749 * @since 1.5.1
    33913750 *
    33923751 * @param string $text The text within which entities will be converted.
     3752 *
    33933753 * @return string Text with converted entities.
    33943754 */
    33953755function ent2ncr( $text ) {
     
    34013761         *
    34023762         * @since 3.3.0
    34033763         *
    3404          * @param null   $converted_text The text to be converted. Default null.
    3405          * @param string $text           The text prior to entity conversion.
     3764         * @param null $converted_text The text to be converted. Default null.
     3765         * @param string $text The text prior to entity conversion.
    34063766         */
    34073767        $filtered = apply_filters( 'pre_ent2ncr', null, $text );
    3408         if ( null !== $filtered )
     3768        if ( null !== $filtered ) {
    34093769                return $filtered;
     3770        }
    34103771
    34113772        $to_ncr = array(
    3412                 '&quot;' => '&#34;',
    3413                 '&amp;' => '&#38;',
    3414                 '&lt;' => '&#60;',
    3415                 '&gt;' => '&#62;',
    3416                 '|' => '&#124;',
    3417                 '&nbsp;' => '&#160;',
    3418                 '&iexcl;' => '&#161;',
    3419                 '&cent;' => '&#162;',
    3420                 '&pound;' => '&#163;',
    3421                 '&curren;' => '&#164;',
    3422                 '&yen;' => '&#165;',
    3423                 '&brvbar;' => '&#166;',
    3424                 '&brkbar;' => '&#166;',
    3425                 '&sect;' => '&#167;',
    3426                 '&uml;' => '&#168;',
    3427                 '&die;' => '&#168;',
    3428                 '&copy;' => '&#169;',
    3429                 '&ordf;' => '&#170;',
    3430                 '&laquo;' => '&#171;',
    3431                 '&not;' => '&#172;',
    3432                 '&shy;' => '&#173;',
    3433                 '&reg;' => '&#174;',
    3434                 '&macr;' => '&#175;',
    3435                 '&hibar;' => '&#175;',
    3436                 '&deg;' => '&#176;',
    3437                 '&plusmn;' => '&#177;',
    3438                 '&sup2;' => '&#178;',
    3439                 '&sup3;' => '&#179;',
    3440                 '&acute;' => '&#180;',
    3441                 '&micro;' => '&#181;',
    3442                 '&para;' => '&#182;',
    3443                 '&middot;' => '&#183;',
    3444                 '&cedil;' => '&#184;',
    3445                 '&sup1;' => '&#185;',
    3446                 '&ordm;' => '&#186;',
    3447                 '&raquo;' => '&#187;',
    3448                 '&frac14;' => '&#188;',
    3449                 '&frac12;' => '&#189;',
    3450                 '&frac34;' => '&#190;',
    3451                 '&iquest;' => '&#191;',
    3452                 '&Agrave;' => '&#192;',
    3453                 '&Aacute;' => '&#193;',
    3454                 '&Acirc;' => '&#194;',
    3455                 '&Atilde;' => '&#195;',
    3456                 '&Auml;' => '&#196;',
    3457                 '&Aring;' => '&#197;',
    3458                 '&AElig;' => '&#198;',
    3459                 '&Ccedil;' => '&#199;',
    3460                 '&Egrave;' => '&#200;',
    3461                 '&Eacute;' => '&#201;',
    3462                 '&Ecirc;' => '&#202;',
    3463                 '&Euml;' => '&#203;',
    3464                 '&Igrave;' => '&#204;',
    3465                 '&Iacute;' => '&#205;',
    3466                 '&Icirc;' => '&#206;',
    3467                 '&Iuml;' => '&#207;',
    3468                 '&ETH;' => '&#208;',
    3469                 '&Ntilde;' => '&#209;',
    3470                 '&Ograve;' => '&#210;',
    3471                 '&Oacute;' => '&#211;',
    3472                 '&Ocirc;' => '&#212;',
    3473                 '&Otilde;' => '&#213;',
    3474                 '&Ouml;' => '&#214;',
    3475                 '&times;' => '&#215;',
    3476                 '&Oslash;' => '&#216;',
    3477                 '&Ugrave;' => '&#217;',
    3478                 '&Uacute;' => '&#218;',
    3479                 '&Ucirc;' => '&#219;',
    3480                 '&Uuml;' => '&#220;',
    3481                 '&Yacute;' => '&#221;',
    3482                 '&THORN;' => '&#222;',
    3483                 '&szlig;' => '&#223;',
    3484                 '&agrave;' => '&#224;',
    3485                 '&aacute;' => '&#225;',
    3486                 '&acirc;' => '&#226;',
    3487                 '&atilde;' => '&#227;',
    3488                 '&auml;' => '&#228;',
    3489                 '&aring;' => '&#229;',
    3490                 '&aelig;' => '&#230;',
    3491                 '&ccedil;' => '&#231;',
    3492                 '&egrave;' => '&#232;',
    3493                 '&eacute;' => '&#233;',
    3494                 '&ecirc;' => '&#234;',
    3495                 '&euml;' => '&#235;',
    3496                 '&igrave;' => '&#236;',
    3497                 '&iacute;' => '&#237;',
    3498                 '&icirc;' => '&#238;',
    3499                 '&iuml;' => '&#239;',
    3500                 '&eth;' => '&#240;',
    3501                 '&ntilde;' => '&#241;',
    3502                 '&ograve;' => '&#242;',
    3503                 '&oacute;' => '&#243;',
    3504                 '&ocirc;' => '&#244;',
    3505                 '&otilde;' => '&#245;',
    3506                 '&ouml;' => '&#246;',
    3507                 '&divide;' => '&#247;',
    3508                 '&oslash;' => '&#248;',
    3509                 '&ugrave;' => '&#249;',
    3510                 '&uacute;' => '&#250;',
    3511                 '&ucirc;' => '&#251;',
    3512                 '&uuml;' => '&#252;',
    3513                 '&yacute;' => '&#253;',
    3514                 '&thorn;' => '&#254;',
    3515                 '&yuml;' => '&#255;',
    3516                 '&OElig;' => '&#338;',
    3517                 '&oelig;' => '&#339;',
    3518                 '&Scaron;' => '&#352;',
    3519                 '&scaron;' => '&#353;',
    3520                 '&Yuml;' => '&#376;',
    3521                 '&fnof;' => '&#402;',
    3522                 '&circ;' => '&#710;',
    3523                 '&tilde;' => '&#732;',
    3524                 '&Alpha;' => '&#913;',
    3525                 '&Beta;' => '&#914;',
    3526                 '&Gamma;' => '&#915;',
    3527                 '&Delta;' => '&#916;',
    3528                 '&Epsilon;' => '&#917;',
    3529                 '&Zeta;' => '&#918;',
    3530                 '&Eta;' => '&#919;',
    3531                 '&Theta;' => '&#920;',
    3532                 '&Iota;' => '&#921;',
    3533                 '&Kappa;' => '&#922;',
    3534                 '&Lambda;' => '&#923;',
    3535                 '&Mu;' => '&#924;',
    3536                 '&Nu;' => '&#925;',
    3537                 '&Xi;' => '&#926;',
    3538                 '&Omicron;' => '&#927;',
    3539                 '&Pi;' => '&#928;',
    3540                 '&Rho;' => '&#929;',
    3541                 '&Sigma;' => '&#931;',
    3542                 '&Tau;' => '&#932;',
    3543                 '&Upsilon;' => '&#933;',
    3544                 '&Phi;' => '&#934;',
    3545                 '&Chi;' => '&#935;',
    3546                 '&Psi;' => '&#936;',
    3547                 '&Omega;' => '&#937;',
    3548                 '&alpha;' => '&#945;',
    3549                 '&beta;' => '&#946;',
    3550                 '&gamma;' => '&#947;',
    3551                 '&delta;' => '&#948;',
    3552                 '&epsilon;' => '&#949;',
    3553                 '&zeta;' => '&#950;',
    3554                 '&eta;' => '&#951;',
    3555                 '&theta;' => '&#952;',
    3556                 '&iota;' => '&#953;',
    3557                 '&kappa;' => '&#954;',
    3558                 '&lambda;' => '&#955;',
    3559                 '&mu;' => '&#956;',
    3560                 '&nu;' => '&#957;',
    3561                 '&xi;' => '&#958;',
    3562                 '&omicron;' => '&#959;',
    3563                 '&pi;' => '&#960;',
    3564                 '&rho;' => '&#961;',
    3565                 '&sigmaf;' => '&#962;',
    3566                 '&sigma;' => '&#963;',
    3567                 '&tau;' => '&#964;',
    3568                 '&upsilon;' => '&#965;',
    3569                 '&phi;' => '&#966;',
    3570                 '&chi;' => '&#967;',
    3571                 '&psi;' => '&#968;',
    3572                 '&omega;' => '&#969;',
     3773                '&quot;'     => '&#34;',
     3774                '&amp;'      => '&#38;',
     3775                '&lt;'       => '&#60;',
     3776                '&gt;'       => '&#62;',
     3777                '|'          => '&#124;',
     3778                '&nbsp;'     => '&#160;',
     3779                '&iexcl;'    => '&#161;',
     3780                '&cent;'     => '&#162;',
     3781                '&pound;'    => '&#163;',
     3782                '&curren;'   => '&#164;',
     3783                '&yen;'      => '&#165;',
     3784                '&brvbar;'   => '&#166;',
     3785                '&brkbar;'   => '&#166;',
     3786                '&sect;'     => '&#167;',
     3787                '&uml;'      => '&#168;',
     3788                '&die;'      => '&#168;',
     3789                '&copy;'     => '&#169;',
     3790                '&ordf;'     => '&#170;',
     3791                '&laquo;'    => '&#171;',
     3792                '&not;'      => '&#172;',
     3793                '&shy;'      => '&#173;',
     3794                '&reg;'      => '&#174;',
     3795                '&macr;'     => '&#175;',
     3796                '&hibar;'    => '&#175;',
     3797                '&deg;'      => '&#176;',
     3798                '&plusmn;'   => '&#177;',
     3799                '&sup2;'     => '&#178;',
     3800                '&sup3;'     => '&#179;',
     3801                '&acute;'    => '&#180;',
     3802                '&micro;'    => '&#181;',
     3803                '&para;'     => '&#182;',
     3804                '&middot;'   => '&#183;',
     3805                '&cedil;'    => '&#184;',
     3806                '&sup1;'     => '&#185;',
     3807                '&ordm;'     => '&#186;',
     3808                '&raquo;'    => '&#187;',
     3809                '&frac14;'   => '&#188;',
     3810                '&frac12;'   => '&#189;',
     3811                '&frac34;'   => '&#190;',
     3812                '&iquest;'   => '&#191;',
     3813                '&Agrave;'   => '&#192;',
     3814                '&Aacute;'   => '&#193;',
     3815                '&Acirc;'    => '&#194;',
     3816                '&Atilde;'   => '&#195;',
     3817                '&Auml;'     => '&#196;',
     3818                '&Aring;'    => '&#197;',
     3819                '&AElig;'    => '&#198;',
     3820                '&Ccedil;'   => '&#199;',
     3821                '&Egrave;'   => '&#200;',
     3822                '&Eacute;'   => '&#201;',
     3823                '&Ecirc;'    => '&#202;',
     3824                '&Euml;'     => '&#203;',
     3825                '&Igrave;'   => '&#204;',
     3826                '&Iacute;'   => '&#205;',
     3827                '&Icirc;'    => '&#206;',
     3828                '&Iuml;'     => '&#207;',
     3829                '&ETH;'      => '&#208;',
     3830                '&Ntilde;'   => '&#209;',
     3831                '&Ograve;'   => '&#210;',
     3832                '&Oacute;'   => '&#211;',
     3833                '&Ocirc;'    => '&#212;',
     3834                '&Otilde;'   => '&#213;',
     3835                '&Ouml;'     => '&#214;',
     3836                '&times;'    => '&#215;',
     3837                '&Oslash;'   => '&#216;',
     3838                '&Ugrave;'   => '&#217;',
     3839                '&Uacute;'   => '&#218;',
     3840                '&Ucirc;'    => '&#219;',
     3841                '&Uuml;'     => '&#220;',
     3842                '&Yacute;'   => '&#221;',
     3843                '&THORN;'    => '&#222;',
     3844                '&szlig;'    => '&#223;',
     3845                '&agrave;'   => '&#224;',
     3846                '&aacute;'   => '&#225;',
     3847                '&acirc;'    => '&#226;',
     3848                '&atilde;'   => '&#227;',
     3849                '&auml;'     => '&#228;',
     3850                '&aring;'    => '&#229;',
     3851                '&aelig;'    => '&#230;',
     3852                '&ccedil;'   => '&#231;',
     3853                '&egrave;'   => '&#232;',
     3854                '&eacute;'   => '&#233;',
     3855                '&ecirc;'    => '&#234;',
     3856                '&euml;'     => '&#235;',
     3857                '&igrave;'   => '&#236;',
     3858                '&iacute;'   => '&#237;',
     3859                '&icirc;'    => '&#238;',
     3860                '&iuml;'     => '&#239;',
     3861                '&eth;'      => '&#240;',
     3862                '&ntilde;'   => '&#241;',
     3863                '&ograve;'   => '&#242;',
     3864                '&oacute;'   => '&#243;',
     3865                '&ocirc;'    => '&#244;',
     3866                '&otilde;'   => '&#245;',
     3867                '&ouml;'     => '&#246;',
     3868                '&divide;'   => '&#247;',
     3869                '&oslash;'   => '&#248;',
     3870                '&ugrave;'   => '&#249;',
     3871                '&uacute;'   => '&#250;',
     3872                '&ucirc;'    => '&#251;',
     3873                '&uuml;'     => '&#252;',
     3874                '&yacute;'   => '&#253;',
     3875                '&thorn;'    => '&#254;',
     3876                '&yuml;'     => '&#255;',
     3877                '&OElig;'    => '&#338;',
     3878                '&oelig;'    => '&#339;',
     3879                '&Scaron;'   => '&#352;',
     3880                '&scaron;'   => '&#353;',
     3881                '&Yuml;'     => '&#376;',
     3882                '&fnof;'     => '&#402;',
     3883                '&circ;'     => '&#710;',
     3884                '&tilde;'    => '&#732;',
     3885                '&Alpha;'    => '&#913;',
     3886                '&Beta;'     => '&#914;',
     3887                '&Gamma;'    => '&#915;',
     3888                '&Delta;'    => '&#916;',
     3889                '&Epsilon;'  => '&#917;',
     3890                '&Zeta;'     => '&#918;',
     3891                '&Eta;'      => '&#919;',
     3892                '&Theta;'    => '&#920;',
     3893                '&Iota;'     => '&#921;',
     3894                '&Kappa;'    => '&#922;',
     3895                '&Lambda;'   => '&#923;',
     3896                '&Mu;'       => '&#924;',
     3897                '&Nu;'       => '&#925;',
     3898                '&Xi;'       => '&#926;',
     3899                '&Omicron;'  => '&#927;',
     3900                '&Pi;'       => '&#928;',
     3901                '&Rho;'      => '&#929;',
     3902                '&Sigma;'    => '&#931;',
     3903                '&Tau;'      => '&#932;',
     3904                '&Upsilon;'  => '&#933;',
     3905                '&Phi;'      => '&#934;',
     3906                '&Chi;'      => '&#935;',
     3907                '&Psi;'      => '&#936;',
     3908                '&Omega;'    => '&#937;',
     3909                '&alpha;'    => '&#945;',
     3910                '&beta;'     => '&#946;',
     3911                '&gamma;'    => '&#947;',
     3912                '&delta;'    => '&#948;',
     3913                '&epsilon;'  => '&#949;',
     3914                '&zeta;'     => '&#950;',
     3915                '&eta;'      => '&#951;',
     3916                '&theta;'    => '&#952;',
     3917                '&iota;'     => '&#953;',
     3918                '&kappa;'    => '&#954;',
     3919                '&lambda;'   => '&#955;',
     3920                '&mu;'       => '&#956;',
     3921                '&nu;'       => '&#957;',
     3922                '&xi;'       => '&#958;',
     3923                '&omicron;'  => '&#959;',
     3924                '&pi;'       => '&#960;',
     3925                '&rho;'      => '&#961;',
     3926                '&sigmaf;'   => '&#962;',
     3927                '&sigma;'    => '&#963;',
     3928                '&tau;'      => '&#964;',
     3929                '&upsilon;'  => '&#965;',
     3930                '&phi;'      => '&#966;',
     3931                '&chi;'      => '&#967;',
     3932                '&psi;'      => '&#968;',
     3933                '&omega;'    => '&#969;',
    35733934                '&thetasym;' => '&#977;',
    3574                 '&upsih;' => '&#978;',
    3575                 '&piv;' => '&#982;',
    3576                 '&ensp;' => '&#8194;',
    3577                 '&emsp;' => '&#8195;',
    3578                 '&thinsp;' => '&#8201;',
    3579                 '&zwnj;' => '&#8204;',
    3580                 '&zwj;' => '&#8205;',
    3581                 '&lrm;' => '&#8206;',
    3582                 '&rlm;' => '&#8207;',
    3583                 '&ndash;' => '&#8211;',
    3584                 '&mdash;' => '&#8212;',
    3585                 '&lsquo;' => '&#8216;',
    3586                 '&rsquo;' => '&#8217;',
    3587                 '&sbquo;' => '&#8218;',
    3588                 '&ldquo;' => '&#8220;',
    3589                 '&rdquo;' => '&#8221;',
    3590                 '&bdquo;' => '&#8222;',
    3591                 '&dagger;' => '&#8224;',
    3592                 '&Dagger;' => '&#8225;',
    3593                 '&bull;' => '&#8226;',
    3594                 '&hellip;' => '&#8230;',
    3595                 '&permil;' => '&#8240;',
    3596                 '&prime;' => '&#8242;',
    3597                 '&Prime;' => '&#8243;',
    3598                 '&lsaquo;' => '&#8249;',
    3599                 '&rsaquo;' => '&#8250;',
    3600                 '&oline;' => '&#8254;',
    3601                 '&frasl;' => '&#8260;',
    3602                 '&euro;' => '&#8364;',
    3603                 '&image;' => '&#8465;',
    3604                 '&weierp;' => '&#8472;',
    3605                 '&real;' => '&#8476;',
    3606                 '&trade;' => '&#8482;',
    3607                 '&alefsym;' => '&#8501;',
    3608                 '&crarr;' => '&#8629;',
    3609                 '&lArr;' => '&#8656;',
    3610                 '&uArr;' => '&#8657;',
    3611                 '&rArr;' => '&#8658;',
    3612                 '&dArr;' => '&#8659;',
    3613                 '&hArr;' => '&#8660;',
    3614                 '&forall;' => '&#8704;',
    3615                 '&part;' => '&#8706;',
    3616                 '&exist;' => '&#8707;',
    3617                 '&empty;' => '&#8709;',
    3618                 '&nabla;' => '&#8711;',
    3619                 '&isin;' => '&#8712;',
    3620                 '&notin;' => '&#8713;',
    3621                 '&ni;' => '&#8715;',
    3622                 '&prod;' => '&#8719;',
    3623                 '&sum;' => '&#8721;',
    3624                 '&minus;' => '&#8722;',
    3625                 '&lowast;' => '&#8727;',
    3626                 '&radic;' => '&#8730;',
    3627                 '&prop;' => '&#8733;',
    3628                 '&infin;' => '&#8734;',
    3629                 '&ang;' => '&#8736;',
    3630                 '&and;' => '&#8743;',
    3631                 '&or;' => '&#8744;',
    3632                 '&cap;' => '&#8745;',
    3633                 '&cup;' => '&#8746;',
    3634                 '&int;' => '&#8747;',
    3635                 '&there4;' => '&#8756;',
    3636                 '&sim;' => '&#8764;',
    3637                 '&cong;' => '&#8773;',
    3638                 '&asymp;' => '&#8776;',
    3639                 '&ne;' => '&#8800;',
    3640                 '&equiv;' => '&#8801;',
    3641                 '&le;' => '&#8804;',
    3642                 '&ge;' => '&#8805;',
    3643                 '&sub;' => '&#8834;',
    3644                 '&sup;' => '&#8835;',
    3645                 '&nsub;' => '&#8836;',
    3646                 '&sube;' => '&#8838;',
    3647                 '&supe;' => '&#8839;',
    3648                 '&oplus;' => '&#8853;',
    3649                 '&otimes;' => '&#8855;',
    3650                 '&perp;' => '&#8869;',
    3651                 '&sdot;' => '&#8901;',
    3652                 '&lceil;' => '&#8968;',
    3653                 '&rceil;' => '&#8969;',
    3654                 '&lfloor;' => '&#8970;',
    3655                 '&rfloor;' => '&#8971;',
    3656                 '&lang;' => '&#9001;',
    3657                 '&rang;' => '&#9002;',
    3658                 '&larr;' => '&#8592;',
    3659                 '&uarr;' => '&#8593;',
    3660                 '&rarr;' => '&#8594;',
    3661                 '&darr;' => '&#8595;',
    3662                 '&harr;' => '&#8596;',
    3663                 '&loz;' => '&#9674;',
    3664                 '&spades;' => '&#9824;',
    3665                 '&clubs;' => '&#9827;',
    3666                 '&hearts;' => '&#9829;',
    3667                 '&diams;' => '&#9830;'
     3935                '&upsih;'    => '&#978;',
     3936                '&piv;'      => '&#982;',
     3937                '&ensp;'     => '&#8194;',
     3938                '&emsp;'     => '&#8195;',
     3939                '&thinsp;'   => '&#8201;',
     3940                '&zwnj;'     => '&#8204;',
     3941                '&zwj;'      => '&#8205;',
     3942                '&lrm;'      => '&#8206;',
     3943                '&rlm;'      => '&#8207;',
     3944                '&ndash;'    => '&#8211;',
     3945                '&mdash;'    => '&#8212;',
     3946                '&lsquo;'    => '&#8216;',
     3947                '&rsquo;'    => '&#8217;',
     3948                '&sbquo;'    => '&#8218;',
     3949                '&ldquo;'    => '&#8220;',
     3950                '&rdquo;'    => '&#8221;',
     3951                '&bdquo;'    => '&#8222;',
     3952                '&dagger;'   => '&#8224;',
     3953                '&Dagger;'   => '&#8225;',
     3954                '&bull;'     => '&#8226;',
     3955                '&hellip;'   => '&#8230;',
     3956                '&permil;'   => '&#8240;',
     3957                '&prime;'    => '&#8242;',
     3958                '&Prime;'    => '&#8243;',
     3959                '&lsaquo;'   => '&#8249;',
     3960                '&rsaquo;'   => '&#8250;',
     3961                '&oline;'    => '&#8254;',
     3962                '&frasl;'    => '&#8260;',
     3963                '&euro;'     => '&#8364;',
     3964                '&image;'    => '&#8465;',
     3965                '&weierp;'   => '&#8472;',
     3966                '&real;'     => '&#8476;',
     3967                '&trade;'    => '&#8482;',
     3968                '&alefsym;'  => '&#8501;',
     3969                '&crarr;'    => '&#8629;',
     3970                '&lArr;'     => '&#8656;',
     3971                '&uArr;'     => '&#8657;',
     3972                '&rArr;'     => '&#8658;',
     3973                '&dArr;'     => '&#8659;',
     3974                '&hArr;'     => '&#8660;',
     3975                '&forall;'   => '&#8704;',
     3976                '&part;'     => '&#8706;',
     3977                '&exist;'    => '&#8707;',
     3978                '&empty;'    => '&#8709;',
     3979                '&nabla;'    => '&#8711;',
     3980                '&isin;'     => '&#8712;',
     3981                '&notin;'    => '&#8713;',
     3982                '&ni;'       => '&#8715;',
     3983                '&prod;'     => '&#8719;',
     3984                '&sum;'      => '&#8721;',
     3985                '&minus;'    => '&#8722;',
     3986                '&lowast;'   => '&#8727;',
     3987                '&radic;'    => '&#8730;',
     3988                '&prop;'     => '&#8733;',
     3989                '&infin;'    => '&#8734;',
     3990                '&ang;'      => '&#8736;',
     3991                '&and;'      => '&#8743;',
     3992                '&or;'       => '&#8744;',
     3993                '&cap;'      => '&#8745;',
     3994                '&cup;'      => '&#8746;',
     3995                '&int;'      => '&#8747;',
     3996                '&there4;'   => '&#8756;',
     3997                '&sim;'      => '&#8764;',
     3998                '&cong;'     => '&#8773;',
     3999                '&asymp;'    => '&#8776;',
     4000                '&ne;'       => '&#8800;',
     4001                '&equiv;'    => '&#8801;',
     4002                '&le;'       => '&#8804;',
     4003                '&ge;'       => '&#8805;',
     4004                '&sub;'      => '&#8834;',
     4005                '&sup;'      => '&#8835;',
     4006                '&nsub;'     => '&#8836;',
     4007                '&sube;'     => '&#8838;',
     4008                '&supe;'     => '&#8839;',
     4009                '&oplus;'    => '&#8853;',
     4010                '&otimes;'   => '&#8855;',
     4011                '&perp;'     => '&#8869;',
     4012                '&sdot;'     => '&#8901;',
     4013                '&lceil;'    => '&#8968;',
     4014                '&rceil;'    => '&#8969;',
     4015                '&lfloor;'   => '&#8970;',
     4016                '&rfloor;'   => '&#8971;',
     4017                '&lang;'     => '&#9001;',
     4018                '&rang;'     => '&#9002;',
     4019                '&larr;'     => '&#8592;',
     4020                '&uarr;'     => '&#8593;',
     4021                '&rarr;'     => '&#8594;',
     4022                '&darr;'     => '&#8595;',
     4023                '&harr;'     => '&#8596;',
     4024                '&loz;'      => '&#9674;',
     4025                '&spades;'   => '&#9824;',
     4026                '&clubs;'    => '&#9827;',
     4027                '&hearts;'   => '&#9829;',
     4028                '&diams;'    => '&#9830;'
    36684029        );
    36694030
    3670         return str_replace( array_keys($to_ncr), array_values($to_ncr), $text );
     4031        return str_replace( array_keys( $to_ncr ), array_values( $to_ncr ), $text );
    36714032}
    36724033
    36734034/**
     
    36834044 *
    36844045 * @see _WP_Editors::editor()
    36854046 *
    3686  * @param string $text           The text to be formatted.
     4047 * @param string $text The text to be formatted.
    36874048 * @param string $default_editor The default editor for the current user.
    36884049 *                               It is usually either 'html' or 'tinymce'.
     4050 *
    36894051 * @return string The formatted text after filter is applied.
    36904052 */
    36914053function format_for_editor( $text, $default_editor = null ) {
     
    36984060         *
    36994061         * @since 4.3.0
    37004062         *
    3701          * @param string $text           The formatted text.
     4063         * @param string $text The formatted text.
    37024064         * @param string $default_editor The default editor for the current user.
    37034065         *                               It is usually either 'html' or 'tinymce'.
    37044066         */
     
    37154077 * @since 2.8.1
    37164078 * @access private
    37174079 *
    3718  * @param string|array $search  The value being searched for, otherwise known as the needle.
     4080 * @param string|array $search The value being searched for, otherwise known as the needle.
    37194081 *                              An array may be used to designate multiple needles.
    3720  * @param string       $subject The string being searched and replaced on, otherwise known as the haystack.
     4082 * @param string $subject The string being searched and replaced on, otherwise known as the haystack.
     4083 *
    37214084 * @return string The string with the replaced svalues.
    37224085 */
    37234086function _deep_replace( $search, $subject ) {
     
    37434106 * @global wpdb $wpdb WordPress database abstraction object.
    37444107 *
    37454108 * @param string|array $data Unescaped data
     4109 *
    37464110 * @return string|array Escaped data
    37474111 */
    37484112function esc_sql( $data ) {
    37494113        global $wpdb;
     4114
    37504115        return $wpdb->_escape( $data );
    37514116}
    37524117
     
    37594124 *
    37604125 * @since 2.8.0
    37614126 *
    3762  * @param string $url       The URL to be cleaned.
    3763  * @param array  $protocols Optional. An array of acceptable protocols.
    3764  *                                  Defaults to return value of wp_allowed_protocols()
    3765  * @param string $_context  Private. Use esc_url_raw() for database usage.
     4127 * @param string $url The URL to be cleaned.
     4128 * @param array $protocols Optional. An array of acceptable protocols.
     4129 *                            Defaults to return value of wp_allowed_protocols()
     4130 * @param string $_context Private. Use esc_url_raw() for database usage.
     4131 *
    37664132 * @return string The cleaned $url after the {@see 'clean_url'} filter is applied.
    37674133 */
    37684134function esc_url( $url, $protocols = null, $_context = 'display' ) {
    37694135        $original_url = $url;
    37704136
    3771         if ( '' == $url )
     4137        if ( '' == $url ) {
    37724138                return $url;
     4139        }
    37734140
    37744141        $url = str_replace( ' ', '%20', $url );
    3775         $url = preg_replace('|[^a-z0-9-~+_.?#=!&;,/:%@$\|*\'()\[\]\\x80-\\xff]|i', '', $url);
     4142        $url = preg_replace( '|[^a-z0-9-~+_.?#=!&;,/:%@$\|*\'()\[\]\\x80-\\xff]|i', '', $url );
    37764143
    37774144        if ( '' === $url ) {
    37784145                return $url;
    37794146        }
    37804147
    37814148        if ( 0 !== stripos( $url, 'mailto:' ) ) {
    3782                 $strip = array('%0d', '%0a', '%0D', '%0A');
    3783                 $url = _deep_replace($strip, $url);
     4149                $strip = array( '%0d', '%0a', '%0D', '%0A' );
     4150                $url   = _deep_replace( $strip, $url );
    37844151        }
    37854152
    3786         $url = str_replace(';//', '://', $url);
     4153        $url = str_replace( ';//', '://', $url );
    37874154        /* If the URL doesn't appear to contain a scheme, we
    37884155         * presume it needs http:// prepended (unless a relative
    37894156         * link starting with /, # or ? or a php file).
    37904157         */
    3791         if ( strpos($url, ':') === false && ! in_array( $url[0], array( '/', '#', '?' ) ) &&
    3792                 ! preg_match('/^[a-z0-9-]+?\.php/i', $url) )
     4158        if ( strpos( $url, ':' ) === false && ! in_array( $url[0], array( '/', '#', '?' ) ) &&
     4159             ! preg_match( '/^[a-z0-9-]+?\.php/i', $url )
     4160        ) {
    37934161                $url = 'http://' . $url;
     4162        }
    37944163
    37954164        // Replace ampersands and single quotes only when displaying.
    37964165        if ( 'display' == $_context ) {
     
    38394208        if ( '/' === $url[0] ) {
    38404209                $good_protocol_url = $url;
    38414210        } else {
    3842                 if ( ! is_array( $protocols ) )
     4211                if ( ! is_array( $protocols ) ) {
    38434212                        $protocols = wp_allowed_protocols();
     4213                }
    38444214                $good_protocol_url = wp_kses_bad_protocol( $url, $protocols );
    3845                 if ( strtolower( $good_protocol_url ) != strtolower( $url ) )
     4215                if ( strtolower( $good_protocol_url ) != strtolower( $url ) ) {
    38464216                        return '';
     4217                }
    38474218        }
    38484219
    38494220        /**
     
    38524223         * @since 2.3.0
    38534224         *
    38544225         * @param string $good_protocol_url The cleaned URL to be returned.
    3855          * @param string $original_url      The URL prior to cleaning.
    3856          * @param string $_context          If 'display', replace ampersands and single quotes only.
     4226         * @param string $original_url The URL prior to cleaning.
     4227         * @param string $_context If 'display', replace ampersands and single quotes only.
    38574228         */
    38584229        return apply_filters( 'clean_url', $good_protocol_url, $original_url, $_context );
    38594230}
     
    38634234 *
    38644235 * @since 2.8.0
    38654236 *
    3866  * @param string $url       The URL to be cleaned.
    3867  * @param array  $protocols An array of acceptable protocols.
     4237 * @param string $url The URL to be cleaned.
     4238 * @param array $protocols An array of acceptable protocols.
     4239 *
    38684240 * @return string The cleaned URL.
    38694241 */
    38704242function esc_url_raw( $url, $protocols = null ) {
     
    38794251 * @since 1.2.2
    38804252 *
    38814253 * @param string $myHTML The text to be converted.
     4254 *
    38824255 * @return string Converted text.
    38834256 */
    38844257function htmlentities2( $myHTML ) {
    3885         $translation_table = get_html_translation_table( HTML_ENTITIES, ENT_QUOTES );
    3886         $translation_table[chr(38)] = '&';
    3887         return preg_replace( "/&(?![A-Za-z]{0,4}\w{2,3};|#[0-9]{2,3};)/", "&amp;", strtr($myHTML, $translation_table) );
     4258        $translation_table              = get_html_translation_table( HTML_ENTITIES, ENT_QUOTES );
     4259        $translation_table[ chr( 38 ) ] = '&';
     4260
     4261        return preg_replace( "/&(?![A-Za-z]{0,4}\w{2,3};|#[0-9]{2,3};)/", "&amp;", strtr( $myHTML, $translation_table ) );
    38884262}
    38894263
    38904264/**
     
    38974271 * @since 2.8.0
    38984272 *
    38994273 * @param string $text The text to be escaped.
     4274 *
    39004275 * @return string Escaped text.
    39014276 */
    39024277function esc_js( $text ) {
     
    39054280        $safe_text = preg_replace( '/&#(x)?0*(?(1)27|39);?/i', "'", stripslashes( $safe_text ) );
    39064281        $safe_text = str_replace( "\r", '', $safe_text );
    39074282        $safe_text = str_replace( "\n", '\\n', addslashes( $safe_text ) );
     4283
    39084284        /**
    39094285         * Filters a string cleaned and escaped for output in JavaScript.
    39104286         *
     
    39144290         * @since 2.0.6
    39154291         *
    39164292         * @param string $safe_text The text after it has been escaped.
    3917          * @param string $text      The text prior to being escaped.
     4293         * @param string $text The text prior to being escaped.
    39184294         */
    39194295        return apply_filters( 'js_escape', $safe_text, $text );
    39204296}
     
    39254301 * @since 2.8.0
    39264302 *
    39274303 * @param string $text
     4304 *
    39284305 * @return string
    39294306 */
    39304307function esc_html( $text ) {
    39314308        $safe_text = wp_check_invalid_utf8( $text );
    39324309        $safe_text = _wp_specialchars( $safe_text, ENT_QUOTES );
     4310
    39334311        /**
    39344312         * Filters a string cleaned and escaped for output in HTML.
    39354313         *
     
    39394317         * @since 2.8.0
    39404318         *
    39414319         * @param string $safe_text The text after it has been escaped.
    3942          * @param string $text      The text prior to being escaped.
     4320         * @param string $text The text prior to being escaped.
    39434321         */
    39444322        return apply_filters( 'esc_html', $safe_text, $text );
    39454323}
     
    39504328 * @since 2.8.0
    39514329 *
    39524330 * @param string $text
     4331 *
    39534332 * @return string
    39544333 */
    39554334function esc_attr( $text ) {
    39564335        $safe_text = wp_check_invalid_utf8( $text );
    39574336        $safe_text = _wp_specialchars( $safe_text, ENT_QUOTES );
     4337
    39584338        /**
    39594339         * Filters a string cleaned and escaped for output in an HTML attribute.
    39604340         *
     
    39644344         * @since 2.0.6
    39654345         *
    39664346         * @param string $safe_text The text after it has been escaped.
    3967          * @param string $text      The text prior to being escaped.
     4347         * @param string $text The text prior to being escaped.
    39684348         */
    39694349        return apply_filters( 'attribute_escape', $safe_text, $text );
    39704350}
     
    39754355 * @since 3.1.0
    39764356 *
    39774357 * @param string $text
     4358 *
    39784359 * @return string
    39794360 */
    39804361function esc_textarea( $text ) {
    39814362        $safe_text = htmlspecialchars( $text, ENT_QUOTES, get_option( 'blog_charset' ) );
     4363
    39824364        /**
    39834365         * Filters a string cleaned and escaped for output in a textarea element.
    39844366         *
    39854367         * @since 3.1.0
    39864368         *
    39874369         * @param string $safe_text The text after it has been escaped.
    3988          * @param string $text      The text prior to being escaped.
     4370         * @param string $text The text prior to being escaped.
    39894371         */
    39904372        return apply_filters( 'esc_textarea', $safe_text, $text );
    39914373}
     
    39964378 * @since 2.5.0
    39974379 *
    39984380 * @param string $tag_name
     4381 *
    39994382 * @return string
    40004383 */
    40014384function tag_escape( $tag_name ) {
    4002         $safe_tag = strtolower( preg_replace('/[^a-zA-Z0-9_:]/', '', $tag_name) );
     4385        $safe_tag = strtolower( preg_replace( '/[^a-zA-Z0-9_:]/', '', $tag_name ) );
     4386
    40034387        /**
    40044388         * Filters a string cleaned and escaped for output as an HTML tag.
    40054389         *
    40064390         * @since 2.8.0
    40074391         *
    40084392         * @param string $safe_tag The tag name after it has been escaped.
    4009          * @param string $tag_name The text before it was escaped.
     4393         * @param string $tag_name The text before it was escaped.
    40104394         */
    40114395        return apply_filters( 'tag_escape', $safe_tag, $tag_name );
    40124396}
     
    40214405 * @since 4.1.0 Support was added for relative URLs.
    40224406 *
    40234407 * @param string $link Full URL path.
     4408 *
    40244409 * @return string Absolute path.
    40254410 */
    40264411function wp_make_link_relative( $link ) {
     
    40384423 * @global wpdb $wpdb WordPress database abstraction object.
    40394424 *
    40404425 * @param string $option The name of the option.
    4041  * @param string $value  The unsanitised value.
     4426 * @param string $value The unsanitised value.
     4427 *
    40424428 * @return string Sanitized value.
    40434429 */
    40444430function sanitize_option( $option, $value ) {
    40454431        global $wpdb;
    40464432
    40474433        $original_value = $value;
    4048         $error = '';
     4434        $error          = '';
    40494435
    40504436        switch ( $option ) {
    40514437                case 'admin_email' :
     
    40894475                case 'posts_per_page':
    40904476                case 'posts_per_rss':
    40914477                        $value = (int) $value;
    4092                         if ( empty($value) )
     4478                        if ( empty( $value ) ) {
    40934479                                $value = 1;
    4094                         if ( $value < -1 )
    4095                                 $value = abs($value);
     4480                        }
     4481                        if ( $value < - 1 ) {
     4482                                $value = abs( $value );
     4483                        }
    40964484                        break;
    40974485
    40984486                case 'default_ping_status':
    40994487                case 'default_comment_status':
    41004488                        // Options that if not there have 0 value but need to be something like "closed"
    4101                         if ( $value == '0' || $value == '')
     4489                        if ( $value == '0' || $value == '' ) {
    41024490                                $value = 'closed';
     4491                        }
    41034492                        break;
    41044493
    41054494                case 'blogdescription':
     
    41174506                        break;
    41184507
    41194508                case 'blog_charset':
    4120                         $value = preg_replace('/[^a-zA-Z0-9_-]/', '', $value); // strips slashes
     4509                        $value = preg_replace( '/[^a-zA-Z0-9_-]/', '', $value ); // strips slashes
    41214510                        break;
    41224511
    41234512                case 'blog_public':
    41244513                        // This is the value if the settings checkbox is not checked on POST. Don't rely on this.
    4125                         if ( null === $value )
     4514                        if ( null === $value ) {
    41264515                                $value = 1;
    4127                         else
     4516                        } else {
    41284517                                $value = intval( $value );
     4518                        }
    41294519                        break;
    41304520
    41314521                case 'date_format':
     
    41514541                        break;
    41524542
    41534543                case 'gmt_offset':
    4154                         $value = preg_replace('/[^0-9:.-]/', '', $value); // strips slashes
     4544                        $value = preg_replace( '/[^0-9:.-]/', '', $value ); // strips slashes
    41554545                        break;
    41564546
    41574547                case 'siteurl':
     
    41954585                        if ( is_wp_error( $value ) ) {
    41964586                                $error = $value->get_error_message();
    41974587                        } else {
    4198                                 if ( ! is_array( $value ) )
     4588                                if ( ! is_array( $value ) ) {
    41994589                                        $value = explode( ' ', $value );
     4590                                }
    42004591
    42014592                                $value = array_values( array_filter( array_map( 'trim', $value ) ) );
    42024593
    4203                                 if ( ! $value )
     4594                                if ( ! $value ) {
    42044595                                        $value = '';
     4596                                }
    42054597                        }
    42064598                        break;
    42074599
     
    42114603                        if ( is_wp_error( $value ) ) {
    42124604                                $error = $value->get_error_message();
    42134605                        } else {
    4214                                 if ( ! is_array( $value ) )
     4606                                if ( ! is_array( $value ) ) {
    42154607                                        $value = explode( "\n", $value );
     4608                                }
    42164609
    42174610                                $domains = array_values( array_filter( array_map( 'trim', $value ) ) );
    4218                                 $value = array();
     4611                                $value   = array();
    42194612
    42204613                                foreach ( $domains as $domain ) {
    42214614                                        if ( ! preg_match( '/(--|\.\.)/', $domain ) && preg_match( '|^([a-zA-Z0-9-\.])+$|', $domain ) ) {
    42224615                                                $value[] = $domain;
    42234616                                        }
    42244617                                }
    4225                                 if ( ! $value )
     4618                                if ( ! $value ) {
    42264619                                        $value = '';
     4620                                }
    42274621                        }
    42284622                        break;
    42294623
     
    42474641
    42484642                        if ( 'permalink_structure' === $option && '' !== $value && ! preg_match( '/%[^\/%]+%/', $value ) ) {
    42494643                                $error = sprintf(
    4250                                         /* translators: %s: Codex URL */
     4644                                /* translators: %s: Codex URL */
    42514645                                        __( 'A structure tag is required when using custom permalinks. <a href="%s">Learn more</a>' ),
    42524646                                        __( 'https://codex.wordpress.org/Using_Permalinks#Choosing_your_permalink_structure' )
    42534647                                );
     
    42554649                        break;
    42564650
    42574651                case 'default_role' :
    4258                         if ( ! get_role( $value ) && get_role( 'subscriber' ) )
     4652                        if ( ! get_role( $value ) && get_role( 'subscriber' ) ) {
    42594653                                $value = 'subscriber';
     4654                        }
    42604655                        break;
    42614656
    42624657                case 'moderation_keys':
     
    42864681         * @since 2.3.0
    42874682         * @since 4.3.0 Added the `$original_value` parameter.
    42884683         *
    4289          * @param string $value          The sanitized option value.
    4290          * @param string $option         The option name.
     4684         * @param string $value The sanitized option value.
     4685         * @param string $option The option name.
    42914686         * @param string $original_value The original value passed to the function.
    42924687         */
    42934688        return apply_filters( "sanitize_option_{$option}", $value, $option, $original_value );
     
    43004695 *
    43014696 * @since 4.4.0
    43024697 *
    4303  * @param mixed    $value    The array, object, or scalar.
     4698 * @param mixed $value The array, object, or scalar.
    43044699 * @param callable $callback The function to map onto $value.
     4700 *
    43054701 * @return mixed The value with the callback applied to all non-arrays and non-objects inside it.
    43064702 */
    43074703function map_deep( $value, $callback ) {
     
    43304726 * @since 2.2.1
    43314727 *
    43324728 * @param string $string The string to be parsed.
    4333  * @param array  $array Variables will be stored in this array.
     4729 * @param array $array Variables will be stored in this array.
    43344730 */
    43354731function wp_parse_str( $string, &$array ) {
    43364732        parse_str( $string, $array );
    4337         if ( get_magic_quotes_gpc() )
     4733        if ( get_magic_quotes_gpc() ) {
    43384734                $array = stripslashes_deep( $array );
     4735        }
    43394736        /**
    43404737         * Filters the array of variables derived from a parsed string.
    43414738         *
     
    43544751 * @since 2.3.0
    43554752 *
    43564753 * @param string $text Text to be converted.
     4754 *
    43574755 * @return string Converted text.
    43584756 */
    43594757function wp_pre_kses_less_than( $text ) {
    4360         return preg_replace_callback('%<[^>]*?((?=<)|>|$)%', 'wp_pre_kses_less_than_callback', $text);
     4758        return preg_replace_callback( '%<[^>]*?((?=<)|>|$)%', 'wp_pre_kses_less_than_callback', $text );
    43614759}
    43624760
    43634761/**
     
    43664764 * @since 2.3.0
    43674765 *
    43684766 * @param array $matches Populated by matches to preg_replace.
     4767 *
    43694768 * @return string The text returned after esc_html if needed.
    43704769 */
    43714770function wp_pre_kses_less_than_callback( $matches ) {
    4372         if ( false === strpos($matches[0], '>') )
    4373                 return esc_html($matches[0]);
     4771        if ( false === strpos( $matches[0], '>' ) ) {
     4772                return esc_html( $matches[0] );
     4773        }
     4774
    43744775        return $matches[0];
    43754776}
    43764777
     
    43804781 * @since 2.5.0
    43814782 * @link https://secure.php.net/sprintf
    43824783 *
    4383  * @param string $pattern   The string which formatted args are inserted.
    4384  * @param mixed  $args ,... Arguments to be formatted into the $pattern string.
     4784 * @param string $pattern The string which formatted args are inserted.
     4785 * @param mixed $args ,... Arguments to be formatted into the $pattern string.
     4786 *
    43854787 * @return string The formatted string.
    43864788 */
    43874789function wp_sprintf( $pattern ) {
    4388         $args = func_get_args();
    4389         $len = strlen($pattern);
    4390         $start = 0;
    4391         $result = '';
     4790        $args      = func_get_args();
     4791        $len       = strlen( $pattern );
     4792        $start     = 0;
     4793        $result    = '';
    43924794        $arg_index = 0;
    43934795        while ( $len > $start ) {
    43944796                // Last character: append and break
    4395                 if ( strlen($pattern) - 1 == $start ) {
    4396                         $result .= substr($pattern, -1);
     4797                if ( strlen( $pattern ) - 1 == $start ) {
     4798                        $result .= substr( $pattern, - 1 );
    43974799                        break;
    43984800                }
    43994801
    44004802                // Literal %: append and continue
    4401                 if ( substr($pattern, $start, 2) == '%%' ) {
    4402                         $start += 2;
     4803                if ( substr( $pattern, $start, 2 ) == '%%' ) {
     4804                        $start  += 2;
    44034805                        $result .= '%';
    44044806                        continue;
    44054807                }
    44064808
    44074809                // Get fragment before next %
    4408                 $end = strpos($pattern, '%', $start + 1);
    4409                 if ( false === $end )
     4810                $end = strpos( $pattern, '%', $start + 1 );
     4811                if ( false === $end ) {
    44104812                        $end = $len;
    4411                 $fragment = substr($pattern, $start, $end - $start);
     4813                }
     4814                $fragment = substr( $pattern, $start, $end - $start );
    44124815
    44134816                // Fragment has a specifier
    4414                 if ( $pattern[$start] == '%' ) {
     4817                if ( $pattern[ $start ] == '%' ) {
    44154818                        // Find numbered arguments or take the next one in order
    4416                         if ( preg_match('/^%(\d+)\$/', $fragment, $matches) ) {
    4417                                 $arg = isset($args[$matches[1]]) ? $args[$matches[1]] : '';
    4418                                 $fragment = str_replace("%{$matches[1]}$", '%', $fragment);
     4819                        if ( preg_match( '/^%(\d+)\$/', $fragment, $matches ) ) {
     4820                                $arg      = isset( $args[ $matches[1] ] ) ? $args[ $matches[1] ] : '';
     4821                                $fragment = str_replace( "%{$matches[1]}$", '%', $fragment );
    44194822                        } else {
    4420                                 ++$arg_index;
    4421                                 $arg = isset($args[$arg_index]) ? $args[$arg_index] : '';
     4823                                ++ $arg_index;
     4824                                $arg = isset( $args[ $arg_index ] ) ? $args[ $arg_index ] : '';
    44224825                        }
    44234826
    44244827                        /**
     
    44294832                         * @since 2.5.0
    44304833                         *
    44314834                         * @param string $fragment A fragment from the pattern.
    4432                          * @param string $arg      The argument.
     4835                         * @param string $arg The argument.
    44334836                         */
    44344837                        $_fragment = apply_filters( 'wp_sprintf', $fragment, $arg );
    4435                         if ( $_fragment != $fragment )
     4838                        if ( $_fragment != $fragment ) {
    44364839                                $fragment = $_fragment;
    4437                         else
    4438                                 $fragment = sprintf($fragment, strval($arg) );
     4840                        } else {
     4841                                $fragment = sprintf( $fragment, strval( $arg ) );
     4842                        }
    44394843                }
    44404844
    44414845                // Append to result and move to next fragment
    44424846                $result .= $fragment;
    4443                 $start = $end;
     4847                $start  = $end;
    44444848        }
     4849
    44454850        return $result;
    44464851}
    44474852
     
    44554860 * @since 2.5.0
    44564861 *
    44574862 * @param string $pattern Content containing '%l' at the beginning.
    4458  * @param array  $args    List items to prepend to the content and replace '%l'.
     4863 * @param array $args List items to prepend to the content and replace '%l'.
     4864 *
    44594865 * @return string Localized list items and rest of the content.
    44604866 */
    44614867function wp_sprintf_l( $pattern, $args ) {
    44624868        // Not a match
    4463         if ( substr($pattern, 0, 2) != '%l' )
     4869        if ( substr( $pattern, 0, 2 ) != '%l' ) {
    44644870                return $pattern;
     4871        }
    44654872
    44664873        // Nothing to work with
    4467         if ( empty($args) )
     4874        if ( empty( $args ) ) {
    44684875                return '';
     4876        }
    44694877
    44704878        /**
    44714879         * Filters the translated delimiters used by wp_sprintf_l().
     
    44804888         */
    44814889        $l = apply_filters( 'wp_sprintf_l', array(
    44824890                /* translators: used to join items in a list with more than 2 items */
    4483                 'between'          => sprintf( __('%s, %s'), '', '' ),
     4891                'between'          => sprintf( __( '%s, %s' ), '', '' ),
    44844892                /* translators: used to join last two items in a list with more than 2 times */
    4485                 'between_last_two' => sprintf( __('%s, and %s'), '', '' ),
     4893                'between_last_two' => sprintf( __( '%s, and %s' ), '', '' ),
    44864894                /* translators: used to join items in a list with only 2 items */
    4487                 'between_only_two' => sprintf( __('%s and %s'), '', '' ),
     4895                'between_only_two' => sprintf( __( '%s and %s' ), '', '' ),
    44884896        ) );
    44894897
    4490         $args = (array) $args;
    4491         $result = array_shift($args);
    4492         if ( count($args) == 1 )
    4493                 $result .= $l['between_only_two'] . array_shift($args);
     4898        $args   = (array) $args;
     4899        $result = array_shift( $args );
     4900        if ( count( $args ) == 1 ) {
     4901                $result .= $l['between_only_two'] . array_shift( $args );
     4902        }
    44944903        // Loop when more than two args
    4495         $i = count($args);
     4904        $i = count( $args );
    44964905        while ( $i ) {
    4497                 $arg = array_shift($args);
    4498                 $i--;
    4499                 if ( 0 == $i )
     4906                $arg = array_shift( $args );
     4907                $i --;
     4908                if ( 0 == $i ) {
    45004909                        $result .= $l['between_last_two'] . $arg;
    4501                 else
     4910                } else {
    45024911                        $result .= $l['between'] . $arg;
     4912                }
    45034913        }
    4504         return $result . substr($pattern, 2);
     4914
     4915        return $result . substr( $pattern, 2 );
    45054916}
    45064917
    45074918/**
     
    45134924 *
    45144925 * @since 2.5.0
    45154926 *
    4516  * @param string $str   String to get the excerpt from.
    4517  * @param int    $count Maximum number of characters to take.
    4518  * @param string $more  Optional. What to append if $str needs to be trimmed. Defaults to empty string.
     4927 * @param string $str String to get the excerpt from.
     4928 * @param int $count Maximum number of characters to take.
     4929 * @param string $more Optional. What to append if $str needs to be trimmed. Defaults to empty string.
     4930 *
    45194931 * @return string The excerpt.
    45204932 */
    45214933function wp_html_excerpt( $str, $count, $more = null ) {
    4522         if ( null === $more )
     4934        if ( null === $more ) {
    45234935                $more = '';
    4524         $str = wp_strip_all_tags( $str, true );
     4936        }
     4937        $str     = wp_strip_all_tags( $str, true );
    45254938        $excerpt = mb_substr( $str, 0, $count );
    45264939        // remove part of an entity at the end
    45274940        $excerpt = preg_replace( '/&[^;\s]{0,6}$/', '', $excerpt );
    4528         if ( $str != $excerpt )
     4941        if ( $str != $excerpt ) {
    45294942                $excerpt = trim( $excerpt ) . $more;
     4943        }
     4944
    45304945        return $excerpt;
    45314946}
    45324947
     
    45414956 * @global string $_links_add_base
    45424957 *
    45434958 * @param string $content String to search for links in.
    4544  * @param string $base    The base URL to prefix to links.
    4545  * @param array  $attrs   The attributes which should be processed.
     4959 * @param string $base The base URL to prefix to links.
     4960 * @param array $attrs The attributes which should be processed.
     4961 *
    45464962 * @return string The processed content.
    45474963 */
    4548 function links_add_base_url( $content, $base, $attrs = array('src', 'href') ) {
     4964function links_add_base_url( $content, $base, $attrs = array( 'src', 'href' ) ) {
    45494965        global $_links_add_base;
    45504966        $_links_add_base = $base;
    4551         $attrs = implode('|', (array)$attrs);
     4967        $attrs           = implode( '|', (array) $attrs );
     4968
    45524969        return preg_replace_callback( "!($attrs)=(['\"])(.+?)\\2!i", '_links_add_base', $content );
    45534970}
    45544971
     
    45614978 * @global string $_links_add_base
    45624979 *
    45634980 * @param string $m The matched link.
     4981 *
    45644982 * @return string The processed link.
    45654983 */
    45664984function _links_add_base( $m ) {
    45674985        global $_links_add_base;
     4986
    45684987        //1 = attribute name  2 = quotation mark  3 = URL
    45694988        return $m[1] . '=' . $m[2] .
    4570                 ( preg_match( '#^(\w{1,20}):#', $m[3], $protocol ) && in_array( $protocol[1], wp_allowed_protocols() ) ?
    4571                         $m[3] :
    4572                         WP_Http::make_absolute_url( $m[3], $_links_add_base )
    4573                 )
    4574                 . $m[2];
     4989               ( preg_match( '#^(\w{1,20}):#', $m[3], $protocol ) && in_array( $protocol[1], wp_allowed_protocols() ) ?
     4990                       $m[3] :
     4991                       WP_Http::make_absolute_url( $m[3], $_links_add_base )
     4992               )
     4993               . $m[2];
    45754994}
    45764995
    45774996/**
     
    45875006 * @global string $_links_add_target
    45885007 *
    45895008 * @param string $content String to search for links in.
    4590  * @param string $target  The Target to add to the links.
    4591  * @param array  $tags    An array of tags to apply to.
     5009 * @param string $target The Target to add to the links.
     5010 * @param array $tags An array of tags to apply to.
     5011 *
    45925012 * @return string The processed content.
    45935013 */
    4594 function links_add_target( $content, $target = '_blank', $tags = array('a') ) {
     5014function links_add_target( $content, $target = '_blank', $tags = array( 'a' ) ) {
    45955015        global $_links_add_target;
    45965016        $_links_add_target = $target;
    4597         $tags = implode('|', (array)$tags);
     5017        $tags              = implode( '|', (array) $tags );
     5018
    45985019        return preg_replace_callback( "!<($tags)([^>]*)>!i", '_links_add_target', $content );
    45995020}
    46005021
     
    46075028 * @global string $_links_add_target
    46085029 *
    46095030 * @param string $m The matched link.
     5031 *
    46105032 * @return string The processed link.
    46115033 */
    46125034function _links_add_target( $m ) {
    46135035        global $_links_add_target;
    4614         $tag = $m[1];
    4615         $link = preg_replace('|( target=([\'"])(.*?)\2)|i', '', $m[2]);
     5036        $tag  = $m[1];
     5037        $link = preg_replace( '|( target=([\'"])(.*?)\2)|i', '', $m[2] );
     5038
    46165039        return '<' . $tag . $link . ' target="' . esc_attr( $_links_add_target ) . '">';
    46175040}
    46185041
     
    46225045 * @since 2.7.0
    46235046 *
    46245047 * @param string $str The string to normalize.
     5048 *
    46255049 * @return string The normalized string.
    46265050 */
    46275051function normalize_whitespace( $str ) {
    4628         $str  = trim( $str );
    4629         $str  = str_replace( "\r", "\n", $str );
    4630         $str  = preg_replace( array( '/\n+/', '/[ \t]+/' ), array( "\n", ' ' ), $str );
     5052        $str = trim( $str );
     5053        $str = str_replace( "\r", "\n", $str );
     5054        $str = preg_replace( array( '/\n+/', '/[ \t]+/' ), array( "\n", ' ' ), $str );
     5055
    46315056        return $str;
    46325057}
    46335058
     
    46405065 *
    46415066 * @since 2.9.0
    46425067 *
    4643  * @param string $string        String containing HTML tags
    4644  * @param bool   $remove_breaks Optional. Whether to remove left over line breaks and white space chars
     5068 * @param string $string String containing HTML tags
     5069 * @param bool $remove_breaks Optional. Whether to remove left over line breaks and white space chars
     5070 *
    46455071 * @return string The processed string.
    46465072 */
    4647 function wp_strip_all_tags($string, $remove_breaks = false) {
     5073function wp_strip_all_tags( $string, $remove_breaks = false ) {
    46485074        $string = preg_replace( '@<(script|style)[^>]*?>.*?</\\1>@si', '', $string );
    4649         $string = strip_tags($string);
     5075        $string = strip_tags( $string );
    46505076
    4651         if ( $remove_breaks )
    4652                 $string = preg_replace('/[\r\n\t ]+/', ' ', $string);
     5077        if ( $remove_breaks ) {
     5078                $string = preg_replace( '/[\r\n\t ]+/', ' ', $string );
     5079        }
    46535080
    46545081        return trim( $string );
    46555082}
     
    46705097 * @see wp_strip_all_tags()
    46715098 *
    46725099 * @param string $str String to sanitize.
     5100 *
    46735101 * @return string Sanitized string.
    46745102 */
    46755103function sanitize_text_field( $str ) {
     
    46815109         * @since 2.9.0
    46825110         *
    46835111         * @param string $filtered The sanitized string.
    4684          * @param string $str      The string prior to being sanitized.
     5112         * @param string $str The string prior to being sanitized.
    46855113         */
    46865114        return apply_filters( 'sanitize_text_field', $filtered, $str );
    46875115}
     
    46985126 * @since 4.7.0
    46995127 *
    47005128 * @param string $str String to sanitize.
     5129 *
    47015130 * @return string Sanitized string.
    47025131 */
    47035132function sanitize_textarea_field( $str ) {
     
    47095138         * @since 4.7.0
    47105139         *
    47115140         * @param string $filtered The sanitized string.
    4712          * @param string $str      The string prior to being sanitized.
     5141         * @param string $str The string prior to being sanitized.
    47135142         */
    47145143        return apply_filters( 'sanitize_textarea_field', $filtered, $str );
    47155144}
     
    47225151 *
    47235152 * @param string $str String to sanitize.
    47245153 * @param bool $keep_newlines optional Whether to keep newlines. Default: false.
     5154 *
    47255155 * @return string Sanitized string.
    47265156 */
    47275157function _sanitize_text_fields( $str, $keep_newlines = false ) {
    47285158        $filtered = wp_check_invalid_utf8( $str );
    47295159
    4730         if ( strpos($filtered, '<') !== false ) {
     5160        if ( strpos( $filtered, '<' ) !== false ) {
    47315161                $filtered = wp_pre_kses_less_than( $filtered );
    47325162                // This will strip extra whitespace for us.
    47335163                $filtered = wp_strip_all_tags( $filtered, false );
    47345164
    47355165                // Use html entities in a special case to make sure no later
    47365166                // newline stripping stage could lead to a functional tag
    4737                 $filtered = str_replace("<\n", "&lt;\n", $filtered);
     5167                $filtered = str_replace( "<\n", "&lt;\n", $filtered );
    47385168        }
    47395169
    47405170        if ( ! $keep_newlines ) {
     
    47435173        $filtered = trim( $filtered );
    47445174
    47455175        $found = false;
    4746         while ( preg_match('/%[a-f0-9]{2}/i', $filtered, $match) ) {
    4747                 $filtered = str_replace($match[0], '', $filtered);
    4748                 $found = true;
     5176        while ( preg_match( '/%[a-f0-9]{2}/i', $filtered, $match ) ) {
     5177                $filtered = str_replace( $match[0], '', $filtered );
     5178                $found    = true;
    47495179        }
    47505180
    47515181        if ( $found ) {
    47525182                // Strip out the whitespace that may now exist after removing the octets.
    4753                 $filtered = trim( preg_replace('/ +/', ' ', $filtered) );
     5183                $filtered = trim( preg_replace( '/ +/', ' ', $filtered ) );
    47545184        }
    47555185
    47565186        return $filtered;
     
    47615191 *
    47625192 * @since 3.1.0
    47635193 *
    4764  * @param string $path   A path.
     5194 * @param string $path A path.
    47655195 * @param string $suffix If the filename ends in suffix this will also be cut off.
     5196 *
    47665197 * @return string
    47675198 */
    47685199function wp_basename( $path, $suffix = '' ) {
     
    47795210 * @staticvar string|false $dblq
    47805211 *
    47815212 * @param string $text The text to be modified.
     5213 *
    47825214 * @return string The modified text.
    47835215 */
    47845216function capital_P_dangit( $text ) {
    47855217        // Simple replacement for titles
    47865218        $current_filter = current_filter();
    4787         if ( 'the_title' === $current_filter || 'wp_title' === $current_filter )
     5219        if ( 'the_title' === $current_filter || 'wp_title' === $current_filter ) {
    47885220                return str_replace( 'Wordpress', 'WordPress', $text );
     5221        }
    47895222        // Still here? Use the more judicious replacement
    47905223        static $dblq = false;
    47915224        if ( false === $dblq ) {
    47925225                $dblq = _x( '&#8220;', 'opening curly double quote' );
    47935226        }
     5227
    47945228        return str_replace(
    47955229                array( ' Wordpress', '&#8216;Wordpress', $dblq . 'Wordpress', '>Wordpress', '(Wordpress' ),
    47965230                array( ' WordPress', '&#8216;WordPress', $dblq . 'WordPress', '>WordPress', '(WordPress' ),
    4797         $text );
     5231                $text );
    47985232}
    47995233
    48005234/**
     
    48035237 * @since 3.1.3
    48045238 *
    48055239 * @param string $mime_type Mime type
     5240 *
    48065241 * @return string Sanitized mime type
    48075242 */
    48085243function sanitize_mime_type( $mime_type ) {
    48095244        $sani_mime_type = preg_replace( '/[^-+*.a-zA-Z0-9\/]/', '', $mime_type );
     5245
    48105246        /**
    48115247         * Filters a mime type following sanitization.
    48125248         *
    48135249         * @since 3.1.3
    48145250         *
    48155251         * @param string $sani_mime_type The sanitized mime type.
    4816          * @param string $mime_type      The mime type prior to sanitization.
     5252         * @param string $mime_type The mime type prior to sanitization.
    48175253         */
    48185254        return apply_filters( 'sanitize_mime_type', $sani_mime_type, $mime_type );
    48195255}
     
    48245260 * @since 3.4.0
    48255261 *
    48265262 * @param string $to_ping Space or carriage return separated URLs
     5263 *
    48275264 * @return string URLs starting with the http or https protocol, separated by a carriage return.
    48285265 */
    48295266function sanitize_trackback_urls( $to_ping ) {
    4830         $urls_to_ping = preg_split( '/[\r\n\t ]/', trim( $to_ping ), -1, PREG_SPLIT_NO_EMPTY );
     5267        $urls_to_ping = preg_split( '/[\r\n\t ]/', trim( $to_ping ), - 1, PREG_SPLIT_NO_EMPTY );
    48315268        foreach ( $urls_to_ping as $k => $url ) {
    4832                 if ( !preg_match( '#^https?://.#i', $url ) )
    4833                         unset( $urls_to_ping[$k] );
     5269                if ( ! preg_match( '#^https?://.#i', $url ) ) {
     5270                        unset( $urls_to_ping[ $k ] );
     5271                }
    48345272        }
    48355273        $urls_to_ping = array_map( 'esc_url_raw', $urls_to_ping );
    48365274        $urls_to_ping = implode( "\n", $urls_to_ping );
     5275
    48375276        /**
    48385277         * Filters a list of trackback URLs following sanitization.
    48395278         *
     
    48435282         * @since 3.4.0
    48445283         *
    48455284         * @param string $urls_to_ping Sanitized space or carriage return separated URLs.
    4846          * @param string $to_ping      Space or carriage return separated URLs before sanitization.
     5285         * @param string $to_ping Space or carriage return separated URLs before sanitization.
    48475286         */
    48485287        return apply_filters( 'sanitize_trackback_urls', $urls_to_ping, $to_ping );
    48495288}
     
    48575296 * @since 3.6.0
    48585297 *
    48595298 * @param string|array $value String or array of strings to slash.
     5299 *
    48605300 * @return string|array Slashed $value
    48615301 */
    48625302function wp_slash( $value ) {
    48635303        if ( is_array( $value ) ) {
    48645304                foreach ( $value as $k => $v ) {
    48655305                        if ( is_array( $v ) ) {
    4866                                 $value[$k] = wp_slash( $v );
     5306                                $value[ $k ] = wp_slash( $v );
    48675307                        } else {
    4868                                 $value[$k] = addslashes( $v );
     5308                                $value[ $k ] = addslashes( $v );
    48695309                        }
    48705310                }
    48715311        } else {
     
    48845324 * @since 3.6.0
    48855325 *
    48865326 * @param string|array $value String or array of strings to unslash.
     5327 *
    48875328 * @return string|array Unslashed $value
    48885329 */
    48895330function wp_unslash( $value ) {
     
    48965337 * @since 3.6.0
    48975338 *
    48985339 * @param string $content A string which might contain a URL.
     5340 *
    48995341 * @return string|false The found URL.
    49005342 */
    49015343function get_url_in_content( $content ) {
     
    49605402        }
    49615403
    49625404        $printed = true;
    4963 ?>
    4964 <style type="text/css">
    4965 img.wp-smiley,
    4966 img.emoji {
    4967         display: inline !important;
    4968         border: none !important;
    4969         box-shadow: none !important;
    4970         height: 1em !important;
    4971         width: 1em !important;
    4972         margin: 0 .07em !important;
    4973         vertical-align: -0.1em !important;
    4974         background: none !important;
    4975         padding: 0 !important;
    4976 }
    4977 </style>
    4978 <?php
     5405        ?>
     5406    <style type="text/css">
     5407        img.wp-smiley,
     5408        img.emoji {
     5409            display: inline !important;
     5410            border: none !important;
     5411            box-shadow: none !important;
     5412            height: 1em !important;
     5413            width: 1em !important;
     5414            margin: 0 .07em !important;
     5415            vertical-align: -0.1em !important;
     5416            background: none !important;
     5417            padding: 0 !important;
     5418        }
     5419    </style>
     5420        <?php
    49795421}
    49805422
    49815423/**
     
    50215463                 *
    50225464                 * @param string The emoji extension for png files. Default .png.
    50235465                 */
    5024                 'ext' => apply_filters( 'emoji_ext', '.png' ),
     5466                'ext'     => apply_filters( 'emoji_ext', '.png' ),
    50255467
    50265468                /**
    50275469                 * Filters the URL where emoji SVG images are hosted.
     
    50305472                 *
    50315473                 * @param string The emoji base URL for svg images.
    50325474                 */
    5033                 'svgUrl' => apply_filters( 'emoji_svg_url', 'https://s.w.org/images/core/emoji/2.2.1/svg/' ),
     5475                'svgUrl'  => apply_filters( 'emoji_svg_url', 'https://s.w.org/images/core/emoji/2.2.1/svg/' ),
    50345476
    50355477                /**
    50365478                 * Filters the extension of the emoji SVG files.
     
    50395481                 *
    50405482                 * @param string The emoji extension for svg files. Default .svg.
    50415483                 */
    5042                 'svgExt' => apply_filters( 'emoji_svg_ext', '.svg' ),
     5484                'svgExt'  => apply_filters( 'emoji_svg_ext', '.svg' ),
    50435485        );
    50445486
    50455487        $version = 'ver=' . get_bloginfo( 'version' );
     
    50535495                );
    50545496
    50555497                ?>
    5056                 <script type="text/javascript">
    5057                         window._wpemojiSettings = <?php echo wp_json_encode( $settings ); ?>;
     5498        <script type="text/javascript">
     5499            window._wpemojiSettings = <?php echo wp_json_encode( $settings ); ?>;
    50585500                        <?php readfile( ABSPATH . WPINC . "/js/wp-emoji-loader.js" ); ?>
    5059                 </script>
     5501        </script>
    50605502                <?php
    50615503        } else {
    50625504                $settings['source'] = array(
     
    50755517                 * and edit wp-emoji-loader.js directly.
    50765518                 */
    50775519                ?>
    5078                 <script type="text/javascript">
    5079                         window._wpemojiSettings = <?php echo wp_json_encode( $settings ); ?>;
    5080                         !function(a,b,c){function d(a){var b,c,d,e,f=String.fromCharCode;if(!k||!k.fillText)return!1;switch(k.clearRect(0,0,j.width,j.height),k.textBaseline="top",k.font="600 32px Arial",a){case"flag":return k.fillText(f(55356,56826,55356,56819),0,0),!(j.toDataURL().length<3e3)&&(k.clearRect(0,0,j.width,j.height),k.fillText(f(55356,57331,65039,8205,55356,57096),0,0),b=j.toDataURL(),k.clearRect(0,0,j.width,j.height),k.fillText(f(55356,57331,55356,57096),0,0),c=j.toDataURL(),b!==c);case"emoji4":return k.fillText(f(55357,56425,55356,57341,8205,55357,56507),0,0),d=j.toDataURL(),k.clearRect(0,0,j.width,j.height),k.fillText(f(55357,56425,55356,57341,55357,56507),0,0),e=j.toDataURL(),d!==e}return!1}function e(a){var c=b.createElement("script");c.src=a,c.defer=c.type="text/javascript",b.getElementsByTagName("head")[0].appendChild(c)}var f,g,h,i,j=b.createElement("canvas"),k=j.getContext&&j.getContext("2d");for(i=Array("flag","emoji4"),c.supports={everything:!0,everythingExceptFlag:!0},h=0;h<i.length;h++)c.supports[i[h]]=d(i[h]),c.supports.everything=c.supports.everything&&c.supports[i[h]],"flag"!==i[h]&&(c.supports.everythingExceptFlag=c.supports.everythingExceptFlag&&c.supports[i[h]]);c.supports.everythingExceptFlag=c.supports.everythingExceptFlag&&!c.supports.flag,c.DOMReady=!1,c.readyCallback=function(){c.DOMReady=!0},c.supports.everything||(g=function(){c.readyCallback()},b.addEventListener?(b.addEventListener("DOMContentLoaded",g,!1),a.addEventListener("load",g,!1)):(a.attachEvent("onload",g),b.attachEvent("onreadystatechange",function(){"complete"===b.readyState&&c.readyCallback()})),f=c.source||{},f.concatemoji?e(f.concatemoji):f.wpemoji&&f.twemoji&&(e(f.twemoji),e(f.wpemoji)))}(window,document,window._wpemojiSettings);
    5081                 </script>
     5520        <script type="text/javascript">
     5521            window._wpemojiSettings = <?php echo wp_json_encode( $settings ); ?>;
     5522            !function (a, b, c) {
     5523                function d(a) {
     5524                    var b, c, d, e, f = String.fromCharCode;
     5525                    if (!k || !k.fillText)return !1;
     5526                    switch (k.clearRect(0, 0, j.width, j.height), k.textBaseline = "top", k.font = "600 32px Arial", a) {
     5527                        case"flag":
     5528                            return k.fillText(f(55356, 56826, 55356, 56819), 0, 0), !(j.toDataURL().length < 3e3) && (k.clearRect(0, 0, j.width, j.height), k.fillText(f(55356, 57331, 65039, 8205, 55356, 57096), 0, 0), b = j.toDataURL(), k.clearRect(0, 0, j.width, j.height), k.fillText(f(55356, 57331, 55356, 57096), 0, 0), c = j.toDataURL(), b !== c);
     5529                        case"emoji4":
     5530                            return k.fillText(f(55357, 56425, 55356, 57341, 8205, 55357, 56507), 0, 0), d = j.toDataURL(), k.clearRect(0, 0, j.width, j.height), k.fillText(f(55357, 56425, 55356, 57341, 55357, 56507), 0, 0), e = j.toDataURL(), d !== e
     5531                    }
     5532                    return !1
     5533                }
     5534
     5535                function e(a) {
     5536                    var c = b.createElement("script");
     5537                    c.src = a, c.defer = c.type = "text/javascript", b.getElementsByTagName("head")[0].appendChild(c)
     5538                }
     5539
     5540                var f, g, h, i, j = b.createElement("canvas"), k = j.getContext && j.getContext("2d");
     5541                for (i = Array("flag", "emoji4"), c.supports = {
     5542                    everything: !0,
     5543                    everythingExceptFlag: !0
     5544                }, h = 0; h < i.length; h++)c.supports[i[h]] = d(i[h]), c.supports.everything = c.supports.everything && c.supports[i[h]], "flag" !== i[h] && (c.supports.everythingExceptFlag = c.supports.everythingExceptFlag && c.supports[i[h]]);
     5545                c.supports.everythingExceptFlag = c.supports.everythingExceptFlag && !c.supports.flag, c.DOMReady = !1, c.readyCallback = function () {
     5546                    c.DOMReady = !0
     5547                }, c.supports.everything || (g = function () {
     5548                    c.readyCallback()
     5549                }, b.addEventListener ? (b.addEventListener("DOMContentLoaded", g, !1), a.addEventListener("load", g, !1)) : (a.attachEvent("onload", g), b.attachEvent("onreadystatechange", function () {
     5550                    "complete" === b.readyState && c.readyCallback()
     5551                })), f = c.source || {}, f.concatemoji ? e(f.concatemoji) : f.wpemoji && f.twemoji && (e(f.twemoji), e(f.wpemoji)))
     5552            }(window, document, window._wpemojiSettings);
     5553        </script>
    50825554                <?php
    50835555        }
    50845556}
     
    50945566 * @since 4.2.0
    50955567 *
    50965568 * @param string $content The content to encode.
     5569 *
    50975570 * @return string The encoded content.
    50985571 */
    50995572function wp_encode_emoji( $content ) {
     
    51195592                                         */
    51205593                                        $unpacked = unpack( 'H*', mb_convert_encoding( $emoji, 'UTF-32', 'UTF-8' ) );
    51215594                                        if ( isset( $unpacked[1] ) ) {
    5122                                                 $entity = '&#x' . ltrim( $unpacked[1], '0' ) . ';';
     5595                                                $entity  = '&#x' . ltrim( $unpacked[1], '0' ) . ';';
    51235596                                                $content = str_replace( $emoji, $entity, $content );
    51245597                                        }
    51255598                                }
     
    51365609 * @since 4.2.0
    51375610 *
    51385611 * @param string $text The content to encode.
     5612 *
    51395613 * @return string The encoded content.
    51405614 */
    51415615function wp_staticize_emoji( $text ) {
     
    51545628         *
    51555629         * First, capture the tags as well as in between.
    51565630         */
    5157         $textarr = preg_split( '/(<.*>)/U', $text, -1, PREG_SPLIT_DELIM_CAPTURE );
    5158         $stop = count( $textarr );
     5631        $textarr = preg_split( '/(<.*>)/U', $text, - 1, PREG_SPLIT_DELIM_CAPTURE );
     5632        $stop    = count( $textarr );
    51595633
    51605634        // Ignore processing of specific tags.
    5161         $tags_to_ignore = 'code|pre|style|script|textarea';
     5635        $tags_to_ignore       = 'code|pre|style|script|textarea';
    51625636        $ignore_block_element = '';
    51635637
    5164         for ( $i = 0; $i < $stop; $i++ ) {
    5165                 $content = $textarr[$i];
     5638        for ( $i = 0; $i < $stop; $i ++ ) {
     5639                $content = $textarr[ $i ];
    51665640
    51675641                // If we're in an ignore block, wait until we find its closing tag.
    5168                 if ( '' == $ignore_block_element && preg_match( '/^<(' . $tags_to_ignore . ')>/', $content, $matches ) )  {
     5642                if ( '' == $ignore_block_element && preg_match( '/^<(' . $tags_to_ignore . ')>/', $content, $matches ) ) {
    51695643                        $ignore_block_element = $matches[1];
    51705644                }
    51715645
    51725646                // If it's not a tag and not in ignore block.
    5173                 if ( '' ==  $ignore_block_element && strlen( $content ) > 0 && '<' != $content[0] ) {
     5647                if ( '' == $ignore_block_element && strlen( $content ) > 0 && '<' != $content[0] ) {
    51745648                        $matches = array();
    51755649                        if ( preg_match_all( '/(&#x1f1(e[6-9a-f]|f[0-9a-f]);){2}/', $content, $matches ) ) {
    51765650                                if ( ! empty( $matches[0] ) ) {
    51775651                                        foreach ( $matches[0] as $flag ) {
    5178                                                 $chars = str_replace( array( '&#x', ';'), '', $flag );
     5652                                                $chars = str_replace( array( '&#x', ';' ), '', $flag );
    51795653
    51805654                                                list( $char1, $char2 ) = str_split( $chars, 5 );
    51815655                                                $entity = sprintf( '<img src="%s" alt="%s" class="wp-smiley" style="height: 1em; max-height: 1em;" />', $cdn_url . $char1 . '-' . $char2 . $ext, html_entity_decode( $flag ) );
     
    51925666                        if ( preg_match_all( $regex, $content, $matches ) ) {
    51935667                                if ( ! empty( $matches[1] ) ) {
    51945668                                        foreach ( $matches[1] as $emoji ) {
    5195                                                 $char = str_replace( array( '&#x', ';'), '', $emoji );
     5669                                                $char   = str_replace( array( '&#x', ';' ), '', $emoji );
    51965670                                                $entity = sprintf( '<img src="%s" alt="%s" class="wp-smiley" style="height: 1em; max-height: 1em;" />', $cdn_url . $char . $ext, html_entity_decode( $emoji ) );
    51975671
    51985672                                                $content = str_replace( $emoji, $entity, $content );
     
    52025676                }
    52035677
    52045678                // Did we exit ignore block.
    5205                 if ( '' != $ignore_block_element && '</' . $ignore_block_element . '>' == $content )  {
     5679                if ( '' != $ignore_block_element && '</' . $ignore_block_element . '>' == $content ) {
    52065680                        $ignore_block_element = '';
    52075681                }
    52085682
     
    52185692 * @since 4.2.0
    52195693 *
    52205694 * @param array $mail The email data array.
     5695 *
    52215696 * @return array The email data array, with emoji in the message staticized.
    52225697 */
    52235698function wp_staticize_emoji_for_email( $mail ) {
     
    52425717        }
    52435718
    52445719        foreach ( $headers as $header ) {
    5245                 if ( strpos($header, ':') === false ) {
     5720                if ( strpos( $header, ':' ) === false ) {
    52465721                        continue;
    52475722                }
    52485723
     
    52505725                list( $name, $content ) = explode( ':', trim( $header ), 2 );
    52515726
    52525727                // Cleanup crew.
    5253                 $name    = trim( $name    );
     5728                $name    = trim( $name );
    52545729                $content = trim( $content );
    52555730
    52565731                if ( 'content-type' === strtolower( $name ) ) {
     
    52855760 * @since 1.2.0
    52865761 * @since 4.4.0 Moved to wp-includes/formatting.php from wp-admin/includes/misc.php and added $length param.
    52875762 *
    5288  * @param string $url    URL to shorten.
    5289  * @param int    $length Optional. Maximum length of the shortened URL. Default 35 characters.
     5763 * @param string $url URL to shorten.
     5764 * @param int $length Optional. Maximum length of the shortened URL. Default 35 characters.
     5765 *
    52905766 * @return string Shortened URL.
    52915767 */
    52925768function url_shorten( $url, $length = 35 ) {
    5293         $stripped = str_replace( array( 'https://', 'http://', 'www.' ), '', $url );
     5769        $stripped  = str_replace( array( 'https://', 'http://', 'www.' ), '', $url );
    52945770        $short_url = untrailingslashit( $stripped );
    52955771
    52965772        if ( strlen( $short_url ) > $length ) {
    52975773                $short_url = substr( $short_url, 0, $length - 3 ) . '&hellip;';
    52985774        }
     5775
    52995776        return $short_url;
    53005777}
    53015778
     
    53085785 * @since 3.4.0
    53095786 *
    53105787 * @param string $color
     5788 *
    53115789 * @return string|void
    53125790 */
    53135791function sanitize_hex_color( $color ) {
     
    53165794        }
    53175795
    53185796        // 3 or 6 hex digits, or the empty string.
    5319         if ( preg_match('|^#([A-Fa-f0-9]{3}){1,2}$|', $color ) ) {
     5797        if ( preg_match( '|^#([A-Fa-f0-9]{3}){1,2}$|', $color ) ) {
    53205798                return $color;
    53215799        }
    53225800}
     
    53335811 * @since 3.4.0
    53345812 *
    53355813 * @param string $color
     5814 *
    53365815 * @return string|null
    53375816 */
    53385817function sanitize_hex_color_no_hash( $color ) {
     
    53545833 * @since 3.4.0
    53555834 *
    53565835 * @param string $color
     5836 *
    53575837 * @return string
    53585838 */
    53595839function maybe_hash_hex_color( $color ) {