diff options
| author | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2007-10-12 16:21:15 +0000 |
|---|---|---|
| committer | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2007-10-12 16:21:15 +0000 |
| commit | 3a4570b0fc8b3d6339bef71d17d7701554e0bbf7 (patch) | |
| tree | 2a06e5261263c68d8afd95a6328879dc289cb909 /wp-admin/includes/import.php | |
| parent | b83c34a7010faee0223f6037025c350da12e05e6 (diff) | |
| download | wordpress-mu-3a4570b0fc8b3d6339bef71d17d7701554e0bbf7.tar.gz wordpress-mu-3a4570b0fc8b3d6339bef71d17d7701554e0bbf7.tar.xz wordpress-mu-3a4570b0fc8b3d6339bef71d17d7701554e0bbf7.zip | |
Merge with WP 2.3 - testing use only!
Move pluggable functions out of wpmu-functions and into pluggable.php, fixes #439
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@1069 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-admin/includes/import.php')
| -rw-r--r-- | wp-admin/includes/import.php | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/wp-admin/includes/import.php b/wp-admin/includes/import.php new file mode 100644 index 0000000..9835bb1 --- /dev/null +++ b/wp-admin/includes/import.php @@ -0,0 +1,45 @@ +<?php + +function get_importers() { + global $wp_importers; + uasort($wp_importers, create_function('$a, $b', 'return strcmp($a[0], $b[0]);')); + return $wp_importers; +} + +function register_importer( $id, $name, $description, $callback ) { + global $wp_importers; + if ( is_wp_error( $callback ) ) + return $callback; + $wp_importers[$id] = array ( $name, $description, $callback ); +} + +function wp_import_cleanup( $id ) { + wp_delete_attachment( $id ); +} + +function wp_import_handle_upload() { + $overrides = array( 'test_form' => false, 'test_type' => false ); + $file = wp_handle_upload( $_FILES['import'], $overrides ); + + if ( isset( $file['error'] ) ) + return $file; + + $url = $file['url']; + $type = $file['type']; + $file = addslashes( $file['file'] ); + $filename = basename( $file ); + + // Construct the object array + $object = array( 'post_title' => $filename, + 'post_content' => $url, + 'post_mime_type' => $type, + 'guid' => $url + ); + + // Save the data + $id = wp_insert_attachment( $object, $file ); + + return array( 'file' => $file, 'id' => $id ); +} + +?> |
