Zeile 3 | Zeile 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 2800 2007-02-14 05:57:01Z chris $
| * $Id: class_parser.php 3030 2007-04-26 00:19:47Z Tikitiki $
|
*/
/*
| */
/*
|
Zeile 124 | Zeile 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 smilies if($options['allow_smilies'] != "no")
|
// If we can, parse smilies 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.
|
if($options['allow_mycode'] != "no")
| if($options['allow_mycode'] != "no")
|
{ $message = $this->parse_mycode($message, $options); }
| { $message = $this->parse_mycode($message, $options); }
|
Zeile 144 | Zeile 151 |
---|
{ // 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)
|
{
| {
|
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
|
Zeile 197 | Zeile 204 |
---|
/** * Generates a cache of MyCode, both standard and custom.
|
/** * Generates a cache of MyCode, both standard and custom.
|
*
| *
|
* @access private */ function cache_mycode()
| * @access private */ function cache_mycode()
|
Zeile 276 | Zeile 283 |
---|
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'] . $extra_modifier;
| $this->mycode_cache['find'][] = $code['regex'];
|
$this->mycode_cache['replacement'][] = $code['replacement']; } }
| $this->mycode_cache['replacement'][] = $code['replacement']; } }
|
Zeile 318 | Zeile 316 |
---|
$message = $this->mycode_auto_url($message);
$message = str_replace('$', '$', $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);
| // Replace the rest $message = preg_replace($this->mycode_cache['find'], $this->mycode_cache['replacement'], $message);
|
Zeile 326 | Zeile 324 |
---|
while(preg_match("#\[list\](.*?)\[/list\]#esi", $message)) { $message = preg_replace("#\[list\](.*?)\[/list\](\r\n?|\n?)#esi", "\$this->mycode_parse_list('$1')\n", $message);
|
while(preg_match("#\[list\](.*?)\[/list\]#esi", $message)) { $message = preg_replace("#\[list\](.*?)\[/list\](\r\n?|\n?)#esi", "\$this->mycode_parse_list('$1')\n", $message);
|
}
| }
|
// Replace lists. while(preg_match("#\[list=(a|A|i|I|1)\](.*?)\[/list\](\r\n?|\n?)#esi", $message))
| // Replace lists. while(preg_match("#\[list=(a|A|i|I|1)\](.*?)\[/list\](\r\n?|\n?)#esi", $message))
|
Zeile 340 | Zeile 338 |
---|
$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 align=([a-z]+)\](\r\n?|\n?)(https?://([^<>\"']+?))\[/img\]#ise", "\$this->mycode_parse_img('$3', array(), '$1');", $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); $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 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);
| $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;
| }
return $message;
|
Zeile 531 | Zeile 522 |
---|
return; }
|
return; }
|
$code = str_replace('&', '&', $code);
| $code = str_replace('$', '$', $code);
|
$code = preg_replace('#\$([0-9])#', '\\\$\\1', $code); $code = str_replace('\\', '\', $code); $code = str_replace("\t", ' ', $code);
| $code = preg_replace('#\$([0-9])#', '\\\$\\1', $code); $code = str_replace('\\', '\', $code); $code = str_replace("\t", ' ', $code);
|
Zeile 613 | Zeile 604 |
---|
$code = preg_replace("#</span>\s*</code>#", "</code>", $code); $code = preg_replace("#</span>(\r\n?|\n?)</code>#", "</span></code>", $code); $code = str_replace("\\", '\', $code);
|
$code = preg_replace("#</span>\s*</code>#", "</code>", $code); $code = preg_replace("#</span>(\r\n?|\n?)</code>#", "</span></code>", $code); $code = str_replace("\\", '\', $code);
|
| $code = str_replace('$', '$', $code);
|
$code = preg_replace("#&\#([0-9]+);#si", "&#$1;", $code);
if($added_open_tag)
| $code = preg_replace("#&\#([0-9]+);#si", "&#$1;", $code);
if($added_open_tag)
|