PluginProbe
Depicter — Popup & Slider Builder / 1.3.3
Depicter — Popup & Slider Builder v1.3.3
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 / PluginDeactivationController.php

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

47 lines 1.2 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\GuzzleHttp\Exception\GuzzleException;
5 use Psr\Http\Message\ResponseInterface;
6
7 class PluginDeactivationController
8 {
9 /**
10 * Send deactivation feedback
11 *
12 * @return ResponseInterface
13 */
14 public function sendFeedback(){
15
16 if ( empty( $_POST['issueRelatesTo'] ) ) {
17 return \Depicter::json([
18 'errors' => "Empty deactivation reason"
19 ])->withStatus(400 );
20 }
21
22 $feedback = [
23 'issueType' => 'deactivation',
24 'issueRelatesTo' => sanitize_text_field( $_POST['issueRelatesTo'] ),
25 'userDescription' => !empty( $_POST['userDescription'] ) ? sanitize_text_field( $_POST['userDescription'] ) : ''
26 ];
27
28 try {
29 if ( \Depicter::deactivationFeedback()->sendFeedback( $feedback ) ) {
30 return \Depicter::json([
31 "hits" => 1,
32 'message' => "Feedback has been sent successfully"
33 ])->withStatus(200 );
34 } else {
35 return \Depicter::json([
36 'errors' => "Error while sending feedback, please try again later"
37 ])->withStatus(400 );
38 }
39 } catch( GuzzleException $e ) {
40 return \Depicter::json([
41 'errors' => "Error while sending feedback, connection error..."
42 ])->withStatus(400 );
43 }
44
45 }
46 }
47