/** * AJAX callback to create a secret URL for the system info. * * @access private * @since 8.3 * @static */ public static function generateSystemInfoURL() { if (!check_ajax_referer('generate_remote_system_info_url', FALSE, FALSE)) { wp_send_json_error(__('Invalid AJAX action or nonce validation failed.', 'connections')); } if (!current_user_can('manage_options')) { wp_send_json_error(__('You do not have sufficient permissions to perform this action.', 'connections')); } /** @todo need to check the $token is not WP_Error. */ $token = cnString::random(32); $expires = apply_filters('cn_system_info_remote_token_expire', DAY_IN_SECONDS * 3); cnCache::set('system_info_remote_token', $token, $expires, 'option-cache'); $url = home_url() . '/?cn-system-info=' . $token; wp_send_json_success(array('url' => $url, 'message' => __('Secret URL has been created.', 'connections'))); }