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-hublet-api-controller.php

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

41 lines 880 B
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 * Hublet Api. Used to fetch portal's hublet and update in case of region migration
10 */
11 class Hublet_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 '/hublet',
19 \WP_REST_Server::EDITABLE,
20 array( $this, 'update_hublet' )
21 );
22 }
23
24 /**
25 * Get's correct hublet and updates it in Options
26 *
27 * @param array $request Request body.
28 */
29 public function update_hublet( $request ) {
30 $data = json_decode( $request->get_body(), true );
31 $hublet = $data['hublet'];
32
33 if ( ! $hublet ) {
34 return new \WP_REST_Response( 'Hublet is required', 400 );
35 }
36 Portal_Options::set_hublet( $hublet );
37 return new \WP_REST_Response( $hublet, 200 );
38 }
39
40 }
41