Beispiel #1
0
function b_xpwiki_block_show($options, $src, $nocache = false)
{
    $mydirname = empty($options[0]) ? 'xpwiki' : $options[0];
    // 必要なファイルの読み込み (固定値:変更の必要なし)
    include_once XOOPS_TRUST_PATH . "/modules/xpwiki/include.php";
    // インスタンス化 (引数: モジュールディレクトリ名)
    $xw = new XpWiki($mydirname);
    $width = empty($options[1]) ? '100%' : $options[1];
    $this_template = empty($options[2]) ? 'db:' . $mydirname . '_block_a_page.html' : trim($options[2]);
    $div_class = empty($options[3]) ? 'xpwiki_b_' . $mydirname : $options[3];
    $css = isset($options[4]) ? $options[4] : NULL;
    $head_tag_place = empty($options[5]) ? 'module' : trim($options[5]);
    $configs = array();
    if (preg_match('/[^0-9a-zA-Z_-]/', $mydirname)) {
        die('Invalid mydirname');
    }
    // ページキャッシュを常に無効にする
    if ($nocache) {
        $configs['root']['pagecache_min'] = 0;
    }
    // Wikiソース
    $arg = array('source' => $src);
    // ブロック用として取得 (引数: Wikiソース, 表示幅)
    list($str, $head) = $xw->get_html_for_block($arg, $width, $div_class, $css, $configs, TRUE);
    // MenuBar の ページCSS を読み込み
    if (isset($options['menubar'])) {
        $head .= $xw->func->get_page_css_tag('MenuBar');
    }
    // オブジェクトを破棄
    $xw = null;
    unset($xw);
    if ($head_tag_place === 'body' || !b_xpwiki_insert_headtag($head, $head_tag_place)) {
        $str = $head . $str;
    }
    if (!$str) {
        return FALSE;
    }
    $block = array('mydirname' => $mydirname, 'mod_url' => XOOPS_URL . '/modules/' . $mydirname, 'pagename' => '', 'content' => $str);
    $tpl = new XoopsTpl();
    $tpl->assign('block', $block);
    $ret['content'] = $tpl->fetch($this_template);
    return $ret;
}