当前位置: 首页>>代码示例>>PHP>>正文


PHP _wp_ajax_delete_comment_response函数代码示例

本文整理汇总了PHP中_wp_ajax_delete_comment_response函数的典型用法代码示例。如果您正苦于以下问题:PHP _wp_ajax_delete_comment_response函数的具体用法?PHP _wp_ajax_delete_comment_response怎么用?PHP _wp_ajax_delete_comment_response使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了_wp_ajax_delete_comment_response函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: wp_ajax_dim_comment

/**
 * Ajax handler to dim a comment.
 *
 * @since 3.1.0
 */
function wp_ajax_dim_comment()
{
    $id = isset($_POST['id']) ? (int) $_POST['id'] : 0;
    if (!($comment = get_comment($id))) {
        $x = new WP_Ajax_Response(array('what' => 'comment', 'id' => new WP_Error('invalid_comment', sprintf(__('Comment %d does not exist'), $id))));
        $x->send();
    }
    if (!current_user_can('edit_comment', $comment->comment_ID) && !current_user_can('moderate_comments')) {
        wp_die(-1);
    }
    $current = wp_get_comment_status($comment);
    if (isset($_POST['new']) && $_POST['new'] == $current) {
        wp_die(time());
    }
    check_ajax_referer("approve-comment_{$id}");
    if (in_array($current, array('unapproved', 'spam'))) {
        $result = wp_set_comment_status($comment, 'approve', true);
    } else {
        $result = wp_set_comment_status($comment, 'hold', true);
    }
    if (is_wp_error($result)) {
        $x = new WP_Ajax_Response(array('what' => 'comment', 'id' => $result));
        $x->send();
    }
    // Decide if we need to send back '1' or a more complicated response including page links and comment counts
    _wp_ajax_delete_comment_response($comment->comment_ID);
    wp_die(0);
}
开发者ID:hughnet,项目名称:WordPress,代码行数:33,代码来源:ajax-actions.php

示例2: wp_get_comment_status

     $current = wp_get_comment_status($comment->comment_ID);
     if ($_POST['new'] == $current) {
         die((string) time());
     }
     check_ajax_referer("approve-comment_{$id}");
     if (in_array($current, array('unapproved', 'spam'))) {
         $result = wp_set_comment_status($comment->comment_ID, 'approve', true);
     } else {
         $result = wp_set_comment_status($comment->comment_ID, 'hold', true);
     }
     if (is_wp_error($result)) {
         $x = new WP_Ajax_Response(array('what' => 'comment', 'id' => $result));
         $x->send();
     }
     // Decide if we need to send back '1' or a more complicated response including page links and comment counts
     _wp_ajax_delete_comment_response($comment->comment_ID);
     die('0');
     break;
 case 'add-category':
     // On the Fly
     check_ajax_referer($action);
     if (!current_user_can('manage_categories')) {
         die('-1');
     }
     $names = explode(',', $_POST['newcat']);
     if (0 > ($parent = (int) $_POST['newcat_parent'])) {
         $parent = 0;
     }
     $post_category = isset($_POST['post_category']) ? (array) $_POST['post_category'] : array();
     $checked_categories = array_map('absint', (array) $post_category);
     $popular_ids = wp_popular_terms_checklist('category', 0, 10, false);
开发者ID:nagyist,项目名称:laura-wordpress,代码行数:31,代码来源:admin-ajax.php


注:本文中的_wp_ajax_delete_comment_response函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。