Esempio n. 1
0
function help_content(&$a)
{
    nav_set_selected('help');
    global $lang;
    $text = '';
    if ($a->argc > 1) {
        $text = load_doc_file('doc/' . $a->argv[1] . '.md');
        $a->page['title'] = t('Help:') . ' ' . str_replace('-', ' ', notags($a->argv[1]));
    }
    $home = load_doc_file('doc/Home.md');
    if (!$text) {
        $text = $home;
        $a->page['title'] = t('Help');
    } else {
        $a->page['aside'] = Markdown($home);
    }
    if (!strlen($text)) {
        header($_SERVER["SERVER_PROTOCOL"] . ' 404 ' . t('Not Found'));
        $tpl = get_markup_template("404.tpl");
        return replace_macros($tpl, array('$message' => t('Page not found.')));
    }
    $html = Markdown($text);
    $html = "<style>.md_warning { padding: 1em; border: #ff0000 solid 2px; background-color: #f9a3a3; color: #ffffff;</style>" . $html;
    return $html;
}
Esempio n. 2
0
function help_content(&$a)
{
    nav_set_selected('help');
    global $lang;
    require_once 'library/markdown.php';
    $text = '';
    if ($a->argc > 1) {
        $text = load_doc_file('doc/' . $a->argv[1] . '.md');
        $a->page['title'] = t('Help:') . ' ' . str_replace('-', ' ', notags($a->argv[1]));
    }
    if (!$text) {
        $text = load_doc_file('doc/Home.md');
        $a->page['title'] = t('Help');
    }
    if (!strlen($text)) {
        header($_SERVER["SERVER_PROTOCOL"] . ' 404 ' . t('Not Found'));
        $tpl = get_markup_template("404.tpl");
        return replace_macros($tpl, array('$message' => t('Page not found.')));
    }
    return Markdown($text);
}
Esempio n. 3
0
function load_context_help()
{
    $path = App::$cmd;
    $args = App::$argv;
    $lang = App::$language;
    if (!isset($lang) || !is_dir('doc/context/' . $lang . '/')) {
        $lang = 'en';
    }
    while ($path) {
        $context_help = load_doc_file('doc/context/' . $lang . '/' . $path . '/help.html');
        if (!$context_help) {
            // Fallback to English if the translation is absent
            $context_help = load_doc_file('doc/context/en/' . $path . '/help.html');
        }
        if ($context_help) {
            break;
        }
        array_pop($args);
        $path = implode($args, '/');
    }
    return $context_help;
}
Esempio n. 4
0
function preg_callback_help_include($matches)
{
    if ($matches[1]) {
        $include = str_replace($matches[0], load_doc_file($matches[1]), $matches[0]);
        if (preg_match('/\\.bb$/', $matches[1]) || preg_match('/\\.txt$/', $matches[1])) {
            require_once 'include/bbcode.php';
            $include = bbcode($include);
            $include = str_replace(' target="_blank"', '', $include);
        } elseif (preg_match('/\\.md$/', $matches[1])) {
            require_once 'library/markdown.php';
            $include = Markdown($include);
        }
        return $include;
    }
}
Esempio n. 5
0
File: help.php Progetto: Mauru/red
function preg_callback_help_include($matches)
{
    if ($matches[1]) {
        return str_replace($matches[0], load_doc_file($matches[1]), $matches[0]);
    }
}