LiveChat – WP live chat plugin for WordPress - Version 4.4.5

Version Description

  • bug fixes
Download this release

Release Info

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

Code changes from version 4.4.4 to 4.4.5

changelog.txt CHANGED
@@ -1,5 +1,8 @@
1
  == Changelog ==
2
 
 
 
 
3
  = 4.4.4 =
4
  * asynchronous chat widget loading
5
  * support for the new admin notices mechanism
1
  == Changelog ==
2
 
3
+ = 4.4.5 =
4
+ * bug fixes
5
+
6
  = 4.4.4 =
7
  * asynchronous chat widget loading
8
  * support for the new admin notices mechanism
livechat.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: LiveChat
4
  * Plugin URI: https://www.livechat.com/marketplace/apps/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
- * Version: 4.4.4
7
  * Author: LiveChat
8
  * Author URI: https://www.livechat.com
9
  * Text Domain: wp-live-chat-software-for-wordpress
3
  * Plugin Name: LiveChat
4
  * Plugin URI: https://www.livechat.com/marketplace/apps/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
+ * Version: 4.4.5
7
  * Author: LiveChat
8
  * Author URI: https://www.livechat.com
9
  * Text Domain: wp-live-chat-software-for-wordpress
plugin_files/Services/ConnectToken.class.php CHANGED
@@ -126,16 +126,15 @@ class ConnectToken {
126
  * Creates ConnectToken instance
127
  *
128
  * @param string $token JWT token string.
129
- * @param string $cert Public key for given JWT token.
130
  *
131
  * @return ConnectToken
132
  * @throws Exception Any exception that could be thrown from JWT::decode.
133
  */
134
- public static function load( $token, $cert ) {
135
- $instance = new ConnectToken();
136
- $instance->set_token( $token, $cert );
137
 
138
- return $instance;
139
  }
140
 
141
  /**
@@ -145,10 +144,18 @@ class ConnectToken {
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
  }
126
  * Creates ConnectToken instance
127
  *
128
  * @param string $token JWT token string.
129
+ * @param string $cert Public key for given JWT token.
130
  *
131
  * @return ConnectToken
132
  * @throws Exception Any exception that could be thrown from JWT::decode.
133
  */
134
+ public function load( $token, $cert ) {
135
+ $this->set_token( $token, $cert );
 
136
 
137
+ return $this;
138
  }
139
 
140
  /**
144
  *
145
  * @return ConnectToken
146
  */
147
+ public function decode( $token ) {
148
+ $this->set_token_without_validation( $token );
 
149
 
150
+ return $this;
151
+ }
152
+
153
+ /**
154
+ * Returns new instance of ConnectToken.
155
+ *
156
+ * @return static
157
+ */
158
+ public static function create() {
159
+ return new static();
160
  }
161
  }
plugin_files/Services/ConnectTokenProvider.class.php CHANGED
@@ -9,6 +9,7 @@ namespace LiveChat\Services;
9
 
10
  use LiveChat\Exceptions\ApiClientException;
11
  use LiveChat\Exceptions\InvalidTokenException;
 
12
 
13
  /**
14
  * Class ConnectTokenProvider
@@ -21,24 +22,33 @@ class ConnectTokenProvider {
21
  *
22
  * @var CertProvider
23
  */
24
- private $cert_provider = null;
25
 
26
  /**
27
  * Instance of TokenValidator
28
  *
29
  * @var TokenValidator
30
  */
31
- private $token_validator = null;
 
 
 
 
 
 
 
32
 
33
  /**
34
  * ConnectTokenProvider constructor.
35
  *
36
- * @param CertProvider $cert_provider Instance of CertProvider.
37
- * @param TokenValidator $token_validator Instance of TokenValidator.
 
38
  */
39
- public function __construct( $cert_provider, $token_validator ) {
40
- $this->cert_provider = $cert_provider;
41
- $this->token_validator = $token_validator;
 
42
  }
43
 
44
  /**
@@ -59,10 +69,16 @@ class ConnectTokenProvider {
59
  $this->token_validator->validate_user_token( $token );
60
  }
61
 
62
- return ConnectToken::load(
63
- $token,
64
- $this->cert_provider->get_stored_cert()
65
- );
 
 
 
 
 
 
66
  }
67
 
68
  /**
@@ -75,7 +91,8 @@ class ConnectTokenProvider {
75
  public static function create( $cert_provider ) {
76
  return new static(
77
  $cert_provider,
78
- TokenValidator::create( $cert_provider )
 
79
  );
80
  }
81
  }
9
 
10
  use LiveChat\Exceptions\ApiClientException;
11
  use LiveChat\Exceptions\InvalidTokenException;
12
+ use LiveChat\Services\Factories\ConnectTokenFactory;
13
 
14
  /**
15
  * Class ConnectTokenProvider
22
  *
23
  * @var CertProvider
24
  */
25
+ private $cert_provider;
26
 
27
  /**
28
  * Instance of TokenValidator
29
  *
30
  * @var TokenValidator
31
  */
32
+ private $token_validator;
33
+
34
+ /**
35
+ * Instance of ConnectTokenFactory.
36
+ *
37
+ * @var ConnectTokenFactory
38
+ */
39
+ private $connect_token_factory;
40
 
41
  /**
42
  * ConnectTokenProvider constructor.
43
  *
44
+ * @param CertProvider $cert_provider Instance of CertProvider.
45
+ * @param TokenValidator $token_validator Instance of TokenValidator.
46
+ * @param ConnectTokenFactory $connect_token_factory Instance of ConnectTokenFactory.
47
  */
48
+ public function __construct( $cert_provider, $token_validator, $connect_token_factory ) {
49
+ $this->cert_provider = $cert_provider;
50
+ $this->token_validator = $token_validator;
51
+ $this->connect_token_factory = $connect_token_factory;
52
  }
53
 
54
  /**
69
  $this->token_validator->validate_user_token( $token );
70
  }
71
 
72
+ $connect_token = $this->connect_token_factory->create();
73
+
74
+ if ( $allow_expired ) {
75
+ return $connect_token->decode( $token );
76
+ } else {
77
+ return $connect_token->load(
78
+ $token,
79
+ $this->cert_provider->get_stored_cert()
80
+ );
81
+ }
82
  }
83
 
84
  /**
91
  public static function create( $cert_provider ) {
92
  return new static(
93
  $cert_provider,
94
+ TokenValidator::create( $cert_provider ),
95
+ ConnectTokenFactory::get_instance()
96
  );
97
  }
98
  }
plugin_files/Services/Factories/ConnectTokenFactory.class.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class ConnectTokenFactory
4
+ *
5
+ * @package LiveChat\Services\Factories
6
+ */
7
+
8
+ namespace LiveChat\Services\Factories;
9
+
10
+ use LiveChat\Services\ConnectToken;
11
+
12
+ /**
13
+ * Class ConnectTokenFactory
14
+ *
15
+ * @package LiveChat\Services\Factories
16
+ */
17
+ class ConnectTokenFactory {
18
+ /**
19
+ * Returns new instance of ConnectToken.
20
+ *
21
+ * @return ConnectToken
22
+ */
23
+ public function create() {
24
+ return new ConnectToken();
25
+ }
26
+
27
+ /**
28
+ * Returns new instance of ConnectTokenFactory.
29
+ *
30
+ * @return static
31
+ */
32
+ public static function get_instance() {
33
+ return new static();
34
+ }
35
+ }
plugin_files/Services/TokenValidator.class.php CHANGED
@@ -10,6 +10,7 @@ namespace LiveChat\Services;
10
  use Exception;
11
  use LiveChat\Exceptions\ApiClientException;
12
  use LiveChat\Exceptions\InvalidTokenException;
 
13
 
14
  /**
15
  * Class TokenValidator
@@ -23,15 +24,24 @@ class TokenValidator {
23
  *
24
  * @var string|null
25
  */
26
- private $cert_provider = null;
 
 
 
 
 
 
 
27
 
28
  /**
29
  * ConnectTokenProvider constructor.
30
  *
31
- * @param CertProvider $cert_provider Instance of CertProvider.
 
32
  */
33
- public function __construct( $cert_provider ) {
34
- $this->cert_provider = $cert_provider;
 
35
  }
36
 
37
  /**
@@ -43,14 +53,16 @@ class TokenValidator {
43
  * @return ConnectToken|null
44
  */
45
  private function validate_jwt_token( $token, $allow_expired = false ) {
 
 
46
  try {
47
- return ConnectToken::load(
48
  $token,
49
  $this->cert_provider->get_stored_cert()
50
  );
51
  } catch ( Exception $exception ) {
52
  if ( $allow_expired && 'Expired token' === $exception->getMessage() ) {
53
- return ConnectToken::decode(
54
  $token
55
  );
56
  }
@@ -109,11 +121,14 @@ class TokenValidator {
109
  /**
110
  * Returns new instance of TokenValidator
111
  *
112
- * @param CertProvider $cert_provider CertProvider instance.
113
  *
114
  * @return TokenValidator
115
  */
116
- public static function create( $cert_provider ) {
117
- return new static( $cert_provider );
 
 
 
118
  }
119
  }
10
  use Exception;
11
  use LiveChat\Exceptions\ApiClientException;
12
  use LiveChat\Exceptions\InvalidTokenException;
13
+ use LiveChat\Services\Factories\ConnectTokenFactory;
14
 
15
  /**
16
  * Class TokenValidator
24
  *
25
  * @var string|null
26
  */
27
+ private $cert_provider;
28
+
29
+ /**
30
+ * Instance of ConnectTokenFactory.
31
+ *
32
+ * @var ConnectTokenFactory
33
+ */
34
+ private $connect_token_factory;
35
 
36
  /**
37
  * ConnectTokenProvider constructor.
38
  *
39
+ * @param CertProvider $cert_provider Instance of CertProvider.
40
+ * @param ConnectTokenFactory $connect_token_factory Instance of ConnectTokenFactory.
41
  */
42
+ public function __construct( $cert_provider, $connect_token_factory ) {
43
+ $this->cert_provider = $cert_provider;
44
+ $this->connect_token_factory = $connect_token_factory;
45
  }
46
 
47
  /**
53
  * @return ConnectToken|null
54
  */
55
  private function validate_jwt_token( $token, $allow_expired = false ) {
56
+ $connect_token = $this->connect_token_factory->create();
57
+
58
  try {
59
+ return $connect_token->load(
60
  $token,
61
  $this->cert_provider->get_stored_cert()
62
  );
63
  } catch ( Exception $exception ) {
64
  if ( $allow_expired && 'Expired token' === $exception->getMessage() ) {
65
+ return $connect_token->decode(
66
  $token
67
  );
68
  }
121
  /**
122
  * Returns new instance of TokenValidator
123
  *
124
+ * @param CertProvider|null $cert_provider CertProvider instance.
125
  *
126
  * @return TokenValidator
127
  */
128
+ public static function create( $cert_provider = null ) {
129
+ return new static(
130
+ $cert_provider ? $cert_provider : CertProvider::create(),
131
+ ConnectTokenFactory::get_instance()
132
+ );
133
  }
134
  }
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.4
5
  Requires PHP: 5.6
6
  Tested up to: 5.7
7
  Requires at least: 4.4
@@ -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.4 =
356
  * asynchronous chat widget loading
357
  * support for the new admin notices mechanism
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.5
5
  Requires PHP: 5.6
6
  Tested up to: 5.7
7
  Requires at least: 4.4
352
 
353
  == Changelog ==
354
 
355
+ = 4.4.5 =
356
+ * bug fixes
357
+
358
  = 4.4.4 =
359
  * asynchronous chat widget loading
360
  * support for the new admin notices mechanism
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
- return ComposerAutoloaderInita679062790a12b21d3b8605f99cd1fb8::getLoader();
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInit8e5b12f916df6f14624e4607a4ac0157::getLoader();
vendor/composer/autoload_classmap.php CHANGED
@@ -27,6 +27,7 @@ return array(
27
  'LiveChat\\Services\\ConnectTokenTest' => $baseDir . '/plugin_files/tests/services/ConnectTokenTest.class.php',
28
  'LiveChat\\Services\\DeactivationModalTest' => $baseDir . '/plugin_files/tests/services/notifications/DeactivationModalTest.class.php',
29
  'LiveChat\\Services\\Factories\\ApiClientFactory' => $baseDir . '/plugin_files/Services/Factories/ApiClientFactory.class.php',
 
30
  'LiveChat\\Services\\Factories\\ConnectTokenProviderFactory' => $baseDir . '/plugin_files/Services/Factories/ConnectTokenProviderFactory.class.php',
31
  'LiveChat\\Services\\Factories\\UrlProviderFactory' => $baseDir . '/plugin_files/Services/Factories/UrlProviderFactory.class.php',
32
  'LiveChat\\Services\\LicenseProvider' => $baseDir . '/plugin_files/Services/LicenseProvider.class.php',
27
  'LiveChat\\Services\\ConnectTokenTest' => $baseDir . '/plugin_files/tests/services/ConnectTokenTest.class.php',
28
  'LiveChat\\Services\\DeactivationModalTest' => $baseDir . '/plugin_files/tests/services/notifications/DeactivationModalTest.class.php',
29
  'LiveChat\\Services\\Factories\\ApiClientFactory' => $baseDir . '/plugin_files/Services/Factories/ApiClientFactory.class.php',
30
+ 'LiveChat\\Services\\Factories\\ConnectTokenFactory' => $baseDir . '/plugin_files/Services/Factories/ConnectTokenFactory.class.php',
31
  'LiveChat\\Services\\Factories\\ConnectTokenProviderFactory' => $baseDir . '/plugin_files/Services/Factories/ConnectTokenProviderFactory.class.php',
32
  'LiveChat\\Services\\Factories\\UrlProviderFactory' => $baseDir . '/plugin_files/Services/Factories/UrlProviderFactory.class.php',
33
  'LiveChat\\Services\\LicenseProvider' => $baseDir . '/plugin_files/Services/LicenseProvider.class.php',
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInita679062790a12b21d3b8605f99cd1fb8
6
  {
7
  private static $loader;
8
 
@@ -22,15 +22,15 @@ class ComposerAutoloaderInita679062790a12b21d3b8605f99cd1fb8
22
  return self::$loader;
23
  }
24
 
25
- spl_autoload_register(array('ComposerAutoloaderInita679062790a12b21d3b8605f99cd1fb8', 'loadClassLoader'), true, true);
26
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
27
- spl_autoload_unregister(array('ComposerAutoloaderInita679062790a12b21d3b8605f99cd1fb8', '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\ComposerStaticInita679062790a12b21d3b8605f99cd1fb8::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 ComposerAutoloaderInit8e5b12f916df6f14624e4607a4ac0157
6
  {
7
  private static $loader;
8
 
22
  return self::$loader;
23
  }
24
 
25
+ spl_autoload_register(array('ComposerAutoloaderInit8e5b12f916df6f14624e4607a4ac0157', 'loadClassLoader'), true, true);
26
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
27
+ spl_autoload_unregister(array('ComposerAutoloaderInit8e5b12f916df6f14624e4607a4ac0157', '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\ComposerStaticInit8e5b12f916df6f14624e4607a4ac0157::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 ComposerStaticInita679062790a12b21d3b8605f99cd1fb8
8
  {
9
  public static $prefixLengthsPsr4 = array (
10
  'L' =>
@@ -50,6 +50,7 @@ class ComposerStaticInita679062790a12b21d3b8605f99cd1fb8
50
  'LiveChat\\Services\\ConnectTokenTest' => __DIR__ . '/../..' . '/plugin_files/tests/services/ConnectTokenTest.class.php',
51
  'LiveChat\\Services\\DeactivationModalTest' => __DIR__ . '/../..' . '/plugin_files/tests/services/notifications/DeactivationModalTest.class.php',
52
  'LiveChat\\Services\\Factories\\ApiClientFactory' => __DIR__ . '/../..' . '/plugin_files/Services/Factories/ApiClientFactory.class.php',
 
53
  'LiveChat\\Services\\Factories\\ConnectTokenProviderFactory' => __DIR__ . '/../..' . '/plugin_files/Services/Factories/ConnectTokenProviderFactory.class.php',
54
  'LiveChat\\Services\\Factories\\UrlProviderFactory' => __DIR__ . '/../..' . '/plugin_files/Services/Factories/UrlProviderFactory.class.php',
55
  'LiveChat\\Services\\LicenseProvider' => __DIR__ . '/../..' . '/plugin_files/Services/LicenseProvider.class.php',
@@ -155,9 +156,9 @@ class ComposerStaticInita679062790a12b21d3b8605f99cd1fb8
155
  public static function getInitializer(ClassLoader $loader)
156
  {
157
  return \Closure::bind(function () use ($loader) {
158
- $loader->prefixLengthsPsr4 = ComposerStaticInita679062790a12b21d3b8605f99cd1fb8::$prefixLengthsPsr4;
159
- $loader->prefixDirsPsr4 = ComposerStaticInita679062790a12b21d3b8605f99cd1fb8::$prefixDirsPsr4;
160
- $loader->classMap = ComposerStaticInita679062790a12b21d3b8605f99cd1fb8::$classMap;
161
 
162
  }, null, ClassLoader::class);
163
  }
4
 
5
  namespace Composer\Autoload;
6
 
7
+ class ComposerStaticInit8e5b12f916df6f14624e4607a4ac0157
8
  {
9
  public static $prefixLengthsPsr4 = array (
10
  'L' =>
50
  'LiveChat\\Services\\ConnectTokenTest' => __DIR__ . '/../..' . '/plugin_files/tests/services/ConnectTokenTest.class.php',
51
  'LiveChat\\Services\\DeactivationModalTest' => __DIR__ . '/../..' . '/plugin_files/tests/services/notifications/DeactivationModalTest.class.php',
52
  'LiveChat\\Services\\Factories\\ApiClientFactory' => __DIR__ . '/../..' . '/plugin_files/Services/Factories/ApiClientFactory.class.php',
53
+ 'LiveChat\\Services\\Factories\\ConnectTokenFactory' => __DIR__ . '/../..' . '/plugin_files/Services/Factories/ConnectTokenFactory.class.php',
54
  'LiveChat\\Services\\Factories\\ConnectTokenProviderFactory' => __DIR__ . '/../..' . '/plugin_files/Services/Factories/ConnectTokenProviderFactory.class.php',
55
  'LiveChat\\Services\\Factories\\UrlProviderFactory' => __DIR__ . '/../..' . '/plugin_files/Services/Factories/UrlProviderFactory.class.php',
56
  'LiveChat\\Services\\LicenseProvider' => __DIR__ . '/../..' . '/plugin_files/Services/LicenseProvider.class.php',
156
  public static function getInitializer(ClassLoader $loader)
157
  {
158
  return \Closure::bind(function () use ($loader) {
159
+ $loader->prefixLengthsPsr4 = ComposerStaticInit8e5b12f916df6f14624e4607a4ac0157::$prefixLengthsPsr4;
160
+ $loader->prefixDirsPsr4 = ComposerStaticInit8e5b12f916df6f14624e4607a4ac0157::$prefixDirsPsr4;
161
+ $loader->classMap = ComposerStaticInit8e5b12f916df6f14624e4607a4ac0157::$classMap;
162
 
163
  }, null, ClassLoader::class);
164
  }