[oik] plugins.com

WordPress plugins and themes

  • Home
  • About
    • lazy shortcodes
    • smart shortcodes
    • oik base plugin
      • oik – donate
      • oik PayPal buttons
      • oik installation
      • oik Button Shortcode button
      • oik changelog
      • oik FAQ
      • oik plugins on SVN
      • oik plugins on GitHub
  • Plugins
    • oik base plugin
    • FREE oik plugins
    • WordPress plugins
    • Premium oik plugins
    • Bespoke oik plugins
  • Shortcodes
    • Shortcode examples
  • Blocks
    • Block examples
  • APIs
    • ALL action and filter hooks
  • Blog

wptexturize_after_shortcodes() – Replaces common plain text characters into formatted entities

You appear to be a bot. Output may be restricted

Description

Replaces common plain text characters into formatted entities

As an example,

  • 'cause today's effort makes it worth tomorrow's "holiday" …
Becomes:
  • ’cause today’s effort makes it worth tomorrow’s “holiday” …
Code within certain html blocks are skipped.

Usage

$string = wptexturize_after_shortcodes( $text, $reset );

Parameters

$text
( string ) required – The text to be formatted
$reset
( bool ) optional – Set to true for unit testing. Translated patterns will reset.

Returns

string The string replaced with html entities

Source

File name: oik-css/includes/formatting-later.php
Lines:
101 to 200 of 274
    }

    // Apostrophe in a word.  No spaces, double apostrophes, or other punctuation.
    if ( "'" !== $apos ) {
      $dynamic[ '/(?<!' . $spaces . ')\'(?!\Z|[.,:;"\'(){}[\]\-]|&[lg]t;|' . $spaces . ')/' ] = $apos;
    }

    // 9' (prime)
    if ( "'" !== $prime ) {
      $dynamic[ '/(?<=\d)\'/' ] = $prime;
    }

    // Single quotes followed by spaces or ending punctuation.
    if ( "'" !== $closing_single_quote ) {
      $dynamic[ '/\'(?=\Z|[.,)}\-\]]|&gt;|' . $spaces . ')/' ] = $closing_single_quote;
    }

    $dynamic_characters['apos'] = array_keys( $dynamic );
    $dynamic_replacements['apos'] = array_values( $dynamic );
    $dynamic = array();

    // Quoted Numbers like "42"
    if ( '"' !== $opening_quote && '"' !== $closing_quote ) {
      $dynamic[ '/(?<=\A|' . $spaces . ')"(\d[.,\d]*)"/' ] = $opening_quote . '$1' . $closing_quote;
    }

    // 9" (double prime)
    if ( '"' !== $double_prime ) {
      $dynamic[ '/(?<=\d)"/' ] = $double_prime;
    }

    // Double quote at start, or preceded by (, {, <, [, -, or spaces, and not followed by spaces.
    if ( '"' !== $opening_quote ) {
      $dynamic[ '/(?<=\A|[([{\-]|&lt;|' . $spaces . ')"(?!' . $spaces . ')/' ] = $opening_quote;
    }

    // Any remaining double quotes.
    if ( '"' !== $closing_quote ) {
      $dynamic[ '/"/' ] = $closing_quote;
    }

    $dynamic_characters['quote'] = array_keys( $dynamic );
    $dynamic_replacements['quote'] = array_values( $dynamic );
    $dynamic = array();

    // Dashes and spaces
    $dynamic[ '/---/' ] = $em_dash;
    $dynamic[ '/(?<=' . $spaces . ')--(?=' . $spaces . ')/' ] = $em_dash;
    $dynamic[ '/(?<!xn)--/' ] = $en_dash;
    $dynamic[ '/(?<=' . $spaces . ')-(?=' . $spaces . ')/' ] = $en_dash;

    $dynamic_characters['dash'] = array_keys( $dynamic );
    $dynamic_replacements['dash'] = array_values( $dynamic );
  }

  // Must do this every time in case plugins use these filters in a context sensitive manner
  
/**
 * Filter the list of HTML elements not to texturize.
 *
 * @since 2.8.0
 *
 * @param array $default_no_texturize_tags An array of HTML element names.
 */
  $no_texturize_tags = apply_filters( 'no_texturize_tags', $default_no_texturize_tags );
  
/**
 * Filter the list of shortcodes not to texturize.
 *
 * @since 2.8.0
 *
 * @param array $default_no_texturize_shortcodes An array of shortcode names.
 */
  $no_texturize_shortcodes = apply_filters( 'no_texturize_shortcodes', $default_no_texturize_shortcodes );

  $no_texturize_tags_stack = array();
  $no_texturize_shortcodes_stack = array();

  // Look for shortcodes and HTML elements.

  $tagnames = array_keys( $shortcode_tags );
  $tagregexp = join( '|', array_map( 'preg_quote', $tagnames ) );
  $tagregexp = "(?:$tagregexp)(?![\\w-])"; // Excerpt of get_shortcode_regex().

  $comment_regex =
      '!'           // Start of comment, after the <.
    . '(?:'         // Unroll the loop: Consume everything until --> is found.
    .     '-(?!->)' // Dash not followed by end of comment.
    .     '[^\-]*+' // Consume non-dashes.
    . ')*+'         // Loop possessively.
    . '(?:-->)?';   // End of comment. If not found, match all input.

  $shortcode_regex =
      '\['              // Find start of shortcode.
    . '[\/\[]?'         // Shortcodes may begin with [/ or [[
    . $tagregexp        // Only match registered shortcodes, because performance.
    . '(?:'
    .     '[^\[\]<>]+'  // Shortcodes do not contain other shortcodes. Quantifier critical.
    . '|'
    .     '<[^\[\]>]*>' // HTML elements permitted. Prevents matching ] before >.
    . ')*+'             // Possessive critical.
    . '\]'              // Find end of shortcode.
 
« Previous [1] [2] [3] Next »
 View on GitHub View on Trac

Published: August 29, 2015 | Last updated: December 18, 2017

Information

Function name: wptexturize_after_shortcodes
Plugin ref: oik-css
Version: 2.0.0
Sourcefile: includes/formatting-later.php
File ref: includes/formatting-later.php
Deprecated?: No
API Letters: A,S,W

Recent plugin updates

oik v4.7.2 oik v4.7.2 includes a fix to the logic to render blocks for Content and Excerpts in the bw_pages shortcode. ...
oik v4.7.1 Upgrade to oik v4.7.1 for bw_pages rendering blocks for Content and Excerpts, and support for post_name attribute for shortcode which query posts ...
oik-shortcodes v1.41.1 Upgrade to oik-shortcodes v1.41.1 for a couple of minor changes. ...
oik-bob-bing-wide v2.2.2 Upgrade to oik-bob-bing-wide v2.2.2 for improvements to bw_dash examples and fixes to some SVG icon's visibility. ...
oik-bwtrace v3.3.1 Upgrade to oik-bwtrace v3.3.1 to measure plugin load times and ad hoc action timing points. ...

Plugins

  • All Plugins
  • oik base plugin
  • FREE oik plugins
  • WordPress plugins
  • Premium oik plugins

Themes

  • FREE themes
  • Bespoke themes
  • Premium themes

Blocks

  • All Blocks
  • Block examples
  • About Blocks

Shortcodes

  • All Shortcodes
  • Shortcode examples
  • About Shortcodes

Reference

  • About APIs
  • All APIs
  • All Classes
  • All Files
  • All Hooks

Support

  • Contact
  • Cookies policy
  • Get API key
  • Privacy
  • Request support
  • Sitemap
  • Stay informed
  • Terms and Conditions
oik-plugins
Email: [email protected]

Weight shipping plugins

Find out which cart weight shipping plugin you need for your WooCommerce site.
Which cart weight based plugin do I need?

Site:  www.oik-plugins.com
© Copyright oik-plugins 2011-2022. All rights reserved.


Website designed and developed by Herb Miller of Bobbing Wide
Proudly powered by WordPress and oik-plugins
WordPress 6.0.1. PHP: 7.4.30. Memory limit: 768M