PluginProbe
Lime Connect (formerly Userlike) – WordPress Live Chat plugin / 2.6
Lime Connect (formerly Userlike) – WordPress Live Chat plugin v2.6
2.9 trunk 1.0 1.1 1.2 1.4 1.5 1.6 1.7 1.8 1.9 2.0.1 2.0.2 2.0.3 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8
← All changes | userlike.php +14 -14 1.72.6 View file →
@@ -2,15 +2,15 @@
2 2 /*
3 3 Plugin Name: Userlike
4 4 Plugin URI: https://www.userlike.com
5 5 Description: Userlike Live Chat integration for Wordpress
6 -Version: 1.7
6 +Version: 2.6
7 7 Author: David Voswinkel <david.voswinkel@userlike.com>
8 8 Author URI: https://www.userlike.com
9 9 License: GPL2
10 10
11 11 This program is free software; you can redistribute it and/or modify
12 -it under the terms of the GNU General Public License, version 2, as
12 +it under the terms of the GNU General Public License, version 2, as
13 13 published by the Free Software Foundation.
14 14
15 15 This program is distributed in the hope that it will be useful,
16 16 but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -26,14 +26,14 @@
26 26 static $is_enabled = false;
27 27 static $json;
28 28 static $plugin_dir;
29 29
30 - function init(){
30 + public static function init(){
31 31 add_option("userlike_secret");
32 - load_plugin_textdomain('userlike', false, dirname(plugin_basename(__FILE__)));
32 + load_plugin_textdomain('userlike', false, dirname(plugin_basename(__FILE__)));
33 33 if(get_option("userlike_secret") && strlen(get_option("userlike_secret")) > 30 && !preg_match("/[^a-f0-9]/", get_option("userlike_secret")))
34 34 self::$is_enabled = true;
35 - else
35 + else
36 36 self::$is_enabled = false;
37 37 self::$plugin_dir = get_option('siteurl').'/'.PLUGINDIR.'/userlike/';
38 38 if(function_exists('current_user_can') && current_user_can('manage_options')){
39 39 add_action('admin_menu', array(__CLASS__, 'add_settings_page'));
@@ -38,9 +38,9 @@
38 38 if(function_exists('current_user_can') && current_user_can('manage_options')){
39 39 add_action('admin_menu', array(__CLASS__, 'add_settings_page'));
40 40 add_filter('plugin_action_links', array(__CLASS__, 'register_actions'), 10, 2);
41 41 }
42 -
42 +
43 43 if(self::$is_enabled){
44 44 add_action('wp_footer', array(__CLASS__, 'insert_code'));
45 45 } else {
46 46 add_action('admin_notices', array(__CLASS__, 'admin_notice'));
@@ -46,21 +46,21 @@
46 46 add_action('admin_notices', array(__CLASS__, 'admin_notice'));
47 47 }
48 48 }
49 49
50 - function insert_code(){
50 + public static function insert_code(){
51 51 /* Insert Userlike javascript code into the page */
52 52 if(!self::$is_enabled) return false;
53 53 $secret = get_option("userlike_secret");
54 - echo "<script src=\"https://s3-eu-west-1.amazonaws.com/userlike-cdn-widgets/".$secret.".js\"></script>";
54 + echo "<script async type=\"text/javascript\" src=\"https://s3-eu-west-1.amazonaws.com/userlike-cdn-widgets/".$secret.".js\"></script>";
55 55 }
56 56
57 - function admin_notice(){
58 - if(!self::$is_enabled)
57 + public static function admin_notice(){
58 + if(!self::$is_enabled)
59 59 echo '<div class="error"><p><strong>'.sprintf(__('Userlike integration has not been set up. Please go to the <a href="%s">plugin page</a> and enter your Userlike credentials to enable it.' ), admin_url('options-general.php?page=userlike')).'</strong></p></div>';
60 60 }
61 61
62 - function add_settings_page(){
62 + public static function add_settings_page(){
63 63 add_action('admin_init', array(__CLASS__, 'register_settings'));
64 64 add_submenu_page('options-general.php', 'Userlike', 'Userlike', 'manage_options', 'userlike', array(__CLASS__, 'settings_page'));
65 65 }
66 66
@@ -65,14 +65,14 @@
65 65 }
66 66
67 67 /* Helper Functions */
68 68
69 - function register_settings(){
69 + public static function register_settings(){
70 70 register_setting('userlike', 'userlike_secret');
71 71 add_settings_section('userlike', 'Userlike', '', 'userlike');
72 72 }
73 73
74 - function register_actions($links, $file){
74 + public static function register_actions($links, $file){
75 75 $this_plugin = plugin_basename(__FILE__);
76 76 if($file == $this_plugin && function_exists('admin_url')){
77 77 $settings_link = '<a href="'.admin_url('options-general.php?page=userlike').'">'.__('Settings', 'userlike').'</a>';
78 78 array_unshift($links, $settings_link);
@@ -79,9 +79,9 @@
79 79 }
80 80 return($links);
81 81 }
82 82
83 - function settings_page(){
83 + public static function settings_page(){
84 84 if(get_option("userlike_secret") && !self::$is_enabled){
85 85 echo '<div id="setting-error-settings_error" class="error settings-error"><p><strong>Your credentials don\'t look like they are correct. Please make sure that your credentials are correct! <a href="#" onClick="return userlikeStartChat();">Click here for live help</a></strong></p></div>';
86 86 }
87 87 $plugin_dir = self::$plugin_dir;