2005-11-12 23:40:18 -05:00
|
|
|
<?php
|
|
|
|
require_once('../wp-config.php');
|
|
|
|
require_once('admin-functions.php');
|
|
|
|
require_once('admin-db.php');
|
|
|
|
|
|
|
|
if ( !current_user_can('manage_categories') )
|
|
|
|
die('-1');
|
|
|
|
|
|
|
|
function get_out_now() { exit; }
|
|
|
|
|
|
|
|
add_action('shutdown', 'get_out_now', -1);
|
|
|
|
|
2005-11-17 05:23:35 -05:00
|
|
|
$names = explode(',', rawurldecode($_GET['ajaxnewcat']) );
|
|
|
|
$ids = array();
|
2005-11-12 23:40:18 -05:00
|
|
|
|
2005-11-17 05:23:35 -05:00
|
|
|
foreach ($names as $cat_name) {
|
|
|
|
$cat_name = trim( $cat_name );
|
2006-02-12 02:53:23 -05:00
|
|
|
|
2005-11-17 05:23:35 -05:00
|
|
|
if ( !$category_nicename = sanitize_title($cat_name) )
|
|
|
|
continue;
|
|
|
|
if ( $already = category_exists($cat_name) ) {
|
|
|
|
$ids[] = (string) $already;
|
|
|
|
continue;
|
|
|
|
}
|
2006-02-12 02:53:23 -05:00
|
|
|
|
2005-11-17 05:23:35 -05:00
|
|
|
$new_cat_id = wp_create_category($cat_name);
|
2006-02-12 02:53:23 -05:00
|
|
|
|
2005-11-17 05:23:35 -05:00
|
|
|
$ids[] = (string) $new_cat_id;
|
|
|
|
}
|
2005-11-12 23:40:18 -05:00
|
|
|
|
2005-11-17 05:23:35 -05:00
|
|
|
$return = join(',', $ids);
|
|
|
|
|
|
|
|
die( (string) $return );
|
|
|
|
|
|
|
|
?>
|