Vergleich inc/class_parser.php - 1.2.1 - 1.2.7

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 3Zeile 3
 * MyBB 1.2
* Copyright � 2006 MyBB Group, All Rights Reserved
*

 * MyBB 1.2
* Copyright � 2006 MyBB Group, All Rights Reserved
*

 * Website: http://www.mybboard.com
* License: http://www.mybboard.com/eula.html

 * Website: http://www.mybboard.net
* License: http://www.mybboard.net/eula.html

 *

 *

 * $Id: class_parser.php 2271 2006-09-27 02:45:07Z Tikitiki $

 * $Id: class_parser.php 3030 2007-04-26 00:19:47Z Tikitiki $

 */

/*

 */

/*

Zeile 75Zeile 75

if($this->base_url != "")
{


if($this->base_url != "")
{

			if(my_substr($this->base_url, strlen($this->base_url) -1) != "/")

			if(my_substr($this->base_url, my_strlen($this->base_url) -1) != "/")

			{
$this->base_url = $this->base_url."/";
}

			{
$this->base_url = $this->base_url."/";
}

Zeile 86Zeile 86

// Get rid of cartridge returns for they are the workings of the devil
$message = str_replace("\r", "", $message);


// Get rid of cartridge returns for they are the workings of the devil
$message = str_replace("\r", "", $message);

		$message = $this->strip_rtl($message);


 
		
// Filter bad words if requested.
if($options['filter_badwords'] != "no")

		
// Filter bad words if requested.
if($options['filter_badwords'] != "no")

Zeile 107Zeile 105
				while(preg_match("#<script(.*)>(.*)</script(.*)>#is", $message))
{
$message = preg_replace("#<script(.*)>(.*)</script(.*)>#is", "&lt;script$1&gt;$2&lt;/script$3&gt;", $message);

				while(preg_match("#<script(.*)>(.*)</script(.*)>#is", $message))
{
$message = preg_replace("#<script(.*)>(.*)</script(.*)>#is", "&lt;script$1&gt;$2&lt;/script$3&gt;", $message);

				}
$message = preg_replace("#<base(.*)>#is", "&lt;base$1&gt;", $message);
$message = preg_replace("#<meta(.*)>#is", "&lt;meta$1&gt;", $message);




				}
// Remove these completely
$message = preg_replace("#\s*<base[^>]*>\s*#is", "", $message);
$message = preg_replace("#\s*<meta[^>]*>\s*#is", "", $message);

$message = str_replace(array('<?php', '<!--', '-->', '?>', "<br />\n", "<br>\n"), array('&lt;?php', '&lt;!--', '--&gt;', '?&gt;', "\n", "\n"), $message);

			}
}


			}
}


Zeile 123Zeile 124

// Always fix bad Javascript in the message.
$message = $this->fix_javascript($message);


// Always fix bad Javascript in the message.
$message = $this->fix_javascript($message);

 
		
// Replace "me" code and slaps if we have a username
if($options['me_username'])
{
$message = preg_replace('#(>|^|\r|\n)/me ([^\r\n<]*)#i', "\\1<span style=\"color: red;\">* {$options['me_username']} \\2</span>", $message);
$message = preg_replace('#(>|^|\r|\n)/slap ([^\r\n<]*)#i', "\\1<span style=\"color: red;\">* {$options['me_username']} {$lang->slaps} \\2 {$lang->with_trout}</span>", $message);
}





		// If we can, parse smiliesa

		// If we can, parse smilies

		if($options['allow_smilies'] != "no")
{

		if($options['allow_smilies'] != "no")
{

			$message = $this->parse_smilies($message, $options['allowhtml']);

			$message = $this->parse_smilies($message, $options['allow_html']);

		}

// Replace MyCode if requested.

		}

// Replace MyCode if requested.

Zeile 140Zeile 148
		$message = $plugins->run_hooks("parse_message", $message);

if($options['allow_mycode'] != "no")

		$message = $plugins->run_hooks("parse_message", $message);

if($options['allow_mycode'] != "no")

		{

		{

			// Now that we're done, if we split up any code tags, parse them and glue it all back together
if(count($code_matches) > 0)
{

			// Now that we're done, if we split up any code tags, parse them and glue it all back together
if(count($code_matches) > 0)
{

Zeile 168Zeile 176
		if($options['nl2br'] != "no")
{
$message = nl2br($message);

		if($options['nl2br'] != "no")
{
$message = nl2br($message);

			$message = str_replace("</div><br />", "</div>", $message);
$message = preg_replace("#<(/?)p>\s*(<br />?)#", "<$1p>", $message);
}


			// Fix up new lines and block level elements
$message = preg_replace("#(</?(?:html|head|body|form|div|p|table|thead|tbody|tfoot|tr|td|th|ul|ol|li|div|p)[^>]*>)\s*<br />#i", "$1", $message);
$message = preg_replace("#(&nbsp;)+(</?(?:html|head|body|form|div|p|table|thead|tbody|tfoot|tr|td|th|ul|ol|li|div|p)[^>]*>)#i", "$2", $message);
}

	
$message = my_wordwrap($message);

	
$message = my_wordwrap($message);

		
$message = str_replace(" ", "&nbsp;&nbsp;", $message);

 
		
$message = $plugins->run_hooks("parse_message_end", $message);


		
$message = $plugins->run_hooks("parse_message_end", $message);


		return $message;
}

		return $message;
}


/**
* Converts HTML in a message to their specific entities whilst allowing unicode characters.


/**
* Converts HTML in a message to their specific entities whilst allowing unicode characters.

	 *

	 *

	 * @param string The message to be parsed.
* @return string The formatted message.

	 * @param string The message to be parsed.
* @return string The formatted message.

	 */

	 */

	function parse_html($message)
{
$message = preg_replace("#&(?!\#[0-9]+;)#si", "&amp;", $message); // fix & but allow unicode

	function parse_html($message)
{
$message = preg_replace("#&(?!\#[0-9]+;)#si", "&amp;", $message); // fix & but allow unicode

Zeile 202Zeile 209
	 */
function cache_mycode()
{

	 */
function cache_mycode()
{

		global $cache;

		global $cache, $lang;

		$this->mycode_cache = array();

$standard_mycode['b']['regex'] = "#\[b\](.*?)\[/b\]#si";

		$this->mycode_cache = array();

$standard_mycode['b']['regex'] = "#\[b\](.*?)\[/b\]#si";

Zeile 251Zeile 258
		$standard_mycode['size']['replacement'] = "<span style=\"font-size: $1;\">$2</span>";

$standard_mycode['size_int']['regex'] = "#\[size=([0-9\+\-]+?)\](.*?)\[/size\]#si";

		$standard_mycode['size']['replacement'] = "<span style=\"font-size: $1;\">$2</span>";

$standard_mycode['size_int']['regex'] = "#\[size=([0-9\+\-]+?)\](.*?)\[/size\]#si";

		$standard_mycode['size_int']['replacement'] = "<font size=\"$1\">$2</font>";

		$standard_mycode['size_int']['replacement'] = "<span style=\"font-size: $1em;\">$2</span>";


$standard_mycode['font']['regex'] = "#\[font=([a-z ]+?)\](.+?)\[/font\]#si";
$standard_mycode['font']['replacement'] = "<span style=\"font-family: $1;\">$2</span>";


$standard_mycode['font']['regex'] = "#\[font=([a-z ]+?)\](.+?)\[/font\]#si";
$standard_mycode['font']['replacement'] = "<span style=\"font-family: $1;\">$2</span>";

Zeile 277Zeile 284
		{
$mycode = $standard_mycode;
}

		{
$mycode = $standard_mycode;
}



		

		// Assign the MyCode to the cache.
foreach($mycode as $code)
{

		// Assign the MyCode to the cache.
foreach($mycode as $code)
{

Zeile 306Zeile 313
		// Parse quotes first
$message = $this->mycode_parse_quotes($message);


		// Parse quotes first
$message = $this->mycode_parse_quotes($message);


		$message = $this->mycode_auto_url($message);		




		$message = $this->mycode_auto_url($message);

$message = str_replace('$', '&#36;', $message);


		// Replace the rest
$message = preg_replace($this->mycode_cache['find'], $this->mycode_cache['replacement'], $message);

// Special code requiring special attention
while(preg_match("#\[list\](.*?)\[/list\]#esi", $message))

		// Replace the rest
$message = preg_replace($this->mycode_cache['find'], $this->mycode_cache['replacement'], $message);

// Special code requiring special attention
while(preg_match("#\[list\](.*?)\[/list\]#esi", $message))

		{

		{

			$message = preg_replace("#\[list\](.*?)\[/list\](\r\n?|\n?)#esi", "\$this->mycode_parse_list('$1')\n", $message);
}


			$message = preg_replace("#\[list\](.*?)\[/list\](\r\n?|\n?)#esi", "\$this->mycode_parse_list('$1')\n", $message);
}


Zeile 325Zeile 334

// Convert images when allowed.
if($options['allow_imgcode'] != "no")


// Convert images when allowed.
if($options['allow_imgcode'] != "no")

		{

		{

			$message = preg_replace("#\[img\](\r\n?|\n?)(https?://([^<>\"']+?))\[/img\]#ise", "\$this->mycode_parse_img('$2')\n", $message);
$message = preg_replace("#\[img=([0-9]{1,3})x([0-9]{1,3})\](\r\n?|\n?)(https?://([^<>\"']+?))\[/img\]#ise", "\$this->mycode_parse_img('$4', array('$1', '$2'));", $message);

			$message = preg_replace("#\[img\](\r\n?|\n?)(https?://([^<>\"']+?))\[/img\]#ise", "\$this->mycode_parse_img('$2')\n", $message);
$message = preg_replace("#\[img=([0-9]{1,3})x([0-9]{1,3})\](\r\n?|\n?)(https?://([^<>\"']+?))\[/img\]#ise", "\$this->mycode_parse_img('$4', array('$1', '$2'));", $message);

		}

// Replace "me" code and slaps if we have a username
if($options['me_username'])
{
$message = preg_replace('#(>|^|\r|\n)/me ([^\r\n<]*)#i', "\\1<span style=\"color: red;\">* {$options['me_username']} \\2</span>", $message);
$message = preg_replace('#(>|^|\r|\n)/slap ([^\r\n<]*)#i', "\\1<span style=\"color: red;\">* {$options['me_username']} {$lang->slaps} \\2 {$lang->with_trout}</span>", $message);
}

return $message;
}

/**

			$message = preg_replace("#\[img align=([a-z]+)\](\r\n?|\n?)(https?://([^<>\"']+?))\[/img\]#ise", "\$this->mycode_parse_img('$3', array(), '$1');", $message);
$message = preg_replace("#\[img=([0-9]{1,3})x([0-9]{1,3}) align=([a-z]+)\](\r\n?|\n?)(https?://([^<>\"']+?))\[/img\]#ise", "\$this->mycode_parse_img('$5', array('$1', '$2', '$3'));", $message);
}

return $message;
}

/**






	 * Generates a cache of smilies
*
* @access private

	 * Generates a cache of smilies
*
* @access private

Zeile 356Zeile 360
			foreach($smilies as $sid => $smilie)
{
$this->smilies_cache[$smilie['find']] = "<img src=\"{$this->base_url}{$smilie['image']}\" style=\"vertical-align: middle;\" border=\"0\" alt=\"{$smilie['name']}\" title=\"{$smilie['name']}\" />";

			foreach($smilies as $sid => $smilie)
{
$this->smilies_cache[$smilie['find']] = "<img src=\"{$this->base_url}{$smilie['image']}\" style=\"vertical-align: middle;\" border=\"0\" alt=\"{$smilie['name']}\" title=\"{$smilie['name']}\" />";

			}
}

			}
}

	}

/**

	}

/**

Zeile 373Zeile 377
		if($this->smilies_cache == 0)
{
$this->cache_smilies();

		if($this->smilies_cache == 0)
{
$this->cache_smilies();

		}

		}

		if(is_array($this->smilies_cache))
{
reset($this->smilies_cache);

		if(is_array($this->smilies_cache))
{
reset($this->smilies_cache);

Zeile 399Zeile 403
		global $cache;
$this->badwords_cache = array();
$this->badwords_cache = $cache->read("badwords");

		global $cache;
$this->badwords_cache = array();
$this->badwords_cache = $cache->read("badwords");

	}

/**

	}

/**

	 * Parses a list of filtered/badwords in the specified message.
*
* @param string The message to be parsed.

	 * Parses a list of filtered/badwords in the specified message.
*
* @param string The message to be parsed.

Zeile 411Zeile 415
	function parse_badwords($message, $options=array())
{
if($this->badwords_cache == 0)

	function parse_badwords($message, $options=array())
{
if($this->badwords_cache == 0)

		{

		{

			$this->cache_badwords();
}
if(is_array($this->badwords_cache))

			$this->cache_badwords();
}
if(is_array($this->badwords_cache))

Zeile 421Zeile 425
			{
if(!$badword['replacement']) $badword['replacement'] = "*****";
$badword['badword'] = preg_quote($badword['badword']);

			{
if(!$badword['replacement']) $badword['replacement'] = "*****";
$badword['badword'] = preg_quote($badword['badword']);

				$message = preg_replace("#\b".$badword['badword']."\b#i", $badword['replacement'], $message);

				$message = preg_replace("#(\W|^)".$badword['badword']."(\W|$)#i", "\\1".$badword['replacement']."\\2", $message);

			}
}
if($options['strip_tags'] == "yes")
{
$message = strip_tags($message);

			}
}
if($options['strip_tags'] == "yes")
{
$message = strip_tags($message);

		}
return $message;
}

/**

		}
return $message;
}

/**

	 * Attempts to move any javascript references in the specified message.
*
* @param string The message to be parsed.

	 * Attempts to move any javascript references in the specified message.
*
* @param string The message to be parsed.

Zeile 440Zeile 444
	function fix_javascript($message)
{
$js_array = array(

	function fix_javascript($message)
{
$js_array = array(

			"#(j)(avascript)#i",
"#(a)(lert)#i",
"#(o)(nmouseover)#i",
"#(o)(nmouseout)#i",
"#(o)(nmousedown)#i",
"#(o)(nmousemove)#i",
"#(o)(nmouseup)#i",
"#(o)(nclick)#i",
"#(o)(ndblclick)#i",
"#(o)(nload)#i",
"#(o)(nsubmit)#i",
"#(o)(nblur)#i",
"#(o)(nchange)#i",
"#(o)(nfocus)#i",
"#(o)(nselect)#i",
"#(o)(nunload)#i",
"#(o)(nkeypress)#i"
);

			"#(&\#(0*)106;|&\#(0*)74;|j)((&\#(0*)97;|&\#(0*)65;|a)(&\#(0*)118;|&\#(0*)86;|v)(&\#(0*)97;|&\#(0*)65;|a)(\s)?(&\#(0*)115;|&\#(0*)83;|s)(&\#(0*)99;|&\#(0*)67;|c)(&\#(0*)114;|&\#(0*)82;|r)(&\#(0*)105;|&\#(0*)73;|i)(&\#112;|&\#(0*)80;|p)(&\#(0*)116;|&\#(0*)84;|t)(&\#(0*)58;|\:))#i",
"#(o)(nmouseover\s?=)#i",
"#(o)(nmouseout\s?=)#i",
"#(o)(nmousedown\s?=)#i",
"#(o)(nmousemove\s?=)#i",
"#(o)(nmouseup\s?=)#i",
"#(o)(nclick\s?=)#i",
"#(o)(ndblclick\s?=)#i",
"#(o)(nload\s?=)#i",
"#(o)(nsubmit\s?=)#i",
"#(o)(nblur\s?=)#i",
"#(o)(nchange\s?=)#i",
"#(o)(nfocus\s?=)#i",
"#(o)(nselect\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", $message);

 


		return $message;
}


		return $message;
}


Zeile 475Zeile 479
		// Assign pattern and replace values.
$pattern = array("#\[quote=(?:&quot;|\"|')?(.*?)[\"']?(?:&quot;|\"|')?\](.*?)\[\/quote\](\r\n?|\n?)#si",
"#\[quote\](.*?)\[\/quote\](\r\n?|\n?)#si");

		// Assign pattern and replace values.
$pattern = array("#\[quote=(?:&quot;|\"|')?(.*?)[\"']?(?:&quot;|\"|')?\](.*?)\[\/quote\](\r\n?|\n?)#si",
"#\[quote\](.*?)\[\/quote\](\r\n?|\n?)#si");

 
						 


$replace = array("</p>\n<div class=\"quote_header\">".htmlentities('\\1')." $lang->wrote\n</div><div class=\"quote_body\">$2</div>\n<p>\n",
"</p>\n<div class=\"quote_header\">$lang->quote\n</div><div class=\"quote_body\">$1</div>\n<p>\n");


$replace = array("</p>\n<div class=\"quote_header\">".htmlentities('\\1')." $lang->wrote\n</div><div class=\"quote_body\">$2</div>\n<p>\n",
"</p>\n<div class=\"quote_header\">$lang->quote\n</div><div class=\"quote_body\">$1</div>\n<p>\n");

Zeile 486Zeile 491
		$find = array(
"#<div class=\"quote_body\">(\r\n?|\n?)#",
"#(\r\n?|\n?)</div>#"

		$find = array(
"#<div class=\"quote_body\">(\r\n?|\n?)#",
"#(\r\n?|\n?)</div>#"

		);


		);


		$replace = array(
"<div class=\"quote_body\">",
"</div>"
);
$message = preg_replace($find, $replace, $message);

		$replace = array(
"<div class=\"quote_body\">",
"</div>"
);
$message = preg_replace($find, $replace, $message);

		return $message;

}

		return $message;

}


/**
* Parses code MyCode.


/**
* Parses code MyCode.

Zeile 504Zeile 509
	* @return string The parsed message.
*/
function mycode_parse_code($code)

	* @return string The parsed message.
*/
function mycode_parse_code($code)

	{
global $lang;
$code = trim($code);












	{
global $lang;

// 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('$', '&#36;', $code);

		$code = preg_replace('#\$([0-9])#', '\\\$\\1', $code);

		$code = preg_replace('#\$([0-9])#', '\\\$\\1', $code);

 
		$code = str_replace('\\', '&#92;', $code);
$code = str_replace("\t", '&nbsp;&nbsp;&nbsp;&nbsp;', $code);
$code = str_replace(" ", '&nbsp;&nbsp;', $code);

		return "</p>\n<div class=\"code_header\">".$lang->code."\n</div><div class=\"code_body\"><div dir=\"ltr\"><code>".$code."</code></div></div>\n<p>\n";
}


		return "</p>\n<div class=\"code_header\">".$lang->code."\n</div><div class=\"code_body\"><div dir=\"ltr\"><code>".$code."</code></div></div>\n<p>\n";
}


Zeile 522Zeile 541
		global $lang;

// Clean the string before parsing.

		global $lang;

// Clean the string before parsing.

		$str = trim($str);
if(!$str)





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

$original = preg_replace('#^\t*#', '', $str);

if(empty($original))

		{
return;
}

		{
return;
}

 

$str = str_replace('&amp;', '&', $str);

		$str = str_replace('&lt;', '<', $str);
$str = str_replace('&gt;', '>', $str);

		$str = str_replace('&lt;', '<', $str);
$str = str_replace('&gt;', '>', $str);

		$str = str_replace('&amp;', '&', $str);
$original = $str;




		// See if open and close tags are provided.

		// See if open and close tags are provided.

		$added_open_close = false;

		$added_open_tag = false;

		if(!preg_match("#^\s*<\?#si", $str))
{

		if(!preg_match("#^\s*<\?#si", $str))
{

			$added_open_close = true;
$str = "<?php \n".$str." \n?>";








			$added_open_tag = true;
$str = "<?php \n".$str;
}

$added_end_tag = false;
if(!preg_match("#\?>\s*$#si", $str))
{
$added_end_tag = true;
$str = $str." \n?>";

		}

		}

 


		// If the PHP version < 4.2, catch highlight_string() output.
if(version_compare(PHP_VERSION, "4.2.0", "<"))

		// If the PHP version < 4.2, catch highlight_string() output.
if(version_compare(PHP_VERSION, "4.2.0", "<"))

		{

		{

			ob_start();
@highlight_string($str);
$code = ob_get_contents();
ob_end_clean();

			ob_start();
@highlight_string($str);
$code = ob_get_contents();
ob_end_clean();

		}

		}

		else
{
$code = @highlight_string($str, true);
}

		else
{
$code = @highlight_string($str, true);
}

 


		// If < PHP 5, make XHTML compatible.
if(version_compare(PHP_VERSION, "5", "<"))
{

		// If < PHP 5, make XHTML compatible.
if(version_compare(PHP_VERSION, "5", "<"))
{

Zeile 558Zeile 591
				"color=\"",
"</font>"
);

				"color=\"",
"</font>"
);



 
			$replace = array(
"<span",
"style=\"color: ",

			$replace = array(
"<span",
"style=\"color: ",

Zeile 572Zeile 604
		$code = preg_replace("#</span>\s*</code>#", "</code>", $code);
$code = preg_replace("#</span>(\r\n?|\n?)</code>#", "</span></code>", $code);
$code = str_replace("\\", '&#092;', $code);

		$code = preg_replace("#</span>\s*</code>#", "</code>", $code);
$code = preg_replace("#</span>(\r\n?|\n?)</code>#", "</span></code>", $code);
$code = str_replace("\\", '&#092;', $code);

 
		$code = str_replace('$', '&#36;', $code);

		$code = preg_replace("#&amp;\#([0-9]+);#si", "&#$1;", $code);


		$code = preg_replace("#&amp;\#([0-9]+);#si", "&#$1;", $code);


 
		if($added_open_tag)
{
$code = preg_replace("#<code><span style=\"color: \#([A-Z0-9]{6})\">&lt;\?php( |&nbsp;)(<br />?)#", "<code><span style=\"color: #$1\">", $code);
}





		if($added_open_close == true)

		if($added_end_tag)

		{

		{

			$code = preg_replace("#<code><span style=\"color: \#([A-Z0-9]{6})\">&lt;\?php( |&nbsp;)(<br />?)#", "<code><span style=\"color: #$1\">", $code);

 
			$code = str_replace("?&gt;</span></code>", "</span></code>", $code);

			$code = str_replace("?&gt;</span></code>", "</span></code>", $code);

		}



			// Wait a minute. It fails highlighting? Stupid highlighter.
$code = str_replace("?&gt;</code>", "</code>", $code);
}


$code = preg_replace("#<span style=\"color: \#([A-Z0-9]{6})\"></span>#", "", $code);
$code = str_replace("<code>", "<div dir=\"ltr\"><code>", $code);


$code = preg_replace("#<span style=\"color: \#([A-Z0-9]{6})\"></span>#", "", $code);
$code = str_replace("<code>", "<div dir=\"ltr\"><code>", $code);

Zeile 603Zeile 641
		if(!preg_match("#^[a-z0-9]+://#i", $url))
{
$url = "http://".$url;

		if(!preg_match("#^[a-z0-9]+://#i", $url))
{
$url = "http://".$url;

		}

		}

		$fullurl = $url;

		$fullurl = $url;





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

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

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

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

		{

		{

			$fullurl = "http://".$fullurl;
}
if(!$name)

			$fullurl = "http://".$fullurl;
}
if(!$name)

Zeile 622Zeile 660
		$fullurl = stripslashes($fullurl);
if($name == $url && $this->options['shorten_urls'] != "no")
{

		$fullurl = stripslashes($fullurl);
if($name == $url && $this->options['shorten_urls'] != "no")
{

			if(strlen($url) > 55)

			if(my_strlen($url) > 55)

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

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

Zeile 639Zeile 677
	 * @param string The URL to the image
* @param array Optional array of dimensions
*/

	 * @param string The URL to the image
* @param array Optional array of dimensions
*/

	function mycode_parse_img($url, $dimensions=array())

	function mycode_parse_img($url, $dimensions=array(), $align='')

	{
$url = trim($url);
$url = str_replace("\n", "", $url);
$url = str_replace("\r", "", $url);

	{
$url = trim($url);
$url = str_replace("\n", "", $url);
$url = str_replace("\r", "", $url);

 
		if($align == "right")
{
$css_align = " style=\"float: right;\"";
}
else if($align == "left")
{
$css_align = " style=\"float: left;\"";
}

		if($dimensions[0] > 0 && $dimensions[1] > 0)
{

		if($dimensions[0] > 0 && $dimensions[1] > 0)
{

			return "<img src=\"{$url}\" width=\"{$dimensions[0]}\" height=\"{$dimensions[1]}\" border=\"0\" alt=\"\" />";

			return "<img src=\"{$url}\" width=\"{$dimensions[0]}\" height=\"{$dimensions[1]}\" border=\"0\" alt=\"\"{$css_align} />";

		}
else
{

		}
else
{

			return "<img src=\"{$url}\" border=\"0\" alt=\"\" />";			

			return "<img src=\"{$url}\" border=\"0\" alt=\"\"{$css_align} />";			

		}
}


		}
}


Zeile 701Zeile 747
	function mycode_parse_list($message, $type="")
{
$message = str_replace('\"', '"', $message);

	function mycode_parse_list($message, $type="")
{
$message = str_replace('\"', '"', $message);

		$message = preg_replace("#\[\*\]\s?#", "</li><li>", $message);

		$message = preg_replace("#\s*\[\*\]\s*#", "</li>\n<li>", $message);

		$message .= "</li>";

if($type)
{

		$message .= "</li>";

if($type)
{

			$list = "</p>\n<ol type=\"$type\">$message</ol>\n<p>";

			$list = "\n<ol type=\"$type\">$message</ol>\n";

		}
else
{

		}
else
{

			$list = "</p>\n<ul>$message</ul>\n</p>";

			$list = "<ul>$message</ul>\n";

		}
$list = preg_replace("#<(ol type=\"$type\"|ul)>\s*</li>#", "<$1>", $list);
return $list;

		}
$list = preg_replace("#<(ol type=\"$type\"|ul)>\s*</li>#", "<$1>", $list);
return $list;

Zeile 734Zeile 780
		}
return $message;
}

		}
return $message;
}

	
/**
* Strip RTL Unicude
*
*/
function strip_rtl($message)
{
//$message = htmlentities($message);
//$message = preg_replace('/[^\x09\x0A\x0D\x20-\x7F]/e', '"&#".ord($0).";"', $message);
//$message = str_replace('&#226;&#128;&#174;', '', $message);
//$message = str_replace('&#8238;', '', $message);
//$message = str_replace('&#x202E', '', $message);
//$message = html_entity_decode($message);
return $message;
}

 

/**
* Strips MyCode.


/**
* Strips MyCode.