You are here

function _shortcode_postprocess_text in Shortcode 7.2

Same name and namespace in other branches
  1. 6 shortcode.module \_shortcode_postprocess_text()
  2. 7 shortcode.module \_shortcode_postprocess_text()

Provides html corrector for WYSIWYG editors.

Correcting p elements around the divs. There are no <div> element is allowed in <p> so remove them.

1 string reference to '_shortcode_postprocess_text'
shortcode_filter_info in ./shortcode.module
Implements hook_filter_info().

File

./shortcode.module, line 310
Provides ShortCodes filter framework and API (like WP ShortCodes)

Code

function _shortcode_postprocess_text($text, $filter) {
  $patterns = array(
    '|#!#|is',
    '!<p>(&nbsp;|\\s)*(<\\/*div>)!is',
    '!<p>(&nbsp;|\\s)*(<div)!is',
    '!(<\\/div.*?>)\\s*</p>!is',
    '!(<div.*?>)\\s*</p>!is',
  );
  $replacements = array(
    '',
    '\\2',
    '\\2',
    '\\1',
    '\\1',
  );
  return preg_replace($patterns, $replacements, $text);
}