Replace html2plain calls by HTML::toPlaintext
This commit is contained in:
parent
b5666bd27f
commit
5e806ff598
6 changed files with 10 additions and 9 deletions
|
@ -2625,10 +2625,10 @@ function api_format_messages($item, $recipient, $sender)
|
||||||
if ($_GET['getText'] == 'html') {
|
if ($_GET['getText'] == 'html') {
|
||||||
$ret['text'] = BBCode::convert($item['body'], false);
|
$ret['text'] = BBCode::convert($item['body'], false);
|
||||||
} elseif ($_GET['getText'] == 'plain') {
|
} 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 {
|
} 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') {
|
if (x($_GET, 'getUserObjects') && $_GET['getUserObjects'] == 'false') {
|
||||||
unset($ret['sender']);
|
unset($ret['sender']);
|
||||||
|
@ -2651,7 +2651,7 @@ function api_convert_item($item)
|
||||||
|
|
||||||
// Workaround for ostatus messages where the title is identically to the body
|
// Workaround for ostatus messages where the title is identically to the body
|
||||||
$html = BBCode::convert(api_clean_plain_items($body), false, 2, true);
|
$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
|
// handle data: images
|
||||||
$statusbody = api_format_items_embeded_images($item, $statusbody);
|
$statusbody = api_format_items_embeded_images($item, $statusbody);
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
use Friendica\App;
|
use Friendica\App;
|
||||||
use Friendica\Content\Text\BBCode;
|
use Friendica\Content\Text\BBCode;
|
||||||
|
use Friendica\Content\Text\HTML;
|
||||||
use Friendica\Core\ACL;
|
use Friendica\Core\ACL;
|
||||||
use Friendica\Core\Config;
|
use Friendica\Core\Config;
|
||||||
use Friendica\Core\L10n;
|
use Friendica\Core\L10n;
|
||||||
|
@ -369,8 +370,8 @@ function display_content(App $a, $update = false, $update_uid = 0) {
|
||||||
// Preparing the meta header
|
// Preparing the meta header
|
||||||
require_once 'include/html2plain.php';
|
require_once 'include/html2plain.php';
|
||||||
|
|
||||||
$description = trim(html2plain(BBCode::convert($s[0]["body"], false), 0, true));
|
$description = trim(HTML::toPlaintext(BBCode::convert($s[0]["body"], false), 0, true));
|
||||||
$title = trim(html2plain(BBCode::convert($s[0]["title"], false), 0, true));
|
$title = trim(HTML::toPlaintext(BBCode::convert($s[0]["title"], false), 0, true));
|
||||||
$author_name = $s[0]["author-name"];
|
$author_name = $s[0]["author-name"];
|
||||||
|
|
||||||
$image = $a->remove_baseurl($s[0]["author-thumb"]);
|
$image = $a->remove_baseurl($s[0]["author-thumb"]);
|
||||||
|
|
|
@ -816,7 +816,7 @@ function item_post(App $a) {
|
||||||
'replyTo' => $a->user['email'],
|
'replyTo' => $a->user['email'],
|
||||||
'messageSubject' => $subject,
|
'messageSubject' => $subject,
|
||||||
'htmlVersion' => $message,
|
'htmlVersion' => $message,
|
||||||
'textVersion' => html2plain($html.$disclaimer)
|
'textVersion' => Friendica\Content\Text\HTML::toPlaintext($html.$disclaimer)
|
||||||
];
|
];
|
||||||
Emailer::send($params);
|
Emailer::send($params);
|
||||||
}
|
}
|
||||||
|
|
|
@ -413,7 +413,7 @@ class BBCode extends BaseObject
|
||||||
}
|
}
|
||||||
|
|
||||||
$html = self::convert($post["text"].$post["after"], false, $htmlmode);
|
$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'));
|
$msg = trim(html_entity_decode($msg, ENT_QUOTES, 'UTF-8'));
|
||||||
|
|
||||||
$link = "";
|
$link = "";
|
||||||
|
|
|
@ -47,7 +47,7 @@ class NotificationsManager extends BaseObject
|
||||||
$n['timestamp'] = strtotime($local_time);
|
$n['timestamp'] = strtotime($local_time);
|
||||||
$n['date_rel'] = Temporal::getRelativeDate($n['date']);
|
$n['date_rel'] = Temporal::getRelativeDate($n['date']);
|
||||||
$n['msg_html'] = BBCode::convert($n['msg'], false);
|
$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;
|
$rets[] = $n;
|
||||||
}
|
}
|
||||||
|
|
|
@ -330,7 +330,7 @@ class Email
|
||||||
$body .= "Content-Transfer-Encoding: 8bit\n";
|
$body .= "Content-Transfer-Encoding: 8bit\n";
|
||||||
$body .= "Content-Type: text/plain; charset=utf-8; format=flowed\n\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 .= "--=_".$part."\n";
|
||||||
$body .= "Content-Transfer-Encoding: 8bit\n";
|
$body .= "Content-Transfer-Encoding: 8bit\n";
|
||||||
|
|
Loading…
Reference in a new issue