Skip to:
Content

bbPress.org

Changeset 6212


Ignore:
Timestamp:
01/11/2017 08:33:09 PM (7 years ago)
Author:
johnjamesjacoby
Message:

Parser: PHP 7.1 compatibility fixes to parser.php

Props xknown. Fixes #2973. See #2987.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/includes/admin/parser.php

    r5909 r6212  
    8989var $pat_comment2;
    9090var $pat_wiki;
    91 function BBCodeLexer($string, $tagmarker = '[') {
     91function __construct($string, $tagmarker = '[') {
    9292$regex_beginmarkers = Array( '[' => '\[', '<' => '<', '{' => '\{', '(' => '\(' );
    9393$regex_endmarkers = Array( '[' => '\]', '<' => '>', '{' => '\}', '(' => '\)' );
     
    122122$this->tag = false;
    123123$this->text = "";
     124}
     125function BBCodeLexer($string, $tagmarker = '[') {
     126$this->__construct($string, $tagmarker);
    124127}
    125128function GuessTextLength() {
     
    11551158if (function_exists("html_entity_decode"))
    11561159return html_entity_decode($string);
    1157 $string = preg_replace('~&#x([0-9a-f]+);~ei', 'chr(hexdec("\\1"))', $string);
    1158 $string = preg_replace('~&#([0-9]+);~e', 'chr("\\1")', $string);
     1160$string = preg_replace_callback('~&#x([0-9a-f]+);~i', array( $this, '_UnHTMLEncode_chr_callback'), $string);
     1161$string = preg_replace_callback('~&#([0-9]+);~', array($this, '_UnHTMLEncode_chr_hexdec_callback'), $string);
    11591162$trans_tbl = get_html_translation_table(HTML_ENTITIES);
    11601163$trans_tbl = array_flip($trans_tbl);
    11611164return strtr($string, $trans_tbl);
     1165}
     1166function _UnHTMLEncode_chr_callback($match) {
     1167return chr(hexdec($match[1]));
     1168}
     1169function _UnHTMLEncode_chr_hexdec_callback($match) {
     1170return chr(hexdec($match[1]));
    11621171}
    11631172function Wikify($string) {
     
    13921401else $value = @$default_array[$matches[1]];
    13931402if (strlen(@$matches[2])) {
    1394 foreach (split(".", substr($matches[2], 1)) as $index) {
     1403foreach (explode(".", substr($matches[2], 1)) as $index) {
    13951404if (is_array($value))
    13961405$value = @$value[$index];
Note: See TracChangeset for help on using the changeset viewer.