WordPress.org

Ready to get started?Download WordPress

Forums

Importing Blogrolling OPML Bug? (4 posts)

  1. Laughinglizard
    Member
    Posted 10 years ago #

    I ran into some problems importing from BlogRolling OPML code into WordPress 0.72. I took a very quick look and realized that the regular expressions dont match the OPML. I made some changes to WordPress and if this is a redundant post, please correct me and/or delete this post. Hope this helps someone.
    Steps:
    1) Look for links.import.php in the wp-admin folder.
    2) Around line 108, replace the preg_match_all('/<outline..... with
    preg_match_all('/<outline text="(.*?)" type="(.*?)" url="(.*?)" lastmod="(.*?)" target="(.*?)"*? \/>/',$opml,$items);
    PS: Links in your BlogRoll which have never notified Blogrolling.com of updates will not transfer over with this script. (the way it stands now) My reg-ex knowledge is years old and I havent spent enough time fixing it. But basically, the "lastmod" item does not show up for those links that have never been updated and so those lines do not match the regular expression and gets left out. If I consider those to be optional through my expression, the code breaks because it keeps track of these items in an array which is dynamically generated.

  2. Laughinglizard
    Member
    Posted 10 years ago #

    PS: the " \ " stands for a backslash in the above post

  3. Rantor
    Member
    Posted 10 years ago #

    This version will accept links with or without the lastmod field, but you need to change the array indices to match.
    preg_match_all('/<outline text="(.*?)" type="(.*?)" url="(.*?)" (lastmod="(.*?)"|) target="(.*?)"*? \/>/',$opml,$items);
    $names = $items[1];
    $types = $items[2];
    $urls = $items[3];
    $titles = $items[5];
    $targets = $items[6];

  4. Mike Little
    Member
    Posted 10 years ago #

    Hi Rantor,
    Thanks for this, it is now checked in to CVS andwill be in the next release.
    I wonder when they changed the format?
    Mike

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.