From: Michael Vogel Date: Sun, 8 Mar 2015 02:25:32 +0000 (+0100) Subject: Removed the timestamp for parser. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=e2965c9ec5b0ffeea6c21912b20294050069523f;p=friendica.git Removed the timestamp for parser. --- diff --git a/include/bbcode.php b/include/bbcode.php index 1f6a315531..3cf67af692 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -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('
','
'), $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$2', $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", '$1', $Text); $Text = preg_replace("/\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism", '$2', $Text); //$Text = preg_replace("/\[url\=([$URLSearchString]*)\]([$URLSearchString]*)\[\/url\]/ism", '$2', $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", '', $Text); $Text = preg_replace("/\[audio\](.*?\.(ogg|ogv|oga|ogm|webm|mp4|mp3))\[\/audio\]/ism", '', $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\]/", '$1', $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 'https://www.youtube.com/watch?v=$1', $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\]/", '', $Text); - $a->save_timestamp($stamp1, "parser"); - // oembed tag $Text = oembed_bbcode2html($Text); - $stamp1 = microtime(true); - // Avoid triple linefeeds through oembed $Text = str_replace("


", "

", $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); } ?>