]> git.mxchange.org Git - friendica-addons.git/commitdiff
Updated addons for new tag handling
authorMichael <heluecht@pirati.ca>
Tue, 5 May 2020 22:47:43 +0000 (22:47 +0000)
committerMichael <heluecht@pirati.ca>
Tue, 5 May 2020 22:47:43 +0000 (22:47 +0000)
advancedcontentfilter/advancedcontentfilter.php
diaspora/diaspora.php
libertree/libertree.php
tumblr/tumblr.php

index 7ecfda4e43034a3f5283ee03af70587bdac62302..62b18d15a08ad65ad5d1b7941e27c4c0ecdedd0a 100644 (file)
@@ -43,7 +43,7 @@ use Friendica\Database\DBA;
 use Friendica\Database\DBStructure;
 use Friendica\DI;
 use Friendica\Model\Item;
-use Friendica\Model\Term;
+use Friendica\Model\Tag;
 use Friendica\Module\Security\Login;
 use Friendica\Network\HTTPException;
 use Friendica\Util\DateTimeFormat;
@@ -417,7 +417,7 @@ function advancedcontentfilter_get_variables_guid(ServerRequestInterface $reques
                throw new HTTPException\NotFoundException(DI::l10n()->t('Unknown post with guid: %s', $args['guid']));
        }
 
-       $tags = Term::populateTagsFromItem($item);
+       $tags = Tag::populateTagsFromItem($item);
 
        $item['tags'] = $tags['tags'];
        $item['hashtags'] = $tags['hashtags'];
index 96314d883c5ce5d7c3ec5cd3bb055d9b02070c60..380a4df8afac96f60780adb5e263ea159637ed70 100644 (file)
@@ -262,20 +262,6 @@ function diaspora_send(App $a, array &$b)
        if ($handle && $password) {
                Logger::log('diaspora_send: all values seem to be okay', Logger::DEBUG);
 
-               $tag_arr = [];
-               $tags = '';
-               $x = preg_match_all('/\#\[(.*?)\](.*?)\[/',$b['tag'],$matches,PREG_SET_ORDER);
-
-               if ($x) {
-                       foreach ($matches as $mtch) {
-                               $tag_arr[] = $mtch[2];
-                       }
-               }
-
-               if (count($tag_arr)) {
-                       $tags = implode(',',$tag_arr);
-               }
-
                $title = $b['title'];
                $body = $b['body'];
                // Insert a newline before and after a quote
index 7dfd8a36ea41acb0f01523ad2d30e3023ab09006..01a9d9420c6ed3cadd684727cb64008aa5a99a8e 100644 (file)
@@ -211,18 +211,6 @@ function libertree_send(&$a,&$b) {
                $ltree_source .= " (".$b['app'].")";
 
        if($ltree_url && $ltree_api_token && $ltree_blog && $ltree_source) {
-               $tag_arr = [];
-               $tags = '';
-               $x = preg_match_all('/\#\[(.*?)\](.*?)\[/',$b['tag'],$matches,PREG_SET_ORDER);
-
-               if($x) {
-                       foreach($matches as $mtch) {
-                               $tag_arr[] = $mtch[2];
-                       }
-               }
-               if(count($tag_arr))
-                       $tags = implode(',',$tag_arr);
-
                $title = $b['title'];
                $body = $b['body'];
                // Insert a newline before and after a quote
index c0db116e569c34593659263e0148ab4c4d39f1e3..77a9a99fc3a87cc4ea44533a4fe1ea8cbf01f2a0 100644 (file)
@@ -16,6 +16,7 @@ use Friendica\Core\Logger;
 use Friendica\Core\Renderer;
 use Friendica\Database\DBA;
 use Friendica\DI;
+use Friendica\Model\Tag;
 use Friendica\Util\Strings;
 
 function tumblr_install()
@@ -383,14 +384,12 @@ function tumblr_send(App $a, array &$b) {
        $tmbl_blog = 'blog/' . $page . '/post';
 
        if ($oauth_token && $oauth_token_secret && $tmbl_blog) {
+               $tags = Tag::getByURIId($b['uri-id']);
+
                $tag_arr = [];
-               $tags = '';
-               preg_match_all('/\#\[(.*?)\](.*?)\[/', $b['tag'], $matches, PREG_SET_ORDER);
 
-               if (!empty($matches)) {
-                       foreach($matches as $mtch) {
-                               $tag_arr[] = $mtch[2];
-                       }
+               foreach($tags as $tag) {
+                       $tag_arr[] = $tag['name'];
                }
 
                if (count($tag_arr)) {