Zendesk Chat - Version 1.0.1

Version Description

  • Maintenance update: More robust connectivity, CURL errors caught
  • Note: PHP Curl is required (and has always been).
Download this release

Release Info

Developer bencxr
Plugin Icon 128x128 Zendesk Chat
Version 1.0.1
Comparing to
See all releases

Code changes from version 0.7 to 1.0.1

Files changed (4) hide show
  1. accountconfig.php +9 -8
  2. customizewidget.php +2 -2
  3. readme.txt +17 -5
  4. zopim.php +18 -2
accountconfig.php CHANGED
@@ -31,13 +31,9 @@ function zopim_account_config() {
31
  $error["login"] = "<b>Could not log in to Zopim. Please check your login details. If problem persists, try connecting without SSL enabled.</b>";
32
  $gotologin = 1;
33
  update_option('zopimSalt', "wronglogin");
34
- } else {
35
  update_option('zopimUsername', $_POST["zopimUsername"]);
36
- if (isset($loginresult->salt)) {
37
- update_option('zopimSalt', $loginresult->salt);
38
- } else {
39
- update_option('zopimSalt', "");
40
- }
41
  $account = getAccountDetails(get_option('zopimSalt'));
42
 
43
  if (isset($account)) {
@@ -48,6 +44,9 @@ function zopim_account_config() {
48
  update_option('zopimGreetings', $jsongreetings);
49
  }
50
  }
 
 
 
51
  }
52
  }
53
  } else if ($_POST["action"]=="signup") {
@@ -71,9 +70,11 @@ function zopim_account_config() {
71
  $signupresult = json_to_array(do_post_request(ZOPIM_SIGNUP_URL, $createdata));
72
  if (isset($signupresult->error)) {
73
  $message = "<div style='color:#c33;'>Error during activation: <b>".$signupresult->error."</b>. Please try again.</div>";
74
- } else {
75
  $message = "<b>Thank you for signing up. Please check your mail for your password to complete the process. </b>";
76
  $gotologin = 1;
 
 
77
  }
78
  }
79
 
@@ -166,7 +167,7 @@ function showSignup(whichform) {
166
  </tr>
167
 
168
  <tr valign="top">
169
- <th scope="row">Zopim Pasword</th>
170
  <td><input type="password" name="zopimPassword" value="<?php if (get_option('zopimSalt') != "") { echo "password"; }; ?>" /></td>
171
  </tr>
172
 
31
  $error["login"] = "<b>Could not log in to Zopim. Please check your login details. If problem persists, try connecting without SSL enabled.</b>";
32
  $gotologin = 1;
33
  update_option('zopimSalt', "wronglogin");
34
+ } else if (isset($loginresult->salt)) {
35
  update_option('zopimUsername', $_POST["zopimUsername"]);
36
+ update_option('zopimSalt', $loginresult->salt);
 
 
 
 
37
  $account = getAccountDetails(get_option('zopimSalt'));
38
 
39
  if (isset($account)) {
44
  update_option('zopimGreetings', $jsongreetings);
45
  }
46
  }
47
+ } else {
48
+ update_option('zopimSalt', "");
49
+ $error["login"] = "<b>Could not log in to Zopim. We were unable to contact Zopim servers. Please check with your server administrator to ensure that <a href='http://www.php.net/manual/en/book.curl.php'>PHP Curl</a> is installed and permissions are set correctly.</b>";
50
  }
51
  }
52
  } else if ($_POST["action"]=="signup") {
70
  $signupresult = json_to_array(do_post_request(ZOPIM_SIGNUP_URL, $createdata));
71
  if (isset($signupresult->error)) {
72
  $message = "<div style='color:#c33;'>Error during activation: <b>".$signupresult->error."</b>. Please try again.</div>";
73
+ } else if (isset($signupresult->account_key)) {
74
  $message = "<b>Thank you for signing up. Please check your mail for your password to complete the process. </b>";
75
  $gotologin = 1;
76
+ } else {
77
+ $message = "<b>Could not activate account. The wordpress installation was unable to contact Zopim servers. Please check with your server administrator to ensure that <a href='http://www.php.net/manual/en/book.curl.php'>PHP Curl</a> is installed and permissions are set correctly.</b>";
78
  }
79
  }
80
 
167
  </tr>
168
 
169
  <tr valign="top">
170
+ <th scope="row">Zopim Password</th>
171
  <td><input type="password" name="zopimPassword" value="<?php if (get_option('zopimSalt') != "") { echo "password"; }; ?>" /></td>
172
  </tr>
173
 
customizewidget.php CHANGED
@@ -227,7 +227,7 @@ line-height:21px;
227
 
228
  if ($accountDetails->color_customization_enabled == 1) {
229
  echo "<div style='display:inline-block;border:11px solid #888;background:#888;color:#fee;'>";
230
- $colors = file_get_contents(ZOPIM_COLORS_LIST);
231
  $colors = explode("\n", $colors);
232
 
233
  $i=0;
@@ -251,7 +251,7 @@ line-height:21px;
251
 
252
  if ($accountDetails->widget_customization_enabled == 1) {
253
  echo '<select name="zopimTheme" id="zopimTheme" onchange="updateWidget()">';
254
- $themes = file_get_contents(ZOPIM_THEMES_LIST);
255
  $themes = valuekeys(explode("\n", $themes));
256
  ksort($themes);
257
 
227
 
228
  if ($accountDetails->color_customization_enabled == 1) {
229
  echo "<div style='display:inline-block;border:11px solid #888;background:#888;color:#fee;'>";
230
+ $colors = curl_get_url(ZOPIM_COLORS_LIST);
231
  $colors = explode("\n", $colors);
232
 
233
  $i=0;
251
 
252
  if ($accountDetails->widget_customization_enabled == 1) {
253
  echo '<select name="zopimTheme" id="zopimTheme" onchange="updateWidget()">';
254
+ $themes = curl_get_url(ZOPIM_THEMES_LIST);
255
  $themes = valuekeys(explode("\n", $themes));
256
  ksort($themes);
257
 
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: bencxr
3
  Tags: widget, plugin, sidebar, page, admin, enhancement, livechat, chat, widget
4
  Requires at least: 2.7
5
- Tested up to: 2.8.2
6
- Stable tag: 0.7
7
 
8
  Visitors can chat with you directly by clicking on the Zopim Chat Bar.
9
 
@@ -30,6 +30,13 @@ Great for improving interaction with your users and increasing the time they spe
30
 
31
  == Changelog ==
32
 
 
 
 
 
 
 
 
33
  = 0.6.1 =
34
  * Update: Launched with improved signup process and minor cosmetic fixes.
35
 
@@ -83,13 +90,18 @@ Not at all! Zopim is a hosted livechat service. Simply configure the plugin and
83
 
84
  Though designed to work on most browsers, Zopim works best in the following environment: IE 6 or later (PC), Firefox 2 or later (Mac, PC, or Linux), Safari 2 or later (Mac), Google Chrome (PC, Mac).
85
 
 
 
 
 
 
86
  = Is it free to use? =
87
 
88
  The plugin comes with a free plan specially tailored for Wordpress users. Power users can purchase upgrade options anytime.
89
 
90
  = Its just not working for me! HELP! =
91
 
92
- Dont worry!! We are happy to assist! Just come on down to our site at http://www.zopim.com and we will help you with installation.
93
 
94
  == Usage ==
95
 
@@ -97,5 +109,5 @@ After enabling the plug in, head on to the widget customization page to change s
97
 
98
  == Installation ==
99
 
100
- *Server Requirements:* PHP4 or PHP5.
101
-
2
  Contributors: bencxr
3
  Tags: widget, plugin, sidebar, page, admin, enhancement, livechat, chat, widget
4
  Requires at least: 2.7
5
+ Tested up to: 2.9.2
6
+ Stable tag: 1.0.2
7
 
8
  Visitors can chat with you directly by clicking on the Zopim Chat Bar.
9
 
30
 
31
  == Changelog ==
32
 
33
+ = 1.0.1 =
34
+ * Maintenance update: More robust connectivity, CURL errors caught
35
+ * Note: PHP Curl is required (and has always been).
36
+
37
+ = 1.0 =
38
+ * Stability update: Official Plugin Launched
39
+
40
  = 0.6.1 =
41
  * Update: Launched with improved signup process and minor cosmetic fixes.
42
 
90
 
91
  Though designed to work on most browsers, Zopim works best in the following environment: IE 6 or later (PC), Firefox 2 or later (Mac, PC, or Linux), Safari 2 or later (Mac), Google Chrome (PC, Mac).
92
 
93
+ = I managed to install the plugin but cannot link up to Zopim. Why? =
94
+ Most likely PHP Curl is not installed or configured properly. Please request your server administrator to enable the PHP CURL extension (see http://www.php.net/manual/en/book.curl.php for details).
95
+
96
+ Alternatively, you can also manually include the script in the footer file ("wp-content/themes/default/footer.php" in your wordpress installation).
97
+
98
  = Is it free to use? =
99
 
100
  The plugin comes with a free plan specially tailored for Wordpress users. Power users can purchase upgrade options anytime.
101
 
102
  = Its just not working for me! HELP! =
103
 
104
+ Dont worry!! We are happy to assist! Just come on down to our site at http://www.zopim.com or leave an email for us at wordpress@zopim.com and we will help you with installation.
105
 
106
  == Usage ==
107
 
109
 
110
  == Installation ==
111
 
112
+ *Server Requirements:* PHP4 or PHP5 with PHP Curl installed.
113
+ *Wordpress versions:* Wordpress 2.7 and up.
zopim.php CHANGED
@@ -5,7 +5,7 @@ Plugin Name: Zopim Widget
5
  Plugin URI: http://www.zopim.org
6
  Description: Zopim embeds a chatbar on your website, so that any visitor can chat with you directly by clicking on the chatbar.
7
  Author: Isidore
8
- Version: 0.7.1
9
  Author URI: http://www.isidorechan.com/
10
  */
11
 
@@ -40,9 +40,12 @@ function zopimme() {
40
 
41
  // Use zopim's code...
42
  echo "
 
43
  <script type=\"text/javascript\">
44
  document.write(unescape(\"%3Cscript src='\" + document.location.protocol + \"//".ZOPIM_SCRIPT_DOMAIN."/?".$code."' charset='utf-8' type='text/javascript'%3E%3C/script%3E\"));
45
- </script>";
 
 
46
 
47
  $theoptions = array();
48
  if (get_option('zopimLang') != "" && get_option('zopimLang') != "--") {
@@ -258,4 +261,17 @@ function getAccountDetails($salt) {
258
  return json_to_array(do_post_request(ZOPIM_GETACCOUNTDETAILS_URL, $salty));
259
  }
260
 
 
 
 
 
 
 
 
 
 
 
 
 
 
261
  ?>
5
  Plugin URI: http://www.zopim.org
6
  Description: Zopim embeds a chatbar on your website, so that any visitor can chat with you directly by clicking on the chatbar.
7
  Author: Isidore
8
+ Version: 1.0
9
  Author URI: http://www.isidorechan.com/
10
  */
11
 
40
 
41
  // Use zopim's code...
42
  echo "
43
+ <!-- Start of Zopim Live Chat Script -->
44
  <script type=\"text/javascript\">
45
  document.write(unescape(\"%3Cscript src='\" + document.location.protocol + \"//".ZOPIM_SCRIPT_DOMAIN."/?".$code."' charset='utf-8' type='text/javascript'%3E%3C/script%3E\"));
46
+ </script>
47
+ <!-- End of Zopim Live Chat Script -->
48
+ ";
49
 
50
  $theoptions = array();
51
  if (get_option('zopimLang') != "" && get_option('zopimLang') != "--") {
261
  return json_to_array(do_post_request(ZOPIM_GETACCOUNTDETAILS_URL, $salty));
262
  }
263
 
264
+ function curl_get_url($filename) {
265
+
266
+ $ch = curl_init();
267
+ $timeout = 5; // set to zero for no timeout
268
+ curl_setopt ($ch, CURLOPT_URL, $filename);
269
+ curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
270
+ curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
271
+ $file_contents = curl_exec($ch);
272
+ curl_close($ch);
273
+
274
+ return $file_contents;
275
+ }
276
+
277
  ?>