⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 externallinks.php

📁 This mambot adds to the external links in a content the text &#8220 target="_blank"&#8221 . Thus, al
💻 PHP
字号:
<?php/****************************************
* ExternalLinks mambot for Mambo/Joomla *
* Copyright (C) 2007 by Denis Ryabov    *
* Homepage   : http://joomup.com/    *
* Version    : 1.0                      *
* License    : Released under GPL       *
*****************************************/
defined( '_VALID_MOS' ) or die( 'Access denied.' );$_MAMBOTS->registerFunction( 'onPrepareContent', 'botExternalLinks' );function botExternalLinks( $published, &$row, &$params, $page=0 ){	global $database;	if(!$published) return true;	$row->text=preg_replace_callback('/<a (.*?)href=["\'](.*?)["\'](.*?)>/i',									 'botExternalLinks_replacer',									 $row->text);	return true;}function botExternalLinks_replacer($matches){	$link_pattern='/^(http:\/\/|)(www.|)([^\/]+)/i';	preg_match($link_pattern,$matches[2],$domain);	preg_match($link_pattern,$_SERVER['HTTP_HOST'],$http);	$target='';	if((isset($domain[3])) and	   (isset($http[3])) and 	   ($domain[3]!==$http[3]) and	   (strpos($matches[1],'_blank')===false) and	   (strpos($matches[3],'_blank')===false))			$target=' target="_blank"';	return '<a href="'.$matches[2].'"'.$matches[1].$matches[3].$target.'>';}?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -