Merge pull request #503 from zeroadam/feature/NowPlaintext

Method moved to Plaintext
This commit is contained in:
Hypolite Petovan 2018-01-26 20:50:56 -05:00 committed by GitHub
commit e09e16fd56
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 5 deletions

View file

@ -9,6 +9,7 @@ require 'addon/buffer/bufferapp.php';
use Friendica\App; use Friendica\App;
use Friendica\Content\Text\BBCode; use Friendica\Content\Text\BBCode;
use Friendica\Content\Text\Plaintext;
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n; use Friendica\Core\L10n;
@ -365,8 +366,8 @@ function buffer_send(App $a, &$b)
if (($profile->service == "twitter") && isset($post["url"]) && ($post["type"] != "photo")) if (($profile->service == "twitter") && isset($post["url"]) && ($post["type"] != "photo"))
$post["text"] .= " ".$post["url"]; $post["text"] .= " ".$post["url"];
elseif (($profile->service == "appdotnet") && isset($post["url"]) && isset($post["title"]) && ($post["type"] != "photo")) { elseif (($profile->service == "appdotnet") && isset($post["url"]) && isset($post["title"]) && ($post["type"] != "photo")) {
$post["title"] = BBCode::shortenMsg($post["title"], 90); $post["title"] = Plaintext::shorten($post["title"], 90);
$post["text"] = BBCode::shortenMsg($post["text"], $limit - (24 + strlen($post["title"]))); $post["text"] = Plaintext::shorten($post["text"], $limit - (24 + strlen($post["title"])));
$post["text"] .= "\n[".$post["title"]."](".$post["url"].")"; $post["text"] .= "\n[".$post["title"]."](".$post["url"].")";
} elseif (($profile->service == "appdotnet") && isset($post["url"]) && ($post["type"] != "photo")) } elseif (($profile->service == "appdotnet") && isset($post["url"]) && ($post["type"] != "photo"))
$post["text"] .= " ".$post["url"]; $post["text"] .= " ".$post["url"];

View file

@ -48,6 +48,7 @@ require_once 'include/enotify.php';
use Friendica\App; use Friendica\App;
use Friendica\Content\OEmbed; use Friendica\Content\OEmbed;
use Friendica\Content\Text\BBCode; use Friendica\Content\Text\BBCode;
use Friendica\Content\Text\Plaintext;
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n; use Friendica\Core\L10n;
@ -645,7 +646,7 @@ function statusnet_post_hook(App $a, &$b)
$msg = $msgarr["text"]; $msg = $msgarr["text"];
if (($msg == "") && isset($msgarr["title"])) if (($msg == "") && isset($msgarr["title"]))
$msg = BBCode::shortenMsg($msgarr["title"], $max_char - 50); $msg = Plaintext::shorten($msgarr["title"], $max_char - 50);
$image = ""; $image = "";

View file

@ -62,6 +62,7 @@
use Friendica\App; use Friendica\App;
use Friendica\Content\OEmbed; use Friendica\Content\OEmbed;
use Friendica\Content\Text\BBCode; use Friendica\Content\Text\BBCode;
use Friendica\Content\Text\Plaintext;
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n; use Friendica\Core\L10n;
@ -529,7 +530,7 @@ function twitter_post_hook(App $a, &$b)
$msg = $msgarr["text"]; $msg = $msgarr["text"];
if (($msg == "") && isset($msgarr["title"])) { if (($msg == "") && isset($msgarr["title"])) {
$msg = BBCode::shortenMsg($msgarr["title"], $max_char - 50); $msg = Plaintext::shorten($msgarr["title"], $max_char - 50);
} }
$image = ""; $image = "";
@ -597,7 +598,7 @@ function twitter_post_hook(App $a, &$b)
$msg = $msgarr["text"]; $msg = $msgarr["text"];
if (($msg == "") && isset($msgarr["title"])) { if (($msg == "") && isset($msgarr["title"])) {
$msg = BBCode::shortenMsg($msgarr["title"], $max_char - 50); $msg = Plaintext::shorten($msgarr["title"], $max_char - 50);
} }
if (isset($msgarr["url"])) { if (isset($msgarr["url"])) {