Beispiel #1
0
function vp_send_bug_report()
{
    $email = $_POST['email'];
    $description = $_POST['description'];
    $bugReporter = new BugReporter('http://versionpress.net/report-problem');
    $reportedSuccessfully = $bugReporter->reportBug($email, $description);
    $result = $reportedSuccessfully ? "ok" : "err";
    wp_redirect(add_query_arg('bug-report', $result, menu_page_url('versionpress', false)));
}
 /**
  * @param WP_REST_Request $request
  * @return WP_REST_Response|\WP_Error
  */
 public function submitBug(WP_REST_Request $request)
 {
     $email = $request['email'];
     $description = $request['description'];
     $bugReporter = new BugReporter('http://versionpress.net/report-problem');
     $reportedSuccessfully = $bugReporter->reportBug($email, $description);
     if ($reportedSuccessfully) {
         return new WP_REST_Response(true);
     } else {
         return new \WP_Error('error', 'There was a problem with sending bug report. Please try it again. Thank you.', array('status' => 403));
     }
 }