PluginProbe
Depicter — Popup & Slider Builder / 1.6.2
Depicter — Popup & Slider Builder v1.6.2
4.8.1 trunk 1.0.0 1.1.0 1.1.2 1.1.4 1.1.6 1.1.7 1.1.8 1.1.9 1.2.0 1.3.0 1.3.1 1.3.2 1.3.3 1.3.5 1.3.8 1.5.0 1.5.1 1.5.2 1.5.5 1.6.0 1.6.1 1.6.2 1.7.0 All 76 releases
depicter / app / src / Controllers / Ajax / ReportIssueAjaxController.php

ReportIssueAjaxController.php in Depicter — Popup & Slider Builder 1.6.2, at app/src/Controllers/Ajax/ReportIssueAjaxController.php

64 lines 1.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Depicter\Controllers\Ajax;
3
4 use Depicter\Utility\Sanitize;
5 use WPEmerge\Requests\RequestInterface;
6
7 class ReportIssueAjaxController
8 {
9
10 public function sendIssue( RequestInterface $request, $view ) {
11
12 $bodyParams = [
13 'issueType' => Sanitize::textfield( $request->body('issueType') ),
14 'issueRelatesTo' => Sanitize::textfield( $request->body('issueRelatesTo') ),
15 'userDescription' => Sanitize::editor( $request->body('userDescription') ),
16 'userEmail' => Sanitize::email( $request->body('userEmail') )
17 ];
18
19 try {
20 if ( \Depicter::client()->reportIssue( $bodyParams ) ) {
21 return \Depicter::json([
22 "hits" => 1,
23 'message' => "Feedback has been sent successfully"
24 ])->withStatus(200 );
25 } else {
26 return \Depicter::json([
27 'errors' => "Error while sending feedback, please try again later"
28 ])->withStatus(400 );
29 }
30 } catch ( \Exception $exception ){
31 return \Depicter::json([
32 'errors' => [ $exception->getMessage() ]
33 ]);
34 }
35 }
36
37 public function sendError( RequestInterface $request, $view ) {
38 $bodyParams = [
39 'crashReport' => Sanitize::textarea( $request->body('crashReport') ),
40 'userComment' => Sanitize::editor( $request->body('userComment') ),
41 'envInfo' => Sanitize::textarea( $request->body('envInfo') ),
42 'userEmail' => Sanitize::email( $request->body('userEmail') ),
43 'userDocumentData' => Sanitize::textarea( $request->body('userDocumentData') )
44 ];
45
46 try {
47 if ( \Depicter::client()->reportError( $bodyParams ) ) {
48 return \Depicter::json([
49 "hits" => 1,
50 'message' => "Error report has been sent successfully"
51 ])->withStatus(200 );
52 } else {
53 return \Depicter::json([
54 'errors' => "Error while sending report, please try again later"
55 ])->withStatus(400 );
56 }
57 } catch ( \Exception $exception ){
58 return \Depicter::json([
59 'errors' => [ $exception->getMessage() ]
60 ]);
61 }
62 }
63 }
64