WordPress.org

Ready to get started?Download WordPress

Forums

Blogger Importer
[resolved] Issue with SimplePie Santize (5 posts)

  1. Workshopshed
    Member
    Plugin Author

    Posted 1 year ago #

    I've spotted an issue in the version of SimplePie that's included in WordPress 3.5 in that the sanitizer is not getting set. The net result of this is that things like videos and objects are unintentionally stripped out of the content. There is also a change of syntax in that the "set_xxx_class" is depreciated in the this version of SimplePie.

    In the function import_blog($blogID) you will find the code that sets these classes.

    $feed = new SimplePie();
    $feed->set_item_class('WP_SimplePie_Blog_Item');
    $feed->set_sanitize_class('Blogger_Importer_Sanitize');
    $feed->set_raw_data($response);
    $feed->init();

    Replace this with:

    $feed = new SimplePie();
    $reg = $feed->get_registry();
    $reg->register('Sanitize','Blogger_Importer_Sanitize');
    $reg->register('Item','WP_SimplePie_Blog_Item');
    $feed->sanitize = $reg->create('Sanitize');
    $feed->set_raw_data($response);
    $feed->init();

    If you actually want the unitentionally behaviour or want to be even more agressive in filtering out the data you can add iframe and object to the list at the top of blogger-importer-sanitize.php

    http://wordpress.org/extend/plugins/blogger-importer/

  2. soundblob
    Member
    Posted 10 months ago #

    Maybe you can help me. I'm importing a blog from Blogger, the importer keeps stripping the embedded Youtube and Soundcloud.
    Is there something I can change in the SimplePie code that will allow this content to be imported.
    If so, could you tell me what to do? (I'm no expert with code)
    Thanks.

  3. Workshopshed
    Member
    Plugin Author

    Posted 10 months ago #

    I'm not aware of how Soundcloud does it's embedded files but the Youtube ones should not be stripped out in the latest beta version.

  4. soundblob
    Member
    Posted 10 months ago #

    Soundcloud uses iframes, so i imagine whatever works for Youtube should work for SC too. How would I go about getting the beta version? I have the standard Blogger importer plugin, and there is no option to update...
    Would I replace the blogger-importer-sanitize.php file with that beta version?
    Thanks

  5. Workshopshed
    Member
    Plugin Author

    Posted 10 months ago #

    It's over here.

    http://core.trac.wordpress.org/attachment/ticket/4010/blogger-importer.zip

    Unfortunately I don't have permissions to add it to SVN, it would be nice to put it in a branch

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic