PluginProbe
HubSpot All-In-One Marketing – Forms, Popups, Live Chat / 11.3.75
HubSpot All-In-One Marketing – Forms, Popups, Live Chat v11.3.75
11.3.75 11.3.73 11.3.71 11.3.70 11.3.69 11.3.64 11.3.65 11.3.62 11.3.61 11.3.56 11.3.58 11.0.31 11.0.52 11.0.54 11.0.56 11.0.58 11.0.7 11.1.10 11.1.11 11.1.13 11.1.14 11.1.15 11.1.2 11.1.20 11.1.21 All 73 releases
leadin / public / admin / modules / api / class-wp-mappings-api-controller.php

class-wp-mappings-api-controller.php in HubSpot All-In-One Marketing – Forms, Popups, Live Chat 11.3.75, at public/admin/modules/api/class-wp-mappings-api-controller.php

66 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Leadin\admin\api;
4
5 use Leadin\api\Base_Api_Controller;
6 use Leadin\data\Portal_Options;
7
8 /**
9 * Updates the Cache for the Mappings
10 */
11 class WP_Mappings_Api_Controller extends Base_Api_Controller {
12
13 /**
14 * Class constructor, register route.
15 */
16 public function __construct() {
17 self::register_leadin_admin_route(
18 '/wp-mappings-cache-reset',
19 \WP_REST_Server::CREATABLE,
20 array( $this, 'reset_wp_mappings_cache' )
21 );
22 self::register_leadin_admin_route(
23 '/wp-mappings-proxy-enabled',
24 \WP_REST_Server::EDITABLE,
25 array( $this, 'set_wp_mappings_proxy_enabled' )
26 );
27 self::register_leadin_admin_route(
28 '/wp-mappings-proxy-enabled',
29 \WP_REST_Server::READABLE,
30 array( $this, 'get_wp_mappings_proxy_enabled' )
31 );
32 }
33
34 /**
35 * Resets the WP cache for the Mappings
36 *
37 * @return string OK response message.
38 */
39 public function reset_wp_mappings_cache() {
40 do_action( 'leadin_reset_wp_mappings_cache' );
41 return new \WP_REST_Response( 'OK', 200 );
42 }
43
44 /**
45 * Get proxy mappings enabled option.
46 *
47 * @return bool Proxy mappings enabled option value.
48 */
49 public function get_wp_mappings_proxy_enabled() {
50 return new \WP_REST_Response( Portal_Options::get_proxy_mappings_enabled(), 200 );
51 }
52
53 /**
54 * Set the proxy mappings enabled option.
55 *
56 * @param bool $request option value.
57 *
58 * @return string OK response message.
59 */
60 public function set_wp_mappings_proxy_enabled( $request ) {
61 Portal_Options::set_proxy_mappings_enabled( json_decode( $request->get_body(), true ) );
62 return new \WP_REST_Response( 'OK', 200 );
63 }
64
65 }
66