]> git.mxchange.org Git - friendica-addons.git/blobdiff - twitter/twitter.php
Method moved to Plaintext
[friendica-addons.git] / twitter / twitter.php
index 244eaee7d8de6536a53f9157352178fbd0e0c0d4..6402b82d2a508fe748f84d3e0cb93460061cb2f9 100644 (file)
@@ -61,6 +61,8 @@
 
 use Friendica\App;
 use Friendica\Content\OEmbed;
+use Friendica\Content\Text\BBCode;
+use Friendica\Content\Text\Plaintext;
 use Friendica\Core\Addon;
 use Friendica\Core\Config;
 use Friendica\Core\L10n;
@@ -524,12 +526,11 @@ function twitter_post_hook(App $a, &$b)
                $tweet = new TwitterOAuth($ckey, $csecret, $otoken, $osecret);
 
                $max_char = 280;
-               require_once "include/plaintext.php";
-               $msgarr = plaintext($b, $max_char, true, 8);
+               $msgarr = BBCode::toPlaintext($b, $max_char, true, 8);
                $msg = $msgarr["text"];
 
                if (($msg == "") && isset($msgarr["title"])) {
-                       $msg = shortenmsg($msgarr["title"], $max_char - 50);
+                       $msg = Plaintext::shorten($msgarr["title"], $max_char - 50);
                }
 
                $image = "";
@@ -593,12 +594,11 @@ function twitter_post_hook(App $a, &$b)
                if (strlen($msg) && ($image == "")) {
 // -----------------
                        $max_char = 280;
-                       require_once "include/plaintext.php";
-                       $msgarr = plaintext($b, $max_char, true, 8);
+                       $msgarr = BBCode::toPlaintext($b, $max_char, true, 8);
                        $msg = $msgarr["text"];
 
                        if (($msg == "") && isset($msgarr["title"])) {
-                               $msg = shortenmsg($msgarr["title"], $max_char - 50);
+                               $msg = Plaintext::shorten($msgarr["title"], $max_char - 50);
                        }
 
                        if (isset($msgarr["url"])) {
@@ -771,7 +771,6 @@ function twitter_prepare_body(App $a, &$b)
 
        if ($b["preview"]) {
                $max_char = 280;
-               require_once "include/plaintext.php";
                $item = $b["item"];
                $item["plink"] = $a->get_baseurl() . "/display/" . $a->user["nickname"] . "/" . $item["parent"];
 
@@ -791,7 +790,7 @@ function twitter_prepare_body(App $a, &$b)
                        }
                }
 
-               $msgarr = plaintext($item, $max_char, true, 8);
+               $msgarr = BBCode::toPlaintext($item, $max_char, true, 8);
                $msg = $msgarr["text"];
 
                if (isset($msgarr["url"]) && ($msgarr["type"] != "photo")) {