$modx->documentOutput= preg_replace('#<span class="head">(.*)</span>#U', '<h1 class="head">$1</h1>', $modx->documentOutput);
This particular plugin works on the documentOutput after the documentContent is retrieved from either the database or a document cache file if it exists. So no, the results would not be cached, and would be executed only after all other dynamic elements were processed on the page.
This is soooo sweet. I used this technique to do some basic SEO fixing on a site - change the str_replace with preg_replace like this:
$modx->documentOutput= preg_replace('#<span class="head">(.*)</span>#U', '<h1 class="head">$1</h1>', $modx->documentOutput);
Works like a charm, and now I don’t have to go through hundreds of pages and change that content by hand.
One question - are the results of these end of page processing calls cached? Or does it process this every time?
Thanks!
James