X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/76aea3697c6043c1613370f172395b4f65ee71f0..11be8dc178e77d0b46189bbd8e33a216a9b90942:/wp-admin/import/opml.php diff --git a/wp-admin/import/opml.php b/wp-admin/import/opml.php new file mode 100644 index 00000000..8148acf6 --- /dev/null +++ b/wp-admin/import/opml.php @@ -0,0 +1,155 @@ + + * @author Mike Little + * @package WordPress + * @subpackage Administration + */ + +/** Load WordPress Administration Bootstrap */ +$parent_file = 'tools.php'; +$submenu_file = 'import.php'; +$title = __('Import Blogroll'); + +class OPML_Import { + + function dispatch() { + global $wpdb, $user_ID; +$step = $_POST['step']; +if (!$step) $step = 0; +?> + + +
+ +

+
+ + +

+
+ + +
+

+ +
+ +
+

+ +
+ +
+ +


+

+ +

+
+ +
+ +
+ +

+ false, 'test_type' => false); + $file = wp_handle_upload($_FILES['userfile'], $overrides); + + if ( isset($file['error']) ) + wp_die($file['error']); + + $url = $file['url']; + $opml_url = $file['file']; + $blogrolling = false; + } + + global $opml, $updated_timestamp, $all_links, $map, $names, $urls, $targets, $descriptions, $feeds; + if ( isset($opml_url) && $opml_url != '' ) { + if ( $blogrolling === true ) { + $opml = wp_remote_fopen($opml_url); + } else { + $opml = file_get_contents($opml_url); + } + + /** Load OPML Parser */ + include_once('link-parse-opml.php'); + + $link_count = count($names); + for ( $i = 0; $i < $link_count; $i++ ) { + if ('Last' == substr($titles[$i], 0, 4)) + $titles[$i] = ''; + if ( 'http' == substr($titles[$i], 0, 4) ) + $titles[$i] = ''; + $link = array( 'link_url' => $urls[$i], 'link_name' => $wpdb->escape($names[$i]), 'link_category' => array($cat_id), 'link_description' => $wpdb->escape($descriptions[$i]), 'link_owner' => $user_ID, 'link_rss' => $feeds[$i]); + wp_insert_link($link); + echo sprintf('

'.__('Inserted %s').'

', $names[$i]); + } +?> + +

manage those links.'), $link_count, $cat_id, 'link-manager.php') ?>

+ +" . __("You need to supply your OPML url. Press back on your browser and try again") . "

\n"; +} // end else + +if ( ! $blogrolling ) + do_action( 'wp_delete_file', $opml_url); + @unlink($opml_url); +?> +
+