diff --git a/include/api.php b/include/api.php index 2f0566b6e0..2645d06f65 100644 --- a/include/api.php +++ b/include/api.php @@ -2625,10 +2625,10 @@ function api_format_messages($item, $recipient, $sender) if ($_GET['getText'] == 'html') { $ret['text'] = BBCode::convert($item['body'], false); } elseif ($_GET['getText'] == 'plain') { - $ret['text'] = trim(html2plain(BBCode::convert(api_clean_plain_items($item['body']), false, 2, true), 0)); + $ret['text'] = trim(HTML::toPlaintext(BBCode::convert(api_clean_plain_items($item['body']), false, 2, true), 0)); } } else { - $ret['text'] = $item['title'] . "\n" . html2plain(BBCode::convert(api_clean_plain_items($item['body']), false, 2, true), 0); + $ret['text'] = $item['title'] . "\n" . HTML::toPlaintext(BBCode::convert(api_clean_plain_items($item['body']), false, 2, true), 0); } if (x($_GET, 'getUserObjects') && $_GET['getUserObjects'] == 'false') { unset($ret['sender']); @@ -2651,7 +2651,7 @@ function api_convert_item($item) // Workaround for ostatus messages where the title is identically to the body $html = BBCode::convert(api_clean_plain_items($body), false, 2, true); - $statusbody = trim(html2plain($html, 0)); + $statusbody = trim(HTML::toPlaintext($html, 0)); // handle data: images $statusbody = api_format_items_embeded_images($item, $statusbody); diff --git a/mod/display.php b/mod/display.php index ab27b283b7..7c74a93ca0 100644 --- a/mod/display.php +++ b/mod/display.php @@ -5,6 +5,7 @@ use Friendica\App; use Friendica\Content\Text\BBCode; +use Friendica\Content\Text\HTML; use Friendica\Core\ACL; use Friendica\Core\Config; use Friendica\Core\L10n; @@ -369,8 +370,8 @@ function display_content(App $a, $update = false, $update_uid = 0) { // Preparing the meta header require_once 'include/html2plain.php'; - $description = trim(html2plain(BBCode::convert($s[0]["body"], false), 0, true)); - $title = trim(html2plain(BBCode::convert($s[0]["title"], false), 0, true)); + $description = trim(HTML::toPlaintext(BBCode::convert($s[0]["body"], false), 0, true)); + $title = trim(HTML::toPlaintext(BBCode::convert($s[0]["title"], false), 0, true)); $author_name = $s[0]["author-name"]; $image = $a->remove_baseurl($s[0]["author-thumb"]); diff --git a/mod/item.php b/mod/item.php index 8aa7c665af..c05650cfaf 100644 --- a/mod/item.php +++ b/mod/item.php @@ -816,7 +816,7 @@ function item_post(App $a) { 'replyTo' => $a->user['email'], 'messageSubject' => $subject, 'htmlVersion' => $message, - 'textVersion' => html2plain($html.$disclaimer) + 'textVersion' => Friendica\Content\Text\HTML::toPlaintext($html.$disclaimer) ]; Emailer::send($params); } diff --git a/src/Content/Text/BBCode.php b/src/Content/Text/BBCode.php index 2e9af5a249..c59d243304 100644 --- a/src/Content/Text/BBCode.php +++ b/src/Content/Text/BBCode.php @@ -413,7 +413,7 @@ class BBCode extends BaseObject } $html = self::convert($post["text"].$post["after"], false, $htmlmode); - $msg = html2plain($html, 0, true); + $msg = HTML::toPlaintext($html, 0, true); $msg = trim(html_entity_decode($msg, ENT_QUOTES, 'UTF-8')); $link = ""; diff --git a/src/Core/NotificationsManager.php b/src/Core/NotificationsManager.php index 0e552d2e09..aaf6933f02 100644 --- a/src/Core/NotificationsManager.php +++ b/src/Core/NotificationsManager.php @@ -47,7 +47,7 @@ class NotificationsManager extends BaseObject $n['timestamp'] = strtotime($local_time); $n['date_rel'] = Temporal::getRelativeDate($n['date']); $n['msg_html'] = BBCode::convert($n['msg'], false); - $n['msg_plain'] = explode("\n", trim(html2plain($n['msg_html'], 0)))[0]; + $n['msg_plain'] = explode("\n", trim(Friendica\Content\Text\HTML::toPlaintext($n['msg_html'], 0)))[0]; $rets[] = $n; } diff --git a/src/Protocol/Email.php b/src/Protocol/Email.php index fadd124c96..671e6a3edd 100644 --- a/src/Protocol/Email.php +++ b/src/Protocol/Email.php @@ -330,7 +330,7 @@ class Email $body .= "Content-Transfer-Encoding: 8bit\n"; $body .= "Content-Type: text/plain; charset=utf-8; format=flowed\n\n"; - $body .= html2plain($html)."\n"; + $body .= Friendica\Content\Text\HTML::toPlaintext($html)."\n"; $body .= "--=_".$part."\n"; $body .= "Content-Transfer-Encoding: 8bit\n";