From: Roland Häder Date: Sat, 8 Apr 2017 16:45:59 +0000 (+0200) Subject: Merge branch 'develop' into rewrites/coding-convention-split2-1-2 X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=3d1626781d473330b9d11ddea8e68d7fee237708;p=friendica.git Merge branch 'develop' into rewrites/coding-convention-split2-1-2 --- 3d1626781d473330b9d11ddea8e68d7fee237708 diff --cc include/bbcode.php index eccf32d5b1,fd380edc99..97b1b6c0cc --- a/include/bbcode.php +++ b/include/bbcode.php @@@ -1,20 -1,19 +1,20 @@@ title = $match[2]; + } - if ($o->type=="error") return $match[0]; + if ($o->type == "error") { + return $match[0]; + } $html = oembed_format_object($o); + return $html; - } // [noparse][i]italic[/i][/noparse] turns into @@@ -230,21 -205,18 +222,20 @@@ function bb_unspacefy_and_trim($st) } function bb_find_open_close($s, $open, $close, $occurence = 1) { -- - if ($occurence < 1) { - if($occurence < 1) -- $occurence = 1; - } ++ if ($occurence < 1) { ++ $occurence = 1; ++ } $start_pos = -1; - for($i = 1; $i <= $occurence; $i++) { - if( $start_pos !== false) + for ($i = 1; $i <= $occurence; $i++) { - if ($start_pos !== false) { ++ if ( $start_pos !== false) { $start_pos = strpos($s, $open, $start_pos + 1); + } } - if( $start_pos === false) + if ($start_pos === false) { return false; + } $end_pos = strpos($s, $close, $start_pos); @@@ -258,21 -229,18 +249,20 @@@ } function get_bb_tag_pos($s, $name, $occurence = 1) { -- - if($occurence < 1) + if ($occurence < 1) { $occurence = 1; - } ++ } $start_open = -1; - for($i = 1; $i <= $occurence; $i++) { - if( $start_open !== false) + for ($i = 1; $i <= $occurence; $i++) { - if ($start_open !== false) { ++ if ( $start_open !== false) { $start_open = strpos($s, '[' . $name, $start_open + 1); // allow [name= type tags + } } - if( $start_open === false) + if ( $start_open === false) { return false; + } $start_equal = strpos($s, '=', $start_open); $start_close = strpos($s, ']', $start_open); @@@ -313,8 -269,8 +303,7 @@@ function bb_tag_preg_replace($pattern, $occurence = 1; $pos = get_bb_tag_pos($string, $name, $occurence); - while($pos !== false && $occurence < 1000) { - + while ($pos !== false && $occurence < 1000) { - $start = substr($string, 0, $pos['start']['open']); $subject = substr($string, $pos['start']['open'], $pos['end']['close'] - $pos['start']['open']); $end = substr($string, $pos['end']['close']);