*/
public static function toBBCode($message, $basepath = '')
{
+ DI::profiler()->startRecording('rendering');
$message = str_replace("\r", "", $message);
$message = Strings::performWithEscapedBlocks($message, '#<pre><code.*</code></pre>#iUs', function ($message) {
$message = self::qualifyURLs($message, $basepath);
}
+ DI::profiler()->stopRecording();
return $message;
}
*/
public static function toPlaintext(string $html, $wraplength = 75, $compact = false)
{
+ DI::profiler()->startRecording('rendering');
$message = str_replace("\r", "", $html);
$doc = new DOMDocument();
$message = mb_convert_encoding($message, 'HTML-ENTITIES', "UTF-8");
if (empty($message)) {
+ DI::profiler()->stopRecording();
return '';
}
// Collecting all links
$urls = self::collectURLs($message);
+ if (empty($message)) {
+ DI::profiler()->stopRecording();
+ return '';
+ }
+
@$doc->loadHTML($message, LIBXML_HTML_NODEFDTD);
self::tagToBBCode($doc, 'html', [], '', '');
$message = self::quoteLevel(trim($message), $wraplength);
+ DI::profiler()->stopRecording();
return trim($message);
}
*/
public static function toMarkdown($html)
{
+ DI::profiler()->startRecording('rendering');
$converter = new HtmlConverter(['hard_break' => true]);
$markdown = $converter->convert($html);
+ DI::profiler()->stopRecording();
return $markdown;
}
]);
}
- /**
- * Get html for contact block.
- *
- * @deprecated since version 2019.03
- * @see ContactBlock::getHTML()
- * @return string
- * @throws \Friendica\Network\HTTPException\InternalServerErrorException
- * @throws \ImagickException
- */
- public static function contactBlock()
- {
- $a = DI::app();
-
- return ContactBlock::getHTML($a->profile);
- }
-
/**
* Format contacts as picture links or as text links
*
'_blank' => true,
]);
+ $config->set('AutoFormat.RemoveEmpty.Predicate', [
+ 'colgroup' => [], // |
+ 'th' => [], // |
+ 'td' => [], // |
+ 'iframe' => ['src'], // ↳ Default HTMLPurify values
+ 'i' => ['class'], // Allows forkawesome icons
+ ]);
// Uncomment to debug HTMLPurifier behavior
//$config->set('Core.CollectErrors', true);