Zendesk Chat - Version 1.2.0

Version Description

  • Signup process is now linked to zopim.com as per Wordpress guidelines.
Download this release

Release Info

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

Code changes from version 1.1.3 to 1.2.0

Files changed (5) hide show
  1. accountconfig.php +119 -247
  2. customizewidget.php +233 -233
  3. imintegration.php +65 -65
  4. readme.txt +11 -7
  5. zopim.php +24 -23
accountconfig.php CHANGED
@@ -2,7 +2,7 @@
2
3
// Settings page in the admin panel
4
function zopim_account_config() {
5
- global $usernameToCodeURL, $languagesURL, $current_user;
6
7
?>
8
@@ -10,288 +10,160 @@ function zopim_account_config() {
10
11
<?php
12
13
- if ($_GET["action"]=="deactivate") {
14
- update_option('zopimSalt', "");
15
- update_option('zopimCode', "zopim");
16
- }
17
-
18
- $message = "";
19
- if ($_POST["action"]=="login") {
20
- if ($_POST["zopimUseSSL"] == "") {
21
- $_POST["zopimUseSSL"] = "nossl";
22
- }
23
- update_option('zopimUseSSL', $_POST["zopimUseSSL"]);
24
-
25
- if ($_POST["zopimPassword"] != "password") {
26
-
27
- $logindata = array("email" => $_POST["zopimUsername"], "password" => $_POST["zopimPassword"]);
28
- $loginresult = json_to_array(do_post_request(ZOPIM_LOGIN_URL, $logindata));
29
-
30
- if (isset($loginresult->error)) {
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)) {
40
- update_option('zopimCode', $account->account_key);
41
-
42
- if (get_option('zopimGreetings') == "") {
43
- $jsongreetings = to_json($account->settings->greetings);
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") {
53
-
54
- if ($_POST["zopimUseSSL"] == "") {
55
- $_POST["zopimUseSSL"] = "nossl";
56
- }
57
- update_option('zopimUseSSL', $_POST["zopimUseSSL"]);
58
-
59
- $createdata = array(
60
- "email" => $_POST["zopimnewemail"],
61
- "first_name" => $_POST["zopimfirstname"],
62
- "last_name" => $_POST["zopimlastname"],
63
- "display_name" => $_POST["zopimfirstname"]." ".$_POST["zopimlastname"],
64
- "eref" => $_POST["zopimeref"],
65
- "source" => "wordpress",
66
- "recaptcha_challenge_field" => $_POST["recaptcha_challenge_field"],
67
- "recaptcha_response_field" => $_POST["recaptcha_response_field"]
68
- );
69
-
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
-
81
- if (get_option('zopimCode') != "" && get_option('zopimCode') != "zopim") {
82
-
83
- $accountDetails = getAccountDetails(get_option('zopimSalt'));
84
-
85
- if (!isset($accountDetails) || isset($accountDetails->error)) {
86
- $gotologin = 1;
87
- $error["auth"] = '
88
- <div class="metabox-holder">
89
<div class="postbox">
90
<h3 class="hndle"><span>Account no longer linked!</span></h3>
91
<div style="padding:10px;line-height:17px;">
92
- We could not verify your Zopim account. Please check your password and try again.
93
</div>
94
- </div>
95
- </div>'
96
;
97
- } else {
98
- $authenticated = "ok";
99
- }
100
- }
101
-
102
- if ($authenticated == "ok") {
103
- if ($accountDetails->package_id=="trial") {
104
- $accountDetails->package_id = "Free Lite Package + 14 Days Full-features";
105
- } else {
106
- $accountDetails->package_id .= " Package";
107
- }
108
?>
109
<div id="icon-options-general" class="icon32"><br/></div><h2>Set up your Zopim Account</h2>
110
<br/>
111
<div style="background:#FFFEEB;padding:25px;border:1px solid #eee;">
112
<span style="float:right;"><a href="admin.php?page=zopim_account_config&action=deactivate">Deactivate</a></span>
113
- Currently Activated Account &rarr; <b><?php echo get_option('zopimUsername'); ?></b> <div style="display:inline-block;background:#444;color:#fff;font-size:10px;text-transform:uppercase;padding:3px 8px;-moz-border-radius:5px;-webkit-border-radius:5px;"><?php echo ucwords($accountDetails->package_id); ?></div>
114
<br><p><br>You can <a href="admin.php?page=zopim_customize_widget">customize</a> the chat widget, <a href="admin.php?page=zopim_instant_messaging">relay messages</a> to your favourite IM client, or <a href="admin.php?page=zopim_dashboard">launch the dashboard</a> for advanced features.
115
</div>
116
117
<?php } else { ?>
118
<div id="icon-options-general" class="icon32"><br/></div><h2>Set up your Zopim Account</h2>
119
<?php if ($error && $error["auth"]) {
120
- echo $error["auth"];
121
- } else if ($message == "") { ?>
122
Congratulations on successfully installing the Zopim WordPress plugin! Activate an account to start using Zopim Live Chat.<br>
123
<br>
124
<?php } else { echo $message; } ?>
125
126
- <script type="text/javascript">
127
-
128
- function showSignup(whichform) {
129
- if (whichform == '1') {
130
- document.getElementById('existingform').style.display = "none";
131
- document.getElementById('signupform').style.display = "block";
132
- document.getElementById('formtoshow_signup').checked = 'true';
133
- } else {
134
- document.getElementById('signupform').style.display = "none";
135
- document.getElementById('existingform').style.display = "block";
136
- document.getElementById('formtoshow_existing').checked = 'true';
137
- }
138
- }
139
-
140
-
141
- </script>
142
- <div class="metabox-holder">
143
- <div class="postbox">
144
- <h3 class="hndle"><span>Select a Setup</span></h3>
145
- <div style="padding:10px;">
146
- <div onclick="javascript: showSignup(1)"><input type="radio" name="formtoshow" id="formtoshow_signup" value="yes" onchange="javascript: showSignup(1)"/> Give me a new account &mdash; <i>absolutely free!</i></div>
147
- <br/>
148
- <div onclick="javascript: showSignup(0)"><input type="radio" name="formtoshow" id="formtoshow_existing" value="no" onchange="javascript: showSignup(0)"/> I already have a Zopim account</div>
149
- </div>
150
- </div>
151
- </div>
152
-
153
-
154
- <div id="existingform" style="display: none">
155
<div class="metabox-holder">
156
<div class="postbox">
157
<h3 class="hndle"><span>Link up to your Zopim account</span></h3>
158
<div style="padding:10px;">
159
<?php if (isset($error) && isset($error["login"])) { echo $error["login"]; } ?>
160
<form method="post" action="admin.php?page=zopim_account_config">
161
- <input type="hidden" name="action" value="login">
162
- <table class="form-table">
163
-
164
- <tr valign="top">
165
- <th scope="row">Zopim Username (E-mail)</th>
166
- <td><input type="text" name="zopimUsername" value="<?php echo get_option('zopimUsername'); ?>" /></td>
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
-
174
- <tr valign="center">
175
- <th scope="row">Use SSL</th>
176
- <td><input type="checkbox" name="zopimUseSSL" value="zopimUseSSL" <?php if (get_option('zopimUseSSL') == "zopimUseSSL") { echo "checked='checked'"; } ?> /> uncheck this if you are unable to login</td>
177
- </tr>
178
- </table>
179
<br/>
180
The Zopim chat bar will displayed on your blog once your account is linked up.
181
- <br/><br/>
182
- <p class="submit">
183
- <input type="submit" class="button-primary" value="<?php _e('Link Up') ?>" />
184
- </p>
185
186
</form>
187
188
</div>
189
- </div>
190
</div>
191
</div>
192
193
- <div id="signupform" style="display: none">
194
- <div class="metabox-holder">
195
- <div class="postbox">
196
- <h3 class="hndle"><span>Activate your free Zopim Account</span></h3>
197
- <div style="padding:10px;">
198
- <form method="post" action="admin.php?page=zopim_account_config" onSubmit="return checkSignUp();">
199
- <input type="hidden" name="action" value="signup">
200
- <div id="signuperror"></div>
201
- <table class="form-table">
202
-
203
- <tr valign="top">
204
- <th scope="row">First Name</th>
205
- <td><input id="zopimfirstname" type="text" name="zopimfirstname" value="<?php if (isset($_POST["zopimfirstname"])) { echo $_POST["zopimfirstname"]; } else { echo $current_user->data->first_name; } ?>"></td>
206
- </tr>
207
-
208
- <tr valign="top">
209
- <th scope="row">Last Name</th>
210
- <td><input id="zopimlastname" type="text" name="zopimlastname" value="<?php if (isset($_POST["zopimlastname"])) { echo $_POST["zopimnlastname"]; } else { echo $current_user->data->last_name; } ?>"></td>
211
- </tr>
212
-
213
- <tr valign="top">
214
- <th scope="row">E-mail</th>
215
- <td><input id="zopimnewemail" type="text" name="zopimnewemail" value="<?php if (isset($_POST["zopimnewemail"])) { echo $_POST["zopimnewemail"]; } else { echo $current_user->data->user_email; } ?>"></td>
216
- </tr>
217
-
218
- <tr valign="top">
219
- <th scope="row">Use SSL</th>
220
- <td><input type="checkbox" name="zopimUseSSL" value="zopimUseSSL" checked="checked" } ?> uncheck this if you are unable to login</td>
221
- </tr>
222
-
223
- <tr valign="top">
224
- <th scope="row">Verification</th>
225
- <td>
226
- <script type="text/javascript" src="https://api-secure.recaptcha.net/challenge?k=6Lfr8AQAAAAAAC7MpRXM2hgLfyss_KKjvcJ_JFIk">
227
- </script>
228
- <noscript>
229
- <iframe src="https://api-secure.recaptcha.net/noscript?k=6Lfr8AQAAAAAAC7MpRXM2hgLfyss_KKjvcJ_JFIk"
230
- height="300" width="500" frameborder="0"></iframe><br>
231
- <textarea name="recaptcha_challenge_field" rows="3" cols="40">
232
- </textarea>
233
- <input type="hidden" name="recaptcha_response_field"
234
- value="manual_challenge">
235
- </noscript>
236
-
237
- </td>
238
- </tr>
239
- <!--
240
- <tr valign="top">
241
- <th scope="row">Referral E-mail or ID</th>
242
- <td><input id="zopimeref" type="text" name="zopimeref" value="<?php if (isset($_POST)) { echo $_POST["zopimeref"]; } ?>"></td>
243
- </tr>
244
- -->
245
- </table>
246
- <br/>
247
- The Zopim chat bar will displayed on your blog once your account is activated.<br/><br/>
248
- <input id="zopimagree" type="checkbox" name="zopimagree" value=""> I agree to Zopim's <a href="http://www.zopim.com/termsnconditions" target="_blank">Terms of Service</a> & <a href="http://www.zopim.com/privacypolicy" target="_blank">Privacy Policy</a>.
249
- <br/><br/>
250
- <p class="submit">
251
- <input type="submit" class="button-primary" value="<?php _e('Activate Now') ?>" />
252
- </p>
253
- </form>
254
- </div>
255
- </div>
256
- </div>
257
-
258
- </div>
259
</div>
260
-
261
- <script type="text/javascript">
262
- <?php
263
- if ($authenticated != "ok" && !isset($gotologin) && get_option("zopimCode")=="zopim") {
264
- echo "showSignup(1); ";
265
- } else {
266
- echo "showSignup(0); ";
267
- }
268
-
269
- ?>
270
-
271
- function checkSignUp() {
272
-
273
- var message = 'Oops! ';
274
- if (document.getElementById('zopimfirstname').value == '') {
275
-
276
- message = message + 'First name is required. ';
277
- }
278
- if (document.getElementById('zopimlastname').value == '') {
279
-
280
- message = message + 'Last name is required. ';
281
- }
282
- if (document.getElementById('zopimagree').checked == '') {
283
-
284
- message = message + 'You must agree to our Terms of Service to continue. ';
285
- }
286
-
287
- if (message != 'Oops! ') {
288
-
289
- document.getElementById('signuperror').innerHTML = message;
290
- return false;
291
- }
292
293
- return true;
294
- }
295
- </script>
296
297
<?php } } ?>
2
3
// Settings page in the admin panel
4
function zopim_account_config() {
5
+ global $usernameToCodeURL, $languagesURL, $current_user;
6
7
?>
8
10
11
<?php
12
13
+ if ($_GET["action"]=="deactivate") {
14
+ update_option('zopimSalt', "");
15
+ update_option('zopimCode', "zopim");
16
+ }
17
+
18
+ $message = "";
19
+ if ($_POST["action"]=="login") {
20
+ if ($_POST["zopimUseSSL"] == "") {
21
+ $_POST["zopimUseSSL"] = "nossl";
22
+ }
23
+ update_option('zopimUseSSL', $_POST["zopimUseSSL"]);
24
+
25
+ if ($_POST["zopimPassword"] != "password") {
26
+
27
+ $logindata = array("email" => $_POST["zopimUsername"], "password" => $_POST["zopimPassword"]);
28
+ $loginresult = json_to_array(do_post_request(ZOPIM_LOGIN_URL, $logindata));
29
+
30
+ if (isset($loginresult->error)) {
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)) {
40
+ update_option('zopimCode', $account->account_key);
41
+
42
+ if (get_option('zopimGreetings') == "") {
43
+ $jsongreetings = to_json($account->settings->greetings);
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") {
53
+
54
+ if ($_POST["zopimUseSSL"] == "") {
55
+ $_POST["zopimUseSSL"] = "nossl";
56
+ }
57
+ update_option('zopimUseSSL', $_POST["zopimUseSSL"]);
58
+
59
+ $createdata = array(
60
+ "email" => $_POST["zopimnewemail"],
61
+ "first_name" => $_POST["zopimfirstname"],
62
+ "last_name" => $_POST["zopimlastname"],
63
+ "display_name" => $_POST["zopimfirstname"]." ".$_POST["zopimlastname"],
64
+ "eref" => $_POST["zopimeref"],
65
+ "source" => "wordpress",
66
+ "recaptcha_challenge_field" => $_POST["recaptcha_challenge_field"],
67
+ "recaptcha_response_field" => $_POST["recaptcha_response_field"]
68
+ );
69
+
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
+
81
+ if (get_option('zopimCode') != "" && get_option('zopimCode') != "zopim") {
82
+
83
+ $accountDetails = getAccountDetails(get_option('zopimSalt'));
84
+
85
+ if (!isset($accountDetails) || isset($accountDetails->error)) {
86
+ $gotologin = 1;
87
+ $error["auth"] = '
88
+ <div class="metabox-holder">
89
<div class="postbox">
90
<h3 class="hndle"><span>Account no longer linked!</span></h3>
91
<div style="padding:10px;line-height:17px;">
92
+ We could not verify your Zopim account. Please check your password and try again.
93
</div>
94
+ </div>
95
+ </div>'
96
;
97
+ } else {
98
+ $authenticated = "ok";
99
+ }
100
+ }
101
+
102
+ if ($authenticated == "ok") {
103
+ if ($accountDetails->package_id=="trial") {
104
+ $accountDetails->package_id = "Free Lite Package + 14 Days Full-features";
105
+ } else {
106
+ $accountDetails->package_id .= " Package";
107
+ }
108
?>
109
<div id="icon-options-general" class="icon32"><br/></div><h2>Set up your Zopim Account</h2>
110
<br/>
111
<div style="background:#FFFEEB;padding:25px;border:1px solid #eee;">
112
<span style="float:right;"><a href="admin.php?page=zopim_account_config&action=deactivate">Deactivate</a></span>
113
+ Currently Activated Account &rarr; <b><?php echo get_option('zopimUsername'); ?></b> <div style="display:inline-block;background:#444;color:#fff;font-size:10px;text-transform:uppercase;padding:3px 8px;-moz-border-radius:5px;-webkit-border-radius:5px;"><?php echo ucwords($accountDetails->package_id); ?></div>
114
<br><p><br>You can <a href="admin.php?page=zopim_customize_widget">customize</a> the chat widget, <a href="admin.php?page=zopim_instant_messaging">relay messages</a> to your favourite IM client, or <a href="admin.php?page=zopim_dashboard">launch the dashboard</a> for advanced features.
115
</div>
116
117
<?php } else { ?>
118
<div id="icon-options-general" class="icon32"><br/></div><h2>Set up your Zopim Account</h2>
119
<?php if ($error && $error["auth"]) {
120
+ echo $error["auth"];
121
+ } else if ($message == "") { ?>
122
Congratulations on successfully installing the Zopim WordPress plugin! Activate an account to start using Zopim Live Chat.<br>
123
<br>
124
<?php } else { echo $message; } ?>
125
126
+ <div id="existingform">
127
<div class="metabox-holder">
128
<div class="postbox">
129
<h3 class="hndle"><span>Link up to your Zopim account</span></h3>
130
<div style="padding:10px;">
131
<?php if (isset($error) && isset($error["login"])) { echo $error["login"]; } ?>
132
<form method="post" action="admin.php?page=zopim_account_config">
133
+ <input type="hidden" name="action" value="login">
134
+ <table class="form-table">
135
+
136
+ <tr valign="top">
137
+ <th scope="row">Zopim Username (E-mail)</th>
138
+ <td><input type="text" name="zopimUsername" value="<?php echo get_option('zopimUsername'); ?>" /></td>
139
+ </tr>
140
+
141
+ <tr valign="top">
142
+ <th scope="row">Zopim Password</th>
143
+ <td><input type="password" name="zopimPassword" value="<?php if (get_option('zopimSalt') != "") { echo "password"; }; ?>" /></td>
144
+ </tr>
145
+
146
+ <tr valign="center">
147
+ <th scope="row">Use SSL</th>
148
+ <td><input type="checkbox" name="zopimUseSSL" value="zopimUseSSL" <?php if (get_option('zopimUseSSL') == "zopimUseSSL") { echo "checked='checked'"; } ?> /> uncheck this if you are unable to login</td>
149
+ </tr>
150
+ </table>
151
<br/>
152
The Zopim chat bar will displayed on your blog once your account is linked up.
153
+ <br/>
154
+ <p class="submit">
155
+ <input type="submit" class="button-primary" value="<?php _e('Link Up') ?>" />
156
+ Don't have a zopim account? <a href="<?php echo ZOPIM_SIGNUP_REDIRECT_URL; ?>" target="_blank" data-popup="true">Sign up now</a>.
157
+ </p>
158
159
</form>
160
161
</div>
162
+ </div>
163
</div>
164
</div>
165
166
</div>
167
168
169
<?php } } ?>
customizewidget.php CHANGED
@@ -3,24 +3,24 @@
3
// Zopim Customize Widget Page
4
5
function zopim_customize_widget() {
6
- global $current_user;
7
- $ul = $current_user->data->first_name;
8
- $useremail = $current_user->data->user_email;
9
- $greetings = json_to_array(get_option('zopimGreetings'));
10
- $message = "";
11
-
12
- if (count($_POST) > 0) {
13
- update_option('zopimLang', $_POST["zopimLang"]);
14
- update_option('zopimPosition', $_POST["zopimPosition"]);
15
- update_option("zopimBubbleEnable", $_POST["zopimBubbleEnable"] );
16
- update_option('zopimColor', $_POST["zopimColor"]);
17
- update_option('zopimTheme', $_POST["zopimTheme"]);
18
- update_option('zopimBubbleTitle', stripslashes($_POST["zopimBubbleTitle"]));
19
- update_option('zopimBubbleText', stripslashes($_POST["zopimBubbleText"]));
20
-
21
- update_checkbox("zopimGetVisitorInfo");
22
- update_checkbox("zopimHideOnOffline");
23
- update_checkbox("zopimUseGreetings");
24
update_checkbox("zopimUseBubble");
25
26
if (isset($_POST['zopimUseGreetings']) && $_POST['zopimUseGreetings'] != "") {
@@ -34,84 +34,84 @@ function zopim_customize_widget() {
34
update_option('zopimGreetings', to_json($greetings));
35
}
36
37
- $message = "<b>Changes saved!</b><br>";
38
- }
39
40
- zopimme();
41
42
- $accountDetails = getAccountDetails(get_option('zopimSalt'));
43
44
- if (get_option('zopimCode')=="zopim") {
45
- $message = '<div class="metabox-holder">
46
<div class="postbox">
47
<h3 class="hndle"><span>Customizing in Demo Mode</span></h3>
48
<div style="padding:10px;line-height:17px;">
49
- Currently customizing in demo mode. Messages in this widget will go to Zopim staff. The chat widget will not appear on your site until you <a href="admin.php?page=zopim_account_config">activate / link up an account</a>. <br>
50
</div>
51
- </div>
52
- </div>';
53
- $accountDetails->widget_customization_enabled = 1;
54
- $accountDetails->color_customization_enabled = 1;
55
- }
56
else if (isset($accountDetails->error)) {
57
- $message = '<div class="metabox-holder">
58
<div class="postbox">
59
<h3 class="hndle"><span>Account no longer linked!</span></h3>
60
<div style="padding:10px;line-height:17px;">
61
- We could not connect to your Zopim account. As a result, this customization page is running in demo mode.<br> Please <a href="admin.php?page=zopim_account_config">check your password in account setup</a> and try again.
62
</div>
63
- </div>
64
- </div>';
65
- }
66
- else {
67
- $message .= "Click 'Save Changes' when you're done. Happy customizing!";
68
- }
69
- // unset($accountDetails->widget_customization_enabled);
70
- // unset($accountDetails->color_customization_enabled);
71
?>
72
73
- <script type="text/javascript">
74
75
- function updateWidget() {
76
- var lang = document.getElementById('zopimLang').options[ document.getElementById('zopimLang').options.selectedIndex ].value;
77
- $zopim.livechat.setLanguage(lang);
78
79
- if (document.getElementById("zopimGetVisitorInfo").checked) {
80
- $zopim.livechat.setName('<?php echo $ul; ?>');
81
- $zopim.livechat.setEmail('<?php echo $useremail; ?>');
82
- }
83
else {
84
- $zopim.livechat.setName('Visitor');
85
- $zopim.livechat.setEmail('');
86
- }
87
88
- document.getElementById("zopimHideOnOffline").checked? $zopim.livechat.button.setHideWhenOffline(true): $zopim.livechat.button.setHideWhenOffline(false);
89
90
- $zopim.livechat.window.setColor(document.getElementById("zopimColor").value);
91
- $zopim.livechat.window.setTheme(document.getElementById("zopimTheme").value);
92
93
if (document.getElementById("zopimUseBubble").checked) {
94
$zopim.livechat.bubble.setTitle(document.getElementById("zopimBubbleTitle").value);
95
- $zopim.livechat.bubble.setText(document.getElementById("zopimBubbleText").value);
96
}
97
else {
98
$zopim.livechat.bubble.setTitle('Questions?');
99
- $zopim.livechat.bubble.setText('Click here to chat with us!');
100
}
101
-
102
- $zopim.livechat.setGreetings({
103
- 'online': [document.getElementById("zopimOnlineShort").value, document.getElementById("zopimOnlineLong").value],
104
- 'offline': [document.getElementById("zopimOfflineShort").value, document.getElementById("zopimOfflineLong").value],
105
- 'away': [document.getElementById("zopimAwayShort").value, document.getElementById("zopimAwayLong").value]
106
- });
107
- }
108
-
109
- function updatePosition() {
110
- var position = document.getElementById('zopimPosition').options[ document.getElementById('zopimPosition').options.selectedIndex ].value;
111
- $zopim.livechat.button.setPosition(position);
112
- }
113
-
114
- function updateBubbleStatus() {
115
var value = document.getElementById("zopimBubbleEnable").value;
116
switch (value) {
117
case 'default':
@@ -124,18 +124,18 @@ function zopim_customize_widget() {
124
$zopim.livechat.bubble.hide();
125
break;
126
}
127
- }
128
-
129
function greetingsChanged() {
130
- var inputs = [ 'zopimOnlineShort', 'zopimAwayShort', 'zopimOfflineShort',
131
- 'zopimOnlineLong' , 'zopimAwayLong', 'zopimOfflineLong' ];
132
- var isDisabled = false;
133
134
- document.getElementById('zopimUseGreetings').checked? (isDisabled = false): (isDisabled = true);
135
136
- for (var i=0; i<inputs.length; i++) {
137
document.getElementById(inputs[i]).disabled = isDisabled;
138
- }
139
140
updateWidget();
141
}
@@ -153,13 +153,13 @@ function zopim_customize_widget() {
153
updateWidget();
154
}
155
156
- var timer;
157
- function updateSoon() {
158
- clearTimeout(timer);
159
- timer = setTimeout("updateWidget()", 300);
160
- }
161
162
- </script>
163
164
<style type="text/css">
165
.smallExplanation {
@@ -195,7 +195,7 @@ line-height:21px;
195
cursor:pointer;
196
}
197
.sorry {
198
- color:#c33;
199
}
200
</style>
201
@@ -208,179 +208,179 @@ line-height:21px;
208
<div class="postbox">
209
<h3 class="hndle"><span>General Settings</span></h3>
210
<div style="padding:10px;">
211
- <table class="form-table">
212
- <tr valign="top">
213
- <th scope="row" class="sethead">Language</th>
214
- <td>
215
- <select name="zopimLang" id="zopimLang" onchange="updateWidget()">
216
- <?php
217
- $languages = get_languages();
218
- echo generate_options($languages, get_option('zopimLang'));
219
?>
220
- </select>
221
- </td>
222
- </tr>
223
- <tr valign="top" style="display:none;">
224
- <th scope="row">Use Logged in Username / Email</th>
225
- <td><input onchange="updateWidget()" type="checkbox" id="zopimGetVisitorInfo" name="zopimGetVisitorInfo" value="zopimGetVisitorInfo" <?php if (get_option('zopimGetVisitorInfo')!="disabled") { echo "checked='checked'"; } ?> /></td>
226
- </tr>
227
- <tr valign="top">
228
- <th scope="row" class="sethead">Position</th>
229
- <td>
230
-
231
- <select name="zopimPosition" id="zopimPosition" onchange="updatePosition()">
232
- <?php
233
- $positions = array("br" => "Bottom Right", "bl" => "Bottom Left");
234
- echo generate_options($positions, get_option('zopimPosition'));
235
?>
236
- </select>
237
- </td>
238
- </tr>
239
-
240
- <tr valign="top">
241
- <th scope="row">Hide chat bar when offline<br>
242
- <!-- <div class="smallExplanation">Hide the chat bar when no agents are available to answer questions. This prevents visitors from sending you offline messages. </div> -->
243
- </th>
244
- <td>
245
- <input onchange="updateWidget()" type="checkbox" id="zopimHideOnOffline" name="zopimHideOnOffline" value="zopimHideOnOffline" <?php if (get_option('zopimHideOnOffline') && get_option('zopimHideOnOffline')!="disabled") { echo "checked='checked'"; } ?> /> Prevents visitors from sending you offline messages
246
<a href="#" onclick="$zopim.livechat.button.show();return false">(Show preview chat bar)</a>
247
</td>
248
- </tr>
249
- </table>
250
</div>
251
- </div>
252
</div>
253
<div class="metabox-holder">
254
<div class="postbox">
255
<h3 class="hndle"><span>Color & Theme Settings</span></h3>
256
<div style="padding:10px;">
257
Theme settings show up instantly on the preview widget. Try it out!<br/>
258
- <table class="form-table" style="width: 700px">
259
- <tr valign="top">
260
- <td colspan="2">
261
- <input type="hidden" id="zopimColor" name="zopimColor" value="<?php echo get_option('zopimColor'); ?>">
262
<?php
263
264
- if ($accountDetails->color_customization_enabled == 1) {
265
- echo "<div style='display:inline-block;border:11px solid #888;background:#888;color:#fee;'>";
266
- $colors = curl_get_url(ZOPIM_COLORS_LIST);
267
- $colors = explode("\n", $colors);
268
-
269
- $i=0;
270
- foreach ($colors as $color) {
271
- echo "<div class='swatch' style='background-color: $color;' onclick=\"document.getElementById('zopimColor').value='$color'; updateWidget();\">&nbsp</div>";
272
- if (++$i%40==0) {
273
- echo "<br>";
274
- }
275
- }
276
- echo "<br><a href=# style='color:#ff8' onclick=\"document.getElementById('zopimColor').value=''; updateWidget();\">Restore default color</a></div>";
277
- } else {
278
- echo "<div class='sorry'>Sorry, your plan does not allow for color customization. Please upgrade to enjoy choice of color!</div>";
279
- }
280
?>
281
- </td>
282
- </tr>
283
- <tr valign="top">
284
- <th scope="row" class="sethead">Select A Theme</th>
285
- <td style="width: 400px"><div align="left">
286
<?php
287
288
- if ($accountDetails->widget_customization_enabled == 1) {
289
- echo '<select name="zopimTheme" id="zopimTheme" onchange="updateWidget()">';
290
- $themes = curl_get_url(ZOPIM_THEMES_LIST);
291
- $themes = valuekeys(explode("\n", $themes));
292
- ksort($themes);
293
-
294
- echo generate_options($themes, get_option('zopimTheme'));
295
- echo "</select> <a href='#' onclick='\$zopim.livechat.window.toggle();return false;'>Open the chat panel</a> to see changes";
296
- }
297
- else {
298
- echo "<div class='sorry'>Sorry, your plan does not allow for theme customization. Please upgrade to enjoy choice of themes!</div>";
299
- echo '<input type=hidden value="" name="zopimTheme" id="zopimTheme">';
300
- }
301
- ?>
302
- </td>
303
- </tr>
304
- </table>
305
</div>
306
- </div>
307
</div>
308
309
- <?php
310
- (get_option('zopimUseBubble') && get_option('zopimUseBubble')!="disabled")? ($useBubble = true): ($useBubble = false);
311
?>
312
<div class="metabox-holder">
313
<div class="postbox">
314
<h3 class="hndle"><span>Help Bubble Settings</span></h3>
315
<div style="padding:10px;">
316
- <table class="form-table">
317
- <tr valign="top">
318
- <th scope="row">Display Help Bubble<br></th>
319
- <td><select onchange="updateBubbleStatus()" type="checkbox" id="zopimBubbleEnable" name="zopimBubbleEnable"> <?php $bubble_modes = array("default" => "Let user decide", "show" => "Always show", "hide" => "Always hide"); echo generate_options($bubble_modes, get_option('zopimBubbleEnable')); ?> </select>
320
- </tr>
321
- <tr>
322
<td colspan="2"><div class="secthead">Help Bubble Text</div></td>
323
</tr>
324
- <tr>
325
<td colspan="2"><input type="checkbox" id="zopimUseBubble" onchange="bubbleChanged()" value="zopimUseBubble" name="zopimUseBubble" <?php if ($useBubble) { echo "checked='checked'"; } ?>/> Enable help bubble text settings (override dashboard settings) - save settings to view changes.</td>
326
</tr>
327
- <tr valign="top">
328
- <th scope="row" class="sethead">Help Bubble Title</th>
329
- <td><input class="inputtextshort" name="zopimBubbleTitle" id="zopimBubbleTitle" onKeyup="updateSoon()" value="<?php echo get_option('zopimBubbleTitle'); ?>" <?php if(!$useBubble) { echo "disabled='disabled'"; } ?>><!-- <a href="#" onclick="updateBubbleStatus();">Refresh</a></td> -->
330
- </tr>
331
- <tr valign="top">
332
- <th scope="row" class="sethead">Help Bubble Message</th>
333
- <td><input class="inputtext" name="zopimBubbleText" id="zopimBubbleText" onKeyup="updateSoon()" value="<?php echo get_option('zopimBubbleText'); ?>" <?php if(!$useBubble) { echo "disabled='disabled'"; } ?>></td>
334
- </tr>
335
- </table>
336
</div>
337
- </div>
338
</div>
339
340
- <?php
341
- (get_option('zopimUseGreetings') && get_option('zopimUseGreetings')!="disabled")? ($useGreetings = true): ($useGreetings = false);
342
?>
343
<div class="metabox-holder">
344
<div class="postbox">
345
<h3 class="hndle"><span>Greeting Message Settings</span></h3>
346
<div style="padding:10px;">
347
- <table class="form-table">
348
- <tr>
349
<td colspan="2"><input type="checkbox" id="zopimUseGreetings" onchange="greetingsChanged()" value="zopimUseGreetings" name="zopimUseGreetings" <?php if ($useGreetings) { echo "checked='checked'"; } ?>/> Enable greeting message settings (override dashboard settings) </td>
350
</tr>
351
- <tr>
352
<td colspan="2"><div class="secthead">Message Shown on Chat Bar (max 26 characters)</div></td>
353
</tr>
354
- <tr valign="top">
355
<th scope="row" class="sethead">Online</th>
356
- <td><input class="inputtextshort" name="zopimOnlineShort" id="zopimOnlineShort" onKeyup="updateSoon()" value="<?php echo $greetings->online->bar; ?>" <?php if (!$useGreetings) echo "disabled='disabled'"?> maxlength="26"></td>
357
- </tr>
358
- <tr valign="top">
359
- <th scope="row" class="sethead">Away</th>
360
- <td><input class="inputtextshort" name="zopimAwayShort" id="zopimAwayShort" onKeyup="updateSoon()" value="<?php echo $greetings->away->bar; ?>" <?php if (!$useGreetings) echo "disabled='disabled'"?> maxlength="26"></td>
361
- </tr>
362
- <tr valign="top">
363
- <th scope="row" class="sethead">Offline</th>
364
- <td><input class="inputtextshort" name="zopimOfflineShort" id="zopimOfflineShort" onKeyup="updateSoon()" value="<?php echo $greetings->offline->bar; ?>" <?php if (!$useGreetings) echo "disabled='disabled'"?> maxlength="26"></td>
365
- </tr>
366
- <tr>
367
<td colspan="2"><div class="secthead">Message Shown on Chat Panel (max 140 characters)</div></td>
368
</tr>
369
- <tr valign="top">
370
- <th scope="row" class="sethead">Online</th>
371
- <td><textarea class="inputtext" name="zopimOnlineLong" id="zopimOnlineLong" onKeyup="updateSoon()" <?php if (!$useGreetings) echo "disabled='disabled'"?> ><?php echo $greetings->online->window; ?></textarea></td>
372
- </tr>
373
- <tr valign="top">
374
- <th scope="row" class="sethead">Away</th>
375
- <td><textarea class="inputtext" name="zopimAwayLong" id="zopimAwayLong" onKeyup="updateSoon()" <?php if (!$useGreetings) echo "disabled='disabled'"?> ><?php echo $greetings->away->window; ?></textarea></td>
376
- </tr>
377
- <tr valign="top">
378
- <th scope="row" class="sethead">Offline</th>
379
- <td><textarea class="inputtext" name="zopimOfflineLong" id="zopimOfflineLong" onKeyup="updateSoon()" <?php if (!$useGreetings) echo "disabled='disabled'"?> ><?php echo $greetings->offline->window; ?></textarea></td>
380
- </tr>
381
- </table>
382
</div>
383
- </div>
384
</div>
385
386
<p class="submit">
@@ -390,38 +390,38 @@ line-height:21px;
390
</form>
391
</div>
392
393
- <?php }
394
395
function valuekeys($array) {
396
- $newarray = array();
397
- foreach ($array as $s) { $newarray[$s] = $s; }
398
- return $newarray;
399
}
400
401
function generate_options($options, $current) {
402
- $out = "";
403
- foreach ($options as $key => $value) {
404
- if ($value != "") {
405
- $isselected = "";
406
- if ($current == $key) {
407
- $isselected = "selected";
408
- }
409
- $out .= '<option value="'.$key.'" '.$isselected.'>'.$value.'</option>';
410
- }
411
- }
412
- return $out;
413
}
414
415
function get_languages() {
416
$langjson = '{"--":" - Auto Detect - ","ar":"Arabic","bn":"Bengali","bg":"Bulgarian","zh_CN":"Chinese (China)","zh_TW":"Chinese (Taiwan)","hr":"Croatian","cs":"Czech","da":"Danish","nl":"Dutch; Flemish","et":"Estonian","fo":"Faroese","fi":"Finnish","fr":"French","ka":"Georgian","de":"German","el":"Greek","he":"Hebrew","hu":"Hungarian","is":"Icelandic","id":"Indonesian","it":"Italian","ja":"Japanese","ko":"Korean","ku":"Kurdish","lv":"Latvian","lt":"Lithuanian","mk":"Macedonian","ms":"Malay","nb":"Norwegian Bokmal","fa":"Persian","pl":"Polish","pt":"Portuguese","pt_BR":"Portuguese (Brazil)","ro":"Romanian","ru":"Russian","sr":"Serbian","sk":"Slovak","sl":"Slovenian","es":"Spanish; Castilian","sv":"Swedish","th":"Thai","tr":"Turkish","uk":"Ukrainian","ur":"Urdu","vi":"Vietnamese"}';
417
- return json_to_array($langjson);
418
}
419
420
function update_checkbox($fieldname) {
421
- if (isset($_POST["$fieldname"]) && $_POST["$fieldname"] != "")
422
- update_option($fieldname, $_POST["$fieldname"]);
423
else
424
- update_option($fieldname, "disabled");
425
}
426
427
?>
3
// Zopim Customize Widget Page
4
5
function zopim_customize_widget() {
6
+ global $current_user;
7
+ $ul = $current_user->data->first_name;
8
+ $useremail = $current_user->data->user_email;
9
+ $greetings = json_to_array(get_option('zopimGreetings'));
10
+ $message = "";
11
+
12
+ if (count($_POST) > 0) {
13
+ update_option('zopimLang', $_POST["zopimLang"]);
14
+ update_option('zopimPosition', $_POST["zopimPosition"]);
15
+ update_option("zopimBubbleEnable", $_POST["zopimBubbleEnable"] );
16
+ update_option('zopimColor', $_POST["zopimColor"]);
17
+ update_option('zopimTheme', $_POST["zopimTheme"]);
18
+ update_option('zopimBubbleTitle', stripslashes($_POST["zopimBubbleTitle"]));
19
+ update_option('zopimBubbleText', stripslashes($_POST["zopimBubbleText"]));
20
+
21
+ update_checkbox("zopimGetVisitorInfo");
22
+ update_checkbox("zopimHideOnOffline");
23
+ update_checkbox("zopimUseGreetings");
24
update_checkbox("zopimUseBubble");
25
26
if (isset($_POST['zopimUseGreetings']) && $_POST['zopimUseGreetings'] != "") {
34
update_option('zopimGreetings', to_json($greetings));
35
}
36
37
+ $message = "<b>Changes saved!</b><br>";
38
+ }
39
40
+ zopimme();
41
42
+ $accountDetails = getAccountDetails(get_option('zopimSalt'));
43
44
+ if (get_option('zopimCode')=="zopim") {
45
+ $message = '<div class="metabox-holder">
46
<div class="postbox">
47
<h3 class="hndle"><span>Customizing in Demo Mode</span></h3>
48
<div style="padding:10px;line-height:17px;">
49
+ Currently customizing in demo mode. Messages in this widget will go to Zopim staff. The chat widget will not appear on your site until you <a href="admin.php?page=zopim_account_config">activate / link up an account</a>. <br>
50
</div>
51
+ </div>
52
+ </div>';
53
+ $accountDetails->widget_customization_enabled = 1;
54
+ $accountDetails->color_customization_enabled = 1;
55
+ }
56
else if (isset($accountDetails->error)) {
57
+ $message = '<div class="metabox-holder">
58
<div class="postbox">
59
<h3 class="hndle"><span>Account no longer linked!</span></h3>
60
<div style="padding:10px;line-height:17px;">
61
+ We could not connect to your Zopim account. As a result, this customization page is running in demo mode.<br> Please <a href="admin.php?page=zopim_account_config">check your password in account setup</a> and try again.
62
+ </div>
63
</div>
64
+ </div>';
65
+ }
66
+ else {
67
+ $message .= "Click 'Save Changes' when you're done. Happy customizing!";
68
+ }
69
+ // unset($accountDetails->widget_customization_enabled);
70
+ // unset($accountDetails->color_customization_enabled);
71
?>
72
73
+ <script type="text/javascript">
74
75
+ function updateWidget() {
76
+ var lang = document.getElementById('zopimLang').options[ document.getElementById('zopimLang').options.selectedIndex ].value;
77
+ $zopim.livechat.setLanguage(lang);
78
79
+ if (document.getElementById("zopimGetVisitorInfo").checked) {
80
+ $zopim.livechat.setName('<?php echo $ul; ?>');
81
+ $zopim.livechat.setEmail('<?php echo $useremail; ?>');
82
+ }
83
else {
84
+ $zopim.livechat.setName('Visitor');
85
+ $zopim.livechat.setEmail('');
86
+ }
87
88
+ document.getElementById("zopimHideOnOffline").checked? $zopim.livechat.button.setHideWhenOffline(true): $zopim.livechat.button.setHideWhenOffline(false);
89
90
+ $zopim.livechat.window.setColor(document.getElementById("zopimColor").value);
91
+ $zopim.livechat.window.setTheme(document.getElementById("zopimTheme").value);
92
93
if (document.getElementById("zopimUseBubble").checked) {
94
$zopim.livechat.bubble.setTitle(document.getElementById("zopimBubbleTitle").value);
95
+ $zopim.livechat.bubble.setText(document.getElementById("zopimBubbleText").value);
96
}
97
else {
98
$zopim.livechat.bubble.setTitle('Questions?');
99
+ $zopim.livechat.bubble.setText('Click here to chat with us!');
100
}
101
+
102
+ $zopim.livechat.setGreetings({
103
+ 'online': [document.getElementById("zopimOnlineShort").value, document.getElementById("zopimOnlineLong").value],
104
+ 'offline': [document.getElementById("zopimOfflineShort").value, document.getElementById("zopimOfflineLong").value],
105
+ 'away': [document.getElementById("zopimAwayShort").value, document.getElementById("zopimAwayLong").value]
106
+ });
107
+ }
108
+
109
+ function updatePosition() {
110
+ var position = document.getElementById('zopimPosition').options[ document.getElementById('zopimPosition').options.selectedIndex ].value;
111
+ $zopim.livechat.button.setPosition(position);
112
+ }
113
+
114
+ function updateBubbleStatus() {
115
var value = document.getElementById("zopimBubbleEnable").value;
116
switch (value) {
117
case 'default':
124
$zopim.livechat.bubble.hide();
125
break;
126
}
127
+ }
128
+
129
function greetingsChanged() {
130
+ var inputs = [ 'zopimOnlineShort', 'zopimAwayShort', 'zopimOfflineShort',
131
+ 'zopimOnlineLong' , 'zopimAwayLong', 'zopimOfflineLong' ];
132
+ var isDisabled = false;
133
134
+ document.getElementById('zopimUseGreetings').checked? (isDisabled = false): (isDisabled = true);
135
136
+ for (var i=0; i<inputs.length; i++) {
137
document.getElementById(inputs[i]).disabled = isDisabled;
138
+ }
139
140
updateWidget();
141
}
153
updateWidget();
154
}
155
156
+ var timer;
157
+ function updateSoon() {
158
+ clearTimeout(timer);
159
+ timer = setTimeout("updateWidget()", 300);
160
+ }
161
162
+ </script>
163
164
<style type="text/css">
165
.smallExplanation {
195
cursor:pointer;
196
}
197
.sorry {
198
+ color:#c33;
199
}
200
</style>
201
208
<div class="postbox">
209
<h3 class="hndle"><span>General Settings</span></h3>
210
<div style="padding:10px;">
211
+ <table class="form-table">
212
+ <tr valign="top">
213
+ <th scope="row" class="sethead">Language</th>
214
+ <td>
215
+ <select name="zopimLang" id="zopimLang" onchange="updateWidget()">
216
+ <?php
217
+ $languages = get_languages();
218
+ echo generate_options($languages, get_option('zopimLang'));
219
?>
220
+ </select>
221
+ </td>
222
+ </tr>
223
+ <tr valign="top" style="display:none;">
224
+ <th scope="row">Use Logged in Username / Email</th>
225
+ <td><input onchange="updateWidget()" type="checkbox" id="zopimGetVisitorInfo" name="zopimGetVisitorInfo" value="zopimGetVisitorInfo" <?php if (get_option('zopimGetVisitorInfo')!="disabled") { echo "checked='checked'"; } ?> /></td>
226
+ </tr>
227
+ <tr valign="top">
228
+ <th scope="row" class="sethead">Position</th>
229
+ <td>
230
+
231
+ <select name="zopimPosition" id="zopimPosition" onchange="updatePosition()">
232
+ <?php
233
+ $positions = array("br" => "Bottom Right", "bl" => "Bottom Left");
234
+ echo generate_options($positions, get_option('zopimPosition'));
235
?>
236
+ </select>
237
+ </td>
238
+ </tr>
239
+
240
+ <tr valign="top">
241
+ <th scope="row">Hide chat bar when offline<br>
242
+ <!-- <div class="smallExplanation">Hide the chat bar when no agents are available to answer questions. This prevents visitors from sending you offline messages. </div> -->
243
+ </th>
244
+ <td>
245
+ <input onchange="updateWidget()" type="checkbox" id="zopimHideOnOffline" name="zopimHideOnOffline" value="zopimHideOnOffline" <?php if (get_option('zopimHideOnOffline') && get_option('zopimHideOnOffline')!="disabled") { echo "checked='checked'"; } ?> /> Prevents visitors from sending you offline messages
246
<a href="#" onclick="$zopim.livechat.button.show();return false">(Show preview chat bar)</a>
247
</td>
248
+ </tr>
249
+ </table>
250
</div>
251
+ </div>
252
</div>
253
<div class="metabox-holder">
254
<div class="postbox">
255
<h3 class="hndle"><span>Color & Theme Settings</span></h3>
256
<div style="padding:10px;">
257
Theme settings show up instantly on the preview widget. Try it out!<br/>
258
+ <table class="form-table" style="width: 700px">
259
+ <tr valign="top">
260
+ <td colspan="2">
261
+ <input type="hidden" id="zopimColor" name="zopimColor" value="<?php echo get_option('zopimColor'); ?>">
262
<?php
263
264
+ if ($accountDetails->color_customization_enabled == 1) {
265
+ echo "<div style='display:inline-block;border:11px solid #888;background:#888;color:#fee;'>";
266
+ $colors = curl_get_url(ZOPIM_COLORS_LIST);
267
+ $colors = explode("\n", $colors);
268
+
269
+ $i=0;
270
+ foreach ($colors as $color) {
271
+ echo "<div class='swatch' style='background-color: $color;' onclick=\"document.getElementById('zopimColor').value='$color'; updateWidget();\">&nbsp</div>";
272
+ if (++$i%40==0) {
273
+ echo "<br>";
274
+ }
275
+ }
276
+ echo "<br><a href=# style='color:#ff8' onclick=\"document.getElementById('zopimColor').value=''; updateWidget();\">Restore default color</a></div>";
277
+ } else {
278
+ echo "<div class='sorry'>Sorry, your plan does not allow for color customization. Please upgrade to enjoy choice of color!</div>";
279
+ }
280
?>
281
+ </td>
282
+ </tr>
283
+ <tr valign="top">
284
+ <th scope="row" class="sethead">Select A Theme</th>
285
+ <td style="width: 400px"><div align="left">
286
<?php
287
288
+ if ($accountDetails->widget_customization_enabled == 1) {
289
+ echo '<select name="zopimTheme" id="zopimTheme" onchange="updateWidget()">';
290
+ $themes = curl_get_url(ZOPIM_THEMES_LIST);
291
+ $themes = valuekeys(explode("\n", $themes));
292
+ ksort($themes);
293
+
294
+ echo generate_options($themes, get_option('zopimTheme'));
295
+ echo "</select> <a href='#' onclick='\$zopim.livechat.window.toggle();return false;'>Open the chat panel</a> to see changes";
296
+ }
297
+ else {
298
+ echo "<div class='sorry'>Sorry, your plan does not allow for theme customization. Please upgrade to enjoy choice of themes!</div>";
299
+ echo '<input type=hidden value="" name="zopimTheme" id="zopimTheme">';
300
+ }
301
+ ?>
302
+ </td>
303
+ </tr>
304
+ </table>
305
</div>
306
+ </div>
307
</div>
308
309
+ <?php
310
+ (get_option('zopimUseBubble') && get_option('zopimUseBubble')!="disabled")? ($useBubble = true): ($useBubble = false);
311
?>
312
<div class="metabox-holder">
313
<div class="postbox">
314
<h3 class="hndle"><span>Help Bubble Settings</span></h3>
315
<div style="padding:10px;">
316
+ <table class="form-table">
317
+ <tr valign="top">
318
+ <th scope="row">Display Help Bubble<br></th>
319
+ <td><select onchange="updateBubbleStatus()" type="checkbox" id="zopimBubbleEnable" name="zopimBubbleEnable"> <?php $bubble_modes = array("default" => "Let user decide", "show" => "Always show", "hide" => "Always hide"); echo generate_options($bubble_modes, get_option('zopimBubbleEnable')); ?> </select>
320
+ </tr>
321
+ <tr>
322
<td colspan="2"><div class="secthead">Help Bubble Text</div></td>
323
</tr>
324
+ <tr>
325
<td colspan="2"><input type="checkbox" id="zopimUseBubble" onchange="bubbleChanged()" value="zopimUseBubble" name="zopimUseBubble" <?php if ($useBubble) { echo "checked='checked'"; } ?>/> Enable help bubble text settings (override dashboard settings) - save settings to view changes.</td>
326
</tr>
327
+ <tr valign="top">
328
+ <th scope="row" class="sethead">Help Bubble Title</th>
329
+ <td><input class="inputtextshort" name="zopimBubbleTitle" id="zopimBubbleTitle" onKeyup="updateSoon()" value="<?php echo get_option('zopimBubbleTitle'); ?>" <?php if(!$useBubble) { echo "disabled='disabled'"; } ?>><!-- <a href="#" onclick="updateBubbleStatus();">Refresh</a></td> -->
330
+ </tr>
331
+ <tr valign="top">
332
+ <th scope="row" class="sethead">Help Bubble Message</th>
333
+ <td><input class="inputtext" name="zopimBubbleText" id="zopimBubbleText" onKeyup="updateSoon()" value="<?php echo get_option('zopimBubbleText'); ?>" <?php if(!$useBubble) { echo "disabled='disabled'"; } ?>></td>
334
+ </tr>
335
+ </table>
336
</div>
337
+ </div>
338
</div>
339
340
+ <?php
341
+ (get_option('zopimUseGreetings') && get_option('zopimUseGreetings')!="disabled")? ($useGreetings = true): ($useGreetings = false);
342
?>
343
<div class="metabox-holder">
344
<div class="postbox">
345
<h3 class="hndle"><span>Greeting Message Settings</span></h3>
346
<div style="padding:10px;">
347
+ <table class="form-table">
348
+ <tr>
349
<td colspan="2"><input type="checkbox" id="zopimUseGreetings" onchange="greetingsChanged()" value="zopimUseGreetings" name="zopimUseGreetings" <?php if ($useGreetings) { echo "checked='checked'"; } ?>/> Enable greeting message settings (override dashboard settings) </td>
350
</tr>
351
+ <tr>
352
<td colspan="2"><div class="secthead">Message Shown on Chat Bar (max 26 characters)</div></td>
353
</tr>
354
+ <tr valign="top">
355
<th scope="row" class="sethead">Online</th>
356
+ <td><input class="inputtextshort" name="zopimOnlineShort" id="zopimOnlineShort" onKeyup="updateSoon()" value="<?php echo $greetings->online->bar; ?>" <?php if (!$useGreetings) echo "disabled='disabled'"?> maxlength="26"></td>
357
+ </tr>
358
+ <tr valign="top">
359
+ <th scope="row" class="sethead">Away</th>
360
+ <td><input class="inputtextshort" name="zopimAwayShort" id="zopimAwayShort" onKeyup="updateSoon()" value="<?php echo $greetings->away->bar; ?>" <?php if (!$useGreetings) echo "disabled='disabled'"?> maxlength="26"></td>
361
+ </tr>
362
+ <tr valign="top">
363
+ <th scope="row" class="sethead">Offline</th>
364
+ <td><input class="inputtextshort" name="zopimOfflineShort" id="zopimOfflineShort" onKeyup="updateSoon()" value="<?php echo $greetings->offline->bar; ?>" <?php if (!$useGreetings) echo "disabled='disabled'"?> maxlength="26"></td>
365
+ </tr>
366
+ <tr>
367
<td colspan="2"><div class="secthead">Message Shown on Chat Panel (max 140 characters)</div></td>
368
</tr>
369
+ <tr valign="top">
370
+ <th scope="row" class="sethead">Online</th>
371
+ <td><textarea class="inputtext" name="zopimOnlineLong" id="zopimOnlineLong" onKeyup="updateSoon()" <?php if (!$useGreetings) echo "disabled='disabled'"?> ><?php echo $greetings->online->window; ?></textarea></td>
372
+ </tr>
373
+ <tr valign="top">
374
+ <th scope="row" class="sethead">Away</th>
375
+ <td><textarea class="inputtext" name="zopimAwayLong" id="zopimAwayLong" onKeyup="updateSoon()" <?php if (!$useGreetings) echo "disabled='disabled'"?> ><?php echo $greetings->away->window; ?></textarea></td>
376
+ </tr>
377
+ <tr valign="top">
378
+ <th scope="row" class="sethead">Offline</th>
379
+ <td><textarea class="inputtext" name="zopimOfflineLong" id="zopimOfflineLong" onKeyup="updateSoon()" <?php if (!$useGreetings) echo "disabled='disabled'"?> ><?php echo $greetings->offline->window; ?></textarea></td>
380
+ </tr>
381
+ </table>
382
</div>
383
+ </div>
384
</div>
385
386
<p class="submit">
390
</form>
391
</div>
392
393
+ <?php }
394
395
function valuekeys($array) {
396
+ $newarray = array();
397
+ foreach ($array as $s) { $newarray[$s] = $s; }
398
+ return $newarray;
399
}
400
401
function generate_options($options, $current) {
402
+ $out = "";
403
+ foreach ($options as $key => $value) {
404
+ if ($value != "") {
405
+ $isselected = "";
406
+ if ($current == $key) {
407
+ $isselected = "selected";
408
+ }
409
+ $out .= '<option value="'.$key.'" '.$isselected.'>'.$value.'</option>';
410
+ }
411
+ }
412
+ return $out;
413
}
414
415
function get_languages() {
416
$langjson = '{"--":" - Auto Detect - ","ar":"Arabic","bn":"Bengali","bg":"Bulgarian","zh_CN":"Chinese (China)","zh_TW":"Chinese (Taiwan)","hr":"Croatian","cs":"Czech","da":"Danish","nl":"Dutch; Flemish","et":"Estonian","fo":"Faroese","fi":"Finnish","fr":"French","ka":"Georgian","de":"German","el":"Greek","he":"Hebrew","hu":"Hungarian","is":"Icelandic","id":"Indonesian","it":"Italian","ja":"Japanese","ko":"Korean","ku":"Kurdish","lv":"Latvian","lt":"Lithuanian","mk":"Macedonian","ms":"Malay","nb":"Norwegian Bokmal","fa":"Persian","pl":"Polish","pt":"Portuguese","pt_BR":"Portuguese (Brazil)","ro":"Romanian","ru":"Russian","sr":"Serbian","sk":"Slovak","sl":"Slovenian","es":"Spanish; Castilian","sv":"Swedish","th":"Thai","tr":"Turkish","uk":"Ukrainian","ur":"Urdu","vi":"Vietnamese"}';
417
+ return json_to_array($langjson);
418
}
419
420
function update_checkbox($fieldname) {
421
+ if (isset($_POST["$fieldname"]) && $_POST["$fieldname"] != "")
422
+ update_option($fieldname, $_POST["$fieldname"]);
423
else
424
+ update_option($fieldname, "disabled");
425
}
426
427
?>
imintegration.php CHANGED
@@ -1,9 +1,9 @@
1
- <?php
2
3
function zopim_instant_messaging() { ?>
4
5
<div class="wrap">
6
- <div id="icon-users" class="icon32"></div>
7
<h2>Relay your messages</h2>
8
Use your favourite Instant Messaging (IM) client to chat with your website visitors!<p>
9
@@ -13,22 +13,22 @@ Use your favourite Instant Messaging (IM) client to chat with your website visit
13
$salt = array('salt' => get_option('zopimSalt'));
14
15
if (isset($_GET["remove"]) && $_GET["remove"] == 1) {
16
- echo "Removed IM Set Up. <br><br>";
17
18
- json_to_array(do_post_request(ZOPIM_IMREMOVE_URL, $salt));
19
}
20
$iminfo = json_to_array(do_post_request(ZOPIM_IMINFO_URL, $salt));
21
22
if (isset($iminfo->bots)) { // Can set up IM ?>
23
24
<style>
25
- td {}
26
- .clients td.first {border:none;background:#888;color:#fff;}
27
- .steps {width:100%}
28
- .steps td {background:#f9f9f9;padding:15px;}
29
- .clients td {padding:8px;border-top:1px solid #dfdfdf;background:#fff;}
30
- .clients {border:1px solid #dfdfdf;background:#fff}
31
- .explain {
32
background:#FAFAFA;
33
color:#667788;
34
font-size:8pt;
@@ -40,57 +40,57 @@ display: inline-block;
40
</style>
41
42
<div class="metabox-holder">
43
- <div class="postbox">
44
- <h3 class="hndle"><span>Setting up your Chat Bots</span></h3>
45
- <div style="padding:10px 0px;line-height:17px;">
46
-
47
- <table class="steps" cellspacing="0" cellpadding="0">
48
- <tr valign="top">
49
- <td style="border-right:5px solid #fff;width:394px;">
50
- 1. Add the Control Bot to the IM Client of your choice.<br/><br/>
51
-
52
- <table class="clients" cellpadding="0" cellspacing="0">
53
- <tr><td align="center" width="160" class="first"><b>IM Cient</b></td><td class="first" width="200"><b>Chat Bot's Name</b></td></tr>
54
- <tr><td valign="center" align="center"><img src="<?php echo ZOPIM_IM_LOGOS ?>big/gtalk.png"></td><td><?php echo $iminfo->bots->gtalk; ?></td></tr>
55
- <tr><td valign="center" align="center"><img src="<?php echo ZOPIM_IM_LOGOS ?>big/msn.png"></td><td><?php echo $iminfo->bots->msn; ?></td></tr>
56
- <tr><td valign="center" align="center"><img src="<?php echo ZOPIM_IM_LOGOS ?>big/yahoo.png"></td><td><?php echo $iminfo->bots->yahoo; ?></td></tr>
57
- <tr><td valign="center" align="center"><img src="<?php echo ZOPIM_IM_LOGOS ?>big/aim.png"></td><td><?php echo $iminfo->bots->aim; ?></td></tr>
58
- </table>
59
- <div class="explain">For example, to use <b>MSN Live Messenger</b> to chat,<br/>add <b>zdctrlbot01@hotmail.com</b> to your MSN contact list.</div>
60
- </td>
61
- <td>
62
- 2. Send the Control Bot this message:<br/><br/><input style="font-size:31px;color:#555;margin:0 0 5px;width:380px;" type="text" value="#setup <?php echo $iminfo->auth_key; ?>" id="box-content" readonly></input><br/>
63
<input id="copy" value="Copy to Clipboard" type="button"></input>
64
65
- <br/><br/>
66
- 3. Accept the invitations to add the Chat Bots.<br>
67
- <div class="explain">Depending on the number of Chat Bots available in your Package,<br/>you may need to accept up to 8 invitations</div>
68
- <br/><br/>That's all!<br/><br/>
69
- The Chat Bot will now relay all messages sent from<br/>your website to your IM Client.
70
- <br/><br/>
71
- Chat away!
72
- </td>
73
- </tr>
74
- </table>
75
-
76
- </div>
77
- </div>
78
</div>
79
- <script type="text/javascript" src="http://www.zopim.com/static/ZeroClipboard.js"></script>
80
- <script language="javascript">
81
82
//create client
83
- ZeroClipboard.setMoviePath('http://www.zopim.com/static/ZeroClipboard.swf');
84
- var clip = new ZeroClipboard.Client();
85
86
//event
87
function $(id) { return document.getElementById(id); }
88
89
clip.addEventListener('mousedown',function() {
90
- clip.setText(document.getElementById('box-content').value);
91
});
92
clip.addEventListener('complete',function(client,text) {
93
- window.status = 'copied: ' + text;
94
});
95
//glue it to the button
96
clip.glue('copy');
@@ -98,7 +98,7 @@ clip.glue('copy');
98
99
<?php } else if (isset($iminfo->status)) { // integration already set up ?>
100
101
- <h3><img src="<?php echo ZOPIM_IM_LOGOS.$iminfo->protocol; ?>.png"> Your <?php echo strtoupper($iminfo->protocol); ?> account is now linked with Zopim.</h3>
102
103
You are connected using the account: <?php echo $iminfo->username; ?>. <br>
104
Your status is now <b><?php echo $iminfo->status; ?></b>.<br><br>
@@ -108,30 +108,30 @@ You can <a href="admin.php?page=zopim_instant_messaging&remove=1">disable IM int
108
109
<?php } else { // could not contact zopim to get the IM status
110
111
- if (get_option('zopimCode') != "zopim") {
112
113
- ?>
114
115
<div class="metabox-holder">
116
- <div class="postbox">
117
- <h3 class="hndle"><span>Account not linked</span></h3>
118
- <div style="padding:10px;line-height:17px;">
119
- Please <a href="admin.php?page=zopim_account_config">link your account / check your password</a> before setting up Chat Bots.
120
121
- </div>
122
- </div>
123
</div>
124
125
<?php } else { ?>
126
127
<div class="metabox-holder">
128
- <div class="postbox">
129
- <h3 class="hndle"><span>Account not activated</span></h3>
130
- <div style="padding:10px;line-height:17px;">
131
- Please <a href="admin.php?page=zopim_account_config">activate your account</a> before setting up Chat Bots.
132
133
- </div>
134
- </div>
135
</div>
136
137
<?php } }
1
+ <?php
2
3
function zopim_instant_messaging() { ?>
4
5
<div class="wrap">
6
+ <div id="icon-users" class="icon32"></div>
7
<h2>Relay your messages</h2>
8
Use your favourite Instant Messaging (IM) client to chat with your website visitors!<p>
9
13
$salt = array('salt' => get_option('zopimSalt'));
14
15
if (isset($_GET["remove"]) && $_GET["remove"] == 1) {
16
+ echo "Removed IM Set Up. <br><br>";
17
18
+ json_to_array(do_post_request(ZOPIM_IMREMOVE_URL, $salt));
19
}
20
$iminfo = json_to_array(do_post_request(ZOPIM_IMINFO_URL, $salt));
21
22
if (isset($iminfo->bots)) { // Can set up IM ?>
23
24
<style>
25
+ td {}
26
+ .clients td.first {border:none;background:#888;color:#fff;}
27
+ .steps {width:100%}
28
+ .steps td {background:#f9f9f9;padding:15px;}
29
+ .clients td {padding:8px;border-top:1px solid #dfdfdf;background:#fff;}
30
+ .clients {border:1px solid #dfdfdf;background:#fff}
31
+ .explain {
32
background:#FAFAFA;
33
color:#667788;
34
font-size:8pt;
40
</style>
41
42
<div class="metabox-holder">
43
+ <div class="postbox">
44
+ <h3 class="hndle"><span>Setting up your Chat Bots</span></h3>
45
+ <div style="padding:10px 0px;line-height:17px;">
46
+
47
+ <table class="steps" cellspacing="0" cellpadding="0">
48
+ <tr valign="top">
49
+ <td style="border-right:5px solid #fff;width:394px;">
50
+ 1. Add the Control Bot to the IM Client of your choice.<br/><br/>
51
+
52
+ <table class="clients" cellpadding="0" cellspacing="0">
53
+ <tr><td align="center" width="160" class="first"><b>IM Cient</b></td><td class="first" width="200"><b>Chat Bot's Name</b></td></tr>
54
+ <tr><td valign="center" align="center"><img src="<?php echo ZOPIM_IM_LOGOS ?>big/gtalk.png"></td><td><?php echo $iminfo->bots->gtalk; ?></td></tr>
55
+ <tr><td valign="center" align="center"><img src="<?php echo ZOPIM_IM_LOGOS ?>big/msn.png"></td><td><?php echo $iminfo->bots->msn; ?></td></tr>
56
+ <tr><td valign="center" align="center"><img src="<?php echo ZOPIM_IM_LOGOS ?>big/yahoo.png"></td><td><?php echo $iminfo->bots->yahoo; ?></td></tr>
57
+ <tr><td valign="center" align="center"><img src="<?php echo ZOPIM_IM_LOGOS ?>big/aim.png"></td><td><?php echo $iminfo->bots->aim; ?></td></tr>
58
+ </table>
59
+ <div class="explain">For example, to use <b>MSN Live Messenger</b> to chat,<br/>add <b>zdctrlbot01@hotmail.com</b> to your MSN contact list.</div>
60
+ </td>
61
+ <td>
62
+ 2. Send the Control Bot this message:<br/><br/><input style="font-size:31px;color:#555;margin:0 0 5px;width:380px;" type="text" value="#setup <?php echo $iminfo->auth_key; ?>" id="box-content" readonly></input><br/>
63
<input id="copy" value="Copy to Clipboard" type="button"></input>
64
65
+ <br/><br/>
66
+ 3. Accept the invitations to add the Chat Bots.<br>
67
+ <div class="explain">Depending on the number of Chat Bots available in your Package,<br/>you may need to accept up to 8 invitations</div>
68
+ <br/><br/>That's all!<br/><br/>
69
+ The Chat Bot will now relay all messages sent from<br/>your website to your IM Client.
70
+ <br/><br/>
71
+ Chat away!
72
+ </td>
73
+ </tr>
74
+ </table>
75
+
76
+ </div>
77
+ </div>
78
</div>
79
+ <script type="text/javascript" src="http://www.zopim.com/static/ZeroClipboard.js"></script>
80
+ <script language="javascript">
81
82
//create client
83
+ ZeroClipboard.setMoviePath('http://www.zopim.com/static/ZeroClipboard.swf');
84
+ var clip = new ZeroClipboard.Client();
85
86
//event
87
function $(id) { return document.getElementById(id); }
88
89
clip.addEventListener('mousedown',function() {
90
+ clip.setText(document.getElementById('box-content').value);
91
});
92
clip.addEventListener('complete',function(client,text) {
93
+ window.status = 'copied: ' + text;
94
});
95
//glue it to the button
96
clip.glue('copy');
98
99
<?php } else if (isset($iminfo->status)) { // integration already set up ?>
100
101
+ <h3><img src="<?php echo ZOPIM_IM_LOGOS.$iminfo->protocol; ?>.png"> Your <?php echo strtoupper($iminfo->protocol); ?> account is now linked with Zopim.</h3>
102
103
You are connected using the account: <?php echo $iminfo->username; ?>. <br>
104
Your status is now <b><?php echo $iminfo->status; ?></b>.<br><br>
108
109
<?php } else { // could not contact zopim to get the IM status
110
111
+ if (get_option('zopimCode') != "zopim") {
112
113
+ ?>
114
115
<div class="metabox-holder">
116
+ <div class="postbox">
117
+ <h3 class="hndle"><span>Account not linked</span></h3>
118
+ <div style="padding:10px;line-height:17px;">
119
+ Please <a href="admin.php?page=zopim_account_config">link your account / check your password</a> before setting up Chat Bots.
120
121
+ </div>
122
+ </div>
123
</div>
124
125
<?php } else { ?>
126
127
<div class="metabox-holder">
128
+ <div class="postbox">
129
+ <h3 class="hndle"><span>Account not activated</span></h3>
130
+ <div style="padding:10px;line-height:17px;">
131
+ Please <a href="admin.php?page=zopim_account_config">activate your account</a> before setting up Chat Bots.
132
133
+ </div>
134
+ </div>
135
</div>
136
137
<?php } }
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: bencxr
3
Tags: widget, plugin, sidebar, page, admin, enhancement, livechat, chat, widget
4
Requires at least: 2.7
5
Tested up to: 3.3.1
6
- Stable tag: 1.1.3
7
8
Zopim is an award winning facebook-like chatbar built for websites. It connects website owners and visitors together via a cross-browser platform.
9
@@ -20,7 +20,7 @@ Build relationships with visitors to your website. They will be pleasantly surpr
20
* Reply to chats via any browser, or your favorite IM client. Chat from Gtalk, MSN, Yahoo! Messenger, AOL, and from Smart Phones that support mobile IM client.
21
22
**What does Zopim look like?**
23
- Zopim shows up as a chatbar docked to the bottom of your website. Visitors chat with you by clicking on the Zopim Chat Bar.
24
25
**3 Reasons to Use Zopim (& Not Anyone Else)**
26
@@ -43,6 +43,10 @@ Zopim shows up as a chatbar docked to the bottom of your website. Visitors chat
43
* Arabic | Bulgarian | Chinese | Croatian | Czech | Danish | Dutch; Flemish | Estonian | Faroese | Finnish | French | Georgian | German | Greek | Hebrew | Hungarian | Icelandic | Indonesian | Italian | Japanese | Korean | Kurdish | Latvian | Lithuanian | Macedonian | Malay | Norwegian Bokmal | Persian | Polish | Portuguese | Romanian | Russian | Serbian | Slovak | Slovenian | Spanish; Castilian | Swedish | Thai | Turkish | Ukranian | Urdu | Vietnamese
44
45
== Changelog ==
46
= 1.1.3 =
47
* Update Zopim embed script
48
* Add option to override dashboard settings for chat bubble text
@@ -140,21 +144,21 @@ Not at all! Zopim is a hosted livechat service. Simply configure the plugin and
140
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).
141
142
= I managed to install the plugin but cannot link up to Zopim. Why? =
143
- 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).
144
145
- Alternatively, you can also manually include the script in the footer file ("wp-content/themes/default/footer.php" in your wordpress installation).
146
147
= Is it free to use? =
148
149
- The plugin comes with a free plan specially tailored for Wordpress users. Power users can purchase upgrade options anytime.
150
151
= Its just not working for me! HELP! =
152
153
- 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.
154
155
== Usage ==
156
157
- After enabling the plug in, head on to the widget customization page to change settings and integrate its look and feel to match your site. When done, enable it by visiting the account configuration page and completing the instant signup process.
158
159
== Installation ==
160
3
Tags: widget, plugin, sidebar, page, admin, enhancement, livechat, chat, widget
4
Requires at least: 2.7
5
Tested up to: 3.3.1
6
+ Stable tag: 1.2.0
7
8
Zopim is an award winning facebook-like chatbar built for websites. It connects website owners and visitors together via a cross-browser platform.
9
20
* Reply to chats via any browser, or your favorite IM client. Chat from Gtalk, MSN, Yahoo! Messenger, AOL, and from Smart Phones that support mobile IM client.
21
22
**What does Zopim look like?**
23
+ Zopim shows up as a chatbar docked to the bottom of your website. Visitors chat with you by clicking on the Zopim Chat Bar.
24
25
**3 Reasons to Use Zopim (& Not Anyone Else)**
26
43
* Arabic | Bulgarian | Chinese | Croatian | Czech | Danish | Dutch; Flemish | Estonian | Faroese | Finnish | French | Georgian | German | Greek | Hebrew | Hungarian | Icelandic | Indonesian | Italian | Japanese | Korean | Kurdish | Latvian | Lithuanian | Macedonian | Malay | Norwegian Bokmal | Persian | Polish | Portuguese | Romanian | Russian | Serbian | Slovak | Slovenian | Spanish; Castilian | Swedish | Thai | Turkish | Ukranian | Urdu | Vietnamese
44
45
== Changelog ==
46
+
47
+ = 1.2.0 =
48
+ * Signup process is now linked to zopim.com as per Wordpress guidelines.
49
+
50
= 1.1.3 =
51
* Update Zopim embed script
52
* Add option to override dashboard settings for chat bubble text
144
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).
145
146
= I managed to install the plugin but cannot link up to Zopim. Why? =
147
+ 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).
148
149
+ Alternatively, you can also manually include the script in the footer file ("wp-content/themes/default/footer.php" in your wordpress installation).
150
151
= Is it free to use? =
152
153
+ The plugin comes with a free plan specially tailored for Wordpress users. Power users can purchase upgrade options anytime.
154
155
= Its just not working for me! HELP! =
156
157
+ 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.
158
159
== Usage ==
160
161
+ After enabling the plug in, head on to the widget customization page to change settings and integrate its look and feel to match your site. When done, enable it by visiting the account configuration page and completing the instant signup process.
162
163
== Installation ==
164
zopim.php CHANGED
@@ -2,15 +2,16 @@
2
3
/*
4
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: Zopim
8
- Version: 1.1.3
9
- Author URI: http://www.zopim.com/
10
*/
11
12
define('ZOPIM_SCRIPT_DOMAIN', "zopim.com");
13
define('ZOPIM_BASE_URL', "https://www.zopim.com/");
14
define('ZOPIM_GETACCOUNTDETAILS_URL', ZOPIM_BASE_URL."plugins/getAccountDetails");
15
define('ZOPIM_SETDISPLAYNAME_URL', ZOPIM_BASE_URL."plugins/setDisplayName");
16
define('ZOPIM_IMINFO_URL', ZOPIM_BASE_URL."plugins/getImSetupInfo");
@@ -20,7 +21,7 @@ define('ZOPIM_SIGNUP_URL', ZOPIM_BASE_URL."plugins/createTrialAccount
20
define('ZOPIM_THEMES_LIST', "http://zopim.com/assets/dashboard/themes/window/plugins-themes.txt");
21
define('ZOPIM_COLORS_LIST', "http://zopim.com/assets/dashboard/themes/window/plugins-colors.txt");
22
define('ZOPIM_LANGUAGES_URL', "http://translate.zopim.com/projects/zopim/");
23
- define('ZOPIM_DASHBOARD_URL', "http://dashboard.zopim.com/");
24
define('ZOPIM_SMALL_LOGO', "http://zopim.com/assets/branding/zopim.com/chatman/online.png");
25
define('ZOPIM_IM_LOGOS', "http://www.zopim.com/static/images/im/");
26
define('ZOPIM_THEMES_URL', "http://");
@@ -54,19 +55,19 @@ type='text/javascript';e.parentNode.insertBefore($,e)})(document,'script');
54
55
$theoptions = array();
56
if (get_option('zopimLang') != "" && get_option('zopimLang') != "--")
57
- $theoptions[] = " language: '".get_option('zopimLang')."'";
58
59
if (isset($current_user) && get_option("zopimGetVisitorInfo") == "checked") {
60
- $ul = $current_user->data->first_name;
61
- $useremail = $current_user->data->user_email;
62
- if ($ul!="" && $useremail != "")
63
- $theoptions[] = "name: '$ul', email: '$useremail'";
64
}
65
66
echo "\n<script type=\"text/javascript\">\n\$zopim( function() {";
67
68
if (count($theoptions) > 0)
69
- echo '$zopim.livechat.set({'.implode(", ", $theoptions)."});";
70
71
get_option('zopimPosition') != "" && print("\n\$zopim.livechat.button.setPosition('".get_option('zopimPosition')."');");
72
get_option('zopimTheme') != "" && print("\n\$zopim.livechat.window.setTheme('".get_option('zopimTheme')."');");
@@ -76,8 +77,8 @@ type='text/javascript';e.parentNode.insertBefore($,e)})(document,'script');
76
if (get_option('zopimGreetings') != "") {
77
$greetings = json_to_array(get_option('zopimGreetings'));
78
foreach ($greetings as $i => $v) {
79
- foreach ($v as $j => $k) {
80
- $greetings->$i->$j = str_replace("\r\n", "\\n", $greetings->$i->$j);
81
}
82
}
83
echo "\n\$zopim.livechat.setGreetings({
@@ -99,7 +100,7 @@ type='text/javascript';e.parentNode.insertBefore($,e)})(document,'script');
99
100
// this must be called last
101
if (get_option('zopimHideOnOffline') == "zopimHideOnOffline")
102
- echo "\n\$zopim.livechat.button.setHideWhenOffline(true);";
103
echo "\n})</script>";
104
}
105
@@ -119,11 +120,11 @@ function zopim_create_menu() {
119
120
function check_zopimCode() {
121
/*
122
- // if (get_option('zopimCode') == '' && ($_GET["page"] != "zopim_account_config")) {
123
- if (ereg("zopim", $_GET["page"] )) {
124
- //add_action( 'admin_notices', create_function( '', 'echo "<div class=\"error\"><p>" . sprintf( "Please <a href=\"%s\">input your Zopim account details</a>.", "admin.php?page=zopim_account_config" ) . "</p></div>";' ) );
125
- add_action( 'admin_notices', create_function( '', 'echo "<div class=\"error\"><p>This Zopim plugin is a work in progress. We will launch on the 25th of January. Thank you for your interest.</p></div>";' ) );
126
- }
127
*/
128
return false;
129
}
@@ -140,7 +141,7 @@ function zopim_about() {
140
141
function zopim_dashboard() {
142
echo '<div id="dashboarddiv"><iframe id="dashboardiframe" src="'.ZOPIM_DASHBOARD_URL.'" height=700 width=98% scrolling="no"></iframe></div> You may also <a href="'.ZOPIM_DASHBOARD_URL.'" target="_newWindow" onClick="javascript:document.getElementById(\'dashboarddiv\').innerHTML=\'\'; ">access the dashboard in a new window</a>.
143
- ';
144
}
145
146
// Register the option settings we will be using
@@ -184,13 +185,13 @@ add_action('admin_menu', 'zopim_create_menu');
184
function do_post_request($url, $_data, $optional_headers = null)
185
{
186
if (get_option('zopimUseSSL') != "zopimUseSSL")
187
- $url = str_replace("https", "http", $url);
188
189
- $data = array();
190
191
while(list($n,$v) = each($_data)){
192
- $data[] = urlencode($n)."=".urlencode($v);
193
- }
194
195
$data = implode('&', $data);
196
2
3
/*
4
Plugin Name: Zopim Widget
5
+ Plugin URI: http://www.zopim.com/?iref=wp_plugin
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: Zopim
8
+ Version: 1.2.0
9
+ Author URI: http://www.zopim.com/?iref=wp_plugin
10
*/
11
12
define('ZOPIM_SCRIPT_DOMAIN', "zopim.com");
13
define('ZOPIM_BASE_URL', "https://www.zopim.com/");
14
+ define('ZOPIM_SIGNUP_REDIRECT_URL', ZOPIM_BASE_URL."?iref=wordpress_plugin#signup");
15
define('ZOPIM_GETACCOUNTDETAILS_URL', ZOPIM_BASE_URL."plugins/getAccountDetails");
16
define('ZOPIM_SETDISPLAYNAME_URL', ZOPIM_BASE_URL."plugins/setDisplayName");
17
define('ZOPIM_IMINFO_URL', ZOPIM_BASE_URL."plugins/getImSetupInfo");
21
define('ZOPIM_THEMES_LIST', "http://zopim.com/assets/dashboard/themes/window/plugins-themes.txt");
22
define('ZOPIM_COLORS_LIST', "http://zopim.com/assets/dashboard/themes/window/plugins-colors.txt");
23
define('ZOPIM_LANGUAGES_URL', "http://translate.zopim.com/projects/zopim/");
24
+ define('ZOPIM_DASHBOARD_URL', "http://dashboard.zopim.com/?iref=wp_plugin");
25
define('ZOPIM_SMALL_LOGO', "http://zopim.com/assets/branding/zopim.com/chatman/online.png");
26
define('ZOPIM_IM_LOGOS', "http://www.zopim.com/static/images/im/");
27
define('ZOPIM_THEMES_URL', "http://");
55
56
$theoptions = array();
57
if (get_option('zopimLang') != "" && get_option('zopimLang') != "--")
58
+ $theoptions[] = " language: '".get_option('zopimLang')."'";
59
60
if (isset($current_user) && get_option("zopimGetVisitorInfo") == "checked") {
61
+ $ul = $current_user->data->first_name;
62
+ $useremail = $current_user->data->user_email;
63
+ if ($ul!="" && $useremail != "")
64
+ $theoptions[] = "name: '$ul', email: '$useremail'";
65
}
66
67
echo "\n<script type=\"text/javascript\">\n\$zopim( function() {";
68
69
if (count($theoptions) > 0)
70
+ echo '$zopim.livechat.set({'.implode(", ", $theoptions)."});";
71
72
get_option('zopimPosition') != "" && print("\n\$zopim.livechat.button.setPosition('".get_option('zopimPosition')."');");
73
get_option('zopimTheme') != "" && print("\n\$zopim.livechat.window.setTheme('".get_option('zopimTheme')."');");
77
if (get_option('zopimGreetings') != "") {
78
$greetings = json_to_array(get_option('zopimGreetings'));
79
foreach ($greetings as $i => $v) {
80
+ foreach ($v as $j => $k) {
81
+ $greetings->$i->$j = str_replace("\r\n", "\\n", $greetings->$i->$j);
82
}
83
}
84
echo "\n\$zopim.livechat.setGreetings({
100
101
// this must be called last
102
if (get_option('zopimHideOnOffline') == "zopimHideOnOffline")
103
+ echo "\n\$zopim.livechat.button.setHideWhenOffline(true);";
104
echo "\n})</script>";
105
}
106
120
121
function check_zopimCode() {
122
/*
123
+ // if (get_option('zopimCode') == '' && ($_GET["page"] != "zopim_account_config")) {
124
+ if (ereg("zopim", $_GET["page"] )) {
125
+ //add_action( 'admin_notices', create_function( '', 'echo "<div class=\"error\"><p>" . sprintf( "Please <a href=\"%s\">input your Zopim account details</a>.", "admin.php?page=zopim_account_config" ) . "</p></div>";' ) );
126
+ add_action( 'admin_notices', create_function( '', 'echo "<div class=\"error\"><p>This Zopim plugin is a work in progress. We will launch on the 25th of January. Thank you for your interest.</p></div>";' ) );
127
+ }
128
*/
129
return false;
130
}
141
142
function zopim_dashboard() {
143
echo '<div id="dashboarddiv"><iframe id="dashboardiframe" src="'.ZOPIM_DASHBOARD_URL.'" height=700 width=98% scrolling="no"></iframe></div> You may also <a href="'.ZOPIM_DASHBOARD_URL.'" target="_newWindow" onClick="javascript:document.getElementById(\'dashboarddiv\').innerHTML=\'\'; ">access the dashboard in a new window</a>.
144
+ ';
145
}
146
147
// Register the option settings we will be using
185
function do_post_request($url, $_data, $optional_headers = null)
186
{
187
if (get_option('zopimUseSSL') != "zopimUseSSL")
188
+ $url = str_replace("https", "http", $url);
189
190
+ $data = array();
191
192
while(list($n,$v) = each($_data)){
193
+ $data[] = urlencode($n)."=".urlencode($v);
194
+ }
195
196
$data = implode('&', $data);
197