Removed the timestamp for parser.
This commit is contained in:
parent
b080eddf8d
commit
e2965c9ec5
1 changed files with 0 additions and 33 deletions
|
@ -787,8 +787,6 @@ function bb_CleanPictureLinks($text) {
|
|||
|
||||
function bbcode($Text,$preserve_nl = false, $tryoembed = true, $simplehtml = false, $forplaintext = false) {
|
||||
|
||||
$stamp1 = microtime(true);
|
||||
|
||||
$a = get_app();
|
||||
|
||||
// Hide all [noparse] contained bbtags by spacefying them
|
||||
|
@ -860,13 +858,9 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true, $simplehtml = fal
|
|||
} while ($oldtext != $Text);
|
||||
}
|
||||
|
||||
$a->save_timestamp($stamp1, "parser");
|
||||
|
||||
// Handle attached links or videos
|
||||
$Text = bb_attachment($Text, ($simplehtml != 4) AND ($simplehtml != 0), $tryoembed);
|
||||
|
||||
$stamp1 = microtime(true);
|
||||
|
||||
$Text = str_replace(array("\r","\n"), array('<br />','<br />'), $Text);
|
||||
|
||||
if($preserve_nl)
|
||||
|
@ -896,14 +890,10 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true, $simplehtml = fal
|
|||
if ($simplehtml == 5)
|
||||
$Text = preg_replace("/[^#@]\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism", '[url]$1[/url]', $Text);
|
||||
|
||||
$a->save_timestamp($stamp1, "parser");
|
||||
|
||||
// Perform URL Search
|
||||
if ($tryoembed)
|
||||
$Text = preg_replace_callback("/\[bookmark\=([^\]]*)\](.*?)\[\/bookmark\]/ism",'tryoembed',$Text);
|
||||
|
||||
$stamp1 = microtime(true);
|
||||
|
||||
if ($simplehtml == 5)
|
||||
$Text = preg_replace("/\[bookmark\=([^\]]*)\](.*?)\[\/bookmark\]/ism",'[url]$1[/url]',$Text);
|
||||
else
|
||||
|
@ -912,8 +902,6 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true, $simplehtml = fal
|
|||
// Handle Diaspora posts
|
||||
$Text = preg_replace_callback("&\[url=/posts/([^\[\]]*)\](.*)\[\/url\]&Usi", 'bb_DiasporaLinks', $Text);
|
||||
|
||||
$a->save_timestamp($stamp1, "parser");
|
||||
|
||||
// if the HTML is used to generate plain text, then don't do this search, but replace all URL of that kind to text
|
||||
if (!$forplaintext)
|
||||
$Text = preg_replace("/([^\]\='".'"'."]|^)(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,]+)/ism", '$1<a href="$2" target="_blank">$2</a>', $Text);
|
||||
|
@ -925,8 +913,6 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true, $simplehtml = fal
|
|||
if ($tryoembed)
|
||||
$Text = preg_replace_callback("/\[url\]([$URLSearchString]*)\[\/url\]/ism",'tryoembed',$Text);
|
||||
|
||||
$stamp1 = microtime(true);
|
||||
|
||||
$Text = preg_replace("/\[url\]([$URLSearchString]*)\[\/url\]/ism", '<a href="$1" target="_blank">$1</a>', $Text);
|
||||
$Text = preg_replace("/\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism", '<a href="$1" target="_blank">$2</a>', $Text);
|
||||
//$Text = preg_replace("/\[url\=([$URLSearchString]*)\]([$URLSearchString]*)\[\/url\]/ism", '<a href="$1" target="_blank">$2</a>', $Text);
|
||||
|
@ -1098,13 +1084,8 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true, $simplehtml = fal
|
|||
$Text = preg_replace("/\[video\](.*?\.(ogg|ogv|oga|ogm|webm|mp4))\[\/video\]/ism", '<video src="$1" controls="controls" width="' . $a->videowidth . '" height="' . $a->videoheight . '"><a href="$1">$1</a></video>', $Text);
|
||||
$Text = preg_replace("/\[audio\](.*?\.(ogg|ogv|oga|ogm|webm|mp4|mp3))\[\/audio\]/ism", '<audio src="$1" controls="controls"><a href="$1">$1</a></audio>', $Text);
|
||||
|
||||
$a->save_timestamp($stamp1, "parser");
|
||||
|
||||
$Text = preg_replace_callback("/\[video\](.*?)\[\/video\]/ism", 'tryoembed', $Text);
|
||||
$Text = preg_replace_callback("/\[audio\](.*?)\[\/audio\]/ism", 'tryoembed', $Text);
|
||||
|
||||
$stamp1 = microtime(true);
|
||||
|
||||
} else {
|
||||
$Text = preg_replace("/\[video\](.*?)\[\/video\]/",
|
||||
'<a href="$1" target="_blank">$1</a>', $Text);
|
||||
|
@ -1122,13 +1103,9 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true, $simplehtml = fal
|
|||
|
||||
// Youtube extensions
|
||||
if ($tryoembed) {
|
||||
$a->save_timestamp($stamp1, "parser");
|
||||
|
||||
$Text = preg_replace_callback("/\[youtube\](https?:\/\/www.youtube.com\/watch\?v\=.*?)\[\/youtube\]/ism", 'tryoembed', $Text);
|
||||
$Text = preg_replace_callback("/\[youtube\](www.youtube.com\/watch\?v\=.*?)\[\/youtube\]/ism", 'tryoembed', $Text);
|
||||
$Text = preg_replace_callback("/\[youtube\](https?:\/\/youtu.be\/.*?)\[\/youtube\]/ism",'tryoembed',$Text);
|
||||
|
||||
$stamp1 = microtime(true);
|
||||
}
|
||||
|
||||
$Text = preg_replace("/\[youtube\]https?:\/\/www.youtube.com\/watch\?v\=(.*?)\[\/youtube\]/ism",'[youtube]$1[/youtube]',$Text);
|
||||
|
@ -1142,12 +1119,8 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true, $simplehtml = fal
|
|||
'<a href="https://www.youtube.com/watch?v=$1" target="_blank">https://www.youtube.com/watch?v=$1</a>', $Text);
|
||||
|
||||
if ($tryoembed) {
|
||||
$a->save_timestamp($stamp1, "parser");
|
||||
|
||||
$Text = preg_replace_callback("/\[vimeo\](https?:\/\/player.vimeo.com\/video\/[0-9]+).*?\[\/vimeo\]/ism",'tryoembed',$Text);
|
||||
$Text = preg_replace_callback("/\[vimeo\](https?:\/\/vimeo.com\/[0-9]+).*?\[\/vimeo\]/ism",'tryoembed',$Text);
|
||||
|
||||
$stamp1 = microtime(true);
|
||||
}
|
||||
|
||||
$Text = preg_replace("/\[vimeo\]https?:\/\/player.vimeo.com\/video\/([0-9]+)(.*?)\[\/vimeo\]/ism",'[vimeo]$1[/vimeo]',$Text);
|
||||
|
@ -1161,13 +1134,9 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true, $simplehtml = fal
|
|||
|
||||
// $Text = preg_replace("/\[youtube\](.*?)\[\/youtube\]/", '<object width="425" height="350" type="application/x-shockwave-flash" data="http://www.youtube.com/v/$1" ><param name="movie" value="http://www.youtube.com/v/$1"></param><!--[if IE]><embed src="http://www.youtube.com/v/$1" type="application/x-shockwave-flash" width="425" height="350" /><![endif]--></object>', $Text);
|
||||
|
||||
$a->save_timestamp($stamp1, "parser");
|
||||
|
||||
// oembed tag
|
||||
$Text = oembed_bbcode2html($Text);
|
||||
|
||||
$stamp1 = microtime(true);
|
||||
|
||||
// Avoid triple linefeeds through oembed
|
||||
$Text = str_replace("<br style='clear:left'></span><br /><br />", "<br style='clear:left'></span><br />", $Text);
|
||||
|
||||
|
@ -1236,8 +1205,6 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true, $simplehtml = fal
|
|||
|
||||
call_hooks('bbcode',$Text);
|
||||
|
||||
$a->save_timestamp($stamp1, "parser");
|
||||
|
||||
return trim($Text);
|
||||
}
|
||||
?>
|
||||
|
|
Loading…
Reference in a new issue