From 9a7f374e7c65f2e2e247e5892a6f35de11221ae0 Mon Sep 17 00:00:00 2001 From: markjaquith Date: Wed, 4 Oct 2006 06:07:48 +0000 Subject: [PATCH] Allow user replacement of cockney replacement array. fixes #1032 git-svn-id: http://svn.automattic.com/wordpress/trunk@4308 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/formatting.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php index 330cb9bbb..1aeb7a925 100644 --- a/wp-includes/formatting.php +++ b/wp-includes/formatting.php @@ -1,6 +1,7 @@ )/Us", $text, -1, PREG_SPLIT_DELIM_CAPTURE); @@ -16,9 +17,15 @@ function wptexturize($text) { $curl = str_replace('...', '…', $curl); $curl = str_replace('``', '“', $curl); - // This is a hack, look at this more later. It works pretty well though. - $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"); + // if a plugin has provided an autocorrect array, use it + if ( isset($wp_cockneyreplace) ) { + $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 = preg_replace("/'s/", '’s', $curl);