PluginProbe
Depicter — Popup & Slider Builder / trunk
Depicter — Popup & Slider Builder vtrunk
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 trunk, at app/src/Controllers/Ajax/PluginDeactivationController.php

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