'spam', 'approve' => 'approve', ); /** * @param HTTPRequest $request * @return HTTPResponse */ public function __construct() { Deprecation::notice('3.1.0', 'Use concrete Spam or Approve handlers instead', Deprecation::SCOPE_CLASS); } public function spam(HTTPRequest $request) { $ids = array(); foreach ($this->getRecords() as $record) { array_push($ids, $record->ID); $record->markSpam(); } $response = new HTTPResponse(json_encode(array( 'done' => true, 'records' => $ids ))); $response->addHeader('Content-Type', 'text/json'); return $response; } /** * @param HTTPRequest $request * @return HTTPResponse */ public function approve(HTTPRequest $request) { $ids = array(); foreach ($this->getRecords() as $record) { array_push($ids, $record->ID); $record->markApproved(); } $response = new HTTPResponse(json_encode(array( 'done' => true, 'records' => $ids ))); $response->addHeader('Content-Type', 'text/json'); return $response; } }