Remove _convert_urlencoded_to_entities() from the get_the_content() callback.

Props vortfu, whyisjake, peterwilsoncc


git-svn-id: https://develop.svn.wordpress.org/trunk@45935 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Jake Spurlock 2019-09-04 16:03:56 +00:00
parent 759ee944c6
commit 7f033deee5
6 changed files with 0 additions and 101 deletions

View File

@ -368,26 +368,9 @@ function get_the_content( $more_link_text = null, $strip_teaser = false, $post =
}
}
if ( $preview ) { // Preview fix for JavaScript bug with foreign languages.
$output = preg_replace_callback( '/\%u([0-9A-F]{4})/', '_convert_urlencoded_to_entities', $output );
}
return $output;
}
/**
* Preview fix for JavaScript bug with foreign languages.
*
* @since 3.1.0
* @access private
*
* @param array $match Match array from preg_replace_callback.
* @return string
*/
function _convert_urlencoded_to_entities( $match ) {
return '&#' . base_convert( $match[1], 16, 10 ) . ';';
}
/**
* Display the post excerpt.
*

View File

@ -1,24 +0,0 @@
# Generates entitized.txt from utf-8.txt
#
# entitized.txt is used by Tests_Formatting_UrlEncodedToEntities
import codecs
import sys
def entitize(line):
"""Convert text to &#[dec]; entities."""
line = line.strip();
line = ["&#%d;" % ord(s) for s in line]
return "".join(line)
if __name__ == "__main__":
args = sys.argv[1:]
if args and args[0] in ("-h", "--help"):
print "Usage: python entitize.py < utf-8.txt > entitized.txt"
sys.exit(2)
sys.stdin = codecs.getreader("utf-8")(sys.stdin)
sys.stdout = codecs.getwriter("ascii")(sys.stdout)
lines = sys.stdin.readlines()
sys.stdout.write( "\n".join(map(entitize, lines)) )

View File

@ -1,6 +0,0 @@
&#31456;&#23376;&#24609;
&#70;&#114;&#97;&#110;&#231;&#111;&#105;&#115;&#32;&#84;&#114;&#117;&#102;&#102;&#97;&#117;&#116;
&#4321;&#4304;&#4325;&#4304;&#4320;&#4311;&#4309;&#4308;&#4314;&#4317;
&#66;&#106;&#246;&#114;&#107;&#32;&#71;&#117;&#240;&#109;&#117;&#110;&#100;&#115;&#100;&#243;&#116;&#116;&#105;&#114;
&#23470;&#23822;&#12288;&#39423;
&#128077;

View File

@ -1,24 +0,0 @@
# Generates u-urlencoded.txt from utf-8.txt
#
# u-urlencoded.txt is used by Tests_Formatting_UrlEncodedToEntities
import codecs
import sys
def uurlencode(line):
"""Use %u[hexvalue] percent encoding."""
line = line.strip()
line = ["%%u%04X" % ord(s) for s in line]
return "".join(line)
if __name__ == "__main__":
args = sys.argv[1:]
if args and args[0] in ("-h", "--help"):
print "Usage: python u-urlencode.py < utf-8.txt > u-urlencoded.txt"
sys.exit(2)
sys.stdin = codecs.getreader("utf-8")(sys.stdin)
sys.stdout = codecs.getwriter("ascii")(sys.stdout)
lines = sys.stdin.readlines()
sys.stdout.write( "\n".join(map(uurlencode, lines)) )

View File

@ -1,6 +0,0 @@
%u7AE0%u5B50%u6021
%u0046%u0072%u0061%u006E%u00E7%u006F%u0069%u0073%u0020%u0054%u0072%u0075%u0066%u0066%u0061%u0075%u0074
%u10E1%u10D0%u10E5%u10D0%u10E0%u10D7%u10D5%u10D4%u10DA%u10DD
%u0042%u006A%u00F6%u0072%u006B%u0020%u0047%u0075%u00F0%u006D%u0075%u006E%u0064%u0073%u0064%u00F3%u0074%u0074%u0069%u0072
%u5BAE%u5D0E%u3000%u99FF
%u1F44D

View File

@ -1,24 +0,0 @@
<?php
/**
* @group formatting
*/
class Tests_Formatting_UrlEncodedToEntities extends WP_UnitTestCase {
/**
* @dataProvider data
*/
function test_convert_urlencoded_to_entities( $u_urlencoded, $entity ) {
$this->assertEquals( $entity, preg_replace_callback( '/\%u([0-9A-F]{4,5})/', '_convert_urlencoded_to_entities', $u_urlencoded ), $entity );
}
function data() {
$input = file( DIR_TESTDATA . '/formatting/utf-8/u-urlencoded.txt' );
$output = file( DIR_TESTDATA . '/formatting/utf-8/entitized.txt' );
$data_provided = array();
foreach ( $input as $key => $value ) {
$data_provided[] = array( trim( $value ), trim( $output[ $key ] ) );
}
return $data_provided;
}
}