Skip to:
Content

bbPress.org

Ticket #1874: 1874.diff

File 1874.diff, 2.1 KB (added by netweb, 12 years ago)
  • bbPress/admin/converters/bbPress1.php

    diff --git a/bbPress/admin/converters/bbPress1.php b/bbPress/admin/converters/bbPress1.php
    index d54481c..07d69ff 100644
    a b class bbPress1 extends BBP_Converter_Base { 
    192192                        'join_expression' => 'USING (topic_id) WHERE posts.post_position IN (0,1)',
    193193                        'to_type'         => 'topic',
    194194                        'to_fieldname'    => 'post_content',
    195                         'callback_method' => 'callback_html'
     195                        'callback_method' => 'callback_html_bbpress1'
    196196                );
    197197
    198198                // Topic status.
    class bbPress1 extends BBP_Converter_Base { 
    365365                        'from_fieldname'  => 'post_text',
    366366                        'to_type'         => 'reply',
    367367                        'to_fieldname'    => 'post_content',
    368                         'callback_method' => 'callback_html'
     368                        'callback_method' => 'callback_html_bbpress1'
    369369                );
    370370
    371371                // Reply order.
    class bbPress1 extends BBP_Converter_Base { 
    477477                        'to_fieldname'   => 'user_status'
    478478                );
    479479
    480                 // User status.
     480                // User display name.
    481481                $this->field_map[] = array(
    482482                        'from_tablename' => 'users',
    483483                        'from_fieldname' => 'display_name',
    class bbPress1 extends BBP_Converter_Base { 
    557557        public function authenticate_pass( $password, $serialized_pass ) {
    558558                return false;
    559559        }
     560
     561        /**
     562         * This callback processes any custom parser.php attributes and custom code with preg_replace
     563         */
     564        protected function callback_html_bbpress1( $field ) {
     565
     566                $bbpress1_markup = $field;
     567                $bbpress1_markup = html_entity_decode ( $bbpress1_markup );
     568
     569                // Replace [b:XXXXXXX]' with '<strong>'
     570                // $bbpress1_markup = preg_replace ( '/\[b:(.*?)\]/'   , '<strong>'  , $bbpress1_markup );
     571                // Replace [/b:XXXXXXX]' with '</strong>'
     572                // $bbpress1_markup = preg_replace ( '/\[\/b:(.*?)\]/' , '</strong>' , $bbpress1_markup );
     573
     574                $field = $bbpress1_markup;
     575
     576                require_once( bbpress()->admin->admin_dir . 'parser.php' );
     577                $bbcode = BBCode::getInstance();
     578                $bbcode->enable_smileys = false;
     579                $bbcode->smiley_regex   = false;
     580                return html_entity_decode( $bbcode->Parse( $field ) );
     581        }
    560582}