Merge branch 'prepare_text' into 'dev'

Correct parameter in include/text.php prepare_text()

See merge request hubzilla/core!1483
This commit is contained in:
Mario 2019-01-23 15:41:54 +01:00
commit 51a7be29f5

View File

@ -1732,17 +1732,24 @@ function prepare_binary($item) {
/**
* @brief Given a text string, convert from bbcode to html and add smilie icons.
* @brief Given a text string, convert from content_type to HTML.
*
* Take a text in plain text, html, markdown, bbcode, PDL or PHP and prepare
* it to return HTML.
*
* In bbcode this function will add smilie icons.
*
* @param string $text
* @param string $content_type (optional) default text/bbcode
* @param boolean $cache (optional) default false
*
* @param string $content_type (optional)
* default 'text/bbcode', other values are 'text/plain', 'text/html',
* 'text/markdown', 'application/x-pdl', 'application/x-php'
* @param boolean|array $opts (optional)
* default false, otherwise configuration array for bbcode()
* @return string
* The parsed $text as prepared HTML.
*/
function prepare_text($text, $content_type = 'text/bbcode', $opts = false) {
switch($content_type) {
case 'text/plain':
$s = escape_tags($text);
@ -1782,8 +1789,8 @@ function prepare_text($text, $content_type = 'text/bbcode', $opts = false) {
default:
require_once('include/bbcode.php');
if(stristr($text,'[nosmile]'))
$s = bbcode($text, [ 'cache' => $cache ]);
if(stristr($text, '[nosmile]'))
$s = bbcode($text, ((is_array($opts)) ? $opts : [] ));
else
$s = smilies(bbcode($text, ((is_array($opts)) ? $opts : [] )));