| @@ -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.8 | |
| 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 |
| @@ -28,12 +28,12 @@ | ||
| 28 | 28 | static $plugin_dir; |
| 29 | 29 | |
| 30 | 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')); |
| @@ -50,13 +50,13 @@ | ||
| 50 | 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 | 57 | public static function admin_notice(){ |
| 58 | - if(!self::$is_enabled) | |
| 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 | 62 | public static function add_settings_page(){ |