]> git.mxchange.org Git - friendica.git/blobdiff - include/bbcode.php
use local photo for tag notifications if available
[friendica.git] / include / bbcode.php
index 6f22d1970257ac9d0f9d4700640c3f3cb4180aa9..c30908e2d48a18c3eebf31790fd9330ff08d5a28 100644 (file)
@@ -47,6 +47,30 @@ function bb_unspacefy_and_trim($st) {
   return $unspacefied;
 }
 
+function bb_find_open_close($s, $open, $close, $occurance = 1) {
+
+       if($occurance < 1)
+               $occurance = 1;
+
+       $start_pos = -1;
+       for($i = 1; $i <= $occurance; $i++) {
+               if( $start_pos !== false)
+                       $start_pos = strpos($s, $open, $start_pos + 1);
+       }
+
+       if( $start_pos === false)
+               return false;
+
+       $end_pos = strpos($s, $close, $start_pos);
+
+       if( $end_pos === false)
+               return false;
+
+       $res = array( 'start' => $start_pos, 'end' => $end_pos );
+
+       return $res;
+}
+
 function get_bb_tag_pos($s, $name, $occurance = 1) {
 
        if($occurance < 1)