$topdir = realpath(dirname(__FILE__) . '/../'); include_once $topdir . "/wiki.php"; // Start Main $Config = getConfig($topdir . '/config.php'); require_once $topdir . '/wikilib.php'; require_once $topdir . '/lib/win32fix.php'; require_once $topdir . '/lib/wikiconfig.php'; require_once $topdir . '/lib/cache.text.php'; require_once $topdir . '/lib/timer.php'; include_once dirname(__FILE__) . '/utils.php'; $Config = wikiConfig($Config); $DBInfo = new WikiDB($Config); $p = $DBInfo->getPage('FrontPage'); $formatter = new Formatter($p); if (empty($formatter->wordrule)) { $formatter->set_wordrule(); } $params = array(); if (class_exists('Timer')) { $timing = new Timer(); $params['timer'] =& $timing; $params['timer']->Check("load"); } $options = array(); $options[] = array('f', '', "force update redirect caches"); $options[] = array('d', '', "debug"); $short_opts = ''; // list of short options. foreach ($options as $item) { $opt = $item[0]; if ($item[1]) {
function render($pagename, $type, $params = array()) { global $DBInfo; $p = $DBInfo->getPage($pagename); $opts = array(); // parameters for mdict if ($type == 'mdict') { $opts = array('prefix' => 'entry:/'); } $formatter = new Formatter($p, $opts); if (isset($params['filters'])) { $formatter->filters = $params['filters']; } // trash javascripts $formatter->get_javascripts(); // init wordrule if (empty($formatter->wordrule)) { $formatter->set_wordrule(); } // render ob_start(); $formatter->send_page(); flush(); $out = ob_get_contents(); ob_end_clean(); // filter for mdict if ($type == 'mdict') { return $formatter->postfilter_repl('mdict', $out); } else { return $out; } }