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;
$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?
$purifier = new HTMLPurifier($config);
$txt = $purifier->purify($txt);
- $_REQUEST['body'] = html2bbcode($txt);
+ $_REQUEST['body'] = HTML::toBBCode($txt);
}
} else {
$_REQUEST['body'] = requestdata('status');
* @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", '<br />', $s);
$o .= '<h2>' . L10n::t('Source input: ') . '</h2>' . EOL . EOL;
$o .= visible_lf($text) . EOL . EOL;
- $html = BBCode::convert($text);
- $o .= '<h2>' . L10n::t("bbcode \x28raw HTML\x28: ") . '</h2>' . EOL . EOL;
+ $html = Text\BBCode::convert($text);
+ $o .= '<h2>' . L10n::t("BBCode::convert \x28raw HTML\x28: ") . '</h2>' . EOL . EOL;
$o .= htmlspecialchars($html) . EOL . EOL;
- $o .= '<h2>' . L10n::t('bbcode: ') . '</h2>' . EOL . EOL;
+ $o .= '<h2>' . L10n::t('BBCode::convert: ') . '</h2>' . EOL . EOL;
$o .= $html . EOL . EOL;
- $bbcode = html2bbcode($html);
- $o .= '<h2>' . L10n::t('bbcode => html2bbcode: ') . '</h2>' . EOL . EOL;
+ $bbcode = Text\HTML::toBBCode($html);
+ $o .= '<h2>' . L10n::t('BBCode::convert => HTML::toBBCode: ') . '</h2>' . EOL . EOL;
$o .= visible_lf($bbcode) . EOL . EOL;
- $diaspora = BBCode::toMarkdown($text);
+ $diaspora = Text\BBCode::toMarkdown($text);
$o .= '<h2>' . L10n::t('BBCode::toMarkdown: ') . '</h2>' . EOL . EOL;
$o .= visible_lf($diaspora) . EOL . EOL;
- $html = Markdown::convert($diaspora);
+ $html = Text\Markdown::convert($diaspora);
$o .= '<h2>' . L10n::t('BBCode::toMarkdown => Markdown::convert: ') . '</h2>' . EOL . EOL;
$o .= $html . EOL . EOL;
- $bbcode = Markdown::toBBCode($diaspora);
+ $bbcode = Text\Markdown::toBBCode($diaspora);
$o .= '<h2>' . L10n::t('BBCode::toMarkdown => Markdown::toBBCode: ') . '</h2>' . EOL . EOL;
$o .= visible_lf($bbcode) . EOL . EOL;
- $bbcode = html2bbcode($html);
- $o .= '<h2>' . L10n::t('bbcode => html2bbcode: ') . '</h2>' . EOL . EOL;
+ $bbcode = Text\HTML::toBBCode($html);
+ $o .= '<h2>' . L10n::t('BBCode::toMarkdown => Markdown::convert => HTML::toBBCode: ') . '</h2>' . EOL . EOL;
$o .= visible_lf($bbcode) . EOL . EOL;
}
$o .= '<h2>' . L10n::t("Source input \x28Diaspora format\x29: ") . '</h2>' . EOL . EOL;
$o .= '<pre>' . $d2bbtext . '</pre>' . EOL . EOL;
- $bb = Markdown::toBBCode($d2bbtext);
- $o .= '<h2>' . L10n::t('diaspora2bb: ') . '</h2>' . EOL . EOL;
+ $bb = Text\Markdown::toBBCode($d2bbtext);
+ $o .= '<h2>' . L10n::t('Markdown::toBBCode: ') . '</h2>' . EOL . EOL;
$o .= '<pre>' . $bb . '</pre>' . EOL . EOL;
}
$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;
$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);
$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.
*/
namespace Friendica\Protocol;
+use Friendica\Content\Text\HTML;
+
require_once 'include/html2plain.php';
/**
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 = '';
}
}
if (trim($html) != '') {
- $ret['body'] = html2bbcode($html);
+ $ret['body'] = HTML::toBBCode($html);
} else {
$ret['body'] = $text;
}
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"];
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;
$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;
*/
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;
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'])) {
$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;
namespace Friendica\Protocol;
+use Friendica\Content\Text\HTML;
use Friendica\Core\Config;
use Friendica\Core\Worker;
use Friendica\Database\DBM;
}
if (isset($entry->aboutMe)) {
- $about = html2bbcode($entry->aboutMe);
+ $about = HTML::toBBCode($entry->aboutMe);
}
if (isset($entry->gender)) {
}
if (isset($entry->aboutMe)) {
- $about = html2bbcode($entry->aboutMe);
+ $about = HTML::toBBCode($entry->aboutMe);
}
if (isset($entry->gender)) {