LiveChat – WP live chat plugin for WordPress - Version 4.4.1

Version Description

  • bug fixes
Download this release

Release Info

Developer livechat
Plugin Icon 128x128 LiveChat – WP live chat plugin for WordPress
Version 4.4.1
Comparing to
See all releases

Code changes from version 4.4.0 to 4.4.1

changelog.txt CHANGED
@@ -1,5 +1,8 @@
1
  == Changelog ==
2
 
 
 
 
3
  = 4.4.0 =
4
  * auto-update feature
5
 
1
  == Changelog ==
2
 
3
+ = 4.4.1 =
4
+ * bug fixes
5
+
6
  = 4.4.0 =
7
  * auto-update feature
8
 
composer.lock CHANGED
@@ -108,12 +108,12 @@
108
  "source": {
109
  "type": "git",
110
  "url": "https://github.com/Brain-WP/BrainMonkey.git",
111
- "reference": "a11f7a0e703ff92a91b67bbf9ea384ab0ec2c863"
112
  },
113
  "dist": {
114
  "type": "zip",
115
- "url": "https://api.github.com/repos/Brain-WP/BrainMonkey/zipball/a11f7a0e703ff92a91b67bbf9ea384ab0ec2c863",
116
- "reference": "a11f7a0e703ff92a91b67bbf9ea384ab0ec2c863",
117
  "shasum": ""
118
  },
119
  "require": {
@@ -166,7 +166,7 @@
166
  "test",
167
  "testing"
168
  ],
169
- "time": "2020-10-05T08:24:45+00:00"
170
  },
171
  {
172
  "name": "dealerdirect/phpcodesniffer-composer-installer",
@@ -1048,23 +1048,23 @@
1048
  },
1049
  {
1050
  "name": "sebastian/code-unit-reverse-lookup",
1051
- "version": "1.0.1",
1052
  "source": {
1053
  "type": "git",
1054
  "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git",
1055
- "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18"
1056
  },
1057
  "dist": {
1058
  "type": "zip",
1059
- "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18",
1060
- "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18",
1061
  "shasum": ""
1062
  },
1063
  "require": {
1064
- "php": "^5.6 || ^7.0"
1065
  },
1066
  "require-dev": {
1067
- "phpunit/phpunit": "^5.7 || ^6.0"
1068
  },
1069
  "type": "library",
1070
  "extra": {
@@ -1089,7 +1089,13 @@
1089
  ],
1090
  "description": "Looks up which function or method a line of code belongs to",
1091
  "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/",
1092
- "time": "2017-03-04T06:30:41+00:00"
 
 
 
 
 
 
1093
  },
1094
  {
1095
  "name": "sebastian/comparator",
@@ -1561,16 +1567,16 @@
1561
  },
1562
  {
1563
  "name": "squizlabs/php_codesniffer",
1564
- "version": "3.5.6",
1565
  "source": {
1566
  "type": "git",
1567
  "url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
1568
- "reference": "e97627871a7eab2f70e59166072a6b767d5834e0"
1569
  },
1570
  "dist": {
1571
  "type": "zip",
1572
- "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/e97627871a7eab2f70e59166072a6b767d5834e0",
1573
- "reference": "e97627871a7eab2f70e59166072a6b767d5834e0",
1574
  "shasum": ""
1575
  },
1576
  "require": {
@@ -1608,20 +1614,20 @@
1608
  "phpcs",
1609
  "standards"
1610
  ],
1611
- "time": "2020-08-10T04:50:15+00:00"
1612
  },
1613
  {
1614
  "name": "symfony/polyfill-ctype",
1615
- "version": "v1.18.1",
1616
  "source": {
1617
  "type": "git",
1618
  "url": "https://github.com/symfony/polyfill-ctype.git",
1619
- "reference": "1c302646f6efc070cd46856e600e5e0684d6b454"
1620
  },
1621
  "dist": {
1622
  "type": "zip",
1623
- "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/1c302646f6efc070cd46856e600e5e0684d6b454",
1624
- "reference": "1c302646f6efc070cd46856e600e5e0684d6b454",
1625
  "shasum": ""
1626
  },
1627
  "require": {
@@ -1633,7 +1639,7 @@
1633
  "type": "library",
1634
  "extra": {
1635
  "branch-alias": {
1636
- "dev-master": "1.18-dev"
1637
  },
1638
  "thanks": {
1639
  "name": "symfony/polyfill",
@@ -1684,20 +1690,20 @@
1684
  "type": "tidelift"
1685
  }
1686
  ],
1687
- "time": "2020-07-14T12:35:20+00:00"
1688
  },
1689
  {
1690
  "name": "symfony/yaml",
1691
- "version": "v3.4.45",
1692
  "source": {
1693
  "type": "git",
1694
  "url": "https://github.com/symfony/yaml.git",
1695
- "reference": "ec3c2ac4d881a4684c1f0317d2107f1a4152bad9"
1696
  },
1697
  "dist": {
1698
  "type": "zip",
1699
- "url": "https://api.github.com/repos/symfony/yaml/zipball/ec3c2ac4d881a4684c1f0317d2107f1a4152bad9",
1700
- "reference": "ec3c2ac4d881a4684c1f0317d2107f1a4152bad9",
1701
  "shasum": ""
1702
  },
1703
  "require": {
@@ -1714,11 +1720,6 @@
1714
  "symfony/console": "For validating YAML files using the lint command"
1715
  },
1716
  "type": "library",
1717
- "extra": {
1718
- "branch-alias": {
1719
- "dev-master": "3.4-dev"
1720
- }
1721
- },
1722
  "autoload": {
1723
  "psr-4": {
1724
  "Symfony\\Component\\Yaml\\": ""
@@ -1757,7 +1758,7 @@
1757
  "type": "tidelift"
1758
  }
1759
  ],
1760
- "time": "2020-09-18T15:58:55+00:00"
1761
  },
1762
  {
1763
  "name": "webmozart/assert",
108
  "source": {
109
  "type": "git",
110
  "url": "https://github.com/Brain-WP/BrainMonkey.git",
111
+ "reference": "f2295a57da59ff88621cd959dbdb4b288feefd19"
112
  },
113
  "dist": {
114
  "type": "zip",
115
+ "url": "https://api.github.com/repos/Brain-WP/BrainMonkey/zipball/f2295a57da59ff88621cd959dbdb4b288feefd19",
116
+ "reference": "f2295a57da59ff88621cd959dbdb4b288feefd19",
117
  "shasum": ""
118
  },
119
  "require": {
166
  "test",
167
  "testing"
168
  ],
169
+ "time": "2020-10-09T06:55:33+00:00"
170
  },
171
  {
172
  "name": "dealerdirect/phpcodesniffer-composer-installer",
1048
  },
1049
  {
1050
  "name": "sebastian/code-unit-reverse-lookup",
1051
+ "version": "1.0.2",
1052
  "source": {
1053
  "type": "git",
1054
  "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git",
1055
+ "reference": "1de8cd5c010cb153fcd68b8d0f64606f523f7619"
1056
  },
1057
  "dist": {
1058
  "type": "zip",
1059
+ "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/1de8cd5c010cb153fcd68b8d0f64606f523f7619",
1060
+ "reference": "1de8cd5c010cb153fcd68b8d0f64606f523f7619",
1061
  "shasum": ""
1062
  },
1063
  "require": {
1064
+ "php": ">=5.6"
1065
  },
1066
  "require-dev": {
1067
+ "phpunit/phpunit": "^8.5"
1068
  },
1069
  "type": "library",
1070
  "extra": {
1089
  ],
1090
  "description": "Looks up which function or method a line of code belongs to",
1091
  "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/",
1092
+ "funding": [
1093
+ {
1094
+ "url": "https://github.com/sebastianbergmann",
1095
+ "type": "github"
1096
+ }
1097
+ ],
1098
+ "time": "2020-11-30T08:15:22+00:00"
1099
  },
1100
  {
1101
  "name": "sebastian/comparator",
1567
  },
1568
  {
1569
  "name": "squizlabs/php_codesniffer",
1570
+ "version": "3.5.8",
1571
  "source": {
1572
  "type": "git",
1573
  "url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
1574
+ "reference": "9d583721a7157ee997f235f327de038e7ea6dac4"
1575
  },
1576
  "dist": {
1577
  "type": "zip",
1578
+ "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/9d583721a7157ee997f235f327de038e7ea6dac4",
1579
+ "reference": "9d583721a7157ee997f235f327de038e7ea6dac4",
1580
  "shasum": ""
1581
  },
1582
  "require": {
1614
  "phpcs",
1615
  "standards"
1616
  ],
1617
+ "time": "2020-10-23T02:01:07+00:00"
1618
  },
1619
  {
1620
  "name": "symfony/polyfill-ctype",
1621
+ "version": "v1.19.0",
1622
  "source": {
1623
  "type": "git",
1624
  "url": "https://github.com/symfony/polyfill-ctype.git",
1625
+ "reference": "aed596913b70fae57be53d86faa2e9ef85a2297b"
1626
  },
1627
  "dist": {
1628
  "type": "zip",
1629
+ "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/aed596913b70fae57be53d86faa2e9ef85a2297b",
1630
+ "reference": "aed596913b70fae57be53d86faa2e9ef85a2297b",
1631
  "shasum": ""
1632
  },
1633
  "require": {
1639
  "type": "library",
1640
  "extra": {
1641
  "branch-alias": {
1642
+ "dev-main": "1.19-dev"
1643
  },
1644
  "thanks": {
1645
  "name": "symfony/polyfill",
1690
  "type": "tidelift"
1691
  }
1692
  ],
1693
+ "time": "2020-10-23T09:01:57+00:00"
1694
  },
1695
  {
1696
  "name": "symfony/yaml",
1697
+ "version": "v3.4.47",
1698
  "source": {
1699
  "type": "git",
1700
  "url": "https://github.com/symfony/yaml.git",
1701
+ "reference": "88289caa3c166321883f67fe5130188ebbb47094"
1702
  },
1703
  "dist": {
1704
  "type": "zip",
1705
+ "url": "https://api.github.com/repos/symfony/yaml/zipball/88289caa3c166321883f67fe5130188ebbb47094",
1706
+ "reference": "88289caa3c166321883f67fe5130188ebbb47094",
1707
  "shasum": ""
1708
  },
1709
  "require": {
1720
  "symfony/console": "For validating YAML files using the lint command"
1721
  },
1722
  "type": "library",
 
 
 
 
 
1723
  "autoload": {
1724
  "psr-4": {
1725
  "Symfony\\Component\\Yaml\\": ""
1758
  "type": "tidelift"
1759
  }
1760
  ],
1761
+ "time": "2020-10-24T10:57:07+00:00"
1762
  },
1763
  {
1764
  "name": "webmozart/assert",
livechat.php CHANGED
@@ -5,7 +5,7 @@ Plugin URI: https://www.livechat.com/addons/wordpress/
5
  Description: Live chat software for live help, online sales and customer support. This plugin allows to quickly install LiveChat on any WordPress website.
6
  Author: LiveChat
7
  Author URI: https://www.livechat.com
8
- Version: 4.4.0
9
  Text Domain: wp-live-chat-software-for-wordpress
10
  Domain Path: /languages
11
  */
5
  Description: Live chat software for live help, online sales and customer support. This plugin allows to quickly install LiveChat on any WordPress website.
6
  Author: LiveChat
7
  Author URI: https://www.livechat.com
8
+ Version: 4.4.1
9
  Text Domain: wp-live-chat-software-for-wordpress
10
  Domain Path: /languages
11
  */
plugin_files/LiveChat.class.php CHANGED
@@ -154,24 +154,40 @@ class LiveChat {
154
  }
155
 
156
  /**
157
- * Injects widget script code
 
 
 
158
  */
159
- public function widget_script() {
 
 
160
  try {
161
- $token = ConnectToken::load(
162
- Store::get_instance()->get_store_token(),
163
  CertProvider::create()->get_stored_cert()
164
  );
165
- $api_url = UrlProvider::create( $token )->get_api_url();
 
 
 
 
 
166
 
167
- $widget_url = sprintf(
168
- $api_url . '/api/v1/script/%s/widget.js',
169
- $token->get_store_uuid()
170
- );
 
 
 
 
 
 
171
 
172
  wp_register_script(
173
  'livechat-widget',
174
- $widget_url,
175
  array(),
176
  $this->module->get_plugin_version(),
177
  $in_footer = true
154
  }
155
 
156
  /**
157
+ * Returns decoded token.
158
+ *
159
+ * @return ConnectToken
160
+ * @throws Exceptions\ApiClientException Can be thrown when a token is malformed.
161
  */
162
+ public function get_connect_token() {
163
+ $store_token = Store::get_instance()->get_store_token();
164
+
165
  try {
166
+ return ConnectToken::load(
167
+ $store_token,
168
  CertProvider::create()->get_stored_cert()
169
  );
170
+ } catch ( Exception $exception ) {
171
+ if ( 'Expired token' === $exception->getMessage() ) {
172
+ return ConnectToken::decode(
173
+ $store_token
174
+ );
175
+ }
176
 
177
+ throw $exception;
178
+ }
179
+ }
180
+
181
+ /**
182
+ * Injects widget script code
183
+ */
184
+ public function widget_script() {
185
+ try {
186
+ $token = $this->get_connect_token();
187
 
188
  wp_register_script(
189
  'livechat-widget',
190
+ UrlProvider::create( $token )->get_widget_url(),
191
  array(),
192
  $this->module->get_plugin_version(),
193
  $in_footer = true
plugin_files/Services/ConnectToken.class.php CHANGED
@@ -110,6 +110,18 @@ class ConnectToken {
110
  return $this->get_from_token( 'userUUID' );
111
  }
112
 
 
 
 
 
 
 
 
 
 
 
 
 
113
  /**
114
  * Creates ConnectToken instance
115
  *
@@ -125,4 +137,18 @@ class ConnectToken {
125
 
126
  return $instance;
127
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
128
  }
110
  return $this->get_from_token( 'userUUID' );
111
  }
112
 
113
+ /**
114
+ * Decodes payload of token without validation.
115
+ *
116
+ * @param string $token JWT to decode.
117
+ */
118
+ private function set_token_without_validation( $token ) {
119
+ $this->token = $token;
120
+
121
+ list(, $payload) = explode( '.', $token );
122
+ $this->decoded_token = JWT::jsonDecode( JWT::urlsafeB64Decode( $payload ) );
123
+ }
124
+
125
  /**
126
  * Creates ConnectToken instance
127
  *
137
 
138
  return $instance;
139
  }
140
+
141
+ /**
142
+ * Only decodes token without validating it.
143
+ *
144
+ * @param string $token JWT to decode.
145
+ *
146
+ * @return ConnectToken
147
+ */
148
+ public static function decode( $token ) {
149
+ $instance = new ConnectToken();
150
+ $instance->set_token_without_validation( $token );
151
+
152
+ return $instance;
153
+ }
154
  }
plugin_files/Services/UrlProvider.class.php CHANGED
@@ -69,6 +69,20 @@ class UrlProvider {
69
  );
70
  }
71
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
72
  /**
73
  * Returns new instance of UrlProvider class.
74
  *
69
  );
70
  }
71
 
72
+ /**
73
+ * Return widget url based on ConnectToken
74
+ *
75
+ * @return string
76
+ */
77
+ public function get_widget_url() {
78
+ $api_url = $this->get_api_url();
79
+
80
+ return sprintf(
81
+ $api_url . '/api/v1/script/%s/widget.js',
82
+ $this->connect_token->get_store_uuid()
83
+ );
84
+ }
85
+
86
  /**
87
  * Returns new instance of UrlProvider class.
88
  *
readme.txt CHANGED
@@ -1,7 +1,7 @@
1
  === LiveChat - WP live chat plugin for WordPress ===
2
  Contributors: LiveChat
3
  Tags: live chat, chat plugin, live chat plugin, wordpress live chat, wordpress chat,
4
- Stable tag: 4.4.0
5
  Requires PHP: 5.6
6
  Tested up to: 5.5
7
  Requires at least: 4.0
@@ -352,6 +352,9 @@ For more detailed instructions, go to the [live chat plugin page](https://www.li
352
 
353
  == Changelog ==
354
 
 
 
 
355
  = 4.4.0 =
356
  * auto-update feature
357
 
1
  === LiveChat - WP live chat plugin for WordPress ===
2
  Contributors: LiveChat
3
  Tags: live chat, chat plugin, live chat plugin, wordpress live chat, wordpress chat,
4
+ Stable tag: 4.4.1
5
  Requires PHP: 5.6
6
  Tested up to: 5.5
7
  Requires at least: 4.0
352
 
353
  == Changelog ==
354
 
355
+ = 4.4.1 =
356
+ * bug fixes
357
+
358
  = 4.4.0 =
359
  * auto-update feature
360
 
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
- return ComposerAutoloaderInitbcbacf9eefa0ad14e8a4b3a447c97b6a::getLoader();
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInit33c4f153ba472c4f67b4585210a4eb1f::getLoader();
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInitbcbacf9eefa0ad14e8a4b3a447c97b6a
6
  {
7
  private static $loader;
8
 
@@ -22,15 +22,15 @@ class ComposerAutoloaderInitbcbacf9eefa0ad14e8a4b3a447c97b6a
22
  return self::$loader;
23
  }
24
 
25
- spl_autoload_register(array('ComposerAutoloaderInitbcbacf9eefa0ad14e8a4b3a447c97b6a', 'loadClassLoader'), true, true);
26
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
27
- spl_autoload_unregister(array('ComposerAutoloaderInitbcbacf9eefa0ad14e8a4b3a447c97b6a', 'loadClassLoader'));
28
 
29
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
30
  if ($useStaticLoader) {
31
  require_once __DIR__ . '/autoload_static.php';
32
 
33
- call_user_func(\Composer\Autoload\ComposerStaticInitbcbacf9eefa0ad14e8a4b3a447c97b6a::getInitializer($loader));
34
  } else {
35
  $map = require __DIR__ . '/autoload_namespaces.php';
36
  foreach ($map as $namespace => $path) {
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInit33c4f153ba472c4f67b4585210a4eb1f
6
  {
7
  private static $loader;
8
 
22
  return self::$loader;
23
  }
24
 
25
+ spl_autoload_register(array('ComposerAutoloaderInit33c4f153ba472c4f67b4585210a4eb1f', 'loadClassLoader'), true, true);
26
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
27
+ spl_autoload_unregister(array('ComposerAutoloaderInit33c4f153ba472c4f67b4585210a4eb1f', 'loadClassLoader'));
28
 
29
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
30
  if ($useStaticLoader) {
31
  require_once __DIR__ . '/autoload_static.php';
32
 
33
+ call_user_func(\Composer\Autoload\ComposerStaticInit33c4f153ba472c4f67b4585210a4eb1f::getInitializer($loader));
34
  } else {
35
  $map = require __DIR__ . '/autoload_namespaces.php';
36
  foreach ($map as $namespace => $path) {
vendor/composer/autoload_static.php CHANGED
@@ -4,7 +4,7 @@
4
 
5
  namespace Composer\Autoload;
6
 
7
- class ComposerStaticInitbcbacf9eefa0ad14e8a4b3a447c97b6a
8
  {
9
  public static $prefixLengthsPsr4 = array (
10
  'L' =>
@@ -72,9 +72,9 @@ class ComposerStaticInitbcbacf9eefa0ad14e8a4b3a447c97b6a
72
  public static function getInitializer(ClassLoader $loader)
73
  {
74
  return \Closure::bind(function () use ($loader) {
75
- $loader->prefixLengthsPsr4 = ComposerStaticInitbcbacf9eefa0ad14e8a4b3a447c97b6a::$prefixLengthsPsr4;
76
- $loader->prefixDirsPsr4 = ComposerStaticInitbcbacf9eefa0ad14e8a4b3a447c97b6a::$prefixDirsPsr4;
77
- $loader->classMap = ComposerStaticInitbcbacf9eefa0ad14e8a4b3a447c97b6a::$classMap;
78
 
79
  }, null, ClassLoader::class);
80
  }
4
 
5
  namespace Composer\Autoload;
6
 
7
+ class ComposerStaticInit33c4f153ba472c4f67b4585210a4eb1f
8
  {
9
  public static $prefixLengthsPsr4 = array (
10
  'L' =>
72
  public static function getInitializer(ClassLoader $loader)
73
  {
74
  return \Closure::bind(function () use ($loader) {
75
+ $loader->prefixLengthsPsr4 = ComposerStaticInit33c4f153ba472c4f67b4585210a4eb1f::$prefixLengthsPsr4;
76
+ $loader->prefixDirsPsr4 = ComposerStaticInit33c4f153ba472c4f67b4585210a4eb1f::$prefixDirsPsr4;
77
+ $loader->classMap = ComposerStaticInit33c4f153ba472c4f67b4585210a4eb1f::$classMap;
78
 
79
  }, null, ClassLoader::class);
80
  }