<?php

function jchwebdev_pullquote( $content ) {
    $pattern = "\[callout\](.*?)\[/callout\]";
    if(preg_match("@(?s)$pattern@", $content, $matches))
    {
      $content = preg_replace("@(?s)($pattern)((.*?</p>){3})@", '\2\3<blockquote class="pullquote">\2</blockquote>', $content);
      return $content;
    }
    return $content;    
}

$text = <<<EOT
<p>If you wanna improve yer German, don't try to read Heine or some elevated crap... watch old episodes of [callout]Tatort or Bukow & Konig[/callout].</p>
<p>If I were teaching a music appreciation I wouldn't teach Beethoven. I'd teach Stamitz and average composers.</p>
<p>And here is a 3rd paragraph.</p>
<p>And here is a 4th paragraph.</p>
EOT;

echo jchwebdev_pullquote($text);
