← All changes
|
src/includes/externals/markdown/nc-markdown.inc.php
+9
-3
260805
→
261001
View file →
| @@ -1,6 +1,9 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | // @codingStandardsIgnoreFile |
| 3 | +if(!defined('WPINC')) //260928.0402 This parser is only loaded through WordPress/s2Member; reject direct web requests. | |
| 4 | + exit('Do not access this file directly.'); | |
| 5 | + | |
| 3 | 6 | /** |
| 4 | 7 | * PHP Markdown class. |
| 5 | 8 | * |
| 6 | 9 | * Copyright {@link http://www.michelf.com/projects/php-markdown/ Michel Fortin}. |
| @@ -1453,11 +1456,14 @@ | ||
| 1453 | 1456 | # function that will loosely count the number of UTF-8 characters with a |
| 1454 | 1457 | # regular expression. |
| 1455 | 1458 | # |
| 1456 | 1459 | if (function_exists($this->utf8_strlen)) return; |
| 1457 | - $this->utf8_strlen = create_function('$text', 'return preg_match_all( | |
| 1458 | - "/[\\\\x00-\\\\xBF]|[\\\\xC0-\\\\xFF][\\\\x80-\\\\xBF]*/", | |
| 1459 | - $text, $m);'); | |
| 1460 | + //260816 create_function() was removed in PHP 8; use a PHP 5.3+ closure for this fallback. | |
| 1461 | + $this->utf8_strlen = function($text) { | |
| 1462 | + return preg_match_all( | |
| 1463 | + "/[\\x00-\\xBF]|[\\xC0-\\xFF][\\x80-\\xBF]*/", | |
| 1464 | + $text, $m); | |
| 1465 | + }; | |
| 1460 | 1466 | } |
| 1461 | 1467 | |
| 1462 | 1468 | |
| 1463 | 1469 | function unhash($text) { |