示例#1
0
function tbg_parse_text($text, $toc = false, $article_id = null, $options = array())
{
    // Perform wiki parsing
    $wiki_parser = new TBGTextParser($text, $toc, 'article_' . $article_id);
    foreach ($options as $option => $value) {
        $wiki_parser->setOption($option, $value);
    }
    $text = $wiki_parser->getParsedText();
    return $text;
}
 public function getParsedContent($options = array())
 {
     switch ($this->_content_syntax) {
         case TBGSettings::SYNTAX_PT:
             $options = array('plain' => true);
         case TBGSettings::SYNTAX_MW:
             $wiki_parser = new TBGTextParser($this->_content, true, $this->getID());
             foreach ($options as $option => $value) {
                 $wiki_parser->setOption($option, $value);
             }
             $text = $wiki_parser->getParsedText();
             break;
         case TBGSettings::SYNTAX_MD:
             $parser = new TBGTextParserMarkdown();
             $text = $parser->transform($this->_content);
             break;
     }
     return $text;
 }
示例#3
0
 protected function _parseContent($options = array())
 {
     switch ($this->_syntax) {
         case TBGSettings::SYNTAX_PT:
             $options = array('plain' => true);
         case TBGSettings::SYNTAX_MW:
             $parser = new TBGTextParser($this->_content);
             foreach ($options as $option => $value) {
                 $parser->setOption($option, $value);
             }
             $text = $parser->getParsedText();
             break;
         case TBGSettings::SYNTAX_MD:
             $parser = new TBGTextParserMarkdown();
             $text = $parser->transform($this->_content);
             break;
     }
     if (isset($parser)) {
         $this->_parser = $parser;
     }
     return $text;
 }
示例#4
0
function tbg_parse_text($text, $toc = false, $article_id = null, $options = array(), $syntax = TBGSettings::SYNTAX_MW)
{
    switch ($syntax) {
        case TBGSettings::SYNTAX_PT:
            $options = array('plain' => true);
        case TBGSettings::SYNTAX_MW:
            $wiki_parser = new TBGTextParser($text, $toc, 'article_' . $article_id);
            foreach ($options as $option => $value) {
                $wiki_parser->setOption($option, $value);
            }
            $text = $wiki_parser->getParsedText();
            break;
        case TBGSettings::SYNTAX_MD:
            $parser = new TBGTextParserMarkdown();
            $text = $parser->transform($text);
            break;
    }
    return $text;
}
示例#5
0
 protected function _getParsedText($text, $syntax, $options = array())
 {
     switch ($syntax) {
         case TBGSettings::SYNTAX_PT:
             $options = array('plain' => true);
         case TBGSettings::SYNTAX_MW:
             $wiki_parser = new TBGTextParser($text);
             foreach ($options as $option => $value) {
                 $wiki_parser->setOption($option, $value);
             }
             $text = $wiki_parser->getParsedText();
             break;
         case TBGSettings::SYNTAX_MD:
             $parser = new TBGTextParserMarkdown();
             $text = $parser->transform($text);
             break;
     }
     return $text;
 }