[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:
201 to 274 of 274
    . '\]?';            // Shortcodes may end with ]]

  $regex =
      '/('                   // Capture the entire match.
    .     '<'                // Find start of element.
    .     '(?(?=!--)'        // Is this a comment?
    .         $comment_regex // Find end of comment.
    .     '|'
    .         '[^>]+>'       // Find end of element.
    .     ')'
    //. '|'
    //.     $shortcode_regex   // Find shortcodes.
    . ')/s';

  $textarr = preg_split( $regex, $text, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY );

  foreach ( $textarr as &$curl ) {
    // Only call _wptexturize_pushpop_element if $curl is a delimiter.
    $first = $curl[0];
    if ( '<' === $first && '<!--' === substr( $curl, 0, 4 ) ) {
      // This is an HTML comment delimeter.

      continue;

    } elseif ( '<' === $first && '>' === substr( $curl, -1 ) ) {
      // This is an HTML element delimiter.

      _wptexturize_pushpop_element( $curl, $no_texturize_tags_stack, $no_texturize_tags );

    } elseif ( '' === trim( $curl ) ) {
      // This is a newline between delimiters.  Performance improves when we check this.

      continue;

    } elseif ( '[' === $first && 1 === preg_match( '/^' . $shortcode_regex . '$/', $curl ) ) {
      // This is a shortcode delimiter.

      if ( '[[' !== substr( $curl, 0, 2 ) && ']]' !== substr( $curl, -2 ) ) {
        // Looks like a normal shortcode.
        _wptexturize_pushpop_element( $curl, $no_texturize_shortcodes_stack, $no_texturize_shortcodes );
      } else {
        // Looks like an escaped shortcode.
        continue;
      }

    } elseif ( empty( $no_texturize_shortcodes_stack ) && empty( $no_texturize_tags_stack ) ) {
      // This is neither a delimiter, nor is this content inside of no_texturize pairs.  Do texturize.

      $curl = str_replace( $static_characters, $static_replacements, $curl );

      if ( false !== strpos( $curl, "'" ) ) {
        $curl = preg_replace( $dynamic_characters['apos'], $dynamic_replacements['apos'], $curl );
      }
      if ( false !== strpos( $curl, '"' ) ) {
        $curl = preg_replace( $dynamic_characters['quote'], $dynamic_replacements['quote'], $curl );
      }
      if ( false !== strpos( $curl, '-' ) ) {
        $curl = preg_replace( $dynamic_characters['dash'], $dynamic_replacements['dash'], $curl );
      }

      // 9x9 (times), but never 0x9999
      if ( 1 === preg_match( '/(?<=\d)x-?\d/', $curl ) ) {
        // Searching for a digit is 10 times more expensive than for the x, so we avoid doing this one!
        $curl = preg_replace( '/\b(\d(?(?<=0)[\d\.,]+|[\d\.,]*))x(-?\d[\d\.,]*)\b/', '$1&#215;$2', $curl );
      }
    }
  }
  $text = implode( '', $textarr );

  // Replace each & with &#038; unless it already looks like an entity.
  $text = preg_replace('/&(?!#(?:\d+|x[a-f0-9]+);|[a-z1-4]{1,8};)/i', '&#038;', $text);

  return $text;
}
 
« Previous [1] [2] [3]
 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