Пример #1
0
     if (!current_user_can('edit_post', $comment_post_ID)) {
         die('-1');
     }
     if ('' == $_POST['content']) {
         die(__('Error: please type a comment.'));
     }
     $comment_id = (int) $_POST['comment_ID'];
     $_POST['comment_status'] = $_POST['status'];
     edit_comment();
     $position = isset($_POST['position']) && (int) $_POST['position'] ? (int) $_POST['position'] : '-1';
     $checkbox = isset($_POST['checkbox']) && true == $_POST['checkbox'] ? 1 : 0;
     $comments_listing = isset($_POST['comments_listing']) ? $_POST['comments_listing'] : '';
     require_once './includes/default-list-tables.php';
     $wp_list_table = new WP_Comments_Table();
     ob_start();
     $wp_list_table->single_row($comment_id, $mode, $comments_listing, $checkbox);
     $comment_list_item = ob_get_contents();
     ob_end_clean();
     $x = new WP_Ajax_Response();
     $x->add(array('what' => 'edit_comment', 'id' => $comment->comment_ID, 'data' => $comment_list_item, 'position' => $position));
     $x->send();
     break;
 case 'add-menu-item':
     if (!current_user_can('edit_theme_options')) {
         die('-1');
     }
     check_ajax_referer('add-menu_item', 'menu-settings-column-nonce');
     require_once ABSPATH . 'wp-admin/includes/nav-menu.php';
     $item_ids = wp_save_nav_menu_items(0, $_POST['menu-item']);
     if (is_wp_error($item_ids)) {
         die('-1');