Ticket #8689: preg-replace.patch
| File preg-replace.patch, 7.9 KB (added by beaulebens, 4 years ago) |
|---|
-
wp-includes/post-template.php
223 223 224 224 } 225 225 if ( $preview ) // preview fix for javascript bug with foreign languages 226 $output = preg_replace ('/\%u([0-9A-F]{4,4})/e', "'&#'.base_convert('\\1',16,10).';'", $output);226 $output = preg_replace_callback('/\%u([0-9A-F]{4})/', create_function('$match', 'return "&#" . base_convert($match[1], 16, 10) . ";";'), $output); 227 227 228 228 return $output; 229 229 } -
wp-includes/formatting.php
1317 1317 return $string; 1318 1318 } else { 1319 1319 $subject = str_replace('_', ' ', $matches[2]); 1320 /** @todo use preg_replace_callback() */ 1321 $subject = preg_replace('#\=([0-9a-f]{2})#ei', "chr(hexdec(strtolower('$1')))", $subject); 1320 $subject = preg_replace_callback('#\=([0-9a-f]{2})#i', create_function('$match', 'return chr(hexdec(strtolower($match[1])));'), $subject); 1322 1321 return $subject; 1323 1322 } 1324 1323 } -
wp-includes/kses.php
394 394 * @return string Content with fixed HTML tags 395 395 */ 396 396 function wp_kses_split($string, $allowed_html, $allowed_protocols) { 397 return preg_replace('%((<!--.*?(-->|$))|(<[^>]*(>|$)|>))%e', 398 "wp_kses_split2('\\1', \$allowed_html, ".'$allowed_protocols)', $string); 397 global $pass_allowed_html, $pass_allowed_protocols; 398 $pass_allowed_html = $allowed_html; 399 $pass_allowed_protocols = $allowed_protocols; 400 return preg_replace_callback('%((<!--.*?(-->|$))|(<[^>]*(>|$)|>))%', 401 create_function('$match', 'global $pass_allowed_html, $pass_allowed_protocols; return wp_kses_split2($match[1], $pass_allowed_html, $pass_allowed_protocols);'), $string); 399 402 } 400 403 401 404 /** … … 999 1002 * @return string Content after decoded entities 1000 1003 */ 1001 1004 function wp_kses_decode_entities($string) { 1002 $string = preg_replace ('/&#([0-9]+);/e', 'chr("\\1")', $string);1003 $string = preg_replace ('/&#[Xx]([0-9A-Fa-f]+);/e', 'chr(hexdec("\\1"))', $string);1005 $string = preg_replace_callback('/&#([0-9]+);/', create_function('$match', 'return chr($match[1]);'), $string); 1006 $string = preg_replace_callback('/&#[Xx]([0-9A-Fa-f]+);/', create_function('$match', 'return chr(hexdec($match[1]));'), $string); 1004 1007 1005 1008 return $string; 1006 1009 } -
wp-admin/import/livejournal.php
71 71 $post_content = $this->unhtmlentities($post_content); 72 72 73 73 // Clean up content 74 $post_content = preg_replace ('|<(/?[A-Z]+)|e', "'<' . strtolower('$1')", $post_content);74 $post_content = preg_replace_callback('|<(/?[A-Z]+)|', create_function('$match', 'return "<" . strtolower($match[1]);'), $post_content); 75 75 $post_content = str_replace('<br>', '<br />', $post_content); 76 76 $post_content = str_replace('<hr>', '<hr />', $post_content); 77 77 $post_content = $wpdb->escape($post_content); … … 107 107 $comment_content = $this->unhtmlentities($comment_content); 108 108 109 109 // Clean up content 110 $comment_content = preg_replace ('|<(/?[A-Z]+)|e', "'<' . strtolower('$1')", $comment_content);110 $comment_content = preg_replace_callback('|<(/?[A-Z]+)|', create_function('$match', 'return "<" . strtolower($match[1]);'), $comment_content); 111 111 $comment_content = str_replace('<br>', '<br />', $comment_content); 112 112 $comment_content = str_replace('<hr>', '<hr />', $comment_content); 113 113 $comment_content = $wpdb->escape($comment_content); -
wp-admin/import/blogware.php
89 89 } 90 90 91 91 // Clean up content 92 $post_content = preg_replace ('|<(/?[A-Z]+)|e', "'<' . strtolower('$1')", $post_content);92 $post_content = preg_replace_callback('|<(/?[A-Z]+)|', create_function('$match', 'return "<" . strtolower($match[1]);'), $post_content); 93 93 $post_content = str_replace('<br>', '<br />', $post_content); 94 94 $post_content = str_replace('<hr>', '<hr />', $post_content); 95 95 $post_content = $wpdb->escape($post_content); … … 129 129 $comment_content = $this->unhtmlentities($comment_content); 130 130 131 131 // Clean up content 132 $comment_content = preg_replace ('|<(/?[A-Z]+)|e', "'<' . strtolower('$1')", $comment_content);132 $comment_content = preg_replace_callback('|<(/?[A-Z]+)|', create_function('$match', 'return "<" . strtolower($match[1]);'), $comment_content); 133 133 $comment_content = str_replace('<br>', '<br />', $comment_content); 134 134 $comment_content = str_replace('<hr>', '<hr />', $comment_content); 135 135 $comment_content = $wpdb->escape($comment_content); -
wp-admin/import/rss.php
103 103 } 104 104 105 105 // Clean up content 106 $post_content = preg_replace ('|<(/?[A-Z]+)|e', "'<' . strtolower('$1')", $post_content);106 $post_content = preg_replace_callback('|<(/?[A-Z]+)|', create_function('$match', 'return "<" . strtolower($match[1]);'), $post_content); 107 107 $post_content = str_replace('<br>', '<br />', $post_content); 108 108 $post_content = str_replace('<hr>', '<hr />', $post_content); 109 109 -
wp-admin/import/blogger.php
550 550 $post_status = isset( $entry->draft ) ? 'draft' : 'publish'; 551 551 552 552 // Clean up content 553 $post_content = preg_replace ('|<(/?[A-Z]+)|e', "'<' . strtolower('$1')", $post_content);553 $post_content = preg_replace_callback('|<(/?[A-Z]+)|', create_function('$match', 'return "<" . strtolower($match[1]);'), $post_content); 554 554 $post_content = str_replace('<br>', '<br />', $post_content); 555 555 $post_content = str_replace('<hr>', '<hr />', $post_content); 556 556 … … 603 603 $comment_content = addslashes( $this->no_apos( html_entity_decode( $entry->content ) ) ); 604 604 605 605 // Clean up content 606 $comment_content = preg_replace ('|<(/?[A-Z]+)|e', "'<' . strtolower('$1')", $comment_content);606 $comment_content = preg_replace_callback('|<(/?[A-Z]+)|', create_function('$match', 'return "<" . strtolower($match[1]);'), $comment_content); 607 607 $comment_content = str_replace('<br>', '<br />', $comment_content); 608 608 $comment_content = str_replace('<hr>', '<hr />', $comment_content); 609 609 -
wp-admin/import/wordpress.php
381 381 $post_author = $this->get_tag( $post, 'dc:creator' ); 382 382 383 383 $post_excerpt = $this->get_tag( $post, 'excerpt:encoded' ); 384 $post_excerpt = preg_replace ('|<(/?[A-Z]+)|e', "'<' . strtolower('$1')", $post_excerpt);384 $post_excerpt = preg_replace_callback('|<(/?[A-Z]+)|', create_function('$match', 'return "<" . strtolower($match[1]);'), $post_excerpt); 385 385 $post_excerpt = str_replace('<br>', '<br />', $post_excerpt); 386 386 $post_excerpt = str_replace('<hr>', '<hr />', $post_excerpt); 387 387 388 388 $post_content = $this->get_tag( $post, 'content:encoded' ); 389 $post_content = preg_replace ('|<(/?[A-Z]+)|e', "'<' . strtolower('$1')", $post_content);389 $post_content = preg_replace_callback('|<(/?[A-Z]+)|', create_function('$match', 'return "<" . strtolower($match[1]);'), $post_content); 390 390 $post_content = str_replace('<br>', '<br />', $post_content); 391 391 $post_content = str_replace('<hr>', '<hr />', $post_content); 392 392