diff --git a/composer.json b/composer.json index fd14953..5659c12 100644 --- a/composer.json +++ b/composer.json @@ -3,7 +3,7 @@ "description": "Wordpress plugin for tawk.to", "type": "project", "license": "GPL-3.0", - "version": "0.9.4", + "version": "0.9.5", "require": { "tawk/url-utils": "2.0.1" }, diff --git a/composer.lock b/composer.lock index b6abd8b..bb4ae98 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "cdc366926c7feaedafc83315708262e0", + "content-hash": "e2d0c8c93a2e744310ebcac698cd3832", "packages": [ { "name": "tawk/url-utils", diff --git a/package-lock.json b/package-lock.json index cc4fe40..69ed99c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "tawk-wordpress", - "version": "0.9.4", + "version": "0.9.5", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index fa026de..6b29a6b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "tawk-wordpress", - "version": "0.9.4", + "version": "0.9.5", "description": "tawk.to wordpress plugin", "main": "index.js", "directories": { diff --git a/tawkto/readme.txt b/tawkto/readme.txt index ec9ee80..c537d81 100644 --- a/tawkto/readme.txt +++ b/tawkto/readme.txt @@ -4,7 +4,7 @@ Tags: tawk.to,tawk,free live chat,ai chat,chat widget Requires at least: 2.7 Requires PHP: 5.6 Tested up to: 7.1 -Stable tag: 0.9.4 +Stable tag: 0.9.5 License: GPLv3 License URI: https://www.gnu.org/licenses/gpl-3.0.html @@ -71,6 +71,12 @@ Note: You will need a free tawk.to account: [Create one for free here!](https:// == Changelog == += 0.9.5 = +* Fix Javascript API key being reset after plugin update + += 0.9.4 = +* Supported version bump to 7.1 + = 0.9.3 = * Supported version bump to 6.9 diff --git a/tawkto/tawkto.php b/tawkto/tawkto.php index 8574f50..19767a4 100644 --- a/tawkto/tawkto.php +++ b/tawkto/tawkto.php @@ -6,7 +6,7 @@ * Plugin Name: Tawk.to Live Chat * Plugin URI: https://www.tawk.to * Description: Embeds Tawk.to live chat widget to your site - * Version: 0.9.4 + * Version: 0.9.5 * Author: Tawkto * Text Domain: tawk-to-live-chat * License: GPLv3 diff --git a/tawkto/templates/widget.php b/tawkto/templates/widget.php index e66f7ee..66ec820 100644 --- a/tawkto/templates/widget.php +++ b/tawkto/templates/widget.php @@ -8,7 +8,7 @@ ?> - + - + diff --git a/tawkto/upgrade.manager.php b/tawkto/upgrade.manager.php index 7f7af50..ebf81e1 100644 --- a/tawkto/upgrade.manager.php +++ b/tawkto/upgrade.manager.php @@ -58,21 +58,17 @@ public function start() { return; } - // special case: we've never set the version before. - // All plugins prior to the current version needs the upgrade. - if ( version_compare( $this->prev_ver, $this->curr_ver ) < 0 ) { - // are there upgrade steps depending on how out-of-date? - foreach ( $this->upgrades as $upgrade_ver => $upgrade ) { - // only run upgrades if upgrade version is lower than - // and equal to the current version. - if ( version_compare( $upgrade_ver, $this->curr_ver ) <= 0 ) { - $this->do_upgrade( $upgrade_ver ); - } - - update_option( $this->version_var_name, $upgrade_ver ); + // only run upgrades newer than the previously installed version and + // up to the current version. If the version was never recorded, + // prev_ver is empty and every upgrade runs. + foreach ( $this->upgrades as $upgrade_ver => $upgrade ) { + if ( version_compare( $upgrade_ver, $this->prev_ver ) > 0 && + version_compare( $upgrade_ver, $this->curr_ver ) <= 0 ) { + $this->do_upgrade( $upgrade_ver ); } } + update_option( $this->version_var_name, $this->curr_ver ); } /** diff --git a/tawkto/upgrades/version.090.php b/tawkto/upgrades/version.090.php index 2c41eeb..c85350a 100644 --- a/tawkto/upgrades/version.090.php +++ b/tawkto/upgrades/version.090.php @@ -25,6 +25,8 @@ public static function upgrade() { update_option( TawkTo_Settings::TAWK_VISIBILITY_OPTIONS, $visibility ); } - update_option( TawkTo_Settings::TAWK_SECURITY_OPTIONS, array( 'js_api_key' => '' ) ); + if ( ! get_option( TawkTo_Settings::TAWK_SECURITY_OPTIONS, false ) ) { + update_option( TawkTo_Settings::TAWK_SECURITY_OPTIONS, array( 'js_api_key' => '' ) ); + } } }