Skip to:
Content

bbPress.org


Ignore:
Timestamp:
08/27/2017 11:24:00 PM (7 years ago)
Author:
johnjamesjacoby
Message:

Converter: more OOP, specifically for the BBCode parser.

This change introduces a bbcode_parser_properties array to the base converter, allowing custom BBCode parser properties to be passed into the parent method via the child, minimizing the amount of code in each individual forum converter.

Trunk, for 2.6.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/includes/admin/converters/SMF.php

    r6573 r6670  
    2121     *
    2222     */
    23     function __construct() {
     23    public function __construct() {
    2424        parent::__construct();
    25         $this->setup_globals();
    2625    }
    2726
     
    3029     */
    3130    public function setup_globals() {
     31
     32        // Setup smiley URL & path
     33        $this->bbcode_parser_properties = array(
     34            'smiley_url' => false,
     35            'smiley_dir' => false
     36        );
    3237
    3338        /** Forum Section ******************************************************/
     
    676681
    677682    /**
    678      * Translate the post status from SMF v2.0.4 numeric's to WordPress's strings.
     683     * Translate the post status from SMF v2.0.4 numerics to WordPress's strings.
    679684     *
    680685     * @param int $status SMF v2.0.4 numeric topic status
     
    696701
    697702    /**
    698      * Translate the topic sticky status type from SMF v2.0.4 numeric's to WordPress's strings.
     703     * Translate the topic sticky status type from SMF v2.0.4 numerics to WordPress's strings.
    699704     *
    700705     * @param int $status SMF v2.0.4 numeric forum type
     
    797802
    798803        // Replace non-break space ' ' with space ' '
    799         $SMF_markup = preg_replace ( '/ /', ' ', $SMF_markup );
     804        $SMF_markup = preg_replace( '/ /', ' ', $SMF_markup );
    800805
    801806        // Now that SMF custom HTML has been stripped put the cleaned HTML back in $field
     
    803808
    804809        // Parse out any bbCodes in $field with the BBCode 'parser.php'
    805         require_once bbpress()->admin->admin_dir . 'parser.php';
    806         $bbcode = BBCode::getInstance();
    807         $bbcode->enable_smileys = false;
    808         $bbcode->smiley_regex   = false;
    809         return html_entity_decode( $bbcode->Parse( $field ) );
     810        return parent::callback_html( $field );
    810811    }
    811812}
Note: See TracChangeset for help on using the changeset viewer.