Changeset 6303 for trunk/wp-admin/admin-ajax.php
- Timestamp:
- 11/01/2007 06:23:16 AM (19 years ago)
- File:
-
- 1 edited
-
trunk/wp-admin/admin-ajax.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/admin-ajax.php
r6299 r6303 148 148 foreach ( $names as $cat_name ) { 149 149 $cat_name = trim($cat_name); 150 if ( !$category_nicename = sanitize_title($cat_name) )151 die('0');152 if ( !$cat_id = category_exists( $cat_name ) )153 $cat_id = wp_create_category( $cat_name );150 $category_nicename = sanitize_title($cat_name); 151 if ( '' === $category_nicename ) 152 continue; 153 $cat_id = wp_create_category( $cat_name ); 154 154 $cat_name = wp_specialchars(stripslashes($cat_name)); 155 155 $x->add( array( … … 170 170 foreach ( $names as $cat_name ) { 171 171 $cat_name = trim($cat_name); 172 if ( !$slug = sanitize_title($cat_name) ) 173 die('0'); 172 $slug = sanitize_title($cat_name); 173 if ( '' === $slug ) 174 continue; 174 175 if ( !$cat_id = is_term( $cat_name, 'link_category' ) ) { 175 176 $cat_id = wp_insert_term( $cat_name, 'link_category' ); … … 190 191 if ( !current_user_can( 'manage_categories' ) ) 191 192 die('-1'); 193 194 if ( '' === trim($_POST['cat_name']) ) { 195 $x = new WP_Ajax_Response( array( 196 'what' => 'cat', 197 'id' => new WP_Error( 'cat_name', __('You did not enter a category name.') ) 198 ) ); 199 $x->send(); 200 } 201 192 202 if ( !$cat = wp_insert_category( $_POST ) ) 193 203 die('0'); … … 216 226 if ( !current_user_can( 'manage_categories' ) ) 217 227 die('-1'); 228 229 if ( '' === trim($_POST['name']) ) { 230 $x = new WP_Ajax_Response( array( 231 'what' => 'link-cat', 232 'id' => new WP_Error( 'name', __('You did not enter a category name.') ) 233 ) ); 234 $x->send(); 235 } 218 236 219 237 $r = wp_insert_term($_POST['name'], 'link_category', $_POST ); … … 271 289 if ( !current_user_can( 'edit_post', $pid ) ) 272 290 die('-1'); 291 if ( '#NONE#' == $_POST['metakeyselect'] && empty($_POST['metakeyinput']) ) 292 die('1'); 273 293 if ( $pid < 0 ) { 274 294 $now = current_time('timestamp', 1); … … 335 355 die('0'); 336 356 elseif ( is_wp_error( $user_id ) ) { 337 foreach( $user_id->get_error_messages() as $message ) 338 echo "<p>$message<p>"; 339 exit; 357 $x = new WP_Ajax_Response( array( 358 'what' => 'user', 359 'id' => $user_id 360 ) ); 361 $x->send(); 340 362 } 341 363 $user_object = new WP_User( $user_id );
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)