本文整理汇总了PHP中Markdown::escape_chars_re方法的典型用法代码示例。如果您正苦于以下问题:PHP Markdown::escape_chars_re方法的具体用法?PHP Markdown::escape_chars_re怎么用?PHP Markdown::escape_chars_re使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Markdown
的用法示例。
在下文中一共展示了Markdown::escape_chars_re方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: transform
/**
*
* Main function. Performs some preprocessing on the input text
* and pass it through the document gamut.
*
*/
public static function transform($text)
{
/**
* From previous constructor
*/
self::_init_detab();
self::prepare_italics_and_bold();
self::$nested_brackets_re = str_repeat('(?>[^\\[\\]]+|\\[', self::$nested_brackets_depth) . str_repeat('\\])*', self::$nested_brackets_depth);
self::$nested_url_parenthesis_re = str_repeat('(?>[^()\\s]+|\\(', self::$nested_url_parenthesis_depth) . str_repeat('(?>\\)))*', self::$nested_url_parenthesis_depth);
self::$escape_chars_re = '[' . preg_quote(self::$escape_chars) . ']';
// Sort document, block, and span gamut in ascendent priority order.
asort(self::$document_gamut);
asort(self::$block_gamut);
asort(self::$span_gamut);
/**
* End of constructor stuff
*/
self::setup();
// Remove UTF-8 BOM and marker character in input, if present.
$text = preg_replace('{^\\xEF\\xBB\\xBF|\\x1A}', '', $text);
// Standardize line endings:
// DOS to Unix and Mac to Unix
$text = preg_replace('{\\r\\n?}', "\n", $text);
// Make sure $text ends with a couple of newlines:
$text .= "\n\n";
// Convert all tabs to spaces.
$text = self::detab($text);
// Turn block-level HTML blocks into hash entries
$text = self::hash_HTML_blocks($text);
// Strip any lines consisting only of spaces and tabs.
// This makes subsequent regexen easier to write, because we can
// match consecutive blank lines with /\n+/ instead of something
// contorted like /[ ]*\n+/ .
$text = preg_replace('/^[ ]+$/m', '', $text);
// Run document gamut methods.
foreach (self::$document_gamut as $method => $priority) {
$text = self::$method($text);
}
self::teardown();
return $text . "\n";
}