Go Back   vb.org Archive > vBulletin Modifications > vBulletin 4.x Modifications > vBulletin 4.x Add-ons
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Open Local links in same window, External in new window Details »»
Open Local links in same window, External in new window
Version: 1.1, by SweCastel SweCastel is offline
Developer Last Online: Dec 2016 Show Printable Version Email this Page

Category: Mini Mods - Version: 4.1.0 Rating:
Released: 12-29-2010 Last Update: Never Installs: 17
Re-useable Code Code Changes  
No support by the author.

I did search for a easy solution to simply open a local link in the same window, and external links in a new window.

Did not find it, so I did make this. My first PHP script.

In the file:
includes/class_bbcode.php

Search for: standard URL hyperlink

3.1.5 (maybe 3.1.6?) And before:
Replace:
Code:
return "<a href=\"$rightlink\" target=\"_top\"" . ($is_external ? ' rel="nofollow"' : '') . ">$text</a>";
3.1.7 ->
Replace:
Code:
return "<a href=\"$rightlink\" target=\"_blank\"" . ($is_external ? ' rel="nofollow"' : '') . ">$text</a>";
With:

Code:
	
	if( is_int(  strpos(  strtolower( $rightlink ), "InsertYourDomainHere") ) )

	{
		return "<a href=\"$rightlink\" target=\"_top\"" . ($is_external ? ' rel="nofollow"' : '') . ">$text</a>";
	} else {
		return "<a href=\"$rightlink\" target=\"_blank\"" . ($is_external ? ' rel="nofollow"' : '') . ">$text</a>";
	}
InsertYourDomainHere = Should be replaced with your domain eg: vbulletin (exclude the last part of your domain eg .com / .org)
It didn?t work for me anyway.
Maybe because of vbulletin cutting down long texts? I dont really now.

And then update the CMS Cache.
AdminCP - vBulletin CMS - Clean CMS-Cache

However this works perfect for me.

// Daniel

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #12  
Old 11-06-2011, 09:44 AM
SweCastel SweCastel is offline
 
Join Date: Dec 2010
Posts: 18
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Works In: 4.1.7 PL2
Reply With Quote
  #13  
Old 11-20-2011, 11:21 PM
SweCastel SweCastel is offline
 
Join Date: Dec 2010
Posts: 18
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Works In: 4.1.8
Reply With Quote
  #14  
Old 12-18-2011, 09:59 PM
spillage spillage is offline
 
Join Date: Feb 2009
Location: S. Florida
Posts: 165
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Did not work on 4.1.8 for me.
Used code as provided... tried all permutations for "InsertYourDomainHere".
Any additional thoughts?
Reply With Quote
  #15  
Old 12-25-2011, 10:45 AM
barakuda barakuda is offline
 
Join Date: Dec 2006
Location: Indonesia
Posts: 46
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

work for 4.1.9 and 3.7.
Reply With Quote
  #16  
Old 02-29-2012, 11:51 PM
SweCastel SweCastel is offline
 
Join Date: Dec 2010
Posts: 18
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Works in 4.11.1
Reply With Quote
  #17  
Old 05-23-2012, 12:32 AM
SweCastel SweCastel is offline
 
Join Date: Dec 2010
Posts: 18
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Works in 4.2
Reply With Quote
  #18  
Old 06-05-2012, 04:31 PM
Dragonsys's Avatar
Dragonsys Dragonsys is offline
 
Join Date: Jan 2008
Location: DFW, Texas
Posts: 743
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You can do this with 1 single line of code as well:
Code:
return "<a href=\"$rightlink\" target=\"" . iif(strstr($rightlink,"yourdomain.com"),"_self","_blank") . "\"" . ($is_external ? ' rel="nofollow"' : '') . ">$text</a>";
Quote:
Originally Posted by utahraves View Post
I have several parked domains. I would like this if I could use multiple domains.
Ex: utahraves.com and utrave.org = same site, I would need to be able to put both domains in that for my site to work.
add an elseif for each domain
Code:
	
	if( is_int(  strpos(  strtolower( $rightlink ), "InsertYourDomainHere") ) ) {
		return "<a href=\"$rightlink\" target=\"_top\"" . ($is_external ? ' rel="nofollow"' : '') . ">$text</a>";
	} elseif( is_int(  strpos(  strtolower( $rightlink ), "DomainName2") ) ) {
		return "<a href=\"$rightlink\" target=\"_top\"" . ($is_external ? ' rel="nofollow"' : '') . ">$text</a>";
	} else {
		return "<a href=\"$rightlink\" target=\"_blank\"" . ($is_external ? ' rel="nofollow"' : '') . ">$text</a>";
	}
Reply With Quote
  #19  
Old 07-25-2013, 07:02 PM
SweCastel SweCastel is offline
 
Join Date: Dec 2010
Posts: 18
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Works in 4.2.1
Reply With Quote
  #20  
Old 07-26-2013, 03:56 AM
DemOnstar's Avatar
DemOnstar DemOnstar is offline
 
Join Date: Dec 2012
Posts: 859
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by SweCastel View Post
Works in 4.2.1
Confirmed here too.
Reply With Quote
  #21  
Old 11-08-2013, 02:01 PM
Heckwork's Avatar
Heckwork Heckwork is offline
 
Join Date: Mar 2002
Location: Rotterdam
Posts: 19
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Great, thanks!

4.2.2 confirmed as well
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 05:55 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04591 seconds
  • Memory Usage 2,318KB
  • Queries Executed 26 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (5)bbcode_code
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete