private function parse_value($value)
 {
     $parser = $this->formatter->get_parser();
     $parser->set_content($value);
     $parser->parse();
     return $parser->get_content();
 }
예제 #2
0
function wiki_parse(&$var)
{
    $content_manager = new ContentFormattingFactory(BBCODE_LANGUAGE);
    $parser = $content_manager->get_parser();
    $parser->set_content($var, MAGIC_QUOTES);
    $parser->parse();
    return preg_replace('`\\[link=([a-z0-9+#-]+)\\](.+)\\[/link\\]`isU', '<a href="/wiki/$1">$2</a>', $parser->get_content());
}
<?php

define('PATH_TO_ROOT', '../../..');
define('NO_SESSION_LOCATION', true);
include_once PATH_TO_ROOT . '/kernel/begin.php';
include_once PATH_TO_ROOT . '/kernel/header_no_display.php';
$page_path_to_root = retrieve(REQUEST, 'path_to_root', '');
$page_path = retrieve(REQUEST, 'page_path', '');
$editor = retrieve(REQUEST, 'editor', $CONFIG['editor']);
$contents = utf8_decode(retrieve(POST, 'contents', '', TSTRING_AS_RECEIVED));
$ftags = retrieve(POST, 'ftags', TSTRING_UNCHANGE);
$forbidden_tags = explode(',', $ftags);
$content_manager = new ContentFormattingFactory($editor);
$parser = $content_manager->get_parser($editor);
$parser->set_content($contents, MAGIC_QUOTES);
$parser->set_path_to_root($page_path_to_root);
$parser->set_page_path($page_path);
if (!empty($forbidden_tags)) {
    $parser->set_forbidden_tags($forbidden_tags);
}
$parser->parse();
$second_parser = $content_manager->get_second_parser();
$second_parser->set_content($parser->get_content(DO_NOT_ADD_SLASHES), PARSER_DO_NOT_STRIP_SLASHES);
$second_parser->set_path_to_root($page_path_to_root);
$second_parser->set_page_path($page_path);
$second_parser->parse();
$contents = $second_parser->get_content(DO_NOT_ADD_SLASHES);
echo $contents;
include_once PATH_TO_ROOT . '/kernel/footer_no_display.php';
예제 #4
0
function strparse(&$content, $forbidden_tags = array(), $addslashes = true)
{
    $content_manager = new ContentFormattingFactory();
    $parser = $content_manager->get_parser();
    $parser->set_content($content, MAGIC_QUOTES);
    if (!empty($forbidden_tags)) {
        $parser->set_forbidden_tags($forbidden_tags);
    }
    $parser->parse();
    return $parser->get_content($addslashes);
}