-if ( ! empty($cat_ID) ) {
- $heading = __('Edit Category');
- $submit_text = __('Edit Category');
- $form = '<form name="editcat" id="editcat" method="post" action="categories.php" class="validate">';
- $action = 'editedcat';
- $nonce_action = 'update-category_' . $cat_ID;
- do_action('edit_category_form_pre', $category);
-} else {
- $heading = __('Add Category');
- $submit_text = __('Add Category');
- $form = '<form name="addcat" id="addcat" method="post" action="categories.php" class="add:the-list: validate">';
- $action = 'addcat';
- $nonce_action = 'add-category';
- do_action('add_category_form_pre', $category);
+/**
+ * Edit category form for inclusion in administration panels.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/**
+ * @var object
+ */
+if ( ! isset( $category ) )
+ $category = (object) array();
+
+/**
+ * @ignore
+ * @since 2.7
+ * @internal Used to prevent errors in page when no category is being edited.
+ *
+ * @param object $category
+ */
+function _fill_empty_category(&$category) {
+ if ( ! isset( $category->name ) )
+ $category->name = '';
+
+ if ( ! isset( $category->slug ) )
+ $category->slug = '';
+
+ if ( ! isset( $category->parent ) )
+ $category->parent = '';
+
+ if ( ! isset( $category->description ) )
+ $category->description = '';