]> git.mxchange.org Git - friendica-addons.git/blobdiff - dwpost/dwpost.php
Rename "fetchUrl" and "fetchUrlFull" to "fetch" and "fetchFull"
[friendica-addons.git] / dwpost / dwpost.php
index 9bcee9c2986cad9bf34c79d25b58f7d8746f294a..9a973b672f2859d633bfca96d42ceb706fc973d8 100644 (file)
@@ -14,8 +14,8 @@ use Friendica\Core\Hook;
 use Friendica\Core\Logger;
 use Friendica\Database\DBA;
 use Friendica\DI;
+use Friendica\Model\Tag;
 use Friendica\Util\DateTimeFormat;
-use Friendica\Util\Network;
 use Friendica\Util\XML;
 
 function dwpost_install()
@@ -191,7 +191,7 @@ function dwpost_send(App $a, array &$b)
                $title = $b['title'];
                $post = BBCode::convert($b['body']);
                $post = XML::escape($post);
-               $tags = dwpost_get_tags($b['tag']);
+               $tags = Tag::getCSVByURIId($b['uri-id'], [Tag::HASHTAG]);
 
                $date = DateTimeFormat::convert($b['created'], $tz);
                $year = intval(substr($date,0,4));
@@ -230,18 +230,9 @@ EOT;
                Logger::log('dwpost: data: ' . $xml, Logger::DATA);
 
                if ($dw_blog !== 'test') {
-                       $x = Network::post($dw_blog, $xml, ["Content-Type: text/xml"])->getBody();
+                       $x = DI::httpRequest()->post($dw_blog, $xml, ["Content-Type: text/xml"])->getBody();
                }
 
                Logger::log('posted to dreamwidth: ' . ($x) ? $x : '', Logger::DEBUG);
        }
 }
-
-function dwpost_get_tags($post)
-{
-       preg_match_all("/\]([^\[#]+)\[/", $post, $matches);
-
-       $tags = implode(', ', $matches[1]);
-
-       return $tags;
-}