LiveChat – WP live chat plugin for WordPress - Version 2.0.0

Version Description

  • Rewritten whole plugin from scratch
  • Ability to create new license from Wordpress plugin settings
  • Updated monitoring code speed
  • Added notification messages
Download this release

Release Info

Developer livechat
Plugin Icon 128x128 LiveChat – WP live chat plugin for WordPress
Version 2.0.0
Comparing to
See all releases

Code changes from version 1.0.0 to 2.0.0

livechat.php CHANGED
@@ -2,83 +2,135 @@
2
  /*
3
  Plugin Name: Live Chat Software for Wordpress
4
  Plugin URI: http://www.livechatinc.com
5
- Description: Description: Live chat software for live help, online sales and customer support. Plugin allows to quickly install the live chat button and monitoring code on any WordPress website.
6
  Author: LIVECHAT Software
7
- Version: 1.0.0
8
  Author URI: http://www.livechatinc.com
9
  */
10
 
11
- function sampleLIVECHAT($licenceNumber, $groups, $language) {
12
- ?>
13
- <!-- BEGIN LIVECHAT button tag. See also www.livechatinc.com -->
14
- <div style="text-align:center"><a id="LivechatButton" href="http://chat.livechatinc.net/licence/<?php echo $licenceNumber?>/open_chat.cgi?groups=<?php echo $groups?>&amp;lang=<?php echo $language?>" target="chat_<?php echo $licenceNumber?>" onclick="window.open('http://chat.livechatinc.net/licence/<?php echo $licenceNumber?>/open_chat.cgi?groups=<?php echo $groups?>'+'&amp;lang=<?php echo $language?>&amp;dc='+escape(document.cookie+';l='+document.location+';r='+document.referer+';s='+typeof lc_session),'Czat_<?php echo $licenceNumber?>','width=529,height=520,resizable=yes,scrollbars=no,status=1');return false;"></a><script type='text/javascript'>var img=new Image();img.style.border='0';img.src=(("https:" == document.location.protocol) ? "https://" : "http://")+'chat.livechatinc.net/licence/<?php echo $licenceNumber?>/button.cgi?lang=<?php echo $language?>&groups=<?php echo $groups?>'+'&d='+((new Date()).getTime());var _livechat_button=document.getElementById('LivechatButton');if(_livechat_button!=null){_livechat_button.appendChild(img);}</script><br><span style="font-family:Tahoma,sans-serif;font-size:10px;color:#333"><a href="http://www.livechatinc.com" style="font-size:10px;text-decoration:none" target="_blank">Live Chat</a> <span style="color: #475780">Software for Business</span></span></div>
15
- <!-- END LIVECHAT button tag. See also www.livechatinc.com -->
16
- <!-- BEGIN LIVECHAT track tag. See also www.livechatinc.com -->
17
- <script type="text/javascript">
18
- var livechat_params = '';
19
- var livechat_host = (("https:" == document.location.protocol) ? "https://" : "http://");
20
- livechat_params = ((livechat_params == '') ? '' : '&amp;params='+encodeURIComponent(livechat_params));
21
- document.write(unescape("%3Cscript src='") + livechat_host + "chat.livechatinc.net/licence/<?php echo $licenceNumber?>/script.cgi?lang=<?php echo $language?>&amp;groups=<?php echo $groups?>" + livechat_params + unescape("' type='text/javascript'%3E%3C/script%3E"));
22
- </script>
23
- <!-- END LIVECHAT track tag. See also www.livechatinc.com -->
24
- <?php
 
 
25
  }
26
 
27
- function widget_myLIVECHAT($args) {
28
- extract($args);
29
-
30
- $options = get_option("widget_myLIVECHAT");
31
- if (!is_array( $options )) {
32
- $options = array(
33
- 'licence_number' => '',
34
- 'language' => 'en',
35
- 'groups' => 0
36
- );
37
- }
38
- //Our Widget Content
39
- sampleLIVECHAT($options['licence_number'], $options['groups'], $options['language']);
40
  }
41
 
42
- function myLIVECHAT_control() {
43
- $options = get_option("widget_myLIVECHAT");
44
- if (!is_array( $options )) {
45
- $options = array(
46
- 'licence_number' => '',
47
- 'language' => 'en',
48
- 'groups' => 0
49
- );
50
- }
51
-
52
- if ($options['groups'] == '') { $options['groups'] = "0"; }
53
- if ($options['language'] == '') { $options['language'] = "en"; }
54
- if ($_POST['myLIVECHAT-Submit']) {
55
- $options['licence_number'] = htmlspecialchars($_POST['myLIVECHAT-licence_number']);
56
- $options['language'] = htmlspecialchars($_POST['myLIVECHAT-language']);
57
- $options['groups'] = htmlspecialchars($_POST['myLIVECHAT-groups']);
58
- update_option("widget_myLIVECHAT", $options);
59
- }
60
-
61
- ?>
62
- <p>
63
- <label for="myLIVECHAT-licence_number">Enter your licence number: </label><br />
64
- <input type="text" id="myLIVECHAT-licence_number" name="myLIVECHAT-licence_number" value="<?php echo $options['licence_number'];?>" />
65
- </p>
66
- <p>
67
- <label for="myLIVECHAT-language">Button language (default is EN): </label><br />
68
- <input type="text" id="myLIVECHAT-language" name="myLIVECHAT-language" value="<?php echo $options['language'];?>" />
69
- </p>
70
- <p>
71
- <label for="myLIVECHAT-groups">Groups (default is 0): </label><br />
72
- <input type="text" id="myLIVECHAT-groups" name="myLIVECHAT-groups" value="<?php echo $options['groups'];?>" />
73
- </p>
74
- <input type="hidden" id="myLIVECHAT-Submit" name="myLIVECHAT-Submit" value="1" />
75
- </p>
76
- <?php
77
  }
78
 
79
- function myLIVECHAT_init() {
80
- wp_register_sidebar_widget( 'WIDGETID', 'LIVECHAT Contact Center', 'widget_myLIVECHAT', array('description' => __('Live chat software for live help, online sales and customer support. Plugin allows to quickly install the live chat button and monitoring code on any WordPress website.')) );
81
- wp_register_widget_control( 'WIDGETID', 'LIVECHAT Contact Center', 'myLIVECHAT_control');
 
 
 
 
82
  }
83
- add_action("plugins_loaded", "myLIVECHAT_init");
84
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  /*
3
  Plugin Name: Live Chat Software for Wordpress
4
  Plugin URI: http://www.livechatinc.com
5
+ Description: Live chat software for live help, online sales and customer support. This plugin allows to quickly install the live chat button and monitoring code on any WordPress website.
6
  Author: LIVECHAT Software
7
+ Version: 2.0.0
8
  Author URI: http://www.livechatinc.com
9
  */
10
 
11
+
12
+ //
13
+ // Admin panel
14
+ //
15
+
16
+ /**
17
+ * Loads CSS styles for admin panel styling
18
+ */
19
+
20
+ define ('LIVECHAT_PLUGIN_URL', WP_PLUGIN_URL . str_replace('\\', '/', strrchr(dirname(__FILE__), DIRECTORY_SEPARATOR)) . '/plugin_files');
21
+
22
+ function livechat_admin_head()
23
+ {
24
+ echo '<style type="text/css">';
25
+ echo '@import url('.LIVECHAT_PLUGIN_URL.'/css/styles.css);';
26
+ echo '</style>';
27
  }
28
 
29
+ /**
30
+ * Loads jQuery scripts in admin panel
31
+ */
32
+ function livechat_admin_footer()
33
+ {
34
+ echo '<script type="text/javascript" src="'.LIVECHAT_PLUGIN_URL.'/js/scripts.js"></script>';
35
+ echo '<script type="text/javascript" src="'.LIVECHAT_PLUGIN_URL.'/js/signup.js"></script>';
 
 
 
 
 
 
36
  }
37
 
38
+ /**
39
+ * Registers livechat settings variables
40
+ */
41
+ function livechat_sanitize_license_number ($license_number)
42
+ {
43
+ if (preg_match('/^\d{2,}$/', $license_number)) return $license_number;
44
+
45
+ return '';;
46
+ }
47
+
48
+ function livechat_sanitize_lang ($lang)
49
+ {
50
+ if (preg_match('/^[a-z]{2}$/', $lang)) return $lang;
51
+
52
+ return 'en';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
  }
54
 
55
+ function livechat_admin_register_settings()
56
+ {
57
+ register_setting ('livechat_license_information', 'livechat_license_number', 'livechat_sanitize_license_number');
58
+ register_setting ('livechat_license_information', 'livechat_lang', 'livechat_sanitize_lang');
59
+ register_setting ('livechat_license_information', 'livechat_groups');
60
+ register_setting ('livechat_license_information', 'livechat_params');
61
+ register_setting ('livechat_license_information', 'livechat_license_created_flag');
62
  }
63
+
64
+ function livechat_read_options()
65
+ {
66
+ $license_number = get_option('livechat_license_number');
67
+
68
+ $lang = get_option('livechat_lang');
69
+ if (empty ($lang)) $lang = 'en';
70
+
71
+ $groups = get_option('livechat_groups');
72
+ if (empty ($groups)) $groups = '0';
73
+
74
+ $params = get_option('livechat_params');
75
+
76
+ return array ($license_number, $lang, $groups, $params);
77
+ }
78
+
79
+ /**
80
+ * Creates new admin menu
81
+ */
82
+ function livechat_admin_menu()
83
+ {
84
+ require_once (dirname(__FILE__).'/plugin_files/settings.php');
85
+
86
+ add_menu_page ('Live chat settings', 'Live chat', 'administrator', '_livechat_settings', '_livechat_settings' /* live chat logo here */);
87
+ add_submenu_page ('_livechat_settings', 'Live chat settings', 'Settings', 'administrator', '_livechat_settings', '_livechat_settings');
88
+ }
89
+
90
+ add_action ('admin_head', 'livechat_admin_head');
91
+ add_action ('admin_footer', 'livechat_admin_footer');
92
+ add_action ('admin_menu', 'livechat_admin_menu');
93
+ add_action ('admin_init', 'livechat_admin_register_settings');
94
+
95
+
96
+
97
+ //
98
+ // Monitoring code installation
99
+ //
100
+
101
+ function livechat_monitoring_code()
102
+ {
103
+ require_once (dirname(__FILE__).'/plugin_files/monitoring_code.php');
104
+
105
+ list ($license_number, $lang, $groups, $params) = livechat_read_options();
106
+
107
+ _livechat_monitoring_code ($license_number, $lang, $groups, $params);
108
+ }
109
+
110
+ add_action ('get_footer', 'livechat_monitoring_code');
111
+
112
+
113
+ //
114
+ // Chat button code installation
115
+ //
116
+
117
+ function livechat_chat_button_code()
118
+ {
119
+ require_once (dirname(__FILE__).'/plugin_files/chat_button_code.php');
120
+
121
+ list ($license_number, $lang, $groups, $params) = livechat_read_options();
122
+
123
+ _livechat_chat_button_code ($license_number, $lang, $groups);
124
+ }
125
+
126
+ function livechat_chat_button_code_control()
127
+ {
128
+ require_once (dirname(__FILE__).'/plugin_files/chat_button_code.php');
129
+
130
+ list ($license_number, $lang, $groups, $params) = livechat_read_options();
131
+
132
+ _livechat_chat_button_code_control ($license_number, $lang, $groups);
133
+ }
134
+
135
+ wp_register_sidebar_widget ('livechat_widget', 'Live chat for Wordpress', 'livechat_chat_button_code');
136
+ wp_register_widget_control ('livechat_widget', 'Live chat for Wordpress', 'livechat_chat_button_code_control');
plugin_files/chat_button_code.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ function _livechat_chat_button_code ($license_number, $lang, $groups, $use_ssl = false)
4
+ {
5
+ ?>
6
+
7
+ <!-- BEGIN LIVECHAT button tag. See also www.livechatinc.com -->
8
+ <div style="text-align:center"><a id="LivechatButton" href="http<?php echo $use_ssl ? 's' : ''; ?>://chat.livechatinc.net/licence/<?php echo $license_number; ?>/open_chat.cgi?groups=<?php echo $groups; ?>&amp;lang=<?php echo $lang; ?>" target="chat_<?php echo $license_number; ?>" onclick="window.open('http<?php echo $use_ssl ? 's' : ''; ?>://chat.livechatinc.net/licence/<?php echo $license_number; ?>/open_chat.cgi?groups=<?php echo $groups; ?>'+'&amp;lang=<?php echo $lang; ?>&amp;dc='+escape(document.cookie+';l='+document.location+';r='+document.referer+';s='+typeof lc_session),'Czat_<?php echo $license_number; ?>','width=529,height=520,resizable=yes,scrollbars=no,status=1');return false;"></a><script type='text/javascript'>var img=new Image();img.style.border='0';img.src=(("https:" == document.location.protocol) ? "https://" : "http://")+'chat.livechatinc.net/licence/<?php echo $license_number; ?>/button.cgi?lang=<?php echo $lang; ?>&groups=<?php echo $groups; ?>'+'&d='+((new Date()).getTime());var _livechat_button=document.getElementById('LivechatButton');if(_livechat_button!=null){_livechat_button.appendChild(img);}</script><br><span style="font-family:Tahoma,sans-serif;font-size:10px;color:#333"><a href="http://www.livechatinc.com" style="font-size:10px;text-decoration:none" target="_blank">Live Chat</a> <span style="color: #475780">Software for Business</span></span></div>
9
+ <!-- END LIVECHAT button tag. See also www.livechatinc.com -->
10
+
11
+ <?php
12
+ }
13
+
14
+ function _livechat_chat_button_code_control ($license_number, $lang, $groups, $use_ssl = false)
15
+ {
16
+ if (strlen(get_option('livechat_license_number') > 0)):
17
+ ?>
18
+ <p>Your live chat button is installed properly!</p>
19
+ <hr class="livechat">
20
+ <p>License number: <strong><?php echo $license_number; ?></strong><br>
21
+ Language: <strong><?php echo $lang; ?></strong><br>
22
+ Groups: <strong><?php echo $groups; ?></strong></p>
23
+ <hr class="livechat">
24
+ <p>To change these settings, go to <a href="?page=_livechat_settings">Live chat plugin settings page</a>.</p>
25
+ <?php else: ?>
26
+ <p>Your live chat button <strong>is not working yet</strong>.</p>
27
+ <p>You need to <a href="?page=_livechat_settings">set up your live chat account</a> first.</p>
28
+ <?php endif; ?>
29
+ <?php
30
+ }
plugin_files/css/styles.css ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .installed_ok { background-color: #e1fdc5; border-color: #6ac611; }
2
+ .postbox h3 { cursor: default; }
3
+ .postbox_content { padding: 0 10px; }
4
+ .postbox_content ul { margin-top: 5px; }
5
+ .explanation { display: block; margin-top: 3px; padding-left: 5px; }
6
+ a.help,
7
+ span.help a { color: #bbb; }
8
+ #wpbody-content a.help:hover,
9
+ #wpbody-content .help a:hover { color: #222; }
10
+ .installed_ok a.help,
11
+ .installed_ok .help a,
12
+ .info a.help,
13
+ .info .help a { color: #666; }
14
+ .installed_ok a.help,
15
+ .info a.help,
16
+ .installed_ok span.help,
17
+ .info span.help { font-weight: normal; color: #666; font-size: 85%; }
18
+ h3.no-radius { -moz-border-radius: 0; }
19
+ hr.livechat { margin-bottom: 1em; height: 1px; border: 0; color: #999; background: #ccc; }
20
+ #ajax_message { display: none; background: url(../images/ajax_loader.gif) no-repeat 5px 60%; font-size: 85%; padding: 0; }
21
+ #ajax_message.wait,
22
+ #ajax_message.message { display: block; }
23
+ #ajax_message.wait { text-indent: 28px; }
24
+ #ajax_message.message { background-image: none; text-indent: 0px; }
plugin_files/images/ajax_loader.gif ADDED
Binary file
plugin_files/js/scripts.js ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ if (!$) $ = jQuery;
2
+ $(document).ready(function()
3
+ {
4
+ var show_form = function()
5
+ {
6
+ if ($('#choice_account_0').is(':checked'))
7
+ {
8
+ $('#livechat_already_have').hide();
9
+ $('#livechat_new_account').show();
10
+ }
11
+ else if ($('#choice_account_1').is(':checked'))
12
+ {
13
+ $('#livechat_new_account').hide();
14
+ $('#livechat_already_have').show();
15
+ }
16
+ }
17
+
18
+ show_form();
19
+ $('#choice_account input').change(show_form);
20
+ });
plugin_files/js/signup.js ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ $(document).ready(function()
2
+ {
3
+ var validate = function(use_alert)
4
+ {
5
+ if ($('#livechat_account_first_name').val().length < 1)
6
+ {
7
+ if (use_alert) alert ('Please enter your first name.');
8
+ return false;
9
+ }
10
+
11
+ if ($('#livechat_account_first_name').val().length < 1)
12
+ {
13
+ if (use_alert) alert ('Please enter your last name.');
14
+ return false;
15
+ }
16
+
17
+ if (/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,6}$/i.test($('#livechat_account_email').val()) == false)
18
+ {
19
+ if (use_alert) alert ('Please enter a valid email address.');
20
+ return false;
21
+ }
22
+
23
+ return true;
24
+ }
25
+
26
+ $('#livechat_new_account form').submit(function()
27
+ {
28
+ if (validate(true))
29
+ {
30
+ $('#ajax_message').removeClass('message').addClass('wait').html('Please wait&hellip;');
31
+
32
+ var create_licence = function()
33
+ {
34
+ $('#ajax_message').removeClass('message').addClass('wait').html('Creating new licence&hellip;');
35
+
36
+ var url = 'http://www.livechatinc.com/en/signup/';
37
+ url += '?account_first_name='+$('#livechat_account_first_name').val();
38
+ url += '&account_last_name='+$('#livechat_account_last_name').val();
39
+ url += '&account_email='+$('#livechat_account_email').val();
40
+ url += '&action=wordpress_signup';
41
+ url += '&recaptcha_ip='+$('input[name=recaptcha_ip]').val();
42
+ url += '&recaptcha_challenge_field='+$('input[name=recaptcha_challenge_field]').val();
43
+ url += '&recaptcha_response_field='+$('input[name=recaptcha_response_field]').val();
44
+ url += '&jsoncallback=?';
45
+
46
+ $.getJSON(url,
47
+ function(data)
48
+ {
49
+ data = parseInt(data.response);
50
+ if (data == '-1')
51
+ {
52
+ // Wrong captcha
53
+ $('#ajax_message').html('Confirmation code is incorrect. Please try again.').addClass('message').removeClass('wait');
54
+ return false;
55
+ }
56
+ if (data == '0')
57
+ {
58
+ $('#ajax_message').html('Could not create licence. Please try again later.').addClass('message').removeClass('wait');
59
+ return false;
60
+ }
61
+
62
+ // Save new licence number
63
+ $('#livechat_license_number').val(data);
64
+ $('#livechat_license_created_flag').val('1');
65
+ $('#livechat_already_have form')
66
+ .unbind('submit')
67
+ .submit();
68
+ });
69
+ }
70
+
71
+ // Check if email address is available
72
+ $.getJSON('http://www.livechatinc.com/php/licence_info.php?email='+$('#livechat_new_account form input[name=livechat_account_email]').val()+'&jsoncallback=?',
73
+ function(data)
74
+ {
75
+ data = parseInt(data.response);
76
+ if (data == 1)
77
+ {
78
+ create_licence();
79
+ }
80
+ else if (data == 2)
81
+ {
82
+ $('#ajax_message').removeClass('wait').addClass('message').html('This email address is already in use. Please choose another e-mail address.');
83
+ }
84
+ else
85
+ {
86
+ $('#ajax_message').removeClass('wait').addClass('message').html('Could not create licence. Please try again later.');
87
+ }
88
+ });
89
+ }
90
+ return false;
91
+ });
92
+ });
plugin_files/monitoring_code.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ function _livechat_monitoring_code($license_number, $lang, $groups, $params)
4
+ {
5
+ ?>
6
+
7
+ <!-- BEGIN LIVECHAT track tag. See also www.livechatinc.com -->
8
+ <script type="text/javascript">
9
+ var livechat_params = '<?php echo $params; ?>';
10
+ var livechat_host = (("https:" == document.location.protocol) ? "https://" : "http://");
11
+ livechat_params = ((livechat_params == '') ? '' : '&amp;params='+encodeURIComponent(livechat_params));
12
+ document.write(unescape("%3Cscript src='") + livechat_host + "chat.livechatinc.net/licence/<?php echo $license_number; ?>/script.cgi?lang=<?php echo $lang; ?>&amp;groups=<?php echo $groups; ?>" + livechat_params + unescape("' type='text/javascript'%3E%3C/script%3E"));
13
+ </script>
14
+ <!-- END LIVECHAT track tag. See also www.livechatinc.com -->
15
+
16
+ <?php
17
+ }
plugin_files/settings.php ADDED
@@ -0,0 +1,187 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ function _livechat_helper_license_created_info()
4
+ {
5
+ echo '<div class="updated installed_ok"><p><strong>Your live chat license has been created! Please follow the instructions we\'ve sent you on your e-mail address to install live chat agent application.</strong></p></div>';
6
+ }
7
+
8
+ function _livechat_helper_monitoring_code_info()
9
+ {
10
+ if (strlen(get_option('livechat_license_number') > 0))
11
+ {
12
+ echo '<div class="updated installed_ok"><p><strong>Your live chat monitoring code is installed properly. <a class="help" href="http://www.livechatinc.com/en/support/manual/monitoring_code.htm">(what is a monitoring code?)</a> </strong></p></div>';
13
+ }
14
+ }
15
+
16
+ function _livechat_helper_chat_button_info()
17
+ {
18
+ if (strlen(get_option('livechat_license_number') > 0))
19
+ {
20
+ if (is_active_widget (null, 'livechat_widget', true))
21
+ {
22
+ echo '<div class="updated info installed_ok"><p><strong>Your live chat button is installed properly. <span class="help">(<a href="widgets.php">manage widgets</a> | <a href="http://www.livechatinc.com/en/support/manual/chat_button.htm" target="_blank">what is a chat button?</a>)</span> </strong></p></div>';
23
+ }
24
+ else
25
+ {
26
+ echo '<div class="updated info"><p><strong>To install your live chat button, go to <a href="widgets.php">Widgets</a> page. <a class="help" href="http://www.livechatinc.com/en/support/manual/chat_button.htm" target="_blank">(what is a chat button?)</a> </strong></p></div>';
27
+ }
28
+ }
29
+ }
30
+
31
+ function _livechat_helper_saved_info()
32
+ {
33
+ if (isset($_GET['updated']))
34
+ {
35
+ echo '<div class="updated"><p><strong>Settings saved.</strong></p></div>';
36
+ }
37
+ }
38
+
39
+ function _livechat_settings()
40
+ {
41
+ ?>
42
+ <div class="wrap">
43
+ <h2>Live chat software for Wordpress</h2>
44
+
45
+ <?php
46
+ if (get_option('livechat_license_created_flag') == '1')
47
+ {
48
+ delete_option('livechat_license_created_flag');
49
+ _livechat_helper_license_created_info();
50
+ _livechat_helper_monitoring_code_info();
51
+ _livechat_helper_chat_button_info();
52
+ }
53
+ else
54
+ {
55
+ _livechat_helper_monitoring_code_info();
56
+ _livechat_helper_chat_button_info();
57
+ _livechat_helper_saved_info();
58
+ }
59
+ ?>
60
+
61
+ <div class="metabox-holder">
62
+ <div class="postbox">
63
+ <h3>Do you already have a live chat account?</h3>
64
+ <div class="postbox_content">
65
+ <ul id="choice_account">
66
+ <li><input type="radio" name="choice_account" id="choice_account_1" checked="checked"> <label for="choice_account_1">Yes, I already have a live chat account</label></li>
67
+ <li><input type="radio" name="choice_account" id="choice_account_0"> <label for="choice_account_0">No, I want to create one</label></li>
68
+ </ul>
69
+ </div>
70
+ </div>
71
+ </div>
72
+
73
+ <!-- Already have an account -->
74
+ <div class="metabox-holder" id="livechat_already_have" style="display:none">
75
+ <div class="postbox">
76
+ <form method="post" action="options.php">
77
+ <?php settings_fields('livechat_license_information'); ?>
78
+
79
+ <h3>Enter your live chat account information</h3>
80
+ <div class="postbox_content">
81
+ <table class="form-table">
82
+ <tr>
83
+ <th scope="row"><label for="livechat_license_number">My license number is:</label></th>
84
+ <td><input type="text" name="livechat_license_number" id="livechat_license_number" value="<?php echo get_option('livechat_license_number'); ?>" /> <span class="explanation">You will find your license number in the <a href="https://panel.livechatinc.net/" target="_blank">Control Panel</a>.</span></td>
85
+ </tr>
86
+ </table>
87
+ </div>
88
+
89
+ <?php if (strlen(get_option('livechat_license_number')) > 1): ?>
90
+ <h3 class="no-radius">Advanced settings</h3>
91
+ <div class="postbox_content">
92
+ <table class="form-table">
93
+ <?php
94
+ $lang = get_option('livechat_lang');
95
+ if (empty($lang)) $lang = 'en';
96
+ ?>
97
+ <tr>
98
+ <th scope="row"><label for="livechat_lang">Language:</label></th>
99
+ <td><input type="text" name="livechat_lang" id="livechat_lang" value="<?php echo $lang; ?>" /> <a class="help" href="http://www.livechatinc.com/en/support/documentation/customizing_web_agent_.htm" target="_blank">supported languages list</a> <span class="explanation"><strong>en</strong> for English (default)</span></td>
100
+ </tr>
101
+
102
+ <?php
103
+ $groups = get_option('livechat_groups');
104
+ if (empty($groups)) $groups = '0';
105
+ ?>
106
+ <tr>
107
+ <th scope="row"><label for="livechat_groups">Groups:</label></th>
108
+ <td><input type="text" name="livechat_groups" id="livechat_groups" value="<?php echo $groups; ?>" /> <a class="help" href="http://www.livechatinc.com/en/support/manual/establishing_groups_of_operators.htm" target="3">what is that?</a> <span class="explanation"><strong>0</strong> for default group (recommended)</span></td>
109
+ </tr>
110
+
111
+ <?php
112
+ $params = get_option('livechat_params');
113
+ ?>
114
+ <tr>
115
+ <th scope="row"><label for="livechat_params">Params:</label></th>
116
+ <td><input type="text" name="livechat_params" id="livechat_params" value="<?php echo $params; ?>" /> <a class="help" href="http://www.livechatinc.com/en/support/documentation/customizing_web_agent_.htm" target="_blank">advanced help</a></td>
117
+ </tr>
118
+ </table>
119
+ <?php else: ?>
120
+ <div class="postbox_content">
121
+ <?php endif; ?>
122
+
123
+ <p class="submit">
124
+ <input type="hidden" name="livechat_license_created_flag" value="0" id="livechat_license_created_flag">
125
+ <input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
126
+ </p>
127
+
128
+ </div>
129
+ </form>
130
+ </div>
131
+ </div>
132
+
133
+ <!-- New account form -->
134
+ <div class="metabox-holder" id="livechat_new_account" style="display:none">
135
+ <div class="postbox">
136
+ <form method="post" action="options.php">
137
+ <h3>Create new live chat account</h3>
138
+ <div class="postbox_content">
139
+
140
+ <?php settings_fields('livechat_license_created'); ?>
141
+ <table class="form-table">
142
+ <tr>
143
+ <th scope="row"><label for="livechat_account_first_name">First name:</label></th>
144
+ <td><input type="text" name="livechat_account_first_name" id="livechat_account_first_name" maxlength="30" /></td>
145
+ </tr>
146
+ <tr>
147
+ <th scope="row"><label for="livechat_account_last_name">Last name:</label></th>
148
+ <td><input type="text" name="livechat_account_last_name" id="livechat_account_last_name" maxlength="30" /></td>
149
+ </tr>
150
+ <tr>
151
+ <th scope="row"><label for="livechat_account_email">E-mail:</label></th>
152
+ <td><input type="text" name="livechat_account_email" id="livechat_account_email" maxlength="70" /></td>
153
+ </tr>
154
+
155
+ <tr>
156
+ <th scope="row"><label>Confirmation code:</label></th>
157
+ <td>
158
+ <!-- ReCaptcha -->
159
+ <input type="hidden" name="recaptcha_ip" value="<?php echo $_SERVER['REMOTE_ADDR']; ?>">
160
+ <script type="text/javascript" src="https://api-secure.recaptcha.net/challenge?k=6LcqygsAAAAAAF5zKDVwo5Mfvc4DarPQIcc_lxTn"></script>
161
+ <noscript><iframe src="https://api-secure.recaptcha.net/noscript?k=6LcqygsAAAAAAF5zKDVwo5Mfvc4DarPQIcc_lxTn" height="300" width="500" frameborder="0"></iframe><br>
162
+ <textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea><input type="hidden" name="recaptcha_response_field" value="manual_challenge"></noscript>
163
+ <!-- end ReCaptcha -->
164
+ </td>
165
+ </tr>
166
+ </table>
167
+
168
+ <p id="ajax_message"></p>
169
+
170
+ <table class="form-table">
171
+ <tr>
172
+ <td class="submit">
173
+ <input type="submit" value="Create account" id="submit" class="button-primary">
174
+ </td>
175
+ </tr>
176
+ </table>
177
+
178
+ </div>
179
+ </form>
180
+ </div>
181
+ </div>
182
+
183
+
184
+
185
+
186
+ <?php
187
+ }
readme.txt CHANGED
@@ -110,11 +110,10 @@ LIVECHAT Contact Center works with:
110
 
111
  == Installation ==
112
 
113
- 1. Upload `livechat.php` to the `/wp-content/plugins/` directory
114
  2. Activate the plugin through the 'Plugins' menu in WordPress
115
- 3. Sign up to create your new live chat account: https://www.livechatinc.com/en/signup/
116
- 4. Put your license number in your plugin settings (you will find it in live chat Dashboard).
117
- 5. It works!
118
 
119
  == Frequently Asked Questions ==
120
 
@@ -215,5 +214,11 @@ This add-on allows agents to use Skype account to call back the customers in the
215
 
216
  == Changelog ==
217
 
 
 
 
 
 
 
218
  = 1.0.0 =
219
  * First plugin version
110
 
111
  == Installation ==
112
 
113
+ 1. Upload `wp-live-chat-software-for-wordpress` directory to Wordpress plugins directory (`/wp-content/plugins/`)
114
  2. Activate the plugin through the 'Plugins' menu in WordPress
115
+ 3. Click the 'Live Chat' menu on the left.
116
+ 4. Follow the instructions.
 
117
 
118
  == Frequently Asked Questions ==
119
 
214
 
215
  == Changelog ==
216
 
217
+ = 2.0.0 =
218
+ * Rewritten whole plugin from scratch
219
+ * Ability to create new license from Wordpress plugin settings
220
+ * Updated monitoring code speed
221
+ * Added notification messages
222
+
223
  = 1.0.0 =
224
  * First plugin version