PluginProbe ʕ •ᴥ•ʔ
WP Chat App / 3.6.1
WP Chat App v3.6.1
3.8.1 3.8.2 trunk 2.6 3.4 3.4.1 3.4.2 3.4.4 3.4.5 3.4.6 3.5 3.6 3.6.1 3.6.2 3.6.3 3.6.4 3.6.5 3.6.6 3.6.7 3.6.8 3.6.9 3.7.0 3.7.1 3.7.2 3.7.3 3.7.4 3.8.0
wp-whatsapp / includes / Fields.php
wp-whatsapp / includes Last commit date
Recommended 2 years ago Support 2 years ago Cross.php 2 years ago Fallback.php 2 years ago Fields.php 2 years ago Helper.php 2 years ago I18n.php 2 years ago Plugin.php 2 years ago Popup.php 2 years ago PostType.php 2 years ago Review.php 2 years ago Settings.php 2 years ago Shortcode.php 2 years ago Upgrade.php 2 years ago
Fields.php
145 lines
1 <?php
2
3 namespace NTA_WhatsApp;
4
5 defined('ABSPATH') || exit;
6
7 class Fields
8 {
9 protected static $instance = null;
10
11 public static function getInstance()
12 {
13 if (null == self::$instance) {
14 self::$instance = new self;
15 }
16 return self::$instance;
17 }
18
19 public function __construct()
20 {
21 }
22
23 public static function getButtonStyles($postId)
24 {
25 $meta = get_post_meta($postId, 'nta_wa_button_styles', true);
26 return wp_parse_args(
27 $meta === false ? array() : $meta,
28 array(
29 'type' => "round",
30 'backgroundColor' => "#2DB742",
31 'textColor' => "#fff",
32 'label' => __("Need Help? Chat with us", "ninjateam-whatsapp"),
33 'width' => 300,
34 'height' => 64,
35 )
36 );
37 }
38
39
40 public static function getWidgetDisplay()
41 {
42 return wp_parse_args(
43 get_option('nta_wa_widget_display', array()),
44 array(
45 'displayCondition' => 'showAllPage',
46 'includePages' => [],
47 'excludePages' => [],
48 'includePosts' => [],
49 'showOnDesktop' => 'ON',
50 'showOnMobile' => 'ON',
51 'time_symbols' => 'h:m',
52 )
53 );
54 }
55
56 public static function getURLSettings()
57 {
58 return wp_parse_args(
59 get_option('nta_wa_url', array()),
60 array(
61 'onDesktop' => 'api',
62 'onMobile' => 'api',
63 'openInNewTab' => 'ON'
64 )
65 );
66 }
67
68 public static function getWidgetStyles()
69 {
70 return wp_parse_args(
71 get_option('nta_wa_widget_styles', array()),
72 array(
73 'title' => __("Start a Conversation", "ninjateam-whatsapp"),
74 "responseText" => __("The team typically replies in a few minutes.", "ninjateam-whatsapp"),
75 'description' => __("Hi! Click one of our member below to chat on <strong>WhatsApp</strong>", "ninjateam-whatsapp"),
76 'backgroundColor' => "#2db742",
77 'textColor' => "#fff",
78 'titleSize' => 18,
79 'accountNameSize' => 14,
80 'descriptionTextSize' => 12,
81 'regularTextSize' => 11,
82 'scrollHeight' => 500,
83 'isShowScroll' => 'OFF',
84 'isShowResponseText' => 'ON',
85 'isShowPoweredBy' => 'ON',
86
87 "btnLabel" => __("Need Help? <strong>Chat with us</strong>", "ninjateam-whatsapp"),
88 'btnLabelWidth' => 156,
89 'btnPosition' => 'right',
90 'btnLeftDistance' => 30,
91 'btnRightDistance' => 30,
92 'btnBottomDistance' => 30,
93 'isShowBtnLabel' => 'ON',
94
95 'isShowGDPR' => 'OFF',
96 "gdprContent" => __('Please accept our <a href="https://ninjateam.org/privacy-policy/">privacy policy</a> first to start a conversation.', "ninjateam-whatsapp"),
97 )
98 );
99 }
100
101 public static function getWoocommerceSetting()
102 {
103 $option = get_option('nta_wa_woocommerce', array());
104 return wp_parse_args($option, array(
105 'position' => 'after_atc',
106 'isShow' => 'OFF'
107 ));
108 }
109
110 public static function getAnalyticsSetting(){
111 $option = get_option('nta_wa_analytics', array());
112 return wp_parse_args($option, array(
113 'enabledGoogle' => 'OFF',
114 'enabledFacebook' => 'OFF',
115 'enabledGoogleGA4' => 'OFF'
116 ));
117 }
118
119 public static function getDefaultMetaAccount($daysOfWeek)
120 {
121 $meta = array(
122 'number' => '',
123 'title' => '',
124 'predefinedText' => '',
125 'willBeBackText' => __('I will be back in [njwa_time_work]', 'ninjateam-whatsapp'),
126 'dayOffsText' => __('I will be back soon', 'ninjateam-whatsapp'),
127 'isAlwaysAvailable' => 'ON',
128 );
129
130 foreach ($daysOfWeek as $dayKey) {
131 $meta['daysOfWeekWorking'][$dayKey] = [
132 'isWorkingOnDay' => 'OFF',
133 'workHours' => [
134 [
135 'startTime' => '08:00',
136 'endTime' => '17:30'
137 ]
138 ]
139 ];
140 }
141
142 return $meta;
143 }
144 }
145