Exemple #1
0
function MarkupToHTML($pagename, $text, $opt = NULL) {
  # convert wiki markup text to HTML output
  global $MarkupRules, $MarkupFrame, $MarkupFrameBase, $WikiWordCount,
    $K0, $K1, $RedoMarkupLine;

  StopWatch('MarkupToHTML begin');
  array_unshift($MarkupFrame, array_merge($MarkupFrameBase, (array)$opt));
  $MarkupFrame[0]['wwcount'] = $WikiWordCount;
  $markrules = BuildMarkupRules();
  foreach((array)$text as $l) 
    $lines[] = $MarkupFrame[0]['escape'] 
               ? PVS(htmlspecialchars($l, ENT_NOQUOTES)) : $l;
  $lines[] = '(:closeall:)';
  $out = '';
  while (count($lines)>0) {
    $x = array_shift($lines);
    $RedoMarkupLine=0;
    foreach($markrules as $p=>$r) {
      if ($p{0} == '/') $x=preg_replace($p,$r,$x); 
      elseif (strstr($x,$p)!==false) $x=eval($r);
      if (isset($php_errormsg)) { echo "pat=$p"; unset($php_errormsg); }
      if ($RedoMarkupLine) { $lines=array_merge((array)$x,$lines); continue 2; }
    }
    if ($x>'') $out .= "$x\n";
  }
  foreach((array)(@$MarkupFrame[0]['posteval']) as $v) eval($v);
  array_shift($MarkupFrame);
  StopWatch('MarkupToHTML end');
  return $out;
}
Exemple #2
0
function PVSE($x) { return PVS(htmlspecialchars($x, ENT_NOQUOTES)); }
Exemple #3
0
function PVSE($x) { return PVS(PHSC($x, ENT_NOQUOTES)); }
Exemple #4
0
function MarkupToHTML($pagename, $text)
{
    # convert wiki markup text to HTML output
    global $MarkupRules, $MarkupFrame, $MarkupFrameBase, $WikiWordCount, $K0, $K1, $RedoMarkupLine;
    StopWatch('MarkupToHTML begin');
    array_unshift($MarkupFrame, $MarkupFrameBase);
    $MarkupFrame[0]['wwcount'] = $WikiWordCount;
    $markrules = BuildMarkupRules();
    foreach ((array) $text as $l) {
        $lines[] = PVS(htmlspecialchars($l, ENT_NOQUOTES));
    }
    $lines[] = '(:closeall:)';
    $out = array();
    while (count($lines) > 0) {
        $x = array_shift($lines);
        $RedoMarkupLine = 0;
        foreach ($markrules as $p => $r) {
            if ($p[0] == '/') {
                $x = preg_replace($p, $r, $x);
            } elseif (strstr($x, $p) !== false) {
                $x = eval($r);
            }
            if (isset($php_errormsg)) {
                echo "pat={$p}";
                unset($php_errormsg);
            }
            if ($RedoMarkupLine) {
                $lines = array_merge((array) $x, $lines);
                continue 2;
            }
        }
        if ($x > '') {
            $out[] = "{$x}\n";
        }
    }
    $out = implode('', (array) $out);
    foreach ((array) @$MarkupFrame[0]['posteval'] as $v) {
        eval($v);
    }
    array_shift($MarkupFrame);
    StopWatch('MarkupToHTML end');
    return $out;
}