| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) { |
| 3 |
exit; // Exit if accessed directly |
| 4 |
} |
| 5 |
|
| 6 |
global $current_user; |
| 7 |
if (!($current_user->ID && $current_user->has_cap('manage_options'))) {exit;} |
| 8 |
|
| 9 |
$cat_id = isset($_POST) && isset($_POST['cat_id']) ? intval($_POST['cat_id']) : 0; |
| 10 |
if (!$cat_id) {exit;} |
| 11 |
|
| 12 |
$category = get_term_by('id', $cat_id, 'wpsc_categories'); |
| 13 |
|
| 14 |
ob_start(); |
| 15 |
?> |
| 16 |
<div class="form-group"> |
| 17 |
<label for="wpsc_cat_name"><?php _e('Category Name','supportcandy');?></label> |
| 18 |
<p class="help-block"><?php _e('Insert category name.','supportcandy');?></p> |
| 19 |
<input id="wpsc_cat_name" class="form-control" name="wpsc_cat_name" value="<?php echo esc_attr($category->name);?>" /> |
| 20 |
</div> |
| 21 |
<?php |
| 22 |
$body = ob_get_clean(); |
| 23 |
ob_start(); |
| 24 |
?> |
| 25 |
<button type="button" class="btn wpsc_popup_close" onclick="wpsc_modal_close();"><?php _e('Close','supportcandy');?></button> |
| 26 |
<button type="button" class="btn wpsc_popup_action" onclick="wpsc_set_edit_category(<?php echo esc_attr($cat_id)?>);"><?php _e('Save Changes','supportcandy');?></button> |
| 27 |
<?php |
| 28 |
$footer = ob_get_clean(); |
| 29 |
|
| 30 |
$output = array( |
| 31 |
'body' => $body, |
| 32 |
'footer' => $footer |
| 33 |
); |
| 34 |
|
| 35 |
wp_send_json($output); |
| 36 |
|