Zeile 6 | Zeile 6 |
---|
* Website: http://www.mybboard.com * License: http://www.mybboard.com/eula.html *
|
* Website: http://www.mybboard.com * License: http://www.mybboard.com/eula.html *
|
* $Id: class_parser.php 2190 2006-09-02 21:33:01Z Tikitiki $
| * $Id: class_parser.php 2800 2007-02-14 05:57:01Z chris $
|
*/
/*
| */
/*
|
Zeile 93 | Zeile 93 |
---|
$message = $this->parse_badwords($message); }
|
$message = $this->parse_badwords($message); }
|
| if($options['allow_html'] != "yes") { $message = $this->parse_html($message); } else { // Strip out any script tags if HTML is enabled if($options['allow_html'] == "yes") { while(preg_match("#<script(.*)>(.*)</script(.*)>#is", $message)) { $message = preg_replace("#<script(.*)>(.*)</script(.*)>#is", "<script$1>$2</script$3>", $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('<?php', '<!--', '-->', '?>', "\n", "\n"), $message); } }
|
// If MyCode needs to be replaced, first filter out [code] and [php] tags. if($options['allow_mycode'] != "no") {
| // If MyCode needs to be replaced, first filter out [code] and [php] tags. if($options['allow_mycode'] != "no") {
|
Zeile 101 | Zeile 122 |
---|
$message = preg_replace("#\[(code|php)\](.*?)\[/\\1\](\r\n?|\n?)#si", "{{mybb-code}}\n", $message); }
|
$message = preg_replace("#\[(code|php)\](.*?)\[/\\1\](\r\n?|\n?)#si", "{{mybb-code}}\n", $message); }
|
if($options['allow_html'] != "yes") { $message = $this->parse_html($message); } // If we can, parse smiliesa if($options['allow_smilies'] != "no") { $message = $this->parse_smilies($message, $options['allowhtml']); }
| // Always fix bad Javascript in the message. $message = $this->fix_javascript($message);
// If we can, parse smilies if($options['allow_smilies'] != "no") { $message = $this->parse_smilies($message, $options['allowhtml']); }
|
// Replace MyCode if requested. if($options['allow_mycode'] != "no") { $message = $this->parse_mycode($message, $options);
|
// Replace MyCode if requested. if($options['allow_mycode'] != "no") { $message = $this->parse_mycode($message, $options);
|
}
| }
|
|
|
// Strip out any script tags if HTML is enabled if($options['allow_html'] == "yes") { while(preg_match("#<script(.*)>(.*)</script(.*)>#is", $message)) { $message = preg_replace("#<script(.*)>(.*)</script(.*)>#is", "<script$1>$2</script$3>", $message); } $message = preg_replace("#<base(.*)>#is", "<base$1>", $message); $message = preg_replace("#<meta(.*)>#is", "<meta$1>", $message); }
| |
// Run plugin hooks $message = $plugins->run_hooks("parse_message", $message);
| // Run plugin hooks $message = $plugins->run_hooks("parse_message", $message);
|
Zeile 139 | Zeile 148 |
---|
foreach($code_matches as $text) { // Fix up HTML inside the code tags so it is clean
|
foreach($code_matches as $text) { // Fix up HTML inside the code tags so it is clean
|
$text[2] = $this->parse_html($text[2]);
| if($options['allow_html'] != "no") { $text[2] = $this->parse_html($text[2]); }
|
if(strtolower($text[1]) == "code") {
| if(strtolower($text[1]) == "code") {
|
Zeile 157 | Zeile 169 |
---|
if($options['nl2br'] != "no") { $message = nl2br($message);
|
if($options['nl2br'] != "no") { $message = nl2br($message);
|
$message = str_replace("</div><br />", "</div>", $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("#( )+(</?(?:html|head|body|form|div|p|table|thead|tbody|tfoot|tr|td|th|ul|ol|li|div|p)[^>]*>)#i", "$2", $message);
|
}
|
}
|
// Always fix bad Javascript in the message. $message = $this->fix_javascript($message);
|
|
$message = my_wordwrap($message);
|
$message = my_wordwrap($message);
|
$message = str_replace(" ", " ", $message);
| |
$message = $plugins->run_hooks("parse_message_end", $message);
| $message = $plugins->run_hooks("parse_message_end", $message);
|
Zeile 192 | Zeile 202 |
---|
*/ 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 200 | Zeile 210 |
---|
$standard_mycode['u']['regex'] = "#\[u\](.*?)\[/u\]#si"; $standard_mycode['u']['replacement'] = "<u>$1</u>";
|
$standard_mycode['u']['regex'] = "#\[u\](.*?)\[/u\]#si"; $standard_mycode['u']['replacement'] = "<u>$1</u>";
|
|
|
$standard_mycode['i']['regex'] = "#\[i\](.*?)\[/i\]#si"; $standard_mycode['i']['replacement'] = "<em>$1</em>";
| $standard_mycode['i']['regex'] = "#\[i\](.*?)\[/i\]#si"; $standard_mycode['i']['replacement'] = "<em>$1</em>";
|
Zeile 212 | Zeile 222 |
---|
$standard_mycode['tm']['regex'] = "#\(tm\)#i"; $standard_mycode['tm']['replacement'] = "™";
|
$standard_mycode['tm']['regex'] = "#\(tm\)#i"; $standard_mycode['tm']['replacement'] = "™";
|
|
|
$standard_mycode['reg']['regex'] = "#\(r\)#i"; $standard_mycode['reg']['replacement'] = "®";
| $standard_mycode['reg']['regex'] = "#\(r\)#i"; $standard_mycode['reg']['replacement'] = "®";
|
Zeile 224 | Zeile 234 |
---|
$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']['regex'] = "#\[url=([a-z]+?://)([^\r\n\"\[<]+?)\](.+?)\[/url\]#esi"; $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']['replacement'] = "\$this->mycode_parse_url(\"$1\", \"$2\")";
| $standard_mycode['url_complex2']['regex'] = "#\[url=([^\r\n\"\[<&\(\)]+?)\](.+?)\[/url\]#esi"; $standard_mycode['url_complex2']['replacement'] = "\$this->mycode_parse_url(\"$1\", \"$2\")";
|
Zeile 239 | Zeile 249 |
---|
$standard_mycode['size']['regex'] = "#\[size=(xx-small|x-small|small|medium|large|x-large|xx-large)\](.*?)\[/size\]#si"; $standard_mycode['size']['replacement'] = "<span style=\"font-size: $1;\">$2</span>";
|
$standard_mycode['size']['regex'] = "#\[size=(xx-small|x-small|small|medium|large|x-large|xx-large)\](.*?)\[/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']['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>";
|
|
|
$standard_mycode['align']['regex'] = "#\[align=(left|center|right|justify)\](.*?)\[/align\]#si"; $standard_mycode['align']['replacement'] = "<p style=\"text-align: $1;\">$2</p>";
| $standard_mycode['align']['regex'] = "#\[align=(left|center|right|justify)\](.*?)\[/align\]#si"; $standard_mycode['align']['replacement'] = "<p style=\"text-align: $1;\">$2</p>";
|
Zeile 266 | Zeile 276 |
---|
else { $mycode = $standard_mycode;
|
else { $mycode = $standard_mycode;
|
| } if(strtolower($lang->settings['charset']) == 'utf-8') { $extra_modifier = 'u'; } else { $extra_modifier = '';
|
}
// Assign the MyCode to the cache. foreach($mycode as $code) {
|
}
// Assign the MyCode to the cache. foreach($mycode as $code) {
|
$this->mycode_cache['find'][] = $code['regex'];
| $this->mycode_cache['find'][] = $code['regex'] . $extra_modifier;
|
$this->mycode_cache['replacement'][] = $code['replacement']; } }
| $this->mycode_cache['replacement'][] = $code['replacement']; } }
|
Zeile 296 | Zeile 315 |
---|
// 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('$', '$', $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 317 | Zeile 338 |
---|
if($options['allow_imgcode'] != "no") { $message = preg_replace("#\[img\](\r\n?|\n?)(https?://([^<>\"']+?))\[/img\]#ise", "\$this->mycode_parse_img('$2')\n", $message);
|
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('$2', '$3'));", $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 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('$4', array('$1', '$2', '$3'));", $message);
|
}
// Replace "me" code and slaps if we have a username
| }
// Replace "me" code and slaps if we have a username
|
Zeile 341 | Zeile 364 |
---|
$this->smilies_cache = array();
$smilies = $cache->read("smilies");
|
$this->smilies_cache = array();
$smilies = $cache->read("smilies");
|
foreach($smilies as $sid => $smilie)
| if(is_array($smilies))
|
{
|
{
|
$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 408 | Zeile 434 |
---|
{ 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")
| } } if($options['strip_tags'] == "yes")
|
Zeile 427 | Zeile 453 |
---|
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; }
|
/** * Parses quote MyCode.
|
/** * Parses quote MyCode.
|
* * @param string The message to be parsed * @return string The parsed message. */
| * * @param string The message to be parsed * @return string The parsed message. */
|
function mycode_parse_quotes($message) { global $lang;
| function mycode_parse_quotes($message) { global $lang;
|
Zeile 462 | Zeile 488 |
---|
// Assign pattern and replace values. $pattern = array("#\[quote=(?:"|\"|')?(.*?)[\"']?(?:"|\"|')?\](.*?)\[\/quote\](\r\n?|\n?)#si", "#\[quote\](.*?)\[\/quote\](\r\n?|\n?)#si");
|
// Assign pattern and replace values. $pattern = array("#\[quote=(?:"|\"|')?(.*?)[\"']?(?:"|\"|')?\](.*?)\[\/quote\](\r\n?|\n?)#si", "#\[quote\](.*?)\[\/quote\](\r\n?|\n?)#si");
|
|
|
|
|
$replace = array("<div class=\"quote_header\">".htmlentities('\\1')." $lang->wrote\n</div><div class=\"quote_body\">$2</div>\n", "<div class=\"quote_header\">$lang->quote\n</div><div class=\"quote_body\">$1</div>\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");
|
while(preg_match($pattern[0], $message) or preg_match($pattern[1], $message)) {
| while(preg_match($pattern[0], $message) or preg_match($pattern[1], $message)) {
|
Zeile 473 | Zeile 500 |
---|
$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\">",
| $replace = array( "<div class=\"quote_body\">",
|
Zeile 491 | Zeile 518 |
---|
* @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); return "<div class=\"code_header\">".$lang->code."\n</div><div class=\"code_body\"><div dir=\"ltr\"><code>".$code."</code></div></div>\n";
| { 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('&', '&', $code); $code = preg_replace('#\$([0-9])#', '\\\$\\1', $code); $code = str_replace('\\', '\', $code); $code = str_replace("\t", ' ', $code); $code = str_replace(" ", ' ', $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";
|
}
/**
| }
/**
|
Zeile 508 | Zeile 550 |
---|
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('&', '&', $str);
|
$str = str_replace('<', '<', $str); $str = str_replace('>', '>', $str);
|
$str = str_replace('<', '<', $str); $str = str_replace('>', '>', $str);
|
$str = str_replace('&', '&', $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", "<")) {
|
Zeile 531 | Zeile 586 |
---|
@highlight_string($str); $code = ob_get_contents(); ob_end_clean();
|
@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 544 | Zeile 600 |
---|
"color=\"", "</font>" );
|
"color=\"", "</font>" );
|
| |
$replace = array( "<span", "style=\"color: ",
| $replace = array( "<span", "style=\"color: ",
|
Zeile 559 | Zeile 614 |
---|
$code = preg_replace("#</span>(\r\n?|\n?)</code>#", "</span></code>", $code); $code = str_replace("\\", '\', $code); $code = preg_replace("#&\#([0-9]+);#si", "&#$1;", $code);
|
$code = preg_replace("#</span>(\r\n?|\n?)</code>#", "</span></code>", $code); $code = str_replace("\\", '\', $code); $code = preg_replace("#&\#([0-9]+);#si", "&#$1;", $code);
|
if($added_open_close == true) { $code = preg_replace("#<code><span style=\"color: \#0000BB\"><\?php( | )(<br />?)#", "<code><span style=\"color: #0000BB\">", $code);
| if($added_open_tag) { $code = preg_replace("#<code><span style=\"color: \#([A-Z0-9]{6})\"><\?php( | )(<br />?)#", "<code><span style=\"color: #$1\">", $code); }
if($added_end_tag) {
|
$code = str_replace("?></span></code>", "</span></code>", $code);
|
$code = str_replace("?></span></code>", "</span></code>", $code);
|
| // Wait a minute. It fails highlighting? Stupid highlighter. $code = str_replace("?></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 = str_replace("</code>", "</code></div>", $code);
|
$code = str_replace("<code>", "<div dir=\"ltr\"><code>", $code); $code = str_replace("</code>", "</code></div>", $code);
|
$code = preg_replace("#\s*$#", "", $code);
| $code = preg_replace("# *$#", "", $code); $code = preg_replace('#\$([0-9])#', '\\\$\\1', $code);
|
// Send back the code all nice and pretty
|
// Send back the code all nice and pretty
|
return "<div class=\"code_header\">$lang->php_code\n</div><div class=\"code_body\">".$code."</div>\n"; }
| return "</p>\n<div class=\"code_header\">$lang->php_code\n</div><div class=\"code_body\">".$code."</div>\n<p>\n"; }
|
/** * Parses URL MyCode.
| /** * Parses URL MyCode.
|
Zeile 610 | Zeile 672 |
---|
{ $name = my_substr($url, 0, 40)."...".my_substr($url, -10); }
|
{ $name = my_substr($url, 0, 40)."...".my_substr($url, -10); }
|
}
| }
|
|
|
$name = preg_replace("#&\#([0-9]+);#si", "&#$1;", $name); $name = preg_replace("#&(?!\#[0-9]+;)#si", "&", $name); // Fix & but allow unicode
| $name = preg_replace("#&\#([0-9]+);#si", "&#$1;", $name); // Fix & but allow unicode
|
$link = "<a href=\"$fullurl\" target=\"_blank\">$name</a>"; return $link; }
| $link = "<a href=\"$fullurl\" target=\"_blank\">$name</a>"; return $link; }
|
Zeile 624 | Zeile 685 |
---|
* @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 686 | Zeile 755 |
---|
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 = "<ol type=\"$type\">$message</ol>";
| $list = "\n<ol type=\"$type\">$message</ol>\n";
|
} else {
|
} else {
|
$list = "<ul>$message</ul>";
| $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;
|