AnsPress_Admin_Ajax::anspress_recount()
Description #
Ajax callback for performing recount actions.
Source #
File: admin/ajax.php
public static function anspress_recount() {
check_ajax_referer( 'recount', '__nonce' );
// Check if user have permission to do this action.
if ( ! current_user_can( 'manage_options' ) ) {
wp_send_json( [
'error' => true,
] );
}
$sub_action = ap_sanitize_unslash( 'sub_action', 'r', '' );
$current = (int) ap_sanitize_unslash( 'current', 'r', 0 );
$offset = 50 * $current;
$method_name = 'recount_' . $sub_action;
if ( ! empty( $sub_action ) && method_exists( __CLASS__, $method_name ) ) {
self::$method_name( $current, $offset );
}
wp_send_json( [
'error' => true,
] );
}
Expand full source code Collapse full source code View on GitHub: admin/ajax.php:277
Add your comment