Skip to:
Content

bbPress.org

Changeset 6418


Ignore:
Timestamp:
05/19/2017 09:40:51 AM (8 years ago)
Author:
netweb
Message:

Parser: PHP 7.1 compatibility fixes to parser.php

Props xknown.
See #2973, #2987.

Merges [6212] to the 2.5 branch.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.5/includes/admin/parser.php

    r4250 r6418  
    8181var $pat_comment2;
    8282var $pat_wiki;
    83 function BBCodeLexer($string, $tagmarker = '[') {
     83function __construct($string, $tagmarker = '[') {
    8484$regex_beginmarkers = Array( '[' => '\[', '<' => '<', '{' => '\{', '(' => '\(' );
    8585$regex_endmarkers = Array( '[' => '\]', '<' => '>', '{' => '\}', '(' => '\)' );
     
    114114$this->tag = false;
    115115$this->text = "";
     116}
     117function BBCodeLexer($string, $tagmarker = '[') {
     118$this->__construct($string, $tagmarker);
    116119}
    117120function GuessTextLength() {
     
    11471150if (function_exists("html_entity_decode"))
    11481151return html_entity_decode($string);
    1149 $string = preg_replace('~&#x([0-9a-f]+);~ei', 'chr(hexdec("\\1"))', $string);
    1150 $string = preg_replace('~&#([0-9]+);~e', 'chr("\\1")', $string);
     1152$string = preg_replace_callback('~&#x([0-9a-f]+);~i', array( $this, '_UnHTMLEncode_chr_callback'), $string);
     1153$string = preg_replace_callback('~&#([0-9]+);~', array($this, '_UnHTMLEncode_chr_hexdec_callback'), $string);
    11511154$trans_tbl = get_html_translation_table(HTML_ENTITIES);
    11521155$trans_tbl = array_flip($trans_tbl);
    11531156return strtr($string, $trans_tbl);
     1157}
     1158function _UnHTMLEncode_chr_callback($match) {
     1159return chr(hexdec($match[1]));
     1160}
     1161function _UnHTMLEncode_chr_hexdec_callback($match) {
     1162return chr(hexdec($match[1]));
    11541163}
    11551164function Wikify($string) {
     
    13841393else $value = @$default_array[$matches[1]];
    13851394if (strlen(@$matches[2])) {
    1386 foreach (split(".", substr($matches[2], 1)) as $index) {
     1395foreach (explode(".", substr($matches[2], 1)) as $index) {
    13871396if (is_array($value))
    13881397$value = @$value[$index];
Note: See TracChangeset for help on using the changeset viewer.