]> git.mxchange.org Git - friendica-addons.git/commitdiff
[advancedcontentfilter] Add new attachments key in filter
authorHypolite Petovan <hypolite@mrpetovan.com>
Mon, 16 Aug 2021 09:29:17 +0000 (05:29 -0400)
committerHypolite Petovan <hypolite@mrpetovan.com>
Mon, 16 Aug 2021 10:09:40 +0000 (06:09 -0400)
- Follows a change in Model\Item::prepareBody to enable filtering on attachments (images, sounds, videos, downloads...)

advancedcontentfilter/advancedcontentfilter.php

index bd97b309c5e174dffa5821944b2b38f2ca2195e0..f5a341fedc4aa76b34d534e0852ec226bf1713e4 100644 (file)
@@ -282,6 +282,7 @@ function advancedcontentfilter_build_fields($data)
                        'event_created', 'event_edited', 'event_start', 'event_finish', 'event_summary',
                        'event_desc', 'event_location', 'event_type', 'event_nofinish', 'event_adjust', 'event_ignore',
                        'children', 'pagedrop', 'tags', 'hashtags', 'mentions',
+                       'attachments',
                ];
 
                $expressionLanguage = new ExpressionLanguage\ExpressionLanguage();
@@ -437,6 +438,10 @@ function advancedcontentfilter_get_variables_guid(ServerRequestInterface $reques
        $item['hashtags'] = $tags['hashtags'];
        $item['mentions'] = $tags['mentions'];
 
+       $attachments = Post\Media::splitAttachments($item['uri-id'], $item['guid'] ?? '');
+
+       $item['attachments'] = $attachments;
+
        $return = advancedcontentfilter_get_filter_fields($item);
 
        return json_encode(['variables' => str_replace('\\\'', '\'', var_export($return, true))]);