1
1
Fork 0

Merge pull request #4562 from annando/bugfix-html

Bugfix: Avoid "Class not found" error
This commit is contained in:
Hypolite Petovan 2018-03-08 15:04:38 -05:00 committed by GitHub
commit 30a1057fcb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 10 additions and 5 deletions

View file

@ -9,6 +9,7 @@ namespace Friendica\Content\Text;
use Friendica\BaseObject; use Friendica\BaseObject;
use Friendica\Model\Contact; use Friendica\Model\Contact;
use Michelf\MarkdownExtra; use Michelf\MarkdownExtra;
use Friendica\Content\Text\HTML;
/** /**
* Friendica-specific usage of Markdown * Friendica-specific usage of Markdown
@ -92,7 +93,7 @@ class Markdown extends BaseObject
$s = str_replace('#', '#', $s); $s = str_replace('#', '#', $s);
$s = Friendica\Content\Text\HTML::toBBCode($s); $s = HTML::toBBCode($s);
// protect the recycle symbol from turning into a tag, but without unescaping angles and naked ampersands // 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); $s = str_replace('♲', html_entity_decode('♲', ENT_QUOTES, 'UTF-8'), $s);

View file

@ -8,6 +8,7 @@ namespace Friendica\Core;
use Friendica\BaseObject; use Friendica\BaseObject;
use Friendica\Content\Text\BBCode; use Friendica\Content\Text\BBCode;
use Friendica\Content\Text\HTML;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Core\System; use Friendica\Core\System;
@ -46,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(Friendica\Content\Text\HTML::toPlaintext($n['msg_html'], 0)))[0]; $n['msg_plain'] = explode("\n", trim(HTML::toPlaintext($n['msg_html'], 0)))[0];
$rets[] = $n; $rets[] = $n;
} }

View file

@ -11,6 +11,7 @@ namespace Friendica\Protocol;
use Friendica\App; use Friendica\App;
use Friendica\Content\OEmbed; use Friendica\Content\OEmbed;
use Friendica\Content\Text\BBCode; use Friendica\Content\Text\BBCode;
use Friendica\Content\Text\HTML;
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n; use Friendica\Core\L10n;
@ -2453,7 +2454,7 @@ class DFRN
$purifier = new HTMLPurifier($config); $purifier = new HTMLPurifier($config);
$item['body'] = $purifier->purify($item['body']); $item['body'] = $purifier->purify($item['body']);
$item['body'] = @Friendica\Content\Text\HTML::toBBCode($item['body']); $item['body'] = @HTML::toBBCode($item['body']);
} }
/// @todo We should check for a repeated post and if we know the repeated author. /// @todo We should check for a repeated post and if we know the repeated author.

View file

@ -328,7 +328,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 .= Friendica\Content\Text\HTML::toPlaintext($html)."\n"; $body .= HTML::toPlaintext($html)."\n";
$body .= "--=_".$part."\n"; $body .= "--=_".$part."\n";
$body .= "Content-Transfer-Encoding: 8bit\n"; $body .= "Content-Transfer-Encoding: 8bit\n";

View file

@ -10,6 +10,8 @@ use Friendica\Database\DBM;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Model\Item; use Friendica\Model\Item;
use Friendica\Util\Network; use Friendica\Util\Network;
use Friendica\Content\Text\HTML;
use dba; use dba;
use DOMDocument; use DOMDocument;
use DOMXPath; use DOMXPath;
@ -362,7 +364,7 @@ class Feed {
if (self::titleIsBody($item["title"], $body)) { if (self::titleIsBody($item["title"], $body)) {
$item["title"] = ""; $item["title"] = "";
} }
$item["body"] = Friendica\Content\Text\HTML::toBBCode($body, $basepath); $item["body"] = HTML::toBBCode($body, $basepath);
if (($item["body"] == '') && ($item["title"] != '')) { if (($item["body"] == '') && ($item["title"] != '')) {
$item["body"] = $item["title"]; $item["body"] = $item["title"];