/*
Plugin Name: WebSnprX
Plugin URI: http://www.mademyday.de/neu/
Description: WebSnprX simply integrates <a href="http://www.websnapr.com">WebSnapr</a>-Script in your MODx content. Adds preview bubble to all external links.
Version: 0.6 - 03.04.07
Author: Marc Hinse (based on a Wordpress plugin by XSized - http://tagg.selfip.com/blog/wordpress-plugin-snapr/
Author URI: http://www.mademyday.de/neu/
*/
/*
Javascript for Preview-Bubbles by WebSnapr - http://www.websnapr.com
*/
$e= & $modx->Event;
switch ($e->name) {
case "OnWebPagePrerender":
$text = $modx->documentOutput;
// search and replace external Links in document
$modx->documentOutput = str_replace('base href="http://','basehref="http://',$modx->documentOutput);
$modx->documentOutput = str_replace(' href="http://',' class="previewlink" href="http://',$modx->documentOutput);
$modx->documentOutput = str_replace('basehref="http://','base href="http://',$modx->documentOutput);
// $modx->documentOutput = str_replace('class="previewlink" href="'.$modx->config['site_url'],'href="'.$modx->config['site_url'],$text);
break;
case "OnParseDocument":
// generate JS for the header
$WebSnprX_pluginpath = $modx->config['site_url']."assets/plugins/WebSnprX/";
$SnaprHead = "\n<!-- Snapr Plugin -->\n";
$SnaprHead.= "<script type=\"text/javascript\">var bubbleImagePath=\"".$WebSnprX_pluginpath ."bg.png\"</script>\n";
$SnaprHead.= "<script type=\"text/javascript\" src=\"". $WebSnprX_pluginpath ."previewbubble.js\"></script>\n";
$SnaprHead.= "<!-- /Snapr Plugin -->\n";
$modx->regClientScript($SnaprHead);
break;
default:
return; // stop here - this is very important.
break;
}<p> <a class="previewlink" class="previewlink" href="http://www.click-immo.com" target="_blank"> www.click-immo.com </a> </p>
