Skip to:
Content

bbPress.org

Changeset 6670


Ignore:
Timestamp:
08/27/2017 11:24:00 PM (9 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.

Location:
trunk/src/includes/admin
Files:
25 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/includes/admin/classes/class-bbp-converter-base.php

    r6669 r6670  
    9191        public $clean = false;
    9292
     93        /**
     94         * @var array Custom BBCode class properties in a key => value format
     95         */
     96        public $bbcode_parser_properties = array();
     97
    9398        /** Methods ***************************************************************/
    9499
     
    98103        public function __construct() {
    99104                $this->init();
     105                $this->setup_globals();
    100106        }
    101107
     
    106112         */
    107113        private function init() {
     114
     115                /** BBCode Parse Properties *******************************************/
     116
     117                // Setup smiley URL & path
     118                $this->bbcode_parser_properties = array(
     119                        'smiley_url' => includes_url( 'images/smilies' ),
     120                        'smiley_dir' => '/' . WPINC . '/images/smilies'
     121                );
    108122
    109123                /** Sanitize Options **************************************************/
     
    250264                );
    251265        }
     266
     267        /**
     268         * Setup global values
     269         */
     270        public function setup_globals() {}
    252271
    253272        /**
     
    11281147                $bbcode = BBCode::getInstance();
    11291148
    1130                 // Setup smiley URL & path
    1131                 $bbcode->smiley_url = includes_url( 'images/smilies' );
    1132                 $bbcode->smiley_dir = '/' . WPINC . '/images/smilies';
     1149                // Pass BBCode properties to the parser
     1150                foreach ( $this->bbcode_parser_properties as $prop => $value ) {
     1151                        $bbcode->{$prop} = $value;
     1152                }
    11331153
    11341154                return html_entity_decode( $bbcode->Parse( $field ) );
  • trunk/src/includes/admin/converters/AEF.php

    r6573 r6670  
    2020         * Main Constructor
    2121         */
    22         function __construct() {
     22        public function __construct() {
    2323                parent::__construct();
    24                 $this->setup_globals();
    2524        }
    2625
     
    593592
    594593        /**
    595          * Translate the forum status from AEF v1.0.9 numeric's to WordPress's strings.
     594         * Translate the forum status from AEF v1.0.9 numerics to WordPress's strings.
    596595         *
    597596         * @param int $status AEF v1.0.9 numeric forum status
     
    613612
    614613        /**
    615          * Translate the post status from AEF v1.0.9 numeric's to WordPress's strings.
     614         * Translate the post status from AEF v1.0.9 numerics to WordPress's strings.
    616615         *
    617616         * @param int $status AEF v1.0.9 numeric topic status
     
    633632
    634633        /**
    635          * Translate the topic sticky status type from AEF 1.x numeric's to WordPress's strings.
     634         * Translate the topic sticky status type from AEF 1.x numerics to WordPress's strings.
    636635         *
    637636         * @param int $status AEF 1.x numeric forum type
  • trunk/src/includes/admin/converters/Drupal7.php

    r6573 r6670  
    2020         * Main Constructor
    2121         */
    22         function __construct() {
     22        public function __construct() {
    2323                parent::__construct();
    24                 $this->setup_globals();
    2524        }
    2625
     
    591590
    592591        /**
    593          * Translate the post status from Drupal v7.x numeric's to WordPress's
     592         * Translate the post status from Drupal v7.x numerics to WordPress's
    594593         * strings.
    595594         *
     
    612611
    613612        /**
    614          * Translate the post status from Drupal v7.x numeric's to WordPress's strings.
     613         * Translate the post status from Drupal v7.x numerics to WordPress's strings.
    615614         *
    616615         * @param int $status Drupal v7.x numeric topic status
     
    632631
    633632        /**
    634          * Translate the topic sticky status type from Drupal v7.x numeric's to WordPress's strings.
     633         * Translate the topic sticky status type from Drupal v7.x numerics to WordPress's strings.
    635634         *
    636635         * @param int $status Drupal v7.x numeric forum type
  • trunk/src/includes/admin/converters/Example.php

    r6573 r6670  
    2020         * Main Constructor
    2121         */
    22         function __construct() {
     22        public function __construct() {
    2323                parent::__construct();
    24                 $this->setup_globals();
    2524        }
    2625
  • trunk/src/includes/admin/converters/FluxBB.php

    r6573 r6670  
    2121         *
    2222         */
    23         function __construct() {
     23        public function __construct() {
    2424                parent::__construct();
    25                 $this->setup_globals();
    2625        }
    2726
     
    614613
    615614        /**
    616          * Translate the post status from FluxBB v1.5.3 numeric's to WordPress's strings.
     615         * Translate the post status from FluxBB v1.5.3 numerics to WordPress's strings.
    617616         *
    618617         * @param int $status FluxBB v1.5.3 numeric topic status
     
    634633
    635634        /**
    636          * Translate the topic sticky status type from FluxBB v1.5.3 numeric's to WordPress's strings.
     635         * Translate the topic sticky status type from FluxBB v1.5.3 numerics to WordPress's strings.
    637636         *
    638637         * @param int $status FluxBB v1.5.3 numeric forum type
  • trunk/src/includes/admin/converters/Invision.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 *****************************************************/
     
    472477
    473478        /**
    474          * Translate the forum type from Invision numeric's to WordPress's strings.
     479         * Translate the forum type from Invision numerics to WordPress's strings.
    475480         *
    476481         * @param int $status Invision numeric forum type
     
    487492
    488493        /**
    489          * Translate the topic sticky status type from Invision numeric's to WordPress's strings.
     494         * Translate the topic sticky status type from Invision numerics to WordPress's strings.
    490495         *
    491496         * @param int $status Invision numeric forum type
     
    628633                $field = $invision_markup;
    629634
    630                 require_once bbpress()->admin->admin_dir . 'parser.php';
    631                 $bbcode = BBCode::getInstance();
    632                 $bbcode->enable_smileys = false;
    633                 $bbcode->smiley_regex   = false;
    634                 return html_entity_decode( $bbcode->Parse( $field ) );
     635                // Parse out any bbCodes in $field with the BBCode 'parser.php'
     636                return parent::callback_html( $field );
    635637        }
    636638}
  • trunk/src/includes/admin/converters/Kunena1.php

    r6573 r6670  
    2121         *
    2222         */
    23         function __construct() {
     23        public function __construct() {
    2424                parent::__construct();
    25                 $this->setup_globals();
    2625        }
    2726
     
    469468
    470469        /**
    471          * Translate the forum type from Kunena v1.x numeric's to WordPress's strings.
     470         * Translate the forum type from Kunena v1.x numerics to WordPress's strings.
    472471         *
    473472         * @param int $status Kunena v1.x numeric forum type
     
    484483
    485484        /**
    486          * Translate the forum status from Kunena v1.x numeric's to WordPress's strings.
     485         * Translate the forum status from Kunena v1.x numerics to WordPress's strings.
    487486         *
    488487         * @param int $status Kunena v1.x numeric forum status
     
    504503
    505504        /**
    506          * Translate the post status from Kunena v1.x numeric's to WordPress's strings.
     505         * Translate the post status from Kunena v1.x numerics to WordPress's strings.
    507506         *
    508507         * @param int $status Kunena v1.x numeric topic status
  • trunk/src/includes/admin/converters/Kunena2.php

    r6573 r6670  
    2121         *
    2222         */
    23         function __construct() {
     23        public function __construct() {
    2424                parent::__construct();
    25                 $this->setup_globals();
    2625        }
    2726
     
    3231
    3332                /** Forum Section *****************************************************/
    34 
    3533
    3634                // Old forum id (Stored in postmeta)
     
    500498        }
    501499        /**
    502          * Translate the forum type from Kunena v2.x numeric's to WordPress's strings.
     500         * Translate the forum type from Kunena v2.x numerics to WordPress's strings.
    503501         *
    504502         * @param int $status Kunena v2.x numeric forum type
     
    515513
    516514        /**
    517          * Translate the forum status from Kunena v2.x numeric's to WordPress's strings.
     515         * Translate the forum status from Kunena v2.x numerics to WordPress's strings.
    518516         *
    519517         * @param int $status Kunena v2.x numeric forum status
     
    535533
    536534        /**
    537          * Translate the post status from Kunena v2.x numeric's to WordPress's strings.
     535         * Translate the post status from Kunena v2.x numerics to WordPress's strings.
    538536         *
    539537         * @param int $status Kunena v2.x numeric topic status
  • trunk/src/includes/admin/converters/Kunena3.php

    r6573 r6670  
    2121         *
    2222         */
    23         function __construct() {
     23        public function __construct() {
    2424                parent::__construct();
    25                 $this->setup_globals();
    2625        }
    2726
     
    724723
    725724        /**
    726          * Translate the forum type from Kunena v3.x numeric's to WordPress's strings.
     725         * Translate the forum type from Kunena v3.x numerics to WordPress's strings.
    727726         *
    728727         * @param int $status Kunena v3.x numeric forum type
     
    739738
    740739        /**
    741          * Translate the forum status from Kunena v3.x numeric's to WordPress's strings.
     740         * Translate the forum status from Kunena v3.x numerics to WordPress's strings.
    742741         *
    743742         * @param int $status Kunena v3.x numeric forum status
     
    759758
    760759        /**
    761          * Translate the post status from Kunena v3.x numeric's to WordPress's strings.
     760         * Translate the post status from Kunena v3.x numerics to WordPress's strings.
    762761         *
    763762         * @param int $status Kunena v3.x numeric topic status
  • trunk/src/includes/admin/converters/Mingle.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 ******************************************************/
     
    435440
    436441        /**
    437          * Translate the topic status from Mingle numeric's to WordPress's strings.
     442         * Translate the topic status from Mingle numerics to WordPress's strings.
    438443         *
    439444         * @param int $status Mingle v1.x numeric topic status
     
    455460
    456461        /**
    457          * Translate the topic sticky status type from Mingle numeric's to WordPress's strings.
     462         * Translate the topic sticky status type from Mingle numerics to WordPress's strings.
    458463         *
    459464         * @param int $status Mingle numeric forum type
     
    473478                return $status;
    474479        }
    475 
    476         /**
    477          * This callback processes any custom BBCodes with parser.php
    478          */
    479         protected function callback_html( $field ) {
    480                 require_once bbpress()->admin->admin_dir . 'parser.php';
    481                 $bbcode = BBCode::getInstance();
    482                 $bbcode->enable_smileys = false;
    483                 $bbcode->smiley_regex   = false;
    484                 return html_entity_decode( $bbcode->Parse( $field ) );
    485         }
    486480}
  • trunk/src/includes/admin/converters/MyBB.php

    r6573 r6670  
    2121         *
    2222         */
    23         function __construct() {
     23        public function __construct() {
    2424                parent::__construct();
    25                 $this->setup_globals();
    2625        }
    2726
     
    540539
    541540        /**
    542          * Translate the post status from MyBB v1.6.10 numeric's to WordPress's strings.
     541         * Translate the post status from MyBB v1.6.10 numerics to WordPress's strings.
    543542         *
    544543         * @param int $status MyBB v1.6.10 numeric topic status
     
    560559
    561560        /**
    562          * Translate the topic sticky status type from MyBB v1.6.10 numeric's to WordPress's strings.
     561         * Translate the topic sticky status type from MyBB v1.6.10 numerics to WordPress's strings.
    563562         *
    564563         * @param int $status MyBB v1.6.10 numeric forum type
  • trunk/src/includes/admin/converters/PHPFox3.php

    r6573 r6670  
    2121         *
    2222         */
    23         function __construct() {
     23        public function __construct() {
    2424                parent::__construct();
    25                 $this->setup_globals();
    2625        }
    2726
     
    530529
    531530        /**
    532          * Translate the forum type from PHPFox v3.5.x numeric's to WordPress's strings.
     531         * Translate the forum type from PHPFox v3.5.x numerics to WordPress's strings.
    533532         *
    534533         * @param int $status PHPFox v3.5.x numeric forum type
     
    550549
    551550        /**
    552          * Translate the forum status from PHPFox v3.5.x numeric's to WordPress's strings.
     551         * Translate the forum status from PHPFox v3.5.x numerics to WordPress's strings.
    553552         *
    554553         * @param int $status PHPFox v3.5.x numeric forum status
     
    570569
    571570        /**
    572          * Translate the post status from PHPFox v3.5.x numeric's to WordPress's strings.
     571         * Translate the post status from PHPFox v3.5.x numerics to WordPress's strings.
    573572         *
    574573         * @param int $status PHPFox v3.5.x numeric topic status
     
    590589
    591590        /**
    592          * Translate the topic sticky status type from PHPFox v3.5.x numeric's to WordPress's strings.
     591         * Translate the topic sticky status type from PHPFox v3.5.x numerics to WordPress's strings.
    593592         *
    594593         * @param int $status PHPFox v3.5.x numeric forum type
  • trunk/src/includes/admin/converters/PHPWind.php

    r6573 r6670  
    2121         *
    2222         */
    23         function __construct() {
     23        public function __construct() {
    2424                parent::__construct();
    25                 $this->setup_globals();
    2625        }
    2726
     
    538537
    539538        /**
    540          * Translate the post status from PHPWind v9.x numeric's to WordPress's strings.
     539         * Translate the post status from PHPWind v9.x numerics to WordPress's strings.
    541540         *
    542541         * @param int $status PHPWind v9.x numeric topic status
  • trunk/src/includes/admin/converters/Phorum.php

    r6573 r6670  
    2121         *
    2222         */
    23         function __construct() {
     23        public function __construct() {
    2424                parent::__construct();
    25                 $this->setup_globals();
    2625        }
    2726
     
    540539
    541540        /**
    542          * Translate the forum type from Phorum v5.2.19 numeric's to WordPress's strings.
     541         * Translate the forum type from Phorum v5.2.19 numerics to WordPress's strings.
    543542         *
    544543         * @param int $status Phorum v5.2.19 numeric forum type
     
    560559
    561560        /**
    562          * Translate the post status from Phorum v5.2.19 numeric's to WordPress's strings.
     561         * Translate the post status from Phorum v5.2.19 numerics to WordPress's strings.
    563562         *
    564563         * @param int $status Phorum v5.2.19 numeric topic status
  • trunk/src/includes/admin/converters/PunBB.php

    r6573 r6670  
    2121         *
    2222         */
    23         function __construct() {
     23        public function __construct() {
    2424                parent::__construct();
    25                 $this->setup_globals();
    2625        }
    2726
     
    687686
    688687        /**
    689          * Translate the post status from PunBB v1.4.2 numeric's to WordPress's strings.
     688         * Translate the post status from PunBB v1.4.2 numerics to WordPress's strings.
    690689         *
    691690         * @param int $status PunBB v1.4.2 numeric topic status
     
    707706
    708707        /**
    709          * Translate the topic sticky status type from PunBB v1.4.2 numeric's to WordPress's strings.
     708         * Translate the topic sticky status type from PunBB v1.4.2 numerics to WordPress's strings.
    710709         *
    711710         * @param int $status PunBB v1.4.2 numeric forum type
  • 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}
  • trunk/src/includes/admin/converters/SimplePress5.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 *****************************************************/
     
    522527
    523528        /**
    524          * Translate the post status from Simple:Press v5.x numeric's to WordPress's strings.
     529         * Translate the post status from Simple:Press v5.x numerics to WordPress's strings.
    525530         *
    526531         * @param int $status Simple:Press numeric status
     
    542547
    543548        /**
    544          * Translate the topic sticky status type from Simple:Press v5.x numeric's to WordPress's strings.
     549         * Translate the topic sticky status type from Simple:Press v5.x numerics to WordPress's strings.
    545550         *
    546551         * @param int $status Simple:Press v5.x numeric forum type
     
    598603
    599604                // Replace '<strong>username said </strong>' with '@username said:'
    600                 $simplepress_markup = preg_replace ( '/\<strong\>(.*?)\ said\ \<\/strong\>/',     '@$1 said:',        $simplepress_markup );
     605                $simplepress_markup = preg_replace( '/\<strong\>(.*?)\ said\ \<\/strong\>/',     '@$1 said:',        $simplepress_markup );
    601606
    602607                // Replace '<p>&nbsp;</p>' with '<p>&nbsp;</p>'
    603                 $simplepress_markup = preg_replace ( '/\n(&nbsp;|[\s\p{Z}\xA0\x{00A0}]+)\r/', '<br>', $simplepress_markup );
     608                $simplepress_markup = preg_replace( '/\n(&nbsp;|[\s\p{Z}\xA0\x{00A0}]+)\r/', '<br>', $simplepress_markup );
    604609
    605610                // Now that SimplePress' custom HTML codes have been stripped put the cleaned HTML back in $field
    606611                $field = $simplepress_markup;
    607612
    608                 // Parse out any bbCodes with the BBCode 'parser.php'
    609                 require_once bbpress()->admin->admin_dir . 'parser.php';
    610                 $bbcode = BBCode::getInstance();
    611                 $bbcode->enable_smileys = false;
    612                 $bbcode->smiley_regex   = false;
    613                 return html_entity_decode( $bbcode->Parse( $field ) );
     613                // Parse out any bbCodes in $field with the BBCode 'parser.php'
     614                return parent::callback_html( $field );
    614615        }
    615616}
  • trunk/src/includes/admin/converters/Vanilla.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 *****************************************************/
     
    521526
    522527        /**
    523          * Translate the topic status from Vanilla v2.x numeric's to WordPress's strings.
     528         * Translate the topic status from Vanilla v2.x numerics to WordPress's strings.
    524529         *
    525530         * @param int $status Vanilla v2.x numeric topic status
     
    541546
    542547        /**
    543          * Translate the topic sticky status type from Vanilla v2.x numeric's to WordPress's strings.
     548         * Translate the topic sticky status type from Vanilla v2.x numerics to WordPress's strings.
    544549         *
    545550         * @param int $status Vanilla v2.x numeric forum type
     
    601606                return false;
    602607        }
    603 
    604         /**
    605          * This callback processes any custom BBCodes with parser.php
    606          */
    607         protected function callback_html( $field ) {
    608                 require_once bbpress()->admin->admin_dir . 'parser.php';
    609                 $bbcode = BBCode::getInstance();
    610                 $bbcode->enable_smileys = false;
    611                 $bbcode->smiley_regex   = false;
    612                 return html_entity_decode( $bbcode->Parse( $field ) );
    613         }
    614608}
  • trunk/src/includes/admin/converters/XMB.php

    r6573 r6670  
    2121         *
    2222         */
    23         function __construct() {
     23        public function __construct() {
    2424                parent::__construct();
    25                 $this->setup_globals();
    2625        }
    2726
     
    671670
    672671        /**
    673          * Translate the post status from XMB v1.9.11.13 numeric's to WordPress's strings.
     672         * Translate the post status from XMB v1.9.11.13 numerics to WordPress's strings.
    674673         *
    675674         * @param int $status XMB v1.9.11.13 numeric topic status
     
    691690
    692691        /**
    693          * Translate the topic sticky status type from XMB v1.9.11.13 numeric's to WordPress's strings.
     692         * Translate the topic sticky status type from XMB v1.9.11.13 numerics to WordPress's strings.
    694693         *
    695694         * @param int $status XMB v1.9.11.13 numeric forum type
  • trunk/src/includes/admin/converters/XenForo.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 *****************************************************/
     
    722727
    723728        /**
    724          * Translate the forum status from XenForo numeric's to WordPress's strings.
     729         * Translate the forum status from XenForo numerics to WordPress's strings.
    725730         *
    726731         * @param int $status XenForo numeric forum status
     
    762767
    763768        /**
    764          * Translate the topic status from XenForo numeric's to WordPress's strings.
     769         * Translate the topic status from XenForo numerics to WordPress's strings.
    765770         *
    766771         * @param int $status XenForo numeric topic status
     
    782787
    783788        /**
    784          * Translate the topic sticky status type from XenForo numeric's to WordPress's strings.
     789         * Translate the topic sticky status type from XenForo numerics to WordPress's strings.
    785790         *
    786791         * @param int $status XenForo numeric forum type
     
    841846
    842847                // Parse out any bbCodes in $field with the BBCode 'parser.php'
    843                 require_once bbpress()->admin->admin_dir . 'parser.php';
    844                 $bbcode = BBCode::getInstance();
    845                 $bbcode->enable_smileys = false;
    846                 $bbcode->smiley_regex   = false;
    847                 return html_entity_decode( $bbcode->Parse( $field ) );
     848                return parent::callback_html( $field );
    848849        }
    849850}
  • trunk/src/includes/admin/converters/bbPress1.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 *****************************************************/
     
    626631
    627632        /**
    628          * Translate the post status from bbPress 1's numeric's to WordPress's
     633         * Translate the post status from bbPress 1's numerics to WordPress's
    629634         * strings.
    630635         *
     
    651656
    652657        /**
    653          * Translate the forum type from bbPress 1.x numeric's to WordPress's strings.
     658         * Translate the forum type from bbPress 1.x numerics to WordPress's strings.
    654659         *
    655660         * @param int $status bbPress 1.x numeric forum type
     
    666671
    667672        /**
    668          * Translate the topic status from bbPress 1's numeric's to WordPress's
     673         * Translate the topic status from bbPress 1's numerics to WordPress's
    669674         * strings.
    670675         *
     
    687692
    688693        /**
    689          * Translate the topic sticky status type from bbPress 1.x numeric's to WordPress's strings.
     694         * Translate the topic sticky status type from bbPress 1.x numerics to WordPress's strings.
    690695         *
    691696         * @param int $status bbPress 1.x numeric forum type
     
    752757                return $field;
    753758        }
    754 
    755         /**
    756          * This callback:
    757          *
    758          * - turns off smiley parsing
    759          * - processes any custom parser.php attributes
    760          * - decodes necessary HTML entities
    761          */
    762         protected function callback_html( $field ) {
    763                 require_once bbpress()->admin->admin_dir . 'parser.php';
    764                 $bbcode = BBCode::getInstance();
    765                 $bbcode->enable_smileys = false;
    766                 $bbcode->smiley_regex   = false;
    767                 return html_entity_decode( $bbcode->Parse( $field ) );
    768         }
    769759}
  • trunk/src/includes/admin/converters/e107v1.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 *****************************************************/
     
    489494
    490495        /**
    491          * Translate the forum type from e107 v1.x numeric's to WordPress's strings.
     496         * Translate the forum type from e107 v1.x numerics to WordPress's strings.
    492497         *
    493498         * @param int $status e107 v1.x numeric forum type
     
    504509
    505510        /**
    506          * Translate the post status from e107 v1.x numeric's to WordPress's strings.
     511         * Translate the post status from e107 v1.x numerics to WordPress's strings.
    507512         *
    508513         * @param int $status e107 v1.x numeric topic status
     
    524529
    525530        /**
    526          * Translate the topic sticky status type from e107 v1.x numeric's to WordPress's strings.
     531         * Translate the topic sticky status type from e107 v1.x numerics to WordPress's strings.
    527532         *
    528533         * @param int $status e107 v1.x numeric forum type
     
    628633
    629634                // Parse out any bbCodes in $field with the BBCode 'parser.php'
    630                 require_once bbpress()->admin->admin_dir . 'parser.php';
    631                 $bbcode = BBCode::getInstance();
    632                 $bbcode->enable_smileys = false;
    633                 $bbcode->smiley_regex   = false;
    634                 return html_entity_decode( $bbcode->Parse( $field ) );
     635                return parent::callback_html( $field );
    635636        }
    636637}
  • trunk/src/includes/admin/converters/phpBB.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 *****************************************************/
     
    832837
    833838        /**
    834          * Translate the forum type from phpBB v3.x numeric's to WordPress's strings.
     839         * Translate the forum type from phpBB v3.x numerics to WordPress's strings.
    835840         *
    836841         * @param int $status phpBB v3.x numeric forum type
     
    852857
    853858        /**
    854          * Translate the forum status from phpBB v3.x numeric's to WordPress's strings.
     859         * Translate the forum status from phpBB v3.x numerics to WordPress's strings.
    855860         *
    856861         * @param int $status phpBB v3.x numeric forum status
     
    872877
    873878        /**
    874          * Translate the topic status from phpBB v3.x numeric's to WordPress's strings.
     879         * Translate the topic status from phpBB v3.x numerics to WordPress's strings.
    875880         *
    876881         * @param int $status phpBB v3.x numeric topic status
     
    892897
    893898        /**
    894          * Translate the topic sticky status type from phpBB 3.x numeric's to WordPress's strings.
     899         * Translate the topic sticky status type from phpBB 3.x numerics to WordPress's strings.
    895900         *
    896901         * @param int $status phpBB 3.x numeric forum type
     
    10181023
    10191024                // Parse out any bbCodes in $field with the BBCode 'parser.php'
    1020                 require_once bbpress()->admin->admin_dir . 'parser.php';
    1021                 $bbcode = BBCode::getInstance();
    1022                 $bbcode->enable_smileys = false;
    1023                 $bbcode->smiley_regex   = false;
    1024                 return html_entity_decode( $bbcode->Parse( $field ) );
     1025                return parent::callback_html( $field );
    10251026        }
    10261027}
  • trunk/src/includes/admin/converters/vBulletin.php

    r6573 r6670  
    2121         *
    2222         */
    23         function __construct() {
     23        public function __construct() {
    2424                parent::__construct();
    25                 $this->setup_globals();
    2625        }
    2726
     
    3029         */
    3130        private 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 *****************************************************/
     
    651656
    652657        /**
    653          * Translate the forum type from vBulletin v4.x numeric's to WordPress's strings.
     658         * Translate the forum type from vBulletin v4.x numerics to WordPress's strings.
    654659         *
    655660         * @param int $status vBulletin v4.x numeric forum type
     
    666671
    667672        /**
    668          * Translate the topic sticky status type from vBulletin v4.x numeric's to WordPress's strings.
     673         * Translate the topic sticky status type from vBulletin v4.x numerics to WordPress's strings.
    669674         *
    670675         * @param int $status vBulletin v4.x numeric forum type
     
    701706
    702707        /**
    703          * Translate the post status from vBulletin numeric's to WordPress's strings.
     708         * Translate the post status from vBulletin numerics to WordPress's strings.
    704709         *
    705710         * @param int $status vBulletin v4.x numeric topic status
     
    747752
    748753                // Parse out any bbCodes in $field with the BBCode 'parser.php'
    749                 require_once bbpress()->admin->admin_dir . 'parser.php';
    750                 $bbcode = BBCode::getInstance();
    751                 $bbcode->enable_smileys = false;
    752                 $bbcode->smiley_regex   = false;
    753                 return html_entity_decode( $bbcode->Parse( $field ) );
     754                return parent::callback_html( $field );
    754755        }
    755756}
  • trunk/src/includes/admin/converters/vBulletin3.php

    r6573 r6670  
    2121         *
    2222         */
    23         function __construct() {
     23        public function __construct() {
    2424                parent::__construct();
    25                 $this->setup_globals();
    2625        }
    2726
     
    3029         */
    3130        private 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 *****************************************************/
     
    655660
    656661        /**
    657          * Translate the forum type from vBulletin v3.x numeric's to WordPress's strings.
     662         * Translate the forum type from vBulletin v3.x numerics to WordPress's strings.
    658663         *
    659664         * @param int $status vBulletin v3.x numeric forum type
     
    670675
    671676        /**
    672          * Translate the topic sticky status type from vBulletin v3.x numeric's to WordPress's strings.
     677         * Translate the topic sticky status type from vBulletin v3.x numerics to WordPress's strings.
    673678         *
    674679         * @param int $status vBulletin v3.x numeric forum type
     
    701706
    702707        /**
    703          * Translate the post status from vBulletin v3.x numeric's to WordPress's strings.
     708         * Translate the post status from vBulletin v3.x numerics to WordPress's strings.
    704709         *
    705710         * @param int $status vBulletin v3.x numeric topic status
     
    745750
    746751                // Parse out any bbCodes in $field with the BBCode 'parser.php'
    747                 require_once bbpress()->admin->admin_dir . 'parser.php';
    748                 $bbcode = BBCode::getInstance();
    749                 $bbcode->enable_smileys = false;
    750                 $bbcode->smiley_regex   = false;
    751                 return html_entity_decode( $bbcode->Parse( $field ) );
     752                return parent::callback_html( $field );
    752753        }
    753754}
Note: See TracChangeset for help on using the changeset viewer.