Add a `$run_texturize` static var to `wptexturize()` that is filterable via a new run-once filter: `'run_wptexturize'`. Allows user to disable texturization.

Needs filter docs.

Props nacin, SergeyBiryukov.
See #19550.

Built from https://develop.svn.wordpress.org/trunk@28715


git-svn-id: http://core.svn.wordpress.org/trunk@28529 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2014-06-10 01:46:14 +00:00
parent 05eeb16e30
commit b4b0efe701
1 changed files with 10 additions and 1 deletions

View File

@ -29,10 +29,19 @@
function wptexturize($text) {
global $wp_cockneyreplace;
static $static_characters, $static_replacements, $dynamic_characters, $dynamic_replacements,
$default_no_texturize_tags, $default_no_texturize_shortcodes;
$default_no_texturize_tags, $default_no_texturize_shortcodes, $run_texturize = true;
if ( false === $run_texturize ) {
return $text;
}
// No need to set up these static variables more than once
if ( ! isset( $static_characters ) ) {
$run_texturize = apply_filters( 'run_wptexturize', $run_texturize );
if ( false === $run_texturize ) {
return $text;
}
/* translators: opening curly double quote */
$opening_quote = _x( '“', 'opening curly double quote' );
/* translators: closing curly double quote */