MyBB Community Forums

Full Version: Duplicate the code mycode
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Duplicate the code mycode.

As you know, code mycode unparse the link and show the link as a text.
Since I use it a lot on my forum, I wonder if I can duplicate the code and built another similar with different name?

In class_parser.php
	/**
	* Parses code MyCode.
	*
	* @param string The message to be parsed
	* @param boolean Are we formatting as text?
	* @return string The parsed message.
	*/
	function mycode_parse_code($code, $text_only=false)
	{
		global $lang;

		if($text_only == true)
		{
			return "\n{$lang->code}\n--\n{$code}\n--\n";
		}

		// Clean the string before parsing.
		$code = preg_replace('#^(\t*)(\n|\r|\0|\x0B| )*#', '\\1', $code);
		$code = rtrim($code);
		$original = preg_replace('#^\t*#', '', $code);

		if(empty($original))
		{
			return;
		}

		$code = str_replace('$', '$', $code);
		$code = preg_replace('#\$([0-9])#', '\\\$\\1', $code);
		$code = str_replace('\\', '\', $code);
		$code = str_replace("\t", '    ', $code);
		$code = str_replace("  ", '  ', $code);
		$lcurl = 'http://tubenow.net/link-checker/?url=' . urlencode($_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']);
		$tnlc = ' [<a href="' . $lcurl . '" target="_blank"><strong>Check Download Links</strong></a>]';

		return "<div class=\"codeblock\">\n<div class=\"title\">".$lang->code.$tnlc."\n</div><div class=\"body\" dir=\"ltr\"><code>".$code."</code></div></div>\n";
	}


I tried copy this codes and changes the names but the results was far from the same. Can anyone advice?