Vergleich inc/class_parser.php - 1.4.0 - 1.4.5

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 6Zeile 6
 * Website: http://www.mybboard.net
* License: http://www.mybboard.net/about/license
*

 * Website: http://www.mybboard.net
* License: http://www.mybboard.net/about/license
*

 * $Id: class_parser.php 4052 2008-07-29 15:45:49Z Tikitiki $

 * $Id: class_parser.php 4322 2009-02-21 23:00:49Z Tikitiki $

 */

/*

 */

/*

Zeile 232Zeile 232
		$standard_mycode['reg']['regex'] = "#\(r\)#i";
$standard_mycode['reg']['replacement'] = "®";


		$standard_mycode['reg']['regex'] = "#\(r\)#i";
$standard_mycode['reg']['replacement'] = "®";


		$standard_mycode['url_simple']['regex'] = "#\[url\]([a-z]+?://)([^\r\n\"\[<]+?)\[/url\]#sei";

		$standard_mycode['url_simple']['regex'] = "#\[url\]([a-z]+?://)([^\r\n\"<]+?)\[/url\]#sei";

		$standard_mycode['url_simple']['replacement'] = "\$this->mycode_parse_url(\"$1$2\")";


		$standard_mycode['url_simple']['replacement'] = "\$this->mycode_parse_url(\"$1$2\")";


		$standard_mycode['url_simple2']['regex'] = "#\[url\]([^\r\n\"\[<]+?)\[/url\]#ei";

		$standard_mycode['url_simple2']['regex'] = "#\[url\]([^\r\n\"<]+?)\[/url\]#ei";

		$standard_mycode['url_simple2']['replacement'] = "\$this->mycode_parse_url(\"$1\")";


		$standard_mycode['url_simple2']['replacement'] = "\$this->mycode_parse_url(\"$1\")";


		$standard_mycode['url_complex']['regex'] = "#\[url=([a-z]+?://)([^\r\n\"\[<]+?)\](.+?)\[/url\]#esi";

		$standard_mycode['url_complex']['regex'] = "#\[url=([a-z]+?://)([^\r\n\"<]+?)\](.+?)\[/url\]#esi";

		$standard_mycode['url_complex']['replacement'] = "\$this->mycode_parse_url(\"$1$2\", \"$3\")";


		$standard_mycode['url_complex']['replacement'] = "\$this->mycode_parse_url(\"$1$2\", \"$3\")";


		$standard_mycode['url_complex2']['regex'] = "#\[url=([^\r\n\"\[<&\(\)]+?)\](.+?)\[/url\]#esi";

		$standard_mycode['url_complex2']['regex'] = "#\[url=([^\r\n\"<&\(\)]+?)\](.+?)\[/url\]#esi";

		$standard_mycode['url_complex2']['replacement'] = "\$this->mycode_parse_url(\"$1\", \"$2\")";

$standard_mycode['email_simple']['regex'] = "#\[email\](.*?)\[/email\]#ei";

		$standard_mycode['url_complex2']['replacement'] = "\$this->mycode_parse_url(\"$1\", \"$2\")";

$standard_mycode['email_simple']['regex'] = "#\[email\](.*?)\[/email\]#ei";

Zeile 275Zeile 275
		{
foreach($custom_mycode as $key => $mycode)
{

		{
foreach($custom_mycode as $key => $mycode)
{

 
				$mycode['regex'] = str_replace("\x0", "", $mycode['regex']);

				$custom_mycode[$key]['regex'] = "#".$mycode['regex']."#si";
}
$mycode = array_merge($standard_mycode, $custom_mycode);

				$custom_mycode[$key]['regex'] = "#".$mycode['regex']."#si";
}
$mycode = array_merge($standard_mycode, $custom_mycode);

Zeile 391Zeile 392
		{
foreach($this->smilies_cache as $find => $replace)
{

		{
foreach($this->smilies_cache as $find => $replace)
{

				$find = $this->parse_html($find);



				$find = $this->parse_html($find);				
$find = preg_quote($find, "#");


				if(version_compare(PHP_VERSION, "5.1.0", ">="))
{

				if(version_compare(PHP_VERSION, "5.1.0", ">="))
{

					$message = preg_replace("#(?<=[^&;\"])".preg_quote($find,"#")."(?=.\W|\"|\W.|\W$)#si", $replace, $message, $remaining, $replacements);















					$orig_message = $message;
$orig_find = $find;
// Fix issues for smileys starting with a ";"
if($find{0} == ";")
{
$find = "(?<!&gt|&lt|&amp)".$find;
}

$message = @preg_replace("#(?<=[^\"])".$find."(?=.\W|\"|\W.|\W$)#si", $replace, $message, $remaining, $replacements);

if($message == null)
{
$message = preg_replace("#(?<=[^&;\"])".$orig_find."(?=.\W|\"|\W.|\W$)#si", $replace, $orig_message, $remaining);
}


					$remaining -= $replacements;
if($remaining <= 0)
{

					$remaining -= $replacements;
if($remaining <= 0)
{

Zeile 403Zeile 420
				}
else
{

				}
else
{

					$message = preg_replace("#(?<=[^&;\"])".preg_quote($find,"#")."(?=.\W|\"|\W.|\W$)#si", $replace, $message, $remaining);

					$message = preg_replace("#(?<=[^&;\"])".$find."(?=.\W|\"|\W.|\W$)#si", $replace, $message, $remaining);

				}
}

				}
}

 
			unset($orig_message, $orig_find);

		}

// If we matched any tags previously, swap them back in

		}

// If we matched any tags previously, swap them back in

Zeile 491Zeile 509
			"#(o)(nunload\s?=)#i",
"#(o)(nkeypress\s?=)#i"
);

			"#(o)(nunload\s?=)#i",
"#(o)(nkeypress\s?=)#i"
);

		$message = preg_replace($js_array, "$1<strong></strong>$2", $message);


		
$message = preg_replace($js_array, "$1<strong></strong>$2$4", $message);


return $message;
}


return $message;
}

Zeile 666Zeile 685
		$code = preg_replace('#^(\t*)(\n|\r|\0|\x0B| )*#', '\\1', $code);
$code = rtrim($code);
$original = preg_replace('#^\t*#', '', $code);

		$code = preg_replace('#^(\t*)(\n|\r|\0|\x0B| )*#', '\\1', $code);
$code = rtrim($code);
$original = preg_replace('#^\t*#', '', $code);





		if(empty($original))
{
return;

		if(empty($original))
{
return;

Zeile 809Zeile 828

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


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

 



if(!preg_match("#[a-z0-9]+://#i", $fullurl))
{


if(!preg_match("#[a-z0-9]+://#i", $fullurl))
{

Zeile 817Zeile 837
		if(!$name)
{
$name = $url;

		if(!$name)
{
$name = $url;

		}

		}

		
$name = str_replace("\'", "'", $name);
$url = str_replace("\'", "'", $url);
$fullurl = str_replace("\'", "'", $fullurl);

		
$name = str_replace("\'", "'", $name);
$url = str_replace("\'", "'", $url);
$fullurl = str_replace("\'", "'", $fullurl);

		

		

		if($name == $url && (!isset($this->options['shorten_urls']) || $this->options['shorten_urls'] != 0))
{
if(my_strlen($url) > 55)

		if($name == $url && (!isset($this->options['shorten_urls']) || $this->options['shorten_urls'] != 0))
{
if(my_strlen($url) > 55)

Zeile 830Zeile 850
				$name = my_substr($url, 0, 40)."...".my_substr($url, -10);
}
}

				$name = my_substr($url, 0, 40)."...".my_substr($url, -10);
}
}

 
		
// fix some entities in URLs
$fullurl = strtr($fullurl, array('$' => '%24', '^' => '%5E', '`' => '%60', '[' => '%5B', ']' => '%5D', '{' => '%7B', '}' => '%7D', '"' => '%22', '<' => '%3C', '>' => '%3E', ' ' => '%20'));


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


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

Zeile 881Zeile 904
	*/
function mycode_parse_email($email, $name="")
{

	*/
function mycode_parse_email($email, $name="")
{

 
		$name = str_replace("\\'", "'", $name);
$email = str_replace("\\'", "'", $email);

		if(!$name)
{
$name = $email;

		if(!$name)
{
$name = $email;

Zeile 903Zeile 928
	*/
function mycode_auto_url($message)
{

	*/
function mycode_auto_url($message)
{

		$message = " ".$message;
$message = preg_replace("#([\>\s\(\)])(https?|ftp|news){1}://([\w\-]+\.([\w\-]+\.)*[\w]+(:[0-9]+)?(/[^\"\s<\[]*)?)#i", "$1[url]$2://$3[/url]", $message);
$message = preg_replace("#([\>\s\(\)])(www|ftp)\.(([\w\-]+\.)*[\w]+(:[0-9]+)?(/[^\"\s<\[]*)?)#i", "$1[url]$2.$3[/url]", $message);
















		static $utf8_pcre_supported;
if(!isset($utf8_pcre_supported))
{
$utf8_pcre_supported = @preg_match('#^.#u', 'a');
}

if($utf8_pcre_supported)
{
$utf8_regex_chr = "u";
}
else
{
$utf8_regex_chr = "";
}

$message = " ".$message;
$message = preg_replace("#([\>\s\(\)])(https?|ftp|news){1}://([\w\-]+\.([\w\-]+\.)*[\w]+(:[0-9]+)?(/[^\"\s<\[]*)?)#i".$utf8_regex_chr, "$1[url]$2://$3[/url]", $message);
$message = preg_replace("#([\>\s\(\)])(www|ftp)\.(([\w\-]+\.)*[\w]+(:[0-9]+)?(/[^\"\s<\[]*)?)#i".$utf8_regex_chr, "$1[url]$2.$3[/url]", $message);

		$message = my_substr($message, 1);
return $message;
}

		$message = my_substr($message, 1);
return $message;
}