Beispiel #1
0
function tf($page, &$startTime, &$endTime)
{
    global $xcludeContent;
    //The new parser strips all \r and lets \n do all the line break work
    $syntax = $page['data'];
    $syntax = str_replace("\r", '', $syntax);
    // Determine the page syntax type
    $is_html = isset($page['is_html']) ? $page['is_html'] == 1 : false;
    $parser = new JisonParser_Wiki_Handler();
    $WysiwygParser = new JisonParser_WikiCKEditor_Handler();
    $parserHtmlToWiki = new JisonParser_Html_Handler();
    // Parse
    $startTime = getMicroTime();
    if (!$is_html) {
        $wikiSyntax = $syntax;
        $html = $WysiwygParser->parse($wikiSyntax);
        $wiki = $parserHtmlToWiki->parse($html);
    } else {
        $htmlSyntax = $syntax;
        $wikiSyntax = $parserHtmlToWiki->parse($htmlSyntax);
        $html = $WysiwygParser->parse($wikiSyntax);
        $wiki = $parserHtmlToWiki->parse($html);
    }
    $endTime = getMicroTime();
    $success = $wikiSyntax == $wiki;
    if ($success == false && !$xcludeContent) {
        echo "\n";
        echo '"' . $wikiSyntax . '"';
        echo "\n---------------------" . mb_detect_encoding($wikiSyntax) . "-------------------------\n";
        echo $html;
        echo "\n----------------------------------------------\n";
        echo '"' . $wiki . '"';
        echo "\n----------------------" . mb_detect_encoding($wiki) . "------------------------\n";
    }
    echo $success ? "\tSUCCESS" : "\tFAILURE";
    unset($parser);
    unset($WysiwygParser);
    unset($parserHtmlToWiki);
    unset($html);
    return $success;
}
Beispiel #2
0
 public function tag(&$tag)
 {
     $parts = preg_split("/[ >]/", substr($tag, 1));
     //<tag> || <tag name="">
     $name = array_shift($parts);
     $name = strtolower(trim($name));
     $end = array_pop($parts);
     $params = implode(" ", $parts);
     $params = $this->parseElementParameters($params);
     $type = "";
     if (isset($params['data-t'])) {
         $type = JisonParser_WikiCKEditor_Handler::typeFromShorthand(strtolower($params['data-t']));
     }
     return array("name" => $name, "params" => $params, "open" => $tag, "state" => "open", "type" => $type, "htmlElementsStackCount" => $this->htmlElementsStackCount);
 }