本文整理汇总了PHP中Drupal\Component\Utility\Html::Escape方法的典型用法代码示例。如果您正苦于以下问题:PHP Html::Escape方法的具体用法?PHP Html::Escape怎么用?PHP Html::Escape使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Drupal\Component\Utility\Html
的用法示例。
在下文中一共展示了Html::Escape方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: geshiProcessCustomGeshi
/**
* Geshifilter wrapper for GeSHi processing.
*
* @param string $source_code
* Source code to process.
* @param string $lang
* Language from sourcecode.
* @param int $linenumbers_start
* The line number to start from.
* @param string $message
* The message that will be displayed in the highlighted section.
* @param string $title
* The title to use.
* @param \GeSHi $geshi
* (optional) The GeSHi object that will be used for generating the HTML.
*
* @return string
* The sourcecode after process by Geshi.
*/
public static function geshiProcessCustomGeshi($source_code, $lang, $linenumbers_start = 1, $message = '', $title, $geshi = NULL)
{
$source_code = trim($source_code, "\n\r");
if (!is_object($geshi)) {
// Load GeSHi library (if not already).
$geshi_library = libraries_load('geshi');
if (!$geshi_library['loaded']) {
drupal_set_message($geshi_library['error message'], 'error');
return $source_code;
}
// Create GeSHi object.
$geshi = self::geshiFactory($source_code, $lang);
}
self::overrideGeshiDefaults($geshi, $lang);
// Some more GeSHi settings and parsing.
// Block source code mode.
$geshi->enable_line_numbers(GESHI_FANCY_LINE_NUMBERS, 2);
$geshi->start_line_numbers_at($linenumbers_start);
$message = '<div class="message"><p>' . Html::Escape($message) . '</p></div>';
$source_code = '';
if (isset($title)) {
$source_code .= '<div class="geshifilter-title">' . Html::Escape($title) . '</div>';
}
$source_code .= '<div class="geshifilter">' . $message . $geshi->parse_code() . '</div>';
return $source_code;
}