diff --git a/_inc/lib/markdown/extra.php b/_inc/lib/markdown/extra.php index 1f411dad00238..6fd39949a8e72 100644 --- a/_inc/lib/markdown/extra.php +++ b/_inc/lib/markdown/extra.php @@ -103,7 +103,6 @@ function __construct() { # # Constructor function. Initialize appropriate member variables. # - $this->_initDetab(); $this->prepareItalicsAndBold(); $this->nested_brackets_re = @@ -1481,10 +1480,6 @@ function outdent($text) { } - # String length function for detab. `_initDetab` will create a function to - # hanlde UTF-8 if the default function does not exist. - public $utf8_strlen = 'mb_strlen'; - function detab($text) { # # Replace tabs with the appropriate amount of space. @@ -1500,7 +1495,6 @@ function detab($text) { } function _detab_callback($matches) { $line = $matches[0]; - $strlen = $this->utf8_strlen; # strlen function for UTF-8. # Split in blocks. $blocks = explode("\t", $line); @@ -1510,24 +1504,11 @@ function _detab_callback($matches) { foreach ($blocks as $block) { # Calculate amount of space, insert spaces, insert block. $amount = $this->tab_width - - $strlen($line, 'UTF-8') % $this->tab_width; + mb_strlen($line, 'UTF-8') % $this->tab_width; $line .= str_repeat(" ", $amount) . $block; } return $line; } - function _initDetab() { - # - # Check for the availability of the function in the `utf8_strlen` property - # (initially `mb_strlen`). If the function is not available, create a - # function that will loosely count the number of UTF-8 characters with a - # regular expression. - # - if (function_exists($this->utf8_strlen)) return; - $this->utf8_strlen = create_function('$text', 'return preg_match_all( - "/[\\\\x00-\\\\xBF]|[\\\\xC0-\\\\xFF][\\\\x80-\\\\xBF]*/", - $text, $m);'); - } - function unhash($text) { # @@ -2157,8 +2138,7 @@ function _hashHTMLBlocks_inHTML($text, $hash_method, $md_attr) { # Calculate indent before tag. if (preg_match('/(?:^|\n)( *?)(?! ).*?$/', $block_text, $matches)) { - $strlen = $this->utf8_strlen; - $indent = $strlen($matches[1], 'UTF-8'); + $indent = mb_strlen($matches[1], 'UTF-8'); } else { $indent = 0; }