本文整理汇总了PHP中Codes::render_pre方法的典型用法代码示例。如果您正苦于以下问题:PHP Codes::render_pre方法的具体用法?PHP Codes::render_pre怎么用?PHP Codes::render_pre使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Codes
的用法示例。
在下文中一共展示了Codes::render_pre方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sprintf
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: render_pre_php
/**
* 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');
}