Ticket #10823: 10823.5.diff
File 10823.5.diff, 2.4 KB (added by , 9 years ago) |
---|
-
wp-includes/formatting.php
1814 1814 $username = remove_accents( $username ); 1815 1815 // Kill octets 1816 1816 $username = preg_replace( '|%([a-fA-F0-9][a-fA-F0-9])|', '', $username ); 1817 $username = preg_replace( '/& .+?;/', '', $username ); // Kill entities1817 $username = preg_replace( '/&#?\w+;/', '', $username ); // Kill entities 1818 1818 1819 1819 // If strict, reduce to ASCII for max portability. 1820 if ( $strict ) 1820 if ( $strict ) { 1821 1821 $username = preg_replace( '|[^a-z0-9 _.\-@]|i', '', $username ); 1822 } 1822 1823 1823 $username = trim( $username );1824 $username = trim( $username 1824 1825 // Consolidate contiguous whitespace 1825 1826 $username = preg_replace( '|\s+|', ' ', $username ); 1826 1827 … … 1927 1928 * @return string The sanitized title. 1928 1929 */ 1929 1930 function sanitize_title_with_dashes( $title, $raw_title = '', $context = 'display' ) { 1930 $title = strip_tags( $title);1931 $title = strip_tags( $title ); 1931 1932 // Preserve escaped octets. 1932 $title = preg_replace( '|%([a-fA-F0-9][a-fA-F0-9])|', '---$1---', $title);1933 $title = preg_replace( '|%([a-fA-F0-9][a-fA-F0-9])|', '---$1---', $title ); 1933 1934 // Remove percent signs that are not part of an octet. 1934 $title = str_replace( '%', '', $title);1935 $title = str_replace( '%', '', $title); 1935 1936 // Restore octets. 1936 $title = preg_replace( '|---([a-fA-F0-9][a-fA-F0-9])---|', '%$1', $title);1937 $title = preg_replace( '|---([a-fA-F0-9][a-fA-F0-9])---|', '%$1', $title ); 1937 1938 1938 if ( seems_utf8($title)) {1939 if ( function_exists('mb_strtolower')) {1940 $title = mb_strtolower( $title, 'UTF-8');1939 if ( seems_utf8( $title ) ) { 1940 if ( function_exists( 'mb_strtolower' ) ) { 1941 $title = mb_strtolower( $title, 'UTF-8' ); 1941 1942 } 1942 $title = utf8_uri_encode( $title, 200);1943 $title = utf8_uri_encode( $title, 200 ); 1943 1944 } 1944 1945 1945 $title = strtolower( $title);1946 $title = strtolower( $title ); 1946 1947 1947 1948 if ( 'save' == $context ) { 1948 1949 // Convert nbsp, ndash and mdash to hyphens … … 1971 1972 $title = str_replace( '%c3%97', 'x', $title ); 1972 1973 } 1973 1974 1974 $title = preg_replace( '/&.+?;/', '', $title); // kill entities1975 $title = str_replace( '.', '-', $title);1975 $title = preg_replace( '/&#?\w+;/', '', $title ); // kill entities 1976 $title = str_replace( '.', '-', $title ); 1976 1977 1977 1978 $title = preg_replace('/[^%a-z0-9 _-]/', '', $title); 1978 1979 $title = preg_replace('/\s+/', '-', $title);