コード例 #1
0
ファイル: browse.php プロジェクト: rair/yacs
if ($script && $store == 'reference') {
    $context['page_title'] = sprintf(i18n::s('Reference script: %s'), $script);
} elseif ($script && $store == 'staging') {
    $context['page_title'] = sprintf(i18n::s('Staging script: %s'), $script);
} else {
    $context['page_title'] = i18n::s('Script view');
}
// no script has been provided
if (!$script) {
    Logger::error(i18n::s('No script has been provided.'));
} elseif (!file_exists($translated)) {
    Logger::error(i18n::s('Script does not exist.'));
} else {
    // lookup for information inside the file
    $content = Safe::file_get_contents($translated);
    // protect from spammers and robots
    $content = preg_replace('/\\[email\\].+\\[\\/email\\]/i', '', $content);
    // highlight php code
    $context['text'] .= "\n" . Codes::render_pre($content);
    // menu bar for reference scripts
    if ($content && $store == 'reference') {
        // browsing is safe
        $context['page_tools'][] = Skin::build_link(Scripts::get_url($script, 'view'), i18n::s('View the documentation page'));
        // protect from spammers and robots
        if (Surfer::is_logged()) {
            $context['page_tools'][] = Skin::build_link(Scripts::get_url($script, 'fetch'), i18n::s('Fetch the script file'));
        }
    }
}
// render the skin
render_skin();
コード例 #2
0
ファイル: codes.php プロジェクト: rair/yacs
 /**
  * render [php]...[php] code
  * 
  * @param string $text
  * @return string the formatted block
  */
 public static function render_pre_php($text)
 {
     return Codes::render_pre($text, 'php');
 }