Skip to:
Content

bbPress.org


Ignore:
Timestamp:
11/08/2013 04:27:29 AM (7 years ago)
Author:
netweb
Message:

SimplePress Importer Improvements. Props netweb. Fixes #2194

  • Add reply slug field mapping
  • Add custom regex for non-break spaces in HTML
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/includes/admin/converters/SimplePress5.php

    r4824 r5151  
    2424    public function setup_globals() {
    2525
    26         /** Forum Section ******************************************************/
     26        /** Forum Section *****************************************************/
    2727
    2828        // Forum id (Stored in postmeta)
     
    130130        );
    131131
    132         /** Topic Section ******************************************************/
     132        /** Topic Section *****************************************************/
    133133
    134134        // Topic id (Stored in postmeta)
     
    309309            'to_fieldname'    => 'post_title',
    310310            'callback_method' => 'callback_reply_title'
     311        );
     312
     313        // Reply slug (Clean name to avoid conflicts)
     314        // Note: We join the sftopics table because sfposts table does not include topic title.
     315        $this->field_map[] = array(
     316            'from_tablename'  => 'sftopics',
     317            'from_fieldname'  => 'topic_name',
     318            'join_tablename'  => 'sfposts',
     319            'join_type'       => 'LEFT',
     320            'join_expression' => 'USING (topic_id) WHERE sfposts.post_index != 1',
     321            'to_type'         => 'reply',
     322            'to_fieldname'    => 'post_name',
     323            'callback_method' => 'callback_slug'
    311324        );
    312325
     
    525538        $simplepress_markup = preg_replace ( '/\<strong\>(.*?)\ said\ \<\/strong\>/',     '@$1 said:',        $simplepress_markup );
    526539
     540        // Replace '<p>&nbsp;</p>' with '<p>&nbsp;</p>'
     541        $simplepress_markup = preg_replace ( '/\n(&nbsp;|[\s\p{Z}\xA0\x{00A0}]+)\r/', '<br>', $simplepress_markup );
     542
    527543        // Now that SimplePress' custom HTML codes have been stripped put the cleaned HTML back in $field
    528544        $field = $simplepress_markup;
Note: See TracChangeset for help on using the changeset viewer.