diff --git a/wp-admin/link-import.php b/wp-admin/link-import.php index 2396e625c6..cc359814cc 100644 --- a/wp-admin/link-import.php +++ b/wp-admin/link-import.php @@ -123,7 +123,7 @@ switch ($step) { if ('http' == substr($titles[$i], 0, 4)) $titles[$i] = ''; $query = "INSERT INTO $tablelinks (link_url, link_name, link_target, link_category, link_description, link_owner, link_rss) - VALUES('{$urls[$i]}', '".addslashes($names[$i])."', '', $cat_id, '".addslashes($descriptions[$i])."', $user_ID, {$feeds[$i]})\n"; + VALUES('{$urls[$i]}', '".addslashes($names[$i])."', '', $cat_id, '".addslashes($descriptions[$i])."', $user_ID, '{$feeds[$i]}')\n"; $result = $wpdb->query($query); echo "
Inserted {$names[$i]}
"; } diff --git a/wp-admin/link-parse-opml.php b/wp-admin/link-parse-opml.php index 7adbafd3ff..e40d37abae 100644 --- a/wp-admin/link-parse-opml.php +++ b/wp-admin/link-parse-opml.php @@ -4,15 +4,13 @@ require_once(ABSPATH.WPINC.'/functions.php'); // columns we wish to find are: link_url, link_name, link_target, link_description // we need to map XML attribute names to our columns -// if we are doing OPML use this map -$opml_map = array( -'link_url' => 'URL', -'link_url' => 'HTMLURL', -'link_name' => 'TEXT', -'link_name' => 'TITLE', -'link_target' => 'TARGET', -'link_description' => 'DESCRIPTION', -'link_rss' => 'XMLURL' +$opml_map = array('URL' => 'link_url', + 'HTMLURL' => 'link_url', + 'TEXT' => 'link_name', + 'TITLE' => 'link_name', + 'TARGET' => 'link_target', + 'DESCRIPTION' => 'link_description', + 'XMLURL' => 'link_rss' ); $map = $opml_map; @@ -26,24 +24,21 @@ function startElement($parser, $tagName, $attrs) { global $names, $urls, $targets, $descriptions, $feeds; if ($tagName == 'OUTLINE') { - if ($map['link_url'] != '') - $link_url = $attrs[$map['link_url']]; - if ($map['link_name'] != '') - $link_name = $attrs[$map['link_name']]; - if ($map['link_target'] != '') - $link_target = $attrs[$map['link_target']]; - if ($map['link_description'] != '') - $link_description = $attrs[$map['link_description']]; - if ($map['link_rss'] != '') - $link_rss = $attrs[$map['link_rss']]; + foreach (array_keys($map) as $key) { + if (isset($attrs[$key])) { + $$map[$key] = $attrs[$key]; + } + } + //echo("got data: link_url = [$link_url], link_name = [$link_name], link_target = [$link_target], link_description = [$link_description]