Zeile 6 | Zeile 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 4322 2009-02-21 23:00:49Z Tikitiki $
| * $Id: class_parser.php 4817 2010-03-17 14:09:32Z Huji $
|
*/
/*
| */
/*
|
Zeile 18 | Zeile 18 |
---|
filter_badwords me_username shorten_urls
|
filter_badwords me_username shorten_urls
|
| highlight
|
) */
| ) */
|
Zeile 50 | Zeile 51 |
---|
* @var string */ var $base_url;
|
* @var string */ var $base_url;
|
| /** * Parsed Highlights cache * * @access private * @var array */ var $highlight_cache = array();
|
/** * Options for this parsed message (Private - set by parse_message argument)
| /** * Options for this parsed message (Private - set by parse_message argument)
|
Zeile 58 | Zeile 67 |
---|
* @var array */ var $options;
|
* @var array */ var $options;
|
|
|
/** * Parses a message with the specified options. *
| /** * Parses a message with the specified options. *
|
Zeile 109 | Zeile 118 |
---|
$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);
|
$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']) {
| // If MyCode needs to be replaced, first filter out [code] and [php] tags. if($options['allow_mycode']) {
|
Zeile 138 | Zeile 147 |
---|
}
// Replace MyCode if requested.
|
}
// Replace MyCode if requested.
|
if($options['allow_mycode']) {
| if($options['allow_mycode']) {
|
$message = $this->parse_mycode($message, $options);
|
$message = $this->parse_mycode($message, $options);
|
| } // Parse Highlights if($options['highlight']) { $message = $this->highlight_message($message, $options['highlight']);
|
}
// Run plugin hooks
| }
// Run plugin hooks
|
Zeile 168 | Zeile 183 |
---|
$code = $this->mycode_parse_php($text[2]); } $message = preg_replace("#\<mybb-code>\n?#", $code, $message, 1);
|
$code = $this->mycode_parse_php($text[2]); } $message = preg_replace("#\<mybb-code>\n?#", $code, $message, 1);
|
}
| }
|
} }
| } }
|
Zeile 472 | Zeile 487 |
---|
{ $badword['replacement'] = "*****"; }
|
{ $badword['replacement'] = "*****"; }
|
$badword['badword'] = preg_quote($badword['badword']);
| $badword['badword'] = preg_quote($badword['badword'], "#");
|
$message = preg_replace("#(\b|^)".$badword['badword']."(\b|$)#i", "\\1".$badword['replacement']."\\2", $message); } }
| $message = preg_replace("#(\b|^)".$badword['badword']."(\b|$)#i", "\\1".$badword['replacement']."\\2", $message); } }
|
Zeile 754 | Zeile 769 |
---|
@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);
|
Zeile 788 | Zeile 803 |
---|
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_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) {
| if($added_end_tag) {
|
Zeile 823 | Zeile 838 |
---|
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('&', '&', $url); $name = str_replace('&', '&', $name);
|
$url = str_replace('&', '&', $url); $name = str_replace('&', '&', $name);
|
if(!preg_match("#[a-z0-9]+://#i", $fullurl)) { $fullurl = "http://".$fullurl; }
|
|
if(!$name) { $name = $url;
| if(!$name) { $name = $url;
|
Zeile 851 | Zeile 861 |
---|
} }
|
} }
|
// fix some entities in URLs $fullurl = strtr($fullurl, array('$' => '%24', '^' => '%5E', '`' => '%60', '[' => '%5B', ']' => '%5D', '{' => '%7B', '}' => '%7D', '"' => '%22', '<' => '%3C', '>' => '%3E', ' ' => '%20'));
| // Fix some entities in URLs $entities = array('$' => '%24', '$' => '%24', '^' => '%5E', '`' => '%60', '[' => '%5B', ']' => '%5D', '{' => '%7B', '}' => '%7D', '"' => '%22', '<' => '%3C', '>' => '%3E', ' ' => '%20'); $fullurl = str_replace(array_keys($entities), array_values($entities), $fullurl);
|
$name = preg_replace("#&\#([0-9]+);#si", "&#$1;", $name); // Fix & but allow unicode $link = "<a href=\"$fullurl\" target=\"_blank\">$name</a>"; return $link;
| $name = preg_replace("#&\#([0-9]+);#si", "&#$1;", $name); // Fix & but allow unicode $link = "<a href=\"$fullurl\" target=\"_blank\">$name</a>"; return $link;
|
Zeile 992 | Zeile 1003 |
---|
{ $message = str_replace($this->smilies_cache, array_keys($this->smilies_cache), $message); }
|
{ $message = str_replace($this->smilies_cache, array_keys($this->smilies_cache), $message); }
|
| return $message; } /** * Highlights a string * * @param string The message to be highligted * @param string The highlight keywords * @return string The message with highlight bbcodes */ function highlight_message($message, $highlight) { if(empty($this->highlight_cache)) { $this->highlight_cache = build_highlight_array($highlight); } if(is_array($this->highlight_cache) && !empty($this->highlight_cache)) { $message = preg_replace(array_keys($this->highlight_cache), $this->highlight_cache, $message); }
|
return $message; }
| return $message; }
|