本文整理汇总了PHP中WP_Ajax_Response::add方法的典型用法代码示例。如果您正苦于以下问题:PHP WP_Ajax_Response::add方法的具体用法?PHP WP_Ajax_Response::add怎么用?PHP WP_Ajax_Response::add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WP_Ajax_Response
的用法示例。
在下文中一共展示了WP_Ajax_Response::add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
/**
* Upload
* Ajax callback function
*
* @return string Error or (XML-)response
*/
static function handle_upload()
{
check_admin_referer('rwmb-upload-images_' . $_REQUEST['field_id']);
$post_id = 0;
if (is_numeric($_REQUEST['post_id'])) {
$post_id = (int) $_REQUEST['post_id'];
}
// You can use WP's wp_handle_upload() function:
$file = $_FILES['async-upload'];
$file_attr = wp_handle_upload($file, array('test_form' => true, 'action' => 'plupload_image_upload'));
$attachment = array('guid' => $file_attr['url'], 'post_mime_type' => $file_attr['type'], 'post_title' => preg_replace('/\\.[^.]+$/', '', basename($file['name'])), 'post_content' => '', 'post_status' => 'inherit');
// Adds file as attachment to WordPress
$id = wp_insert_attachment($attachment, $file_attr['file'], $post_id);
if (!is_wp_error($id)) {
wp_update_attachment_metadata($id, wp_generate_attachment_metadata($id, $file_attr['file']));
// Save file ID in meta field
if (isset($_REQUEST['field_id'])) {
add_post_meta($post_id, $_REQUEST['field_id'], $id, false);
}
$response = new WP_Ajax_Response();
$response->add(array('what' => 'rwmb_image_response', 'data' => self::img_html($id)));
$response->send();
}
exit;
}
示例2: header
/**
* Upload
* Ajax callback function
*
* @return error or (XML-)response
*/
static function handle_upload()
{
header('Content-Type: text/html; charset=UTF-8');
if (!defined('DOING_AJAX')) {
define('DOING_AJAX', true);
}
check_ajax_referer('plupload_image');
$post_id = 0;
if (is_numeric($_REQUEST['post_id'])) {
$post_id = (int) $_REQUEST['post_id'];
}
// you can use WP's wp_handle_upload() function:
$file = $_FILES['async-upload'];
$file_attr = wp_handle_upload($file, array('test_form' => true, 'action' => 'plupload_image_upload'));
$attachment = array('post_mime_type' => $file_attr['type'], 'post_title' => preg_replace('/\\.[^.]+$/', '', basename($file['name'])), 'post_content' => '', 'post_status' => 'inherit');
// Adds file as attachment to WordPress
$id = wp_insert_attachment($attachment, $file_attr['file'], $post_id);
if (!is_wp_error($id)) {
$response = new WP_Ajax_Response();
wp_update_attachment_metadata($id, wp_generate_attachment_metadata($id, $file_attr['file']));
if (isset($_REQUEST['field_id'])) {
// Save file ID in meta field
add_post_meta($post_id, $_REQUEST['field_id'], $id, false);
}
$response->add(array('what' => 'rwmb_image_response', 'data' => self::img_html($id)));
$response->send();
}
// faster than die();
exit;
}
示例3: cherry_plugin_export_content
function cherry_plugin_export_content()
{
$exclude_files = array('xml', 'json');
/**
* Filters folders to exclude from export parser
* @var array
*/
$exclude_folder = apply_filters('cherry_export_exclude_folders', array('woocommerce_uploads', 'wc-logs'));
$response = array('what' => 'status', 'action' => 'export_content', 'id' => '1', 'data' => __('Export content done', CHERRY_PLUGIN_DOMAIN));
$response_file = array('what' => 'file', 'action' => 'export_content', 'id' => '2');
$zip_name = UPLOAD_BASE_DIR . '/sample_data.zip';
cherry_plugin_delete_file($zip_name);
if (is_dir(UPLOAD_BASE_DIR)) {
$file_string = cherry_plugin_scan_dir(UPLOAD_BASE_DIR, $exclude_folder, $exclude_files);
}
$zip = new PclZip($zip_name);
$result = $zip->create($file_string, PCLZIP_OPT_REMOVE_ALL_PATH);
//export json
$json_file = cherry_plugin_export_json();
if (is_wp_error($json_file)) {
$response['data'] = "Error : " . $json_file->get_error_message();
} else {
$zip->add($json_file, PCLZIP_OPT_REMOVE_ALL_PATH);
cherry_plugin_delete_file($json_file);
}
//export xml
$xml_file = cherry_plugin_export_xml();
if (is_wp_error($xml_file)) {
$response['data'] = "Error : " . $xml_file->get_error_message();
} else {
$zip->add($xml_file, PCLZIP_OPT_REMOVE_ALL_PATH);
cherry_plugin_delete_file($xml_file);
}
$nonce = wp_create_nonce('cherry_plugin_download_content');
$file_url = add_query_arg(array('action' => 'cherry_plugin_get_export_file', 'file' => $zip_name, '_wpnonce' => $nonce), admin_url('admin-ajax.php'));
if ($result == 0) {
$response['data'] = "Error : " . $zip->errorInfo(true);
} else {
$response_file['data'] = $file_url;
}
$xmlResponse = new WP_Ajax_Response($response);
$xmlResponse->add($response_file);
$xmlResponse->send();
exit;
}
示例4: edd_dwqa_categories_created_edd_term
function edd_dwqa_categories_created_edd_term($term_id, $tt_id, $taxonomy)
{
$term = get_term_by('id', $term_id, $taxonomy);
if (!empty($term) && $term->parent == 0 && $taxonomy == 'download_category') {
$tag = wp_insert_term($term->name, 'dwqa-question_category', $_POST);
if (!$tag || is_wp_error($tag)) {
// || (!$tag = get_term( $tag['term_id'], $taxonomy ))
$message = __('An error has occurred. DW Q&A category could not be added!', 'edd_dwqa_categories');
if (is_wp_error($tag) && $tag->get_error_message()) {
$message = $tag->get_error_message();
}
$x = new WP_Ajax_Response();
$x->add(array('what' => 'taxonomy', 'data' => new WP_Error('error', $message)));
$x->send();
} else {
//global $wpdb;
//$wpdb->query( $wpdb->prepare("INSERT INTO ".$wpdb->prefix."js_dwqa_categories (id, dwqa_category_id, edd_product_id, edd_category_id) VALUES ('', %d, '', %d)", $tag->term_id, $term_id) );
}
}
}
示例5: cherry_plugin_export_content
function cherry_plugin_export_content()
{
$exclude_files = array('xml', 'json');
$exclude_folder = array('woocommerce_uploads');
$response = array('what' => 'status', 'action' => 'export_content', 'id' => '1', 'data' => __('Export content done', CHERRY_PLUGIN_DOMAIN));
$response_file = array('what' => 'file', 'action' => 'export_content', 'id' => '2');
$zip_name = UPLOAD_BASE_DIR . '/sample_data.zip';
cherry_plugin_delete_file($zip_name);
if (is_dir(UPLOAD_BASE_DIR)) {
$file_string = cherry_plugin_scan_dir(UPLOAD_BASE_DIR, $exclude_folder, $exclude_files);
}
$zip = new PclZip($zip_name);
$result = $zip->create($file_string, PCLZIP_OPT_REMOVE_ALL_PATH);
//export json
$json_file = cherry_plugin_export_json();
if (is_wp_error($json_file)) {
$response['data'] = "Error : " . $json_file->get_error_message();
} else {
$zip->add($json_file, PCLZIP_OPT_REMOVE_ALL_PATH);
cherry_plugin_delete_file($json_file);
}
//export xml
$xml_file = cherry_plugin_export_xml();
if (is_wp_error($xml_file)) {
$response['data'] = "Error : " . $xml_file->get_error_message();
} else {
$zip->add($xml_file, PCLZIP_OPT_REMOVE_ALL_PATH);
cherry_plugin_delete_file($xml_file);
}
if ($result == 0) {
$response['data'] = "Error : " . $zip->errorInfo(true);
} else {
$response_file['data'] = $zip_name;
}
$xmlResponse = new WP_Ajax_Response($response);
$xmlResponse->add($response_file);
$xmlResponse->send();
exit;
}
示例6: ht_intraverts_ajax_show
//.........这里部分代码省略.........
if (!$teamcheck) {
continue;
}
}
// target a grade?
if ($grades = get_post_meta(get_the_id(), 'intravert_grades', true)) {
$gradecheck = false;
$usergrades = get_user_meta(get_current_user_id(), 'user_grade', true);
if ($usergrades) {
foreach ((array) $usergrades as $u) {
if (in_array($u, $grades)) {
$gradecheck = true;
}
}
}
if (!$gradecheck) {
continue;
}
}
}
// date range?
$sdate = date('Ymd');
if (get_post_meta(get_the_id(), 'intravert_date_range', true) && ($sdate < get_post_meta(get_the_id(), 'intravert_start_date', true) || $sdate > get_post_meta(get_the_id(), 'intravert_end_date', true))) {
continue;
}
$catcheck = false;
// target content?
$targetcontent = get_post_meta(get_the_id(), 'intravert_target_content', true);
if ($targetcontent == "Task category" && $pt == "task") {
if ($icategory = get_post_meta(get_the_id(), 'intravert_category', true)) {
if ($icategory) {
foreach ((array) $icategory as $u) {
if (in_array($u, $currentpostterms)) {
$catcheck = true;
}
}
}
}
}
if ($targetcontent == "News type" && $pt == "news") {
if ($icategory = get_post_meta(get_the_id(), 'intravert_news_type', true)) {
if ($icategory) {
foreach ((array) $icategory as $u) {
if (in_array($u, $currentnewsterms)) {
$catcheck = true;
}
}
}
}
}
if ($targetcontent == "Task category" && !$catcheck) {
continue;
}
if ($targetcontent == "News type" && !$catcheck) {
continue;
}
/*
Display intravert
*/
$k++;
$thistitle = get_the_title($post->ID);
$thisURL = get_permalink($post->ID);
$destination = get_post_meta(get_the_id(), 'intravert_destination_page', true);
if ($destination) {
$destination = get_permalink($destination[0]);
} else {
$destination = "#nowhere";
}
if (has_post_thumbnail($post->ID)) {
$html .= "<a href='" . $destination . "' onclick='pauseIntravert(\"ht_intravert_" . get_the_id() . "\"," . $icookie . ",\"" . $post->post_title . "\",\"" . $originaltitle . "\");'> ";
$html .= get_the_post_thumbnail(get_the_id(), 'large', array('class' => 'img-responsive'));
$html .= "</a>";
}
$html .= apply_filters("the_content", get_the_content());
if (get_post_meta(get_the_id(), 'intravert_link_text', true)) {
$html .= "<a id='intravert_hook_" . $widget_id . "' class='btn btn-info filter_results' href='" . $destination . "' onclick='pauseIntravert(\"ht_intravert_" . get_the_id() . "\"," . $icookie . ",\"" . $post->post_title . "\",\"" . $originaltitle . "\");'> ";
$html .= get_post_meta(get_the_id(), 'intravert_link_text', true);
if ($destination != '#nowhere') {
$html .= " <span class='dashicons dashicons-arrow-right-alt2'></span>";
}
$html .= "</a> ";
}
break;
}
if ($k) {
$finalhtml = $before_widget;
$finalhtml .= $html;
$finalhtml .= "<div class='clearfix'></div>";
$finalhtml .= $after_widget;
}
if ($finalhtml) {
// Request successful
$response->add(array('data' => 'success', 'supplemental' => array('message' => $finalhtml)));
} else {
// Request failed
$response->add(array('data' => 'error', 'supplemental' => array('message' => 'an error occurred')));
}
$response->send();
exit;
}
示例7: isset
$start = isset($_POST['page']) ? intval($_POST['page']) * 25 : 25;
list($comments, $total) = _wp_get_comment_list( $search, $start, 1 );
if ( !$comments )
die('1');
$x = new WP_Ajax_Response();
foreach ( (array) $comments as $comment ) {
get_comment( $comment );
ob_start();
_wp_comment_list_item( $comment->comment_ID );
$comment_list_item = ob_get_contents();
ob_end_clean();
$x->add( array(
'what' => 'comment',
'id' => $comment->comment_ID,
'data' => $comment_list_item
) );
}
$x->send();
break;
case 'add-meta' :
if ( !current_user_can( 'edit_post', $id ) )
die('-1');
if ( $id < 0 ) {
$now = current_time('timestamp', 1);
if ( $pid = wp_insert_post( array(
'post_title' => sprintf('Draft created on %s at %s', date(get_option('date_format'), $now), date(get_option('time_format'), $now))
) ) )
$mid = add_meta( $pid );
else
示例8: ht_need_to_know_ajax_show
function ht_need_to_know_ajax_show()
{
$items = absint($_POST['items']);
$title = esc_attr($_POST['title']);
$before_widget = stripcslashes($_POST['before_widget']);
$after_widget = stripcslashes($_POST['after_widget']);
$before_title = stripcslashes($_POST['before_title']);
$after_title = stripcslashes($_POST['after_title']);
$hide = $_POST['hide'];
$response = new WP_Ajax_Response();
global $post;
$html = load_news($items, $title, $before_widget, $after_widget, stripcslashes($before_title), $after_title, $hide);
if ($html) {
// Request successful
$response->add(array('data' => 'success', 'supplemental' => array('message' => $html)));
} else {
// Request failed
$response->add(array('data' => 'error', 'supplemental' => array('message' => 'an error occured')));
}
$response->send();
exit;
}
示例9: die
/**
* Function that handles editing of the plugin via AJAX
*/
function ajax_edit_plugin_note()
{
global $current_user;
// Verify nonce
if (!wp_verify_nonce($_POST['_nonce'], 'wp-plugin_notes_nonce')) {
die(__('Don\'t think you\'re supposed to be here...', 'plugin_notes'));
return;
}
$current_user = wp_get_current_user();
if (current_user_can('edit_plugins')) {
// Get notes array
$notes = $this->_get_notes();
$note_text = trim(strip_tags(stripslashes($_POST['plugin_note']), '<p><b><i><em><u><strong><a><img>'));
// TODO: Escape this?
$plugin = $_POST['plugin_slug'];
$plugin_name = esc_html($_POST['plugin_name']);
$response_data = array();
$response_data['slug'] = $plugin;
if ($note_text) {
$date_format = get_option('date_format');
// setup the note data
$note = array();
$note['date'] = date($date_format);
$note['user'] = $current_user->ID;
$note['note'] = $note_text;
// Add new note to notes array
$notes[$plugin] = $note;
$response_data = array_merge($response_data, $note);
$response_data['action'] = 'edit';
} else {
// no note sent, so let's delete it
if (!empty($notes[$plugin])) {
unset($notes[$plugin]);
}
$response_data['action'] = 'delete';
}
// Save the new notes array
$this->_set_notes($notes);
} else {
// user can't edit plugins, so throw error
die(__('Sorry, you do not have permission to edit plugins.', 'plugin_notes'));
return;
}
// Prepare response
$response = new WP_Ajax_Response();
ob_start();
$this->_add_plugin_note($note, array('Name' => $plugin_name), $plugin);
$plugin_note_content = ob_get_contents();
ob_end_clean();
$response->add(array('what' => 'plugin_note', 'id' => $plugin, 'data' => $plugin_note_content, 'action' => $note_text ? 'edit' : 'delete'));
$response->send();
return;
}
示例10: send_ajax_response
/**
* Send ajax response
*
* @param array $response Part response in the format:
* [id] => 0 = no result, 1 = result
* [data] => html string (can be empty if no result)
* [supplemental] => (optional) supplemental info to pass
* [tr_class] => (optional) class for the wrapping row
* @return void
*/
public function send_ajax_response($response)
{
$tr_class = '';
if (isset($response['tr_class']) && $response['tr_class'] !== '') {
$tr_class = ' class="' . esc_attr($response['tr_class']) . '"';
}
$data = '';
if ($response['data'] !== '') {
$data = '<tr' . $tr_class . '>
<td> </td>
<td colspan="{colspan}">
' . $response['data'] . '
</td>
</tr>';
}
$supplemental = array();
// Only accounts for the expected new view online link, everything else will be buggered
if (isset($response['supplemental']) && $response['supplemental'] !== '') {
$supplemental['url_link'] = ' | ' . $response['supplemental'];
}
/* Send the response */
$ajax_response = new WP_Ajax_Response();
$ajax_response->add(array('what' => self::$name, 'action' => $_POST['action'], 'id' => $response['id'], 'data' => $data, 'supplemental' => $supplemental));
$ajax_response->send();
exit;
}
示例11: update_lead_status
/**
* Updates the entry status
*
* Called via AJAX
* Passes data off to either RGFormsModel::update_lead_property or RGFormsModel::delete_lead
*
* @access public
* @static
* @see RGFormsModel::update_lead_property
* @see RGFormsModel::delete_lead
*/
public static function update_lead_status()
{
check_ajax_referer('gf_delete_entry');
$status = rgpost('status');
$lead_id = rgpost('entry');
$entry = GFAPI::get_entry($lead_id);
$form = GFAPI::get_form($entry['form_id']);
switch ($status) {
case 'unspam':
RGFormsModel::update_lead_property($lead_id, 'status', 'active');
break;
case 'delete':
if (GFCommon::current_user_can_any('gravityforms_delete_entries')) {
RGFormsModel::delete_lead($lead_id);
}
break;
default:
RGFormsModel::update_lead_property($lead_id, 'status', $status);
break;
}
require_once 'entry_list.php';
$filter_links = GFEntryList::get_filter_links($form);
$counts = array();
foreach ($filter_links as $filter_link) {
$id = $filter_link['id'] == '' ? 'all' : $filter_link['id'];
$counts[$id . '_count'] = $filter_link['count'];
}
$x = new WP_Ajax_Response();
$x->add(array('what' => 'gf_entry', 'id' => $lead_id, 'supplemental' => $counts));
$x->send();
}
示例12: ht_profile_nudge_ajax_action_add_bio
function ht_profile_nudge_ajax_action_add_bio()
{
$nonce = $_POST['nonce'];
$itext = $_POST['itext'];
$widget_id = $_POST['widget_id'];
global $current_user;
$success = false;
$current_user = wp_get_current_user();
if ($current_user->ID) {
$userid = $current_user->ID;
}
if (!wp_verify_nonce($nonce, 'update_profile_add_bio_' . $widget_id)) {
// This nonce is not valid.
$html = __("Security check - there is something wrong", "govintranet");
} else {
// The nonce was valid.
// Do stuff here.
$response = new WP_Ajax_Response();
$userid = $_POST['userid'];
$current_user = wp_get_current_user();
$current_userid = $current_user->ID;
//
if ($itext == '') {
$html = __('Tell us a little more', 'govintranet');
} elseif ($userid != $current_userid) {
$html = __("Security check - can\\'t check your identity", "govintranet");
} else {
$itext = sanitize_text_field($itext);
update_user_meta($current_userid, 'description', $itext, '');
$html = __('<strong>Updated.</strong> Thank you', 'govintranet') . ' <span class="dashicons dashicons-smiley"></span>';
$success = true;
}
}
if ($success) {
// Request successful
$response->add(array('data' => 'success', 'supplemental' => array('message' => '<div class="alert alert-success alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">x</button>' . $html . '</div>')));
} else {
// Request failed
$response->add(array('data' => 'error', 'supplemental' => array('message' => '<div class="alert alert-danger">' . $html . '</div>')));
}
$response->send();
exit;
}
示例13: die
/**
* Handles AJAX insert comment
*/
function ajax_insert_comment()
{
global $current_user, $user_ID, $wpdb;
// Verify nonce
if (!wp_verify_nonce($_POST['_nonce'], 'comment')) {
die(__("Nonce check failed. Please ensure you're supposed to be adding editorial comments.", 'edit-flow'));
}
// Get user info
get_currentuserinfo();
// Set up comment data
$post_id = absint($_POST['post_id']);
$parent = absint($_POST['parent']);
// Only allow the comment if user can edit post
// @TODO: allow contributers to add comments as well (?)
if (!current_user_can('edit_post', $post_id)) {
die(__('Sorry, you don\'t have the privileges to add editorial comments. Please talk to your Administrator.', 'edit-flow'));
}
// Verify that comment was actually entered
$comment_content = trim($_POST['content']);
if (!$comment_content) {
die(__("Please enter a comment.", 'edit-flow'));
}
// Check that we have a post_id and user logged in
if ($post_id && $current_user) {
// set current time
$time = current_time('mysql', $gmt = 0);
// Set comment data
$data = array('comment_post_ID' => (int) $post_id, 'comment_author' => esc_sql($current_user->display_name), 'comment_author_email' => esc_sql($current_user->user_email), 'comment_author_url' => esc_sql($current_user->user_url), 'comment_content' => wp_kses($comment_content, array('a' => array('href' => array(), 'title' => array()), 'b' => array(), 'i' => array(), 'strong' => array(), 'em' => array(), 'u' => array(), 'del' => array(), 'blockquote' => array(), 'sub' => array(), 'sup' => array())), 'comment_type' => self::comment_type, 'comment_parent' => (int) $parent, 'user_id' => (int) $user_ID, 'comment_author_IP' => esc_sql($_SERVER['REMOTE_ADDR']), 'comment_agent' => esc_sql($_SERVER['HTTP_USER_AGENT']), 'comment_date' => $time, 'comment_date_gmt' => $time, 'comment_approved' => self::comment_type);
apply_filters('ef_pre_insert_editorial_comment', $data);
// Insert Comment
$comment_id = wp_insert_comment($data);
$comment = get_comment($comment_id);
// Register actions -- will be used to set up notifications and other modules can hook into this
if ($comment_id) {
do_action('ef_post_insert_editorial_comment', $comment);
}
// Prepare response
$response = new WP_Ajax_Response();
ob_start();
$this->the_comment($comment, '', '');
$comment_list_item = ob_get_contents();
ob_end_clean();
$response->add(array('what' => 'comment', 'id' => $comment_id, 'data' => $comment_list_item, 'action' => $parent ? 'reply' : 'new'));
$response->send();
} else {
die(__('There was a problem of some sort. Try again or contact your administrator.', 'edit-flow'));
}
}
示例14: wpsc_add_variant_from_products_page
function wpsc_add_variant_from_products_page()
{
/* This is the parent term / vartiation set we will save this first */
$variation_set_term = $_POST['variation'];
$variants[0] = $_POST['variant'];
/*
variants can be coma separated so we check for
these and put them into an array
*/
$variants = explode(',', $variants[0]);
wp_insert_term($variation_set_term, 'wpsc-variation', $args = array());
/* now get the parent id so we can save all the kids*/
$parent_term = term_exists($variation_set_term, 'wpsc-variation');
// array is returned if taxonomy is given
$parent_term_id = $parent_term['term_id'];
// get numeric term id
/* if we have a parent and some kids then we will add kids now */
if (!empty($parent_term_id) && !empty($variants)) {
foreach ($variants as $variant) {
wp_insert_term($variant, 'wpsc-variation', $args = array('parent' => $parent_term_id));
/* want to get out the id so we can return it with the response */
$varient_term = term_exists($variant, 'wpsc-variation', $parent_term_id);
$variant_term_id[] = $varient_term['term_id'];
// get numeric term id
}
}
$response = new WP_Ajax_Response();
$response->add(array('data' => 'success', 'supplemental' => array('variant_id' => implode(",", $variant_term_id))));
$response->send();
exit;
}
示例15: ht_notify_ajax_show
function ht_notify_ajax_show()
{
$before_widget = stripcslashes($_POST['before_widget']);
$after_widget = stripcslashes($_POST['after_widget']);
$post_id = $_POST['post_id'];
$user_id = $_POST['user_id'];
$widget_id = $_POST['widget_id'];
$response = new WP_Ajax_Response();
$notes = get_user_meta($user_id, 'user_notifications', true);
$html = "";
if (isset($notes) && !in_array($post_id, (array) $notes)) {
$html .= "<a onclick='javascript:addtonotifications();' class='ht_addtonotifications btn btn-sm btn-primary'>" . __('Get notifications', 'govintranet') . "</a>";
} else {
$html .= "<a onclick='javascript:delnotifications();' class='ht_addtonotifications btn btn-sm btn-default'>" . __('Stop notifications', 'govintranet') . "</a>";
}
$html .= $after_widget;
wp_reset_postdata();
if ($html) {
// Request successful
$response->add(array('data' => 'success', 'supplemental' => array('message' => $html)));
} else {
// Request failed
$response->add(array('data' => 'error', 'supplemental' => array('message' => 'an error occurred')));
}
$response->send();
exit;
}