[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
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: 62
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
.:: Chico ::.
Registered User
Posts: 463
Joined: Fri Aug 03, 2007 6:35 am
Location: Rio de Janeiro
Contact:

Re: Installation

Post by .:: Chico ::. »

HHO wrote: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
Calm down, people.
Everyone didn't find because this mod is not for RC7.
Just wait primehalo to update the mod.
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 »

It looks like they moved it to "includes/functions_content.php". I haven't yet installed RC7, but once I do I'll update the installation instructions.
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 »

Thank you, prime!

I think you are right: http://www.ktuk.net/phpBB3/viewtopic.php?f=32&t=2921

Hope you enjoyed your holiday! :)
Wolfgang
User avatar
angelside
Registered User
Posts: 105
Joined: Sat Jan 27, 2007 11:32 am
Location: Türkiye
Contact:

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

Post by angelside »

I have one problem, I look source code:

Code: Select all

rel=" nofollow"
Is have one space before nofollow.


If deactive line 123, its work:

Code: Select all

				/*$new_rel	= implode(' ', array_unique(array_merge(explode(' ', $rel), (array)$new_rel)));	// This will append the new rel instead of replacing the existing one. */
Now:

Code: Select all

rel="nofollow"
phpBB Türkiye | Turkish phpBB3 support and develop
phpBB3 Portal | simple portal for phpBB3 Olympus
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 »

angelside wrote:I have one problem, I look source code:

Code: Select all

rel=" nofollow"
Is have one space before nofollow.


If deactive line 123, its work:

Code: Select all

				/*$new_rel	= implode(' ', array_unique(array_merge(explode(' ', $rel), (array)$new_rel)));	// This will append the new rel instead of replacing the existing one. */
Now:

Code: Select all

rel="nofollow"
Try this, change:

Code: Select all

				$new_rel	= implode(' ', array_unique(array_merge(explode(' ', $rel), (array)$new_rel)));	// This will append the new rel instead of replacing the existing one.
To this:

Code: Select all

				$new_rel	= trim(implode(' ', array_unique(array_merge(explode(' ', $rel), (array)$new_rel))));	// This will append the new rel instead of replacing the existing one.
Ken F. Innes IV
My Extensions | My MODs | My Topics | My Site: Absolute Anime
Experience the wonder of Japanese Animation!
User avatar
angelside
Registered User
Posts: 105
Joined: Sat Jan 27, 2007 11:32 am
Location: Türkiye
Contact:

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

Post by angelside »

Code: Select all

            $new_rel   = trim(implode(' ', array_unique(array_merge(explode(' ', $rel), (array)$new_rel))));   // This will append the new rel instead of replacing the existing one.
I test...
phpBB Türkiye | Turkish phpBB3 support and develop
phpBB3 Portal | simple portal for phpBB3 Olympus
Locked

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