diff --git a/include/api.php b/include/api.php
index 60a9acce0..2f0566b6e 100644
--- a/include/api.php
+++ b/include/api.php
@@ -10,6 +10,7 @@ use Friendica\App;
use Friendica\Content\ContactSelector;
use Friendica\Content\Feature;
use Friendica\Content\Text\BBCode;
+use Friendica\Content\Text\HTML;
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\L10n;
@@ -1096,7 +1097,7 @@ function api_statuses_mediap($type)
$purifier = new HTMLPurifier($config);
$txt = $purifier->purify($txt);
}
- $txt = html2bbcode($txt);
+ $txt = HTML::toBBCode($txt);
$a->argv[1]=$user_info['screen_name']; //should be set to username?
@@ -1147,7 +1148,7 @@ function api_statuses_update($type)
$purifier = new HTMLPurifier($config);
$txt = $purifier->purify($txt);
- $_REQUEST['body'] = html2bbcode($txt);
+ $_REQUEST['body'] = HTML::toBBCode($txt);
}
} else {
$_REQUEST['body'] = requestdata('status');
diff --git a/mod/babel.php b/mod/babel.php
index 99e6f4078..a2d197599 100644
--- a/mod/babel.php
+++ b/mod/babel.php
@@ -3,12 +3,9 @@
* @file mod/babel.php
*/
-use Friendica\Content\Text\BBCode;
-use Friendica\Content\Text\Markdown;
+use Friendica\Content\Text;
use Friendica\Core\L10n;
-require_once 'include/html2bbcode.php';
-
function visible_lf($s)
{
return str_replace("\n", '
', $s);
@@ -37,31 +34,31 @@ function babel_content()
$o .= '
' . $d2bbtext . '' . EOL . EOL; - $bb = Markdown::toBBCode($d2bbtext); - $o .= '
' . $bb . '' . EOL . EOL; } diff --git a/mod/oexchange.php b/mod/oexchange.php index feca39d35..2e1d7a2db 100644 --- a/mod/oexchange.php +++ b/mod/oexchange.php @@ -52,7 +52,7 @@ function oexchange_content(App $a) { $post['profile_uid'] = local_user(); $post['return'] = '/oexchange/done' ; - $post['body'] = html2bbcode($s); + $post['body'] = Friendica\Content\Text\HTML::toBBCode($s); $post['type'] = 'wall'; $_REQUEST = $post; diff --git a/src/Content/Text/Markdown.php b/src/Content/Text/Markdown.php index e7383a3fd..6e982c7f0 100644 --- a/src/Content/Text/Markdown.php +++ b/src/Content/Text/Markdown.php @@ -94,7 +94,7 @@ class Markdown extends BaseObject $s = str_replace('#', '#', $s); - $s = html2bbcode($s); + $s = Friendica\Content\Text\HTML::toBBCode($s); // protect the recycle symbol from turning into a tag, but without unescaping angles and naked ampersands $s = str_replace('♲', html_entity_decode('♲', ENT_QUOTES, 'UTF-8'), $s); diff --git a/src/Protocol/DFRN.php b/src/Protocol/DFRN.php index 5e7cc02a3..a82ae3d25 100644 --- a/src/Protocol/DFRN.php +++ b/src/Protocol/DFRN.php @@ -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. diff --git a/src/Protocol/Email.php b/src/Protocol/Email.php index b1eeb94d6..fadd124c9 100644 --- a/src/Protocol/Email.php +++ b/src/Protocol/Email.php @@ -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; } diff --git a/src/Protocol/Feed.php b/src/Protocol/Feed.php index 17234ce45..d54846fc3 100644 --- a/src/Protocol/Feed.php +++ b/src/Protocol/Feed.php @@ -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"]; diff --git a/src/Protocol/OStatus.php b/src/Protocol/OStatus.php index c6f840a66..9eebc7f2e 100644 --- a/src/Protocol/OStatus.php +++ b/src/Protocol/OStatus.php @@ -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; diff --git a/src/Protocol/PortableContact.php b/src/Protocol/PortableContact.php index 5b419e42e..f5513bddd 100644 --- a/src/Protocol/PortableContact.php +++ b/src/Protocol/PortableContact.php @@ -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)) {