]> git.mxchange.org Git - friendica.git/blobdiff - include/conversation.php
Merge pull request #4462 from MrPetovan/task/3878-move-include-bbcode-to-src
[friendica.git] / include / conversation.php
index f0d6bbfabac76c2aac17c1942d2463170d9e897d..1ff1dbf5f4cdb57ca29d1ee41d4f1ae93b3d68ab 100644 (file)
@@ -6,6 +6,7 @@
 use Friendica\App;
 use Friendica\Content\ContactSelector;
 use Friendica\Content\Feature;
+use Friendica\Content\Text\BBCode;
 use Friendica\Core\Addon;
 use Friendica\Core\Config;
 use Friendica\Core\L10n;
@@ -20,7 +21,6 @@ use Friendica\Util\DateTimeFormat;
 use Friendica\Util\Temporal;
 use Friendica\Util\XML;
 
-require_once "include/bbcode.php";
 require_once "include/acl_selectors.php";
 
 function item_extract_images($body) {
@@ -72,7 +72,7 @@ function item_redir_and_replace_images($body, $images, $cid) {
        $newbody = '';
 
        $cnt = 1;
-       $pos = get_bb_tag_pos($origbody, 'url', 1);
+       $pos = BBCode::getTagPosition($origbody, 'url', 0);
        while ($pos !== false && $cnt < 1000) {
 
                $search = '/\[url\=(.*?)\]\[!#saved_image([0-9]*)#!\]\[\/url\]' . '/is';
@@ -90,7 +90,8 @@ function item_redir_and_replace_images($body, $images, $cid) {
                $newbody .= $subject;
 
                $cnt++;
-               $pos = get_bb_tag_pos($origbody, 'url', 1);
+               // Isn't this supposed to use $cnt value for $occurrences? - @MrPetovan
+               $pos = BBCode::getTagPosition($origbody, 'url', 0);
        }
        $newbody .= $origbody;
 
@@ -347,7 +348,7 @@ function localize_item(&$item) {
        $photo_pattern = "/\[url=(.*?)\/photos\/(.*?)\/image\/(.*?)\]\[img(.*?)\]h(.*?)\[\/img\]\[\/url\]/is";
        if (preg_match($photo_pattern, $item['body'])) {
                $photo_replace = '[url=' . Profile::zrl('$1' . '/photos/' . '$2' . '/image/' . '$3' ,true) . '][img' . '$4' . ']h' . '$5'  . '[/img][/url]';
-               $item['body'] = bb_tag_preg_replace($photo_pattern, $photo_replace, 'url', $item['body']);
+               $item['body'] = BBCode::pregReplaceInTag($photo_pattern, $photo_replace, 'url', $item['body']);
        }
 
        // add sparkle links to appropriate permalinks
@@ -497,7 +498,6 @@ function item_condition() {
  *
  */
 function conversation(App $a, $items, $mode, $update, $preview = false) {
-       require_once 'include/bbcode.php';
        require_once 'mod/proxy.php';
 
        $ssl_state = ((local_user()) ? true : false);
@@ -908,6 +908,7 @@ function community_add_items($parents) {
        foreach ($parents AS $parent) {
                $thread_items = dba::p(item_query()." AND `item`.`uid` = ?
                        AND `item`.`parent-uri` = ?
+                       AND NOT `author`.`hidden` AND NOT `author`.`blocked`
                        ORDER BY `item`.`commented` DESC LIMIT ".intval($max_comments + 1),
                        local_user(),
                        $parent['uri']