This repository has been archived on 2026-11-04. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
wp-json-api/controllers/respond.php
T
2011-03-25 12:22:44 -04:00

28 lines
770 B
PHP

<?php
/*
Controller name: Respond
Controller description: Comment/trackback submission methods
*/
class JSON_API_Respond_Controller {
function submit_comment() {
global $json_api;
nocache_headers();
if (empty($_REQUEST['post_id'])) {
$json_api->error("No post specified. Include 'post_id' var in your request.");
} else if (empty($_REQUEST['name']) ||
empty($_REQUEST['email']) ||
empty($_REQUEST['content'])) {
$json_api->error("Please include all required arguments (name, email, content).");
} else if (!is_email($_REQUEST['email'])) {
$json_api->error("Please enter a valid email address.");
}
$pending = new JSON_API_Comment();
return $pending->handle_submission();
}
}
?>