Replace html2bbcode calls by HTML::toBBCode

This commit is contained in:
Hypolite Petovan 2018-03-07 16:24:13 -05:00
parent 3bb2f72d05
commit b5666bd27f
9 changed files with 32 additions and 30 deletions

View file

@ -2454,7 +2454,7 @@ class DFRN
$purifier = new HTMLPurifier($config);
$item['body'] = $purifier->purify($item['body']);
$item['body'] = @html2bbcode($item['body']);
$item['body'] = @Friendica\Content\Text\HTML::toBBCode($item['body']);
}
/// @todo We should check for a repeated post and if we know the repeated author.

View file

@ -4,6 +4,8 @@
*/
namespace Friendica\Protocol;
use Friendica\Content\Text\HTML;
require_once 'include/html2plain.php';
/**
@ -111,7 +113,7 @@ class Email
if (trim($ret['body']) == '') {
$ret['body'] = self::messageGetPart($mbox, $uid, $struc, 0, 'plain');
} else {
$ret['body'] = html2bbcode($ret['body']);
$ret['body'] = HTML::toBBCode($ret['body']);
}
} else {
$text = '';
@ -128,7 +130,7 @@ class Email
}
}
if (trim($html) != '') {
$ret['body'] = html2bbcode($html);
$ret['body'] = HTML::toBBCode($html);
} else {
$ret['body'] = $text;
}

View file

@ -363,7 +363,7 @@ class Feed {
if (self::titleIsBody($item["title"], $body)) {
$item["title"] = "";
}
$item["body"] = html2bbcode($body, $basepath);
$item["body"] = Friendica\Content\Text\HTML::toBBCode($body, $basepath);
if (($item["body"] == '') && ($item["title"] != '')) {
$item["body"] = $item["title"];

View file

@ -5,6 +5,7 @@
namespace Friendica\Protocol;
use Friendica\Content\Text\BBCode;
use Friendica\Content\Text\HTML;
use Friendica\Core\Cache;
use Friendica\Core\Config;
use Friendica\Core\L10n;
@ -168,7 +169,7 @@ class OStatus
$value = $xpath->evaluate('atom:author/poco:note/text()', $context)->item(0)->nodeValue;
if ($value != "") {
$contact["about"] = html2bbcode($value);
$contact["about"] = HTML::toBBCode($value);
}
$value = $xpath->evaluate('atom:author/poco:address/poco:formatted/text()', $context)->item(0)->nodeValue;
@ -557,7 +558,7 @@ class OStatus
*/
private static function processPost($xpath, $entry, &$item, $importer)
{
$item["body"] = html2bbcode($xpath->query('atom:content/text()', $entry)->item(0)->nodeValue);
$item["body"] = HTML::toBBCode($xpath->query('atom:content/text()', $entry)->item(0)->nodeValue);
$item["object-type"] = $xpath->query('activity:object-type/text()', $entry)->item(0)->nodeValue;
if (($item["object-type"] == ACTIVITY_OBJ_BOOKMARK) || ($item["object-type"] == ACTIVITY_OBJ_EVENT)) {
$item["title"] = $xpath->query('atom:title/text()', $entry)->item(0)->nodeValue;
@ -659,7 +660,7 @@ class OStatus
if (($item["verb"] == ACTIVITY_POST) && $xpath->evaluate('boolean(atom:summary)', $entry)) {
$clear_text = $xpath->query('atom:summary/text()', $entry)->item(0)->nodeValue;
$item["body"] = html2bbcode($clear_text) . '[spoiler]' . $item["body"] . '[/spoiler]';
$item["body"] = HTML::toBBCode($clear_text) . '[spoiler]' . $item["body"] . '[/spoiler]';
}
if (($self != '') && empty($item['protocol'])) {
@ -1014,7 +1015,7 @@ class OStatus
$item["author-link"] = $orig_author["author-link"];
$item["author-avatar"] = $orig_author["author-avatar"];
$item["body"] = html2bbcode($orig_body);
$item["body"] = HTML::toBBCode($orig_body);
$item["created"] = $orig_created;
$item["edited"] = $orig_edited;

View file

@ -9,6 +9,7 @@
namespace Friendica\Protocol;
use Friendica\Content\Text\HTML;
use Friendica\Core\Config;
use Friendica\Core\Worker;
use Friendica\Database\DBM;
@ -155,7 +156,7 @@ class PortableContact
}
if (isset($entry->aboutMe)) {
$about = html2bbcode($entry->aboutMe);
$about = HTML::toBBCode($entry->aboutMe);
}
if (isset($entry->gender)) {
@ -1669,7 +1670,7 @@ class PortableContact
}
if (isset($entry->aboutMe)) {
$about = html2bbcode($entry->aboutMe);
$about = HTML::toBBCode($entry->aboutMe);
}
if (isset($entry->gender)) {