File: /home/httpd/html/freebigasstube.com/DEAD/wp-content/plugins/zap_newwindow.php
<?php
/*
Plugin Name: Zap_NewWindow
Plugin URI: http://www.zappelfillip.de/index.php/2005-12-05/zap_newwindow/
Description: External links in posts (links that refer to other domains) will be automatically opened in a new browser window. No target="_blank" needed. The code is valide to XHTML Strict.
Author: Tom Koehler
Version: 1.2
Author URI: http://www.zappelfillip.de
*/
add_action('wp_head', 'newwindows_wp_header');
function newwindows_wp_header()
{
$blogdomain = parse_url(get_settings('home'));
echo "<script type=\"text/javascript\">
<!--
function makeNewWindows() {
if (!document.links) {
document.links = document.getElementsByTagName('a');
}
for (var t=0; t<document.links.length; t++) {
var zaplinks = document.links[t];
if (zaplinks.href.search(/http/) != -1) {
if (zaplinks.href.search('/".$blogdomain['host']."/') == -1) {
zaplinks.setAttribute('target', '_blank');
}
}
}
}
function addLoadEvent2(func)
{
var oldonload = window.onload;
if (typeof window.onload != 'function'){
window.onload = func;
} else {
window.onload = function(){
oldonload();
func();
}
}
}
addLoadEvent2(makeNewWindows); // makeNewWindows bei onLoad hinzufuegen
//-->
</script>";
// $content = preg_replace("/\starget=\"_blank\"/Ui", "", $content);
// $content = preg_replace("/<a\s(.*)>/Ui", "<a \\1 target=\"_blank\">", $content);
}
?>