Might fix some OPML imports but I'm pretty sure I just broke others.
git-svn-id: http://svn.automattic.com/wordpress/trunk@1099 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
ecdd48e62a
commit
8546d782a6
|
@ -32,7 +32,7 @@ switch ($step) {
|
|||
|
||||
<div class="wrap">
|
||||
|
||||
<h3>Import your blogroll from another system </h3>
|
||||
<h2>Import your blogroll from another system </h2>
|
||||
<!-- <form name="blogroll" action="link-import.php" method="get"> -->
|
||||
<form enctype="multipart/form-data" action="link-import.php" method="post" name="blogroll">
|
||||
|
||||
|
@ -86,7 +86,7 @@ switch ($step) {
|
|||
?>
|
||||
<div class="wrap">
|
||||
|
||||
<h3>Importing...</h3>
|
||||
<h2>Importing...</h2>
|
||||
<?php
|
||||
$cat_id = $HTTP_POST_VARS['cat_id'];
|
||||
if (($cat_id == '') || ($cat_id == 0)) {
|
||||
|
@ -122,8 +122,8 @@ switch ($step) {
|
|||
$titles[$i] = '';
|
||||
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)
|
||||
VALUES('{$urls[$i]}', '".addslashes($names[$i])."', '', $cat_id, '".addslashes($descriptions[$i])."', $user_ID)\n";
|
||||
$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";
|
||||
$result = $wpdb->query($query);
|
||||
echo "<p>Inserted <strong>{$names[$i]}</strong></p>";
|
||||
}
|
||||
|
|
|
@ -6,11 +6,14 @@ require_once(ABSPATH.WPINC.'/functions.php');
|
|||
// 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_name' => 'TEXT',
|
||||
'link_target' => 'TARGET',
|
||||
'link_description' => 'DESCRIPTION'
|
||||
);
|
||||
'link_url' => 'URL',
|
||||
'link_url' => 'HTMLURL',
|
||||
'link_name' => 'TEXT',
|
||||
'link_name' => 'TITLE',
|
||||
'link_target' => 'TARGET',
|
||||
'link_description' => 'DESCRIPTION',
|
||||
'link_rss' => 'XMLURL'
|
||||
);
|
||||
|
||||
$map = $opml_map;
|
||||
|
||||
|
@ -20,7 +23,7 @@ $map = $opml_map;
|
|||
**/
|
||||
function startElement($parser, $tagName, $attrs) {
|
||||
global $updated_timestamp, $all_links, $map;
|
||||
global $names, $urls, $targets, $descriptions;
|
||||
global $names, $urls, $targets, $descriptions, $feeds;
|
||||
|
||||
if ($tagName == 'OUTLINE') {
|
||||
if ($map['link_url'] != '')
|
||||
|
@ -31,11 +34,14 @@ function startElement($parser, $tagName, $attrs) {
|
|||
$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']];
|
||||
//echo("got data: link_url = [$link_url], link_name = [$link_name], link_target = [$link_target], link_description = [$link_description]<br />\n");
|
||||
// save the data away.
|
||||
$names[] = $link_name;
|
||||
$urls[] = $link_url;
|
||||
$targets[] = $link_target;
|
||||
$feeds[] = $link_rss;
|
||||
$descriptions[] = $link_description;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue