Allow user replacement of cockney replacement array. fixes #1032
git-svn-id: https://develop.svn.wordpress.org/trunk@4308 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
1c0f13ab9a
commit
c37652968a
|
@ -1,6 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
function wptexturize($text) {
|
function wptexturize($text) {
|
||||||
|
global $wp_cockneyreplace;
|
||||||
$output = '';
|
$output = '';
|
||||||
// Capture tags and everything inside them
|
// Capture tags and everything inside them
|
||||||
$textarr = preg_split("/(<.*>)/Us", $text, -1, PREG_SPLIT_DELIM_CAPTURE);
|
$textarr = preg_split("/(<.*>)/Us", $text, -1, PREG_SPLIT_DELIM_CAPTURE);
|
||||||
|
@ -16,9 +17,15 @@ function wptexturize($text) {
|
||||||
$curl = str_replace('...', '…', $curl);
|
$curl = str_replace('...', '…', $curl);
|
||||||
$curl = str_replace('``', '“', $curl);
|
$curl = str_replace('``', '“', $curl);
|
||||||
|
|
||||||
// This is a hack, look at this more later. It works pretty well though.
|
// if a plugin has provided an autocorrect array, use it
|
||||||
$cockney = array("'tain't","'twere","'twas","'tis","'twill","'til","'bout","'nuff","'round","'cause");
|
if ( isset($wp_cockneyreplace) ) {
|
||||||
$cockneyreplace = array("’tain’t","’twere","’twas","’tis","’twill","’til","’bout","’nuff","’round","’cause");
|
$cockney = array_keys($wp_cockneyreplace);
|
||||||
|
$cockney_replace = array_values($wp_cockneyreplace);
|
||||||
|
} else {
|
||||||
|
$cockney = array("'tain't","'twere","'twas","'tis","'twill","'til","'bout","'nuff","'round","'cause");
|
||||||
|
$cockneyreplace = array("’tain’t","’twere","’twas","’tis","’twill","’til","’bout","’nuff","’round","’cause");
|
||||||
|
}
|
||||||
|
|
||||||
$curl = str_replace($cockney, $cockneyreplace, $curl);
|
$curl = str_replace($cockney, $cockneyreplace, $curl);
|
||||||
|
|
||||||
$curl = preg_replace("/'s/", '’s', $curl);
|
$curl = preg_replace("/'s/", '’s', $curl);
|
||||||
|
|
Loading…
Reference in New Issue