示例#1
0
function _cell($cell, $type)
{
    if ($type == 'wiki') {
        $cell = konawiki_parser_convert($cell, FALSE);
        return $cell;
    }
    $cell = kona3text2html($cell);
    return $cell;
}
示例#2
0
function kona3plugins_file_execute($args)
{
    global $kona3conf;
    $name = array_shift($args);
    $fname = kona3getWikiFile($name, false);
    if (!file_exists($fname)) {
        return "<div class='error'>Not Exists:" . kona3text2html($name) . "</div>";
    }
    $txt = file_get_contents($fname);
    $htm = konawiki_parser_convert($txt);
    return "<div>" . $htm . "</div>";
}
示例#3
0
function kona3plugins_block_execute($args)
{
    $class = "column";
    if (count($args) >= 2) {
        $test = array_shift($args);
        if (preg_match('/^[a-zA-Z0-9\\_\\-]+$/', $test)) {
            $class = $test;
        }
    }
    $text = array_shift($args);
    $html = konawiki_parser_convert($text);
    $t = "<div class='{$class}'>{$html}</div>";
    return $t;
}
示例#4
0
function kona3plugins_column_execute($args)
{
    if (!$args) {
        return "";
    }
    $class = "column";
    if (count($args) >= 2) {
        $class = trim(array_shift($args));
    }
    $body = array_shift($args);
    if (!preg_match("/^([0-9a-zA-Z\\-\\_]+)\$/", $class)) {
        $class = "column";
    }
    $html = konawiki_parser_convert($body, FALSE);
    return "<div class='{$class}'>{$html}</div>";
}
示例#5
0
function kona3_action_show()
{
    global $kona3conf;
    $page = $kona3conf["page"];
    $page_h = htmlspecialchars($page);
    // check login
    if ($kona3conf["wiki.private"]) {
        if (!kona3isLogin()) {
            $url = kona3getPageURL($page, "login");
            kona3error($page, "Private mode. <a href='{$url}'>Please login.</a>");
            exit;
        }
    }
    // wiki file (text)
    $fname = kona3getWikiFile($page);
    // wiki file eixsits?
    $ext = "txt";
    $wiki_live = file_exists($fname);
    if (!$wiki_live) {
        // mark down
        $fname = kona3getWikiFile($page, TRUE, '.md');
        $wiki_live = file_exists($fname);
        if ($wiki_live) {
            $ext = "md";
        } else {
            $fname = kona3getWikiFile($page, FALSE);
            $wiki_live = file_exists($fname);
            if (preg_match('#\\.([a-z]+)$#', $fname, $m)) {
                $ext = $m[1];
            }
        }
    }
    // body
    if ($wiki_live) {
        $txt = @file_get_contents($fname);
    } else {
        $updir = dirname($page);
        $txt = "*** {$page}\n\n" . "Not Found\n\n" . "#ls()\n";
    }
    // convert
    $cnt_txt = mb_strlen($txt);
    if ($ext == "txt") {
        $page_body = konawiki_parser_convert($txt);
    } else {
        if ($ext == "md") {
            $page_body = _markdown_convert($txt);
        } else {
            kona3error($page, "Sorry, System Error.");
            exit;
        }
    }
    // every page
    if (!empty($kona3conf['allpage.footer'])) {
        $footer = konawiki_parser_convert($kona3conf['allpage.footer']);
        $page_body .= "<hr>" . $footer;
    }
    // menu
    $menufile = kona3getWikiFile("MenuBar");
    if (file_exists($menufile)) {
        $menu = @file_get_contents($menufile);
        $menuhtml = konawiki_parser_convert($menu);
    } else {
        $menuhtml = "";
    }
    // show
    kona3template('show', array("page_title" => kona3text2html($page), "page_body" => $page_body, "cnt_txt" => $cnt_txt, "wiki_menu" => $menuhtml));
}