CoreFiles by mySites.guru
edit-form-ajax-cat.php37 lines, 734 bytes, from wordpress-2.0.4.zip
Raw History Compare with 2.0.1
md5
0aac64061660e65f515127087e4cd2a2
sha1
944f589c1214babf982ce77635ad39f752285350
sha256
55a60a0bcb76af81aa8f7089354c2945fa5d5ce597ae0b9dc94b1a574bd6dbd9
<?php
require_once('../wp-config.php');
require_once('admin-functions.php');
require_once('admin-db.php');

if ( !current_user_can('manage_categories') )
	die('-1');
if ( !check_ajax_referer() )
	die('-1');

function get_out_now() { exit; }

add_action('shutdown', 'get_out_now', -1);

$names = explode(',', rawurldecode($_POST['ajaxnewcat']) );
$ids   = array();

foreach ($names as $cat_name) {
	$cat_name = trim( $cat_name );
	
	if ( !$category_nicename = sanitize_title($cat_name) )
		continue;
	if ( $already = category_exists($cat_name) ) {
		$ids[] = (string) $already;
		continue;
	}
	
	$new_cat_id = wp_create_category($cat_name);
	
	$ids[] = (string) $new_cat_id;
}

$return = join(',', $ids);

die( (string) $return );

?>

The same content is in 24 releases, WordPress 2.0.4 to 2.0.11. See them all, or every version of this file.