WP Live Chat Support - Version 3.0

Version Description

  • Improved chat UI
  • Chat Box is draggable
Download this release

Release Info

Developer WP-LiveChat
Plugin Icon 128x128 WP Live Chat Support
Version 3.0
Comparing to
See all releases

Code changes from version 2.10 to 3.0

ajax.php CHANGED
@@ -1,218 +1,218 @@
1
- <?php
2
-
3
- ini_set('html_errors', 0);
4
- define('SHORTINIT', true);
5
-
6
-
7
- $absolute_path = __FILE__;
8
-
9
- $path_to_file = explode( 'wp-content', $absolute_path );
10
-
11
- $path_to_wp = $path_to_file[0];
12
-
13
-
14
-
15
- require_once( $path_to_wp.'/wp-load.php' );
16
-
17
-
18
- require( ABSPATH . WPINC . '/l10n.php' );
19
-
20
- require( ABSPATH . WPINC . '/link-template.php' );
21
-
22
-
23
-
24
-
25
-
26
- global $wpdb;
27
-
28
- global $wplc_tblname_chats;
29
-
30
- global $wplc_tblname_msgs;
31
-
32
- $wplc_tblname_chats = $wpdb->prefix . "wplc_chat_sessions";
33
-
34
- $wplc_tblname_msgs = $wpdb->prefix . "wplc_chat_msgs";
35
-
36
-
37
-
38
- require_once("functions.php");
39
-
40
-
41
-
42
- // stuff goes here
43
-
44
-
45
-
46
- $check = 1;
47
-
48
- if ($check == 1) {
49
-
50
-
51
-
52
-
53
-
54
- // standard callbacks
55
-
56
- if ($_POST['action'] == "wplc_start_chat") {
57
-
58
- if ($_POST['cid']) {
59
-
60
- if ($_POST['name'] && $_POST['email']) {
61
-
62
- echo wplc_user_initiate_chat($_POST['name'],$_POST['email'],$_POST['cid']); // echo the chat session id
63
-
64
- } else {
65
-
66
- echo "error2";
67
-
68
-
69
- }
70
-
71
- } else {
72
-
73
- if ($_POST['name'] && $_POST['email']) {
74
-
75
- echo wplc_user_initiate_chat($_POST['name'],$_POST['email']); // echo the chat session id
76
-
77
- } else {
78
-
79
- echo "error2";
80
-
81
- }
82
-
83
- }
84
-
85
- }
86
-
87
- if ($_POST['action'] == "wplc_relay_stage") {
88
-
89
-
90
-
91
- if ($_POST['stage'] == "1") { // chat window is displayed to user
92
-
93
- echo wplc_log_user_on_page("user".time(),"no email set");
94
-
95
- }
96
-
97
- else if ($_POST['stage'] == "2") { // user still hasnt opened chat window but is now on another page
98
-
99
- echo wplc_update_user_on_page($_POST['cid']);
100
-
101
-
102
- }
103
-
104
- }
105
-
106
- if ($_POST['action'] == "wplc_update_admin_chat") {
107
-
108
- wplc_list_chats();
109
-
110
- }
111
-
112
- if ($_POST['action'] == "wplc_update_admin_status") {
113
-
114
- wplc_update_chat_statuses();
115
-
116
- }
117
-
118
- if ($_POST['action'] == "wplc_admin_accept_chat") {
119
-
120
- wplc_admin_accept_chat($_POST['cid']);
121
-
122
- }
123
-
124
- if ($_POST['action'] == "wplc_update_admin_chat_boxes") {
125
-
126
- echo wplc_return_admin_chat_messages($_POST['cid']);
127
-
128
- wplc_mark_as_read_admin_chat_messages($_POST['cid']);
129
-
130
- }
131
-
132
- if ($_POST['action'] == "wplc_update_admin_return_chat_status") {
133
-
134
- echo wplc_return_chat_status($_POST['cid']);
135
-
136
- }
137
-
138
-
139
-
140
- if ($_POST['action'] == "wplc_admin_send_msg") {
141
-
142
- $chat_id = $_POST['cid'];
143
-
144
- $chat_msg = $_POST['msg'];
145
-
146
- $wplc_rec_msg = wplc_record_chat_msg("2",$chat_id,$chat_msg);
147
-
148
- if ($wplc_rec_msg) {
149
-
150
- echo 'sent';
151
-
152
- } else {
153
-
154
- echo "There was an error sending your chat message. Please contact support";
155
-
156
- }
157
-
158
- }
159
-
160
-
161
- if ($_POST['action'] == "wplc_admin_close_chat") {
162
- $chat_id = $_POST['cid'];
163
- wplc_change_chat_status($chat_id,1);
164
- echo 'done';
165
- }
166
-
167
-
168
-
169
-
170
- // user
171
-
172
-
173
- if ($_POST['action'] == "wplc_user_awaiting_chat") {
174
- $chat_id = $_POST['id'];
175
- echo wplc_return_chat_status($chat_id);
176
- }
177
- if ($_POST['action'] == "wplc_user_minimize_chat") {
178
- $chat_id = $_POST['cid'];
179
- wplc_change_chat_status($_POST['cid'],2);
180
- }
181
- if ($_POST['action'] == "wplc_user_close_chat") {
182
- $chat_id = $_POST['cid'];
183
- wplc_change_chat_status($_POST['cid'],1);
184
- }
185
- if ($_POST['action'] == "wplc_user_maximize_chat") {
186
- $chat_id = $_POST['cid'];
187
- wplc_change_chat_status($_POST['cid'],3);
188
- }
189
-
190
- if ($_POST['action'] == "wplc_user_send_msg") {
191
- $chat_id = $_POST['cid'];
192
- $chat_msg = $_POST['msg'];
193
- $wplc_rec_msg = wplc_record_chat_msg("1",$chat_id,$chat_msg);
194
- if ($wplc_rec_msg) {
195
- echo 'sent';
196
- } else {
197
- echo "There was an error sending your chat message. Please contact support";
198
- }
199
- }
200
-
201
- if ($_POST['action'] == "wplc_update_user_chat_boxes") {
202
- echo wplc_return_user_chat_messages($_POST['cid']);
203
- wplc_mark_as_read_user_chat_messages($_POST['cid']);
204
- }
205
- if ($_POST['action'] == "wplc_update_user_chat_status") {
206
- echo wplc_return_chat_status($_POST['cid']);
207
- }
208
-
209
- if ($_POST['action'] == "wplc_user_reactivate_chat") {
210
- wplc_change_chat_status($_POST['cid'],3);
211
- echo wplc_return_chat_messages($_POST['cid']);
212
-
213
- }
214
-
215
- }
216
- function untrailingslashit($string) {
217
- return rtrim($string, '/');
218
  }
1
+ <?php
2
+
3
+ ini_set('html_errors', 0);
4
+ define('SHORTINIT', true);
5
+
6
+
7
+ $absolute_path = __FILE__;
8
+
9
+ $path_to_file = explode( 'wp-content', $absolute_path );
10
+
11
+ $path_to_wp = $path_to_file[0];
12
+
13
+
14
+
15
+ require_once( $path_to_wp.'/wp-load.php' );
16
+
17
+
18
+ require( ABSPATH . WPINC . '/l10n.php' );
19
+
20
+ require( ABSPATH . WPINC . '/link-template.php' );
21
+
22
+
23
+
24
+
25
+
26
+ global $wpdb;
27
+
28
+ global $wplc_tblname_chats;
29
+
30
+ global $wplc_tblname_msgs;
31
+
32
+ $wplc_tblname_chats = $wpdb->prefix . "wplc_chat_sessions";
33
+
34
+ $wplc_tblname_msgs = $wpdb->prefix . "wplc_chat_msgs";
35
+
36
+
37
+
38
+ require_once("functions.php");
39
+
40
+
41
+
42
+ // stuff goes here
43
+
44
+
45
+
46
+ $check = 1;
47
+
48
+ if ($check == 1) {
49
+
50
+
51
+
52
+
53
+
54
+ // standard callbacks
55
+
56
+ if ($_POST['action'] == "wplc_start_chat") {
57
+
58
+ if ($_POST['cid']) {
59
+
60
+ if ($_POST['name'] && $_POST['email']) {
61
+
62
+ echo wplc_user_initiate_chat($_POST['name'],$_POST['email'],$_POST['cid']); // echo the chat session id
63
+
64
+ } else {
65
+
66
+ echo "error2";
67
+
68
+
69
+ }
70
+
71
+ } else {
72
+
73
+ if ($_POST['name'] && $_POST['email']) {
74
+
75
+ echo wplc_user_initiate_chat($_POST['name'],$_POST['email']); // echo the chat session id
76
+
77
+ } else {
78
+
79
+ echo "error2";
80
+
81
+ }
82
+
83
+ }
84
+
85
+ }
86
+
87
+ if ($_POST['action'] == "wplc_relay_stage") {
88
+
89
+
90
+
91
+ if ($_POST['stage'] == "1") { // chat window is displayed to user
92
+
93
+ echo wplc_log_user_on_page("user".time(),"no email set");
94
+
95
+ }
96
+
97
+ else if ($_POST['stage'] == "2") { // user still hasnt opened chat window but is now on another page
98
+
99
+ echo wplc_update_user_on_page($_POST['cid']);
100
+
101
+
102
+ }
103
+
104
+ }
105
+
106
+ if ($_POST['action'] == "wplc_update_admin_chat") {
107
+
108
+ wplc_list_chats();
109
+
110
+ }
111
+
112
+ if ($_POST['action'] == "wplc_update_admin_status") {
113
+
114
+ wplc_update_chat_statuses();
115
+
116
+ }
117
+
118
+ if ($_POST['action'] == "wplc_admin_accept_chat") {
119
+
120
+ wplc_admin_accept_chat($_POST['cid']);
121
+
122
+ }
123
+
124
+ if ($_POST['action'] == "wplc_update_admin_chat_boxes") {
125
+
126
+ echo wplc_return_admin_chat_messages($_POST['cid']);
127
+
128
+ wplc_mark_as_read_admin_chat_messages($_POST['cid']);
129
+
130
+ }
131
+
132
+ if ($_POST['action'] == "wplc_update_admin_return_chat_status") {
133
+
134
+ echo wplc_return_chat_status($_POST['cid']);
135
+
136
+ }
137
+
138
+
139
+
140
+ if ($_POST['action'] == "wplc_admin_send_msg") {
141
+
142
+ $chat_id = $_POST['cid'];
143
+
144
+ $chat_msg = $_POST['msg'];
145
+
146
+ $wplc_rec_msg = wplc_record_chat_msg("2",$chat_id,$chat_msg);
147
+
148
+ if ($wplc_rec_msg) {
149
+
150
+ echo 'sent';
151
+
152
+ } else {
153
+
154
+ echo "There was an error sending your chat message. Please contact support";
155
+
156
+ }
157
+
158
+ }
159
+
160
+
161
+ if ($_POST['action'] == "wplc_admin_close_chat") {
162
+ $chat_id = $_POST['cid'];
163
+ wplc_change_chat_status($chat_id,1);
164
+ echo 'done';
165
+ }
166
+
167
+
168
+
169
+
170
+ // user
171
+
172
+
173
+ if ($_POST['action'] == "wplc_user_awaiting_chat") {
174
+ $chat_id = $_POST['id'];
175
+ echo wplc_return_chat_status($chat_id);
176
+ }
177
+ if ($_POST['action'] == "wplc_user_minimize_chat") {
178
+ $chat_id = $_POST['cid'];
179
+ wplc_change_chat_status($_POST['cid'],2);
180
+ }
181
+ if ($_POST['action'] == "wplc_user_close_chat") {
182
+ $chat_id = $_POST['cid'];
183
+ wplc_change_chat_status($_POST['cid'],1);
184
+ }
185
+ if ($_POST['action'] == "wplc_user_maximize_chat") {
186
+ $chat_id = $_POST['cid'];
187
+ wplc_change_chat_status($_POST['cid'],3);
188
+ }
189
+
190
+ if ($_POST['action'] == "wplc_user_send_msg") {
191
+ $chat_id = $_POST['cid'];
192
+ $chat_msg = $_POST['msg'];
193
+ $wplc_rec_msg = wplc_record_chat_msg("1",$chat_id,$chat_msg);
194
+ if ($wplc_rec_msg) {
195
+ echo 'sent';
196
+ } else {
197
+ echo "There was an error sending your chat message. Please contact support";
198
+ }
199
+ }
200
+
201
+ if ($_POST['action'] == "wplc_update_user_chat_boxes") {
202
+ echo wplc_return_user_chat_messages($_POST['cid']);
203
+ wplc_mark_as_read_user_chat_messages($_POST['cid']);
204
+ }
205
+ if ($_POST['action'] == "wplc_update_user_chat_status") {
206
+ echo wplc_return_chat_status($_POST['cid']);
207
+ }
208
+
209
+ if ($_POST['action'] == "wplc_user_reactivate_chat") {
210
+ wplc_change_chat_status($_POST['cid'],3);
211
+ echo wplc_return_chat_messages($_POST['cid']);
212
+
213
+ }
214
+
215
+ }
216
+ function untrailingslashit($string) {
217
+ return rtrim($string, '/');
218
  }
beep-2.mp3 CHANGED
File without changes
css/font-awesome.min.css ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ /*!
2
+ * Font Awesome 4.0.3 by @davegandy - http://fontawesome.io - @fontawesome
3
+ * License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License)
4
+ */@font-face{font-family:'FontAwesome';src:url('../fonts/fontawesome-webfont.eot?v=4.0.3');src:url('../fonts/fontawesome-webfont.eot?#iefix&v=4.0.3') format('embedded-opentype'),url('../fonts/fontawesome-webfont.woff?v=4.0.3') format('woff'),url('../fonts/fontawesome-webfont.ttf?v=4.0.3') format('truetype'),url('../fonts/fontawesome-webfont.svg?v=4.0.3#fontawesomeregular') format('svg');font-weight:normal;font-style:normal}.fa{display:inline-block;font-family:FontAwesome;font-style:normal;font-weight:normal;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.fa-lg{font-size:1.3333333333333333em;line-height:.75em;vertical-align:-15%}.fa-2x{font-size:2em}.fa-3x{font-size:3em}.fa-4x{font-size:4em}.fa-5x{font-size:5em}.fa-fw{width:1.2857142857142858em;text-align:center}.fa-ul{padding-left:0;margin-left:2.142857142857143em;list-style-type:none}.fa-ul>li{position:relative}.fa-li{position:absolute;left:-2.142857142857143em;width:2.142857142857143em;top:.14285714285714285em;text-align:center}.fa-li.fa-lg{left:-1.8571428571428572em}.fa-border{padding:.2em .25em .15em;border:solid .08em #eee;border-radius:.1em}.pull-right{float:right}.pull-left{float:left}.fa.pull-left{margin-right:.3em}.fa.pull-right{margin-left:.3em}.fa-spin{-webkit-animation:spin 2s infinite linear;-moz-animation:spin 2s infinite linear;-o-animation:spin 2s infinite linear;animation:spin 2s infinite linear}@-moz-keyframes spin{0%{-moz-transform:rotate(0deg)}100%{-moz-transform:rotate(359deg)}}@-webkit-keyframes spin{0%{-webkit-transform:rotate(0deg)}100%{-webkit-transform:rotate(359deg)}}@-o-keyframes spin{0%{-o-transform:rotate(0deg)}100%{-o-transform:rotate(359deg)}}@-ms-keyframes spin{0%{-ms-transform:rotate(0deg)}100%{-ms-transform:rotate(359deg)}}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(359deg)}}.fa-rotate-90{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=1);-webkit-transform:rotate(90deg);-moz-transform:rotate(90deg);-ms-transform:rotate(90deg);-o-transform:rotate(90deg);transform:rotate(90deg)}.fa-rotate-180{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=2);-webkit-transform:rotate(180deg);-moz-transform:rotate(180deg);-ms-transform:rotate(180deg);-o-transform:rotate(180deg);transform:rotate(180deg)}.fa-rotate-270{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=3);-webkit-transform:rotate(270deg);-moz-transform:rotate(270deg);-ms-transform:rotate(270deg);-o-transform:rotate(270deg);transform:rotate(270deg)}.fa-flip-horizontal{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=0,mirror=1);-webkit-transform:scale(-1,1);-moz-transform:scale(-1,1);-ms-transform:scale(-1,1);-o-transform:scale(-1,1);transform:scale(-1,1)}.fa-flip-vertical{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=2,mirror=1);-webkit-transform:scale(1,-1);-moz-transform:scale(1,-1);-ms-transform:scale(1,-1);-o-transform:scale(1,-1);transform:scale(1,-1)}.fa-stack{position:relative;display:inline-block;width:2em;height:2em;line-height:2em;vertical-align:middle}.fa-stack-1x,.fa-stack-2x{position:absolute;left:0;width:100%;text-align:center}.fa-stack-1x{line-height:inherit}.fa-stack-2x{font-size:2em}.fa-inverse{color:#fff}.fa-glass:before{content:"\f000"}.fa-music:before{content:"\f001"}.fa-search:before{content:"\f002"}.fa-envelope-o:before{content:"\f003"}.fa-heart:before{content:"\f004"}.fa-star:before{content:"\f005"}.fa-star-o:before{content:"\f006"}.fa-user:before{content:"\f007"}.fa-film:before{content:"\f008"}.fa-th-large:before{content:"\f009"}.fa-th:before{content:"\f00a"}.fa-th-list:before{content:"\f00b"}.fa-check:before{content:"\f00c"}.fa-times:before{content:"\f00d"}.fa-search-plus:before{content:"\f00e"}.fa-search-minus:before{content:"\f010"}.fa-power-off:before{content:"\f011"}.fa-signal:before{content:"\f012"}.fa-gear:before,.fa-cog:before{content:"\f013"}.fa-trash-o:before{content:"\f014"}.fa-home:before{content:"\f015"}.fa-file-o:before{content:"\f016"}.fa-clock-o:before{content:"\f017"}.fa-road:before{content:"\f018"}.fa-download:before{content:"\f019"}.fa-arrow-circle-o-down:before{content:"\f01a"}.fa-arrow-circle-o-up:before{content:"\f01b"}.fa-inbox:before{content:"\f01c"}.fa-play-circle-o:before{content:"\f01d"}.fa-rotate-right:before,.fa-repeat:before{content:"\f01e"}.fa-refresh:before{content:"\f021"}.fa-list-alt:before{content:"\f022"}.fa-lock:before{content:"\f023"}.fa-flag:before{content:"\f024"}.fa-headphones:before{content:"\f025"}.fa-volume-off:before{content:"\f026"}.fa-volume-down:before{content:"\f027"}.fa-volume-up:before{content:"\f028"}.fa-qrcode:before{content:"\f029"}.fa-barcode:before{content:"\f02a"}.fa-tag:before{content:"\f02b"}.fa-tags:before{content:"\f02c"}.fa-book:before{content:"\f02d"}.fa-bookmark:before{content:"\f02e"}.fa-print:before{content:"\f02f"}.fa-camera:before{content:"\f030"}.fa-font:before{content:"\f031"}.fa-bold:before{content:"\f032"}.fa-italic:before{content:"\f033"}.fa-text-height:before{content:"\f034"}.fa-text-width:before{content:"\f035"}.fa-align-left:before{content:"\f036"}.fa-align-center:before{content:"\f037"}.fa-align-right:before{content:"\f038"}.fa-align-justify:before{content:"\f039"}.fa-list:before{content:"\f03a"}.fa-dedent:before,.fa-outdent:before{content:"\f03b"}.fa-indent:before{content:"\f03c"}.fa-video-camera:before{content:"\f03d"}.fa-picture-o:before{content:"\f03e"}.fa-pencil:before{content:"\f040"}.fa-map-marker:before{content:"\f041"}.fa-adjust:before{content:"\f042"}.fa-tint:before{content:"\f043"}.fa-edit:before,.fa-pencil-square-o:before{content:"\f044"}.fa-share-square-o:before{content:"\f045"}.fa-check-square-o:before{content:"\f046"}.fa-arrows:before{content:"\f047"}.fa-step-backward:before{content:"\f048"}.fa-fast-backward:before{content:"\f049"}.fa-backward:before{content:"\f04a"}.fa-play:before{content:"\f04b"}.fa-pause:before{content:"\f04c"}.fa-stop:before{content:"\f04d"}.fa-forward:before{content:"\f04e"}.fa-fast-forward:before{content:"\f050"}.fa-step-forward:before{content:"\f051"}.fa-eject:before{content:"\f052"}.fa-chevron-left:before{content:"\f053"}.fa-chevron-right:before{content:"\f054"}.fa-plus-circle:before{content:"\f055"}.fa-minus-circle:before{content:"\f056"}.fa-times-circle:before{content:"\f057"}.fa-check-circle:before{content:"\f058"}.fa-question-circle:before{content:"\f059"}.fa-info-circle:before{content:"\f05a"}.fa-crosshairs:before{content:"\f05b"}.fa-times-circle-o:before{content:"\f05c"}.fa-check-circle-o:before{content:"\f05d"}.fa-ban:before{content:"\f05e"}.fa-arrow-left:before{content:"\f060"}.fa-arrow-right:before{content:"\f061"}.fa-arrow-up:before{content:"\f062"}.fa-arrow-down:before{content:"\f063"}.fa-mail-forward:before,.fa-share:before{content:"\f064"}.fa-expand:before{content:"\f065"}.fa-compress:before{content:"\f066"}.fa-plus:before{content:"\f067"}.fa-minus:before{content:"\f068"}.fa-asterisk:before{content:"\f069"}.fa-exclamation-circle:before{content:"\f06a"}.fa-gift:before{content:"\f06b"}.fa-leaf:before{content:"\f06c"}.fa-fire:before{content:"\f06d"}.fa-eye:before{content:"\f06e"}.fa-eye-slash:before{content:"\f070"}.fa-warning:before,.fa-exclamation-triangle:before{content:"\f071"}.fa-plane:before{content:"\f072"}.fa-calendar:before{content:"\f073"}.fa-random:before{content:"\f074"}.fa-comment:before{content:"\f075"}.fa-magnet:before{content:"\f076"}.fa-chevron-up:before{content:"\f077"}.fa-chevron-down:before{content:"\f078"}.fa-retweet:before{content:"\f079"}.fa-shopping-cart:before{content:"\f07a"}.fa-folder:before{content:"\f07b"}.fa-folder-open:before{content:"\f07c"}.fa-arrows-v:before{content:"\f07d"}.fa-arrows-h:before{content:"\f07e"}.fa-bar-chart-o:before{content:"\f080"}.fa-twitter-square:before{content:"\f081"}.fa-facebook-square:before{content:"\f082"}.fa-camera-retro:before{content:"\f083"}.fa-key:before{content:"\f084"}.fa-gears:before,.fa-cogs:before{content:"\f085"}.fa-comments:before{content:"\f086"}.fa-thumbs-o-up:before{content:"\f087"}.fa-thumbs-o-down:before{content:"\f088"}.fa-star-half:before{content:"\f089"}.fa-heart-o:before{content:"\f08a"}.fa-sign-out:before{content:"\f08b"}.fa-linkedin-square:before{content:"\f08c"}.fa-thumb-tack:before{content:"\f08d"}.fa-external-link:before{content:"\f08e"}.fa-sign-in:before{content:"\f090"}.fa-trophy:before{content:"\f091"}.fa-github-square:before{content:"\f092"}.fa-upload:before{content:"\f093"}.fa-lemon-o:before{content:"\f094"}.fa-phone:before{content:"\f095"}.fa-square-o:before{content:"\f096"}.fa-bookmark-o:before{content:"\f097"}.fa-phone-square:before{content:"\f098"}.fa-twitter:before{content:"\f099"}.fa-facebook:before{content:"\f09a"}.fa-github:before{content:"\f09b"}.fa-unlock:before{content:"\f09c"}.fa-credit-card:before{content:"\f09d"}.fa-rss:before{content:"\f09e"}.fa-hdd-o:before{content:"\f0a0"}.fa-bullhorn:before{content:"\f0a1"}.fa-bell:before{content:"\f0f3"}.fa-certificate:before{content:"\f0a3"}.fa-hand-o-right:before{content:"\f0a4"}.fa-hand-o-left:before{content:"\f0a5"}.fa-hand-o-up:before{content:"\f0a6"}.fa-hand-o-down:before{content:"\f0a7"}.fa-arrow-circle-left:before{content:"\f0a8"}.fa-arrow-circle-right:before{content:"\f0a9"}.fa-arrow-circle-up:before{content:"\f0aa"}.fa-arrow-circle-down:before{content:"\f0ab"}.fa-globe:before{content:"\f0ac"}.fa-wrench:before{content:"\f0ad"}.fa-tasks:before{content:"\f0ae"}.fa-filter:before{content:"\f0b0"}.fa-briefcase:before{content:"\f0b1"}.fa-arrows-alt:before{content:"\f0b2"}.fa-group:before,.fa-users:before{content:"\f0c0"}.fa-chain:before,.fa-link:before{content:"\f0c1"}.fa-cloud:before{content:"\f0c2"}.fa-flask:before{content:"\f0c3"}.fa-cut:before,.fa-scissors:before{content:"\f0c4"}.fa-copy:before,.fa-files-o:before{content:"\f0c5"}.fa-paperclip:before{content:"\f0c6"}.fa-save:before,.fa-floppy-o:before{content:"\f0c7"}.fa-square:before{content:"\f0c8"}.fa-bars:before{content:"\f0c9"}.fa-list-ul:before{content:"\f0ca"}.fa-list-ol:before{content:"\f0cb"}.fa-strikethrough:before{content:"\f0cc"}.fa-underline:before{content:"\f0cd"}.fa-table:before{content:"\f0ce"}.fa-magic:before{content:"\f0d0"}.fa-truck:before{content:"\f0d1"}.fa-pinterest:before{content:"\f0d2"}.fa-pinterest-square:before{content:"\f0d3"}.fa-google-plus-square:before{content:"\f0d4"}.fa-google-plus:before{content:"\f0d5"}.fa-money:before{content:"\f0d6"}.fa-caret-down:before{content:"\f0d7"}.fa-caret-up:before{content:"\f0d8"}.fa-caret-left:before{content:"\f0d9"}.fa-caret-right:before{content:"\f0da"}.fa-columns:before{content:"\f0db"}.fa-unsorted:before,.fa-sort:before{content:"\f0dc"}.fa-sort-down:before,.fa-sort-asc:before{content:"\f0dd"}.fa-sort-up:before,.fa-sort-desc:before{content:"\f0de"}.fa-envelope:before{content:"\f0e0"}.fa-linkedin:before{content:"\f0e1"}.fa-rotate-left:before,.fa-undo:before{content:"\f0e2"}.fa-legal:before,.fa-gavel:before{content:"\f0e3"}.fa-dashboard:before,.fa-tachometer:before{content:"\f0e4"}.fa-comment-o:before{content:"\f0e5"}.fa-comments-o:before{content:"\f0e6"}.fa-flash:before,.fa-bolt:before{content:"\f0e7"}.fa-sitemap:before{content:"\f0e8"}.fa-umbrella:before{content:"\f0e9"}.fa-paste:before,.fa-clipboard:before{content:"\f0ea"}.fa-lightbulb-o:before{content:"\f0eb"}.fa-exchange:before{content:"\f0ec"}.fa-cloud-download:before{content:"\f0ed"}.fa-cloud-upload:before{content:"\f0ee"}.fa-user-md:before{content:"\f0f0"}.fa-stethoscope:before{content:"\f0f1"}.fa-suitcase:before{content:"\f0f2"}.fa-bell-o:before{content:"\f0a2"}.fa-coffee:before{content:"\f0f4"}.fa-cutlery:before{content:"\f0f5"}.fa-file-text-o:before{content:"\f0f6"}.fa-building-o:before{content:"\f0f7"}.fa-hospital-o:before{content:"\f0f8"}.fa-ambulance:before{content:"\f0f9"}.fa-medkit:before{content:"\f0fa"}.fa-fighter-jet:before{content:"\f0fb"}.fa-beer:before{content:"\f0fc"}.fa-h-square:before{content:"\f0fd"}.fa-plus-square:before{content:"\f0fe"}.fa-angle-double-left:before{content:"\f100"}.fa-angle-double-right:before{content:"\f101"}.fa-angle-double-up:before{content:"\f102"}.fa-angle-double-down:before{content:"\f103"}.fa-angle-left:before{content:"\f104"}.fa-angle-right:before{content:"\f105"}.fa-angle-up:before{content:"\f106"}.fa-angle-down:before{content:"\f107"}.fa-desktop:before{content:"\f108"}.fa-laptop:before{content:"\f109"}.fa-tablet:before{content:"\f10a"}.fa-mobile-phone:before,.fa-mobile:before{content:"\f10b"}.fa-circle-o:before{content:"\f10c"}.fa-quote-left:before{content:"\f10d"}.fa-quote-right:before{content:"\f10e"}.fa-spinner:before{content:"\f110"}.fa-circle:before{content:"\f111"}.fa-mail-reply:before,.fa-reply:before{content:"\f112"}.fa-github-alt:before{content:"\f113"}.fa-folder-o:before{content:"\f114"}.fa-folder-open-o:before{content:"\f115"}.fa-smile-o:before{content:"\f118"}.fa-frown-o:before{content:"\f119"}.fa-meh-o:before{content:"\f11a"}.fa-gamepad:before{content:"\f11b"}.fa-keyboard-o:before{content:"\f11c"}.fa-flag-o:before{content:"\f11d"}.fa-flag-checkered:before{content:"\f11e"}.fa-terminal:before{content:"\f120"}.fa-code:before{content:"\f121"}.fa-reply-all:before{content:"\f122"}.fa-mail-reply-all:before{content:"\f122"}.fa-star-half-empty:before,.fa-star-half-full:before,.fa-star-half-o:before{content:"\f123"}.fa-location-arrow:before{content:"\f124"}.fa-crop:before{content:"\f125"}.fa-code-fork:before{content:"\f126"}.fa-unlink:before,.fa-chain-broken:before{content:"\f127"}.fa-question:before{content:"\f128"}.fa-info:before{content:"\f129"}.fa-exclamation:before{content:"\f12a"}.fa-superscript:before{content:"\f12b"}.fa-subscript:before{content:"\f12c"}.fa-eraser:before{content:"\f12d"}.fa-puzzle-piece:before{content:"\f12e"}.fa-microphone:before{content:"\f130"}.fa-microphone-slash:before{content:"\f131"}.fa-shield:before{content:"\f132"}.fa-calendar-o:before{content:"\f133"}.fa-fire-extinguisher:before{content:"\f134"}.fa-rocket:before{content:"\f135"}.fa-maxcdn:before{content:"\f136"}.fa-chevron-circle-left:before{content:"\f137"}.fa-chevron-circle-right:before{content:"\f138"}.fa-chevron-circle-up:before{content:"\f139"}.fa-chevron-circle-down:before{content:"\f13a"}.fa-html5:before{content:"\f13b"}.fa-css3:before{content:"\f13c"}.fa-anchor:before{content:"\f13d"}.fa-unlock-alt:before{content:"\f13e"}.fa-bullseye:before{content:"\f140"}.fa-ellipsis-h:before{content:"\f141"}.fa-ellipsis-v:before{content:"\f142"}.fa-rss-square:before{content:"\f143"}.fa-play-circle:before{content:"\f144"}.fa-ticket:before{content:"\f145"}.fa-minus-square:before{content:"\f146"}.fa-minus-square-o:before{content:"\f147"}.fa-level-up:before{content:"\f148"}.fa-level-down:before{content:"\f149"}.fa-check-square:before{content:"\f14a"}.fa-pencil-square:before{content:"\f14b"}.fa-external-link-square:before{content:"\f14c"}.fa-share-square:before{content:"\f14d"}.fa-compass:before{content:"\f14e"}.fa-toggle-down:before,.fa-caret-square-o-down:before{content:"\f150"}.fa-toggle-up:before,.fa-caret-square-o-up:before{content:"\f151"}.fa-toggle-right:before,.fa-caret-square-o-right:before{content:"\f152"}.fa-euro:before,.fa-eur:before{content:"\f153"}.fa-gbp:before{content:"\f154"}.fa-dollar:before,.fa-usd:before{content:"\f155"}.fa-rupee:before,.fa-inr:before{content:"\f156"}.fa-cny:before,.fa-rmb:before,.fa-yen:before,.fa-jpy:before{content:"\f157"}.fa-ruble:before,.fa-rouble:before,.fa-rub:before{content:"\f158"}.fa-won:before,.fa-krw:before{content:"\f159"}.fa-bitcoin:before,.fa-btc:before{content:"\f15a"}.fa-file:before{content:"\f15b"}.fa-file-text:before{content:"\f15c"}.fa-sort-alpha-asc:before{content:"\f15d"}.fa-sort-alpha-desc:before{content:"\f15e"}.fa-sort-amount-asc:before{content:"\f160"}.fa-sort-amount-desc:before{content:"\f161"}.fa-sort-numeric-asc:before{content:"\f162"}.fa-sort-numeric-desc:before{content:"\f163"}.fa-thumbs-up:before{content:"\f164"}.fa-thumbs-down:before{content:"\f165"}.fa-youtube-square:before{content:"\f166"}.fa-youtube:before{content:"\f167"}.fa-xing:before{content:"\f168"}.fa-xing-square:before{content:"\f169"}.fa-youtube-play:before{content:"\f16a"}.fa-dropbox:before{content:"\f16b"}.fa-stack-overflow:before{content:"\f16c"}.fa-instagram:before{content:"\f16d"}.fa-flickr:before{content:"\f16e"}.fa-adn:before{content:"\f170"}.fa-bitbucket:before{content:"\f171"}.fa-bitbucket-square:before{content:"\f172"}.fa-tumblr:before{content:"\f173"}.fa-tumblr-square:before{content:"\f174"}.fa-long-arrow-down:before{content:"\f175"}.fa-long-arrow-up:before{content:"\f176"}.fa-long-arrow-left:before{content:"\f177"}.fa-long-arrow-right:before{content:"\f178"}.fa-apple:before{content:"\f179"}.fa-windows:before{content:"\f17a"}.fa-android:before{content:"\f17b"}.fa-linux:before{content:"\f17c"}.fa-dribbble:before{content:"\f17d"}.fa-skype:before{content:"\f17e"}.fa-foursquare:before{content:"\f180"}.fa-trello:before{content:"\f181"}.fa-female:before{content:"\f182"}.fa-male:before{content:"\f183"}.fa-gittip:before{content:"\f184"}.fa-sun-o:before{content:"\f185"}.fa-moon-o:before{content:"\f186"}.fa-archive:before{content:"\f187"}.fa-bug:before{content:"\f188"}.fa-vk:before{content:"\f189"}.fa-weibo:before{content:"\f18a"}.fa-renren:before{content:"\f18b"}.fa-pagelines:before{content:"\f18c"}.fa-stack-exchange:before{content:"\f18d"}.fa-arrow-circle-o-right:before{content:"\f18e"}.fa-arrow-circle-o-left:before{content:"\f190"}.fa-toggle-left:before,.fa-caret-square-o-left:before{content:"\f191"}.fa-dot-circle-o:before{content:"\f192"}.fa-wheelchair:before{content:"\f193"}.fa-vimeo-square:before{content:"\f194"}.fa-turkish-lira:before,.fa-try:before{content:"\f195"}.fa-plus-square-o:before{content:"\f196"}
css/wplcstyle.css CHANGED
@@ -1,68 +1,189 @@
1
- #wp-live-chat input[type="button"] { width: auto }
2
- #wp-live-chat input[type="text"] { width:150px; border:1px solid #CCC; }
3
- #wp-live-chat textarea { width:145px; height:40px; border:1px solid #CCC; }
4
- #wplc_chatbox {
5
- border: 1px solid #CCC;
6
- overflow: auto;
7
- padding:5px;
8
- height:200px;
9
- overflow:auto;
10
- width:230px;
11
- margin-left:5px;
12
- }
13
- #wp-live-chat td { padding:5px; padding-left:10px; }
14
- #wp-live-chat table { border: 0 !important; }
15
- #wp-live-chat table td { border: 0 !important; }
16
- #wp-live-chat h4 { font-size:20px; margin:3px; }
17
- #wp-live-chat p { font-size:14px; margin:3px; }
18
- #wp-live-chat #wplc-sb { font-size:14px; font-weight:bold; }
19
- #wp-live-chat-4 { padding-top:8px; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  #wp-live-chat {
21
- box-shadow: 5px 5px 5px #888;
22
- border:2px solid #888;
23
- position:fixed;
24
- bottom:0px;
25
- z-index:105;
26
- display:block;
27
  background: #fff;
28
- width:250px;
29
-
 
 
 
 
 
 
30
  }
 
31
  #wp-live-chat-1 {
32
- background: #73BE28;
33
  cursor: pointer;
34
- padding:5px;
35
- padding-left:20px;
36
- padding-right:20px;
37
- font-size:14px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
 
39
- color:#FFF;
40
  }
41
- #wp-live-chat-minimize { position:absolute; right:23px; top:15px; width:10px; cursor: pointer; height:3px; background:#FFF; }
42
- #wp-live-chat-close { position:absolute; right:5px; top:4px; width:10px; cursor: pointer; font-weight:bold; }
 
 
 
 
 
 
 
 
43
  #wp-live-chat-2-info {
44
- font-size:11px;
45
- display:block;
46
- width:212px;
47
- margin-left:auto;
48
- margin-right:auto;
49
- margin-top:10px;
50
- overflow:auto;
51
- border:1px solid #ccc;
52
- padding:2px;
53
  }
 
54
  #wp-live-chat-2-img {
55
- float:left;
56
- padding:5px;
57
  }
 
58
  #wplc_chatmsg {
59
- width:215px !important;
60
- margin-left:10px;
61
- border:1px solid #9D9D9D;
62
-
63
  }
 
64
  .wplc_offline {
65
- font-size:12px;
66
- font-weight:bold;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
  }
68
- .wplc_logo_class { max-width: 220px; }
1
+ #wp-live-chat textarea {
2
+ width: 100%;
3
+ height: 100px;
4
+ }
5
+
6
+ #wplc_chatbox {
7
+ padding: 5px;
8
+ height: 200px;
9
+ overflow-y: auto;
10
+ overflow-x:hidden;
11
+ -webkit-box-shadow: inset 0px 5px 5px -4px rgba(50, 50, 50, 0.5);
12
+ -moz-box-shadow: inset 0px 5px 5px -4px rgba(50, 50, 50, 0.5);
13
+ box-shadow: inset 0px 5px 5px -4px rgba(50, 50, 50, 0.5);
14
+ }
15
+
16
+
17
+ #wp-live-chat td {
18
+ padding: 5px;
19
+ padding-left: 10px;
20
+ }
21
+
22
+ #wp-live-chat table {
23
+ border: 0 !important;
24
+ }
25
+
26
+ #wp-live-chat table td {
27
+ border: 0 !important;
28
+ }
29
+
30
+ #wp-live-chat h4 {
31
+ font-size: 20px;
32
+ margin: 3px;
33
+ }
34
+
35
+ #wp-live-chat p {
36
+ font-size: 14px;
37
+ margin: 3px;
38
+ }
39
+
40
+ #wp-live-chat #wplc-sb {
41
+ font-size: 14px;
42
+ font-weight: 700;
43
+ }
44
+
45
+ #wp-live-chat-4 {
46
+ }
47
+
48
  #wp-live-chat {
49
+ position: fixed;
50
+ bottom: 0;
51
+ z-index: 105;
52
+ display: block;
 
 
53
  background: #fff;
54
+ -webkit-box-shadow: 0px 0px 5px 0px rgba(50, 50, 50, 0.5);
55
+ -moz-box-shadow: 0px 0px 5px 0px rgba(50, 50, 50, 0.5);
56
+ box-shadow: 0px 0px 5px 0px rgba(50, 50, 50, 0.5);
57
+ border-radius: 5px 5px 0 0 ;
58
+ color:#999;
59
+ max-width: 250px;
60
+ max-height: 360px;
61
+ z-index: 9999;
62
  }
63
+
64
  #wp-live-chat-1 {
 
65
  cursor: pointer;
66
+ padding: 5px;
67
+ padding-left: 20px;
68
+ padding-right: 20px;
69
+ font-size: 14px;
70
+ color: #FFF;
71
+ }
72
+
73
+ #wp-live-chat-minimize {
74
+ position: absolute;
75
+ right: 23px;
76
+ top: 4px;
77
+ cursor: pointer;
78
+ height: 14px;
79
+ padding: 0 3px;
80
+ border-radius: 2px;
81
+ background-color: rgba(0, 0, 0, 0.4);
82
+ font-size: 10px;
83
+ }
84
+
85
+ #wp-live-chat-close {
86
+ position: absolute;
87
+ right: 5px;
88
+ top: 4px;
89
+ cursor: pointer;
90
+ border-radius: 2px;
91
+ background-color: rgba(0, 0, 0, 0.4);
92
+ height: 14px;
93
+ padding: 0 3px;
94
 
 
95
  }
96
+ #wp-live-chat-close .fa-times{
97
+ position: relative;
98
+ bottom:8px;
99
+ font-size: 10px;
100
+ }
101
+ #wp-live-chat-minimize .fa-minus{
102
+ position: relative;
103
+ top: 3px;
104
+ }
105
+
106
  #wp-live-chat-2-info {
107
+ font-size: 13px;
108
+ display: block;
109
+ width: 212px;
110
+ overflow: auto;
111
+ text-align: center;
112
+ margin: 0 auto;
 
 
 
113
  }
114
+
115
  #wp-live-chat-2-img {
116
+ padding-bottom: 5px;
 
117
  }
118
+
119
  #wplc_chatmsg {
120
+ width: 100%;
 
 
 
121
  }
122
+
123
  .wplc_offline {
124
+ font-size: 12px;
125
+ font-weight: 700;
126
+ }
127
+
128
+ .wplc_logo_class {
129
+ max-width: 250px;
130
+ }
131
+ #wp-live-chat-header{
132
+ padding: 10px 0 0;
133
+ border-radius: 5px 5px 0 0;
134
+ position:relative;
135
+ }
136
+ #wp-live-chat-image{
137
+ position: absolute;
138
+ padding: 5px;
139
+ width: 40px;
140
+ max-height: 40px;
141
+ background: #fff;
142
+ border-radius: 3px;
143
+ bottom: 25px;
144
+ left: 10px;
145
+ -webkit-box-shadow: 0px 0px 5px 0px rgba(50, 50, 50, 0.5);
146
+ -moz-box-shadow: 0px 0px 5px 0px rgba(50, 50, 50, 0.5);
147
+ box-shadow: 0px 0px 5px 0px rgba(50, 50, 50, 0.5);
148
+ }
149
+ #wp-live-chat-2 {
150
+ padding:5px;
151
+ }
152
+ #wp-live-chat-2 input{
153
+ display:block;
154
+ margin:5px 0;
155
+ width:100%;
156
+ }
157
+ .wplc-user-message{
158
+ display: inline-block;
159
+ padding: 5px;
160
+ -webkit-box-shadow: 0px 0px 5px 0px rgba(50, 50, 50, 0.5);
161
+ -moz-box-shadow: 0px 0px 5px 0px rgba(50, 50, 50, 0.5);
162
+ box-shadow: 0px 0px 5px 0px rgba(50, 50, 50, 0.5);
163
+ border-radius: 5px;
164
+ float: right;
165
+ margin-bottom: 5px;
166
+ }
167
+ .wplc-user-message hr , .wplc-admin-message hr{
168
+ margin:0;
169
+ }
170
+ .wplc-clear-float-message{
171
+ clear: both;
172
+ }
173
+
174
+ .wplc-admin-message{
175
+ display: inline-block;
176
+ padding: 5px;
177
+ -webkit-box-shadow: 0px 0px 5px 0px rgba(50, 50, 50, 0.5);
178
+ -moz-box-shadow: 0px 0px 5px 0px rgba(50, 50, 50, 0.5);
179
+ box-shadow: 0px 0px 5px 0px rgba(50, 50, 50, 0.5);
180
+ border-radius: 5px;
181
+ float: left;
182
+ margin-bottom: 5px;
183
+ }
184
+ #wplc_message_div{
185
+ width: 200px;
186
+ text-align: center;
187
+ margin: 0 auto;
188
  }
189
+
ding.mp3 CHANGED
File without changes
fonts/fontawesome-webfont.ttf ADDED
Binary file
functions.php CHANGED
@@ -1,467 +1,492 @@
1
- <?php
2
-
3
- function wplc_log_user_on_page($name,$email) {
4
- global $wpdb;
5
- global $wplc_tblname_chats;
6
-
7
- $ins_array = array(
8
- 'status' => '5',
9
- 'timestamp' => date("Y-m-d H:i:s"),
10
- 'name' => $name,
11
- 'email' => $email,
12
- 'ip' => $_SERVER['REMOTE_ADDR'],
13
- 'url' => $_SERVER['HTTP_REFERER'],
14
- 'last_active_timestamp' => date("Y-m-d H:i:s")
15
- );
16
-
17
- $rows_affected = $wpdb->insert( $wplc_tblname_chats, $ins_array );
18
-
19
- $lastid = $wpdb->insert_id;
20
-
21
-
22
- return $lastid;
23
-
24
- }
25
- function wplc_update_user_on_page($cid) {
26
- global $wpdb;
27
- global $wplc_tblname_chats;
28
-
29
- $query =
30
- "
31
- UPDATE $wplc_tblname_chats
32
- SET
33
- `url` = '".$_SERVER['HTTP_REFERER']."',
34
- `last_active_timestamp` = '".date("Y-m-d H:i:s")."',
35
- `ip` = '".$_SERVER['REMOTE_ADDR']."',
36
- `status` = '5'
37
-
38
- WHERE `id` = '$cid'
39
- LIMIT 1
40
- ";
41
- $results = $wpdb->query($query);
42
- return $query;
43
-
44
-
45
-
46
- }
47
-
48
-
49
-
50
- function wplc_record_chat_msg($from,$cid,$msg) {
51
- global $wpdb;
52
- global $wplc_tblname_msgs;
53
-
54
- if ($from == "1") {
55
- $fromname = wplc_return_chat_name($cid);
56
- $orig = '2';
57
- }
58
- else {
59
- $fromname = "admin";
60
- $orig = '1';
61
- }
62
-
63
- $ins_array = array(
64
- 'chat_sess_id' => $cid,
65
- 'timestamp' => date("Y-m-d H:i:s"),
66
- 'from' => $fromname,
67
- 'msg' => $msg,
68
- 'status' => 0,
69
- 'originates' => $orig
70
- );
71
- $rows_affected = $wpdb->insert( $wplc_tblname_msgs, $ins_array );
72
-
73
- wplc_update_active_timestamp($cid);
74
- wplc_change_chat_status($cid,3);
75
- return true;
76
-
77
-
78
- }
79
-
80
- function wplc_update_active_timestamp($cid) {
81
- global $wpdb;
82
- global $wplc_tblname_chats;
83
- $results = $wpdb->get_results(
84
- "
85
- UPDATE $wplc_tblname_chats
86
- SET `last_active_timestamp` = '".date("Y-m-d H:i:s")."'
87
- WHERE `id` = '$cid'
88
- LIMIT 1
89
- "
90
- );
91
- wplc_change_chat_status($cid,3);
92
- return true;
93
-
94
- }
95
-
96
- function wplc_return_chat_name($cid) {
97
- global $wpdb;
98
- global $wplc_tblname_chats;
99
- $results = $wpdb->get_results(
100
- "
101
- SELECT *
102
- FROM $wplc_tblname_chats
103
- WHERE `id` = '$cid'
104
- "
105
- );
106
- foreach ($results as $result) {
107
- return $result->name;
108
- }
109
-
110
- }
111
- function wplc_list_chats() {
112
-
113
- global $wpdb;
114
- global $wplc_tblname_chats;
115
-
116
- $results = $wpdb->get_results(
117
- "
118
- SELECT *
119
- FROM $wplc_tblname_chats
120
- WHERE `status` = 3 OR `status` = 2
121
- ORDER BY `timestamp` ASC
122
-
123
- "
124
- );
125
- echo "
126
-
127
-
128
- <table class=\"wp-list-table widefat fixed \" cellspacing=\"0\">
129
- <thead>
130
- <tr>
131
- <th scope='col' id='wplc_id_colum' class='manage-column column-id sortable desc' style=''><span>".__("IP","wplivechat")."</span></th>
132
- <th scope='col' id='wplc_name_colum' class='manage-column column-name_title sortable desc' style=''><span>".__("Name","wplivechat")."</span></th>
133
- <th scope='col' id='wplc_email_colum' class='manage-column column-email' style=\"\">".__("Email","wplivechat")."</th>
134
- <th scope='col' id='wplc_url_colum' class='manage-column column-url' style=\"\">".__("URL","wplivechat")."</th>
135
- <th scope='col' id='wplc_status_colum' class='manage-column column-status' style=\"\">".__("Status","wplivechat")."</th>
136
- <th scope='col' id='wplc_action_colum' class='manage-column column-action sortable desc' style=\"\"><span>".__("Action","wplivechat")."</span></th>
137
- </tr>
138
- </thead>
139
- <tbody id=\"the-list\" class='list:wp_list_text_link'>
140
- ";
141
-
142
- if (!$results) {
143
- echo "<tr><td></td><td>".__("No chat sessions available at the moment","wplivechat")."</td></tr>";
144
- }
145
- else {
146
- foreach ($results as $result) {
147
- unset($trstyle);
148
- unset($actions);
149
- $wplc_c++;
150
-
151
- if ($result->status == 2) {
152
- $url = admin_url( 'admin.php?page=wplivechat-menu&action=ac&cid='.$result->id);
153
- $actions = "<a href=\"#\" onclick=\"window.open('$url', 'mywindow".$result->id."', 'location=no,status=1,scrollbars=1,width=500,height=650');return false;\">Accept Chat</a>";
154
- $trstyle = "style='background-color:#FFFBE4; height:30px;'";
155
- }
156
- if ($result->status == 3) {
157
- $url = admin_url( 'admin.php?page=wplivechat-menu&action=ac&cid='.$result->id);
158
- $actions = "<a href=\"#\" onclick=\"window.open('$url', 'mywindow".$result->id."', 'location=no,status=1,scrollbars=1,width=500,height=650');return false;\">Open Chat Window</a>";
159
- $trstyle = "style='background-color:#F7FCFE; height:30px;'";
160
- }
161
-
162
-
163
- echo "<tr id=\"record_".$result->id."\" $trstyle>";
164
- echo "<td class='chat_id column-chat_d'>".$result->ip."</td>";
165
- echo "<td class='chat_name column_chat_name' id='chat_name_".$result->id."'><img src=\"http://www.gravatar.com/avatar/".md5($result->email)."?s=40\" /> ".$result->name."</td>";
166
- echo "<td class='chat_email column_chat_email' id='chat_email_".$result->id."'>".$result->email."</td>";
167
- echo "<td class='chat_name column_chat_url' id='chat_url_".$result->id."'>".$result->url."</td>";
168
- echo "<td class='chat_status column_chat_status' id='chat_status_".$result->id."'><strong>".wplc_return_status($result->status)."</strong></td>";if ($wplc_c>1) { $actions = wplc_get_msg(); }
169
- echo "<td class='chat_action column-chat_action' id='chat_action_".$result->id."'>$actions</td>";
170
- echo "</tr>";
171
-
172
- }
173
- }
174
- echo "</table><br /><br />";
175
-
176
-
177
- }
178
-
179
-
180
-
181
-
182
- function wplc_return_user_chat_messages($cid) {
183
- global $wpdb;
184
- global $wplc_tblname_msgs;
185
- $results = $wpdb->get_results(
186
- "
187
- SELECT *
188
- FROM $wplc_tblname_msgs
189
- WHERE `chat_sess_id` = '$cid' AND `status` = '0' AND `originates` = '1'
190
- ORDER BY `timestamp` ASC
191
-
192
- "
193
- );
194
- $msg_hist = "";
195
- foreach ($results as $result) {
196
- $id = $result->id;
197
- $from = $result->from;
198
-
199
- $msg = stripslashes($result->msg);
200
- //$timestamp = strtotime($result->timestamp);
201
- //$timeshow = date("H:i",$timestamp);
202
- $msg_hist .= "<strong>$from</strong>: $msg<br />";
203
-
204
- }
205
-
206
- return $msg_hist;
207
-
208
-
209
- }
210
-
211
-
212
- function wplc_change_chat_status($id,$status) {
213
- global $wpdb;
214
- global $wplc_tblname_chats;
215
- $results = $wpdb->get_results(
216
- "
217
- UPDATE $wplc_tblname_chats
218
- SET `status` = '$status'
219
- WHERE `id` = '$id'
220
- LIMIT 1
221
- "
222
- );
223
- return true;
224
-
225
- }
226
-
227
-
228
- function wplc_return_chat_messages($cid) {
229
- global $wpdb;
230
- global $wplc_tblname_msgs;
231
- $results = $wpdb->get_results(
232
- "
233
- SELECT *
234
- FROM $wplc_tblname_msgs
235
- WHERE `chat_sess_id` = '$cid'
236
- ORDER BY `timestamp` ASC
237
- LIMIT 0, 100
238
- "
239
- );
240
- foreach ($results as $result) {
241
- $from = $result->from;
242
- $msg = $result->msg;
243
- $timestamp = strtotime($result->timestamp);
244
- $timeshow = date("H:i:s",$timestamp);
245
- $msg_hist .= "<strong>$from</strong>: $msg<br />";
246
-
247
- }
248
- return $msg_hist;
249
-
250
-
251
- }
252
-
253
-
254
- function wplc_mark_as_read_user_chat_messages($cid) {
255
- global $wpdb;
256
- global $wplc_tblname_msgs;
257
- $results = $wpdb->get_results(
258
- "
259
- SELECT *
260
- FROM $wplc_tblname_msgs
261
- WHERE `chat_sess_id` = '$cid' AND `status` = '0' AND `originates` = '1'
262
- ORDER BY `timestamp` DESC
263
-
264
- "
265
- );
266
-
267
-
268
- foreach ($results as $result) {
269
- $id = $result->id;
270
- $check = $wpdb->query(
271
- "
272
- UPDATE $wplc_tblname_msgs
273
- SET `status` = 1
274
- WHERE `id` = '$id'
275
- LIMIT 1
276
-
277
- "
278
- );
279
- }
280
- return "ok";
281
-
282
-
283
- }
284
-
285
- function wplc_return_admin_chat_messages($cid) {
286
- global $wpdb;
287
- global $wplc_tblname_msgs;
288
- $results = $wpdb->get_results(
289
- "
290
- SELECT *
291
- FROM $wplc_tblname_msgs
292
- WHERE `chat_sess_id` = '$cid' AND `status` = '0' AND `originates` = '2'
293
- ORDER BY `timestamp` ASC
294
-
295
- "
296
- );
297
- $msg_hist = "";
298
- foreach ($results as $result) {
299
- $id = $result->id;
300
- $from = $result->from;
301
-
302
- $msg = stripslashes($result->msg);
303
- //$timestamp = strtotime($result->timestamp);
304
- //$timeshow = date("H:i",$timestamp);
305
- $msg_hist .= "<strong>$from</strong>: $msg<br />";
306
-
307
- }
308
-
309
- return $msg_hist;
310
-
311
-
312
- }
313
- function wplc_mark_as_read_admin_chat_messages($cid) {
314
- global $wpdb;
315
- global $wplc_tblname_msgs;
316
- $results = $wpdb->get_results(
317
- "
318
- SELECT *
319
- FROM $wplc_tblname_msgs
320
- WHERE `chat_sess_id` = '$cid' AND `status` = '0' AND `originates` = '2'
321
- ORDER BY `timestamp` DESC
322
-
323
- "
324
- );
325
-
326
-
327
- foreach ($results as $result) {
328
- $id = $result->id;
329
- $check = $wpdb->query(
330
- "
331
- UPDATE $wplc_tblname_msgs
332
- SET `status` = 1
333
- WHERE `id` = '$id'
334
- LIMIT 1
335
-
336
- "
337
- );
338
- }
339
- return "ok";
340
-
341
-
342
- }
343
-
344
-
345
-
346
-
347
-
348
-
349
-
350
- function wplc_return_chat_status($cid) {
351
- global $wpdb;
352
- global $wplc_tblname_chats;
353
- $results = $wpdb->get_results(
354
- "
355
- SELECT *
356
- FROM $wplc_tblname_chats
357
- WHERE `id` = '$cid'
358
- "
359
- );
360
- foreach ($results as $result) {
361
- return $result->status;
362
- }
363
- }
364
-
365
-
366
- function wplc_return_status($status) {
367
- if ($status == 1) {
368
- return "complete";
369
- }
370
- if ($status == 2) {
371
- return "pending";
372
- }
373
- if ($status == 3) {
374
- return "active";
375
- }
376
- if ($status == 4) {
377
- return "deleted";
378
- }
379
- if ($status == 5) {
380
- return "browsing";
381
- }
382
- if ($status == 6) {
383
- return "requesting chat";
384
- }
385
- }
386
-
387
-
388
- function wplc_user_initiate_chat($name,$email,$cid = null) {
389
- global $wpdb;
390
- global $wplc_tblname_chats;
391
-
392
- if (function_exists("wplc_list_chats_pro")) { /* check if functions-pro is around */
393
- wplc_pro_notify_via_email();
394
- }
395
-
396
- if ($cid != null) { /* change from a visitor to a chat */
397
- $query =
398
- "
399
- UPDATE $wplc_tblname_chats
400
- SET
401
- `status` = '2',
402
- `timestamp` = '".date("Y-m-d H:i:s")."',
403
- `name` = '$name',
404
- `email` = '$email',
405
- `ip` = '".$_SERVER['REMOTE_ADDR']."',
406
- `url` = '".$_SERVER['HTTP_REFERER']."',
407
- `last_active_timestamp` = '".date("Y-m-d H:i:s")."'
408
-
409
- WHERE `id` = '$cid'
410
- LIMIT 1
411
- ";
412
- $results = $wpdb->query($query);
413
- return $cid;
414
- }
415
- else { // create new ID for the chat
416
- $ins_array = array(
417
- 'status' => '2',
418
- 'timestamp' => date("Y-m-d H:i:s"),
419
- 'name' => $name,
420
- 'email' => $email,
421
- 'ip' => $_SERVER['REMOTE_ADDR'],
422
- 'url' => $_SERVER['HTTP_REFERER'],
423
- 'last_active_timestamp' => date("Y-m-d H:i:s")
424
- );
425
- $rows_affected = $wpdb->insert( $wplc_tblname_chats, $ins_array );
426
- $lastid = $wpdb->insert_id;
427
- return $lastid;
428
- }
429
-
430
- }
431
-
432
-
433
-
434
- function wplc_get_msg() {
435
- return "<a href=\"http://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=morechats\" title=\"".__("Get Pro Add-on to accept more chats","wplivechat")."\" target=\"_BLANK\">Get Pro Add-on to accept more chats</a>";
436
- }
437
- function wplc_update_chat_statuses() {
438
-
439
- global $wpdb;
440
- global $wplc_tblname_chats;
441
- $results = $wpdb->get_results(
442
- "
443
- SELECT *
444
- FROM $wplc_tblname_chats
445
- WHERE `status` = '2' OR `status` = '3' OR `status` = '5'
446
- "
447
- );
448
- foreach ($results as $result) {
449
- $id = $result->id;
450
- $timestamp = strtotime($result->last_active_timestamp);
451
- if ($result->status == 2) {
452
- if ((time() - $timestamp) >= 60) { // 1 minute max
453
- wplc_change_chat_status($id,0);
454
- }
455
- }
456
- else if ($result->status == 3) {
457
- if ((time() - $timestamp) >= 600) { // 10 minute max
458
- wplc_change_chat_status($id,1);
459
- }
460
- }
461
- else if ($result->status == 5) {
462
- if ((time() - $timestamp) >= 120) { // 2 minute timeout
463
- wplc_change_chat_status($id,7); // 7 - timedout
464
- }
465
- }
466
- }
467
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ function wplc_log_user_on_page($name,$email) {
4
+ global $wpdb;
5
+ global $wplc_tblname_chats;
6
+
7
+ $ins_array = array(
8
+ 'status' => '5',
9
+ 'timestamp' => date("Y-m-d H:i:s"),
10
+ 'name' => $name,
11
+ 'email' => $email,
12
+ 'ip' => $_SERVER['REMOTE_ADDR'],
13
+ 'url' => $_SERVER['HTTP_REFERER'],
14
+ 'last_active_timestamp' => date("Y-m-d H:i:s")
15
+ );
16
+
17
+ $rows_affected = $wpdb->insert( $wplc_tblname_chats, $ins_array );
18
+
19
+ $lastid = $wpdb->insert_id;
20
+
21
+
22
+ return $lastid;
23
+
24
+ }
25
+ function wplc_update_user_on_page($cid) {
26
+ global $wpdb;
27
+ global $wplc_tblname_chats;
28
+
29
+ $query =
30
+ "
31
+ UPDATE $wplc_tblname_chats
32
+ SET
33
+ `url` = '".$_SERVER['HTTP_REFERER']."',
34
+ `last_active_timestamp` = '".date("Y-m-d H:i:s")."',
35
+ `ip` = '".$_SERVER['REMOTE_ADDR']."',
36
+ `status` = '5'
37
+
38
+ WHERE `id` = '$cid'
39
+ LIMIT 1
40
+ ";
41
+ $results = $wpdb->query($query);
42
+ return $query;
43
+
44
+
45
+
46
+ }
47
+
48
+
49
+
50
+ function wplc_record_chat_msg($from,$cid,$msg) {
51
+ global $wpdb;
52
+ global $wplc_tblname_msgs;
53
+
54
+ if ($from == "1") {
55
+ $fromname = wplc_return_chat_name($cid);
56
+ $orig = '2';
57
+ }
58
+ else {
59
+ $fromname = "admin";
60
+ $orig = '1';
61
+ }
62
+
63
+ $ins_array = array(
64
+ 'chat_sess_id' => $cid,
65
+ 'timestamp' => date("Y-m-d H:i:s"),
66
+ 'from' => $fromname,
67
+ 'msg' => $msg,
68
+ 'status' => 0,
69
+ 'originates' => $orig
70
+ );
71
+ $rows_affected = $wpdb->insert( $wplc_tblname_msgs, $ins_array );
72
+
73
+ wplc_update_active_timestamp($cid);
74
+ wplc_change_chat_status($cid,3);
75
+ return true;
76
+
77
+
78
+ }
79
+
80
+ function wplc_update_active_timestamp($cid) {
81
+ global $wpdb;
82
+ global $wplc_tblname_chats;
83
+ $results = $wpdb->get_results(
84
+ "
85
+ UPDATE $wplc_tblname_chats
86
+ SET `last_active_timestamp` = '".date("Y-m-d H:i:s")."'
87
+ WHERE `id` = '$cid'
88
+ LIMIT 1
89
+ "
90
+ );
91
+ wplc_change_chat_status($cid,3);
92
+ return true;
93
+
94
+ }
95
+
96
+ function wplc_return_chat_name($cid) {
97
+ global $wpdb;
98
+ global $wplc_tblname_chats;
99
+ $results = $wpdb->get_results(
100
+ "
101
+ SELECT *
102
+ FROM $wplc_tblname_chats
103
+ WHERE `id` = '$cid'
104
+ "
105
+ );
106
+ foreach ($results as $result) {
107
+ return $result->name;
108
+ }
109
+
110
+ }
111
+ function wplc_list_chats() {
112
+
113
+ global $wpdb;
114
+ global $wplc_tblname_chats;
115
+
116
+ $results = $wpdb->get_results(
117
+ "
118
+ SELECT *
119
+ FROM $wplc_tblname_chats
120
+ WHERE `status` = 3 OR `status` = 2
121
+ ORDER BY `timestamp` ASC
122
+
123
+ "
124
+ );
125
+ echo "
126
+
127
+
128
+ <table class=\"wp-list-table widefat fixed \" cellspacing=\"0\">
129
+ <thead>
130
+ <tr>
131
+ <th scope='col' id='wplc_id_colum' class='manage-column column-id sortable desc' style=''><span>".__("IP","wplivechat")."</span></th>
132
+ <th scope='col' id='wplc_name_colum' class='manage-column column-name_title sortable desc' style=''><span>".__("Name","wplivechat")."</span></th>
133
+ <th scope='col' id='wplc_email_colum' class='manage-column column-email' style=\"\">".__("Email","wplivechat")."</th>
134
+ <th scope='col' id='wplc_url_colum' class='manage-column column-url' style=\"\">".__("URL","wplivechat")."</th>
135
+ <th scope='col' id='wplc_status_colum' class='manage-column column-status' style=\"\">".__("Status","wplivechat")."</th>
136
+ <th scope='col' id='wplc_action_colum' class='manage-column column-action sortable desc' style=\"\"><span>".__("Action","wplivechat")."</span></th>
137
+ </tr>
138
+ </thead>
139
+ <tbody id=\"the-list\" class='list:wp_list_text_link'>
140
+ ";
141
+
142
+ if (!$results) {
143
+ echo "<tr><td></td><td>".__("No chat sessions available at the moment","wplivechat")."</td></tr>";
144
+ }
145
+ else {
146
+ foreach ($results as $result) {
147
+ unset($trstyle);
148
+ unset($actions);
149
+ $wplc_c++;
150
+
151
+ if ($result->status == 2) {
152
+ $url = admin_url( 'admin.php?page=wplivechat-menu&action=ac&cid='.$result->id);
153
+ $actions = "<a href=\"#\" onclick=\"window.open('$url', 'mywindow".$result->id."', 'location=no,status=1,scrollbars=1,width=500,height=650');return false;\">Accept Chat</a>";
154
+ $trstyle = "style='background-color:#FFFBE4; height:30px;'";
155
+ }
156
+ if ($result->status == 3) {
157
+ $url = admin_url( 'admin.php?page=wplivechat-menu&action=ac&cid='.$result->id);
158
+ $actions = "<a href=\"#\" onclick=\"window.open('$url', 'mywindow".$result->id."', 'location=no,status=1,scrollbars=1,width=500,height=650');return false;\">Open Chat Window</a>";
159
+ $trstyle = "style='background-color:#F7FCFE; height:30px;'";
160
+ }
161
+
162
+
163
+ echo "<tr id=\"record_".$result->id."\" $trstyle>";
164
+ echo "<td class='chat_id column-chat_d'>".$result->ip."</td>";
165
+ echo "<td class='chat_name column_chat_name' id='chat_name_".$result->id."'><img src=\"http://www.gravatar.com/avatar/".md5($result->email)."?s=40\" /> ".$result->name."</td>";
166
+ echo "<td class='chat_email column_chat_email' id='chat_email_".$result->id."'>".$result->email."</td>";
167
+ echo "<td class='chat_name column_chat_url' id='chat_url_".$result->id."'>".$result->url."</td>";
168
+ echo "<td class='chat_status column_chat_status' id='chat_status_".$result->id."'><strong>".wplc_return_status($result->status)."</strong></td>";if ($wplc_c>1) { $actions = wplc_get_msg(); }
169
+ echo "<td class='chat_action column-chat_action' id='chat_action_".$result->id."'>$actions</td>";
170
+ echo "</tr>";
171
+
172
+ }
173
+ }
174
+ echo "</table><br /><br />";
175
+
176
+
177
+ }
178
+
179
+
180
+
181
+
182
+ function wplc_return_user_chat_messages($cid) {
183
+ global $wpdb;
184
+ global $wplc_tblname_msgs;
185
+ $results = $wpdb->get_results(
186
+ "
187
+ SELECT *
188
+ FROM $wplc_tblname_msgs
189
+ WHERE `chat_sess_id` = '$cid' AND `status` = '0' AND `originates` = '1'
190
+ ORDER BY `timestamp` ASC
191
+
192
+ "
193
+ );
194
+ $msg_hist = "";
195
+ foreach ($results as $result) {
196
+ $id = $result->id;
197
+ $from = $result->from;
198
+
199
+ $msg = stripslashes($result->msg);
200
+ //$timestamp = strtotime($result->timestamp);
201
+ //$timeshow = date("H:i",$timestamp);
202
+ $image = "";
203
+
204
+ if(function_exists("wplc_pro_get_admin_picture")){
205
+ $src = wplc_pro_get_admin_picture();
206
+ if($src){
207
+ $image = "<img src=".$src." width='20px' id='wp-live-chat-2-img'/>";
208
+ }
209
+ }
210
+
211
+
212
+ $msg_hist .= "<span class='wplc-admin-message'>$image <strong>$from</strong>:<hr/> $msg</span><br /><div class='wplc-clear-float-message'></div>";
213
+
214
+ }
215
+
216
+ return $msg_hist;
217
+
218
+
219
+ }
220
+
221
+
222
+ function wplc_change_chat_status($id,$status) {
223
+ global $wpdb;
224
+ global $wplc_tblname_chats;
225
+ $results = $wpdb->get_results(
226
+ "
227
+ UPDATE $wplc_tblname_chats
228
+ SET `status` = '$status'
229
+ WHERE `id` = '$id'
230
+ LIMIT 1
231
+ "
232
+ );
233
+ return true;
234
+
235
+ }
236
+
237
+
238
+ function wplc_return_chat_messages($cid) {
239
+ global $wpdb;
240
+ global $wplc_tblname_msgs;
241
+ $results = $wpdb->get_results(
242
+ "
243
+ SELECT *
244
+ FROM $wplc_tblname_msgs
245
+ WHERE `chat_sess_id` = '$cid'
246
+ ORDER BY `timestamp` ASC
247
+ LIMIT 0, 100
248
+ "
249
+ );
250
+ foreach ($results as $result) {
251
+ $from = $result->from;
252
+ $msg = $result->msg;
253
+ $timestamp = strtotime($result->timestamp);
254
+ $timeshow = date("H:i:s",$timestamp);
255
+ $image = "";
256
+ if($result->originates == 1){
257
+ $class = "wplc-admin-message";
258
+ if(function_exists("wplc_pro_get_admin_picture")){
259
+ $src = wplc_pro_get_admin_picture();
260
+ if($src){
261
+ $image = "<img src=".$src." width='20px' id='wp-live-chat-2-img'/>";
262
+ }
263
+ }
264
+ } else {
265
+ $class = "wplc-user-message";
266
+ }
267
+
268
+
269
+
270
+
271
+ $msg_hist .= "<span class='$class'>$image <strong>$from</strong>:<hr/> $msg</span><br /><div class='wplc-clear-float-message'></div>";
272
+
273
+ }
274
+ return $msg_hist;
275
+
276
+
277
+ }
278
+
279
+
280
+ function wplc_mark_as_read_user_chat_messages($cid) {
281
+ global $wpdb;
282
+ global $wplc_tblname_msgs;
283
+ $results = $wpdb->get_results(
284
+ "
285
+ SELECT *
286
+ FROM $wplc_tblname_msgs
287
+ WHERE `chat_sess_id` = '$cid' AND `status` = '0' AND `originates` = '1'
288
+ ORDER BY `timestamp` DESC
289
+
290
+ "
291
+ );
292
+
293
+
294
+ foreach ($results as $result) {
295
+ $id = $result->id;
296
+ $check = $wpdb->query(
297
+ "
298
+ UPDATE $wplc_tblname_msgs
299
+ SET `status` = 1
300
+ WHERE `id` = '$id'
301
+ LIMIT 1
302
+
303
+ "
304
+ );
305
+ }
306
+ return "ok";
307
+
308
+
309
+ }
310
+
311
+ function wplc_return_admin_chat_messages($cid) {
312
+ global $wpdb;
313
+ global $wplc_tblname_msgs;
314
+ $results = $wpdb->get_results(
315
+ "
316
+ SELECT *
317
+ FROM $wplc_tblname_msgs
318
+ WHERE `chat_sess_id` = '$cid' AND `status` = '0' AND `originates` = '2'
319
+ ORDER BY `timestamp` ASC
320
+
321
+ "
322
+ );
323
+ $msg_hist = "";
324
+ foreach ($results as $result) {
325
+ $id = $result->id;
326
+ $from = $result->from;
327
+
328
+ $msg = stripslashes($result->msg);
329
+ //$timestamp = strtotime($result->timestamp);
330
+ //$timeshow = date("H:i",$timestamp);
331
+ $msg_hist .= "<strong>$from</strong>: $msg<br />";
332
+
333
+ }
334
+
335
+ return $msg_hist;
336
+
337
+
338
+ }
339
+ function wplc_mark_as_read_admin_chat_messages($cid) {
340
+ global $wpdb;
341
+ global $wplc_tblname_msgs;
342
+ $results = $wpdb->get_results(
343
+ "
344
+ SELECT *
345
+ FROM $wplc_tblname_msgs
346
+ WHERE `chat_sess_id` = '$cid' AND `status` = '0' AND `originates` = '2'
347
+ ORDER BY `timestamp` DESC
348
+
349
+ "
350
+ );
351
+
352
+
353
+ foreach ($results as $result) {
354
+ $id = $result->id;
355
+ $check = $wpdb->query(
356
+ "
357
+ UPDATE $wplc_tblname_msgs
358
+ SET `status` = 1
359
+ WHERE `id` = '$id'
360
+ LIMIT 1
361
+
362
+ "
363
+ );
364
+ }
365
+ return "ok";
366
+
367
+
368
+ }
369
+
370
+
371
+
372
+
373
+
374
+
375
+
376
+ function wplc_return_chat_status($cid) {
377
+ global $wpdb;
378
+ global $wplc_tblname_chats;
379
+ $results = $wpdb->get_results(
380
+ "
381
+ SELECT *
382
+ FROM $wplc_tblname_chats
383
+ WHERE `id` = '$cid'
384
+ "
385
+ );
386
+ foreach ($results as $result) {
387
+ return $result->status;
388
+ }
389
+ }
390
+
391
+
392
+ function wplc_return_status($status) {
393
+ if ($status == 1) {
394
+ return "complete";
395
+ }
396
+ if ($status == 2) {
397
+ return "pending";
398
+ }
399
+ if ($status == 3) {
400
+ return "active";
401
+ }
402
+ if ($status == 4) {
403
+ return "deleted";
404
+ }
405
+ if ($status == 5) {
406
+ return "browsing";
407
+ }
408
+ if ($status == 6) {
409
+ return "requesting chat";
410
+ }
411
+ }
412
+
413
+ function wplc_user_initiate_chat($name,$email,$cid = null) {
414
+ global $wpdb;
415
+ global $wplc_tblname_chats;
416
+
417
+ if (function_exists("wplc_list_chats_pro")) { /* check if functions-pro is around */
418
+ wplc_pro_notify_via_email();
419
+ }
420
+
421
+ if ($cid != null) { /* change from a visitor to a chat */
422
+ $query =
423
+ "
424
+ UPDATE $wplc_tblname_chats
425
+ SET
426
+ `status` = '2',
427
+ `timestamp` = '".date("Y-m-d H:i:s")."',
428
+ `name` = '$name',
429
+ `email` = '$email',
430
+ `ip` = '".$_SERVER['REMOTE_ADDR']."',
431
+ `url` = '".$_SERVER['HTTP_REFERER']."',
432
+ `last_active_timestamp` = '".date("Y-m-d H:i:s")."'
433
+
434
+ WHERE `id` = '$cid'
435
+ LIMIT 1
436
+ ";
437
+ $results = $wpdb->query($query);
438
+ return $cid;
439
+ }
440
+ else { // create new ID for the chat
441
+ $ins_array = array(
442
+ 'status' => '2',
443
+ 'timestamp' => date("Y-m-d H:i:s"),
444
+ 'name' => $name,
445
+ 'email' => $email,
446
+ 'ip' => $_SERVER['REMOTE_ADDR'],
447
+ 'url' => $_SERVER['HTTP_REFERER'],
448
+ 'last_active_timestamp' => date("Y-m-d H:i:s")
449
+ );
450
+ $rows_affected = $wpdb->insert( $wplc_tblname_chats, $ins_array );
451
+ $lastid = $wpdb->insert_id;
452
+ return $lastid;
453
+ }
454
+
455
+ }
456
+
457
+
458
+
459
+ function wplc_get_msg() {
460
+ return "<a href=\"http://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=morechats\" title=\"".__("Get Pro Add-on to accept more chats","wplivechat")."\" target=\"_BLANK\">Get Pro Add-on to accept more chats</a>";
461
+ }
462
+ function wplc_update_chat_statuses() {
463
+
464
+ global $wpdb;
465
+ global $wplc_tblname_chats;
466
+ $results = $wpdb->get_results(
467
+ "
468
+ SELECT *
469
+ FROM $wplc_tblname_chats
470
+ WHERE `status` = '2' OR `status` = '3' OR `status` = '5'
471
+ "
472
+ );
473
+ foreach ($results as $result) {
474
+ $id = $result->id;
475
+ $timestamp = strtotime($result->last_active_timestamp);
476
+ if ($result->status == 2) {
477
+ if ((time() - $timestamp) >= 60) { // 1 minute max
478
+ wplc_change_chat_status($id,0);
479
+ }
480
+ }
481
+ else if ($result->status == 3) {
482
+ if ((time() - $timestamp) >= 600) { // 10 minute max
483
+ wplc_change_chat_status($id,1);
484
+ }
485
+ }
486
+ else if ($result->status == 5) {
487
+ if ((time() - $timestamp) >= 120) { // 2 minute timeout
488
+ wplc_change_chat_status($id,7); // 7 - timedout
489
+ }
490
+ }
491
+ }
492
+ }
images/flash.ico CHANGED
File without changes
includes/settings_page.php CHANGED
@@ -1,241 +1,241 @@
1
-
2
- <div class="wrap">
3
- <div id="icon-edit" class="icon32 icon32-posts-post">
4
- <br>
5
- </div>
6
- <h2><?php _e("WP Live Chat Support Settings","wplivechat")?></h2>
7
- <?php
8
- $wplc_settings = get_option("WPLC_SETTINGS");
9
- if ($wplc_settings["wplc_settings_align"]) { $wplc_settings_align[intval($wplc_settings["wplc_settings_align"])] = "SELECTED"; }
10
- if ($wplc_settings["wplc_settings_enabled"]) { $wplc_settings_enabled[intval($wplc_settings["wplc_settings_enabled"])] = "SELECTED"; }
11
- if ($wplc_settings["wplc_settings_fill"]) { $wplc_settings_fill = $wplc_settings["wplc_settings_fill"]; } else { $wplc_settings_fill = "73BE28"; }
12
- if ($wplc_settings["wplc_settings_font"]) { $wplc_settings_font = $wplc_settings["wplc_settings_font"]; } else { $wplc_settings_font = "FFFFFF"; }
13
- if(get_option("WPLC_HIDE_CHAT") == true) { $wplc_hide_chat = "checked"; } else { $wplc_hide_chat = ""; };
14
- ?>
15
- <form action='' name='wplc_settings' method='POST' id='wplc_settings'>
16
-
17
- <div id="wplc_tabs">
18
- <ul>
19
- <li><a href="#tabs-1"><?php _e("General Settings","wplivechat")?></a></li>
20
- <li><a href="#tabs-2"><?php _e("Chat Box","wplivechat")?></a></li>
21
- <li><a href="#tabs-3"><?php _e("Offline Messages","wplivechat")?></a></li>
22
- <li><a href="#tabs-4"><?php _e("Styling","wplivechat")?></a></li>
23
- </ul>
24
- <div id="tabs-1">
25
- <h3><?php _e("Main Settings",'wplivechat')?></h3>
26
- <table class='form-table' width='700'>
27
- <tr>
28
- <td width='200' valign='top'><?php _e("Chat enabled","wplivechat")?>:</td>
29
- <td>
30
- <select id='wplc_settings_enabled' name='wplc_settings_enabled'>
31
- <option value="1" <?php $wplc_settings_enabled[1]?>><?php _e("Yes","wplivechat")?></option>
32
- <option value="2" <?php $wplc_settings_enabled[2]?>><?php _e("No","wplivechat")?></option>
33
- </select>
34
- </td>
35
- </tr>
36
- <tr>
37
- <td width='200' valign='top'>
38
- <?php _e("Hide Chat","wplivechat")?>:
39
- <p class="description">Hides chat for 24hrs when user clicks X</p>
40
- </td>
41
- <td valign='top'>
42
- <input type="checkbox" value="true" readonly disabled/>
43
- <small>
44
- <i>
45
- <?php _e("available in the","wplivechat")?>
46
- <a href="http://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=name" title="<?php _e("Pro Add-on","wplivechat")?>" target="_BLANK"><?php _e("Pro Add-on","wplivechat")?></a>
47
- <?php _e("only","wplivechat")?>
48
- </i>
49
- </small>
50
- </td>
51
- </tr>
52
- </table>
53
-
54
- </div>
55
- <div id="tabs-2">
56
- <h3><?php _e("Chat Window Settings",'wplivechat')?></h3>
57
- <table class='form-table' width='700'>
58
- <tr>
59
- <td width='200' valign='top'><?php _e("Chat box alignment","wplivechat")?>:</td>
60
- <td>
61
- <select id='wplc_settings_align' name='wplc_settings_align'>
62
- <option value="1" <?php $wplc_settings_align[1]?>><?php _e("Bottom left","wplivechat")?></option>
63
- <option value="2" <?php $wplc_settings_align[2]?>><?php _e("Bottom right","wplivechat")?></option>
64
- </select>
65
- </td>
66
- </tr>
67
- <tr>
68
- <!-- Chat Name-->
69
- <td width='200' valign='top'>
70
- <?php _e("Name","wplivechat")?>:
71
- </td>
72
- <td>
73
- <input type='text' size='50' maxlength='50' disabled readonly value='admin' />
74
- <small>
75
- <i>
76
- <?php _e("available in the","wplivechat")?>
77
- <a href="http://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=name" title="<?php _e("Pro Add-on","wplivechat")?>" target="_BLANK"><?php _e("Pro Add-on","wplivechat")?></a>
78
- <?php _e("only","wplivechat")?>
79
- </i>
80
- </small>
81
- </td>
82
- </tr>
83
- <!-- Chat Pic-->
84
- <tr>
85
- <td width='200' valign='top'>
86
- <?php _e("Picture","wplivechat")?>:
87
- </td>
88
- <td>
89
- <input id="wplc_pro_pic_button" type="button" value="<?php _e("Upload Image","wplivechat")?>" readonly disabled />
90
- <small>
91
- <i>
92
- <?php _e("available in the","wplivechat")?>
93
- <a href="http://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=pic" title="<?php _e("Pro Add-on","wplivechat")?>" target="_BLANK"><?php _e("Pro Add-on","wplivechat")?></a>
94
- <?php _e("only","wplivechat")?>
95
- </i>
96
- </small>
97
- </td>
98
- </tr>
99
- <!-- Chat Logo-->
100
- <tr>
101
- <td width='200' valign='top'>
102
- <?php _e("Logo","wplivechat")?>:
103
- </td>
104
- <td>
105
- <input id="wplc_pro_logo_button" type="button" value="<?php _e("Upload Image","wplivechat")?>" readonly disabled />
106
- <small>
107
- <i>
108
- <?php _e("available in the","wplivechat")?>
109
- <a href="http://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=pic" title="<?php _e("Pro Add-on","wplivechat")?>" target="_BLANK"><?php _e("Pro Add-on","wplivechat")?></a>
110
- <?php _e("only","wplivechat")?>
111
- </i>
112
- </small>
113
- </td>
114
- </tr>
115
- <!-- Chat Delay-->
116
- <tr>
117
- <td width='200' valign='top'>
118
- <?php _e("Chat delay (seconds)","wplivechat")?>:
119
- </td>
120
- <td>
121
- <input type='text' size='50' maxlength='50' disabled readonly value='10' />
122
- <small>
123
- <i>
124
- <?php _e("available in the","wplivechat")?>
125
- <a href="http://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=delay" title="<?php _e("Pro Add-on","wplivechat")?>" target="_BLANK"><?php _e("Pro Add-on","wplivechat")?></a>
126
- <?php _e("only","wplivechat")?>
127
- </i>
128
- </small>
129
- </td>
130
- </tr>
131
- <!-- Chat Notification if want to chat-->
132
- <tr>
133
- <td width='200' valign='top'>
134
- <?php _e("Chat notifications","wplivechat")?>:
135
- </td>
136
- <td>
137
- <input id='wplc_pro_chat_notification' name='wplc_pro_chat_notification' type='checkbox' value='yes' disabled="disabled" readonly/>
138
- <?php _e("Alert me via email as soon as someone wants to chat","wplivechat")?>
139
- <small>
140
- <i>
141
- <?php _e("available in the","wplivechat")?>
142
- <a href="http://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=alert" title="<?php _e("Pro Add-on","wplivechat")?>" target="_BLANK"><?php _e("Pro Add-on","wplivechat")?></a>
143
- <?php _e("only","wplivechat")?>
144
- </i>
145
- </small>
146
- </td>
147
- </tr>
148
- </table>
149
-
150
- </div>
151
- <div id="tabs-3">
152
- <h3><?php _e("Offline Messages",'wplivechat')?></h3>
153
- <table class='form-table' width='700'>
154
- <tr>
155
- <td width='200' valign='top'>
156
- <?php _e("Email Address","wplivechat")?>:
157
- </td>
158
- <td>
159
- <input type='text' size='50' maxlength='150' class='regular-text' readonly value='' />
160
- <small>
161
- <i>
162
- <?php _e("Get offline messages with the ","wplivechat")?>
163
- <a href="http://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=offlinemessages" title="<?php _e("Pro Add-on","wplivechat")?>" target="_BLANK"><?php _e("Pro Add-on","wplivechat")?></a>.
164
- </i>
165
- </small>
166
- <br />
167
- </td>
168
- </tr>
169
- <tr>
170
- <td width='200' valign='top'>
171
- <?php _e("Offline text","wplivechat")?>:
172
- </td>
173
- <td>
174
- <input type='text' size='50' maxlength='50' class='regular-text' readonly value='Chat offline. Leave a message' />
175
- <small>
176
- <i> <?php _e("Edit these text fields using the ","wplivechat")?>
177
- <a href="http://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=textfields4" title="<?php _e("Pro Add-on","wplivechat")?>" target="_BLANK"><?php _e("Pro Add-on","wplivechat")?></a>
178
- </i>
179
- </small>
180
- <br />
181
- </td>
182
- </tr>
183
-
184
- </table>
185
- </div>
186
-
187
-
188
- <div id="tabs-4">
189
- <h3><?php _e("Styling",'wplivechat')?></h3>
190
- <table class='form-table' width='700'>
191
- <tr>
192
- <td width='200' valign='top'><?php _e("Chat box fill color","wplivechat")?>:</td>
193
- <td>
194
- <input id="wplc_settings_fill" name="wplc_settings_fill" type="text" class="color" value="<?php echo $wplc_settings_fill;?>" />
195
- </td>
196
- </tr>
197
- <tr>
198
- <td width='200' valign='top'><?php _e("Chat box font color","wplivechat")?>:</td>
199
- <td>
200
- <input id="wplc_settings_font" name="wplc_settings_font" type="text" class="color" value="<?php echo $wplc_settings_font;?>" />
201
- </td>
202
- </tr>
203
- <tr style='height:30px;'><td></td><td></td></tr>
204
- <tr>
205
- <td width='200' valign='top'><?php _e("First section text","wplivechat")?>:</td>
206
- <td>
207
- <input type='text' size='50' maxlength='50' class='regular-text' readonly value='Questions?' /> <br />
208
- <input type='text' size='50' maxlength='50' class='regular-text' readonly value='Chat with us' /> <br />
209
- </td>
210
- </tr>
211
- <tr>
212
- <td width='200' valign='top'><?php _e("Second section text","wplivechat") ?>:</td>
213
- <td>
214
- <input type='text' size='50' maxlength='50' class='regular-text' readonly value='Start Chat' /> <br />
215
- <input type='text' size='50' maxlength='50' class='regular-text' readonly value='Connecting you to a sales person. Please be patient.' /> <br />
216
-
217
-
218
- </td>
219
- </tr>
220
- <tr>
221
- <td width='200' valign='top'><?php _e("Reactivate chat section text","wplivechat")?>:</td>
222
- <td>
223
- <input type='text' size='50' maxlength='50' class='regular-text' readonly value='Reactivating your previous chat...' />
224
- <small>
225
- <i>
226
- <?php _e("Edit these text fields using the ","wplivechat")?>
227
- <a href="http://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=textfields3" title="<?php _e("Pro Add-on","wplivechat")?>" target="_BLANK"><?php _e("Pro Add-on","wplivechat")?></a>.
228
- </i>
229
- </small>
230
- <br />
231
-
232
-
233
- </td>
234
- </tr>
235
- </table>
236
- </div>
237
- </div>
238
- <p class='submit'><input type='submit' name='wplc_save_settings' class='button-primary' value='<?php _e("Save Settings","wplivechat")?>' /></p>
239
- </form>
240
-
241
- </div>
1
+
2
+ <div class="wrap">
3
+ <div id="icon-edit" class="icon32 icon32-posts-post">
4
+ <br>
5
+ </div>
6
+ <h2><?php _e("WP Live Chat Support Settings","wplivechat")?></h2>
7
+ <?php
8
+ $wplc_settings = get_option("WPLC_SETTINGS");
9
+ if ($wplc_settings["wplc_settings_align"]) { $wplc_settings_align[intval($wplc_settings["wplc_settings_align"])] = "SELECTED"; }
10
+ if ($wplc_settings["wplc_settings_enabled"]) { $wplc_settings_enabled[intval($wplc_settings["wplc_settings_enabled"])] = "SELECTED"; }
11
+ if ($wplc_settings["wplc_settings_fill"]) { $wplc_settings_fill = $wplc_settings["wplc_settings_fill"]; } else { $wplc_settings_fill = "73BE28"; }
12
+ if ($wplc_settings["wplc_settings_font"]) { $wplc_settings_font = $wplc_settings["wplc_settings_font"]; } else { $wplc_settings_font = "FFFFFF"; }
13
+ if(get_option("WPLC_HIDE_CHAT") == true) { $wplc_hide_chat = "checked"; } else { $wplc_hide_chat = ""; };
14
+ ?>
15
+ <form action='' name='wplc_settings' method='POST' id='wplc_settings'>
16
+
17
+ <div id="wplc_tabs">
18
+ <ul>
19
+ <li><a href="#tabs-1"><?php _e("General Settings","wplivechat")?></a></li>
20
+ <li><a href="#tabs-2"><?php _e("Chat Box","wplivechat")?></a></li>
21
+ <li><a href="#tabs-3"><?php _e("Offline Messages","wplivechat")?></a></li>
22
+ <li><a href="#tabs-4"><?php _e("Styling","wplivechat")?></a></li>
23
+ </ul>
24
+ <div id="tabs-1">
25
+ <h3><?php _e("Main Settings",'wplivechat')?></h3>
26
+ <table class='form-table' width='700'>
27
+ <tr>
28
+ <td width='200' valign='top'><?php _e("Chat enabled","wplivechat")?>:</td>
29
+ <td>
30
+ <select id='wplc_settings_enabled' name='wplc_settings_enabled'>
31
+ <option value="1" <?php $wplc_settings_enabled[1]?>><?php _e("Yes","wplivechat")?></option>
32
+ <option value="2" <?php $wplc_settings_enabled[2]?>><?php _e("No","wplivechat")?></option>
33
+ </select>
34
+ </td>
35
+ </tr>
36
+ <tr>
37
+ <td width='200' valign='top'>
38
+ <?php _e("Hide Chat","wplivechat")?>:
39
+ <p class="description">Hides chat for 24hrs when user clicks X</p>
40
+ </td>
41
+ <td valign='top'>
42
+ <input type="checkbox" value="true" readonly disabled/>
43
+ <small>
44
+ <i>
45
+ <?php _e("available in the","wplivechat")?>
46
+ <a href="http://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=name" title="<?php _e("Pro Add-on","wplivechat")?>" target="_BLANK"><?php _e("Pro Add-on","wplivechat")?></a>
47
+ <?php _e("only","wplivechat")?>
48
+ </i>
49
+ </small>
50
+ </td>
51
+ </tr>
52
+ </table>
53
+
54
+ </div>
55
+ <div id="tabs-2">
56
+ <h3><?php _e("Chat Window Settings",'wplivechat')?></h3>
57
+ <table class='form-table' width='700'>
58
+ <tr>
59
+ <td width='200' valign='top'><?php _e("Chat box alignment","wplivechat")?>:</td>
60
+ <td>
61
+ <select id='wplc_settings_align' name='wplc_settings_align'>
62
+ <option value="1" <?php $wplc_settings_align[1]?>><?php _e("Bottom left","wplivechat")?></option>
63
+ <option value="2" <?php $wplc_settings_align[2]?>><?php _e("Bottom right","wplivechat")?></option>
64
+ </select>
65
+ </td>
66
+ </tr>
67
+ <tr>
68
+ <!-- Chat Name-->
69
+ <td width='200' valign='top'>
70
+ <?php _e("Name","wplivechat")?>:
71
+ </td>
72
+ <td>
73
+ <input type='text' size='50' maxlength='50' disabled readonly value='admin' />
74
+ <small>
75
+ <i>
76
+ <?php _e("available in the","wplivechat")?>
77
+ <a href="http://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=name" title="<?php _e("Pro Add-on","wplivechat")?>" target="_BLANK"><?php _e("Pro Add-on","wplivechat")?></a>
78
+ <?php _e("only","wplivechat")?>
79
+ </i>
80
+ </small>
81
+ </td>
82
+ </tr>
83
+ <!-- Chat Pic-->
84
+ <tr>
85
+ <td width='200' valign='top'>
86
+ <?php _e("Picture","wplivechat")?>:
87
+ </td>
88
+ <td>
89
+ <input id="wplc_pro_pic_button" type="button" value="<?php _e("Upload Image","wplivechat")?>" readonly disabled />
90
+ <small>
91
+ <i>
92
+ <?php _e("available in the","wplivechat")?>
93
+ <a href="http://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=pic" title="<?php _e("Pro Add-on","wplivechat")?>" target="_BLANK"><?php _e("Pro Add-on","wplivechat")?></a>
94
+ <?php _e("only","wplivechat")?>
95
+ </i>
96
+ </small>
97
+ </td>
98
+ </tr>
99
+ <!-- Chat Logo-->
100
+ <tr>
101
+ <td width='200' valign='top'>
102
+ <?php _e("Logo","wplivechat")?>:
103
+ </td>
104
+ <td>
105
+ <input id="wplc_pro_logo_button" type="button" value="<?php _e("Upload Image","wplivechat")?>" readonly disabled />
106
+ <small>
107
+ <i>
108
+ <?php _e("available in the","wplivechat")?>
109
+ <a href="http://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=pic" title="<?php _e("Pro Add-on","wplivechat")?>" target="_BLANK"><?php _e("Pro Add-on","wplivechat")?></a>
110
+ <?php _e("only","wplivechat")?>
111
+ </i>
112
+ </small>
113
+ </td>
114
+ </tr>
115
+ <!-- Chat Delay-->
116
+ <tr>
117
+ <td width='200' valign='top'>
118
+ <?php _e("Chat delay (seconds)","wplivechat")?>:
119
+ </td>
120
+ <td>
121
+ <input type='text' size='50' maxlength='50' disabled readonly value='10' />
122
+ <small>
123
+ <i>
124
+ <?php _e("available in the","wplivechat")?>
125
+ <a href="http://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=delay" title="<?php _e("Pro Add-on","wplivechat")?>" target="_BLANK"><?php _e("Pro Add-on","wplivechat")?></a>
126
+ <?php _e("only","wplivechat")?>
127
+ </i>
128
+ </small>
129
+ </td>
130
+ </tr>
131
+ <!-- Chat Notification if want to chat-->
132
+ <tr>
133
+ <td width='200' valign='top'>
134
+ <?php _e("Chat notifications","wplivechat")?>:
135
+ </td>
136
+ <td>
137
+ <input id='wplc_pro_chat_notification' name='wplc_pro_chat_notification' type='checkbox' value='yes' disabled="disabled" readonly/>
138
+ <?php _e("Alert me via email as soon as someone wants to chat","wplivechat")?>
139
+ <small>
140
+ <i>
141
+ <?php _e("available in the","wplivechat")?>
142
+ <a href="http://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=alert" title="<?php _e("Pro Add-on","wplivechat")?>" target="_BLANK"><?php _e("Pro Add-on","wplivechat")?></a>
143
+ <?php _e("only","wplivechat")?>
144
+ </i>
145
+ </small>
146
+ </td>
147
+ </tr>
148
+ </table>
149
+
150
+ </div>
151
+ <div id="tabs-3">
152
+ <h3><?php _e("Offline Messages",'wplivechat')?></h3>
153
+ <table class='form-table' width='700'>
154
+ <tr>
155
+ <td width='200' valign='top'>
156
+ <?php _e("Email Address","wplivechat")?>:
157
+ </td>
158
+ <td>
159
+ <input type='text' size='50' maxlength='150' class='regular-text' readonly value='' />
160
+ <small>
161
+ <i>
162
+ <?php _e("Get offline messages with the ","wplivechat")?>
163
+ <a href="http://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=offlinemessages" title="<?php _e("Pro Add-on","wplivechat")?>" target="_BLANK"><?php _e("Pro Add-on","wplivechat")?></a>.
164
+ </i>
165
+ </small>
166
+ <br />
167
+ </td>
168
+ </tr>
169
+ <tr>
170
+ <td width='200' valign='top'>
171
+ <?php _e("Offline text","wplivechat")?>:
172
+ </td>
173
+ <td>
174
+ <input type='text' size='50' maxlength='50' class='regular-text' readonly value='Chat offline. Leave a message' />
175
+ <small>
176
+ <i> <?php _e("Edit these text fields using the ","wplivechat")?>
177
+ <a href="http://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=textfields4" title="<?php _e("Pro Add-on","wplivechat")?>" target="_BLANK"><?php _e("Pro Add-on","wplivechat")?></a>
178
+ </i>
179
+ </small>
180
+ <br />
181
+ </td>
182
+ </tr>
183
+
184
+ </table>
185
+ </div>
186
+
187
+
188
+ <div id="tabs-4">
189
+ <h3><?php _e("Styling",'wplivechat')?></h3>
190
+ <table class='form-table' width='700'>
191
+ <tr>
192
+ <td width='200' valign='top'><?php _e("Chat box fill color","wplivechat")?>:</td>
193
+ <td>
194
+ <input id="wplc_settings_fill" name="wplc_settings_fill" type="text" class="color" value="<?php echo $wplc_settings_fill;?>" />
195
+ </td>
196
+ </tr>
197
+ <tr>
198
+ <td width='200' valign='top'><?php _e("Chat box font color","wplivechat")?>:</td>
199
+ <td>
200
+ <input id="wplc_settings_font" name="wplc_settings_font" type="text" class="color" value="<?php echo $wplc_settings_font;?>" />
201
+ </td>
202
+ </tr>
203
+ <tr style='height:30px;'><td></td><td></td></tr>
204
+ <tr>
205
+ <td width='200' valign='top'><?php _e("First section text","wplivechat")?>:</td>
206
+ <td>
207
+ <input type='text' size='50' maxlength='50' class='regular-text' readonly value='Questions?' /> <br />
208
+ <input type='text' size='50' maxlength='50' class='regular-text' readonly value='Chat with us' /> <br />
209
+ </td>
210
+ </tr>
211
+ <tr>
212
+ <td width='200' valign='top'><?php _e("Second section text","wplivechat") ?>:</td>
213
+ <td>
214
+ <input type='text' size='50' maxlength='50' class='regular-text' readonly value='Start Chat' /> <br />
215
+ <input type='text' size='50' maxlength='50' class='regular-text' readonly value='Connecting you to a sales person. Please be patient.' /> <br />
216
+
217
+
218
+ </td>
219
+ </tr>
220
+ <tr>
221
+ <td width='200' valign='top'><?php _e("Reactivate chat section text","wplivechat")?>:</td>
222
+ <td>
223
+ <input type='text' size='50' maxlength='50' class='regular-text' readonly value='Reactivating your previous chat...' />
224
+ <small>
225
+ <i>
226
+ <?php _e("Edit these text fields using the ","wplivechat")?>
227
+ <a href="http://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=textfields3" title="<?php _e("Pro Add-on","wplivechat")?>" target="_BLANK"><?php _e("Pro Add-on","wplivechat")?></a>.
228
+ </i>
229
+ </small>
230
+ <br />
231
+
232
+
233
+ </td>
234
+ </tr>
235
+ </table>
236
+ </div>
237
+ </div>
238
+ <p class='submit'><input type='submit' name='wplc_save_settings' class='button-primary' value='<?php _e("Save Settings","wplivechat")?>' /></p>
239
+ </form>
240
+
241
+ </div>
js/arrow.gif CHANGED
File without changes
js/cross.gif CHANGED
File without changes
js/hs.png CHANGED
File without changes
js/hv.png CHANGED
File without changes
js/jquery-cookie.js CHANGED
File without changes
js/jscolor.js CHANGED
File without changes
js/wplc_tabs.js CHANGED
File without changes
js/wplc_u.js CHANGED
@@ -7,7 +7,15 @@
7
  * 4 = Chat window - user and admin can now chat
8
  */
9
  jQuery(document).ready(function() {
10
-
 
 
 
 
 
 
 
 
11
 
12
 
13
  var wplc_user_auto_refresh = "";
@@ -51,6 +59,12 @@ jQuery(document).ready(function() {
51
 
52
  /* minimize chat window */
53
  jQuery("#wp-live-chat-minimize").on("click", function() {
 
 
 
 
 
 
54
  jQuery("#wp-live-chat-1").show();
55
  jQuery("#wp-live-chat-1").css('cursor', 'pointer');
56
  jQuery("#wp-live-chat-2").hide();
@@ -96,7 +110,8 @@ jQuery(document).ready(function() {
96
 
97
  jQuery("#wp-live-chat-1").on("click", function() {
98
  //jQuery("#wp-live-chat-1").hide();
99
- jQuery("#wp-live-chat-1").css('cursor', 'default');
 
100
  jQuery.cookie('wplc_hide', "", { expires: 1, path: '/' });
101
  jQuery("#wp-live-chat-minimize").show();
102
  jQuery("#wp-live-chat-close").show();
@@ -211,7 +226,7 @@ jQuery(document).ready(function() {
211
  wplc_name = jQuery.cookie('wplc_name');
212
  }
213
  jQuery("#wplc_chatmsg").val('');
214
- jQuery("#wplc_chatbox").append("<strong>"+wplc_name+"</strong>: "+wplc_chat+"<br />");
215
  var height = jQuery('#wplc_chatbox')[0].scrollHeight;
216
  jQuery('#wplc_chatbox').scrollTop(height);
217
 
@@ -244,7 +259,7 @@ jQuery(document).ready(function() {
244
  jQuery("#wp-live-chat-minimize").hide();
245
  document.getElementById('wplc_chatmsg').disabled = true;
246
  }
247
- console.log("wplc_update_user_chat_response "+response);
248
  });
249
 
250
 
7
  * 4 = Chat window - user and admin can now chat
8
  */
9
  jQuery(document).ready(function() {
10
+ jQuery(function() {
11
+ jQuery( "#wp-live-chat" ).draggable({
12
+ handle: "#wp-live-chat-header",
13
+ drag: function( event, ui ) {
14
+ jQuery(this).css("right","");
15
+ jQuery(this).css("bottom","inherit");
16
+ }
17
+ });
18
+ });
19
 
20
 
21
  var wplc_user_auto_refresh = "";
59
 
60
  /* minimize chat window */
61
  jQuery("#wp-live-chat-minimize").on("click", function() {
62
+ if(jQuery("#wp-live-chat").attr("original_pos") === "right"){
63
+ jQuery("#wp-live-chat").css("left ", "");
64
+ }
65
+ jQuery("#wp-live-chat").css(jQuery("#wp-live-chat").attr("original_pos"), "100px");
66
+ jQuery("#wp-live-chat").css("top", "");
67
+ jQuery("#wp-live-chat").css("bottom", "0");
68
  jQuery("#wp-live-chat-1").show();
69
  jQuery("#wp-live-chat-1").css('cursor', 'pointer');
70
  jQuery("#wp-live-chat-2").hide();
110
 
111
  jQuery("#wp-live-chat-1").on("click", function() {
112
  //jQuery("#wp-live-chat-1").hide();
113
+ jQuery("#wp-live-chat-header").css('cursor', 'all-scroll');
114
+ jQuery("#wp-live-chat-1").css('cursor', 'all-scroll');
115
  jQuery.cookie('wplc_hide', "", { expires: 1, path: '/' });
116
  jQuery("#wp-live-chat-minimize").show();
117
  jQuery("#wp-live-chat-close").show();
226
  wplc_name = jQuery.cookie('wplc_name');
227
  }
228
  jQuery("#wplc_chatmsg").val('');
229
+ jQuery("#wplc_chatbox").append("<span class='wplc-user-message'><strong>"+wplc_name+"</strong>:<hr/> "+wplc_chat+"</span><br /><div class='wplc-clear-float-message'></div>");
230
  var height = jQuery('#wplc_chatbox')[0].scrollHeight;
231
  jQuery('#wplc_chatbox').scrollTop(height);
232
 
259
  jQuery("#wp-live-chat-minimize").hide();
260
  document.getElementById('wplc_chatmsg').disabled = true;
261
  }
262
+ //console.log("wplc_update_user_chat_response "+response);
263
  });
264
 
265
 
languages/wp-live-chat-support-default.mo CHANGED
File without changes
languages/wp-live-chat-support-default.po CHANGED
File without changes
readme.txt CHANGED
@@ -1,141 +1,141 @@
1
- === WP Live Chat Support ===
2
- Contributors: WP-LiveChat
3
- Donate link: http://www.wp-livechat.com
4
- Tags: live chat, live support, chat plugin, live help, wordpress chat, customer support, chat, live chat plugin, live support plugin, live chat support plugin, chat plugin, support plugin, support, chat software, chat online, visitor chat, chat, free chat, free live chat, customer support, online support, live help, chat widget, customer help
5
- Requires at least: 3.5
6
- Tested up to: 3.8.1
7
- Stable tag: trunk
8
- License: GPLv2
9
-
10
- The most cost effective Live Chat plugin. Provide live support for free!
11
-
12
- == Description ==
13
-
14
- The most cost effective Live Chat plugin. Chat with your visitors for free! WP Live Chat Support is perfect for small businesses. No third party connections or subscriptions required. There's no need to pay for live chat monthly subscriptions in order to better understand your visitors. This is a fully functional live chat plugin. Increase your conversion rates by communicating directly with your visitors when they're ready to do so using WP Live Chat Support.
15
-
16
- = Free Version Features =
17
-
18
- â–º WP Live Chat Support is a fully functional live chat plugin
19
- â–º Initiate live chats with your visitors
20
- â–º Easy to use interface for both the admin and the visitor
21
- â–º No advertising or links
22
- â–º No "Powered by" links on the live chat window
23
- â–º No monthly live chat subscriptions needed
24
- â–º Provide live support for your site for free
25
-
26
-
27
- = Pro Version Features =
28
-
29
- â–º Initiate live chats with online visitors
30
- â–º Chat to more than one visitor at a time
31
- â–º Access historical live chat records
32
- â–º Set up your user profile
33
- â–º Add your company logo to the live chat window
34
- â–º Add your photo to the live chat window
35
- â–º Edit all text fields
36
- â–º World-class support
37
- â–º Fully customizable live chat experience
38
-
39
- Get the [WP Live Chat Support Pro Add-on](http://wp-livechat.com/purchase-pro/) for only $24.95 once off!
40
-
41
- = 5 second live chat installation =
42
-
43
- Our live chat plugin instantly gives you the ability to chat directly with potential clients and/or website visitors when they're ready to do so. Initiate a live chat with a certain visitor or wait for them to initiate a live chat with you. Increase your website conversion rates by providing real time live support.
44
-
45
- = Quick Overview =
46
-
47
- Once the live chat plugin is activated, click on "Live Chat" in the left menu navigation. As soon as a visitor lands on your website, their details will be displayed in the live chat control panel. A live chat box will be displayed on their screen. If they fill out their details and click "Start chat", a ringing sound will trigger in your live chat control panel. Once you accept the chat, you can communicate directly with your visitor.
48
-
49
-
50
- = Coming Soon to WP Live Chat Support =
51
-
52
- * Multiple live chat operators
53
- * More advanced customization and themes
54
-
55
-
56
- == Installation ==
57
-
58
- 1. Once activated, click the "Live Chat" link under your settings tabs.
59
- 2. Edit the settings to your preference.
60
- 3. Test it out in a post or page.
61
-
62
-
63
- == Frequently Asked Questions ==
64
-
65
- = I've installed the live chat plugin, now what? =
66
-
67
- Once installed and activated, a link should appear in your left navigation panel within your WP-ADMIN section. Click on the "Live Chat" link and follow the on screen instructions.
68
-
69
- = The live chat box is not showing up =
70
-
71
- Please review the live chat documentation on [our website](http://wp-livechat.com/documentation/).
72
-
73
- == Screenshots ==
74
-
75
- 1. Front-end of WP Live Chat Support
76
- 2. Back-end of WP Live Chat Support
77
- 3. Settings page of WP Live Chat Support
78
-
79
-
80
- == Upgrade Notice ==
81
-
82
- * Nothing required
83
-
84
-
85
- == Changelog ==
86
-
87
- = 2.10 =
88
- * Included a .PO file for internationalization
89
-
90
- = 2.9 =
91
- * Added comprehensive documentation
92
-
93
- = 2.8 =
94
- * Fixed bug that stopped dynamic css loading in some themes
95
-
96
- = 2.7 =
97
- * Fixed the live chat initiation bug
98
- * Fixed the style bug
99
- * Added support to email for proper smtp (pro)
100
- * Fixed cookie bugs
101
- * Add delete live chat history option (pro)
102
- * Added UTF8 character support for the live chat
103
- * Added error reporting (pro)
104
-
105
- = 2.6 =
106
- * Fixed a bug that showed 'page not found' when saving the live chat settings
107
- * Better UI
108
- * Added the ability to end live chats
109
-
110
- = 2.5 =
111
- * Major performance improvements
112
- * Small UI improvements
113
-
114
- = 2.4 =
115
- * You now have full control of the fill and font color of your live chat box
116
- * Added the ability to turn live chat on and off
117
- * Better notification of incoming live chats.
118
- * Added more localization support
119
- * Plugin should now be compatible with caching plugins.
120
-
121
- = 2.3 =
122
- * Fixed another small bug
123
-
124
- = 2.2 =
125
- * Fixed a small bug
126
-
127
- = 2.1 =
128
- * More precise functionality to handle if you are online or offline
129
- * Fixed a bug that recorded visitors when offline
130
- * Neatened up some code
131
- * Fixed some small bugs
132
-
133
- = 2.0 =
134
- * Bug fixes
135
- * Better front-end UI (Basic + Pro)
136
- * You can now get an email notification when a visitor wants to chat (Pro)
137
- * Allow your visitors to leave messages when you are offline (Pro)
138
- * More text fields can be customized
139
-
140
- = 1.0 =
141
  * Launch!
1
+ === WP Live Chat Support ===
2
+ Contributors: WP-LiveChat
3
+ Donate link: http://www.wp-livechat.com
4
+ Tags: live chat, live support, chat plugin, live help, wordpress chat, customer support, chat, live chat plugin, live support plugin, live chat support plugin
5
+ Requires at least: 3.5
6
+ Tested up to: 3.8.1
7
+ Stable tag: trunk
8
+ License: GPLv2
9
+
10
+ The most cost effective Live Chat plugin. Chat with your visitors for free!
11
+
12
+ == Description ==
13
+
14
+ The most cost effective Live Chat plugin. Chat with your visitors for free! WP Live Chat Support is perfect for small businesses. No third party connections or subscriptions required. There's no need to pay for live chat monthly subscriptions in order to better understand your visitors. This is a fully functional live chat plugin. Increase your conversion rates by communicating directly with your visitors when they're ready to do so using WP Live Chat Support.
15
+
16
+ = Free Version Features =
17
+
18
+ â–º WP Live Chat Support is a fully functional live chat plugin
19
+ â–º Initiate live chats with your visitors
20
+ â–º Easy to use interface for both the admin and the visitor
21
+ â–º No advertising or links
22
+ â–º No "Powered by" links on the live chat window
23
+ â–º No monthly live chat subscriptions needed
24
+
25
+
26
+ = Pro Version Features =
27
+
28
+ â–º Initiate live chats with online visitors
29
+ â–º Chat to more than one visitor at a time
30
+ â–º Access historical live chat records
31
+ â–º Set up your user profile
32
+ â–º Add your company logo to the live chat window
33
+ â–º Add your photo to the live chat window
34
+ â–º Edit all text fields
35
+ â–º World-class support
36
+ â–º Fully customizable live chat experience
37
+
38
+ Get the [WP Live Chat Support Pro Add-on](http://wp-livechat.com/purchase-pro/) for only $24.95 once off!
39
+
40
+ = 5 second live chat installation =
41
+
42
+ Our live chat plugin instantly gives you the ability to chat directly with potential clients and/or website visitors when they're ready to do so. Initiate a live chat with a certain visitor or wait for them to initiate a live chat with you. Increase your website conversion rates by providing real time live support.
43
+
44
+ = Quick Overview =
45
+
46
+ Once the live chat plugin is activated, click on "Live Chat" in the left menu navigation. As soon as a visitor lands on your website, their details will be displayed in the live chat control panel. A live chat box will be displayed on their screen. If they fill out their details and click "Start chat", a ringing sound will trigger in your live chat control panel. Once you accept the chat, you can communicate directly with your visitor.
47
+
48
+
49
+ = Coming Soon to WP Live Chat Support =
50
+
51
+ * Multiple live chat operators
52
+ * More advanced customization and themes
53
+
54
+
55
+ == Installation ==
56
+
57
+ 1. Once activated, click the "Live Chat" link under your settings tabs.
58
+ 2. Edit the settings to your preference.
59
+ 3. Test it out in a post or page.
60
+
61
+
62
+ == Frequently Asked Questions ==
63
+
64
+ = I've installed the live chat plugin, now what? =
65
+
66
+ Once installed and activated, a link should appear in your left navigation panel within your WP-ADMIN section. Click on the "Live Chat" link and follow the on screen instructions.
67
+
68
+ = The live chat box is not showing up =
69
+
70
+ Please review the live chat documentation on [our website](http://wp-livechat.com/documentation/).
71
+
72
+ == Screenshots ==
73
+
74
+ 1. Front-end of WP Live Chat Support
75
+ 2. Back-end of WP Live Chat Support
76
+ 3. Settings page of WP Live Chat Support
77
+
78
+
79
+ == Upgrade Notice ==
80
+
81
+ * Nothing required
82
+
83
+
84
+ == Changelog ==
85
+
86
+ = 3.0 =
87
+ * Improved chat UI
88
+ * Chat Box is draggable
89
+
90
+ = 2.9 =
91
+ * Added comprehensive documentation
92
+
93
+ = 2.8 =
94
+ * Fixed bug that stopped dynamic css loading in some themes
95
+
96
+ = 2.7 =
97
+ * Fixed the live chat initiation bug
98
+ * Fixed the style bug
99
+ * Added support to email for proper smtp (pro)
100
+ * Fixed cookie bugs
101
+ * Add delete live chat history option (pro)
102
+ * Added UTF8 character support for the live chat
103
+ * Added error reporting (pro)
104
+
105
+ = 2.6 =
106
+ * Fixed a bug that showed 'page not found' when saving the live chat settings
107
+ * Better UI
108
+ * Added the ability to end live chats
109
+
110
+ = 2.5 =
111
+ * Major performance improvements
112
+ * Small UI improvements
113
+
114
+ = 2.4 =
115
+ * You now have full control of the fill and font color of your live chat box
116
+ * Added the ability to turn live chat on and off
117
+ * Better notification of incoming live chats.
118
+ * Added more localization support
119
+ * Plugin should now be compatible with caching plugins.
120
+
121
+ = 2.3 =
122
+ * Fixed another small bug
123
+
124
+ = 2.2 =
125
+ * Fixed a small bug
126
+
127
+ = 2.1 =
128
+ * More precise functionality to handle if you are online or offline
129
+ * Fixed a bug that recorded visitors when offline
130
+ * Neatened up some code
131
+ * Fixed some small bugs
132
+
133
+ = 2.0 =
134
+ * Bug fixes
135
+ * Better front-end UI (Basic + Pro)
136
+ * You can now get an email notification when a visitor wants to chat (Pro)
137
+ * Allow your visitors to leave messages when you are offline (Pro)
138
+ * More text fields can be customized
139
+
140
+ = 1.0 =
141
  * Launch!
ring.wav CHANGED
File without changes
screenshot-1.JPG CHANGED
File without changes
screenshot-2.JPG CHANGED
File without changes
screenshot-3.JPG CHANGED
File without changes
wp-live-chat-support.php CHANGED
@@ -1,740 +1,781 @@
1
- <?php
2
- /*
3
- Plugin Name: WP Live Chat Support
4
- Plugin URI: http://www.wp-livechat.com
5
- Description: The easiest to use website live chat plugin. Let your visitors chat with you and increase sales conversion rates with WP Live Chat Support. No third party connection required!
6
- Version: 2.10
7
- Author: WP-LiveChat
8
- Author URI: http://www.wp-livechat.com
9
- */
10
-
11
- error_reporting(E_ERROR);
12
- global $wplc_version;
13
- global $wplc_p_version;
14
- global $wplc_tblname;
15
- global $wpdb;
16
- global $wplc_tblname_chats;
17
- global $wplc_tblname_msgs;
18
- $wplc_tblname_chats = $wpdb->prefix . "wplc_chat_sessions";
19
- $wplc_tblname_msgs = $wpdb->prefix . "wplc_chat_msgs";
20
- $wplc_version = "2.10";
21
-
22
- require_once (plugin_dir_path( __FILE__ )."functions.php");
23
- add_action('wp_ajax_wplc_admin_set_transient', 'wplc_action_callback');
24
-
25
- add_action('wp_footer', 'wplc_display_box');
26
-
27
-
28
- if (function_exists('wplc_head_pro')) {
29
- add_action('admin_head', 'wplc_head_pro');
30
- } else {
31
- add_action('admin_head', 'wplc_head_basic');
32
- }
33
-
34
-
35
- add_action('wp_enqueue_scripts', 'wplc_add_user_stylesheet' );
36
- add_action('admin_enqueue_scripts', 'wplc_add_admin_stylesheet');
37
-
38
- if(function_exists('wplc_admin_menu_pro')){
39
- add_action('admin_menu', 'wplc_admin_menu_pro');
40
- } else {
41
- add_action('admin_menu', 'wplc_admin_menu');
42
- }
43
- add_action('admin_head', 'wplc_superadmin_javascript');
44
- register_activation_hook( __FILE__, 'wplc_activate' );
45
-
46
-
47
-
48
-
49
- function wplc_action_callback() {
50
- global $wpdb;
51
- global $wplc_tblname_chats;
52
- $check = check_ajax_referer( 'wplc', 'security' );
53
-
54
- if ($check == 1) {
55
-
56
- if ($_POST['action'] == "wplc_admin_set_transient") {
57
- set_transient("wplc_is_admin_logged_in", "1", 70 );
58
-
59
- }
60
- }
61
-
62
- die(); // this is required to return a proper result
63
-
64
- }
65
-
66
-
67
-
68
-
69
- function wplc_admin_menu() {
70
- $wplc_mainpage = add_menu_page('WP Live Chat', __('Live Chat','wplivechat'), 'read', 'wplivechat-menu', 'wplc_admin_menu_layout');
71
- add_submenu_page('wplivechat-menu', __('Settings','wplivechat'), __('Settings','wplivechat'), 'manage_options' , 'wplivechat-menu-settings', 'wplc_admin_settings_layout');
72
- add_submenu_page('wplivechat-menu', __('History','wplivechat'), __('History','wplivechat'), 'manage_options' , 'wplivechat-menu-history', 'wplc_admin_history_layout');
73
-
74
- }
75
- add_action('wp_head','wplc_user_top_js');
76
- function wplc_user_top_js() {
77
- echo "<!-- DEFINING DO NOT CACHE -->";
78
- define('DONOTCACHEPAGE', true);
79
- define('DONOTCACHEDB', true);
80
- $ajax_nonce = wp_create_nonce("wplc");
81
- wp_register_script( 'wplc-user-jquery-cookie', plugins_url('/js/jquery-cookie.js', __FILE__) );
82
- wp_enqueue_script( 'wplc-user-jquery-cookie' );
83
- $wplc_settings = get_option("WPLC_SETTINGS");
84
-
85
- ?>
86
- <script type="text/javascript">
87
- <?php if (!function_exists("wplc_register_pro_version")) { ?>
88
- var wplc_ajaxurl = '<?php echo plugins_url('/ajax.php', __FILE__); ?>';
89
- <?php } ?>
90
- var wplc_nonce = '<?php echo $ajax_nonce; ?>';
91
- </script>
92
- <?php
93
-
94
- $hide_chat = get_option('WPLC_HIDE_CHAT');
95
- if($hide_chat == true){
96
- $hide_chat = "yes";
97
- } else {
98
- $hide_chat = '';
99
- }
100
- ?>
101
- <script>
102
- var hide_chat = "<?php echo $hide_chat; ?>";
103
- </script>
104
- <?php
105
- }
106
-
107
- function wplc_draw_user_box() {
108
- $wplc_settings = get_option("WPLC_SETTINGS");
109
- if ($wplc_settings["wplc_settings_enabled"] == 2) { return; }
110
-
111
- wp_register_script( 'wplc-user-script', plugins_url('/js/wplc_u.js', __FILE__) );
112
- wp_enqueue_script( 'wplc-user-script' );
113
- wplc_output_box();
114
-
115
- }
116
- function wplc_output_box() {
117
-
118
-
119
- $wplc_settings = get_option("WPLC_SETTINGS");
120
- if ($wplc_settings["wplc_settings_enabled"] == 2) { return; }
121
-
122
- if ($wplc_settings["wplc_settings_align"] == 1) { $wplc_box_align = "left:100px;"; } else { $wplc_box_align = "right:100px;"; }
123
- if ($wplc_settings["wplc_settings_fill"]) { $wplc_settings_fill = "#".$wplc_settings["wplc_settings_fill"]; } else { $wplc_settings_fill = "#73BE28"; }
124
- if ($wplc_settings["wplc_settings_font"]) { $wplc_settings_font = "#".$wplc_settings["wplc_settings_font"]; } else { $wplc_settings_font = "#FFFFFF"; }
125
-
126
- $wplc_is_admin_logged_in = get_transient("wplc_is_admin_logged_in");
127
- if (!function_exists("wplc_register_pro_version") && $wplc_is_admin_logged_in != 1) {
128
- return "";
129
- }
130
-
131
- ?>
132
- <div id="wp-live-chat" style="display:none; <?php echo $wplc_box_align; ?>;">
133
-
134
-
135
- <?php if (function_exists("wplc_register_pro_version")) {
136
- wplc_pro_output_box();
137
- } else {
138
- ?>
139
-
140
- <div id="wp-live-chat-minimize" style="display:none; background-color: <?php echo $wplc_settings_font; ?> !important; color: <?php echo $wplc_settings_fill; ?> !important;"></div>
141
- <div id="wp-live-chat-close" style="display:none; background-color: <?php echo $wplc_settings_fill; ?> !important; color: <?php echo $wplc_settings_font; ?> !important;">X</div>
142
- <div id="wp-live-chat-1" style="background-color: <?php echo $wplc_settings_fill; ?> !important; color: <?php echo $wplc_settings_font; ?> !important;">
143
- <strong>Questions?</strong> Chat with us
144
- </div>
145
- <div id="wp-live-chat-2" style="display:none;">
146
- <table>
147
- <tr>
148
- <td></td>
149
- <td><strong>Start Live Chat</strong></td>
150
- </tr>
151
- <tr>
152
- <td><?php _e("Name","wplivechat"); ?></td>
153
- <td><input type="text" name="wplc_name" id="wplc_name" value="" /></td>
154
- </tr>
155
- <tr>
156
- <td><?php _e("Email","wplivechat"); ?></td>
157
- <td><input type="text" name="wplc_email" id="wplc_email" value="" /></td>
158
- </tr>
159
- <tr>
160
- <td></td>
161
- <td><input id="wplc_start_chat_btn" type="button" value="Start Chat" /></td>
162
- </tr>
163
- </table>
164
- </div>
165
- <div id="wp-live-chat-3" style="display:none;">
166
- <p>Connecting you to a sales person. Please be patient.</p>
167
- </div>
168
- <div id="wp-live-chat-react" style="display:none;">
169
- <p>Reactivating your previous chat...</p>
170
- </div>
171
- <div id="wp-live-chat-4" style="display:none;">
172
- <div id="wplc_chatbox"></div>
173
- <p style="text-align:center; font-size:11px;">Press ENTER to send your message</p>
174
- <p>
175
- <input type="text" name="wplc_chatmsg" id="wplc_chatmsg" value="" />
176
- <input type="hidden" name="wplc_cid" id="wplc_cid" value="" />
177
- <input id="wplc_send_msg" type="button" value="<?php _e("Send","wplc"); ?>" style="display:none;" /></p>
178
- </div>
179
-
180
- </div>
181
- <?php
182
- }
183
- }
184
-
185
- function wplc_display_box() {
186
- $wplc_is_admin_logged_in = get_transient("wplc_is_admin_logged_in");
187
- if ($wplc_is_admin_logged_in != 1) { echo "<!-- wplc a-n-c -->"; }
188
- if (function_exists("wplc_register_pro_version")) { wplc_pro_draw_user_box(); } else { wplc_draw_user_box(); }
189
- }
190
-
191
-
192
-
193
- function wplc_admin_display_chat($cid) {
194
- global $wpdb;
195
- global $wplc_tblname_msgs;
196
- $results = $wpdb->get_results(
197
- "
198
- SELECT *
199
- FROM $wplc_tblname_msgs
200
- WHERE `chat_sess_id` = '$cid'
201
- ORDER BY `timestamp` DESC
202
- LIMIT 0, 100
203
- "
204
- );
205
- foreach ($results as $result) {
206
- $from = $result->from;
207
- $msg = stripslashes($result->msg);
208
- $msg_hist .= "$from: $msg<br />";
209
-
210
- }
211
- echo $msg_hist;
212
- }
213
- function wplc_admin_accept_chat($cid) {
214
- wplc_change_chat_status($cid,3);
215
- return true;
216
-
217
- }
218
- add_action('admin_head','wplc_update_chat_statuses');
219
-
220
-
221
- function wplc_superadmin_javascript() {
222
-
223
- if (isset($_GET['page']) && $_GET['page'] == 'wplivechat-menu') {
224
-
225
- if (!isset($_GET['action'])) {
226
- if (function_exists("wplc_register_pro_version")) {
227
- wplc_pro_admin_javascript();
228
- } else {
229
- wplc_admin_javascript();
230
- }
231
-
232
- } // main page
233
- else if (isset($_GET['action'])) {
234
- if (function_exists("wplc_register_pro_version")) {
235
- wplc_return_pro_admin_chat_javascript($_GET['cid']);
236
- } else {
237
- wplc_return_admin_chat_javascript($_GET['cid']);
238
- }
239
-
240
- }
241
-
242
-
243
-
244
- }
245
-
246
- $ajax_nonce = wp_create_nonce("wplc");
247
- ?>
248
- <script type="text/javascript">
249
- jQuery(document).ready(function() {
250
-
251
-
252
- var wplc_set_transient = null;
253
-
254
- wplc_set_transient = setInterval(function (){wpcl_admin_set_transient();}, 60000);
255
- wpcl_admin_set_transient();
256
- function wpcl_admin_set_transient() {
257
- var data = {
258
- action: 'wplc_admin_set_transient',
259
- security: '<?php echo $ajax_nonce; ?>'
260
- };
261
- jQuery.post(ajaxurl, data, function(response) {
262
- //console.log("wplc_admin_set_transient");
263
- });
264
- }
265
-
266
-
267
-
268
-
269
-
270
- });
271
-
272
-
273
-
274
- </script>
275
- <?php
276
- }
277
- function wplc_admin_javascript() {
278
- $ajax_nonce = wp_create_nonce("wplc");
279
- ?>
280
- <script type="text/javascript">
281
- jQuery(document).ready(function() {
282
- var wplc_ajaxurl = '<?php echo plugins_url('/ajax.php', __FILE__); ?>';
283
- var wplc_autoLoad = null;
284
- var wplc_refresh_chat_area = null;
285
- var wplc_refresh_status = null;
286
-
287
-
288
-
289
-
290
- wplc_refresh_chat_area = setInterval(function (){wpcl_admin_update_chats();}, 4000);
291
- function wpcl_admin_update_chats(cid) {
292
- var data = {
293
- action: 'wplc_update_admin_chat',
294
- security: '<?php echo $ajax_nonce; ?>'
295
- };
296
- jQuery.post(wplc_ajaxurl, data, function(response) {
297
- //console.log("wplc_update_admin_chat");
298
- jQuery("#wplc_admin_chat_area").html(response);
299
- if (response.indexOf("pending") >= 0) {
300
- var orig_title = document.getElementsByTagName("title")[0].innerHTML;
301
- document.title = "** CHAT REQUEST **";
302
- wplc_title_alerts1 = setTimeout(function (){ document.title = "__ CHAT Request __"; }, 1000);
303
- wplc_title_alerts2 = setTimeout(function (){ document.title = "** CHAT REQUEST **"; }, 1500);
304
- wplc_title_alerts3 = setTimeout(function (){ document.title = "__ CHAT Request __"; }, 2000);
305
- wplc_title_alerts4 = setTimeout(function (){ document.title = orig_title; }, 2500);
306
-
307
- document.getElementById("wplc_sound").innerHTML="<embed src='<?php echo plugins_url('/ring.wav', __FILE__); ?>' hidden=true autostart=true loop=false>";
308
- }
309
-
310
-
311
- });
312
- }
313
-
314
- wplc_refresh_status = setInterval(function (){wplc_update_statuses();}, 10000);
315
- function wplc_update_statuses() {
316
- var data = {
317
- action: 'wplc_update_admin_status',
318
- security: '<?php echo $ajax_nonce; ?>'
319
- };
320
- jQuery.post(wplc_ajaxurl, data, function(response) {
321
- //console.log("wplc_update_admin_status");
322
- //alert(response);
323
- });
324
- };
325
-
326
-
327
- });
328
-
329
-
330
-
331
- </script>
332
- <?php
333
- }
334
-
335
-
336
-
337
- function wplc_admin_menu_layout() {
338
- if (function_exists("wplc_register_pro_version")) {
339
- global $wplc_pro_version;
340
- if ($wplc_pro_version < 2.3) {
341
- ?>
342
- <div class='error below-h1'>
343
-
344
- <p>Dear Pro User<br /></p>
345
- <p>You are using an outdated version of WP Live Chat Support Pro. Please <a href="<?php echo get_option('siteurl'); ?>/wp-admin/update-core.php\" target=\"_BLANK\">update to at least version 2.3</a> to ensure all functionality is in working order.</p>
346
- <p>&nbsp;</p>
347
- <p>If you are having difficulty updating the plugin, please contact nick@wp-livechat.com</p>
348
-
349
- </div>
350
- <?php
351
- }
352
-
353
-
354
- }
355
- if (function_exists("wplc_register_pro_version")) {
356
- wplc_pro_admin_menu_layout_display();
357
- } else {
358
- wplc_admin_menu_layout_display();
359
- }
360
-
361
- }
362
-
363
- function wplc_admin_menu_layout_display() {
364
- if (!isset($_GET['action'])) {
365
-
366
- ?>
367
- <div style='float:right; display:block; width:450px; padding:10px; text-align:center; background-color: #EEE; border: 1px solid #E6DB55; margin:10px;'>
368
- <strong>Experiencing problems with the plugin?</strong>
369
- <br />
370
- <a href='http://wp-livechat.com/documentation/' title='WP Live Chat Support Documentation' target='_BLANK'>Review the documentation.</a>
371
- Or ask a question on our <a href='http://wp-livechat.com/forums/forum/support/' title='WP Live Chat Support Forum' target='_BLANK'>Support forum.</a>
372
- </div>
373
-
374
- <h1>Live Chat</h1>
375
- <div id="wplc_sound"></div>
376
-
377
-
378
-
379
-
380
- <div id="wplc_admin_chat_area">
381
-
382
- <?php if (function_exists("wplc_register_pro_version")) { wplc_list_chats_pro(); } else { wplc_list_chats(); } ?>
383
- </div>
384
- <h1>Online Visitors</h1>
385
- <p><?php _e("With the Pro add-on of WP Live Chat Support, you can","wplivechat"); ?> <a href="http://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=initiate1" title="<?php _e("see who's online and initiate chats","wplivechat"); ?>" target=\"_BLANK\"><?php _e("see who's online and initiate chats","wplivechat"); ?></a> <?php _e("with your online visitors with the click of a button.","wplivechat"); ?> <a href="http://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=initiate2" title="<?php _e("Buy the Pro add-on now for only $24.95 once off. Free Updates FOREVER.","wplivechat"); ?>" target=\"_BLANK\"><strong><?php _e("Buy the Pro add-on now for only $24.95 once off. Free Updates Forever.","wplivechat"); ?></strong></a></p>
386
- <?php
387
- }
388
- else {
389
-
390
- if ($_GET['action'] == 'ac') {
391
- wplc_change_chat_status($_GET['cid'],3);
392
- if (function_exists("wplc_register_pro_version")) { wplc_pro_draw_chat_area($_GET['cid']); } else { wplc_draw_chat_area($_GET['cid']); }
393
- }
394
- }
395
- }
396
-
397
- function wplc_draw_chat_area($cid) {
398
-
399
- global $wpdb;
400
- global $wplc_tblname_chats;
401
- $results = $wpdb->get_results(
402
- "
403
- SELECT *
404
- FROM $wplc_tblname_chats
405
- WHERE `id` = '$cid'
406
- LIMIT 1
407
- "
408
- );
409
-
410
-
411
- foreach ($results as $result) {
412
- if ($result->status == 1) { $status = "Previous"; } else { $status = "Active"; }
413
-
414
- echo "<h2>$status Chat with ".$result->name."</h2>";
415
- echo "<style>#adminmenuwrap { display:none; } #adminmenuback { display:none; } #wpadminbar { display:none; } #wpfooter { display:none; } .update-nag { display:none; }</style>";
416
- echo "<div style='display:block;'>";
417
- echo "<div style='float:left; width:100px;'><img src=\"http://www.gravatar.com/avatar/".md5($result->email)."\" /></div>";
418
- echo "<div id=\"wplc_sound_update\"></div>";
419
- echo "<div style='float:left; width:350px;'>";
420
- echo "<table>";
421
- echo "<tr><td>Email address</td><td><a href='mailto:".$result->email."' title='".$result->email."'>".$result->email."</a></td></tr>";
422
- echo "<tr><td>IP Address</td><td><a href='http://www.ip-adress.com/ip_tracer/".$result->ip."' title='Whois for ".$result->ip."'>".$result->ip."</a></td></tr>";
423
- echo "<tr><td>From URL</td><td>".$result->url. " (<a href='".$result->url."' target='_BLANK'>open</a>)"."</td></tr>";
424
- echo "<tr><td>Date</td><td>".$result->timestamp."</td></tr>";
425
- echo "</table><br />";
426
- echo "</div>";
427
- echo "</div>";
428
-
429
- echo "
430
- <p style=\"display:block; width:290px; text-align:right; font-size:10px;\"><a href=\"javascript:void(0);\" class=\"wplc_admin_close_chat\" id=\"wplc_admin_close_chat\">".__("End chat","wplivechat")."</a></p>
431
- <div id='admin_chat_box'>
432
- <div id='admin_chat_box_area_".$result->id."' style='height:200px; width:290px; border:1px solid #ccc; overflow:auto;'>".wplc_return_chat_messages($cid)."</div>
433
- <p>
434
- ";
435
- if ($result->status != 1) {
436
- echo "
437
- <p style=\"text-align:left; font-size:11px;\">Press ENTER to send your message</p>
438
- <input type='text' name='wplc_admin_chatmsg' id='wplc_admin_chatmsg' value='' style=\"border:1px solid #666; width:290px;\" />
439
- <input id='wplc_admin_cid' type='hidden' value='".$_GET['cid']."' />
440
- <input id='wplc_admin_send_msg' type='button' value='".__("Send","wplc")."' style=\"display:none;\" />
441
- </p>
442
- </div>
443
- ";
444
- //echo wplc_return_admin_chat_javascript($_GET['cid']);
445
- }
446
-
447
- }
448
- }
449
-
450
- function wplc_return_admin_chat_javascript($cid) {
451
- $ajax_nonce = wp_create_nonce("wplc");
452
- ?>
453
- <script type="text/javascript">
454
- jQuery(document).ready(function() {
455
-
456
-
457
- var wplc_ajaxurl = '<?php echo plugins_url('/ajax.php', __FILE__); ?>';
458
- var wplc_nonce = '<?php echo $ajax_nonce; ?>';
459
- var wplc_gcid = '<?php echo $cid; ?>';
460
-
461
- if (jQuery('#wplc_admin_cid').length){
462
- var wplc_cid = jQuery("#wplc_admin_cid").val();
463
- var height = jQuery('#admin_chat_box_area_'+wplc_cid)[0].scrollHeight;
464
- jQuery('#admin_chat_box_area_'+wplc_cid).scrollTop(height);
465
- }
466
-
467
- jQuery(".wplc_admin_accept").live("click", function() {
468
- var cid = jQuery(this).attr("cid");
469
-
470
- var data = {
471
- action: 'wplc_admin_accept_chat',
472
- cid: cid,
473
- security: wplc_nonce
474
- };
475
- jQuery.post(wplc_ajaxurl, data, function(response) {
476
- //console.log("wplc_admin_accept_chat");
477
- wplc_refresh_chat_boxes[cid] = setInterval(function (){wpcl_admin_update_chat_box(cid);}, 3000);
478
- jQuery("#admin_chat_box_"+cid).show();
479
- });
480
- });
481
-
482
- jQuery("#wplc_admin_chatmsg").keyup(function(event){
483
- if(event.keyCode == 13){
484
- jQuery("#wplc_admin_send_msg").click();
485
- }
486
- });
487
- jQuery("#wplc_admin_close_chat").live("click", function() {
488
- var wplc_cid = jQuery("#wplc_admin_cid").val();
489
- var data = {
490
- action: 'wplc_admin_close_chat',
491
- security: '<?php echo $ajax_nonce; ?>',
492
- cid: wplc_cid
493
-
494
- };
495
- jQuery.post(wplc_ajaxurl, data, function(response) {
496
- //console.log("wplc_admin_close_chat");
497
- //console.log(response);
498
- window.close();
499
- });
500
-
501
- });
502
-
503
- jQuery("#wplc_admin_send_msg").live("click", function() {
504
- var wplc_cid = jQuery("#wplc_admin_cid").val();
505
- var wplc_chat = jQuery("#wplc_admin_chatmsg").val();
506
- var wplc_name = "a"+"d"+"m"+"i"+"n";
507
- jQuery("#wplc_admin_chatmsg").val('');
508
-
509
-
510
- jQuery("#admin_chat_box_area_"+wplc_cid).append("<strong>"+wplc_name+"</strong>: "+wplc_chat+"<br />");
511
- var height = jQuery('#admin_chat_box_area_'+wplc_cid)[0].scrollHeight;
512
- jQuery('#admin_chat_box_area_'+wplc_cid).scrollTop(height);
513
-
514
-
515
- var data = {
516
- action: 'wplc_admin_send_msg',
517
- security: wplc_nonce,
518
- cid: wplc_cid,
519
- msg: wplc_chat
520
- };
521
- jQuery.post(wplc_ajaxurl, data, function(response) {
522
- //console.log("wplc_admin_send_msg");
523
-
524
- });
525
-
526
-
527
- });
528
-
529
-
530
- wplc_auto_refresh = setInterval(function (){wpcl_admin_auto_update_chat_box(wplc_gcid);}, 3500);
531
- function wpcl_admin_auto_update_chat_box(cid) {
532
- current_len = jQuery("#admin_chat_box_area_"+cid).html().length;
533
-
534
-
535
- var data = {
536
- action: 'wplc_update_admin_chat_boxes',
537
- cid: cid,
538
- security: wplc_nonce
539
- };
540
- jQuery.post(wplc_ajaxurl, data, function(response) {
541
- //console.log("wplc_update_admin_chat_boxes");
542
- //jQuery("#admin_chat_box_area_"+cid).html(response);
543
- jQuery("#admin_chat_box_area_"+cid).append(response);
544
- new_length = jQuery("#admin_chat_box_area_"+cid).html().length;
545
- if (current_len < new_length) {
546
- document.getElementById("wplc_sound_update").innerHTML="<embed src='<?php echo plugins_url('/ding.mp3', __FILE__); ?>' hidden=true autostart=true loop=false>";
547
- }
548
-
549
- var height = jQuery('#admin_chat_box_area_'+cid)[0].scrollHeight;
550
- jQuery('#admin_chat_box_area_'+cid).scrollTop(height);
551
- });
552
-
553
- }
554
-
555
-
556
-
557
- wplc_auto_check_status_of_chat = setInterval(function (){wpcl_admin_auto_check_status_of_chat(<?php echo $cid; ?>);}, 5000);
558
- var chat_status = 3;
559
- function wpcl_admin_auto_check_status_of_chat(cid) {
560
-
561
- var data = {
562
- action: 'wplc_update_admin_return_chat_status',
563
- cid: <?php echo $cid; ?>,
564
- security: '<?php echo $ajax_nonce; ?>'
565
- };
566
- jQuery.post(wplc_ajaxurl, data, function(response) {
567
- //console.log("wplc_update_admin_return_chat_status");
568
- if (response == "0") { } else {
569
- if (chat_status != response) {
570
- previous_chat_status = chat_status;
571
- console.log("previous chat status: "+previous_chat_status)
572
- chat_status = response;
573
- //console.log("chat status: "+chat_status)
574
- if (chat_status == "2") {
575
- //clearInterval(wplc_auto_check_status_of_chat);
576
- //clearInterval(wplc_auto_refresh);
577
- jQuery("#admin_chat_box_area_"+cid).append("<em><?php _e("User has minimized the chat window","wplivechat"); ?></em><br />");
578
- var height = jQuery('#admin_chat_box_area_'+cid)[0].scrollHeight;
579
- jQuery('#admin_chat_box_area_'+cid).scrollTop(height);
580
-
581
- }
582
- else if (previous_chat_status == "2" && chat_status == "3") {
583
- jQuery("#admin_chat_box_area_"+cid).append("<em><?php _e("User has opened the chat window","wplivechat"); ?></em><br />");
584
- var height = jQuery('#admin_chat_box_area_'+cid)[0].scrollHeight;
585
- jQuery('#admin_chat_box_area_'+cid).scrollTop(height);
586
- }
587
- else if (chat_status == "1") {
588
- //clearInterval(wplc_auto_check_status_of_chat);
589
- //clearInterval(wplc_auto_refresh);
590
- jQuery("#admin_chat_box_area_"+cid).append("<em><?php _e("User has closed and ended the chat","wplivechat"); ?></em><br />");
591
- var height = jQuery('#admin_chat_box_area_'+cid)[0].scrollHeight;
592
- jQuery('#admin_chat_box_area_'+cid).scrollTop(height);
593
- clearInterval(wplc_auto_check_status_of_chat);
594
- clearInterval(wplc_auto_refresh);
595
- document.getElementById('wplc_admin_chatmsg').disabled = true;
596
-
597
-
598
- }
599
-
600
- }
601
- }
602
-
603
- });
604
-
605
- }
606
-
607
-
608
-
609
- });
610
- </script>
611
- <?php
612
- }
613
- function wplc_activate() {
614
- wplc_handle_db();
615
- if (!get_option("WPLC_SETTINGS")) {
616
- add_option('WPLC_SETTINGS',array("wplc_settings_align" => "2", "wplc_settings_enabled" => "1", "wplc_settings_fill" => "73BE28", "wplc_settings_font" => "FFFFFF"));
617
- }
618
- add_option("WPLC_HIDE_CHAT","true");
619
- }
620
-
621
-
622
- function wplc_handle_db() {
623
- global $wpdb;
624
- global $wplc_version;
625
- global $wplc_tblname_chats;
626
- global $wplc_tblname_msgs;
627
-
628
- $sql = "
629
- CREATE TABLE `".$wplc_tblname_chats."` (
630
- `id` int(11) NOT NULL AUTO_INCREMENT,
631
- `timestamp` datetime NOT NULL,
632
- `name` varchar(700) NOT NULL,
633
- `email` varchar(700) NOT NULL,
634
- `ip` varchar(700) NOT NULL,
635
- `status` int(11) NOT NULL,
636
- `url` varchar(700) NOT NULL,
637
- `last_active_timestamp` datetime NOT NULL,
638
- PRIMARY KEY (`id`)
639
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
640
- ";
641
-
642
- require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
643
- dbDelta($sql);
644
-
645
- $sql = "
646
- CREATE TABLE `".$wplc_tblname_msgs."` (
647
- `id` int(11) NOT NULL AUTO_INCREMENT,
648
- `chat_sess_id` int(11) NOT NULL,
649
- `from` varchar(150) CHARACTER SET utf8 NOT NULL,
650
- `msg` varchar(700) CHARACTER SET utf8 NOT NULL,
651
- `timestamp` datetime NOT NULL,
652
- `status` INT(3) NOT NULL,
653
- `originates` INT(3) NOT NULL,
654
- PRIMARY KEY (`id`)
655
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
656
- ";
657
-
658
- require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
659
- dbDelta($sql);
660
- add_option("wplc_db_version", $wplc_version);
661
- update_option("wplc_db_version",$wplc_version);
662
- }
663
-
664
- function wplc_add_user_stylesheet() {
665
- wp_register_style( 'wplc-style', plugins_url('/css/wplcstyle.css', __FILE__) );
666
- wp_enqueue_style( 'wplc-style' );
667
-
668
- }
669
- function wplc_add_admin_stylesheet() {
670
- wp_register_style( 'wplc-admin-style', 'http://code.jquery.com/ui/1.8.24/themes/smoothness/jquery-ui.css' );
671
- wp_enqueue_style( 'wplc-admin-style' );
672
-
673
- }
674
-
675
- if (isset($_GET['page']) && $_GET['page'] == 'wplivechat-menu-settings') {
676
- add_action('admin_print_scripts', 'wplc_admin_scripts_basic');
677
- }
678
- function wplc_admin_scripts_basic() {
679
-
680
- if ($_GET['page'] == "wplivechat-menu-settings") {
681
- wp_enqueue_script( 'jquery' );
682
- wp_enqueue_script('jquery-ui-core');
683
-
684
- wp_register_script('my-wplc-color', plugins_url('js/jscolor.js',__FILE__), false, '1.4.1', false);
685
- wp_enqueue_script('my-wplc-color');
686
- wp_enqueue_script( 'jquery-ui-tabs');
687
- wp_register_script('my-wplc-tabs', plugins_url('js/wplc_tabs.js',__FILE__), array('jquery-ui-core'), '', true);
688
- wp_enqueue_script('my-wplc-tabs');
689
- }
690
- }
691
-
692
-
693
- function wplc_admin_settings_layout() {
694
- wplc_settings_page_basic();
695
- }
696
- function wplc_admin_history_layout() {
697
- echo"<div class=\"wrap\"><div id=\"icon-edit\" class=\"icon32 icon32-posts-post\"><br></div><h2>".__("WP Live Chat History","wplivechat")."</h2>";
698
- if (function_exists("wplc_register_pro_version")) {
699
- wplc_pro_admin_display_history();
700
- }
701
- else {
702
- echo "<br /><br >This option is only available in the <a href=\"http://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=history1\" title=\"".__("Pro Add-on","wplivechat")."\" target=\"_BLANK\">Pro Add-on</a> of WP Live Chat. <a href=\"http://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=history2\" title=\"".__("Pro Add-on","wplivechat")."\" target=\"_BLANK\">Get it now for only $24.95 once off!</a>";
703
- }
704
- }
705
-
706
-
707
- function wplc_settings_page_basic() {
708
- if(function_exists("wplc_register_pro_version")){
709
- wplc_settings_page_pro();
710
- } else {
711
- include 'includes/settings_page.php';
712
- }
713
- }
714
- function wplc_head_basic() {
715
- global $wpdb;
716
-
717
- if (isset($_POST['wplc_save_settings'])){
718
-
719
- $wplc_data['wplc_settings_align'] = esc_attr($_POST['wplc_settings_align']);
720
- $wplc_data['wplc_settings_fill'] = esc_attr($_POST['wplc_settings_fill']);
721
- $wplc_data['wplc_settings_font'] = esc_attr($_POST['wplc_settings_font']);
722
- $wplc_data['wplc_settings_enabled'] = esc_attr($_POST['wplc_settings_enabled']);
723
- update_option('WPLC_SETTINGS', $wplc_data);
724
- update_option("WPLC_HIDE_CHAT", $_POST['wplc_hide_chat']);
725
- echo "<div class='updated'>";
726
- _e("Your settings have been saved.","wplivechat");
727
- echo "</div>";
728
-
729
-
730
- }
731
-
732
- }
733
-
734
- function wplc_logout() {
735
- delete_transient('wplc_is_admin_logged_in');
736
- }
737
- add_action('wp_logout', 'wplc_logout');
738
-
739
-
740
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Plugin Name: WP Live Chat Support
4
+ Plugin URI: http://www.wp-livechat.com
5
+ Description: The easiest to use website live chat plugin. Let your visitors chat with you and increase sales conversion rates with WP Live Chat Support. No third party connection required!
6
+ Version: 3.0
7
+ Author: WP-LiveChat
8
+ Author URI: http://www.wp-livechat.com
9
+ */
10
+
11
+ error_reporting(E_ERROR);
12
+ global $wplc_version;
13
+ global $wplc_p_version;
14
+ global $wplc_tblname;
15
+ global $wpdb;
16
+ global $wplc_tblname_chats;
17
+ global $wplc_tblname_msgs;
18
+ $wplc_tblname_chats = $wpdb->prefix . "wplc_chat_sessions";
19
+ $wplc_tblname_msgs = $wpdb->prefix . "wplc_chat_msgs";
20
+ $wplc_version = "3.0";
21
+
22
+ require_once (plugin_dir_path( __FILE__ )."functions.php");
23
+ add_action('wp_ajax_wplc_admin_set_transient', 'wplc_action_callback');
24
+
25
+ add_action('wp_footer', 'wplc_display_box');
26
+
27
+
28
+ if (function_exists('wplc_head_pro')) {
29
+ add_action('admin_head', 'wplc_head_pro');
30
+ } else {
31
+ add_action('admin_head', 'wplc_head_basic');
32
+ }
33
+
34
+
35
+ add_action('wp_enqueue_scripts', 'wplc_add_user_stylesheet' );
36
+ add_action('admin_enqueue_scripts', 'wplc_add_admin_stylesheet');
37
+
38
+ if(function_exists('wplc_admin_menu_pro')){
39
+ add_action('admin_menu', 'wplc_admin_menu_pro');
40
+ } else {
41
+ add_action('admin_menu', 'wplc_admin_menu');
42
+ }
43
+ add_action('admin_head', 'wplc_superadmin_javascript');
44
+ register_activation_hook( __FILE__, 'wplc_activate' );
45
+
46
+
47
+
48
+
49
+ function wplc_action_callback() {
50
+ global $wpdb;
51
+ global $wplc_tblname_chats;
52
+ $check = check_ajax_referer( 'wplc', 'security' );
53
+
54
+ if ($check == 1) {
55
+
56
+ if ($_POST['action'] == "wplc_admin_set_transient") {
57
+ set_transient("wplc_is_admin_logged_in", "1", 70 );
58
+
59
+ }
60
+ }
61
+
62
+ die(); // this is required to return a proper result
63
+
64
+ }
65
+
66
+
67
+
68
+
69
+ function wplc_admin_menu() {
70
+ $wplc_mainpage = add_menu_page('WP Live Chat', __('Live Chat','wplivechat'), 'manage_options', 'wplivechat-menu', 'wplc_admin_menu_layout');
71
+ add_submenu_page('wplivechat-menu', __('Settings','wplivechat'), __('Settings','wplivechat'), 'manage_options' , 'wplivechat-menu-settings', 'wplc_admin_settings_layout');
72
+ add_submenu_page('wplivechat-menu', __('History','wplivechat'), __('History','wplivechat'), 'manage_options' , 'wplivechat-menu-history', 'wplc_admin_history_layout');
73
+
74
+ }
75
+ add_action('wp_head','wplc_user_top_js');
76
+ function wplc_user_top_js() {
77
+ echo "<!-- DEFINING DO NOT CACHE -->";
78
+ define('DONOTCACHEPAGE', true);
79
+ define('DONOTCACHEDB', true);
80
+ $ajax_nonce = wp_create_nonce("wplc");
81
+ wp_register_script( 'wplc-user-jquery-cookie', plugins_url('/js/jquery-cookie.js', __FILE__) );
82
+ wp_enqueue_script( 'wplc-user-jquery-cookie' );
83
+ $wplc_settings = get_option("WPLC_SETTINGS");
84
+
85
+ ?>
86
+ <script type="text/javascript">
87
+ <?php if (!function_exists("wplc_register_pro_version")) { ?>
88
+ var wplc_ajaxurl = '<?php echo plugins_url('/ajax.php', __FILE__); ?>';
89
+ <?php } ?>
90
+ var wplc_nonce = '<?php echo $ajax_nonce; ?>';
91
+ </script>
92
+ <?php
93
+
94
+ $hide_chat = get_option('WPLC_HIDE_CHAT');
95
+ if($hide_chat == true){
96
+ $hide_chat = "yes";
97
+ } else {
98
+ $hide_chat = '';
99
+ }
100
+ ?>
101
+ <script>
102
+ var hide_chat = "<?php echo $hide_chat; ?>";
103
+ </script>
104
+ <?php
105
+ }
106
+
107
+ function wplc_draw_user_box() {
108
+ $wplc_settings = get_option("WPLC_SETTINGS");
109
+ if ($wplc_settings["wplc_settings_enabled"] == 2) { return; }
110
+
111
+ wp_register_script( 'wplc-user-script', plugins_url('/js/wplc_u.js', __FILE__) );
112
+ wp_enqueue_script( 'wplc-user-script' );
113
+ wp_enqueue_script( 'jquery' );
114
+ wp_enqueue_script( 'jquery-ui-core' );
115
+ wp_enqueue_script( 'jquery-ui-draggable');
116
+ wplc_output_box();
117
+
118
+ }
119
+ function wplc_output_box() {
120
+
121
+
122
+ $wplc_settings = get_option("WPLC_SETTINGS");
123
+ if ($wplc_settings["wplc_settings_enabled"] == 2) { return; }
124
+
125
+ if ($wplc_settings["wplc_settings_align"] == 1) { $wplc_box_align = "left:100px;"; } else { $wplc_box_align = "right:100px;"; }
126
+ if ($wplc_settings["wplc_settings_fill"]) { $wplc_settings_fill = "#".$wplc_settings["wplc_settings_fill"]; } else { $wplc_settings_fill = "#73BE28"; }
127
+ if ($wplc_settings["wplc_settings_font"]) { $wplc_settings_font = "#".$wplc_settings["wplc_settings_font"]; } else { $wplc_settings_font = "#FFFFFF"; }
128
+
129
+ $wplc_is_admin_logged_in = get_transient("wplc_is_admin_logged_in");
130
+ if (!function_exists("wplc_register_pro_version") && $wplc_is_admin_logged_in != 1) {
131
+ return "";
132
+ }
133
+ if($wplc_settings["wplc_settings_align"] == 1){
134
+ $original_pos = "left";
135
+ } else {
136
+ $original_pos = "right";
137
+ }
138
+
139
+ ?>
140
+ <div id="wp-live-chat" style="display:none; <?php echo $wplc_box_align; ?>;" original_pos="<?php echo $original_pos ?>">
141
+
142
+
143
+ <?php if (function_exists("wplc_register_pro_version")) {
144
+ wplc_pro_output_box();
145
+ } else {
146
+ ?>
147
+ <div id="wp-live-chat-header" style="background-color: <?php echo $wplc_settings_fill; ?> !important; color: <?php echo $wplc_settings_font; ?> !important;">
148
+
149
+ <div id="wp-live-chat-minimize" style="display:none;"><i class="fa fa-minus" ></i></div>
150
+ <div id="wp-live-chat-close" style="display:none;"><i class="fa fa-times" ></i></div>
151
+
152
+ <div id="wp-live-chat-1" >
153
+ <div style="display:block; ">
154
+ <strong>Questions?</strong> Chat with us
155
+ </div>
156
+ </div>
157
+ </div>
158
+ <div id="wp-live-chat-2" style="display:none;">
159
+
160
+ <div id="wp-live-chat-2-info">
161
+ <strong>Start Live Chat</strong>
162
+ </div>
163
+
164
+ <input type="text" name="wplc_name" id="wplc_name" value="" placeholder="<?php _e("Name","wplivechat"); ?>"/>
165
+
166
+ <input type="text" name="wplc_email" id="wplc_email" value="" placeholder="<?php _e("Email","wplivechat"); ?>"/>
167
+
168
+ <input id="wplc_start_chat_btn" type="button" value="Start Chat" style="background-color: <?php echo $wplc_settings_fill; ?> !important; color: <?php echo $wplc_settings_font; ?> !important;"/>
169
+
170
+
171
+
172
+ </div>
173
+
174
+ <div id="wp-live-chat-3" style="display:none;">
175
+ <p>Connecting you to a sales person. Please be patient.</p>
176
+ </div>
177
+ <div id="wp-live-chat-react" style="display:none;">
178
+ <p>Reactivating your previous chat...</p>
179
+ </div>
180
+ <div id="wp-live-chat-4" style="display:none;">
181
+ <div id="wplc_chatbox"></div>
182
+ <p style="text-align:center; font-size:11px;">Press ENTER to send your message</p>
183
+ <p>
184
+ <input type="text" name="wplc_chatmsg" id="wplc_chatmsg" value="" />
185
+ <input type="hidden" name="wplc_cid" id="wplc_cid" value="" />
186
+ <input id="wplc_send_msg" type="button" value="<?php _e("Send","wplc"); ?>" style="display:none;" /></p>
187
+ </div>
188
+
189
+ </div>
190
+ <?php
191
+ }
192
+ }
193
+
194
+ function wplc_display_box() {
195
+ $wplc_is_admin_logged_in = get_transient("wplc_is_admin_logged_in");
196
+ if ($wplc_is_admin_logged_in != 1) { echo "<!-- wplc a-n-c -->"; }
197
+ if (function_exists("wplc_register_pro_version")) { wplc_pro_draw_user_box(); } else { wplc_draw_user_box(); }
198
+ }
199
+
200
+
201
+
202
+ function wplc_admin_display_chat($cid) {
203
+ global $wpdb;
204
+ global $wplc_tblname_msgs;
205
+ $results = $wpdb->get_results(
206
+ "
207
+ SELECT *
208
+ FROM $wplc_tblname_msgs
209
+ WHERE `chat_sess_id` = '$cid'
210
+ ORDER BY `timestamp` DESC
211
+ LIMIT 0, 100
212
+ "
213
+ );
214
+ foreach ($results as $result) {
215
+ $from = $result->from;
216
+ $msg = stripslashes($result->msg);
217
+ $msg_hist .= "$from: $msg<br />";
218
+
219
+ }
220
+ echo $msg_hist;
221
+ }
222
+ function wplc_admin_accept_chat($cid) {
223
+ wplc_change_chat_status($cid,3);
224
+ return true;
225
+
226
+ }
227
+ add_action('admin_head','wplc_update_chat_statuses');
228
+
229
+
230
+ function wplc_superadmin_javascript() {
231
+
232
+ if (isset($_GET['page']) && $_GET['page'] == 'wplivechat-menu') {
233
+
234
+ if (!isset($_GET['action'])) {
235
+ if (function_exists("wplc_register_pro_version")) {
236
+ wplc_pro_admin_javascript();
237
+ } else {
238
+ wplc_admin_javascript();
239
+ }
240
+
241
+ } // main page
242
+ else if (isset($_GET['action'])) {
243
+ if (function_exists("wplc_register_pro_version")) {
244
+ wplc_return_pro_admin_chat_javascript($_GET['cid']);
245
+ } else {
246
+ wplc_return_admin_chat_javascript($_GET['cid']);
247
+ }
248
+
249
+ }
250
+
251
+
252
+
253
+ }
254
+
255
+ $ajax_nonce = wp_create_nonce("wplc");
256
+ ?>
257
+ <script type="text/javascript">
258
+ jQuery(document).ready(function() {
259
+
260
+
261
+ var wplc_set_transient = null;
262
+
263
+ wplc_set_transient = setInterval(function (){wpcl_admin_set_transient();}, 60000);
264
+ wpcl_admin_set_transient();
265
+ function wpcl_admin_set_transient() {
266
+ var data = {
267
+ action: 'wplc_admin_set_transient',
268
+ security: '<?php echo $ajax_nonce; ?>'
269
+ };
270
+ jQuery.post(ajaxurl, data, function(response) {
271
+ //console.log("wplc_admin_set_transient");
272
+ });
273
+ }
274
+
275
+
276
+
277
+
278
+
279
+ });
280
+
281
+
282
+
283
+ </script>
284
+ <?php
285
+ }
286
+ function wplc_admin_javascript() {
287
+ $ajax_nonce = wp_create_nonce("wplc");
288
+ ?>
289
+ <script type="text/javascript">
290
+ jQuery(document).ready(function() {
291
+ var wplc_ajaxurl = '<?php echo plugins_url('/ajax.php', __FILE__); ?>';
292
+ var wplc_autoLoad = null;
293
+ var wplc_refresh_chat_area = null;
294
+ var wplc_refresh_status = null;
295
+
296
+
297
+
298
+
299
+ wplc_refresh_chat_area = setInterval(function (){wpcl_admin_update_chats();}, 4000);
300
+ function wpcl_admin_update_chats(cid) {
301
+ var data = {
302
+ action: 'wplc_update_admin_chat',
303
+ security: '<?php echo $ajax_nonce; ?>'
304
+ };
305
+ jQuery.post(wplc_ajaxurl, data, function(response) {
306
+ //console.log("wplc_update_admin_chat");
307
+ jQuery("#wplc_admin_chat_area").html(response);
308
+ if (response.indexOf("pending") >= 0) {
309
+ var orig_title = document.getElementsByTagName("title")[0].innerHTML;
310
+ document.title = "** CHAT REQUEST **";
311
+ wplc_title_alerts1 = setTimeout(function (){ document.title = "__ CHAT Request __"; }, 1000);
312
+ wplc_title_alerts2 = setTimeout(function (){ document.title = "** CHAT REQUEST **"; }, 1500);
313
+ wplc_title_alerts3 = setTimeout(function (){ document.title = "__ CHAT Request __"; }, 2000);
314
+ wplc_title_alerts4 = setTimeout(function (){ document.title = orig_title; }, 2500);
315
+
316
+ document.getElementById("wplc_sound").innerHTML="<embed src='<?php echo plugins_url('/ring.wav', __FILE__); ?>' hidden=true autostart=true loop=false>";
317
+ }
318
+
319
+
320
+ });
321
+ }
322
+
323
+ wplc_refresh_status = setInterval(function (){wplc_update_statuses();}, 10000);
324
+ function wplc_update_statuses() {
325
+ var data = {
326
+ action: 'wplc_update_admin_status',
327
+ security: '<?php echo $ajax_nonce; ?>'
328
+ };
329
+ jQuery.post(wplc_ajaxurl, data, function(response) {
330
+ //console.log("wplc_update_admin_status");
331
+ //alert(response);
332
+ });
333
+ };
334
+
335
+
336
+ });
337
+
338
+
339
+
340
+ </script>
341
+ <?php
342
+ }
343
+
344
+
345
+
346
+ function wplc_admin_menu_layout() {
347
+ if (function_exists("wplc_register_pro_version")) {
348
+ global $wplc_pro_version;
349
+ if ($wplc_pro_version < 3.0) {
350
+ ?>
351
+ <div class='error below-h1'>
352
+
353
+ <p>Dear Pro User<br /></p>
354
+ <p>You are using an outdated version of WP Live Chat Support Pro. Please <a href="http://wp-livechat.com/get-updated-version/" target=\"_BLANK\">update to at least version 3.0</a> to ensure all functionality is in working order.</p>
355
+ <p>&nbsp;</p>
356
+ <p>If you are having difficulty updating the plugin, please contact nick@wp-livechat.com</p>
357
+
358
+ </div>
359
+ <?php
360
+ }
361
+
362
+
363
+ }
364
+ if (function_exists("wplc_register_pro_version")) {
365
+ wplc_pro_admin_menu_layout_display();
366
+ } else {
367
+ wplc_admin_menu_layout_display();
368
+ }
369
+
370
+ }
371
+
372
+ function wplc_admin_menu_layout_display() {
373
+ if (!isset($_GET['action'])) {
374
+
375
+ ?>
376
+ <div style='float:right; display:block; width:450px; padding:10px; text-align:center; background-color: #EEE; border: 1px solid #E6DB55; margin:10px;'>
377
+ <strong>Experiencing problems with the plugin?</strong>
378
+ <br />
379
+ <a href='http://wp-livechat.com/documentation/' title='WP Live Chat Support Documentation' target='_BLANK'>Review the documentation.</a>
380
+ Or ask a question on our <a href='http://wp-livechat.com/forums/forum/support/' title='WP Live Chat Support Forum' target='_BLANK'>Support forum.</a>
381
+ </div>
382
+
383
+ <h1>Live Chat</h1>
384
+ <div id="wplc_sound"></div>
385
+
386
+
387
+
388
+
389
+ <div id="wplc_admin_chat_area">
390
+
391
+ <?php if (function_exists("wplc_register_pro_version")) { wplc_list_chats_pro(); } else { wplc_list_chats(); } ?>
392
+ </div>
393
+ <h1>Online Visitors</h1>
394
+ <p><?php _e("With the Pro add-on of WP Live Chat Support, you can","wplivechat"); ?> <a href="http://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=initiate1" title="<?php _e("see who's online and initiate chats","wplivechat"); ?>" target=\"_BLANK\"><?php _e("see who's online and initiate chats","wplivechat"); ?></a> <?php _e("with your online visitors with the click of a button.","wplivechat"); ?> <a href="http://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=initiate2" title="<?php _e("Buy the Pro add-on now for only $24.95 once off. Free Updates FOREVER.","wplivechat"); ?>" target=\"_BLANK\"><strong><?php _e("Buy the Pro add-on now for only $24.95 once off. Free Updates Forever.","wplivechat"); ?></strong></a></p>
395
+ <?php
396
+ }
397
+ else {
398
+
399
+ if ($_GET['action'] == 'ac') {
400
+ wplc_change_chat_status($_GET['cid'],3);
401
+ if (function_exists("wplc_register_pro_version")) { wplc_pro_draw_chat_area($_GET['cid']); } else { wplc_draw_chat_area($_GET['cid']); }
402
+ }
403
+ }
404
+ }
405
+
406
+ function wplc_draw_chat_area($cid) {
407
+
408
+ global $wpdb;
409
+ global $wplc_tblname_chats;
410
+ $results = $wpdb->get_results(
411
+ "
412
+ SELECT *
413
+ FROM $wplc_tblname_chats
414
+ WHERE `id` = '$cid'
415
+ LIMIT 1
416
+ "
417
+ );?>
418
+ <style>
419
+ .wplc-user-message{
420
+ display: inline-block;
421
+ padding: 5px;
422
+ -webkit-box-shadow: 0px 0px 5px 0px rgba(50, 50, 50, 0.5);
423
+ -moz-box-shadow: 0px 0px 5px 0px rgba(50, 50, 50, 0.5);
424
+ box-shadow: 0px 0px 5px 0px rgba(50, 50, 50, 0.5);
425
+ border-radius: 5px;
426
+ float: left;
427
+ margin-bottom: 5px;
428
+ }
429
+ .wplc-user-message hr , .wplc-admin-message hr{
430
+ margin:0;
431
+ }
432
+ .wplc-clear-float-message{
433
+ clear: both;
434
+ }
435
+
436
+ .wplc-admin-message{
437
+ display: inline-block;
438
+ padding: 5px;
439
+ -webkit-box-shadow: 0px 0px 5px 0px rgba(50, 50, 50, 0.5);
440
+ -moz-box-shadow: 0px 0px 5px 0px rgba(50, 50, 50, 0.5);
441
+ box-shadow: 0px 0px 5px 0px rgba(50, 50, 50, 0.5);
442
+ border-radius: 5px;
443
+ float: right;
444
+ margin-bottom: 5px;
445
+ }
446
+ </style>
447
+ <?php
448
+
449
+
450
+ foreach ($results as $result) {
451
+ if ($result->status == 1) { $status = "Previous"; } else { $status = "Active"; }
452
+
453
+ echo "<h2>$status Chat with ".$result->name."</h2>";
454
+ echo "<style>#adminmenuwrap { display:none; } #adminmenuback { display:none; } #wpadminbar { display:none; } #wpfooter { display:none; } .update-nag { display:none; }</style>";
455
+ echo "<div style='display:block;'>";
456
+ echo "<div style='float:left; width:100px;'><img src=\"http://www.gravatar.com/avatar/".md5($result->email)."\" /></div>";
457
+ echo "<div id=\"wplc_sound_update\"></div>";
458
+ echo "<div style='float:left; width:350px;'>";
459
+ echo "<table>";
460
+ echo "<tr><td>Email address</td><td><a href='mailto:".$result->email."' title='".$result->email."'>".$result->email."</a></td></tr>";
461
+ echo "<tr><td>IP Address</td><td><a href='http://www.ip-adress.com/ip_tracer/".$result->ip."' title='Whois for ".$result->ip."'>".$result->ip."</a></td></tr>";
462
+ echo "<tr><td>From URL</td><td>".$result->url. " (<a href='".$result->url."' target='_BLANK'>open</a>)"."</td></tr>";
463
+ echo "<tr><td>Date</td><td>".$result->timestamp."</td></tr>";
464
+ echo "</table><br />";
465
+ echo "</div>";
466
+ echo "</div>";
467
+
468
+ echo "
469
+ <p style=\"display:block; width:290px; text-align:right; font-size:10px;\"><a href=\"javascript:void(0);\" class=\"wplc_admin_close_chat\" id=\"wplc_admin_close_chat\">".__("End chat","wplivechat")."</a></p>
470
+ <div id='admin_chat_box'>
471
+ <div id='admin_chat_box_area_".$result->id."' style='height:200px; width:290px; border:1px solid #ccc; overflow:auto; padding: 5px;'>".wplc_return_chat_messages($cid)."</div>
472
+ <p>
473
+ ";
474
+ if ($result->status != 1) {
475
+ echo "
476
+ <p style=\"text-align:left; font-size:11px;\">Press ENTER to send your message</p>
477
+ <input type='text' name='wplc_admin_chatmsg' id='wplc_admin_chatmsg' value='' style=\"border:1px solid #666; width:290px;\" />
478
+ <input id='wplc_admin_cid' type='hidden' value='".$_GET['cid']."' />
479
+ <input id='wplc_admin_send_msg' type='button' value='".__("Send","wplc")."' style=\"display:none;\" />
480
+ </p>
481
+ </div>
482
+ ";
483
+ //echo wplc_return_admin_chat_javascript($_GET['cid']);
484
+ }
485
+
486
+ }
487
+ }
488
+
489
+ function wplc_return_admin_chat_javascript($cid) {
490
+ $ajax_nonce = wp_create_nonce("wplc");
491
+ ?>
492
+ <script type="text/javascript">
493
+ jQuery(document).ready(function() {
494
+
495
+
496
+ var wplc_ajaxurl = '<?php echo plugins_url('/ajax.php', __FILE__); ?>';
497
+ var wplc_nonce = '<?php echo $ajax_nonce; ?>';
498
+ var wplc_gcid = '<?php echo $cid; ?>';
499
+
500
+ if (jQuery('#wplc_admin_cid').length){
501
+ var wplc_cid = jQuery("#wplc_admin_cid").val();
502
+ var height = jQuery('#admin_chat_box_area_'+wplc_cid)[0].scrollHeight;
503
+ jQuery('#admin_chat_box_area_'+wplc_cid).scrollTop(height);
504
+ }
505
+
506
+ jQuery(".wplc_admin_accept").live("click", function() {
507
+ var cid = jQuery(this).attr("cid");
508
+
509
+ var data = {
510
+ action: 'wplc_admin_accept_chat',
511
+ cid: cid,
512
+ security: wplc_nonce
513
+ };
514
+ jQuery.post(wplc_ajaxurl, data, function(response) {
515
+ //console.log("wplc_admin_accept_chat");
516
+ wplc_refresh_chat_boxes[cid] = setInterval(function (){wpcl_admin_update_chat_box(cid);}, 3000);
517
+ jQuery("#admin_chat_box_"+cid).show();
518
+ });
519
+ });
520
+
521
+ jQuery("#wplc_admin_chatmsg").keyup(function(event){
522
+ if(event.keyCode == 13){
523
+ jQuery("#wplc_admin_send_msg").click();
524
+ }
525
+ });
526
+ jQuery("#wplc_admin_close_chat").live("click", function() {
527
+ var wplc_cid = jQuery("#wplc_admin_cid").val();
528
+ var data = {
529
+ action: 'wplc_admin_close_chat',
530
+ security: '<?php echo $ajax_nonce; ?>',
531
+ cid: wplc_cid
532
+
533
+ };
534
+ jQuery.post(wplc_ajaxurl, data, function(response) {
535
+ //console.log("wplc_admin_close_chat");
536
+ //console.log(response);
537
+ window.close();
538
+ });
539
+
540
+ });
541
+
542
+ jQuery("#wplc_admin_send_msg").live("click", function() {
543
+ var wplc_cid = jQuery("#wplc_admin_cid").val();
544
+ var wplc_chat = jQuery("#wplc_admin_chatmsg").val();
545
+ var wplc_name = "a"+"d"+"m"+"i"+"n";
546
+ jQuery("#wplc_admin_chatmsg").val('');
547
+
548
+
549
+ jQuery("#admin_chat_box_area_"+wplc_cid).append("<strong>"+wplc_name+"</strong>: "+wplc_chat+"<br />");
550
+ var height = jQuery('#admin_chat_box_area_'+wplc_cid)[0].scrollHeight;
551
+ jQuery('#admin_chat_box_area_'+wplc_cid).scrollTop(height);
552
+
553
+
554
+ var data = {
555
+ action: 'wplc_admin_send_msg',
556
+ security: wplc_nonce,
557
+ cid: wplc_cid,
558
+ msg: wplc_chat
559
+ };
560
+ jQuery.post(wplc_ajaxurl, data, function(response) {
561
+ //console.log("wplc_admin_send_msg");
562
+
563
+ });
564
+
565
+
566
+ });
567
+
568
+
569
+ wplc_auto_refresh = setInterval(function (){wpcl_admin_auto_update_chat_box(wplc_gcid);}, 3500);
570
+ function wpcl_admin_auto_update_chat_box(cid) {
571
+ current_len = jQuery("#admin_chat_box_area_"+cid).html().length;
572
+
573
+
574
+ var data = {
575
+ action: 'wplc_update_admin_chat_boxes',
576
+ cid: cid,
577
+ security: wplc_nonce
578
+ };
579
+ jQuery.post(wplc_ajaxurl, data, function(response) {
580
+ //console.log("wplc_update_admin_chat_boxes");
581
+ //jQuery("#admin_chat_box_area_"+cid).html(response);
582
+ jQuery("#admin_chat_box_area_"+cid).append(response);
583
+ new_length = jQuery("#admin_chat_box_area_"+cid).html().length;
584
+ if (current_len < new_length) {
585
+ document.getElementById("wplc_sound_update").innerHTML="<embed src='<?php echo plugins_url('/ding.mp3', __FILE__); ?>' hidden=true autostart=true loop=false>";
586
+ }
587
+
588
+ var height = jQuery('#admin_chat_box_area_'+cid)[0].scrollHeight;
589
+ jQuery('#admin_chat_box_area_'+cid).scrollTop(height);
590
+ });
591
+
592
+ }
593
+
594
+
595
+
596
+ wplc_auto_check_status_of_chat = setInterval(function (){wpcl_admin_auto_check_status_of_chat(<?php echo $cid; ?>);}, 5000);
597
+ var chat_status = 3;
598
+ function wpcl_admin_auto_check_status_of_chat(cid) {
599
+
600
+ var data = {
601
+ action: 'wplc_update_admin_return_chat_status',
602
+ cid: <?php echo $cid; ?>,
603
+ security: '<?php echo $ajax_nonce; ?>'
604
+ };
605
+ jQuery.post(wplc_ajaxurl, data, function(response) {
606
+ //console.log("wplc_update_admin_return_chat_status");
607
+ if (response == "0") { } else {
608
+ if (chat_status != response) {
609
+ previous_chat_status = chat_status;
610
+ console.log("previous chat status: "+previous_chat_status)
611
+ chat_status = response;
612
+ //console.log("chat status: "+chat_status)
613
+ if (chat_status == "2") {
614
+ //clearInterval(wplc_auto_check_status_of_chat);
615
+ //clearInterval(wplc_auto_refresh);
616
+ jQuery("#admin_chat_box_area_"+cid).append("<em><?php _e("User has minimized the chat window","wplivechat"); ?></em><br />");
617
+ var height = jQuery('#admin_chat_box_area_'+cid)[0].scrollHeight;
618
+ jQuery('#admin_chat_box_area_'+cid).scrollTop(height);
619
+
620
+ }
621
+ else if (previous_chat_status == "2" && chat_status == "3") {
622
+ jQuery("#admin_chat_box_area_"+cid).append("<em><?php _e("User has opened the chat window","wplivechat"); ?></em><br />");
623
+ var height = jQuery('#admin_chat_box_area_'+cid)[0].scrollHeight;
624
+ jQuery('#admin_chat_box_area_'+cid).scrollTop(height);
625
+ }
626
+ else if (chat_status == "1") {
627
+ //clearInterval(wplc_auto_check_status_of_chat);
628
+ //clearInterval(wplc_auto_refresh);
629
+ jQuery("#admin_chat_box_area_"+cid).append("<em><?php _e("User has closed and ended the chat","wplivechat"); ?></em><br />");
630
+ var height = jQuery('#admin_chat_box_area_'+cid)[0].scrollHeight;
631
+ jQuery('#admin_chat_box_area_'+cid).scrollTop(height);
632
+ clearInterval(wplc_auto_check_status_of_chat);
633
+ clearInterval(wplc_auto_refresh);
634
+ document.getElementById('wplc_admin_chatmsg').disabled = true;
635
+
636
+
637
+ }
638
+
639
+ }
640
+ }
641
+
642
+ });
643
+
644
+ }
645
+
646
+
647
+
648
+ });
649
+ </script>
650
+ <?php
651
+ }
652
+ function wplc_activate() {
653
+ wplc_handle_db();
654
+ if (!get_option("WPLC_SETTINGS")) {
655
+ add_option('WPLC_SETTINGS',array("wplc_settings_align" => "2", "wplc_settings_enabled" => "1", "wplc_settings_fill" => "73BE28", "wplc_settings_font" => "FFFFFF"));
656
+ }
657
+ add_option("WPLC_HIDE_CHAT","true");
658
+ }
659
+
660
+
661
+ function wplc_handle_db() {
662
+ global $wpdb;
663
+ global $wplc_version;
664
+ global $wplc_tblname_chats;
665
+ global $wplc_tblname_msgs;
666
+
667
+ $sql = "
668
+ CREATE TABLE `".$wplc_tblname_chats."` (
669
+ `id` int(11) NOT NULL AUTO_INCREMENT,
670
+ `timestamp` datetime NOT NULL,
671
+ `name` varchar(700) NOT NULL,
672
+ `email` varchar(700) NOT NULL,
673
+ `ip` varchar(700) NOT NULL,
674
+ `status` int(11) NOT NULL,
675
+ `url` varchar(700) NOT NULL,
676
+ `last_active_timestamp` datetime NOT NULL,
677
+ PRIMARY KEY (`id`)
678
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
679
+ ";
680
+
681
+ require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
682
+ dbDelta($sql);
683
+
684
+ $sql = "
685
+ CREATE TABLE `".$wplc_tblname_msgs."` (
686
+ `id` int(11) NOT NULL AUTO_INCREMENT,
687
+ `chat_sess_id` int(11) NOT NULL,
688
+ `from` varchar(150) CHARACTER SET utf8 NOT NULL,
689
+ `msg` varchar(700) CHARACTER SET utf8 NOT NULL,
690
+ `timestamp` datetime NOT NULL,
691
+ `status` INT(3) NOT NULL,
692
+ `originates` INT(3) NOT NULL,
693
+ PRIMARY KEY (`id`)
694
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
695
+ ";
696
+
697
+ require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
698
+ dbDelta($sql);
699
+ add_option("wplc_db_version", $wplc_version);
700
+ update_option("wplc_db_version",$wplc_version);
701
+ }
702
+
703
+ function wplc_add_user_stylesheet() {
704
+ wp_register_style( 'wplc-font-awesome', plugins_url('/css/font-awesome.min.css', __FILE__) );
705
+ wp_enqueue_style( 'wplc-font-awesome' );
706
+ wp_register_style( 'wplc-style', plugins_url('/css/wplcstyle.css', __FILE__) );
707
+ wp_enqueue_style( 'wplc-style' );
708
+
709
+ }
710
+ function wplc_add_admin_stylesheet() {
711
+ wp_register_style( 'wplc-admin-style', 'http://code.jquery.com/ui/1.8.24/themes/smoothness/jquery-ui.css' );
712
+ wp_enqueue_style( 'wplc-admin-style' );
713
+
714
+ }
715
+
716
+ if (isset($_GET['page']) && $_GET['page'] == 'wplivechat-menu-settings') {
717
+ add_action('admin_print_scripts', 'wplc_admin_scripts_basic');
718
+ }
719
+ function wplc_admin_scripts_basic() {
720
+
721
+ if ($_GET['page'] == "wplivechat-menu-settings") {
722
+ wp_enqueue_script( 'jquery' );
723
+ wp_enqueue_script('jquery-ui-core');
724
+
725
+ wp_register_script('my-wplc-color', plugins_url('js/jscolor.js',__FILE__), false, '1.4.1', false);
726
+ wp_enqueue_script('my-wplc-color');
727
+ wp_enqueue_script( 'jquery-ui-tabs');
728
+ wp_register_script('my-wplc-tabs', plugins_url('js/wplc_tabs.js',__FILE__), array('jquery-ui-core'), '', true);
729
+ wp_enqueue_script('my-wplc-tabs');
730
+ }
731
+ }
732
+
733
+
734
+ function wplc_admin_settings_layout() {
735
+ wplc_settings_page_basic();
736
+ }
737
+ function wplc_admin_history_layout() {
738
+ echo"<div class=\"wrap\"><div id=\"icon-edit\" class=\"icon32 icon32-posts-post\"><br></div><h2>".__("WP Live Chat History","wplivechat")."</h2>";
739
+ if (function_exists("wplc_register_pro_version")) {
740
+ wplc_pro_admin_display_history();
741
+ }
742
+ else {
743
+ echo "<br /><br >This option is only available in the <a href=\"http://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=history1\" title=\"".__("Pro Add-on","wplivechat")."\" target=\"_BLANK\">Pro Add-on</a> of WP Live Chat. <a href=\"http://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=history2\" title=\"".__("Pro Add-on","wplivechat")."\" target=\"_BLANK\">Get it now for only $24.95 once off!</a>";
744
+ }
745
+ }
746
+
747
+
748
+ function wplc_settings_page_basic() {
749
+ if(function_exists("wplc_register_pro_version")){
750
+ wplc_settings_page_pro();
751
+ } else {
752
+ include 'includes/settings_page.php';
753
+ }
754
+ }
755
+ function wplc_head_basic() {
756
+ global $wpdb;
757
+
758
+ if (isset($_POST['wplc_save_settings'])){
759
+
760
+ $wplc_data['wplc_settings_align'] = esc_attr($_POST['wplc_settings_align']);
761
+ $wplc_data['wplc_settings_fill'] = esc_attr($_POST['wplc_settings_fill']);
762
+ $wplc_data['wplc_settings_font'] = esc_attr($_POST['wplc_settings_font']);
763
+ $wplc_data['wplc_settings_enabled'] = esc_attr($_POST['wplc_settings_enabled']);
764
+ update_option('WPLC_SETTINGS', $wplc_data);
765
+ update_option("WPLC_HIDE_CHAT", $_POST['wplc_hide_chat']);
766
+ echo "<div class='updated'>";
767
+ _e("Your settings have been saved.","wplivechat");
768
+ echo "</div>";
769
+
770
+
771
+ }
772
+
773
+ }
774
+
775
+ function wplc_logout() {
776
+ delete_transient('wplc_is_admin_logged_in');
777
+ }
778
+ add_action('wp_logout', 'wplc_logout');
779
+
780
+
781
+