Code: Select all
##############################################################
## MOD Title: Own links own the window
## MOD Author: niekas < dont.email.me_use.pm_on.phpbb@hotmail.com > (niekas)
## MOD Description: This mod will change link behavior in viewtopic.
##Links to the same domain will open in the same tab/window instead of
##forcing new one. Other than your phpBB instalation domains and subdomains will open in new tabs/windows
## MOD Version: 0.1.1
##
## Installation Level: Easy
## Installation Time: 5 Minutes
## Files To Edit: 1
## bbcode.php
##
## Included Files: (n/a)
##############################################################
##############################################################
## For Security Purposes, Please Check: http://www.phpbb.com/mods/ for the
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered
## in our MOD-Database, located at: http://www.phpbb.com/mods/
############################################################## ## Author Notes:
## I'm adding improved short vbulletin style url mod from Cobra85
## http://www.phpbb.com/phpBB/viewtopic.php?t=131079
##############################################################
## MOD History:
##
## 2004-10-24 - Version 0.1.0
## - First Public Beta
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
#
#-----[ OPEN ]------------------------------------------
#
bbcode.php
#
#-----[ FIND ]------------------------------------------
#
function make_clickable($text)
{
#
#-----[ BEFORE, ADD ]------------------------------------------
#
function soft_hyphen($text, $max, $char = "")
{
$words = explode(' ', $text);
foreach($words as $key => $word)
{
$length = strlen($word);
if($length > $max)
$word = chunk_split($word, floor($length/ceil($length/$max)), $char);
$words[$key] = $word;
}
return implode(' ', $words);
}
#
#-----[ AFTER, ADD ]------------------------------------------
#
global $board_config;
#
#-----[ FIND ]------------------------------------------
#
return($ret);
#
#-----[ BEFORE, ADD ]------------------------------------------
#
$ret = preg_replace("/<a href=(.*?)>(.*?)<\/a>/ie", "(strlen(\"\\2\") > 65 && (!eregi(\"<\", \"\\2\") && !strpos( \"\\2\", \" \") )) ? '<a href='.stripslashes(\"\\1\").'>'.substr(\"\\2\", 0, 42) . '...' . substr(\"\\2\", -10).'</a>' : '<a href='.stripslashes(\"\\1\").'>'.soft_hyphen(stripslashes(\"\\2\"),120).'</a>'", $ret);
$ret = preg_replace("/<a href=(\"http:\/\/www\.".$board_config['server_name'].".*?|\"http:\/\/".$board_config['server_name'].".*?)>(.*?)<\/a>/ie", "'<a href=' .(str_replace(' target=\"_blank\"','', stripslashes(\"\\1\"))).'>'.stripslashes(\"\\2\").'</a>'", $ret);
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM