[RC1] Prime Links - Classify Locals & Target Externals

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment!
Scam Warning
Locked
User avatar
primehalo
Former Team Member
Posts: 2898
Joined: Fri May 06, 2005 5:58 pm
Location: Redding, CA
Contact:

Re: [RC1] Prime Links - Classify Locals & Target Externals

Post by primehalo »

You could put the domains in an array and then loop over the array.
Ken F. Innes IV
My Extensions | My MODs | My Topics | My Site: Absolute Anime
Experience the wonder of Japanese Animation!
dudemang
Registered User
Posts: 1
Joined: Tue Jun 17, 2008 7:55 pm

Re: [RC1] Prime Links - Classify Locals & Target Externals

Post by dudemang »

Here's a mod to this mod which allows for a white-list of domains to exclude from the nofollow addition.
in the file includes/prime_links.php ...

1.
find:

Code: Select all

function prime_links()
{
insert after:

Code: Select all

// top level domains only. sub-domains are automatically included.
$this->whitelist = array('example.com', 'example.org');
2.
find:

Code: Select all

return($is_local);
insert before:

Code: Select all

$host = parse_url($url, PHP_URL_HOST);
foreach ($this->whitelist as $white_host) {
	$length = strlen($white_host);
	if (strlen($host) >= $length && substr_compare($host, $white_host, -$length, $length, true) === 0) {
		return true;
	}
}

I hope this, or something similar, makes its way into the next version.

Cheers.
sorro
Registered User
Posts: 16
Joined: Mon Jan 15, 2007 10:25 pm
Location: Germany

Re: [RC1] Prime Links - Classify Locals & Target Externals

Post by sorro »

Hi,

first of all ... I installed this mod and it works great - thanks a lot! But I still have one question: If one of my users has a website entered in his profile and you click on the URL icon it will be opened in the same tab/window. This happens in memberlist and profile. What can I do that these links are also opened in a new window?

Bye,
Sorro
Jan Christensen
Registered User
Posts: 140
Joined: Sun May 16, 2004 10:42 am
Location: Denmark

Re: [RC1] Prime Links - Classify Locals & Target Externals

Post by Jan Christensen »

sorro:

Funny, I was going to ask the exact same thing, can you fix it Prime? :)

Thx for a great mod btw. :D
Jan Christensen • Danish language package author • Olympus DK Team
stokerpiller
Registered User
Posts: 1934
Joined: Wed Feb 28, 2007 8:06 pm

Re: [RC1] Prime Links - Classify Locals & Target Externals

Post by stokerpiller »

Sorro and Jan Christensen

See if this will work for you:
Open prosilver viewtopic_body.html
Find:

Code: Select all

<!-- IF postrow.U_WWW --><li class="web-icon"><a href="{postrow.U_WWW}"
Inline after add:

Code: Select all

 onclick="this.target='_blank';"
Save, upload and refresh.
I am done with phpBB
User avatar
primehalo
Former Team Member
Posts: 2898
Joined: Fri May 06, 2005 5:58 pm
Location: Redding, CA
Contact:

Re: [RC1] Prime Links - Classify Locals & Target Externals

Post by primehalo »

sorro wrote:Hi,

first of all ... I installed this mod and it works great - thanks a lot! But I still have one question: If one of my users has a website entered in his profile and you click on the URL icon it will be opened in the same tab/window. This happens in memberlist and profile. What can I do that these links are also opened in a new window?

Bye,
Sorro
This seems to be the most requested feature, so I just updated to include this. Update by copying over the new includes/prime_links.php file, then install the new feature by following the supplementary instructions. Note that it doesn't check to see if the user's website link is local or external, it is just assumed to be external (since it will be 99% of the time).

I'm having trouble connecting to my server, so I uploaded the new package here:
http://www.mediafire.com/?mdpjjtnm03z
Ken F. Innes IV
My Extensions | My MODs | My Topics | My Site: Absolute Anime
Experience the wonder of Japanese Animation!
sorro
Registered User
Posts: 16
Joined: Mon Jan 15, 2007 10:25 pm
Location: Germany

Re: [RC1] Prime Links - Classify Locals & Target Externals

Post by sorro »

Hi Ken,

thanks for your work but after uploading file and deleting cache user websites still open in the same frame. When I look in prime_links.php I see "@version $Id: prime_links.php,v 1.0.8 2008/07/01 11:45:00 primehalo " in header. This seems to be the right file version, doesn't it?

In functions_content.php I have inserted the following code:

Code: Select all

//-- mod: Prime Links -------------------------------------------------------//
	if (!function_exists('prime_links'))
	{
		global $phpEx;
		include($phpbb_root_path . 'includes/prime_links.' . $phpEx);
	}
	$text = prime_links($text);
//-- end: Prime Links -------------------------------------------------------//
Where do I make my mistake?!?!?

Thanks in advance!
morpheus74
Registered User
Posts: 1
Joined: Sun Jul 06, 2008 8:15 am

Re: [RC1] Prime Links - Classify Locals & Target Externals

Post by morpheus74 »

Hello,
I have another request:
Is ist possible to inlude links to internal Pictures as external, so that the will be opened in a new TAB/Window too?
Thanks for your reply.
Enrico
danswano
Registered User
Posts: 273
Joined: Sun Apr 06, 2008 10:43 pm

Re: [RC1] Prime Links - Classify Locals & Target Externals

Post by danswano »

Download link down, any mirror ?
User avatar
primehalo
Former Team Member
Posts: 2898
Joined: Fri May 06, 2005 5:58 pm
Location: Redding, CA
Contact:

Re: [RC1] Prime Links - Classify Locals & Target Externals

Post by primehalo »

morpheus74 wrote:Hello,
I have another request:
Is ist possible to inlude links to internal Pictures as external, so that the will be opened in a new TAB/Window too?
Thanks for your reply.
Enrico
Sure, I just added this to version 1.0.9.
sorro wrote:Hi Ken,

thanks for your work but after uploading file and deleting cache user websites still open in the same frame. When I look in prime_links.php I see "@version $Id: prime_links.php,v 1.0.8 2008/07/01 11:45:00 primehalo " in header. This seems to be the right file version, doesn't it?

In functions_content.php I have inserted the following code:

Code: Select all

//-- mod: Prime Links -------------------------------------------------------//
	if (!function_exists('prime_links'))
	{
		global $phpEx;
		include($phpbb_root_path . 'includes/prime_links.' . $phpEx);
	}
	$text = prime_links($text);
//-- end: Prime Links -------------------------------------------------------//
Where do I make my mistake?!?!?

Thanks in advance!
That was the latest version, though now I've just updated that file to version 1.0.9. You mention adding code to functions_content.php, but you didn't mention anything about functions_display.php. To get the feature you are looking for, you need to follow the instructions in the supplementary install file.
Ken F. Innes IV
My Extensions | My MODs | My Topics | My Site: Absolute Anime
Experience the wonder of Japanese Animation!
User avatar
IPB_Refugee
Registered User
Posts: 1290
Joined: Fri Jul 07, 2006 2:25 pm
Location: Austria
Name: Wolfgang Weber

Re: [RC1] Prime Links - Classify Locals & Target Externals

Post by IPB_Refugee »

First post wrote:MOD Version: 1.0.5
Thanks again for the great work!
Wolfgang

EDIT: Would it be possible to add one more feature, please? Regarding:

Code: Select all

	define('FORCE_IMAGE_LINKS', ''); // '' (normal), 'SKIP' (do not process), 'INTERNAL' (make local), 'EXTERNAL' (make external)
I wish there were a way to open [img ]-links in a new window but without running them over anonym.to. So the link should not be treated as "real" external link. No external link prefix, but onclick="this.target='_blank';" enabled

Regards
Wolfgang
danswano
Registered User
Posts: 273
Joined: Sun Apr 06, 2008 10:43 pm

Re: [RC1] Prime Links - Classify Locals & Target Externals

Post by danswano »

Please i need a mirror for the old version that works with 3.0.0, p lease i need this mod and i can't upgrade at the moment to 3.0.1 or 3.0.2 :cry:
sorro
Registered User
Posts: 16
Joined: Mon Jan 15, 2007 10:25 pm
Location: Germany

Re: [RC1] Prime Links - Classify Locals & Target Externals

Post by sorro »

primehalo wrote:You mention adding code to functions_content.php, but you didn't mention anything about functions_display.php. To get the feature you are looking for, you need to follow the instructions in the supplementary install file.
Sorry but I didn't recognize the additional install instructions in the contrib folder. Now I changed the remaining files and it works great! Thanks again!!!
User avatar
primehalo
Former Team Member
Posts: 2898
Joined: Fri May 06, 2005 5:58 pm
Location: Redding, CA
Contact:

Re: [RC1] Prime Links - Classify Locals & Target Externals

Post by primehalo »

danswano wrote:Please i need a mirror for the old version that works with 3.0.0, p lease i need this mod and i can't upgrade at the moment to 3.0.1 or 3.0.2 :cry:
This works with the old version, only the instructions are slightly different. Just search for the function "smiley_text" and place the code inside it, on the line after the global variables declaration.
IPB_Refugee wrote:I wish there were a way to open [img ]-links in a new window but without running them over anonym.to. So the link should not be treated as "real" external link. No external link prefix, but onclick="this.target='_blank';" enabled
I'll work on it.
Ken F. Innes IV
My Extensions | My MODs | My Topics | My Site: Absolute Anime
Experience the wonder of Japanese Animation!
User avatar
Kamahl19
Registered User
Posts: 1598
Joined: Tue Nov 06, 2007 3:33 pm
Location: Slovakia
Name: Martin
Contact:

Re: [RC1] Prime Links - Classify Locals & Target Externals

Post by Kamahl19 »

works with 3.0.2?
Locked

Return to “[3.0.x] MODs in Development”