<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<?xml-stylesheet type="text/xsl" href="./contrib/xsl/modx.prosilver.en.xsl"?>
<!--
	NOTICE: Please open this file in your web browser. If presented with a security warning, you may safely tell it to allow the blocked content.
-->
<!--For security purposes, please check: http://www.phpbb.com/mods/ for the latest version of this MOD. Although MODs are checked before being allowed in the MODs Database there is no guarantee that there are no security problems within the MOD. No support will be given for MODs not found within the MODs Database which can be found at http://www.phpbb.com/mods/-->
<mod xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.phpbb.com/mods/xml/modx-1.2.5.xsd">
	<header>
		<license>http://opensource.org/licenses/gpl-license.php GNU General Public License v2</license>
		<title lang="en">Prime Links</title>
		<description lang="en">Modifies links within posts so that local links are correctly classified as such. It can also apply a target to external links (e.g. to open in a new window) and prepend links (e.g. to apply an anonymizer).</description>
		<author-notes lang="en">If you want to disable the external link target, open "includes/prime_links.php" and change the value of EXTERNAL_LINK_TARGET to an empty string. Other settings can be adjusted from within the "includes/prime_links.php" file as well.

Creating, maintaining, and updating MODs requires a lot of time and effort, so if you like this MOD and have the desire to express your thanks through donations, that would be greatly appreciated. My Paypal ID is primehalo@gmail.com, or contact me for my mailing address. The suggested donation amount for this MOD is $5.00 (but any amount will help).</author-notes>
		<author-group>
			<author>
				<realname>Ken F. Innes IV</realname>
				<email>primehalo@gmail.com</email>
				<username>primehalo</username>
				<homepage><![CDATA[http://www.absoluteanime.com/admin/mods.htm#links]]></homepage>
			</author>
		</author-group>
		<mod-version>1.3.0</mod-version>
		<installation>
			<level>easy</level>
			<time>120</time>
			<target-version>3.0.10</target-version>
		</installation>
		<history>
			<entry>
				<date>2007-09-24</date>
				<rev-version>0.0.0</rev-version>
				<changelog lang="en">
					<change>Initial test release</change>
				</changelog>
			</entry>
			<entry>
				<date>2007-09-24</date>
				<rev-version>0.0.1</rev-version>
				<changelog lang="en">
					<change>Fixed an error that would occur on some PHP configurations.</change>
					<change>Added an option to allow all subdomains to be considered internal.</change>
				</changelog>
			</entry>
			<entry>
				<date>2007-09-25</date>
				<rev-version>0.0.2</rev-version>
				<changelog lang="en">
					<change>Fixed an issue that didn't handle multiple subdomains properly.</change>
				</changelog>
			</entry>
			<entry>
				<date>2007-09-25</date>
				<rev-version>0.0.3</rev-version>
				<changelog lang="en">
					<change>Fixed a bug where numerical HTML entities in the URL were not being decoded.</change>
					<change>Fixed a bug where internal links without a protocol were being detected as external links.</change>
				</changelog>
			</entry>
			<entry>
				<date>2007-09-26</date>
				<rev-version>0.0.4</rev-version>
				<changelog lang="en">
					<change>Added support for adding an anonymizer to external links.</change>
					<change>Added support for the REL attribute (link relationships, primarily used for "nofollow").</change>
					<change>Improved efficiency a bit.</change>
				</changelog>
			</entry>
			<entry>
				<date>2007-09-28</date>
				<rev-version>0.0.5</rev-version>
				<changelog lang="en">
					<change>Append class names to links instead of overwriting them in order to protect classes applied via custom BBCodes.</change>
				</changelog>
			</entry>
			<entry>
				<date>2007-10-22</date>
				<rev-version>0.0.5a</rev-version>
				<changelog lang="en">
					<change>Updated for compatibility with phpBB3.0.RC7.</change>
					<change>Fixed: In subsilver, appending class names would cause local links to have the same styling as external links.</change>
				</changelog>
			</entry>
			<entry>
				<date>2007-12-10</date>
				<rev-version>1.0.0
				</rev-version>
				<changelog lang="en">
					<change>Changed the description slightly.</change>
					<change>Fixed a minor typo in the Do-It-Yourself instructions.</change>
				</changelog>
			</entry>
			<entry>
				<date>2007-12-12</date>
				<rev-version>1.0.1</rev-version>
				<changelog lang="en">
					<change>Fixed a bug that would cause links without an HREF attribute to become messed up.</change>
				</changelog>
			</entry>
			<entry>
				<date>2008-01-11</date>
				<rev-version>1.0.2</rev-version>
				<changelog lang="en">
					<change>Made the domain check (along with any un-removed subdomains) case-insensitive.</change>
					<change>Only modify links that use the http or https scheme.</change>
					<change>Allow for specific subdomains to be ignored.</change>
					<change>Fixed the algorithm so that multiple top-level domains, such as .co.jp and .ca.us, should now be handled correctly.</change>
					<change>Put functions inside of a class to prevent potential conflicts with other MODs.</change>
					<change>The target attribute can now be enabled by changing the value of a define rather than by un-commenting several lines of code.</change>
				</changelog>
			</entry>
			<entry>
				<date>2008-01-13</date>
				<rev-version>1.0.3</rev-version>
				<changelog lang="en">
					<change>Fixed a PHP 4 incompatibility.</change>
				</changelog>
			</entry>
			<entry>
				<date>2008-01-18</date>
				<rev-version>1.0.4</rev-version>
				<changelog lang="en">
					<change>Fixed the possibility of getting debug notices when an email address exists in a post.</change>
					<change>Fixed the possibility of getting debug notices when no links existed in a post.</change>
				</changelog>
			</entry>
			<entry>
				<date>2008-03-08</date>
				<rev-version>1.0.5</rev-version>
				<changelog lang="en">
					<change>Treat http:// and https:// as the same scheme.</change>
				</changelog>
			</entry>
			<entry>
				<date>2008-04-06</date>
				<rev-version>1.0.5a</rev-version>
				<changelog lang="en">
					<change>Renamed the define ANONYMIZE_EXTERNAL_LINKS to EXTERNAL_LINK_PREFIX.</change>
				</changelog>
			</entry>
			<entry>
				<date>2008-04-11</date>
				<rev-version>1.0.6</rev-version>
				<changelog lang="en">
					<change>When a URL cannot be properly parsed, the error message will be silenced and script will continue execution.</change>
				</changelog>
			</entry>
			<entry>
				<date>2008-06-08</date>
				<rev-version>1.0.7</rev-version>
				<changelog lang="en">
					<change>Fixed a mistake with ignoring multiple subdomains.</change>
				</changelog>
			</entry>
			<entry>
				<date>2008-07-01</date>
				<rev-version>1.0.8</rev-version>
				<changelog lang="en">
					<change>Repackaged for MODX 1.2.0.</change>
					<change>Added the ability to skip the parsing of image links.</change>
					<change>Created supplementary installation instructions for opening user website links in a new window.</change>
				</changelog>
			</entry>
			<entry>
				<date>2008-07-09</date>
				<rev-version>1.0.9</rev-version>
				<changelog lang="en">
					<change>Added the ability to force the classification of image links as either internal or external links.</change>
				</changelog>
			</entry>
			<entry>
				<date>2008-07-10</date>
				<rev-version>1.0.10</rev-version>
				<changelog lang="en">
					<change>Added the ability to force the classification of image links as external links without adding an external link prefix.</change>
					<change>Verified compatibility with phpBB 3.0.2</change>
				</changelog>
			</entry>
			<entry>
				<date>2008-07-23</date>
				<rev-version>1.2.0</rev-version>
				<changelog lang="en">
					<change>Added the ability to classify links based on the type of file to which they point.</change>
					<change>Added the ability to treat specified domains as if they were local.</change>
					<change>Added a sample stylesheet (with a few icons) for convenient styling of links (without the need for refreshing the template in the ACP).</change>
					<change>Added optional instructions for applying targets to forums that are set up to be links.</change>
				</changelog>
			</entry>
			<entry>
				<date>2008-07-25</date>
				<rev-version>1.2.1</rev-version>
				<changelog lang="en">
					<change>Added the ability to classify certain domains as forbidden, and have those links replaced with an alternate URL.</change>
				</changelog>
			</entry>
			<entry>
				<date>2008-08-05</date>
				<rev-version>1.2.2</rev-version>
				<changelog lang="en">
			<change>Added the ability to change external (or internal) links into text (changes the A tag to a SPAN tag). These can then be style via the stylesheet to actually hide them, if so desired.</change>
				</changelog>
			</entry>
			<entry>
				<date>2008-08-29</date>
				<rev-version>1.2.3</rev-version>
				<changelog lang="en">
					<change>Added the ability to change links into text for guests.</change>
				</changelog>
			</entry>
			<entry>
				<date>2008-10-14</date>
				<rev-version>1.2.4</rev-version>
				<changelog lang="en">
					<change>Fixed: removing specific domains was not working properly.</change>
					<change>Added a define to specify the top level domain name, so that it can be specified directly in cases where the guessing algorithm guesses wrong.</change>
				</changelog>
			</entry>
			<entry>
				<date>2009-01-22</date>
				<rev-version>1.2.5</rev-version>
				<changelog lang="en">
					<change>Fixed: links were not classified properly when setting the TOP_LEVEL_DOMAIN_NAME define.</change>
				</changelog>
			</entry>
			<entry>
				<date>2009-01-22</date>
				<rev-version>1.2.6</rev-version>
				<changelog lang="en">
					<change>When the option to hide links from guests is enabled, the ex-link will now be surrounded by a SPAN tag with the class "link_removed" rather than the class name that the link used to have.</change>
					<change>The option to hide links from guests can now be a string value in addition to a boolean value. if it is set as a string, then the string will replace what used to be the text of the link.</change>
				</changelog>
			</entry>
			<entry>
				<date>2009-10-20</date>
				<rev-version>1.2.7</rev-version>
				<changelog lang="en">
					<change>Fixed a bug that would not recognize external links as being external if the scheme was not lowercase.</change>
				</changelog>
			</entry>
			<entry>
				<date>2010-07-21</date>
				<rev-version>1.2.8</rev-version>
				<changelog lang="en">
					<change>Fixed a minor bug that could cause a link to be processed incorrectly if preceded by an acronym HTML tag (or any other non-anchor tag that begins with the letter "a").</change>
				</changelog>
			</entry>
			<entry>
				<date>2010-09-15</date>
				<rev-version>1.2.9</rev-version>
				<changelog lang="en">
					<change>Fixed a bug where the INTERNAL_LINK_DOMAINS would not always correctly recognize domains as being internal if the defined domain(s) had a trailing slash and the link in the post did not.</change>
				</changelog>
			</entry>
			<entry>
				<date>2010-10-22</date>
				<rev-version>1.2.10</rev-version>
				<changelog lang="en">
					<change>Add the REL attribute to links when using the optional Forum Links or User Website Links functionality.</change>
				</changelog>
			</entry>
			<entry>
				<date>2010-12-20</date>
				<rev-version>1.2.11</rev-version>
				<changelog lang="en">
					<change>Slightly reworked how the target and REL attribute are added to links when using the optional User Website Links functionality.</change>
				</changelog>
			</entry>
			<entry>
				<date>2011-11-04</date>
				<rev-version>1.2.12</rev-version>
				<changelog lang="en">
					<change>Fixed a case sensitivity issue with domain name matching.</change>
				</changelog>
			</entry>
			<entry>
				<date>2012-02-08</date>
				<rev-version>1.3.0</rev-version>
				<changelog lang="en">
					<change>Rewrote some of the code to better work with domains with multiple top-level domains (for example, .co.jp).</change>
					<change>Fixed minor bug when including a link in replacement text for guests.</change>
				</changelog>
			</entry>
		</history>
		<link-group>
			<link type="contrib" href="contrib/install user website links.xml" lang="en">Install User Website Links</link>
			<link type="contrib" href="contrib/install forum links.xml" lang="en">Install Forum Links</link>
			<link type="contrib" href="contrib/install style links.xml" lang="en">Install Style Links</link>
		</link-group>
	</header>
	<action-group>
		<copy>
			<file from="root/includes/prime_links.php" to="includes/prime_links.php" />
		</copy>

		<open src="includes/functions_content.php">
			<edit>
				<find><![CDATA[	if ($force_option || !$config['allow_smilies'] || !$user->optionget('viewsmilies'))]]></find>
				<action type="before-add"><![CDATA[//-- 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 -------------------------------------------------------//
]]></action>
			</edit>
		</open>

		<diy-instructions lang="en"><![CDATA[After installing, clear your board's cache!

If you want to disable the external link target, open "includes/prime_links.php"
and change the value of EXTERNAL_LINK_TARGET to an empty string.

Other settings can be adjusted from within the "includes/prime_links.php" file as well.]]></diy-instructions>
	</action-group>
</mod>

