MyBB Community Forums

Full Version: [MOD] Insert http://anonym.to/? to all [URL] Tags
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
http://anonym.to/? is a little service for linking to other sites anonymously.

But if we want to insert it to all [URL] Tags, we have to edit the file class_parser.php (this file is located into inc folder).

Before editing files make a backup!!!

1. Open the file class_parser.php with a Text Editor (I use Notepad++)

2. Find:
			function mycode_parse_url($url, $name="")
	{
		if(!preg_match("#^[a-z0-9]+://#i", $url))
		{
			$url = "http://".$url;
		}
		$fullurl = $url;

		$url = str_replace('&', '&', $url);
		$name = str_replace('&', '&', $name);

		if(!preg_match("#[a-z0-9]+://#i", $fullurl))
		{
			$fullurl = "http://".$fullurl;
		}
		if(!$name)
		{
			$name = $url;
		}
		$name = stripslashes($name);
		$url = stripslashes($url);
		$fullurl = stripslashes($fullurl);
		if($name == $url && $this->options['shorten_urls'] != "no")
		{
			if(my_strlen($url) > 55)
			{
				$name = my_substr($url, 0, 40)."...".my_substr($url, -10);
			}
		}

		$name = preg_replace("#&\#([0-9]+);#si", "&#$1;", $name); // Fix & but allow unicode		
		$link = "<a href=\"$fullurl\" target=\"_blank\">$name</a>";
		return $link;
	}

3. Replace with:
                         // Function mod by FlashTato
		function mycode_parse_url($url, $name="")
	{
		if(!preg_match("#^[a-z0-9]+://#i", $url))
		{
			$url = "http://anonym.to/?http://".$url; // 
		} else {
		    $url = "http://anonym.to/?".$url;
		}
		$fullurl = $url;

		$url = str_replace('&amp;', '&', $url);
		$name = str_replace('&amp;', '&', $name);

		if(!preg_match("#[a-z0-9]+://#i", $fullurl))
		{
			$fullurl = "http://anonym.to/?".$fullurl;
		}
		if(!$name)
		{
			$name = $url;
			$name = str_replace("http://anonym.to/?", "", $name);
		}
		$name = stripslashes($name);
		$url = stripslashes($url);
		$fullurl = stripslashes($fullurl);
		if($name == $url && $this->options['shorten_urls'] != "no")
		{
			if(my_strlen($url) > 55)
			{
				$name = my_substr($url, 0, 40)."...".my_substr($url, -10);
			}
		}

		$name = preg_replace("#&amp;\#([0-9]+);#si", "&#$1;", $name); // Fix & but allow unicode		
		$link = "<a href=\"$fullurl\" target=\"_blank\">$name</a>";
		return $link;
	}

I hope you appreciate Smile
(2007-01-02, 09:05 PM)FlashTato Wrote: [ -> ]http://anonym.to/? is a little service for linking to other sites anonymously.

But if we want to insert it to all [URL] Tags, we have to edit the file class_parser.php (this file is located into inc folder).

Before editing files make a backup!!!

1. Open the file class_parser.php with a Text Editor (I use Notepad++)

2. Find:
			function mycode_parse_url($url, $name="")
	{
		if(!preg_match("#^[a-z0-9]+://#i", $url))
		{
			$url = "http://".$url;
		}
		$fullurl = $url;

		$url = str_replace('&amp;', '&', $url);
		$name = str_replace('&amp;', '&', $name);

		if(!preg_match("#[a-z0-9]+://#i", $fullurl))
		{
			$fullurl = "http://".$fullurl;
		}
		if(!$name)
		{
			$name = $url;
		}
		$name = stripslashes($name);
		$url = stripslashes($url);
		$fullurl = stripslashes($fullurl);
		if($name == $url && $this->options['shorten_urls'] != "no")
		{
			if(my_strlen($url) > 55)
			{
				$name = my_substr($url, 0, 40)."...".my_substr($url, -10);
			}
		}

		$name = preg_replace("#&amp;\#([0-9]+);#si", "&#$1;", $name); // Fix & but allow unicode		
		$link = "<a href=\"$fullurl\" target=\"_blank\">$name</a>";
		return $link;
	}

3. Replace with:
                         // Function mod by FlashTato
		function mycode_parse_url($url, $name="")
	{
		if(!preg_match("#^[a-z0-9]+://#i", $url))
		{
			$url = "http://anonym.to/?http://".$url; // 
		} else {
		    $url = "http://anonym.to/?".$url;
		}
		$fullurl = $url;

		$url = str_replace('&amp;', '&', $url);
		$name = str_replace('&amp;', '&', $name);

		if(!preg_match("#[a-z0-9]+://#i", $fullurl))
		{
			$fullurl = "http://anonym.to/?".$fullurl;
		}
		if(!$name)
		{
			$name = $url;
			$name = str_replace("http://anonym.to/?", "", $name);
		}
		$name = stripslashes($name);
		$url = stripslashes($url);
		$fullurl = stripslashes($fullurl);
		if($name == $url && $this->options['shorten_urls'] != "no")
		{
			if(my_strlen($url) > 55)
			{
				$name = my_substr($url, 0, 40)."...".my_substr($url, -10);
			}
		}

		$name = preg_replace("#&amp;\#([0-9]+);#si", "&#$1;", $name); // Fix & but allow unicode		
		$link = "<a href=\"$fullurl\" target=\"_blank\">$name</a>";
		return $link;
	}

I hope you appreciate Smile

Thank you very much.
This thread is over five years old. Don't bump old threads.