X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModel%2FItemContent.php;h=c8ad48ca46bc1333e2f05e9cc57e7fd008334680;hb=f4e1acedfcd86c81403c14747ecfd3b11583506e;hp=672631b7e80700e7f76671f47ff6bb4bce4026ca;hpb=c58dc357d4fb97fc7d22e5c2db03a4f22719185c;p=friendica.git diff --git a/src/Model/ItemContent.php b/src/Model/ItemContent.php index 672631b7e8..c8ad48ca46 100644 --- a/src/Model/ItemContent.php +++ b/src/Model/ItemContent.php @@ -1,19 +1,35 @@ . + * */ namespace Friendica\Model; use Friendica\Content\Text; +use Friendica\Content\Text\BBCode; use Friendica\Core\Protocol; use Friendica\DI; class ItemContent { /** - * @brief Convert a message into plaintext for connectors to other networks + * Convert a message into plaintext for connectors to other networks * * @param array $item The message array that is about to be posted * @param int $limit The maximum number of characters when posting to that network @@ -26,7 +42,7 @@ class ItemContent * @see \Friendica\Content\Text\BBCode::getAttachedData * */ - public static function getPlaintextPost($item, $limit = 0, $includedlinks = false, $htmlmode = 2, $target_network = '') + public static function getPlaintextPost($item, $limit = 0, $includedlinks = false, $htmlmode = BBCode::API, $target_network = '') { // Remove hashtags $URLSearchString = '^\[\]'; @@ -64,11 +80,11 @@ class ItemContent } } else {// Try to guess the correct target network switch ($htmlmode) { - case 8: + case BBCode::TWITTER: $abstract = Text\BBCode::getAbstract($item['body'], Protocol::TWITTER); break; - case 7: + case BBCode::OSTATUS: $abstract = Text\BBCode::getAbstract($item['body'], Protocol::STATUSNET); break; @@ -124,8 +140,8 @@ class ItemContent $msg = trim(str_replace($link, '', $msg)); } elseif (($limit == 0) || ($pos < $limit)) { // The limit has to be increased since it will be shortened - but not now - // Only do it with Twitter (htmlmode = 8) - if (($limit > 0) && (strlen($link) > 23) && ($htmlmode == 8)) { + // Only do it with Twitter + if (($limit > 0) && (strlen($link) > 23) && ($htmlmode == BBCode::TWITTER)) { $limit = $limit - 23 + strlen($link); }