Support » Installing WordPress » Importing Blogrolling OPML Bug?

  • 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.
    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 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.

Viewing 3 replies - 1 through 3 (of 3 total)
  • PS: the ” \ ” stands for a backslash in the above post

    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];

    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?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Importing Blogrolling OPML Bug?’ is closed to new replies.