[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
User avatar
primehalo
Former Team Member
Posts: 2898
Joined: Fri May 06, 2005 5:58 pm
Location: Redding, CA
Contact:

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

Post by primehalo »

I've added in the suggestions for anonymizing and adding rel="nofollow" to external links. The "nofollow" is on by default, but you'll have to manually enable the anonymizing. To do this, change the value of ANONYMIZE_EXTERNAL_LINKS to the anonymizer that you want to use (example: 'http://anonym.to?').

Update to the latest version by copying over the prime_links.php file.
mattgid wrote:I think one more function needs to be included.
on the view profile page where the user's website is displayed, as well as on the memberlist, the link to their website has to open in a new window too!! ;)
I don't think that really needs to be added to this MOD specifically. Almost all of those links will be external, so just search all the template files for U_WWW and add the target to each of the links, like so:

Code: Select all

onclick="this.target='_blank';"
Or if you're not using strict validation:

Code: Select all

target="_blank"
It might be nice to have the exact instructions as part of this MOD and to have a rare local link not open in a new window, but the U_WWW shows up in a whole bunch of files, and I really REALLY don't want to write the instructions for editing them all. It's just laziness on my part.
Ken F. Innes IV
My Extensions | My MODs | My Topics | My Site: Absolute Anime
Experience the wonder of Japanese Animation!
User avatar
mattgid
Registered User
Posts: 339
Joined: Wed Sep 05, 2007 6:57 am
Location: Singapore

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

Post by mattgid »

sure no problem!!! that info was good enough! ;) thanks!! :D
✖✖_Matthew Gideon_✖✖
cotp
Registered User
Posts: 445
Joined: Wed Sep 14, 2005 7:34 pm
Contact:

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

Post by cotp »

primehalo wrote:I've added in the suggestions for anonymizing and adding rel="nofollow" to external links. The "nofollow" is on by default, but you'll have to manually enable the anonymizing. To do this, change the value of ANONYMIZE_EXTERNAL_LINKS to the anonymizer that you want to use (example: 'http://anonym.to?').
Hallo prime halo ;)

Do you mean that bu default external links have a rel="nofollow" attribute ?

Do we have the option to change that if we don't want it primehalo...

Not sure :?

Cotp
User avatar
primehalo
Former Team Member
Posts: 2898
Joined: Fri May 06, 2005 5:58 pm
Location: Redding, CA
Contact:

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

Post by primehalo »

cotp wrote:
primehalo wrote:I've added in the suggestions for anonymizing and adding rel="nofollow" to external links. The "nofollow" is on by default, but you'll have to manually enable the anonymizing. To do this, change the value of ANONYMIZE_EXTERNAL_LINKS to the anonymizer that you want to use (example: 'http://anonym.to?').
Hallo prime halo ;)

Do you mean that bu default external links have a rel="nofollow" attribute ?

Do we have the option to change that if we don't want it primehalo...

Not sure :?

Cotp
Correct. To change it, just open the file and change the value to an empty string.
Ken F. Innes IV
My Extensions | My MODs | My Topics | My Site: Absolute Anime
Experience the wonder of Japanese Animation!
User avatar
mattgid
Registered User
Posts: 339
Joined: Wed Sep 05, 2007 6:57 am
Location: Singapore

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

Post by mattgid »

what does annonymize mean anyway? like what does it do?
✖✖_Matthew Gideon_✖✖
User avatar
primehalo
Former Team Member
Posts: 2898
Joined: Fri May 06, 2005 5:58 pm
Location: Redding, CA
Contact:

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

Post by primehalo »

mattgid wrote:what does annonymize mean anyway? like what does it do?
This can explain better than I can: http://en.wikipedia.org/wiki/Anonymizer
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: [BETA] Prime Links - Classify Locals & Target Externals

Post by IPB_Refugee »

primehalo wrote:I've added in the suggestions for anonymizing and adding rel="nofollow" to external links.
That's great - thank you! :)
mattgid wrote:what does annonymize mean anyway? like what does it do?
Hi mattgid, the main reason is to hide the true referer. So if you link to site A using e.g. anonym.to the webmaster of site A will not know that you are linking to his site. Most people do not need this feature in any way. I think it is mostly used on sites with adult related content.
cotp wrote:Do you mean that bu default external links have a rel="nofollow" attribute ?

Do we have the option to change that if we don't want it primehalo...
Hi cotp, that's very easy to do in prime_links.php Just take a look at prime's code which is (as far as I can judge) a beautiful piece of code. Near the top of the file you will find these lines:

Code: Select all

	// Options
	define('ALL_SUBDOMAINS_INTERNAL', true);
	define('ANONYMIZE_EXTERNAL_LINKS', '');	//Example: 'http://anonym.to?'

	// Link relationships
	define('INTERNAL_LINK_REL', '');
	define('EXTERNAL_LINK_REL', 'nofollow');

	// Link targets
	define('INTERNAL_LINK_TARGET', '');
	define('EXTERNAL_LINK_TARGET', '_blank');

	// Link classes
	define('INTERNAL_LINK_CLASS', 'postlink-local');
	define('EXTERNAL_LINK_CLASS', '');
If you don't want external links to be nofollowed simply change

Code: Select all

	define('EXTERNAL_LINK_REL', 'nofollow');
to

Code: Select all

	define('EXTERNAL_LINK_REL', '');
I have one more small add-on: :)

c. Treat links to a certain external domain as internal links:

(This can be used if you want that links to a certain external domain have the same appearance as internal links, open in the same window, are not nofollowed by default and so on.) To do so open prime_links.php and find

Code: Select all

		if (!$is_local)
		{
			$protocol = substr($url, 0, strpos($url, ':'));
			$is_local = !$protocol || ($protocol && !in_array($protocol, array('http', 'https', 'mailto', 'ftp', 'gopher')));
		}
AFTER, ADD:

Code: Select all

		if (strpos($url, "example.com") > 0)
		{
			$is_local = TRUE;
		}
Don't forget to change example.com in the first line to the domain name you want to be treated as internal.

Regards
Wolfgang
cotp
Registered User
Posts: 445
Joined: Wed Sep 14, 2005 7:34 pm
Contact:

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

Post by cotp »

Thanks Wolfgang for that last post, great explanation ! And of course thanks to Primehalo ;)

Cotp
User avatar
oddfish
Registered User
Posts: 839
Joined: Mon Mar 19, 2007 8:45 pm
Location: Testing 3.1
Contact:

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

Post by oddfish »

thanks IPB .. and Prime for this mod.

can you please update the functions.php edit to reflect changes in RC6?

cheers.
Country Flag User Edition Clickable Post Count Link

... another record broken without breaking any records ...
Testing phpBB3.1 dark style based on prosilver ... http://www.oddmods.net
-HS-
Registered User
Posts: 2
Joined: Tue Oct 16, 2007 4:46 am

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

Post by -HS- »

Hello

The changes for the rc7? ?

Or add in includes / functions.php
//-- 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 -------------------------------------------------------//



thanks


;)
.:: Chico ::.
Registered User
Posts: 463
Joined: Fri Aug 03, 2007 6:35 am
Location: Rio de Janeiro
Contact:

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

Post by .:: Chico ::. »

Hello Primehalo,
the code in function.php exist no more, in RC7.

Bye!
-HS-
Registered User
Posts: 2
Joined: Tue Oct 16, 2007 4:46 am

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

Post by -HS- »

-HS- wrote:Hello

The changes for the rc7? ?

Or add in includes / functions.php
//-- 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 -------------------------------------------------------//



thanks


;)
Help
User avatar
huyhoa
Registered User
Posts: 65
Joined: Sat Oct 02, 2004 4:39 am
Name: Huy Hoa
Contact:

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

Post by huyhoa »

if ($force_option || !$config['allow_smilies'] || !$user->optionget('viewsmilies'))
is not found in RC7
please help me
User avatar
oddfish
Registered User
Posts: 839
Joined: Mon Mar 19, 2007 8:45 pm
Location: Testing 3.1
Contact:

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

Post by oddfish »

... so -HS-, does it not matter where it is placed?
Country Flag User Edition Clickable Post Count Link

... another record broken without breaking any records ...
Testing phpBB3.1 dark style based on prosilver ... http://www.oddmods.net
HHO
Registered User
Posts: 7
Joined: Wed Oct 17, 2007 3:19 pm

Installation

Post by HHO »

hello

i don t find where to add your change in the function.php in R7

could you be more precise on how to install your MOD prime_links in phpBB3 R7 ?

ty

regards

HHO
Locked

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