]> git.mxchange.org Git - friendica.git/commitdiff
Replace html2plain calls by HTML::toPlaintext
authorHypolite Petovan <mrpetovan@gmail.com>
Wed, 7 Mar 2018 21:29:44 +0000 (16:29 -0500)
committerHypolite Petovan <mrpetovan@gmail.com>
Wed, 7 Mar 2018 21:29:44 +0000 (16:29 -0500)
include/api.php
mod/display.php
mod/item.php
src/Content/Text/BBCode.php
src/Core/NotificationsManager.php
src/Protocol/Email.php

index 2f0566b6e07a034e801db97ecc96776208169289..2645d06f657b4fff8a77ede31012b91ca90cbc16 100644 (file)
@@ -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);
index ab27b283b764f4ea847963f6864c867d6ff92e95..7c74a93ca0ffad6eb07b23776b1b2a76436b5557 100644 (file)
@@ -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"]);
index 8aa7c665af8733df7cbb873f35818698192f76fe..c05650cfafcc4ddcd8baa1e9e968034976005665 100644 (file)
@@ -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);
                        }
index 2e9af5a249efa16db7c397b529108e2ea1a20b64..c59d2433042a1d5780011a642205936f5ce349d3 100644 (file)
@@ -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 = "";
index 0e552d2e09620207632ffec2c58e7eb61badb4f5..aaf6933f0299759b934448a632df3afba363fa29 100644 (file)
@@ -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;
                }
index fadd124c961e43b2e32f7228fcde380cb3e63426..671e6a3edddee861d1b28621aea01f04b3960a6c 100644 (file)
@@ -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";