Skip to content

Commit 95d9f33

Browse files
author
Dreb Bits
committed
Initial files
0 parents  commit 95d9f33

11 files changed

+372
-0
lines changed

favicon.ico

1.12 KB
Binary file not shown.

logo.png

17.7 KB
Loading

purechat.php

Lines changed: 191 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,191 @@
1+
<?php
2+
/**
3+
* @package Pure_Chat
4+
* @version 2.2
5+
*/
6+
/*
7+
Plugin Name: Pure Chat
8+
Plugin URI:
9+
Description: Website chat, simplified. Now 100% Free for Live Chat for Three Users/Operators and Unlimited Chats for your website! Love purechat? Spread the word! <a href="https://wordpress.org/support/view/plugin-reviews/pure-chat">Click here to review the plugin!</a>
10+
Author: Pure Chat, Inc.
11+
Version: 2.2
12+
Author URI: purechat.com
13+
*/
14+
15+
defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
16+
17+
include 'variables.php';
18+
19+
class Pure_Chat_Plugin {
20+
var $version = 5;
21+
22+
public static function activate() {
23+
Pure_Chat_Plugin::clear_cache();
24+
}
25+
26+
public static function deactivate() {
27+
Pure_Chat_Plugin::clear_cache();
28+
}
29+
30+
31+
32+
function __construct() {
33+
// add_option('purechat_widget_code', '', '', 'yes');
34+
// add_option('purechat_widget_name', '', '', 'yes');
35+
36+
add_action('wp_footer', array( &$this, 'pure_chat_load_snippet') );
37+
38+
add_action('admin_menu', array( &$this, 'pure_chat_menu' ) );
39+
add_action('wp_ajax_pure_chat_update', array( &$this, 'pure_chat_update' ) );
40+
41+
$this->update_plugin();
42+
}
43+
44+
function update_plugin() {
45+
update_option('purechat_plugin_ver', $this->version);
46+
}
47+
48+
function pure_chat_menu() {
49+
add_menu_page('Pure Chat', 'Pure Chat', 'manage_options', 'purechat-menu', array( &$this, 'pure_chat_generateAcctPage' ), plugins_url().'/pure-chat/favicon.ico');
50+
}
51+
52+
function pure_chat_update() {
53+
if($_POST['action'] == 'pure_chat_update' && strlen((string)$_POST['purechatwid']) == 36)
54+
{
55+
update_option('purechat_widget_code', $_POST['purechatwid']);
56+
update_option('purechat_widget_name', $_POST['purechatwname']);
57+
}
58+
}
59+
60+
function pure_chat_load_snippet() {
61+
global $current_user;
62+
if(get_option('purechat_widget_code'))
63+
{
64+
echo("<script type='text/javascript' data-cfasync='false'>window.purechatApi = { l: [], t: [], on: function () { this.l.push(arguments); } }; (function () { var done = false; var script = document.createElement('script'); script.async = true; script.type = 'text/javascript'; script.src = 'https://app.purechat.com/VisitorWidget/WidgetScript'; document.getElementsByTagName('HEAD').item(0).appendChild(script); script.onreadystatechange = script.onload = function (e) { if (!done && (!this.readyState || this.readyState == 'loaded' || this.readyState == 'complete')) { var w = new PCWidget({c: '" . get_option('purechat_widget_code') . "', f: true }); done = true; } }; })();</script>");
65+
}
66+
else
67+
{
68+
echo("<!-- Please select a widget in the wordpress plugin to activate purechat -->");
69+
}
70+
}
71+
72+
private static function clear_cache() {
73+
if (function_exists('wp_cache_clear_cache')) {
74+
wp_cache_clear_cache();
75+
}
76+
}
77+
78+
function pure_chat_generateAcctPage() {
79+
global $purechatHome;
80+
?>
81+
<head>
82+
<link rel="stylesheet" href="<?php echo plugins_url().'/pure-chat/purechatStyles.css'?>" type="text/css">
83+
</head>
84+
<?php
85+
if (isset($_POST['purechatwid']) && isset($_POST['purechatwname'])) {
86+
pure_chat_update();
87+
}
88+
?>
89+
<p>
90+
<div class="purechatbuttonbox">
91+
<img src="<?php echo plugins_url().'/pure-chat/logo.png'?>"alt="Pure Chat logo"></img>
92+
<div class = "purechatcontentdiv">
93+
<?php
94+
if (get_option('purechat_widget_code') == '' ) {
95+
?>
96+
<p>Pure Chat allows you to chat in real time with visitors to your WordPress site. Click the button below to get started by logging in to Pure Chat and selecting a chat widget!</p>
97+
<p>The button will open a widget selector in an external page. Keep in mind that your Pure Chat account is separate from your WordPress account.</p>
98+
<?php
99+
} else {
100+
?>
101+
<h4>Your current chat widget is:</h4>
102+
<h1 class="purechatCurrentWidgetName"><?php echo get_option('purechat_widget_name'); ?></h1>
103+
<p>Would you like to switch widgets?</p>
104+
<?php
105+
}
106+
?>
107+
</div>
108+
<form>
109+
<input type="button" class="purechatbutton" value="Pick a widget!" onclick="openPureChatChildWindow()">
110+
</form>
111+
<p>
112+
</div>
113+
<script>
114+
var pureChatChildWindow;
115+
var purechatNameToPass = "<?php echo get_option('purechat_widget_name');?>";
116+
var purechatIdToPass = "<?php echo get_option('purechat_widget_code');?>";
117+
function openPureChatChildWindow() {
118+
pureChatChildWindow = window.open('<?php echo $purechatHome;?>/home/pagechoicewordpress?widForDisplay=' + purechatIdToPass +
119+
'&nameForDisplay=' + purechatNameToPass, 'Pure Chat');
120+
}
121+
var url = ajaxurl;
122+
window.addEventListener('message', function(event) {
123+
var data = {
124+
'action': 'pure_chat_update',
125+
'purechatwid': event.data.id,
126+
'purechatwname': event.data.name
127+
};
128+
jQuery.post(url, data).done(function(){})
129+
var purechatNamePassedIn = event.data.name;
130+
if(typeof purechatNamePassedIn != 'undefined') {
131+
document.getElementsByClassName('purechatcontentdiv')[0].innerHTML = '<h4>Your current chat widget is:</h4><h1 class="purechatCurrentWidgetName">' +
132+
purechatNamePassedIn + '</h1><p>Would you like to switch widgets?</p>';
133+
purechatNameToPass = purechatNamePassedIn;
134+
purechatIdToPass = event.data.id;
135+
}
136+
}, false);
137+
</script>
138+
<div class="purechatlinkbox">
139+
<p><a href="https://app.purechat.com/user/dashboard" target="_blank">Your Pure Chat dashboard page</a> is your place to answer chats, add more widgets, customize their appearance with images and text, manage users, and more!</p>
140+
</div>
141+
<?php
142+
}
143+
}
144+
145+
/*function deactivate_script(){
146+
?>
147+
<script type="text/javascript">
148+
149+
//Popup in window
150+
jQuery(document).ready(function($){
151+
var currentPage='';
152+
153+
var deactivate_popup = [
154+
'<div style="position: fixed; top: 80px; width: 275px; background-color: #fff; z-index: 9999; left: 0; right: 0; line-height: 20px; margin: auto; padding: 20px; box-shadow: 1px 1px 1px grey;">',
155+
'<center><img src="<?=plugin_dir_url( __FILE__ )?>/logo.png"/></center><br>',
156+
'<form action="">',
157+
'<input type="radio" name="purechat_survey" value="expensive">Didn\'t recieve enough chats</input><br><br>',
158+
'<input type="radio" name="purechat_survey" value="nowork">Too expensive</input><br><br>',
159+
'<input type="radio" name="purechat_survey" value="testing">Don\'t have the time</input><br><br>',
160+
'<input type="radio" name="purechat_survey" value="troubleshooting">Missing Key Feautres</input><br><br>',
161+
'<input type="radio" name="purechat_survey" value="option">Switched to a different chat provider</input><br><br>',
162+
'<input type="radio" name="purechat_survey" value="Not">Not a right fit or doesn\'t meat your needs</input><br><br>',
163+
'<input type="radio" name="purechat_survey" value="other">Other Reason:</input><br><input style="margin-top: 5px; width: 100%;"></input><br><br>',
164+
'</form>',
165+
'<center><button style="border-radius: 3px; cursor: pointer; font-size: 14px; white-space: nowrap; padding: 10px 60px; background-color: #289AA0; color: #ffffff; transition: 0.7s; border: 0;" id="pure-chat-send-survey">Send and Deactivate</button></center>',
166+
'</div>'].join("");
167+
168+
$('#pure-chat-test').find('.deactivate a').click(function(e){
169+
currentPage = $(this).attr('href');
170+
171+
e.preventDefault();
172+
173+
$('body').append(deactivate_popup);
174+
});
175+
176+
$(document).on('click', '#pure-chat-send-survey', function(){
177+
178+
179+
window.location.href=currentPage;
180+
});
181+
182+
});
183+
</script>
184+
<?php
185+
}*/
186+
187+
register_activation_hook(__FILE__, array('Pure_Chat_Plugin', 'activate'));
188+
register_deactivation_hook(__FILE__, array('Pure_Chat_Plugin', 'deactivate'));
189+
190+
new Pure_Chat_Plugin();
191+
?>

purechatStyles.css

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
.purechatbuttonbox{
2+
text-align:center;
3+
border-style:solid;
4+
border-width:0px;
5+
border-radius:0px;
6+
border-color:#21759b;
7+
padding:6px;
8+
width: 40%;
9+
margin: 0 auto;
10+
}
11+
12+
.purechatcontentdiv{
13+
text-align:center;
14+
}
15+
16+
17+
.purechatbutton{
18+
border-radius: 3px;
19+
cursor: pointer;
20+
font-size: 19px;
21+
white-space: nowrap;
22+
padding: 13px 60px;
23+
background-color: #289AA0;
24+
color: #ffffff;
25+
transition: 0.7s;
26+
border: 0;
27+
}
28+
29+
.purechatlinkbox{
30+
width:40%;
31+
margin:0 auto;
32+
text-align:left;
33+
}

purechatwidgetcode.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

readme.txt

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
=== Pure Chat - 100% Free Live Chat Plugin & More! ===
2+
Contributors: pure-chat
3+
Donate link: https://www.purechat.com
4+
Tags: live chat, chat software, Chat Widget, zopim, tawk.to, free chat, IM Chat, live chat inc, live chat services, live chat software, live chatting, live support, live web chat, livechat, olark, online chat, Pure Chat, purechat, Website Chat, WordPress chat, wordpress live chat, wordpress live chat plugin, Visitor tracker, visitor tracking, visitor analytics, website analytics, web analytics, analytics, analytics dashboard
5+
Requires at least: 3.0.1
6+
Tested up to: 4.9.8
7+
Stable tag: trunk
8+
9+
Pure Chat provides a 100% Free Live Chat plugin for Three Users/Operators and Unlimited Chats for your website!
10+
11+
== Description ==
12+
13+
Pure Chat is a 100% Free Live Chat plugin for WordPress. It offers unlimited chats and three users for free. All chat widget customizations, transcript history, triggers, email forms (when unavailable), etc. are completely free.
14+
15+
Besides Live Chat, Pure Chat PRO offers unlimited users, realtime analytics, visitor tracking and contact tracking features.
16+
17+
For more information, visit [PureChat.com](https://www.purechat.com "Pure Chat")
18+
19+
== Installation ==
20+
21+
1. Install and activate plugin.
22+
2. Click on the new Pure Chat button in your left sidebar.
23+
3. Click the button to take you to the Pure Chat widget selector.
24+
4. Sign in or create a new account (If you're not already signed in to Pure Chat).
25+
5. Select a widget for your page.
26+
6. Click the link to your Pure Chat dashboard and get ready to chat!
27+
28+
== Frequently Asked Questions ==
29+
30+
= Do I have to install any extra software? =
31+
32+
No, just this plugin.
33+
34+
= How can I change the appearance of the widget on my page? =
35+
36+
You can change all your widget settings from your [Pure Chat dashboard](https://app.purechat.com/user/dashboard/ "Pure Chat dashboard").
37+
38+
= What pricing plans do you offer? =
39+
40+
Check the [Pure Chat pricing page](https://www.purechat.com/pricing "Pure Chat pricing page") for the latest info! We offer both free and paid plans.
41+
42+
= Does Pure Chat support other languages? =
43+
44+
Absolutely! You can customize all the messages that appear in the chat widget and write them in whatever language you want.
45+
46+
= Are there any ads? =
47+
48+
No! There are no annoying ads in Pure Chat.
49+
50+
= What do my visitors see if I'm not online to take their chats? =
51+
52+
You decide! Your widget can display an offline indicator, disappear entirely, or let visitors email you with their questions.
53+
54+
= Can I temporarily remove the chat widget from my site without losing my settings? =
55+
56+
Yes, deactivating the Pure Chat plugin will stop the widget from showing up, but your preferred widget settings will remain for when you want to reactivate it.
57+
58+
== Screenshots ==
59+
60+
1. Chat widget
61+
62+
2. Operator dashboard
63+
64+
3. Native iOS and Android apps.
65+
66+
== Changelog ==
67+
68+
= 2.2 =
69+
* Readme updates.
70+
71+
= 2.1 =
72+
* Update tested to version.
73+
74+
= 2.0 =
75+
* Made Live Chat portion completely free!
76+
77+
= 1.40 =
78+
* Fix issue with plugin and javascript api.
79+
80+
= 1.39 =
81+
* Fixed deprecated constructor.
82+
83+
= 1.38 =
84+
* Fixed typos.
85+
86+
= 1.37 =
87+
* Readme updates.
88+
89+
= 1.36 =
90+
* Readme updates.
91+
92+
= 1.35 =
93+
* Quick fix to remove survey.
94+
95+
= 1.34 =
96+
97+
* New icons and coloring
98+
99+
* Improved stability
100+
101+
* Fixed issue where chat box wouldn’t appear
102+
103+
= 1.33 =
104+
* New screenshots an branding.
105+
106+
= 1.32 =
107+
* Potential fix for a rare bug with some users.
108+
109+
= 1.31 =
110+
* Fixed uninstall cleanup.
111+
112+
= 1.3 =
113+
* Fixed some more issues with WP Super Cache plugin.
114+
* Added proper cleanup on plugin uninstall.
115+
116+
= 1.2 =
117+
* Fixed selected widget not updating right away due to recent "WP Super Cache" plugin update.
118+
119+
= 1.1 =
120+
* Fixed bugs in 1.0
121+
122+
= 1.0 =
123+
* Plugin launch.
124+
125+
== Upgrade Notice ==
126+
127+
= 1.2 =
128+
* Fixed selected widget not updating right away due to recent "WP Super Cache" plugin update.
129+
130+
= 1.1 =
131+
* Fixed bugs in 1.0
132+
133+
= 1.0 =
134+
* Plugin launch.

screenshot-1.png

239 KB
Loading

screenshot-2.png

300 KB
Loading

screenshot-3.png

227 KB
Loading

uninstall.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
if ( !defined( 'WP_UNINSTALL_PLUGIN' ) )
4+
exit();
5+
6+
delete_option('purechat_widget_code');
7+
delete_option('purechat_widget_name');
8+
delete_option('purechat_plugin_ver');
9+
10+
?>

variables.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<?php
2+
$purechatHome = 'https://app.purechat.com';
3+
?>

0 commit comments

Comments
 (0)