Zeile 165 | Zeile 165 |
---|
$replace = array("\n", "\n"); $message = str_replace($find, $replace, $message); }
|
$replace = array("\n", "\n"); $message = str_replace($find, $replace, $message); }
|
| $message = $plugins->run_hooks("parse_message_htmlsanitized", $message);
|
// Replace "me" code and slaps if we have a username if(!empty($this->options['me_username']) && $mybb->settings['allowmemycode'] == 1)
|
// Replace "me" code and slaps if we have a username if(!empty($this->options['me_username']) && $mybb->settings['allowmemycode'] == 1)
|
{
| {
|
global $lang;
|
global $lang;
|
|
|
$message = preg_replace('#(>|^|\r|\n)/me ([^\r\n<]*)#i', "\\1<span style=\"color: red;\" class=\"mycode_me\">* {$this->options['me_username']} \\2</span>", $message); $message = preg_replace('#(>|^|\r|\n)/slap ([^\r\n<]*)#i', "\\1<span style=\"color: red;\" class=\"mycode_slap\">* {$this->options['me_username']} {$lang->slaps} \\2 {$lang->with_trout}</span>", $message);
|
$message = preg_replace('#(>|^|\r|\n)/me ([^\r\n<]*)#i', "\\1<span style=\"color: red;\" class=\"mycode_me\">* {$this->options['me_username']} \\2</span>", $message); $message = preg_replace('#(>|^|\r|\n)/slap ([^\r\n<]*)#i', "\\1<span style=\"color: red;\" class=\"mycode_slap\">* {$this->options['me_username']} {$lang->slaps} \\2 {$lang->with_trout}</span>", $message);
|
}
| }
$message = $plugins->run_hooks("parse_message_me_mycode", $message);
|
// If we can, parse smilies if(!empty($this->options['allow_smilies']))
| // If we can, parse smilies if(!empty($this->options['allow_smilies']))
|
Zeile 185 | Zeile 189 |
---|
if(!empty($this->options['allow_mycode'])) { $message = $this->parse_mycode($message);
|
if(!empty($this->options['allow_mycode'])) { $message = $this->parse_mycode($message);
|
}
| }
|
// Parse Highlights if(!empty($this->options['highlight']))
| // Parse Highlights if(!empty($this->options['highlight']))
|
Zeile 204 | Zeile 208 |
---|
foreach($code_matches as $text) { if(my_strtolower($text[1]) == "code")
|
foreach($code_matches as $text) { if(my_strtolower($text[1]) == "code")
|
{
| {
|
// Fix up HTML inside the code tags so it is clean $text[2] = $this->parse_html($text[2]);
| // Fix up HTML inside the code tags so it is clean $text[2] = $this->parse_html($text[2]);
|
Zeile 263 | Zeile 267 |
---|
$standard_mycode = $callback_mycode = $nestable_mycode = array(); $standard_count = $callback_count = $nestable_count = 0;
|
$standard_mycode = $callback_mycode = $nestable_mycode = array(); $standard_count = $callback_count = $nestable_count = 0;
|
|
|
if($mybb->settings['allowbasicmycode'] == 1) { $standard_mycode['b']['regex'] = "#\[b\](.*?)\[/b\]#si";
| if($mybb->settings['allowbasicmycode'] == 1) { $standard_mycode['b']['regex'] = "#\[b\](.*?)\[/b\]#si";
|
Zeile 271 | Zeile 275 |
---|
$standard_mycode['u']['regex'] = "#\[u\](.*?)\[/u\]#si"; $standard_mycode['u']['replacement'] = "<span style=\"text-decoration: underline;\" class=\"mycode_u\">$1</span>";
|
$standard_mycode['u']['regex'] = "#\[u\](.*?)\[/u\]#si"; $standard_mycode['u']['replacement'] = "<span style=\"text-decoration: underline;\" class=\"mycode_u\">$1</span>";
|
|
|
$standard_mycode['i']['regex'] = "#\[i\](.*?)\[/i\]#si"; $standard_mycode['i']['replacement'] = "<span style=\"font-style: italic;\" class=\"mycode_i\">$1</span>";
$standard_mycode['s']['regex'] = "#\[s\](.*?)\[/s\]#si"; $standard_mycode['s']['replacement'] = "<span style=\"text-decoration: line-through;\" class=\"mycode_s\">$1</span>";
|
$standard_mycode['i']['regex'] = "#\[i\](.*?)\[/i\]#si"; $standard_mycode['i']['replacement'] = "<span style=\"font-style: italic;\" class=\"mycode_i\">$1</span>";
$standard_mycode['s']['regex'] = "#\[s\](.*?)\[/s\]#si"; $standard_mycode['s']['replacement'] = "<span style=\"text-decoration: line-through;\" class=\"mycode_s\">$1</span>";
|
|
|
$standard_mycode['hr']['regex'] = "#\[hr\]#si"; $standard_mycode['hr']['replacement'] = "<hr class=\"mycode_hr\" />";
|
$standard_mycode['hr']['regex'] = "#\[hr\]#si"; $standard_mycode['hr']['replacement'] = "<hr class=\"mycode_hr\" />";
|
++$standard_count; }
| ++$standard_count; }
|
if($mybb->settings['allowsymbolmycode'] == 1) { $standard_mycode['copy']['regex'] = "#\(c\)#i"; $standard_mycode['copy']['replacement'] = "©";
|
if($mybb->settings['allowsymbolmycode'] == 1) { $standard_mycode['copy']['regex'] = "#\(c\)#i"; $standard_mycode['copy']['replacement'] = "©";
|
|
|
$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 302 | Zeile 306 |
---|
{ $callback_mycode['url_simple']['regex'] = "#\[url\]((?!javascript)[a-z]+?://)([^\r\n\"<]+?)\[/url\]#si"; $callback_mycode['url_simple']['replacement'] = array($this, 'mycode_parse_url_callback1');
|
{ $callback_mycode['url_simple']['regex'] = "#\[url\]((?!javascript)[a-z]+?://)([^\r\n\"<]+?)\[/url\]#si"; $callback_mycode['url_simple']['replacement'] = array($this, 'mycode_parse_url_callback1');
|
|
|
$callback_mycode['url_simple2']['regex'] = "#\[url\]((?!javascript:)[^\r\n\"<]+?)\[/url\]#i"; $callback_mycode['url_simple2']['replacement'] = array($this, 'mycode_parse_url_callback2');
$callback_mycode['url_complex']['regex'] = "#\[url=((?!javascript)[a-z]+?://)([^\r\n\"<]+?)\](.+?)\[/url\]#si"; $callback_mycode['url_complex']['replacement'] = array($this, 'mycode_parse_url_callback1');
|
$callback_mycode['url_simple2']['regex'] = "#\[url\]((?!javascript:)[^\r\n\"<]+?)\[/url\]#i"; $callback_mycode['url_simple2']['replacement'] = array($this, 'mycode_parse_url_callback2');
$callback_mycode['url_complex']['regex'] = "#\[url=((?!javascript)[a-z]+?://)([^\r\n\"<]+?)\](.+?)\[/url\]#si"; $callback_mycode['url_complex']['replacement'] = array($this, 'mycode_parse_url_callback1');
|
|
|
$callback_mycode['url_complex2']['regex'] = "#\[url=((?!javascript:)[^\r\n\"<]+?)\](.+?)\[/url\]#si"; $callback_mycode['url_complex2']['replacement'] = array($this, 'mycode_parse_url_callback2');
| $callback_mycode['url_complex2']['regex'] = "#\[url=((?!javascript:)[^\r\n\"<]+?)\](.+?)\[/url\]#si"; $callback_mycode['url_complex2']['replacement'] = array($this, 'mycode_parse_url_callback2');
|
Zeile 317 | Zeile 321 |
---|
if($mybb->settings['allowemailmycode'] == 1) {
|
if($mybb->settings['allowemailmycode'] == 1) {
|
$callback_mycode['email_simple']['regex'] = "#\[email\](.*?)\[/email\]#i";
| $callback_mycode['email_simple']['regex'] = "#\[email\]((?:[a-zA-Z0-9-_\+\.]+?)@[a-zA-Z0-9-]+\.[a-zA-Z0-9\.-]+(?:\?.*?)?)\[/email\]#i";
|
$callback_mycode['email_simple']['replacement'] = array($this, 'mycode_parse_email_callback');
|
$callback_mycode['email_simple']['replacement'] = array($this, 'mycode_parse_email_callback');
|
$callback_mycode['email_complex']['regex'] = "#\[email=(.*?)\](.*?)\[/email\]#i";
| $callback_mycode['email_complex']['regex'] = "#\[email=((?:[a-zA-Z0-9-_\+\.]+?)@[a-zA-Z0-9-]+\.[a-zA-Z0-9\.-]+(?:\?.*?)?)\](.*?)\[/email\]#i";
|
$callback_mycode['email_complex']['replacement'] = array($this, 'mycode_parse_email_callback');
|
$callback_mycode['email_complex']['replacement'] = array($this, 'mycode_parse_email_callback');
|
++$callback_count;
| ++$callback_count;
|
}
if($mybb->settings['allowcolormycode'] == 1)
| }
if($mybb->settings['allowcolormycode'] == 1)
|
Zeile 360 | Zeile 364 |
---|
$nestable_mycode['align']['replacement'] = "<div style=\"text-align: $1;\" class=\"mycode_align\">$2</div>";
++$nestable_count;
|
$nestable_mycode['align']['replacement'] = "<div style=\"text-align: $1;\" class=\"mycode_align\">$2</div>";
++$nestable_count;
|
}
$custom_mycode = $cache->read("mycode");
| }
$custom_mycode = $cache->read("mycode");
|
// If there is custom MyCode, load it. if(is_array($custom_mycode))
| // If there is custom MyCode, load it. if(is_array($custom_mycode))
|
Zeile 429 | Zeile 433 |
---|
// Parse quotes first $message = $this->mycode_parse_quotes($message);
|
// Parse quotes first $message = $this->mycode_parse_quotes($message);
|
| // Convert images when allowed. if(!empty($this->options['allow_imgcode'])) { $message = preg_replace_callback("#\[img\](\r\n?|\n?)(https?://([^<>\"']+?))\[/img\]#is", array($this, 'mycode_parse_img_callback1'), $message); $message = preg_replace_callback("#\[img=([1-9][0-9]*)x([1-9][0-9]*)\](\r\n?|\n?)(https?://([^<>\"']+?))\[/img\]#is", array($this, 'mycode_parse_img_callback2'), $message); $message = preg_replace_callback("#\[img align=(left|right)\](\r\n?|\n?)(https?://([^<>\"']+?))\[/img\]#is", array($this, 'mycode_parse_img_callback3'), $message); $message = preg_replace_callback("#\[img=([1-9][0-9]*)x([1-9][0-9]*) align=(left|right)\](\r\n?|\n?)(https?://([^<>\"']+?))\[/img\]#is", array($this, 'mycode_parse_img_callback4'), $message); } else { $message = preg_replace_callback("#\[img\](\r\n?|\n?)(https?://([^<>\"']+?))\[/img\]#is", array($this, 'mycode_parse_img_disabled_callback1'), $message); $message = preg_replace_callback("#\[img=([1-9][0-9]*)x([1-9][0-9]*)\](\r\n?|\n?)(https?://([^<>\"']+?))\[/img\]#is", array($this, 'mycode_parse_img_disabled_callback2'), $message); $message = preg_replace_callback("#\[img align=(left|right)\](\r\n?|\n?)(https?://([^<>\"']+?))\[/img\]#is", array($this, 'mycode_parse_img_disabled_callback3'), $message); $message = preg_replace_callback("#\[img=([1-9][0-9]*)x([1-9][0-9]*) align=(left|right)\](\r\n?|\n?)(https?://([^<>\"']+?))\[/img\]#is", array($this, 'mycode_parse_img_disabled_callback4'), $message); }
|
$message = $this->mycode_auto_url($message);
| $message = $this->mycode_auto_url($message);
|
Zeile 474 | Zeile 494 |
---|
{ // Ignores missing end tags $message = preg_replace_callback("#\s?\[list(=(a|A|i|I|1))?&{$i}\](.*?)(\[/list&{$i}\]|$)(\r\n?|\n?)#si", array($this, 'mycode_parse_list_callback'), $message, 1);
|
{ // Ignores missing end tags $message = preg_replace_callback("#\s?\[list(=(a|A|i|I|1))?&{$i}\](.*?)(\[/list&{$i}\]|$)(\r\n?|\n?)#si", array($this, 'mycode_parse_list_callback'), $message, 1);
|
} }
// Convert images when allowed. if(!empty($this->options['allow_imgcode'])) { $message = preg_replace_callback("#\[img\](\r\n?|\n?)(https?://([^<>\"']+?))\[/img\]#is", array($this, 'mycode_parse_img_callback1'), $message); $message = preg_replace_callback("#\[img=([1-9][0-9]*)x([1-9][0-9]*)\](\r\n?|\n?)(https?://([^<>\"']+?))\[/img\]#is", array($this, 'mycode_parse_img_callback2'), $message); $message = preg_replace_callback("#\[img align=(left|right)\](\r\n?|\n?)(https?://([^<>\"']+?))\[/img\]#is", array($this, 'mycode_parse_img_callback3'), $message); $message = preg_replace_callback("#\[img=([1-9][0-9]*)x([1-9][0-9]*) align=(left|right)\](\r\n?|\n?)(https?://([^<>\"']+?))\[/img\]#is", array($this, 'mycode_parse_img_callback4'), $message); } else { $message = preg_replace_callback("#\[img\](\r\n?|\n?)(https?://([^<>\"']+?))\[/img\]#is", array($this, 'mycode_parse_img_disabled_callback1'), $message); $message = preg_replace_callback("#\[img=([1-9][0-9]*)x([1-9][0-9]*)\](\r\n?|\n?)(https?://([^<>\"']+?))\[/img\]#is", array($this, 'mycode_parse_img_disabled_callback2'), $message); $message = preg_replace_callback("#\[img align=(left|right)\](\r\n?|\n?)(https?://([^<>\"']+?))\[/img\]#is", array($this, 'mycode_parse_img_disabled_callback3'), $message); $message = preg_replace_callback("#\[img=([1-9][0-9]*)x([1-9][0-9]*) align=(left|right)\](\r\n?|\n?)(https?://([^<>\"']+?))\[/img\]#is", array($this, 'mycode_parse_img_disabled_callback4'), $message); }
| } }
|
// Convert videos when allow. if(!empty($this->options['allow_videocode'])) { $message = preg_replace_callback("#\[video=(.*?)\](.*?)\[/video\]#i", array($this, 'mycode_parse_video_callback'), $message);
|
// Convert videos when allow. if(!empty($this->options['allow_videocode'])) { $message = preg_replace_callback("#\[video=(.*?)\](.*?)\[/video\]#i", array($this, 'mycode_parse_video_callback'), $message);
|
}
| }
|
else { $message = preg_replace_callback("#\[video=(.*?)\](.*?)\[/video\]#i", array($this, 'mycode_parse_video_disabled_callback'), $message);
| else { $message = preg_replace_callback("#\[video=(.*?)\](.*?)\[/video\]#i", array($this, 'mycode_parse_video_disabled_callback'), $message);
|
Zeile 508 | Zeile 512 |
---|
/** * Generates a cache of smilies
|
/** * Generates a cache of smilies
|
*
| *
|
* @access private */ function cache_smilies()
| * @access private */ function cache_smilies()
|
Zeile 526 | Zeile 530 |
---|
$smilie['image'] = str_replace("{theme}", $theme['imgdir'], $smilie['image']); $smilie['image'] = htmlspecialchars_uni($mybb->get_asset_url($smilie['image'])); $smilie['name'] = htmlspecialchars_uni($smilie['name']);
|
$smilie['image'] = str_replace("{theme}", $theme['imgdir'], $smilie['image']); $smilie['image'] = htmlspecialchars_uni($mybb->get_asset_url($smilie['image'])); $smilie['name'] = htmlspecialchars_uni($smilie['name']);
|
|
|
foreach($smilie['find'] as $s) { $s = $this->parse_html($s);
| foreach($smilie['find'] as $s) { $s = $this->parse_html($s);
|
Zeile 541 | Zeile 545 |
---|
">$s" => ">$s", ); }
|
">$s" => ">$s", ); }
|
} } } }
| } } } }
|
/** * Parses smilie code in the specified message.
| /** * Parses smilie code in the specified message.
|
Zeile 562 | Zeile 566 |
---|
// No smilies? if(!count($this->smilies_cache))
|
// No smilies? if(!count($this->smilies_cache))
|
{
| {
|
return $message; }
| return $message; }
|
Zeile 615 | Zeile 619 |
---|
if(empty($this->options)) { $this->options = $options;
|
if(empty($this->options)) { $this->options = $options;
|
}
| }
|
if($this->badwords_cache == 0) { $this->cache_badwords();
| if($this->badwords_cache == 0) { $this->cache_badwords();
|
Zeile 630 | Zeile 634 |
---|
{ $badword['replacement'] = "*****"; }
|
{ $badword['replacement'] = "*****"; }
|
|
|
// Take into account the position offset for our last replacement.
|
// Take into account the position offset for our last replacement.
|
$index = substr_count($badword['badword'], '*')+2;
| |
$badword['badword'] = str_replace('\*', '([a-zA-Z0-9_]{1})', preg_quote($badword['badword'], "#"));
// Ensure we run the replacement enough times but not recursively (i.e. not while(preg_match..))
|
$badword['badword'] = str_replace('\*', '([a-zA-Z0-9_]{1})', preg_quote($badword['badword'], "#"));
// Ensure we run the replacement enough times but not recursively (i.e. not while(preg_match..))
|
$count = preg_match_all("#(^|\W)".$badword['badword']."(\W|$)#i", $message, $matches); for($i=0; $i < $count; ++$i) { $message = preg_replace("#(^|\W)".$badword['badword']."(\W|$)#i", "\\1".$badword['replacement'].'\\'.$index, $message); }
| $message = preg_replace("#(^|\W)".$badword['badword']."(?=\W|$)#i", '\1'.$badword['replacement'], $message);
|
}
|
}
|
}
| }
|
if(!empty($this->options['strip_tags'])) { $message = strip_tags($message); }
|
if(!empty($this->options['strip_tags'])) { $message = strip_tags($message); }
|
return $message;
| return $message;
|
}
|
}
|
|
|
/** * Resolves nested CDATA tags in the specified message. *
| /** * Resolves nested CDATA tags in the specified message. *
|
Zeile 659 | Zeile 658 |
---|
function parse_cdata($message) { $message = str_replace(']]>', ']]]]><![CDATA[>', $message);
|
function parse_cdata($message) { $message = str_replace(']]>', ']]]]><![CDATA[>', $message);
|
return $message;
| return $message;
|
}
/**
| }
/**
|
Zeile 675 | Zeile 674 |
---|
"#(&\#(0*)106;?|&\#(0*)74;?|&\#x(0*)4a;?|&\#x(0*)6a;?|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", "#([\s\"']on)([a-z]+\s*=)#i", );
|
"#(&\#(0*)106;?|&\#(0*)74;?|&\#x(0*)4a;?|&\#x(0*)6a;?|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", "#([\s\"']on)([a-z]+\s*=)#i", );
|
|
|
// Add invisible white space $message = preg_replace($js_array, "$1\xE2\x80\x8C$2$6", $message);
|
// Add invisible white space $message = preg_replace($js_array, "$1\xE2\x80\x8C$2$6", $message);
|
return $message;
| return $message;
|
}
/**
| }
/**
|
Zeile 698 | Zeile 697 |
---|
if($size < 1) { $size = 1;
|
if($size < 1) { $size = 1;
|
}
| }
|
if($size > 50) {
| if($size > 50) {
|
Zeile 735 | Zeile 734 |
---|
// Assign pattern and replace values. $pattern = "#\[quote\](.*?)\[\/quote\](\r\n?|\n?)#si";
|
// Assign pattern and replace values. $pattern = "#\[quote\](.*?)\[\/quote\](\r\n?|\n?)#si";
|
$pattern_callback = "#\[quote=([\"']|"|)(.*?)(?:\\1)(.*?)(?:[\"']|")?\](.*?)\[/quote\](\r\n?|\n?)#si";
if($text_only == false)
| $pattern_callback = "#\[quote=([\"']|"|)(.*?)(?:\\1)(.*?)(?:[\"']|")?\](.*?)\[/quote\](\r\n?|\n?)#si";
if($text_only == false)
|
{ $replace = "<blockquote class=\"mycode_quote\"><cite>$lang->quote</cite>$1</blockquote>\n"; $replace_callback = array($this, 'mycode_parse_post_quotes_callback1');
| { $replace = "<blockquote class=\"mycode_quote\"><cite>$lang->quote</cite>$1</blockquote>\n"; $replace_callback = array($this, 'mycode_parse_post_quotes_callback1');
|
Zeile 795 | Zeile 794 |
---|
$message = preg_replace("#(^<br(\s?)(\/?)>|<br(\s?)(\/?)>$)#i", "", $message);
if(!$message)
|
$message = preg_replace("#(^<br(\s?)(\/?)>|<br(\s?)(\/?)>$)#i", "", $message);
if(!$message)
|
{
| {
|
return ''; }
| return ''; }
|
Zeile 803 | Zeile 802 |
---|
$delete_quote = true;
preg_match("#pid=(?:"|\"|')?([0-9]+)[\"']?(?:"|\"|')?#i", $username, $match);
|
$delete_quote = true;
preg_match("#pid=(?:"|\"|')?([0-9]+)[\"']?(?:"|\"|')?#i", $username, $match);
|
if((int)$match[1])
| if((int)$match[1])
|
{ $pid = (int)$match[1]; $url = $mybb->settings['bburl']."/".get_post_link($pid)."#pid$pid"; if(defined("IN_ARCHIVE")) { $linkback = " <a href=\"{$url}\">[ -> ]</a>";
|
{ $pid = (int)$match[1]; $url = $mybb->settings['bburl']."/".get_post_link($pid)."#pid$pid"; if(defined("IN_ARCHIVE")) { $linkback = " <a href=\"{$url}\">[ -> ]</a>";
|
}
| }
|
else { eval("\$linkback = \" ".$templates->get("postbit_gotopost", 1, 0)."\";");
| else { eval("\$linkback = \" ".$templates->get("postbit_gotopost", 1, 0)."\";");
|
Zeile 826 | Zeile 825 |
---|
{ if($match[1] < TIME_NOW) {
|
{ if($match[1] < TIME_NOW) {
|
$postdate = my_date('relative', (int)$match[1]);
| if($text_only) { $postdate = my_date('normal', (int)$match[1]); } else { $postdate = my_date('relative', (int)$match[1]); }
|
$date = " ({$postdate})"; } $username = preg_replace("#(?:"|\"|')? dateline=(?:"|\"|')?[0-9]+(?:"|\"|')?#i", '', $username);
| $date = " ({$postdate})"; } $username = preg_replace("#(?:"|\"|')? dateline=(?:"|\"|')?[0-9]+(?:"|\"|')?#i", '', $username);
|
Zeile 1055 | Zeile 1061 |
---|
$name = htmlspecialchars_uni($name); }
|
$name = htmlspecialchars_uni($name); }
|
$nofollow = '';
| |
if(!empty($this->options['nofollow_on'])) {
|
if(!empty($this->options['nofollow_on'])) {
|
$nofollow = " rel=\"nofollow\"";
| $rel = " rel=\"noopener nofollow\"";
|
}
|
}
|
| else { $rel = " rel=\"noopener\""; }
|
// Fix some entities in URLs $entities = array('$' => '%24', '$' => '%24', '^' => '%5E', '`' => '%60', '[' => '%5B', ']' => '%5D', '{' => '%7B', '}' => '%7D', '"' => '%22', '<' => '%3C', '>' => '%3E', ' ' => '%20'); $url = str_replace(array_keys($entities), array_values($entities), $url);
$name = preg_replace("#&\#([0-9]+);#si", "&#$1;", $name); // Fix & but allow unicode
|
// Fix some entities in URLs $entities = array('$' => '%24', '$' => '%24', '^' => '%5E', '`' => '%60', '[' => '%5B', ']' => '%5D', '{' => '%7B', '}' => '%7D', '"' => '%22', '<' => '%3C', '>' => '%3E', ' ' => '%20'); $url = str_replace(array_keys($entities), array_values($entities), $url);
$name = preg_replace("#&\#([0-9]+);#si", "&#$1;", $name); // Fix & but allow unicode
|
|
|
eval("\$mycode_url = \"".$templates->get("mycode_url", 1, 0)."\";"); return $mycode_url;
|
eval("\$mycode_url = \"".$templates->get("mycode_url", 1, 0)."\";"); return $mycode_url;
|
}
/** * Parses URL MyCode.
| }
/** * Parses URL MyCode.
|
* * @param array $matches Matches. * @return string The built-up link.
| * * @param array $matches Matches. * @return string The built-up link.
|
Zeile 1084 | Zeile 1093 |
---|
$matches[3] = ''; } return $this->mycode_parse_url($matches[1].$matches[2], $matches[3]);
|
$matches[3] = ''; } return $this->mycode_parse_url($matches[1].$matches[2], $matches[3]);
|
}
| }
|
/** * Parses URL MyCode. *
| /** * Parses URL MyCode. *
|
Zeile 1110 | Zeile 1119 |
---|
* @return string */ function mycode_parse_img($url, $dimensions=array(), $align='')
|
* @return string */ function mycode_parse_img($url, $dimensions=array(), $align='')
|
{
| {
|
global $lang, $templates; $url = trim($url); $url = str_replace("\n", "", $url);
| global $lang, $templates; $url = trim($url); $url = str_replace("\n", "", $url);
|
Zeile 1422 | Zeile 1431 |
---|
} break; case "twitch":
|
} break; case "twitch":
|
if(isset($path[3]))
| if(count($path) >= 3 && $path[1] == 'videos') { // Direct video embed with URL like: https://www.twitch.tv/videos/179723472 $id = 'video=v'.$path[2]; } elseif(count($path) >= 4 && $path[2] == 'v') { // Direct video embed with URL like: https://www.twitch.tv/waypoint/v/179723472 $id = 'video=v'.$path[3]; } elseif(count($path) >= 2)
|
{
|
{
|
$id = $path[3]; // https://www.twitch.tv/giantbomb/v/100048090
| // Channel (livestream) embed with URL like: https://twitch.tv/waypoint $id = 'channel='.$path[1];
|
} break; default:
| } break; default:
|
Zeile 1492 | Zeile 1512 |
---|
{ $message = " ".$message; // Links should end with slashes, numbers, characters and braces but not with dots, commas or question marks
|
{ $message = " ".$message; // Links should end with slashes, numbers, characters and braces but not with dots, commas or question marks
|
$message = preg_replace_callback("#([\>\s\(\)])(http|https|ftp|news|irc|ircs|irc6){1}://([^\/\"\s\<\[\.]+\.([^\/\"\s\<\[\.]+\.)*[\w]+(:[0-9]+)?(/([^\"\s<\[]|\[\])*)?([\w\/\)]))#iu", array($this, 'mycode_auto_url_callback'), $message); $message = preg_replace_callback("#([\>\s\(\)])(www|ftp)\.(([^\/\"\s\<\[\.]+\.)*[\w]+(:[0-9]+)?(/([^\"\s<\[]|\[\])*)?([\w\/\)]))#iu", array($this, 'mycode_auto_url_callback'), $message);
| $message = preg_replace_callback("#([\>\s\(\)\[]|(?:\[(?!url)(?:.*?)\]))(http|https|ftp|news|irc|ircs|irc6){1}://([^\/\"\s\<\[\.]+\.([^\/\"\s\<\[\.]+\.)*[\w]+(:[0-9]+)?(/([^\"\s<\[]|\[\])*)?([\w\/\)]))#iu", array($this, 'mycode_auto_url_callback'), $message); $message = preg_replace_callback("#([\>\s\(\)\[]|(?:\[(?!url)(?:.*?)\]))(www|ftp)\.(([^\/\"\s\<\[\.]+\.)*[\w]+(:[0-9]+)?(/([^\"\s<\[]|\[\])*)?([\w\/\)]))#iu", array($this, 'mycode_auto_url_callback'), $message);
|
$message = my_substr($message, 1);
return $message;
| $message = my_substr($message, 1);
return $message;
|
Zeile 1530 | Zeile 1550 |
---|
$last_char = my_substr($matches[3], -1); } }
|
$last_char = my_substr($matches[3], -1); } }
|
if($matches[2] == 'www' || $matches[2] == 'ftp')
| if(in_array(strtolower($matches[2]), array('www', 'ftp')))
|
{ return "{$matches[1]}[url]{$matches[2]}.{$matches[3]}[/url]{$external}"; }
| { return "{$matches[1]}[url]{$matches[2]}.{$matches[3]}[/url]{$external}"; }
|