/** Plugin Name: WebSnprX Plugin URI: http://www.mademyday.de Description: WebSnprX simply integrates WebSnapr-Script in your MODx content. Adds preview bubble to all external links. The link reference has to be the first attribute of the a tag. Version: 0.6.7 - 14.09.09 Author: Marc Hinse - www.mademyday.de (based on a Wordpress plugin by XSized - http://tagg.selfip.com/blog/wordpress-plugin-snapr/) Modified: Thomas Jakobi - www.partout.info Events: OnWebPagePrerender **/ global $modx; $e = &$modx->Event; switch ($e->name) { case "OnWebPagePrerender": // search and replace external Links in document $text = $modx->documentOutput; $modx->documentOutput = str_replace('config['site_url'], $modx->documentOutput); // generate JS for the header if (strpos($modx->documentOutput, 'previewlink')) $modx->documentOutput = str_replace('', ''."\r\n".'', $modx->documentOutput); break; default: return; // stop here - this is very important. break; }