PluginProbe ʕ •ᴥ•ʔ
Floating Chat Widget: Contact Chat Icons, Telegram Chat, Line Messenger, WeChat, Email, SMS, Call Button – Chaty / 3.2
Floating Chat Widget: Contact Chat Icons, Telegram Chat, Line Messenger, WeChat, Email, SMS, Call Button – Chaty v3.2
3.5.7 3.5.6 3.5.5 3.5.4 trunk 1.1 1.1.1 1.1.2 1.1.3 1.2 1.2.1 1.2.2 1.2.3 1.3 1.3.1 1.3.2 1.3.3 1.3.4 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9 2.1 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.2 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.2.7 2.2.8 2.4 2.4.1 2.4.2 2.4.3 2.4.4 2.4.5 2.4.6 2.4.7 2.4.8 2.4.9 2.5 2.5.1 2.5.2 2.5.3 2.5.4 2.5.5 2.5.6 2.5.7 2.5.8 2.6 2.6.1 2.6.2 2.6.3 2.6.4 2.6.5 2.6.6 2.7 2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 2.7.8 2.7.9 2.8 2.8.1 2.8.2 2.8.3 2.8.4 2.8.5 2.8.6 2.9 2.9.1 2.9.2 2.9.3 3.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2 3.2.1 3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 3.2.7 3.2.8 3.2.9 3.3 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 3.3.8 3.3.9 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.6 3.4.7 3.4.8 3.4.9 3.5.0 3.5.1 3.5.2 3.5.3
chaty / cht-icons.php
chaty Last commit date
admin 2 years ago css 2 years ago images 2 years ago includes 2 years ago js 2 years ago languages 2 years ago src 3 years ago views 2 years ago cht-icons.php 2 years ago mix-manifest.json 3 years ago package-lock.json 3 years ago package.json 3 years ago postcss.config.js 3 years ago readme.txt 2 years ago tailwind.config.js 3 years ago webpack.mix.js 3 years ago
cht-icons.php
257 lines
1 <?php
2 /*
3 Plugin Name: Chaty
4 Contributors: galdub, tomeraharon
5 Description: Chat with your website visitors via their favorite channels. Show a chat icon on the bottom of your site and communicate with your website visitors.
6 Author: Premio
7 Author URI: https://premio.io/downloads/chaty/
8 Text Domain: chaty
9 Domain Path: /languages
10 Version: 3.2
11 License: GPL2
12 */
13
14 if (!defined('ABSPATH')) {
15 exit;
16 }
17
18
19 define('CHT_FILE', __FILE__); // this file
20 if(!defined('CHT_OPT')) {
21 define('CHT_OPT', 'chaty');
22 }
23 define('CHT_DIR', dirname(CHT_FILE)); // our directory
24 define('CHT_ADMIN_INC', CHT_DIR . '/admin');
25 define('CHT_FRONT_INC', CHT_DIR . '/frontend');
26 define('CHT_INC', CHT_DIR . '/includes');
27 define('CHT_PRO_URL', admin_url("admin.php?page=chaty-app-upgrade"));
28 define('CHT_PLUGIN_URL', plugin_dir_url(__FILE__));
29 define('CHT_PLUGIN_BASE', plugin_basename(CHT_FILE));
30 define('CHT_VERSION', "3.2");
31
32 if (!function_exists('wp_doing_ajax')) {
33 function wp_doing_ajax()
34 {
35 /**
36 * Filters whether the current request is a WordPress Ajax request.
37 *
38 * @since 4.7.0
39 *
40 * @param bool $wp_doing_ajax Whether the current request is a WordPress Ajax request.
41 */
42 return apply_filters('wp_doing_ajax', defined('DOING_AJAX') && DOING_AJAX);
43 }
44 }
45
46 /**
47 * Clear all caches.
48 *
49 * This method clears various caches used by different caching plugins
50 * and tools in order to ensure that the caches are updated correctly.
51 *
52 */
53 if(!function_exists("cht_clear_all_caches")) {
54 function cht_clear_all_caches()
55 {
56 /* Clear cookies from browser */
57 if (isset($_COOKIE['chaty_settings'])) {
58 setcookie("chaty_settings", '', time() - 3600, "/");
59 setcookie("cta_exit_intent_shown", '', time() - 3600, "/");
60 }
61 if(isset($_COOKIE['chatyWidget_0'])) {
62 setcookie("chatyWidget_0", '', time() - 3600, "/");
63 }
64 for($i=1; $i<=20; $i++) {
65 if(isset($_COOKIE['chatyWidget__'.$i])) {
66 setcookie('chatyWidget__'.$i, '', time() - 3600, "/");
67 }
68 }
69 try {
70 global $wp_fastest_cache;
71 // if W3 Total Cache is being used, clear the cache
72 if (function_exists('w3tc_flush_all')) {
73 w3tc_flush_all();
74
75 }
76 /* if WP Super Cache is being used, clear the cache */
77 if (function_exists('wp_cache_clean_cache')) {
78 global $file_prefix, $supercachedir;
79 if (empty($supercachedir) && function_exists('get_supercache_dir')) {
80 $supercachedir = get_supercache_dir();
81 }
82 wp_cache_clean_cache($file_prefix);
83 }
84 if (class_exists('WpeCommon')) {
85 //be extra careful, just in case 3rd party changes things on us
86 if (method_exists('WpeCommon', 'purge_memcached')) {
87 //WpeCommon::purge_memcached();
88 }
89 if (method_exists('WpeCommon', 'clear_maxcdn_cache')) {
90 //WpeCommon::clear_maxcdn_cache();
91 }
92 if (method_exists('WpeCommon', 'purge_varnish_cache')) {
93 //WpeCommon::purge_varnish_cache();
94 }
95 }
96 /* WP Fastest Cache Plugin */
97 if (method_exists('WpFastestCache', 'deleteCache') && !empty($wp_fastest_cache)) {
98 $wp_fastest_cache->deleteCache();
99 }
100 /* WP Rocket Plugin */
101 if (function_exists('rocket_clean_domain')) {
102 rocket_clean_domain();
103 // Preload cache.
104 if (function_exists('run_rocket_sitemap_preload')) {
105 run_rocket_sitemap_preload();
106 }
107 }
108 /* Autoptimize Cache Plugin */
109 if (class_exists("autoptimizeCache") && method_exists("autoptimizeCache", "clearall")) {
110 autoptimizeCache::clearall();
111 }
112 /* LiteSpeed Plugin */
113 if (class_exists("LiteSpeed_Cache_API") && method_exists("autoptimizeCache", "purge_all")) {
114 LiteSpeed_Cache_API::purge_all();
115 }
116 /* Breeze Plugin */
117 if (class_exists("Breeze_PurgeCache") && method_exists("Breeze_PurgeCache", "breeze_cache_flush")) {
118 Breeze_PurgeCache::breeze_cache_flush();
119 }
120 /* Hummingbird */
121 if (class_exists( '\Hummingbird\Core\Utils' ) ) {
122 $modules = \Hummingbird\Core\Utils::get_active_cache_modules();
123 foreach ( $modules as $module => $name ) {
124 $mod = \Hummingbird\Core\Utils::get_module( $module );
125 if ( $mod->is_active() ) {
126 if ( 'minify' === $module ) {
127 $mod->clear_files();
128 } else {
129 $mod->clear_cache();
130 }
131 }
132 }
133 }
134 /* WP Total Cache */
135 if ( function_exists( 'wp_cache_clean_cache' ) ) {
136 global $file_prefix;
137 wp_cache_clean_cache( $file_prefix, true );
138 }
139 } catch (Exception $e) {
140 return 1;
141 }
142 }
143 }
144
145 if(is_admin()) {
146 require_once CHT_ADMIN_INC . '/chaty-timezone.php';
147 require_once CHT_INC . '/class-review-box.php';
148 require_once CHT_INC . '/class-affiliate.php';
149 require_once CHT_INC . '/class-upgrade-box.php';
150 }
151
152 require_once CHT_INC . '/class-cht-icons.php';
153 require_once CHT_INC . '/class-frontend.php';
154
155 add_action('activated_plugin', 'cht_activation_redirect');
156
157 register_activation_hook(CHT_FILE, 'cht_install', 10);
158
159 /**
160 * Installs the Chaty plugin.
161 *
162 * This method checks if certain options are empty and if so, it sets default values for them.
163 * It also adds default values for other options if they are not already set.
164 * Additionally, it sets the initial values for the intro popup and the affiliate box options.
165 *
166 * @return void
167 */
168 function cht_install()
169 {
170 $widgetSize = get_option('cht_numb_slug');
171 $cht_devices = get_option('cht_devices');
172
173 if (empty($widgetSize) && empty($cht_devices)) {
174 $options = array(
175 'mobile' => '1',
176 'desktop' => '1',
177 );
178
179 update_option('cht_created_on', date("Y-m-d"));
180 update_option('cht_devices', $options);
181 update_option('cht_position', 'right');
182 update_option('cht_cta', 'Contact us');
183 update_option('cht_numb_slug', ',Phone,Whatsapp');
184 update_option('cht_social_whatsapp', '');
185 update_option('cht_social_phone', '');
186 update_option('cht_widget_size', '54');
187 update_option('widget_icon', 'chat-base');
188 update_option('cht_widget_img', '');
189 update_option('cht_color', '#A886CD');
190 }
191
192 $popup_status = get_option("chaty_intro_popup");
193 if($popup_status === false || empty($popup_status)) {
194 add_option("chaty_intro_popup", "show");
195 }
196
197 $option = get_option("Chaty_show_affiliate_box_after");
198 if($option === false || empty($option)) {
199 $date = date("Y-m-d", strtotime("+5 days"));
200 add_option("Chaty_show_affiliate_box_after", $date);
201 }
202 }
203
204 /**
205 * Redirects the user after activating the plugin.
206 *
207 * @param string $plugin The plugin's base name.
208 *
209 * @return void
210 */
211 function cht_activation_redirect($plugin)
212 {
213 if (!defined("DOING_AJAX") && $plugin == plugin_basename(__FILE__)) {
214 delete_option("cht_redirect");
215 add_option("cht_redirect",1);
216 }
217 }
218
219 /**
220 * Checks if the database table 'chaty_contact_form_leads' exists and creates it if it doesn't.
221 *
222 * @return void
223 * @global string $pagenow Current page name.
224 * @global wpdb $wpdb WordPress database object.
225 */
226 function chaty_plugin_check_db_table() {
227 global $wpdb, $pagenow;
228 $page = filter_input(INPUT_GET, 'page');
229 if ($pagenow == 'plugins.php' || ($page == 'chaty-app' || $page == 'chaty-upgrade' || $page == 'widget-analytics' || $page == 'chaty-contact-form-feed')) {
230 require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
231 $charset_collate = $wpdb->get_charset_collate();
232 $chaty_table = $wpdb->prefix . 'chaty_contact_form_leads';
233 if ($wpdb->get_var("show tables like '{$chaty_table}'") != $chaty_table) {
234 $chaty_table_settings = "CREATE TABLE {$chaty_table} (
235 id bigint(11) NOT NULL AUTO_INCREMENT,
236 widget_id int(11) NULL,
237 name varchar(100) NULL,
238 email varchar(100) NULL,
239 phone_number varchar(100) NULL,
240 message text NULL,
241 ref_page text NULL,
242 ip_address tinytext NULL,
243 created_on datetime,
244 PRIMARY KEY (id)
245 ) $charset_collate;";
246 dbDelta($chaty_table_settings);
247 }
248
249 /* version 2.7.3 change added new column */
250 $field_check = $wpdb->get_var("SHOW COLUMNS FROM {$chaty_table} LIKE 'phone_number'");
251 if ('phone_number' != $field_check) {
252 $wpdb->query("ALTER TABLE {$chaty_table} ADD phone_number VARCHAR(100) NULL DEFAULT NULL AFTER email");
253 }
254 }
255 }
256 add_action( 'admin_init' , 'chaty_plugin_check_db_table' );
257