/**
 * Interpret output to match input of textarea having both bbcode, html and tinymce buttons
 * @param           $data
 * @param bool|TRUE $smileys - parse smileys or not
 * @param bool|TRUE $bbcode - parse bbcode or not
 * @param bool|TRUE $decode - to decode special chars or not
 * @param string    $default_image_folder - to auto align path to image button or not
 * @return string - formatted text
 */
function parse_textarea($data, $smileys = true, $bbcode = true, $decode = true, $default_image_folder = IMAGES)
{
    $locale = fusion_get_locale('', LOCALE . LOCALESET . "global.php");
    $data = $smileys ? parsesmileys($data) : $data;
    $data = $bbcode ? parseubb($data) : $data;
    $data = $decode ? html_entity_decode(stripslashes($data), ENT_QUOTES, $locale['charset']) : $data;
    $data = $default_image_folder ? parse_imageDir($data, $default_image_folder) : $data;
    return (string) $data;
}
Ejemplo n.º 2
0
        \PHPFusion\ImageRepo::setImage("smiley_" . $smiley['smiley_text'], $smiley_path);
    }
}
if ($_POST['editor'] == 'html') {
    $text = parsesmileys(nl2br(html_entity_decode(stripslashes($text))));
    if (isset($_POST['mode']) && $_POST['mode'] == 'admin') {
        $images = str_replace('../../../', '', IMAGES);
        $text = str_replace(IMAGES, $images, $text);
        $text = str_replace(IMAGES_N, $images, $text);
        $text = parse_imageDir($text, $prefix_ . "images/");
    }
    echo html_entity_decode($text, ENT_QUOTES, $locale['charset']) ?: "<p class='text-center'>" . $locale['nopreview'] . "</p>\n";
} elseif ($_POST['editor'] == 'bbcode') {
    $text = parseubb(parsesmileys($text));
    if (isset($_POST['mode']) && $_POST['mode'] == 'admin') {
        $images = str_replace('../../../', '', IMAGES);
        $text = str_replace(IMAGES, $images, $text);
        $text = str_replace(IMAGES_N, $images, $text);
        $text = parse_imageDir($text, $prefix_ . "images/");
    }
    echo html_entity_decode($text, ENT_QUOTES, $locale['charset']) ?: "<p class='text-center'>" . $locale['nopreview'] . "</p>\n";
} else {
    $text = parsesmileys($text);
    if (isset($_POST['mode']) && $_POST['mode'] == 'admin') {
        $images = str_replace('../../../', '', IMAGES);
        $text = str_replace(IMAGES, $images, $text);
        $text = str_replace(IMAGES_N, $images, $text);
    }
    echo parse_imageDir(nl2br(html_entity_decode($text, ENT_QUOTES, $locale['charset']))) ?: "<p class='text-center'>" . $locale['nopreview'] . "</p>\n";
}
echo "</div>\n";
Ejemplo n.º 3
0
/**
 * Interpret output to match input of textarea having both bbcode, html and tinymce buttons
 * @param           $data
 * @param bool|TRUE $smileys - parse smileys or not
 * @param bool|TRUE $bbcode - parse bbcode or not
 * @param bool|TRUE $decode - to decode special chars or not
 * @param string    $default_image_folder - to auto align path to image button or not
 * @return string - formatted text
 */
function parse_textarea($data, $smileys = true, $bbcode = true, $decode = true, $default_image_folder = IMAGES)
{
    global $locale;
    $data = $smileys ? parsesmileys($data) : $data;
    $data = $bbcode ? parseubb($data) : $data;
    $data = $decode ? html_entity_decode(stripslashes($data), ENT_QUOTES, $locale['charset']) : $data;
    $data = $default_image_folder ? parse_imageDir($data, $default_image_folder) : $data;
    return (string) $data;
}