PluginProbe
WPVR – 360 Panorama viewer and Virtual Tour Builder for WordPress / 8.5.38
WPVR – 360 Panorama viewer and Virtual Tour Builder for WordPress v8.5.38
9.1.2 9.1.1 9.1.0 9.0.3 9.0.2 9.0.1 9.0.0 8.5.79 8.5.78 8.5.77 8.5.76 8.5.75 8.5.74 8.5.73 8.5.72 8.5.71 8.5.70 8.5.69 8.5.68 8.5.35 8.5.36 8.5.37 8.5.38 8.5.39 8.5.4 All 221 releases
wpvr / includes / class-wpvr-create-contact.php

class-wpvr-create-contact.php in WPVR – 360 Panorama viewer and Virtual Tour Builder for WordPress 8.5.38, at includes/class-wpvr-create-contact.php

99 lines 2.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Create Contact to MailMint
4 *
5 * @since 8.4.10
6 */
7 class WPVR_Create_Contact {
8
9 protected $webHookUrl = [WPVR_WEBHOOK_URL];
10
11 /**
12 * Email
13 *
14 * @var string
15 * @since 8.4.10
16 */
17 protected $email = '';
18
19 /**
20 * Name
21 *
22 * @var string
23 * @since 8.4.10
24 */
25 protected $name = '';
26
27
28 /**
29 * Industry
30 *
31 * @var string
32 * @since 8.4.10
33 */
34 protected $industry = '';
35
36
37 /**
38 * Constructor
39 *
40 * @param string $email
41 * @param string $name
42 * @since 8.4.10
43 */
44 public function __construct( $email, $name, $industry ){
45 $this->email = $email;
46 $this->name = $name;
47 $this->industry = $industry;
48 }
49
50
51 /**
52 * Create contact to MailMint via webhook
53 *
54 * @return array
55 * @since 8.4.10
56 */
57 public function create_contact_via_webhook(){
58 if( !$this->email ){
59 return [
60 'suceess' => false,
61 ];
62 }
63
64 $response = [
65 'suceess' => true,
66 ];
67
68 $industry_name = !empty( get_option('wpvr_industry_name') ) ? get_option('wpvr_industry_name') : '';
69 $json_body_data = json_encode([
70 'email' => $this->email,
71 'first_name' => $this->name,
72 'meta_fields' => [
73 'industry' => $this->industry,
74 ],
75 ]);
76
77 try{
78 if( !empty($this->webHookUrl ) ){
79 foreach( $this->webHookUrl as $url ){
80 $response = wp_remote_request($url, [
81 'method' => 'POST',
82 'headers' => [
83 'Content-Type' => 'application/json',
84 ],
85 'body' => $json_body_data
86 ]);
87 }
88 }
89 }catch(\Exception $e){
90 error_log('Error sending contact data to MailMint');
91 $response = [
92 'suceess' => false,
93 ];
94 }
95
96 return $response;
97 }
98 }
99 ?>