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/admin-ajax.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/admin-ajax.php')
| -rw-r--r-- | wp-admin/admin-ajax.php | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/wp-admin/admin-ajax.php b/wp-admin/admin-ajax.php index 1bd5480..013e375 100644 --- a/wp-admin/admin-ajax.php +++ b/wp-admin/admin-ajax.php @@ -1,7 +1,6 @@ <?php require_once('../wp-config.php'); -require_once('admin-functions.php'); -require_once('admin-db.php'); +require_once('includes/admin.php'); define('DOING_AJAX', true); @@ -126,6 +125,28 @@ case 'add-category' : // On the Fly } $x->send(); break; +case 'add-link-category' : // On the Fly + if ( !current_user_can( 'manage_categories' ) ) + die('-1'); + $names = explode(',', $_POST['newcat']); + $x = new WP_Ajax_Response(); + foreach ( $names as $cat_name ) { + $cat_name = trim($cat_name); + if ( !$slug = sanitize_title($cat_name) ) + die('0'); + if ( !$cat_id = is_term( $cat_name, 'link_category' ) ) { + $cat_id = wp_insert_term( $cat_name, 'link_category' ); + $cat_id = $cat_id['term_id']; + } + $cat_name = wp_specialchars(stripslashes($cat_name)); + $x->add( array( + 'what' => 'link-category', + 'id' => $cat_id, + 'data' => "<li id='link-category-$cat_id'><label for='in-link-category-$cat_id' class='selectit'><input value='$cat_id' type='checkbox' checked='checked' name='link_category[]' id='in-link-category-$cat_id'/> $cat_name</label></li>" + ) ); + } + $x->send(); + break; case 'add-cat' : // From Manage->Categories if ( !current_user_can( 'manage_categories' ) ) die('-1'); @@ -183,8 +204,11 @@ case 'add-meta' : $now = current_time('timestamp', 1); if ( $pid = wp_insert_post( array( 'post_title' => sprintf('Draft created on %s at %s', date(get_option('date_format'), $now), date(get_option('time_format'), $now)) - ) ) ) + ) ) ) { + if ( is_wp_error( $pid ) ) + return $pid; $mid = add_meta( $pid ); + } else die('0'); } else if ( !$mid = add_meta( $id ) ) { |
