WP-Chatbot for Facebook Messenger Customer Chat - Version 3.7

Version Description

alpha feature - load sdk after page load (page speed matters)

Download this release

Release Info

Developer bhvreddy
Plugin Icon 128x128 WP-Chatbot for Facebook Messenger Customer Chat
Version 3.7
Comparing to
See all releases

Code changes from version 3.5 to 3.7

admin/admin.php CHANGED
@@ -31,7 +31,7 @@ include_once HTCC_PLUGIN_DIR . 'admin/browser/class-htcc-admin-browser.php';
31
 
32
  #premium
33
  if ( 'true' == HTCC_PRO ) {
34
- // include_once HTCC_PLUGIN_DIR . 'admin/pro/htcc-pro-update.php';
35
  include_once HTCC_PLUGIN_DIR . 'admin/pro/class-admin-htcc-pro.php';
36
  }
37
 
31
 
32
  #premium
33
  if ( 'true' == HTCC_PRO ) {
34
+ include_once HTCC_PLUGIN_DIR . 'admin/pro/htcc-pro-update.php';
35
  include_once HTCC_PLUGIN_DIR . 'admin/pro/class-admin-htcc-pro.php';
36
  }
37
 
admin/browser/class-htcc-admin-browser.php CHANGED
@@ -57,9 +57,9 @@ class Admin_HTCC_Browser {
57
  <?php settings_fields( 'htcc_settings_fields_browser' ); ?>
58
  <?php do_settings_sections( 'htcc_settings_sections_browser' ) ?>
59
  <?php submit_button() ?>
60
- <p class="description">Once <a target="_blank" href="https://developers.facebook.com/docs/messenger-platform/discovery/customer-chat-plugin">Customer chat plugin</a> supports safari 12, we plan to remove this feature and update the plugin 'or' you can simply uncheck the enable option </p>
61
  <br>
62
- <p class="description">approximately <a href="https://caniuse.com/usage-table">1 percent uses Safari 12</a> (29th October, 2018), We know how important it will be that why we added this feature</p>
63
  </form>
64
  </div>
65
  <!-- <div class="col s12 m12 xl6 ht-cc-admin-sidebar">
@@ -96,15 +96,15 @@ class Admin_HTCC_Browser {
96
  function section_cb() {
97
  echo '<h1>Browser Support ( Safari 12 ) </h1>';
98
  ?>
99
- <p class="description" style="background-color: #e2e2e2; max-width: 455px;"> This is beta, temporary feature until <a target="_blank" href="https://developers.facebook.com/docs/messenger-platform/discovery/customer-chat-plugin">Customer chat plugin</a> not supports Safari 12 </p>
100
- <br>
101
  <!-- <p class="description"><a target="_blank" href="https://developers.facebook.com/docs/messenger-platform/discovery/customer-chat-plugin"><?php _e( 'Customer chat plugin' , 'wp-chatbot' ) ?></a> <?php _e( ' temporarily not supporting safari 12 ' , 'wp-chatbot' ) ?> </p> -->
102
  <!-- <p class="description"><?php _e( '1 to 2 percent may use safari 12, but our concept is - you should not miss your website users from communication' , 'wp-chatbot' ) ?> </p> -->
103
  <p class="description">In Safari 12, this feature adds 'message us' button </p>
104
  <p class="description">When user clicks on 'Message Us' button based on device navigates to Messenger.com or Messenger App</p>
105
  <!-- <p class="description">Once <a target="_blank" href="https://developers.facebook.com/docs/messenger-platform/discovery/customer-chat-plugin">Customer chat plugin</a> supports safari 12, we plan to remove this feature and update the plugin or you can simply remove the feature by uncheck the enable option </p> -->
106
  <!-- <p class="description">Facebook App id also needed to make this work, please add 'app id' in main plugin settings </p> -->
107
- <br><br>
108
  <?php
109
  }
110
 
@@ -145,59 +145,67 @@ class Admin_HTCC_Browser {
145
  ?>
146
 
147
  <p class="description"><?php _e( 'If checked, Message Us button will appear on safari 12 browser ' , 'wp-chatbot' ) ?> </p>
 
148
  <br><br>
149
 
150
  <!-- color -->
151
  <div class="row">
152
- <div class="input-field col s12">
153
- <label for=""><?php _e( 'Color' , 'wp-chatbot' ) ?></label>
154
  <select name="htcc_browser[color]" class="select-1">
155
  <option value="blue" <?php echo $color_value == "blue" ? 'SELECTED' : ''; ?> >Blue (default)</option>
156
  <option value="white" <?php echo $color_value == "white" ? 'SELECTED' : ''; ?> >White</option>
157
  </select>
 
158
  </div>
159
  </div>
160
 
161
- <br>
162
 
163
  <!-- size -->
164
  <div class="row">
165
- <div class="input-field col s12">
166
- <label for=""><?php _e( 'Size' , 'wp-chatbot' ) ?></label>
167
  <select name="htcc_browser[size]" class="select-1">
168
  <option value="standard" <?php echo $size_value == "standard" ? 'SELECTED' : ''; ?> >standard</option>
169
  <option value="large" <?php echo $size_value == "large" ? 'SELECTED' : ''; ?> >large (default)</option>
170
  <option value="xlarge" <?php echo $size_value == "xlarge" ? 'SELECTED' : ''; ?> >xlarge</option>
171
  </select>
 
172
  </div>
173
  </div>
174
 
175
 
176
- <br>
177
 
178
  <!-- p1 -->
179
- <div class="input-field col s12">
180
- <label for=""><?php _e( 'position' , 'wp-chatbot' ) ?></label>
181
- <select name="htcc_browser[p1]" class="select-1">
182
- <option value="bottom" <?php echo $p1 == "bottom" ? 'SELECTED' : ''; ?> >bottom</option>
183
- <option value="top" <?php echo $p1 == "top" ? 'SELECTED' : ''; ?> >top</option>
184
- </select>
185
-
 
 
186
  <!-- p1 value -->
187
- <input type="text" name="htcc_browser[p1_value]" id="p1_value" value="<?php echo esc_attr( $options['p1_value'] ) ?>">
 
 
188
  </div>
189
 
190
 
191
  <!-- p2 -->
192
- <div class="input-field col s12">
193
- <label for=""><?php _e( 'position' , 'wp-chatbot' ) ?></label>
194
- <select name="htcc_browser[p2]" class="select-1">
195
- <option value="right" <?php echo $p2 == "right" ? 'SELECTED' : ''; ?> >right</option>
196
- <option value="left" <?php echo $p2 == "left" ? 'SELECTED' : ''; ?> >left</option>
197
- </select>
198
-
 
199
  <!-- p2 value -->
200
- <input type="text" name="htcc_browser[p2_value]" id="p2_value" value="<?php echo esc_attr( $options['p2_value'] ) ?>">
 
 
201
  </div>
202
 
203
 
57
  <?php settings_fields( 'htcc_settings_fields_browser' ); ?>
58
  <?php do_settings_sections( 'htcc_settings_sections_browser' ) ?>
59
  <?php submit_button() ?>
60
+ <p class="description">Once <a target="_blank" href="https://developers.facebook.com/docs/messenger-platform/discovery/customer-chat-plugin">Customer chat plugin</a> supports Safari 12, we plan to remove this feature and update the plugin 'or' you can simply uncheck the enable option </p>
61
  <br>
62
+ <p class="description">approximately <a href="https://caniuse.com/usage-table">1 percent uses Safari 12</a> (29th October 2018), We know how important that 1% is, that's why we added this feature</p>
63
  </form>
64
  </div>
65
  <!-- <div class="col s12 m12 xl6 ht-cc-admin-sidebar">
96
  function section_cb() {
97
  echo '<h1>Browser Support ( Safari 12 ) </h1>';
98
  ?>
99
+ <p class="description"> <span style="background-color: #e2e2e2;"> This is temporary feature until <a target="_blank" href="https://developers.facebook.com/docs/messenger-platform/discovery/customer-chat-plugin">Customer chat plugin</a> not supports Safari 12 </span></p>
100
+ <!-- <br> -->
101
  <!-- <p class="description"><a target="_blank" href="https://developers.facebook.com/docs/messenger-platform/discovery/customer-chat-plugin"><?php _e( 'Customer chat plugin' , 'wp-chatbot' ) ?></a> <?php _e( ' temporarily not supporting safari 12 ' , 'wp-chatbot' ) ?> </p> -->
102
  <!-- <p class="description"><?php _e( '1 to 2 percent may use safari 12, but our concept is - you should not miss your website users from communication' , 'wp-chatbot' ) ?> </p> -->
103
  <p class="description">In Safari 12, this feature adds 'message us' button </p>
104
  <p class="description">When user clicks on 'Message Us' button based on device navigates to Messenger.com or Messenger App</p>
105
  <!-- <p class="description">Once <a target="_blank" href="https://developers.facebook.com/docs/messenger-platform/discovery/customer-chat-plugin">Customer chat plugin</a> supports safari 12, we plan to remove this feature and update the plugin or you can simply remove the feature by uncheck the enable option </p> -->
106
  <!-- <p class="description">Facebook App id also needed to make this work, please add 'app id' in main plugin settings </p> -->
107
+ <!-- <br><br> -->
108
  <?php
109
  }
110
 
145
  ?>
146
 
147
  <p class="description"><?php _e( 'If checked, Message Us button will appear on safari 12 browser ' , 'wp-chatbot' ) ?> </p>
148
+ <p class="description">Facebook "App Id" have to add at plugin main settings page</p>
149
  <br><br>
150
 
151
  <!-- color -->
152
  <div class="row">
153
+ <div class="input-field col s12 m10">
 
154
  <select name="htcc_browser[color]" class="select-1">
155
  <option value="blue" <?php echo $color_value == "blue" ? 'SELECTED' : ''; ?> >Blue (default)</option>
156
  <option value="white" <?php echo $color_value == "white" ? 'SELECTED' : ''; ?> >White</option>
157
  </select>
158
+ <label for=""><?php _e( 'Color' , 'wp-chatbot' ) ?></label>
159
  </div>
160
  </div>
161
 
162
+ <!-- <br> -->
163
 
164
  <!-- size -->
165
  <div class="row">
166
+ <div class="input-field col s12 m10">
 
167
  <select name="htcc_browser[size]" class="select-1">
168
  <option value="standard" <?php echo $size_value == "standard" ? 'SELECTED' : ''; ?> >standard</option>
169
  <option value="large" <?php echo $size_value == "large" ? 'SELECTED' : ''; ?> >large (default)</option>
170
  <option value="xlarge" <?php echo $size_value == "xlarge" ? 'SELECTED' : ''; ?> >xlarge</option>
171
  </select>
172
+ <label for=""><?php _e( 'Size' , 'wp-chatbot' ) ?></label>
173
  </div>
174
  </div>
175
 
176
 
177
+ <!-- <br> -->
178
 
179
  <!-- p1 -->
180
+ <div class="row">
181
+ <div class="input-field col s6 m5">
182
+ <select name="htcc_browser[p1]" class="select-1">
183
+ <option value="bottom" <?php echo $p1 == "bottom" ? 'SELECTED' : ''; ?> >bottom</option>
184
+ <option value="top" <?php echo $p1 == "top" ? 'SELECTED' : ''; ?> >top</option>
185
+ </select>
186
+ <label for=""><?php _e( 'position' , 'wp-chatbot' ) ?></label>
187
+ </div>
188
+
189
  <!-- p1 value -->
190
+ <div class="input-field col s6 m5">
191
+ <input type="text" name="htcc_browser[p1_value]" id="p1_value" value="<?php echo esc_attr( $options['p1_value'] ) ?>">
192
+ </div>
193
  </div>
194
 
195
 
196
  <!-- p2 -->
197
+ <div class="row">
198
+ <div class="input-field col s6 m5">
199
+ <select name="htcc_browser[p2]" class="select-1">
200
+ <option value="right" <?php echo $p2 == "right" ? 'SELECTED' : ''; ?> >right</option>
201
+ <option value="left" <?php echo $p2 == "left" ? 'SELECTED' : ''; ?> >left</option>
202
+ </select>
203
+ <label for=""><?php _e( 'position' , 'wp-chatbot' ) ?></label>
204
+ </div>
205
  <!-- p2 value -->
206
+ <div class="input-field col s6 m5">
207
+ <input type="text" name="htcc_browser[p2_value]" id="p2_value" value="<?php echo esc_attr( $options['p2_value'] ) ?>">
208
+ </div>
209
  </div>
210
 
211
 
admin/class-htcc-admin.php CHANGED
@@ -81,7 +81,7 @@ class HTCC_Admin {
81
  add_settings_field( 'htcc_fb_color', __( 'Color' , 'wp-chatbot' ), array( $this, 'htcc_fb_color_cb' ), 'htcc_options_settings', 'htcc_settings' );
82
  add_settings_field( 'htcc_fb_greeting_login', __( 'Logged in Greeting' , 'wp-chatbot' ), array( $this, 'htcc_fb_greeting_login_cb' ), 'htcc_options_settings', 'htcc_settings' );
83
  add_settings_field( 'htcc_fb_greeting_logout', __( 'Logged out Greeting' , 'wp-chatbot' ), array( $this, 'htcc_fb_greeting_logout_cb' ), 'htcc_options_settings', 'htcc_settings' );
84
-
85
  add_settings_field( 'htcc_fb_greeting_dialog_display', __( 'Greeting Dialog Display' , 'wp-chatbot' ), array( $this, 'htcc_fb_greeting_dialog_display_cb' ), 'htcc_options_settings', 'htcc_settings' );
86
  add_settings_field( 'htcc_fb_greeting_dialog_delay', __( 'Greeting Dialog Delay' , 'wp-chatbot' ), array( $this, 'htcc_fb_greeting_dialog_delay_cb' ), 'htcc_options_settings', 'htcc_settings' );
87
  add_settings_field( 'htcc_fb_sdk_lang', __( 'Messenger language' , 'wp-chatbot' ), array( $this, 'htcc_fb_sdk_lang_cb' ), 'htcc_options_settings', 'htcc_settings' );
@@ -95,6 +95,8 @@ class HTCC_Admin {
95
 
96
  // add_settings_field( 'htcc_fb_is_minimized', __( 'Minimized' , 'wp-chatbot' ), array( $this, 'htcc_fb_is_minimized_cb' ), 'htcc_options_settings', 'htcc_settings' );
97
 
 
 
98
  }
99
 
100
  // section heading
@@ -166,7 +168,7 @@ class HTCC_Admin {
166
  <option value="yes" <?php echo $log_events_value == "yes" ? 'SELECTED' : ''; ?> >Yes</option>
167
  <option value="no" <?php echo $log_events_value == "no" ? 'SELECTED' : ''; ?> >No</option>
168
  </select>
169
- <label for=""><?php _e( 'Log Events' , 'ht-click' ) ?></label>
170
  <p class="description"><?php _e( 'App ID is needed to log Events - ' , 'wp-chatbot' ) ?><a target="_blank" href="https://www.holithemes.com/wp-chatbot/log-events/"><?php _e( 'more info' , 'wp-chatbot' ) ?></a> </p>
171
  </div>
172
  </div>
@@ -222,6 +224,8 @@ class HTCC_Admin {
222
  <input type="text" name="htcc_options[fb_greeting_login]" id="fb_greeting_login" value="<?php echo esc_attr( $htcc_fb_greeting_login['fb_greeting_login'] ) ?>">
223
  <label for="fb_greeting_login"><?php _e( 'Logged in Greetings' , 'ht-click' ) ?></label>
224
  <p class="description"><?php _e( 'Greetings text - If Facebook logged in the current browser, leave empty for default message - ' , 'wp-chatbot' ) ?><a target="_blank" href="https://www.holithemes.com/wp-chatbot/change-facebook-messenger-greetings-text/"><?php _e( 'more info' , 'wp-chatbot' ) ?></a> </p>
 
 
225
  </div>
226
  </div>
227
  <?php
@@ -639,6 +643,105 @@ class HTCC_Admin {
639
 
640
 
641
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
642
  /**
643
  * Sanitize each setting field as needed
644
  *
81
  add_settings_field( 'htcc_fb_color', __( 'Color' , 'wp-chatbot' ), array( $this, 'htcc_fb_color_cb' ), 'htcc_options_settings', 'htcc_settings' );
82
  add_settings_field( 'htcc_fb_greeting_login', __( 'Logged in Greeting' , 'wp-chatbot' ), array( $this, 'htcc_fb_greeting_login_cb' ), 'htcc_options_settings', 'htcc_settings' );
83
  add_settings_field( 'htcc_fb_greeting_logout', __( 'Logged out Greeting' , 'wp-chatbot' ), array( $this, 'htcc_fb_greeting_logout_cb' ), 'htcc_options_settings', 'htcc_settings' );
84
+
85
  add_settings_field( 'htcc_fb_greeting_dialog_display', __( 'Greeting Dialog Display' , 'wp-chatbot' ), array( $this, 'htcc_fb_greeting_dialog_display_cb' ), 'htcc_options_settings', 'htcc_settings' );
86
  add_settings_field( 'htcc_fb_greeting_dialog_delay', __( 'Greeting Dialog Delay' , 'wp-chatbot' ), array( $this, 'htcc_fb_greeting_dialog_delay_cb' ), 'htcc_options_settings', 'htcc_settings' );
87
  add_settings_field( 'htcc_fb_sdk_lang', __( 'Messenger language' , 'wp-chatbot' ), array( $this, 'htcc_fb_sdk_lang_cb' ), 'htcc_options_settings', 'htcc_settings' );
95
 
96
  // add_settings_field( 'htcc_fb_is_minimized', __( 'Minimized' , 'wp-chatbot' ), array( $this, 'htcc_fb_is_minimized_cb' ), 'htcc_options_settings', 'htcc_settings' );
97
 
98
+ add_settings_field( 'htcc_page_load', __( 'Load SDK after Page Load' , 'wp-chatbot' ), array( $this, 'htcc_page_load_cb' ), 'htcc_options_settings', 'htcc_settings' );
99
+
100
  }
101
 
102
  // section heading
168
  <option value="yes" <?php echo $log_events_value == "yes" ? 'SELECTED' : ''; ?> >Yes</option>
169
  <option value="no" <?php echo $log_events_value == "no" ? 'SELECTED' : ''; ?> >No</option>
170
  </select>
171
+ <label for=""><?php _e( 'Log Events (Facebook Analytics)' , 'ht-click' ) ?></label>
172
  <p class="description"><?php _e( 'App ID is needed to log Events - ' , 'wp-chatbot' ) ?><a target="_blank" href="https://www.holithemes.com/wp-chatbot/log-events/"><?php _e( 'more info' , 'wp-chatbot' ) ?></a> </p>
173
  </div>
174
  </div>
224
  <input type="text" name="htcc_options[fb_greeting_login]" id="fb_greeting_login" value="<?php echo esc_attr( $htcc_fb_greeting_login['fb_greeting_login'] ) ?>">
225
  <label for="fb_greeting_login"><?php _e( 'Logged in Greetings' , 'ht-click' ) ?></label>
226
  <p class="description"><?php _e( 'Greetings text - If Facebook logged in the current browser, leave empty for default message - ' , 'wp-chatbot' ) ?><a target="_blank" href="https://www.holithemes.com/wp-chatbot/change-facebook-messenger-greetings-text/"><?php _e( 'more info' , 'wp-chatbot' ) ?></a> </p>
227
+ <!-- <p class="description"><?php _e( 'Grettings can add in any language, this can be different to the messenger language' , 'wp-chatbot' ) ?></p> -->
228
+ <!-- <p class="description"><?php _e( 'If this Greetings fields are blank, default Greetings will load based on Messenger Language' , 'wp-chatbot' ) ?></p> -->
229
  </div>
230
  </div>
231
  <?php
643
 
644
 
645
 
646
+ // page load
647
+ public function htcc_page_load_cb() {
648
+ $options = get_option('htcc_options');
649
+
650
+ ?>
651
+ <p class="description">This feature is in beta stage ( please review this settings, atleast in the next 2 versions )</p>
652
+ <p class="description">This feature is useful, if this plugin only calls Facebook SDK</p>
653
+ <br>
654
+ <p class="description">Don't enable this features If some other plugins or some other source also calls Facebook SDK.</p>
655
+ <p class="description">If Enabled - After webpage loaded, then calls Facebook SDK and display messenger</p>
656
+ <br>
657
+
658
+ <?php
659
+ // load sdk after page loaded
660
+ if ( isset( $options['is_sdk_after_page_load'] ) ) {
661
+ ?>
662
+ <p>
663
+ <label>
664
+ <input name="htcc_options[is_sdk_after_page_load]" type="checkbox" value="1" <?php checked( $options['is_sdk_after_page_load'], 1 ); ?> id="is_sdk_after_page_load" />
665
+ <span><?php _e( 'Load Facebook SDK after page loads' , 'wp-chatbot' ) ?></span>
666
+ </label>
667
+ </p>
668
+ <?php
669
+ } else {
670
+ ?>
671
+ <p>
672
+ <label>
673
+ <input name="htcc_options[is_sdk_after_page_load]" type="checkbox" value="1" id="is_sdk_after_page_load" />
674
+ <span><?php _e( 'Load Facebook SDK after page loads' , 'wp-chatbot' ) ?></span>
675
+ </label>
676
+ </p>
677
+ <?php
678
+ }
679
+ ?>
680
+ <p class="description">this improves the user experience. (first webpage loads and then calls FB SDK and display messenger)</p>
681
+ <br>
682
+
683
+ <?php
684
+
685
+ // +4 seconds - load sdk after page loaded
686
+ if ( isset( $options['is_sdk_4_seconds'] ) ) {
687
+ ?>
688
+ <p>
689
+ <label>
690
+ <input name="htcc_options[is_sdk_4_seconds]" type="checkbox" value="1" <?php checked( $options['is_sdk_4_seconds'], 1 ); ?> id="is_sdk_4_seconds" />
691
+ <span><?php _e( '+4 seconds after page load' , 'wp-chatbot' ) ?></span>
692
+ </label>
693
+ </p>
694
+ <?php
695
+ } else {
696
+ ?>
697
+ <p>
698
+ <label>
699
+ <input name="htcc_options[is_sdk_4_seconds]" type="checkbox" value="1" id="is_sdk_4_seconds" />
700
+ <span><?php _e( '+4 seconds after page load' , 'wp-chatbot' ) ?></span>
701
+ </label>
702
+ </p>
703
+ <?php
704
+ }
705
+ ?>
706
+ <p class="description">this benfit at page speed metrics</p>
707
+ <!-- <p class="description">(first webpage loads and after 4 seconds calls FB SDK and display messenger)</p> -->
708
+ <br>
709
+
710
+ <?php
711
+ if ( 'true' !== HTCC_PRO ) {
712
+ ?>
713
+ <p class="description">Test your website in GTmetrix or similar <br>
714
+ 1. with out activating this plugin <br>
715
+ 2. after activating and enable this +4 feature </p>
716
+ <p class="description">+2, +3 seconds we tested, some situations its not given expected result, so added +4. In pro version can test and set any time</p>
717
+
718
+
719
+ <br>
720
+
721
+ <p class="description">This feature is build for pro version, but as page speed is the most important factor for most users, moved this feature to free version. </p>
722
+
723
+ <br>
724
+ <p class="description">If only this plugin calls FB SDK, Is this working fine on your website? please <a target="_blank" href="https://m.me/holithemes?ref=load-sdk">message us</a>, we like to improve this feature</p>
725
+ <!-- <p class="description">If you like this plugin, please support the developers by giving <a target="_blank" href="https://wordpress.org/support/plugin/wp-chatbot/reviews/#new-post">5 star rating.</a></p> -->
726
+ <br>
727
+ <p class="description">If you are an SEO Expert and like to share thoughts - please <a href="https://m.me/holithemes?ref=seo">message us</a> </p>
728
+
729
+ <br>
730
+ <p class="description">In pro version can set time to call SDK, and can set time to display messenger</p>
731
+ <p class="description"><a target="_blank" href="https://www.holithemes.com/wp-chatbot/pro/"> Pro Version have lot more features</a> </p>
732
+ <!-- <p class="description">it's like giving high priority to page content and also getting benefit in page speed rank, seo as Page speed tools will not count the sdk and messenger )</p> -->
733
+ <?php
734
+ }
735
+
736
+ if ( 'true' == HTCC_PRO ) {
737
+ include_once HTCC_PLUGIN_DIR . 'admin/pro/admin-sdk-load-time.php';
738
+ }
739
+
740
+ }
741
+
742
+
743
+
744
+
745
  /**
746
  * Sanitize each setting field as needed
747
  *
admin/class-htcc-enqueue.php CHANGED
@@ -14,7 +14,7 @@ class HTCC_Enqueue {
14
  function enqueue( $hook ) {
15
 
16
  // echo $hook;
17
- if( 'toplevel_page_wp-chatbot' == $hook || 'wp-chatbot_page_wp-chatbot-features' == $hook || 'wp-chatbot_page_wp-chatbot-actions' == $hook || 'wp-chatbot_page_wp-chatbot-pro-woo' == $hook ) {
18
 
19
 
20
  // color picker..
14
  function enqueue( $hook ) {
15
 
16
  // echo $hook;
17
+ if( 'toplevel_page_wp-chatbot' == $hook || 'wp-chatbot_page_wp-chatbot-features' == $hook || 'wp-chatbot_page_wp-chatbot-actions' == $hook || 'wp-chatbot_page_wp-chatbot-pro-woo' == $hook || 'wp-chatbot_page_wp-chatbot-browser-support' == $hook ) {
18
 
19
 
20
  // color picker..
admin/commons/ht-cc-admin-sidebar.php CHANGED
@@ -31,6 +31,12 @@ if ( ! defined( 'ABSPATH' ) ) exit;
31
  <br>
32
 
33
 
 
 
 
 
 
 
34
  <!-- premium plugin card -->
35
  <div class="card blue-grey darken-1">
36
  <div class="card-content white-text">
@@ -44,11 +50,23 @@ if ( ! defined( 'ABSPATH' ) ) exit;
44
  Different Settings per Device ( Mobile, Desktop ) </p>
45
  <br>
46
 
47
- <p>Display Messenger Icon <br>
48
  - After Some Time Delay, <br>
49
  - After user Scroll down the page <br>
50
  Different Settings per Device ( Mobile, Desktop ) </p>
51
  <br>
 
 
 
 
 
 
 
 
 
 
 
 
52
 
53
  <p>Update Greetings, REF on Fly <br>
54
  - based on Time <br>
@@ -70,21 +88,16 @@ if ( ! defined( 'ABSPATH' ) ) exit;
70
 
71
  <p>WooCommerce - Separate Settings page<br>
72
  - Greetings Dialog, REF, Page ID, Color <br>
73
- plan to expand a lot of features </p>
74
  <br>
75
 
76
  <p>Placeholders for Greetings Dialog, REF <br>
77
- - {{product}} - to add WooCommerce single product name <br>
78
  in Greeting Dialog, REF Attribute <br>
79
  - {{title}} - to add page title in REF Attribute <br>
80
  - {{id}} - to add the page ID in REF Attribute </p>
81
  <br>
82
 
83
- <p>Don’t Load Messenger on<br>
84
- - Selected Days in a Week ( like Weekends ) <br>
85
- - Selected Time Range in a Day ( like non working hours ) </p>
86
- <br>
87
-
88
  <!-- <p>( planning to expand a lot of Features, Especially related to WooCommerce )</p> -->
89
  <p>More Features Included</p>
90
  <br>
@@ -93,13 +106,17 @@ if ( ! defined( 'ABSPATH' ) ) exit;
93
  <p></p>
94
  </div>
95
  <div class="card-action">
96
- <a target="_blank" href="https://www.holithemes.com/shop/product-category/wp-chatbot-pro/?utm_source=wp-chatbot&utm_medium=admin-page">Plans</a><br><br>
97
 
98
  <!-- <a target="_blank" href="https://www.holithemes.com/shop/product/wp-chatbot-pro-single-website-plan/?utm_source=wp-chatbot&utm_medium=admin-page">Single Website plan</a><br><br> -->
99
  <!-- <a target="_blank" href="https://www.holithemes.com/shop/product/wp-chatbot-pro-unlimited-website-plan/?utm_source=wp-chatbot&utm_medium=admin-page">Unlimited Website plan</a> -->
100
  </div>
101
  </div>
102
 
 
 
 
 
103
  <small class="close" onclick="ht_cc_admin_hide_services_content()" style="cursor: pointer;">Hide this box</small>
104
 
105
  </div>
31
  <br>
32
 
33
 
34
+ <?php
35
+
36
+ // dont display on pro version
37
+ if ( 'true' !== HTCC_PRO ) {
38
+ ?>
39
+
40
  <!-- premium plugin card -->
41
  <div class="card blue-grey darken-1">
42
  <div class="card-content white-text">
50
  Different Settings per Device ( Mobile, Desktop ) </p>
51
  <br>
52
 
53
+ <p>Display Messenger<br>
54
  - After Some Time Delay, <br>
55
  - After user Scroll down the page <br>
56
  Different Settings per Device ( Mobile, Desktop ) </p>
57
  <br>
58
+
59
+ <p>Set Greetings text Dialog<br>
60
+ - based on time range (like working hours or not)<br>
61
+ - based on days in a week (like working days or not) <br>
62
+ ( Online / Offline feature )</p>
63
+ <br>
64
+
65
+ <p>option to not Load Messenger on <br>
66
+ - Selected Days in a Week ( like Weekends ) <br>
67
+ - Selected Time Range ( like non working hours ) <br>
68
+ ( Online / Offline feature )</p>
69
+ <br>
70
 
71
  <p>Update Greetings, REF on Fly <br>
72
  - based on Time <br>
88
 
89
  <p>WooCommerce - Separate Settings page<br>
90
  - Greetings Dialog, REF, Page ID, Color <br>
91
+ plan to expand to a lot of features </p>
92
  <br>
93
 
94
  <p>Placeholders for Greetings Dialog, REF <br>
95
+ - {{product}} - to add WooCommerce product name
96
  in Greeting Dialog, REF Attribute <br>
97
  - {{title}} - to add page title in REF Attribute <br>
98
  - {{id}} - to add the page ID in REF Attribute </p>
99
  <br>
100
 
 
 
 
 
 
101
  <!-- <p>( planning to expand a lot of Features, Especially related to WooCommerce )</p> -->
102
  <p>More Features Included</p>
103
  <br>
106
  <p></p>
107
  </div>
108
  <div class="card-action">
109
+ <a target="_blank" href="https://www.holithemes.com/wp-chatbot/pro/?utm_source=wp-chatbot&utm_medium=admin-page">WP-Chatbot PRO</a><br><br>
110
 
111
  <!-- <a target="_blank" href="https://www.holithemes.com/shop/product/wp-chatbot-pro-single-website-plan/?utm_source=wp-chatbot&utm_medium=admin-page">Single Website plan</a><br><br> -->
112
  <!-- <a target="_blank" href="https://www.holithemes.com/shop/product/wp-chatbot-pro-unlimited-website-plan/?utm_source=wp-chatbot&utm_medium=admin-page">Unlimited Website plan</a> -->
113
  </div>
114
  </div>
115
 
116
+ <?php
117
+ }
118
+ ?>
119
+
120
  <small class="close" onclick="ht_cc_admin_hide_services_content()" style="cursor: pointer;">Hide this box</small>
121
 
122
  </div>
inc/browser/browser.js CHANGED
@@ -32,7 +32,7 @@ browser_name = browser.name.toLowerCase();
32
  // if safari browser ..
33
  if ( browser_name == "safari" && browser.version >= 12 ) {
34
  // if ( browser_name == "chrome" && browser.version >= 12 ) {
35
- // console.log('Safari 12');
36
  fbcheck();
37
  }
38
 
32
  // if safari browser ..
33
  if ( browser_name == "safari" && browser.version >= 12 ) {
34
  // if ( browser_name == "chrome" && browser.version >= 12 ) {
35
+ console.log('Safari 12');
36
  fbcheck();
37
  }
38
 
inc/class-htcc-chatbot.php CHANGED
@@ -15,6 +15,7 @@ class HTCC_Chatbot {
15
  // if sdk is not added then dont add - customer chat html content
16
  public $sdk_added = 'no';
17
  public $sdk_added_for_shortcode = 'no';
 
18
 
19
  /**
20
  * load Customer Chat SDK at header
@@ -187,42 +188,97 @@ class HTCC_Chatbot {
187
  // update xfbml
188
  $xfbml = true;
189
  if ( 'true' == HTCC_PRO ) {
190
- // include_once HTCC_PLUGIN_DIR . 'inc/pro/htcc-update-sdk.php';
191
-
192
  // if pro set to false - parse form js after conditons check .. ..
193
  $xfbml = false;
194
  }
195
 
196
- ?>
197
-
 
 
 
 
198
 
199
- <!-- Add Messenger - wp-chatbot - HoliThemes - https://www.holithemes.com/wp-chatbot -->
200
- <script>
201
- window.fbAsyncInit = function() {
202
- FB.init({
203
- appId : '<?php echo $fb_app_id ?>',
204
- autoLogAppEvents : <?php echo $log_events ? 'true' : 'false' ?>,
205
- xfbml : <?php echo $xfbml ? 'true' : 'false' ?>,
206
- version : 'v3.2'
207
- });
208
- };
209
-
210
- (function(d, s, id){
211
- var js, fjs = d.getElementsByTagName(s)[0];
212
- if (d.getElementById(id)) {return;}
213
- js = d.createElement(s); js.id = id;
214
- js.src = '<?php echo $fb_sdk_src ?>';
215
- fjs.parentNode.insertBefore(js, fjs);
216
- }(document, 'script', 'facebook-jssdk'));
217
- </script>
218
 
219
- <!-- / Add Messenger - wp-chatbot - HoliThemes -->
220
 
 
 
 
 
 
 
 
 
221
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
222
  <?php
 
 
223
  // After sdk is added
 
224
  $this->sdk_added = 'yes';
225
-
 
226
  }
227
 
228
 
15
  // if sdk is not added then dont add - customer chat html content
16
  public $sdk_added = 'no';
17
  public $sdk_added_for_shortcode = 'no';
18
+ public $sdk_load_time = '';
19
 
20
  /**
21
  * load Customer Chat SDK at header
188
  // update xfbml
189
  $xfbml = true;
190
  if ( 'true' == HTCC_PRO ) {
 
 
191
  // if pro set to false - parse form js after conditons check .. ..
192
  $xfbml = false;
193
  }
194
 
195
+ // is_sdk_after_page_load
196
+ // is_sdk_4_seconds
197
+ $is_sdk_after_page_load = 'no';
198
+ if ( isset( $htcc_options['is_sdk_after_page_load'] ) ) {
199
+ $is_sdk_after_page_load = 'yes';
200
+ }
201
 
202
+ $sdk_load_time = '';
203
+ $is_sdk_4_seconds = 'no';
204
+ if ( isset( $htcc_options['is_sdk_4_seconds'] ) ) {
205
+ $is_sdk_4_seconds = 'yes';
206
+ $sdk_load_time = '4';
207
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
208
 
 
209
 
210
+ if ( isset( $htcc_options['sdk_load_time'] ) ) {
211
+ $db_sdk_load_time = esc_attr( $htcc_options['sdk_load_time'] );
212
+
213
+ // to avoud - if +2 is enabled and sdk_load_time value is empty.
214
+ if ( '0.1' < $db_sdk_load_time ) {
215
+ $sdk_load_time = $db_sdk_load_time;
216
+ }
217
+ }
218
 
219
+ if ( 'yes' == $is_sdk_after_page_load && '0.1' <= $sdk_load_time ) {
220
+ ?>
221
+ <!-- Add Messenger - wp-chatbot - HoliThemes - https://www.holithemes.com/wp-chatbot -->
222
+ <script>
223
+ window.onload = function() {
224
+ setTimeout(function(){
225
+ htcc_load_fb_sdk();
226
+ }, <?php echo $sdk_load_time ?> * 1000 );
227
+ }
228
+ function htcc_load_fb_sdk() {
229
+ window.fbAsyncInit = function() {
230
+ FB.init({
231
+ appId : '<?php echo $fb_app_id ?>',
232
+ autoLogAppEvents : <?php echo $log_events ? 'true' : 'false' ?>,
233
+ xfbml : <?php echo $xfbml ? 'true' : 'false' ?>,
234
+ version : 'v3.2'
235
+ });
236
+ };
237
+
238
+ (function(d, s, id){
239
+ var js, fjs = d.getElementsByTagName(s)[0];
240
+ if (d.getElementById(id)) {return;}
241
+ js = d.createElement(s); js.id = id;
242
+ js.src = '<?php echo $fb_sdk_src ?>';
243
+ fjs.parentNode.insertBefore(js, fjs);
244
+ }(document, 'script', 'facebook-jssdk'));
245
+ }
246
+ </script>
247
+ <!-- / Add Messenger - wp-chatbot - HoliThemes -->
248
+ <?php
249
+ } else {
250
+ ?>
251
+ <!-- Add Messenger - wp-chatbot - HoliThemes - https://www.holithemes.com/wp-chatbot -->
252
+ <script>
253
+ window.onload = function() {
254
+ console.log('window loaded');
255
+ }
256
+ window.fbAsyncInit = function() {
257
+ FB.init({
258
+ appId : '<?php echo $fb_app_id ?>',
259
+ autoLogAppEvents : <?php echo $log_events ? 'true' : 'false' ?>,
260
+ xfbml : <?php echo $xfbml ? 'true' : 'false' ?>,
261
+ version : 'v3.2'
262
+ });
263
+ };
264
+
265
+ (function(d, s, id){
266
+ var js, fjs = d.getElementsByTagName(s)[0];
267
+ if (d.getElementById(id)) {return;}
268
+ js = d.createElement(s); js.id = id;
269
+ js.src = '<?php echo $fb_sdk_src ?>';
270
+ fjs.parentNode.insertBefore(js, fjs);
271
+ }(document, 'script', 'facebook-jssdk'));
272
+ </script>
273
+ <!-- / Add Messenger - wp-chatbot - HoliThemes -->
274
  <?php
275
+ }
276
+
277
  // After sdk is added
278
+ // for customer_chat(), var htcc_values
279
  $this->sdk_added = 'yes';
280
+ $this->sdk_load_time = $sdk_load_time;
281
+
282
  }
283
 
284
 
inc/class-htcc-db.php CHANGED
@@ -48,12 +48,19 @@ class HTCC_db {
48
  *
49
  * greeting_dialog_display - show, hide, fade
50
  * greeting_dialog_delay - number in seconds with in quotes
 
 
 
 
 
 
 
51
  */
52
  $values = array(
53
  // 'enable' => '1', Deprecated
54
  'fb_page_id' => '',
55
  'fb_app_id' => '',
56
- 'log_events' => 'yes',
57
  'fb_sdk_lang' => 'en_US',
58
 
59
  'fb_color' => '',
@@ -67,6 +74,8 @@ class HTCC_db {
67
  'greeting_dialog_display' => '',
68
  'greeting_dialog_delay' => '',
69
  'ref' => '',
 
 
70
  );
71
 
72
  $db_values = get_option( 'htcc_options', array() );
48
  *
49
  * greeting_dialog_display - show, hide, fade
50
  * greeting_dialog_delay - number in seconds with in quotes
51
+ *
52
+ *
53
+ * sdk_load_time - set time when to load sdk after page load..
54
+ *
55
+ * checkbox
56
+ * is_sdk_after_page_load - if checked sdk will load after page load
57
+ * is_sdk_4_seconds - if both checked - after page loaded, load sdk after 4 seconds
58
  */
59
  $values = array(
60
  // 'enable' => '1', Deprecated
61
  'fb_page_id' => '',
62
  'fb_app_id' => '',
63
+ 'log_events' => 'no',
64
  'fb_sdk_lang' => 'en_US',
65
 
66
  'fb_color' => '',
74
  'greeting_dialog_display' => '',
75
  'greeting_dialog_delay' => '',
76
  'ref' => '',
77
+
78
+ 'sdk_load_time' => '4',
79
  );
80
 
81
  $db_values = get_option( 'htcc_options', array() );
readme.txt CHANGED
@@ -39,15 +39,20 @@ Chat history will be saved automatically, continue chat at any time using Messen
39
  * Shortcode - add different settings at page level.
40
  * WooCommerce Compatible
41
 
42
- = Temporary feature - Supports for Safari 12 =
43
 
44
- [Customer Chat plugin](https://developers.facebook.com/docs/messenger-platform/discovery/customer-chat-plugin) Support for Safari 12 has been temporarily disabled.
45
- For Safari 12, This plugin adds "Message Us" button
46
- The "Message Us" button navigates to Messenger.com or Messenger App based on device.
47
- Can disable this option from plugin settings.
 
 
 
 
 
 
 
48
 
49
- Once Customer Chat plugin supports Safari 12, We will disable this feature and update the plugin. or within that time you can disable the feature from plugin settings.
50
- [browser usage](https://caniuse.com/usage-table), approximately 1% uses Safari 12 (29th October, 2018)
51
 
52
  == Premium Version - WP-Chabot Pro ==
53
 
@@ -58,11 +63,21 @@ Once Customer Chat plugin supports Safari 12, We will disable this feature and u
58
  - Greetings Dialog and Chat Window Position
59
  Different Settings per Device ( Mobile, Desktop )
60
 
61
- * Display Messenger Icon
62
  - After some Time Delay
63
  - After user scroll down the page
64
  Different Settings per Device ( Mobile, Desktop )
65
 
 
 
 
 
 
 
 
 
 
 
66
  * Update Greetings, REF on Fly
67
  - based on Time
68
  - based on user Scroll down the page
@@ -104,12 +119,12 @@ From your Facebook page -> 'settings' -> 'Messenger Platform' tab and at 'Whitel
104
 
105
  [Plugin Settings Page](https://www.holithemes.com/wp-chatbot/wp-chatbot-settings/?utm_source=wp.org&utm_medium=wp-chatbot-description),
106
 
107
- This plugin adds Facebook Messenger Customer Chat plugin in your Website.
108
 
109
 
110
  = Shortcodes =
111
 
112
- Useful to change settings at page level. like changing Facebook Page, color, Greetings text, REF,...
113
 
114
  [chatbot page_id="123456789"]
115
 
@@ -215,6 +230,15 @@ Can set different settings per device ( Mobile, Desktop ).
215
 
216
  [WP Chatbot Pro](https://www.holithemes.com/wp-chatbot/pro/?utm_source=wp.org&utm_medium=wp-chatbot&utm_campaign=plugin-faq-demo)
217
 
 
 
 
 
 
 
 
 
 
218
 
219
 
220
  == Upgrade Notice ==
@@ -232,6 +256,12 @@ Can set different settings per device ( Mobile, Desktop ).
232
 
233
  == Changelog ==
234
 
 
 
 
 
 
 
235
  = 3.5 =
236
  "Message Us" button for Safari 12
237
  SDK updated to 3.2
39
  * Shortcode - add different settings at page level.
40
  * WooCommerce Compatible
41
 
42
+ <pre> Alternate support for Safari 12 (more info at faq)</pre>
43
 
44
+ = Load SDK After Page Loads ( Beta - added in v3.7 ) =
45
+
46
+
47
+ **Load Customer Chat SDK after page loads** - First webpage loads and then calls Customer chat SDK and display messenger.
48
+
49
+ **+4 seconds after page loads** - First Webpage loads and after 4 seconds call SDK and display Messenger - benfits at page speed metrics, SEO
50
+ To identify the benfit
51
+ 1. Check Page before activating this plugin ( GTmetrix or similar )
52
+ 2. Check after activating and enable this 'after page load' and '+4' feature
53
+ It will be almost the same, by just adding Messenger after a few seconds dealy. this can benfit at Page speed, SEO
54
+ ( In pro version can set time to load SDK after page loads )
55
 
 
 
56
 
57
  == Premium Version - WP-Chabot Pro ==
58
 
63
  - Greetings Dialog and Chat Window Position
64
  Different Settings per Device ( Mobile, Desktop )
65
 
66
+ * Display/Parse Messenger
67
  - After some Time Delay
68
  - After user scroll down the page
69
  Different Settings per Device ( Mobile, Desktop )
70
 
71
+ * Set Greetings text Dialog
72
+ - based on time range (like working hours or not)
73
+ - based on days in a week (like working days or not)
74
+ ( Online / Offline feature )
75
+
76
+ * option to not Load Messenger on
77
+ - Selected Days in a Week ( like Weekends )
78
+ - Selected Time Range ( like non working hours )
79
+ ( Online / Offline feature )
80
+
81
  * Update Greetings, REF on Fly
82
  - based on Time
83
  - based on user Scroll down the page
119
 
120
  [Plugin Settings Page](https://www.holithemes.com/wp-chatbot/wp-chatbot-settings/?utm_source=wp.org&utm_medium=wp-chatbot-description),
121
 
122
+ This plugin adds Messenger Customer Chat on your Website.
123
 
124
 
125
  = Shortcodes =
126
 
127
+ Useful to change settings at page level. to change Facebook Page, color, Greetings text, REF,...
128
 
129
  [chatbot page_id="123456789"]
130
 
230
 
231
  [WP Chatbot Pro](https://www.holithemes.com/wp-chatbot/pro/?utm_source=wp.org&utm_medium=wp-chatbot&utm_campaign=plugin-faq-demo)
232
 
233
+ = Supports for Safari 12 =
234
+
235
+ Support for Safari 12 has been temporarily disabled by [Customer Chat plugin](https://developers.facebook.com/docs/messenger-platform/discovery/customer-chat-plugin)
236
+ If page loads on browser Safari 12, This plugin adds "Message Us" button.
237
+ The "Message Us" button navigates to Messenger.com or Messenger App based on device.
238
+
239
+ [Demo, Docs](https://www.holithemes.com/wp-chatbot/safari-12/) "Message Us" feature.
240
+
241
+ Once Customer Chat plugin supports Safari 12, We will disable this feature and update the plugin. or within that time you can disable the feature from plugin settings.
242
 
243
 
244
  == Upgrade Notice ==
256
 
257
  == Changelog ==
258
 
259
+ = 3.7 =
260
+ alpha feature - load sdk after page load (page speed matters)
261
+
262
+ = silent release =
263
+ browser feature - admin page user interface
264
+
265
  = 3.5 =
266
  "Message Us" button for Safari 12
267
  SDK updated to 3.2
wp-chatbot.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: WP Chatbot
4
  Plugin URI: https://www.holithemes.com/wp-chatbot/
5
  Description: Add Messenger to your website, Chatbot or live Chat using Facebook Messenger
6
- Version: 3.5
7
  Author: HoliThemes
8
  Author URI: https://www.holithemes.com/
9
  License: GPL2
@@ -17,7 +17,7 @@ if ( ! defined( 'ABSPATH' ) ) exit;
17
 
18
  // Version - define HTCC_VERSION
19
  if ( ! defined( 'HTCC_VERSION' ) ) {
20
- define( 'HTCC_VERSION', '3.5' );
21
  }
22
 
23
 
3
  Plugin Name: WP Chatbot
4
  Plugin URI: https://www.holithemes.com/wp-chatbot/
5
  Description: Add Messenger to your website, Chatbot or live Chat using Facebook Messenger
6
+ Version: 3.7
7
  Author: HoliThemes
8
  Author URI: https://www.holithemes.com/
9
  License: GPL2
17
 
18
  // Version - define HTCC_VERSION
19
  if ( ! defined( 'HTCC_VERSION' ) ) {
20
+ define( 'HTCC_VERSION', '3.7' );
21
  }
22
 
23