Version Description
- bug fixes
Download this release
Release Info
Developer | livechat |
Plugin | LiveChat – WP live chat plugin for WordPress |
Version | 4.1.3 |
Comparing to | |
See all releases |
Code changes from version 4.1.2 to 4.1.3
- changelog.txt +11 -2
- composer.lock +136 -123
- livechat.php +1 -1
- plugin_files/Helpers/DeactivationFeedbackFormHelper.class.php +1 -1
- plugin_files/LiveChat.class.php +16 -16
- plugin_files/LiveChatAdmin.class.php +75 -117
- plugin_files/Services/User.class.php +7 -0
- plugin_files/css/livechat-menu.css +4 -0
- plugin_files/js/livechat.js +18 -8
- plugin_files/templates/connect.html.twig +37 -8
- readme.txt +9 -6
- vendor/autoload.php +1 -1
- vendor/composer/autoload_real.php +4 -4
- vendor/composer/autoload_static.php +4 -4
- vendor/composer/installed.json +12 -8
- vendor/firebase/php-jwt/README.md +4 -4
- vendor/firebase/php-jwt/composer.json +5 -1
- vendor/firebase/php-jwt/src/BeforeValidException.php +0 -1
- vendor/firebase/php-jwt/src/ExpiredException.php +0 -1
- vendor/firebase/php-jwt/src/JWK.php +171 -0
- vendor/firebase/php-jwt/src/JWT.php +180 -47
- vendor/firebase/php-jwt/src/SignatureInvalidException.php +0 -1
changelog.txt
CHANGED
@@ -1,10 +1,19 @@
|
|
1 |
== Changelog ==
|
2 |
|
3 |
-
= 4.1.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
* 'Resources' section added
|
5 |
* bug fixes
|
6 |
|
7 |
-
= 4.0.0
|
8 |
* revised in-admin signup/login page view
|
9 |
* introducing a new way of creating accounts in LiveChat
|
10 |
* added the possibility of creating or logging into a LiveChat account to all users in WordPress
|
1 |
== Changelog ==
|
2 |
|
3 |
+
= 4.1.3 =
|
4 |
+
* bug fixes
|
5 |
+
|
6 |
+
= 4.1.2 =
|
7 |
+
* CSS improvements
|
8 |
+
|
9 |
+
= 4.1.1 =
|
10 |
+
* bug fixes
|
11 |
+
|
12 |
+
= 4.1.0 =
|
13 |
* 'Resources' section added
|
14 |
* bug fixes
|
15 |
|
16 |
+
= 4.0.0 =
|
17 |
* revised in-admin signup/login page view
|
18 |
* introducing a new way of creating accounts in LiveChat
|
19 |
* added the possibility of creating or logging into a LiveChat account to all users in WordPress
|
composer.lock
CHANGED
@@ -8,23 +8,23 @@
|
|
8 |
"packages": [
|
9 |
{
|
10 |
"name": "firebase/php-jwt",
|
11 |
-
"version": "v5.
|
12 |
"source": {
|
13 |
"type": "git",
|
14 |
"url": "https://github.com/firebase/php-jwt.git",
|
15 |
-
"reference": "
|
16 |
},
|
17 |
"dist": {
|
18 |
"type": "zip",
|
19 |
-
"url": "https://api.github.com/repos/firebase/php-jwt/zipball/
|
20 |
-
"reference": "
|
21 |
"shasum": ""
|
22 |
},
|
23 |
"require": {
|
24 |
"php": ">=5.3.0"
|
25 |
},
|
26 |
"require-dev": {
|
27 |
-
"phpunit/phpunit": "
|
28 |
},
|
29 |
"type": "library",
|
30 |
"autoload": {
|
@@ -50,22 +50,26 @@
|
|
50 |
],
|
51 |
"description": "A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec.",
|
52 |
"homepage": "https://github.com/firebase/php-jwt",
|
53 |
-
"
|
|
|
|
|
|
|
|
|
54 |
}
|
55 |
],
|
56 |
"packages-dev": [
|
57 |
{
|
58 |
"name": "antecedent/patchwork",
|
59 |
-
"version": "2.1.
|
60 |
"source": {
|
61 |
"type": "git",
|
62 |
"url": "https://github.com/antecedent/patchwork.git",
|
63 |
-
"reference": "
|
64 |
},
|
65 |
"dist": {
|
66 |
"type": "zip",
|
67 |
-
"url": "https://api.github.com/repos/antecedent/patchwork/zipball/
|
68 |
-
"reference": "
|
69 |
"shasum": ""
|
70 |
},
|
71 |
"require": {
|
@@ -96,7 +100,7 @@
|
|
96 |
"runkit",
|
97 |
"testing"
|
98 |
],
|
99 |
-
"time": "2019-
|
100 |
},
|
101 |
{
|
102 |
"name": "brain/monkey",
|
@@ -232,32 +236,34 @@
|
|
232 |
},
|
233 |
{
|
234 |
"name": "doctrine/instantiator",
|
235 |
-
"version": "1.0
|
236 |
"source": {
|
237 |
"type": "git",
|
238 |
"url": "https://github.com/doctrine/instantiator.git",
|
239 |
-
"reference": "
|
240 |
},
|
241 |
"dist": {
|
242 |
"type": "zip",
|
243 |
-
"url": "https://api.github.com/repos/doctrine/instantiator/zipball/
|
244 |
-
"reference": "
|
245 |
"shasum": ""
|
246 |
},
|
247 |
"require": {
|
248 |
-
"php": "
|
249 |
},
|
250 |
"require-dev": {
|
251 |
-
"
|
252 |
"ext-pdo": "*",
|
253 |
"ext-phar": "*",
|
254 |
-
"
|
255 |
-
"
|
|
|
|
|
256 |
},
|
257 |
"type": "library",
|
258 |
"extra": {
|
259 |
"branch-alias": {
|
260 |
-
"dev-master": "1.
|
261 |
}
|
262 |
},
|
263 |
"autoload": {
|
@@ -277,12 +283,12 @@
|
|
277 |
}
|
278 |
],
|
279 |
"description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors",
|
280 |
-
"homepage": "https://
|
281 |
"keywords": [
|
282 |
"constructor",
|
283 |
"instantiate"
|
284 |
],
|
285 |
-
"time": "
|
286 |
},
|
287 |
{
|
288 |
"name": "hamcrest/hamcrest-php",
|
@@ -334,23 +340,22 @@
|
|
334 |
},
|
335 |
{
|
336 |
"name": "mockery/mockery",
|
337 |
-
"version": "1.3.
|
338 |
"source": {
|
339 |
"type": "git",
|
340 |
"url": "https://github.com/mockery/mockery.git",
|
341 |
-
"reference": "
|
342 |
},
|
343 |
"dist": {
|
344 |
"type": "zip",
|
345 |
-
"url": "https://api.github.com/repos/mockery/mockery/zipball/
|
346 |
-
"reference": "
|
347 |
"shasum": ""
|
348 |
},
|
349 |
"require": {
|
350 |
"hamcrest/hamcrest-php": "~2.0",
|
351 |
"lib-pcre": ">=7.0",
|
352 |
-
"php": ">=5.6.0"
|
353 |
-
"sebastian/comparator": "^1.2.4|^3.0"
|
354 |
},
|
355 |
"require-dev": {
|
356 |
"phpunit/phpunit": "~5.7.10|~6.5|~7.0|~8.0"
|
@@ -358,7 +363,7 @@
|
|
358 |
"type": "library",
|
359 |
"extra": {
|
360 |
"branch-alias": {
|
361 |
-
"dev-master": "1.
|
362 |
}
|
363 |
},
|
364 |
"autoload": {
|
@@ -396,29 +401,32 @@
|
|
396 |
"test double",
|
397 |
"testing"
|
398 |
],
|
399 |
-
"time": "2019-
|
400 |
},
|
401 |
{
|
402 |
"name": "myclabs/deep-copy",
|
403 |
-
"version": "1.
|
404 |
"source": {
|
405 |
"type": "git",
|
406 |
"url": "https://github.com/myclabs/DeepCopy.git",
|
407 |
-
"reference": "
|
408 |
},
|
409 |
"dist": {
|
410 |
"type": "zip",
|
411 |
-
"url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/
|
412 |
-
"reference": "
|
413 |
"shasum": ""
|
414 |
},
|
415 |
"require": {
|
416 |
-
"php": "^
|
|
|
|
|
|
|
417 |
},
|
418 |
"require-dev": {
|
419 |
"doctrine/collections": "^1.0",
|
420 |
"doctrine/common": "^2.6",
|
421 |
-
"phpunit/phpunit": "^
|
422 |
},
|
423 |
"type": "library",
|
424 |
"autoload": {
|
@@ -441,39 +449,37 @@
|
|
441 |
"object",
|
442 |
"object graph"
|
443 |
],
|
444 |
-
"time": "
|
445 |
},
|
446 |
{
|
447 |
"name": "phpdocumentor/reflection-common",
|
448 |
-
"version": "
|
449 |
"source": {
|
450 |
"type": "git",
|
451 |
"url": "https://github.com/phpDocumentor/ReflectionCommon.git",
|
452 |
-
"reference": "
|
453 |
},
|
454 |
"dist": {
|
455 |
"type": "zip",
|
456 |
-
"url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/
|
457 |
-
"reference": "
|
458 |
"shasum": ""
|
459 |
},
|
460 |
"require": {
|
461 |
-
"php": ">=
|
462 |
},
|
463 |
"require-dev": {
|
464 |
-
"phpunit/phpunit": "
|
465 |
},
|
466 |
"type": "library",
|
467 |
"extra": {
|
468 |
"branch-alias": {
|
469 |
-
"dev-master": "
|
470 |
}
|
471 |
},
|
472 |
"autoload": {
|
473 |
"psr-4": {
|
474 |
-
"phpDocumentor\\Reflection\\":
|
475 |
-
"src"
|
476 |
-
]
|
477 |
}
|
478 |
},
|
479 |
"notification-url": "https://packagist.org/downloads/",
|
@@ -495,38 +501,42 @@
|
|
495 |
"reflection",
|
496 |
"static analysis"
|
497 |
],
|
498 |
-
"time": "
|
499 |
},
|
500 |
{
|
501 |
"name": "phpdocumentor/reflection-docblock",
|
502 |
-
"version": "
|
503 |
"source": {
|
504 |
"type": "git",
|
505 |
"url": "https://github.com/phpDocumentor/ReflectionDocBlock.git",
|
506 |
-
"reference": "
|
507 |
},
|
508 |
"dist": {
|
509 |
"type": "zip",
|
510 |
-
"url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/
|
511 |
-
"reference": "
|
512 |
"shasum": ""
|
513 |
},
|
514 |
"require": {
|
515 |
-
"
|
516 |
-
"
|
517 |
-
"phpdocumentor/
|
518 |
-
"
|
|
|
519 |
},
|
520 |
"require-dev": {
|
521 |
-
"
|
522 |
-
"
|
523 |
},
|
524 |
"type": "library",
|
|
|
|
|
|
|
|
|
|
|
525 |
"autoload": {
|
526 |
"psr-4": {
|
527 |
-
"phpDocumentor\\Reflection\\":
|
528 |
-
"src/"
|
529 |
-
]
|
530 |
}
|
531 |
},
|
532 |
"notification-url": "https://packagist.org/downloads/",
|
@@ -537,44 +547,46 @@
|
|
537 |
{
|
538 |
"name": "Mike van Riel",
|
539 |
"email": "me@mikevanriel.com"
|
|
|
|
|
|
|
|
|
540 |
}
|
541 |
],
|
542 |
"description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.",
|
543 |
-
"time": "
|
544 |
},
|
545 |
{
|
546 |
"name": "phpdocumentor/type-resolver",
|
547 |
-
"version": "
|
548 |
"source": {
|
549 |
"type": "git",
|
550 |
"url": "https://github.com/phpDocumentor/TypeResolver.git",
|
551 |
-
"reference": "
|
552 |
},
|
553 |
"dist": {
|
554 |
"type": "zip",
|
555 |
-
"url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/
|
556 |
-
"reference": "
|
557 |
"shasum": ""
|
558 |
},
|
559 |
"require": {
|
560 |
-
"php": "^
|
561 |
-
"phpdocumentor/reflection-common": "^
|
562 |
},
|
563 |
"require-dev": {
|
564 |
-
"
|
565 |
-
"
|
566 |
},
|
567 |
"type": "library",
|
568 |
"extra": {
|
569 |
"branch-alias": {
|
570 |
-
"dev-master": "1.
|
571 |
}
|
572 |
},
|
573 |
"autoload": {
|
574 |
"psr-4": {
|
575 |
-
"phpDocumentor\\Reflection\\":
|
576 |
-
"src/"
|
577 |
-
]
|
578 |
}
|
579 |
},
|
580 |
"notification-url": "https://packagist.org/downloads/",
|
@@ -587,37 +599,38 @@
|
|
587 |
"email": "me@mikevanriel.com"
|
588 |
}
|
589 |
],
|
590 |
-
"
|
|
|
591 |
},
|
592 |
{
|
593 |
"name": "phpspec/prophecy",
|
594 |
-
"version": "
|
595 |
"source": {
|
596 |
"type": "git",
|
597 |
"url": "https://github.com/phpspec/prophecy.git",
|
598 |
-
"reference": "
|
599 |
},
|
600 |
"dist": {
|
601 |
"type": "zip",
|
602 |
-
"url": "https://api.github.com/repos/phpspec/prophecy/zipball/
|
603 |
-
"reference": "
|
604 |
"shasum": ""
|
605 |
},
|
606 |
"require": {
|
607 |
"doctrine/instantiator": "^1.0.2",
|
608 |
"php": "^5.3|^7.0",
|
609 |
"phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0|^5.0",
|
610 |
-
"sebastian/comparator": "^1.
|
611 |
-
"sebastian/recursion-context": "^1.0|^2.0|^3.0"
|
612 |
},
|
613 |
"require-dev": {
|
614 |
-
"phpspec/phpspec": "^2.5
|
615 |
"phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1"
|
616 |
},
|
617 |
"type": "library",
|
618 |
"extra": {
|
619 |
"branch-alias": {
|
620 |
-
"dev-master": "1.
|
621 |
}
|
622 |
},
|
623 |
"autoload": {
|
@@ -650,7 +663,7 @@
|
|
650 |
"spy",
|
651 |
"stub"
|
652 |
],
|
653 |
-
"time": "
|
654 |
},
|
655 |
{
|
656 |
"name": "phpunit/php-code-coverage",
|
@@ -854,29 +867,29 @@
|
|
854 |
},
|
855 |
{
|
856 |
"name": "phpunit/php-token-stream",
|
857 |
-
"version": "
|
858 |
"source": {
|
859 |
"type": "git",
|
860 |
"url": "https://github.com/sebastianbergmann/php-token-stream.git",
|
861 |
-
"reference": "
|
862 |
},
|
863 |
"dist": {
|
864 |
"type": "zip",
|
865 |
-
"url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/
|
866 |
-
"reference": "
|
867 |
"shasum": ""
|
868 |
},
|
869 |
"require": {
|
870 |
"ext-tokenizer": "*",
|
871 |
-
"php": "
|
872 |
},
|
873 |
"require-dev": {
|
874 |
-
"phpunit/phpunit": "
|
875 |
},
|
876 |
"type": "library",
|
877 |
"extra": {
|
878 |
"branch-alias": {
|
879 |
-
"dev-master": "
|
880 |
}
|
881 |
},
|
882 |
"autoload": {
|
@@ -899,7 +912,7 @@
|
|
899 |
"keywords": [
|
900 |
"tokenizer"
|
901 |
],
|
902 |
-
"time": "2017-
|
903 |
},
|
904 |
{
|
905 |
"name": "phpunit/phpunit",
|
@@ -1558,16 +1571,16 @@
|
|
1558 |
},
|
1559 |
{
|
1560 |
"name": "squizlabs/php_codesniffer",
|
1561 |
-
"version": "3.5.
|
1562 |
"source": {
|
1563 |
"type": "git",
|
1564 |
"url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
|
1565 |
-
"reference": "
|
1566 |
},
|
1567 |
"dist": {
|
1568 |
"type": "zip",
|
1569 |
-
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/
|
1570 |
-
"reference": "
|
1571 |
"shasum": ""
|
1572 |
},
|
1573 |
"require": {
|
@@ -1605,20 +1618,20 @@
|
|
1605 |
"phpcs",
|
1606 |
"standards"
|
1607 |
],
|
1608 |
-
"time": "
|
1609 |
},
|
1610 |
{
|
1611 |
"name": "symfony/polyfill-ctype",
|
1612 |
-
"version": "v1.
|
1613 |
"source": {
|
1614 |
"type": "git",
|
1615 |
"url": "https://github.com/symfony/polyfill-ctype.git",
|
1616 |
-
"reference": "
|
1617 |
},
|
1618 |
"dist": {
|
1619 |
"type": "zip",
|
1620 |
-
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/
|
1621 |
-
"reference": "
|
1622 |
"shasum": ""
|
1623 |
},
|
1624 |
"require": {
|
@@ -1630,7 +1643,7 @@
|
|
1630 |
"type": "library",
|
1631 |
"extra": {
|
1632 |
"branch-alias": {
|
1633 |
-
"dev-master": "1.
|
1634 |
}
|
1635 |
},
|
1636 |
"autoload": {
|
@@ -1663,31 +1676,31 @@
|
|
1663 |
"polyfill",
|
1664 |
"portable"
|
1665 |
],
|
1666 |
-
"time": "
|
1667 |
},
|
1668 |
{
|
1669 |
"name": "symfony/yaml",
|
1670 |
-
"version": "
|
1671 |
"source": {
|
1672 |
"type": "git",
|
1673 |
"url": "https://github.com/symfony/yaml.git",
|
1674 |
-
"reference": "
|
1675 |
},
|
1676 |
"dist": {
|
1677 |
"type": "zip",
|
1678 |
-
"url": "https://api.github.com/repos/symfony/yaml/zipball/
|
1679 |
-
"reference": "
|
1680 |
"shasum": ""
|
1681 |
},
|
1682 |
"require": {
|
1683 |
-
"php": "^
|
1684 |
"symfony/polyfill-ctype": "~1.8"
|
1685 |
},
|
1686 |
"conflict": {
|
1687 |
"symfony/console": "<3.4"
|
1688 |
},
|
1689 |
"require-dev": {
|
1690 |
-
"symfony/console": "
|
1691 |
},
|
1692 |
"suggest": {
|
1693 |
"symfony/console": "For validating YAML files using the lint command"
|
@@ -1695,7 +1708,7 @@
|
|
1695 |
"type": "library",
|
1696 |
"extra": {
|
1697 |
"branch-alias": {
|
1698 |
-
"dev-master": "
|
1699 |
}
|
1700 |
},
|
1701 |
"autoload": {
|
@@ -1722,20 +1735,20 @@
|
|
1722 |
],
|
1723 |
"description": "Symfony Yaml Component",
|
1724 |
"homepage": "https://symfony.com",
|
1725 |
-
"time": "
|
1726 |
},
|
1727 |
{
|
1728 |
"name": "webmozart/assert",
|
1729 |
-
"version": "1.
|
1730 |
"source": {
|
1731 |
"type": "git",
|
1732 |
"url": "https://github.com/webmozart/assert.git",
|
1733 |
-
"reference": "
|
1734 |
},
|
1735 |
"dist": {
|
1736 |
"type": "zip",
|
1737 |
-
"url": "https://api.github.com/repos/webmozart/assert/zipball/
|
1738 |
-
"reference": "
|
1739 |
"shasum": ""
|
1740 |
},
|
1741 |
"require": {
|
@@ -1770,20 +1783,20 @@
|
|
1770 |
"check",
|
1771 |
"validate"
|
1772 |
],
|
1773 |
-
"time": "
|
1774 |
},
|
1775 |
{
|
1776 |
"name": "wp-coding-standards/wpcs",
|
1777 |
-
"version": "2.2.
|
1778 |
"source": {
|
1779 |
"type": "git",
|
1780 |
"url": "https://github.com/WordPress/WordPress-Coding-Standards.git",
|
1781 |
-
"reference": "
|
1782 |
},
|
1783 |
"dist": {
|
1784 |
"type": "zip",
|
1785 |
-
"url": "https://api.github.com/repos/WordPress/WordPress-Coding-Standards/zipball/
|
1786 |
-
"reference": "
|
1787 |
"shasum": ""
|
1788 |
},
|
1789 |
"require": {
|
@@ -1791,12 +1804,12 @@
|
|
1791 |
"squizlabs/php_codesniffer": "^3.3.1"
|
1792 |
},
|
1793 |
"require-dev": {
|
1794 |
-
"dealerdirect/phpcodesniffer-composer-installer": "^0.5.
|
1795 |
"phpcompatibility/php-compatibility": "^9.0",
|
1796 |
"phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0"
|
1797 |
},
|
1798 |
"suggest": {
|
1799 |
-
"dealerdirect/phpcodesniffer-composer-installer": "^0.
|
1800 |
},
|
1801 |
"type": "phpcodesniffer-standard",
|
1802 |
"notification-url": "https://packagist.org/downloads/",
|
@@ -1815,7 +1828,7 @@
|
|
1815 |
"standards",
|
1816 |
"wordpress"
|
1817 |
],
|
1818 |
-
"time": "
|
1819 |
}
|
1820 |
],
|
1821 |
"aliases": [],
|
8 |
"packages": [
|
9 |
{
|
10 |
"name": "firebase/php-jwt",
|
11 |
+
"version": "v5.2.0",
|
12 |
"source": {
|
13 |
"type": "git",
|
14 |
"url": "https://github.com/firebase/php-jwt.git",
|
15 |
+
"reference": "feb0e820b8436873675fd3aca04f3728eb2185cb"
|
16 |
},
|
17 |
"dist": {
|
18 |
"type": "zip",
|
19 |
+
"url": "https://api.github.com/repos/firebase/php-jwt/zipball/feb0e820b8436873675fd3aca04f3728eb2185cb",
|
20 |
+
"reference": "feb0e820b8436873675fd3aca04f3728eb2185cb",
|
21 |
"shasum": ""
|
22 |
},
|
23 |
"require": {
|
24 |
"php": ">=5.3.0"
|
25 |
},
|
26 |
"require-dev": {
|
27 |
+
"phpunit/phpunit": ">=4.8 <=9"
|
28 |
},
|
29 |
"type": "library",
|
30 |
"autoload": {
|
50 |
],
|
51 |
"description": "A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec.",
|
52 |
"homepage": "https://github.com/firebase/php-jwt",
|
53 |
+
"keywords": [
|
54 |
+
"jwt",
|
55 |
+
"php"
|
56 |
+
],
|
57 |
+
"time": "2020-03-25T18:49:23+00:00"
|
58 |
}
|
59 |
],
|
60 |
"packages-dev": [
|
61 |
{
|
62 |
"name": "antecedent/patchwork",
|
63 |
+
"version": "2.1.12",
|
64 |
"source": {
|
65 |
"type": "git",
|
66 |
"url": "https://github.com/antecedent/patchwork.git",
|
67 |
+
"reference": "b98e046dd4c0acc34a0846604f06f6111654d9ea"
|
68 |
},
|
69 |
"dist": {
|
70 |
"type": "zip",
|
71 |
+
"url": "https://api.github.com/repos/antecedent/patchwork/zipball/b98e046dd4c0acc34a0846604f06f6111654d9ea",
|
72 |
+
"reference": "b98e046dd4c0acc34a0846604f06f6111654d9ea",
|
73 |
"shasum": ""
|
74 |
},
|
75 |
"require": {
|
100 |
"runkit",
|
101 |
"testing"
|
102 |
],
|
103 |
+
"time": "2019-12-22T17:52:09+00:00"
|
104 |
},
|
105 |
{
|
106 |
"name": "brain/monkey",
|
236 |
},
|
237 |
{
|
238 |
"name": "doctrine/instantiator",
|
239 |
+
"version": "1.3.0",
|
240 |
"source": {
|
241 |
"type": "git",
|
242 |
"url": "https://github.com/doctrine/instantiator.git",
|
243 |
+
"reference": "ae466f726242e637cebdd526a7d991b9433bacf1"
|
244 |
},
|
245 |
"dist": {
|
246 |
"type": "zip",
|
247 |
+
"url": "https://api.github.com/repos/doctrine/instantiator/zipball/ae466f726242e637cebdd526a7d991b9433bacf1",
|
248 |
+
"reference": "ae466f726242e637cebdd526a7d991b9433bacf1",
|
249 |
"shasum": ""
|
250 |
},
|
251 |
"require": {
|
252 |
+
"php": "^7.1"
|
253 |
},
|
254 |
"require-dev": {
|
255 |
+
"doctrine/coding-standard": "^6.0",
|
256 |
"ext-pdo": "*",
|
257 |
"ext-phar": "*",
|
258 |
+
"phpbench/phpbench": "^0.13",
|
259 |
+
"phpstan/phpstan-phpunit": "^0.11",
|
260 |
+
"phpstan/phpstan-shim": "^0.11",
|
261 |
+
"phpunit/phpunit": "^7.0"
|
262 |
},
|
263 |
"type": "library",
|
264 |
"extra": {
|
265 |
"branch-alias": {
|
266 |
+
"dev-master": "1.2.x-dev"
|
267 |
}
|
268 |
},
|
269 |
"autoload": {
|
283 |
}
|
284 |
],
|
285 |
"description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors",
|
286 |
+
"homepage": "https://www.doctrine-project.org/projects/instantiator.html",
|
287 |
"keywords": [
|
288 |
"constructor",
|
289 |
"instantiate"
|
290 |
],
|
291 |
+
"time": "2019-10-21T16:45:58+00:00"
|
292 |
},
|
293 |
{
|
294 |
"name": "hamcrest/hamcrest-php",
|
340 |
},
|
341 |
{
|
342 |
"name": "mockery/mockery",
|
343 |
+
"version": "1.3.1",
|
344 |
"source": {
|
345 |
"type": "git",
|
346 |
"url": "https://github.com/mockery/mockery.git",
|
347 |
+
"reference": "f69bbde7d7a75d6b2862d9ca8fab1cd28014b4be"
|
348 |
},
|
349 |
"dist": {
|
350 |
"type": "zip",
|
351 |
+
"url": "https://api.github.com/repos/mockery/mockery/zipball/f69bbde7d7a75d6b2862d9ca8fab1cd28014b4be",
|
352 |
+
"reference": "f69bbde7d7a75d6b2862d9ca8fab1cd28014b4be",
|
353 |
"shasum": ""
|
354 |
},
|
355 |
"require": {
|
356 |
"hamcrest/hamcrest-php": "~2.0",
|
357 |
"lib-pcre": ">=7.0",
|
358 |
+
"php": ">=5.6.0"
|
|
|
359 |
},
|
360 |
"require-dev": {
|
361 |
"phpunit/phpunit": "~5.7.10|~6.5|~7.0|~8.0"
|
363 |
"type": "library",
|
364 |
"extra": {
|
365 |
"branch-alias": {
|
366 |
+
"dev-master": "1.3.x-dev"
|
367 |
}
|
368 |
},
|
369 |
"autoload": {
|
401 |
"test double",
|
402 |
"testing"
|
403 |
],
|
404 |
+
"time": "2019-12-26T09:49:15+00:00"
|
405 |
},
|
406 |
{
|
407 |
"name": "myclabs/deep-copy",
|
408 |
+
"version": "1.9.5",
|
409 |
"source": {
|
410 |
"type": "git",
|
411 |
"url": "https://github.com/myclabs/DeepCopy.git",
|
412 |
+
"reference": "b2c28789e80a97badd14145fda39b545d83ca3ef"
|
413 |
},
|
414 |
"dist": {
|
415 |
"type": "zip",
|
416 |
+
"url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/b2c28789e80a97badd14145fda39b545d83ca3ef",
|
417 |
+
"reference": "b2c28789e80a97badd14145fda39b545d83ca3ef",
|
418 |
"shasum": ""
|
419 |
},
|
420 |
"require": {
|
421 |
+
"php": "^7.1"
|
422 |
+
},
|
423 |
+
"replace": {
|
424 |
+
"myclabs/deep-copy": "self.version"
|
425 |
},
|
426 |
"require-dev": {
|
427 |
"doctrine/collections": "^1.0",
|
428 |
"doctrine/common": "^2.6",
|
429 |
+
"phpunit/phpunit": "^7.1"
|
430 |
},
|
431 |
"type": "library",
|
432 |
"autoload": {
|
449 |
"object",
|
450 |
"object graph"
|
451 |
],
|
452 |
+
"time": "2020-01-17T21:11:47+00:00"
|
453 |
},
|
454 |
{
|
455 |
"name": "phpdocumentor/reflection-common",
|
456 |
+
"version": "2.0.0",
|
457 |
"source": {
|
458 |
"type": "git",
|
459 |
"url": "https://github.com/phpDocumentor/ReflectionCommon.git",
|
460 |
+
"reference": "63a995caa1ca9e5590304cd845c15ad6d482a62a"
|
461 |
},
|
462 |
"dist": {
|
463 |
"type": "zip",
|
464 |
+
"url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/63a995caa1ca9e5590304cd845c15ad6d482a62a",
|
465 |
+
"reference": "63a995caa1ca9e5590304cd845c15ad6d482a62a",
|
466 |
"shasum": ""
|
467 |
},
|
468 |
"require": {
|
469 |
+
"php": ">=7.1"
|
470 |
},
|
471 |
"require-dev": {
|
472 |
+
"phpunit/phpunit": "~6"
|
473 |
},
|
474 |
"type": "library",
|
475 |
"extra": {
|
476 |
"branch-alias": {
|
477 |
+
"dev-master": "2.x-dev"
|
478 |
}
|
479 |
},
|
480 |
"autoload": {
|
481 |
"psr-4": {
|
482 |
+
"phpDocumentor\\Reflection\\": "src/"
|
|
|
|
|
483 |
}
|
484 |
},
|
485 |
"notification-url": "https://packagist.org/downloads/",
|
501 |
"reflection",
|
502 |
"static analysis"
|
503 |
],
|
504 |
+
"time": "2018-08-07T13:53:10+00:00"
|
505 |
},
|
506 |
{
|
507 |
"name": "phpdocumentor/reflection-docblock",
|
508 |
+
"version": "5.1.0",
|
509 |
"source": {
|
510 |
"type": "git",
|
511 |
"url": "https://github.com/phpDocumentor/ReflectionDocBlock.git",
|
512 |
+
"reference": "cd72d394ca794d3466a3b2fc09d5a6c1dc86b47e"
|
513 |
},
|
514 |
"dist": {
|
515 |
"type": "zip",
|
516 |
+
"url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/cd72d394ca794d3466a3b2fc09d5a6c1dc86b47e",
|
517 |
+
"reference": "cd72d394ca794d3466a3b2fc09d5a6c1dc86b47e",
|
518 |
"shasum": ""
|
519 |
},
|
520 |
"require": {
|
521 |
+
"ext-filter": "^7.1",
|
522 |
+
"php": "^7.2",
|
523 |
+
"phpdocumentor/reflection-common": "^2.0",
|
524 |
+
"phpdocumentor/type-resolver": "^1.0",
|
525 |
+
"webmozart/assert": "^1"
|
526 |
},
|
527 |
"require-dev": {
|
528 |
+
"doctrine/instantiator": "^1",
|
529 |
+
"mockery/mockery": "^1"
|
530 |
},
|
531 |
"type": "library",
|
532 |
+
"extra": {
|
533 |
+
"branch-alias": {
|
534 |
+
"dev-master": "5.x-dev"
|
535 |
+
}
|
536 |
+
},
|
537 |
"autoload": {
|
538 |
"psr-4": {
|
539 |
+
"phpDocumentor\\Reflection\\": "src"
|
|
|
|
|
540 |
}
|
541 |
},
|
542 |
"notification-url": "https://packagist.org/downloads/",
|
547 |
{
|
548 |
"name": "Mike van Riel",
|
549 |
"email": "me@mikevanriel.com"
|
550 |
+
},
|
551 |
+
{
|
552 |
+
"name": "Jaap van Otterdijk",
|
553 |
+
"email": "account@ijaap.nl"
|
554 |
}
|
555 |
],
|
556 |
"description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.",
|
557 |
+
"time": "2020-02-22T12:28:44+00:00"
|
558 |
},
|
559 |
{
|
560 |
"name": "phpdocumentor/type-resolver",
|
561 |
+
"version": "1.1.0",
|
562 |
"source": {
|
563 |
"type": "git",
|
564 |
"url": "https://github.com/phpDocumentor/TypeResolver.git",
|
565 |
+
"reference": "7462d5f123dfc080dfdf26897032a6513644fc95"
|
566 |
},
|
567 |
"dist": {
|
568 |
"type": "zip",
|
569 |
+
"url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/7462d5f123dfc080dfdf26897032a6513644fc95",
|
570 |
+
"reference": "7462d5f123dfc080dfdf26897032a6513644fc95",
|
571 |
"shasum": ""
|
572 |
},
|
573 |
"require": {
|
574 |
+
"php": "^7.2",
|
575 |
+
"phpdocumentor/reflection-common": "^2.0"
|
576 |
},
|
577 |
"require-dev": {
|
578 |
+
"ext-tokenizer": "^7.2",
|
579 |
+
"mockery/mockery": "~1"
|
580 |
},
|
581 |
"type": "library",
|
582 |
"extra": {
|
583 |
"branch-alias": {
|
584 |
+
"dev-master": "1.x-dev"
|
585 |
}
|
586 |
},
|
587 |
"autoload": {
|
588 |
"psr-4": {
|
589 |
+
"phpDocumentor\\Reflection\\": "src"
|
|
|
|
|
590 |
}
|
591 |
},
|
592 |
"notification-url": "https://packagist.org/downloads/",
|
599 |
"email": "me@mikevanriel.com"
|
600 |
}
|
601 |
],
|
602 |
+
"description": "A PSR-5 based resolver of Class names, Types and Structural Element Names",
|
603 |
+
"time": "2020-02-18T18:59:58+00:00"
|
604 |
},
|
605 |
{
|
606 |
"name": "phpspec/prophecy",
|
607 |
+
"version": "v1.10.3",
|
608 |
"source": {
|
609 |
"type": "git",
|
610 |
"url": "https://github.com/phpspec/prophecy.git",
|
611 |
+
"reference": "451c3cd1418cf640de218914901e51b064abb093"
|
612 |
},
|
613 |
"dist": {
|
614 |
"type": "zip",
|
615 |
+
"url": "https://api.github.com/repos/phpspec/prophecy/zipball/451c3cd1418cf640de218914901e51b064abb093",
|
616 |
+
"reference": "451c3cd1418cf640de218914901e51b064abb093",
|
617 |
"shasum": ""
|
618 |
},
|
619 |
"require": {
|
620 |
"doctrine/instantiator": "^1.0.2",
|
621 |
"php": "^5.3|^7.0",
|
622 |
"phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0|^5.0",
|
623 |
+
"sebastian/comparator": "^1.2.3|^2.0|^3.0|^4.0",
|
624 |
+
"sebastian/recursion-context": "^1.0|^2.0|^3.0|^4.0"
|
625 |
},
|
626 |
"require-dev": {
|
627 |
+
"phpspec/phpspec": "^2.5 || ^3.2",
|
628 |
"phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1"
|
629 |
},
|
630 |
"type": "library",
|
631 |
"extra": {
|
632 |
"branch-alias": {
|
633 |
+
"dev-master": "1.10.x-dev"
|
634 |
}
|
635 |
},
|
636 |
"autoload": {
|
663 |
"spy",
|
664 |
"stub"
|
665 |
],
|
666 |
+
"time": "2020-03-05T15:02:03+00:00"
|
667 |
},
|
668 |
{
|
669 |
"name": "phpunit/php-code-coverage",
|
867 |
},
|
868 |
{
|
869 |
"name": "phpunit/php-token-stream",
|
870 |
+
"version": "2.0.2",
|
871 |
"source": {
|
872 |
"type": "git",
|
873 |
"url": "https://github.com/sebastianbergmann/php-token-stream.git",
|
874 |
+
"reference": "791198a2c6254db10131eecfe8c06670700904db"
|
875 |
},
|
876 |
"dist": {
|
877 |
"type": "zip",
|
878 |
+
"url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/791198a2c6254db10131eecfe8c06670700904db",
|
879 |
+
"reference": "791198a2c6254db10131eecfe8c06670700904db",
|
880 |
"shasum": ""
|
881 |
},
|
882 |
"require": {
|
883 |
"ext-tokenizer": "*",
|
884 |
+
"php": "^7.0"
|
885 |
},
|
886 |
"require-dev": {
|
887 |
+
"phpunit/phpunit": "^6.2.4"
|
888 |
},
|
889 |
"type": "library",
|
890 |
"extra": {
|
891 |
"branch-alias": {
|
892 |
+
"dev-master": "2.0-dev"
|
893 |
}
|
894 |
},
|
895 |
"autoload": {
|
912 |
"keywords": [
|
913 |
"tokenizer"
|
914 |
],
|
915 |
+
"time": "2017-11-27T05:48:46+00:00"
|
916 |
},
|
917 |
{
|
918 |
"name": "phpunit/phpunit",
|
1571 |
},
|
1572 |
{
|
1573 |
"name": "squizlabs/php_codesniffer",
|
1574 |
+
"version": "3.5.4",
|
1575 |
"source": {
|
1576 |
"type": "git",
|
1577 |
"url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
|
1578 |
+
"reference": "dceec07328401de6211037abbb18bda423677e26"
|
1579 |
},
|
1580 |
"dist": {
|
1581 |
"type": "zip",
|
1582 |
+
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/dceec07328401de6211037abbb18bda423677e26",
|
1583 |
+
"reference": "dceec07328401de6211037abbb18bda423677e26",
|
1584 |
"shasum": ""
|
1585 |
},
|
1586 |
"require": {
|
1618 |
"phpcs",
|
1619 |
"standards"
|
1620 |
],
|
1621 |
+
"time": "2020-01-30T22:20:29+00:00"
|
1622 |
},
|
1623 |
{
|
1624 |
"name": "symfony/polyfill-ctype",
|
1625 |
+
"version": "v1.15.0",
|
1626 |
"source": {
|
1627 |
"type": "git",
|
1628 |
"url": "https://github.com/symfony/polyfill-ctype.git",
|
1629 |
+
"reference": "4719fa9c18b0464d399f1a63bf624b42b6fa8d14"
|
1630 |
},
|
1631 |
"dist": {
|
1632 |
"type": "zip",
|
1633 |
+
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/4719fa9c18b0464d399f1a63bf624b42b6fa8d14",
|
1634 |
+
"reference": "4719fa9c18b0464d399f1a63bf624b42b6fa8d14",
|
1635 |
"shasum": ""
|
1636 |
},
|
1637 |
"require": {
|
1643 |
"type": "library",
|
1644 |
"extra": {
|
1645 |
"branch-alias": {
|
1646 |
+
"dev-master": "1.15-dev"
|
1647 |
}
|
1648 |
},
|
1649 |
"autoload": {
|
1676 |
"polyfill",
|
1677 |
"portable"
|
1678 |
],
|
1679 |
+
"time": "2020-02-27T09:26:54+00:00"
|
1680 |
},
|
1681 |
{
|
1682 |
"name": "symfony/yaml",
|
1683 |
+
"version": "v4.4.6",
|
1684 |
"source": {
|
1685 |
"type": "git",
|
1686 |
"url": "https://github.com/symfony/yaml.git",
|
1687 |
+
"reference": "43d7a46b1f80b4fd2ecfac4a9a4cc1f22d029fbb"
|
1688 |
},
|
1689 |
"dist": {
|
1690 |
"type": "zip",
|
1691 |
+
"url": "https://api.github.com/repos/symfony/yaml/zipball/43d7a46b1f80b4fd2ecfac4a9a4cc1f22d029fbb",
|
1692 |
+
"reference": "43d7a46b1f80b4fd2ecfac4a9a4cc1f22d029fbb",
|
1693 |
"shasum": ""
|
1694 |
},
|
1695 |
"require": {
|
1696 |
+
"php": "^7.1.3",
|
1697 |
"symfony/polyfill-ctype": "~1.8"
|
1698 |
},
|
1699 |
"conflict": {
|
1700 |
"symfony/console": "<3.4"
|
1701 |
},
|
1702 |
"require-dev": {
|
1703 |
+
"symfony/console": "^3.4|^4.0|^5.0"
|
1704 |
},
|
1705 |
"suggest": {
|
1706 |
"symfony/console": "For validating YAML files using the lint command"
|
1708 |
"type": "library",
|
1709 |
"extra": {
|
1710 |
"branch-alias": {
|
1711 |
+
"dev-master": "4.4-dev"
|
1712 |
}
|
1713 |
},
|
1714 |
"autoload": {
|
1735 |
],
|
1736 |
"description": "Symfony Yaml Component",
|
1737 |
"homepage": "https://symfony.com",
|
1738 |
+
"time": "2020-03-16T08:56:54+00:00"
|
1739 |
},
|
1740 |
{
|
1741 |
"name": "webmozart/assert",
|
1742 |
+
"version": "1.7.0",
|
1743 |
"source": {
|
1744 |
"type": "git",
|
1745 |
"url": "https://github.com/webmozart/assert.git",
|
1746 |
+
"reference": "aed98a490f9a8f78468232db345ab9cf606cf598"
|
1747 |
},
|
1748 |
"dist": {
|
1749 |
"type": "zip",
|
1750 |
+
"url": "https://api.github.com/repos/webmozart/assert/zipball/aed98a490f9a8f78468232db345ab9cf606cf598",
|
1751 |
+
"reference": "aed98a490f9a8f78468232db345ab9cf606cf598",
|
1752 |
"shasum": ""
|
1753 |
},
|
1754 |
"require": {
|
1783 |
"check",
|
1784 |
"validate"
|
1785 |
],
|
1786 |
+
"time": "2020-02-14T12:15:55+00:00"
|
1787 |
},
|
1788 |
{
|
1789 |
"name": "wp-coding-standards/wpcs",
|
1790 |
+
"version": "2.2.1",
|
1791 |
"source": {
|
1792 |
"type": "git",
|
1793 |
"url": "https://github.com/WordPress/WordPress-Coding-Standards.git",
|
1794 |
+
"reference": "b5a453203114cc2284b1a614c4953456fbe4f546"
|
1795 |
},
|
1796 |
"dist": {
|
1797 |
"type": "zip",
|
1798 |
+
"url": "https://api.github.com/repos/WordPress/WordPress-Coding-Standards/zipball/b5a453203114cc2284b1a614c4953456fbe4f546",
|
1799 |
+
"reference": "b5a453203114cc2284b1a614c4953456fbe4f546",
|
1800 |
"shasum": ""
|
1801 |
},
|
1802 |
"require": {
|
1804 |
"squizlabs/php_codesniffer": "^3.3.1"
|
1805 |
},
|
1806 |
"require-dev": {
|
1807 |
+
"dealerdirect/phpcodesniffer-composer-installer": "^0.5 || ^0.6",
|
1808 |
"phpcompatibility/php-compatibility": "^9.0",
|
1809 |
"phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0"
|
1810 |
},
|
1811 |
"suggest": {
|
1812 |
+
"dealerdirect/phpcodesniffer-composer-installer": "^0.6 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically."
|
1813 |
},
|
1814 |
"type": "phpcodesniffer-standard",
|
1815 |
"notification-url": "https://packagist.org/downloads/",
|
1828 |
"standards",
|
1829 |
"wordpress"
|
1830 |
],
|
1831 |
+
"time": "2020-02-04T02:52:06+00:00"
|
1832 |
}
|
1833 |
],
|
1834 |
"aliases": [],
|
livechat.php
CHANGED
@@ -5,7 +5,7 @@ Plugin URI: https://www.livechatinc.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.livechatinc.com
|
8 |
-
Version: 4.1.
|
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.livechatinc.com
|
8 |
+
Version: 4.1.3
|
9 |
Text Domain: wp-live-chat-software-for-wordpress
|
10 |
Domain Path: /languages
|
11 |
*/
|
plugin_files/Helpers/DeactivationFeedbackFormHelper.class.php
CHANGED
@@ -162,7 +162,7 @@ class DeactivationFeedbackFormHelper extends LiveChatHelper {
|
|
162 |
<script>
|
163 |
window.deactivationDetails = window.deactivationDetails || {};
|
164 |
window.deactivationDetails = {
|
165 |
-
license: <?php echo esc_html( $license_id ); ?>,
|
166 |
name: '<?php echo esc_html( $wp_user['name'] ); ?>',
|
167 |
wpEmail: '<?php echo esc_html( $wp_user['email'] ); ?>'
|
168 |
};
|
162 |
<script>
|
163 |
window.deactivationDetails = window.deactivationDetails || {};
|
164 |
window.deactivationDetails = {
|
165 |
+
license: <?php echo esc_html( (int) $license_id ); ?>,
|
166 |
name: '<?php echo esc_html( $wp_user['name'] ); ?>',
|
167 |
wpEmail: '<?php echo esc_html( $wp_user['email'] ); ?>'
|
168 |
};
|
plugin_files/LiveChat.class.php
CHANGED
@@ -73,7 +73,20 @@ class LiveChat {
|
|
73 |
* It is used only for migrated users who are not connected to new integration.
|
74 |
*/
|
75 |
public function tracking_code() {
|
76 |
-
echo (
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
}
|
78 |
|
79 |
/**
|
@@ -165,20 +178,7 @@ class LiveChat {
|
|
165 |
);
|
166 |
wp_enqueue_script( 'livechat-widget' );
|
167 |
} catch ( Exception $exception ) {
|
168 |
-
|
169 |
-
( new TrackingCodeHelper() )->render(),
|
170 |
-
array(
|
171 |
-
'script' => array(
|
172 |
-
'type' => array(),
|
173 |
-
),
|
174 |
-
'noscript' => array(),
|
175 |
-
'a' => array(
|
176 |
-
'href' => array(),
|
177 |
-
'rel' => array(),
|
178 |
-
'target' => array(),
|
179 |
-
),
|
180 |
-
)
|
181 |
-
);
|
182 |
}
|
183 |
}
|
184 |
|
@@ -188,7 +188,7 @@ class LiveChat {
|
|
188 |
* @return boolean
|
189 |
*/
|
190 |
public function check_mobile() {
|
191 |
-
$user_agent =
|
192 |
$regex = '/((Chrome).*(Mobile))|((Android).*)|((iPhone|iPod).*Apple.*Mobile)|((Android).*(Mobile))/i';
|
193 |
return preg_match( $regex, $user_agent );
|
194 |
}
|
73 |
* It is used only for migrated users who are not connected to new integration.
|
74 |
*/
|
75 |
public function tracking_code() {
|
76 |
+
echo wp_kses(
|
77 |
+
( new TrackingCodeHelper() )->render(),
|
78 |
+
array(
|
79 |
+
'script' => array(
|
80 |
+
'type' => array(),
|
81 |
+
),
|
82 |
+
'noscript' => array(),
|
83 |
+
'a' => array(
|
84 |
+
'href' => array(),
|
85 |
+
'rel' => array(),
|
86 |
+
'target' => array(),
|
87 |
+
),
|
88 |
+
)
|
89 |
+
);
|
90 |
}
|
91 |
|
92 |
/**
|
178 |
);
|
179 |
wp_enqueue_script( 'livechat-widget' );
|
180 |
} catch ( Exception $exception ) {
|
181 |
+
$this->tracking_code();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
182 |
}
|
183 |
}
|
184 |
|
188 |
* @return boolean
|
189 |
*/
|
190 |
public function check_mobile() {
|
191 |
+
$user_agent = isset( $_SERVER['HTTP_USER_AGENT'] ) ? sanitize_text_field( wp_unslash( $_SERVER['HTTP_USER_AGENT'] ) ) : '';
|
192 |
$regex = '/((Chrome).*(Mobile))|((Android).*)|((iPhone|iPod).*Apple.*Mobile)|((Android).*(Mobile))/i';
|
193 |
return preg_match( $regex, $user_agent );
|
194 |
}
|
plugin_files/LiveChatAdmin.class.php
CHANGED
@@ -1,4 +1,9 @@
|
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
namespace LiveChat;
|
4 |
|
@@ -54,8 +59,6 @@ final class LiveChatAdmin extends LiveChat {
|
|
54 |
|
55 |
/**
|
56 |
* Starts the plugin
|
57 |
-
*
|
58 |
-
* @throws Exception Can be thrown by check_notices_conditions method.
|
59 |
*/
|
60 |
public function __construct() {
|
61 |
parent::__construct();
|
@@ -64,38 +67,11 @@ final class LiveChatAdmin extends LiveChat {
|
|
64 |
add_action( 'admin_init', array( $this, 'load_menu_icon_styles' ) );
|
65 |
add_action( 'admin_init', array( $this, 'load_general_scripts_and_styles' ) );
|
66 |
add_action( 'admin_init', array( $this, 'inject_nonce_object' ) );
|
|
|
|
|
67 |
|
68 |
-
|
69 |
-
|
70 |
-
// Notice action.
|
71 |
-
$this->check_notices_conditions();
|
72 |
-
|
73 |
-
add_action( 'admin_menu', array( $this, 'admin_menu' ) );
|
74 |
-
|
75 |
-
add_action( 'admin_init', array( $this, 'handle_post' ) );
|
76 |
-
|
77 |
-
if ( array_key_exists( 'SCRIPT_NAME', $_SERVER ) && strpos( sanitize_text_field( wp_unslash( $_SERVER['SCRIPT_NAME'] ) ), 'plugins.php' ) ) {
|
78 |
-
add_action( 'in_admin_header', array( $this, 'show_deactivation_feedback_form' ) );
|
79 |
-
}
|
80 |
-
}
|
81 |
-
|
82 |
-
/**
|
83 |
-
* Handles post.
|
84 |
-
*/
|
85 |
-
public function handle_post() {
|
86 |
-
if ( current_user_can( 'manage_options' )
|
87 |
-
&& array_key_exists( 'nonce', $_GET )
|
88 |
-
&& wp_verify_nonce( sanitize_text_field( wp_unslash( $_GET['nonce'] ) ), 'livechat-security-check' )
|
89 |
-
) {
|
90 |
-
if ( array_key_exists( 'reset', $_GET ) && '1' === $_GET['reset'] && array_key_exists( 'page', $_GET ) && 'livechat_settings' === $_GET['page'] ) {
|
91 |
-
$this->reset_options();
|
92 |
-
} elseif ( array_key_exists( 'REQUEST_METHOD', $_SERVER ) && 'POST' === $_SERVER['REQUEST_METHOD'] ) {
|
93 |
-
// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
|
94 |
-
// Data is sanitized inside update_options method.
|
95 |
-
echo $this->update_options( $_POST );
|
96 |
-
// phpcs:enable
|
97 |
-
}
|
98 |
-
}
|
99 |
}
|
100 |
|
101 |
/**
|
@@ -230,13 +206,10 @@ final class LiveChatAdmin extends LiveChat {
|
|
230 |
/**
|
231 |
* Adds LiveChat to WP administrator menu.
|
232 |
*/
|
233 |
-
public function
|
234 |
add_menu_page(
|
235 |
'LiveChat',
|
236 |
-
|
237 |
-
// This is not a form's processing.
|
238 |
-
$this->is_installed() || ( array_key_exists( 'page', $_GET ) && 'livechat_settings' === $_GET['page'] ) ? 'LiveChat' : 'LiveChat <span class="awaiting-mod">!</span>',
|
239 |
-
// phpcs:enable
|
240 |
'administrator',
|
241 |
'livechat',
|
242 |
array( $this, 'livechat_settings_page' ),
|
@@ -311,23 +284,11 @@ final class LiveChatAdmin extends LiveChat {
|
|
311 |
return $links;
|
312 |
}
|
313 |
|
314 |
-
/**
|
315 |
-
* Deletes options set by LiveChat plugin.
|
316 |
-
*/
|
317 |
-
private function reset_options() {
|
318 |
-
delete_option( 'livechat_license_number' );
|
319 |
-
delete_option( 'livechat_email' );
|
320 |
-
delete_option( 'livechat_review_notice_start_timestamp' );
|
321 |
-
delete_option( 'livechat_review_notice_start_timestamp_offset' );
|
322 |
-
delete_option( 'livechat_disable_mobile' );
|
323 |
-
delete_option( 'livechat_disable_guests' );
|
324 |
-
}
|
325 |
|
326 |
/**
|
327 |
* Checks if review notice should be visible.
|
328 |
*
|
329 |
* @return bool
|
330 |
-
* @throws Exception Can be thrown by check_if_license_is_active.
|
331 |
*/
|
332 |
private function check_review_notice_conditions() {
|
333 |
if ( $this->is_installed() && ! $this->check_if_review_notice_was_dismissed() && $this->check_if_license_is_active() ) {
|
@@ -343,41 +304,52 @@ final class LiveChatAdmin extends LiveChat {
|
|
343 |
}
|
344 |
|
345 |
/**
|
346 |
-
*
|
347 |
*
|
348 |
-
* @
|
349 |
*/
|
350 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
351 |
if ( $this->check_review_notice_conditions() ) {
|
352 |
add_action( 'admin_init', array( $this, 'load_review_scripts_and_styles' ) );
|
353 |
add_action( 'wp_ajax_lc_review_dismiss', array( $this, 'ajax_review_dismiss' ) );
|
354 |
add_action( 'wp_ajax_lc_review_postpone', array( $this, 'ajax_review_postpone' ) );
|
355 |
add_action( 'admin_notices', array( $this, 'show_review_notice' ) );
|
356 |
}
|
357 |
-
|
358 |
-
|
359 |
-
if ( ! $this->is_installed() && ! ( array_key_exists( 'page', $_GET ) && 'livechat_settings' === $_GET['page'] ) ) {
|
360 |
-
// phpcs:enable
|
361 |
-
if ( $this->has_license_number() ) {
|
362 |
-
add_action( 'admin_notices', array( $this, 'show_confirm_identity_notice' ) );
|
363 |
-
} else {
|
364 |
-
add_action( 'admin_notices', array( $this, 'show_connect_notice' ) );
|
365 |
-
}
|
366 |
-
}
|
367 |
}
|
368 |
|
369 |
/**
|
370 |
* Checks if LiveChat license is active.
|
371 |
*
|
372 |
* @return boolean
|
373 |
-
* @throws Exceptions\ApiClientException Can be thrown by ApiClient.
|
374 |
-
* @throws Exceptions\InvalidTokenException Can be throw by ConnectTokenProvider.
|
375 |
*/
|
376 |
private function check_if_license_is_active() {
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
|
|
|
|
|
|
|
|
|
|
381 |
}
|
382 |
|
383 |
/**
|
@@ -403,9 +375,15 @@ final class LiveChatAdmin extends LiveChat {
|
|
403 |
|
404 |
/**
|
405 |
* Shows deactivation feedback form.
|
|
|
|
|
406 |
*/
|
407 |
public function show_deactivation_feedback_form() {
|
408 |
-
(
|
|
|
|
|
|
|
|
|
409 |
}
|
410 |
|
411 |
/**
|
@@ -437,7 +415,7 @@ final class LiveChatAdmin extends LiveChat {
|
|
437 |
|
438 |
check_ajax_referer( 'wp_ajax_lc_connect', 'security' );
|
439 |
|
440 |
-
if (
|
441 |
$user_token = sanitize_text_field( wp_unslash( $_POST['user_token'] ) );
|
442 |
$store_token = sanitize_text_field( wp_unslash( $_POST['store_token'] ) );
|
443 |
}
|
@@ -448,6 +426,8 @@ final class LiveChatAdmin extends LiveChat {
|
|
448 |
Store::get_instance()->authorize_store( $store_token );
|
449 |
delete_option( 'livechat_license_number' );
|
450 |
delete_option( 'livechat_email' );
|
|
|
|
|
451 |
|
452 |
wp_send_json_success( array( 'status' => 'ok' ) );
|
453 |
} catch ( Exception $e ) {
|
@@ -457,6 +437,30 @@ final class LiveChatAdmin extends LiveChat {
|
|
457 |
}
|
458 |
}
|
459 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
460 |
/**
|
461 |
* Removes all LiveChat data stored in WP database.
|
462 |
* It's called as uninstall hook.
|
@@ -478,51 +482,5 @@ final class LiveChatAdmin extends LiveChat {
|
|
478 |
|
479 |
delete_option( 'livechat_review_notice_start_timestamp' );
|
480 |
delete_option( 'livechat_review_notice_start_timestamp_offset' );
|
481 |
-
delete_option( 'livechat_disable_mobile' );
|
482 |
-
delete_option( 'livechat_disable_guests' );
|
483 |
-
}
|
484 |
-
|
485 |
-
/**
|
486 |
-
* Updates options
|
487 |
-
*
|
488 |
-
* @param array $data Options to set.
|
489 |
-
*
|
490 |
-
* @return bool
|
491 |
-
*/
|
492 |
-
private function update_options( $data ) {
|
493 |
-
if ( ! isset( $data['licenseEmail'] ) || ! isset( $data['licenseNumber'] ) ) {
|
494 |
-
if ( array_key_exists( 'disableMobile', $data ) || array_key_exists( 'disableGuests', $data ) ) {
|
495 |
-
$disable_mobile = array_key_exists( 'disableMobile', $data ) ? (int) $data['disableMobile'] : 0;
|
496 |
-
$disable_guests = array_key_exists( 'disableGuests', $data ) ? (int) $data['disableGuests'] : 0;
|
497 |
-
|
498 |
-
update_option( 'livechat_disable_mobile', $disable_mobile );
|
499 |
-
update_option( 'livechat_disable_guests', $disable_guests );
|
500 |
-
|
501 |
-
$array = array(
|
502 |
-
'message' => 'success',
|
503 |
-
);
|
504 |
-
|
505 |
-
wp_send_json( $array );
|
506 |
-
} else {
|
507 |
-
return false;
|
508 |
-
}
|
509 |
-
} else {
|
510 |
-
|
511 |
-
$license_number = isset( $data['licenseNumber'] ) ? (int) $data['licenseNumber'] : 0;
|
512 |
-
$email = isset( $data['licenseEmail'] ) ? (string) $data['licenseEmail'] : '';
|
513 |
-
|
514 |
-
update_option( 'livechat_license_number', $license_number );
|
515 |
-
update_option( 'livechat_email', sanitize_email( $email ) );
|
516 |
-
|
517 |
-
update_option( 'livechat_review_notice_start_timestamp', time() );
|
518 |
-
update_option( 'livechat_review_notice_start_timestamp_offset', 16 );
|
519 |
-
|
520 |
-
update_option( 'livechat_disable_mobile', 0 );
|
521 |
-
update_option( 'livechat_disable_guests', 0 );
|
522 |
-
|
523 |
-
if ( isset( $data['changes_saved'] ) && '1' === $data['changes_saved'] ) {
|
524 |
-
$this->changes_saved = true;
|
525 |
-
}
|
526 |
-
}
|
527 |
}
|
528 |
}
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* Class LiveChatAdmin
|
4 |
+
*
|
5 |
+
* @package LiveChat
|
6 |
+
*/
|
7 |
|
8 |
namespace LiveChat;
|
9 |
|
59 |
|
60 |
/**
|
61 |
* Starts the plugin
|
|
|
|
|
62 |
*/
|
63 |
public function __construct() {
|
64 |
parent::__construct();
|
67 |
add_action( 'admin_init', array( $this, 'load_menu_icon_styles' ) );
|
68 |
add_action( 'admin_init', array( $this, 'load_general_scripts_and_styles' ) );
|
69 |
add_action( 'admin_init', array( $this, 'inject_nonce_object' ) );
|
70 |
+
add_action( 'admin_menu', array( $this, 'register_admin_menu' ) );
|
71 |
+
add_action( 'current_screen', array( $this, 'show_deactivation_feedback_form' ) );
|
72 |
|
73 |
+
$this->register_admin_notices();
|
74 |
+
$this->register_ajax_actions();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
}
|
76 |
|
77 |
/**
|
206 |
/**
|
207 |
* Adds LiveChat to WP administrator menu.
|
208 |
*/
|
209 |
+
public function register_admin_menu() {
|
210 |
add_menu_page(
|
211 |
'LiveChat',
|
212 |
+
$this->is_installed() ? 'LiveChat' : 'LiveChat <span class="awaiting-mod">!</span>',
|
|
|
|
|
|
|
213 |
'administrator',
|
214 |
'livechat',
|
215 |
array( $this, 'livechat_settings_page' ),
|
284 |
return $links;
|
285 |
}
|
286 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
287 |
|
288 |
/**
|
289 |
* Checks if review notice should be visible.
|
290 |
*
|
291 |
* @return bool
|
|
|
292 |
*/
|
293 |
private function check_review_notice_conditions() {
|
294 |
if ( $this->is_installed() && ! $this->check_if_review_notice_was_dismissed() && $this->check_if_license_is_active() ) {
|
304 |
}
|
305 |
|
306 |
/**
|
307 |
+
* Registers actions required for connect notice
|
308 |
*
|
309 |
+
* @return void
|
310 |
*/
|
311 |
+
public function register_connect_notice() {
|
312 |
+
if ( $this->is_installed() || 'livechat_page_livechat_settings' === get_current_screen()->id ) {
|
313 |
+
return;
|
314 |
+
}
|
315 |
+
|
316 |
+
if ( $this->has_license_number() ) {
|
317 |
+
add_action( 'admin_notices', array( $this, 'show_confirm_identity_notice' ) );
|
318 |
+
return;
|
319 |
+
}
|
320 |
+
|
321 |
+
add_action( 'admin_notices', array( $this, 'show_connect_notice' ) );
|
322 |
+
}
|
323 |
+
|
324 |
+
/**
|
325 |
+
* Checks if any notice should be displayed.
|
326 |
+
*/
|
327 |
+
private function register_admin_notices() {
|
328 |
if ( $this->check_review_notice_conditions() ) {
|
329 |
add_action( 'admin_init', array( $this, 'load_review_scripts_and_styles' ) );
|
330 |
add_action( 'wp_ajax_lc_review_dismiss', array( $this, 'ajax_review_dismiss' ) );
|
331 |
add_action( 'wp_ajax_lc_review_postpone', array( $this, 'ajax_review_postpone' ) );
|
332 |
add_action( 'admin_notices', array( $this, 'show_review_notice' ) );
|
333 |
}
|
334 |
+
|
335 |
+
add_action( 'current_screen', array( $this, 'register_connect_notice' ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
336 |
}
|
337 |
|
338 |
/**
|
339 |
* Checks if LiveChat license is active.
|
340 |
*
|
341 |
* @return boolean
|
|
|
|
|
342 |
*/
|
343 |
private function check_if_license_is_active() {
|
344 |
+
try {
|
345 |
+
$store = Store::get_instance();
|
346 |
+
$connect_token = ConnectTokenProvider::create( CertProvider::create() )->get( $store->get_store_token(), 'store' );
|
347 |
+
$result = ApiClient::create( $connect_token )->license_info();
|
348 |
+
|
349 |
+
return array_key_exists( 'isActive', $result ) ? $result['isActive'] : false;
|
350 |
+
} catch ( Exception $e ) {
|
351 |
+
return false;
|
352 |
+
}
|
353 |
}
|
354 |
|
355 |
/**
|
375 |
|
376 |
/**
|
377 |
* Shows deactivation feedback form.
|
378 |
+
*
|
379 |
+
* @return void;
|
380 |
*/
|
381 |
public function show_deactivation_feedback_form() {
|
382 |
+
if ( get_current_screen()->id !== 'plugins' ) {
|
383 |
+
return;
|
384 |
+
}
|
385 |
+
|
386 |
+
add_action( 'in_admin_header', array( new DeactivationFeedbackFormHelper(), 'render' ) );
|
387 |
}
|
388 |
|
389 |
/**
|
415 |
|
416 |
check_ajax_referer( 'wp_ajax_lc_connect', 'security' );
|
417 |
|
418 |
+
if ( isset( $_POST['user_token'] ) && isset( $_POST['store_token'] ) && isset( $_POST['security'] ) ) {
|
419 |
$user_token = sanitize_text_field( wp_unslash( $_POST['user_token'] ) );
|
420 |
$store_token = sanitize_text_field( wp_unslash( $_POST['store_token'] ) );
|
421 |
}
|
426 |
Store::get_instance()->authorize_store( $store_token );
|
427 |
delete_option( 'livechat_license_number' );
|
428 |
delete_option( 'livechat_email' );
|
429 |
+
delete_option( 'livechat_disable_mobile' );
|
430 |
+
delete_option( 'livechat_disable_guests' );
|
431 |
|
432 |
wp_send_json_success( array( 'status' => 'ok' ) );
|
433 |
} catch ( Exception $e ) {
|
437 |
}
|
438 |
}
|
439 |
|
440 |
+
/**
|
441 |
+
* Removes store token when it was not found in LiveChat service.
|
442 |
+
*/
|
443 |
+
public function ajax_store_not_found() {
|
444 |
+
Store::get_instance()->remove_store_data();
|
445 |
+
User::get_instance()->remove_authorized_users();
|
446 |
+
}
|
447 |
+
|
448 |
+
/**
|
449 |
+
* Removes current user token when it was not found in LiveChat service.
|
450 |
+
*/
|
451 |
+
public function ajax_user_not_found() {
|
452 |
+
User::get_instance()->remove_current_user_token();
|
453 |
+
}
|
454 |
+
|
455 |
+
/**
|
456 |
+
* Registers plugin's AJAX actions
|
457 |
+
*/
|
458 |
+
public function register_ajax_actions() {
|
459 |
+
add_action( 'wp_ajax_lc_connect', array( $this, 'ajax_connect' ) );
|
460 |
+
add_action( 'wp_ajax_lc_store_not_found', array( $this, 'ajax_store_not_found' ) );
|
461 |
+
add_action( 'wp_ajax_lc_user_not_found', array( $this, 'ajax_user_not_found' ) );
|
462 |
+
}
|
463 |
+
|
464 |
/**
|
465 |
* Removes all LiveChat data stored in WP database.
|
466 |
* It's called as uninstall hook.
|
482 |
|
483 |
delete_option( 'livechat_review_notice_start_timestamp' );
|
484 |
delete_option( 'livechat_review_notice_start_timestamp_offset' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
485 |
}
|
486 |
}
|
plugin_files/Services/User.class.php
CHANGED
@@ -108,6 +108,13 @@ class User {
|
|
108 |
return delete_option( 'livechat_user_' . $user_id . '_token' );
|
109 |
}
|
110 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
/**
|
112 |
* Removes all users tokens from WP database
|
113 |
*/
|
108 |
return delete_option( 'livechat_user_' . $user_id . '_token' );
|
109 |
}
|
110 |
|
111 |
+
/**
|
112 |
+
* Removes current user tokens from WP database
|
113 |
+
*/
|
114 |
+
public function remove_current_user_token() {
|
115 |
+
$this->remove_user_token( $this->current_user->ID );
|
116 |
+
}
|
117 |
+
|
118 |
/**
|
119 |
* Removes all users tokens from WP database
|
120 |
*/
|
plugin_files/css/livechat-menu.css
CHANGED
@@ -1,3 +1,7 @@
|
|
1 |
a.toplevel_page_livechat div.wp-menu-image.dashicons-before img {
|
2 |
padding: 6px 0 0 2px !important;
|
3 |
}
|
|
|
|
|
|
|
|
1 |
a.toplevel_page_livechat div.wp-menu-image.dashicons-before img {
|
2 |
padding: 6px 0 0 2px !important;
|
3 |
}
|
4 |
+
|
5 |
+
body.livechat_page_livechat_settings a.toplevel_page_livechat span.awaiting-mod {
|
6 |
+
display: none !important;
|
7 |
+
}
|
plugin_files/js/livechat.js
CHANGED
@@ -191,6 +191,11 @@
|
|
191 |
},
|
192 |
showError: function (errorType) {
|
193 |
$( '#lc-deactivation-feedback-form-' + errorType + '-error' ).show();
|
|
|
|
|
|
|
|
|
|
|
194 |
}
|
195 |
},
|
196 |
deactivationModalOpenHandler: function() {
|
@@ -243,6 +248,15 @@
|
|
243 |
var that = this;
|
244 |
response = response ? this.sanitize( response ) : 'skipped';
|
245 |
comment = comment ? this.sanitize( comment ) : '';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
246 |
$.ajax(
|
247 |
{
|
248 |
method: 'POST',
|
@@ -251,19 +265,15 @@
|
|
251 |
{
|
252 |
plugin: that.slug,
|
253 |
url: window.location.href.replace( /(.*)wp-admin.*/, '$1' ),
|
254 |
-
license:
|
255 |
-
name:
|
256 |
-
wpEmail:
|
257 |
response,
|
258 |
comment
|
259 |
}
|
260 |
),
|
261 |
dataType: 'jsonp',
|
262 |
-
complete:
|
263 |
-
window.location.replace(
|
264 |
-
$( 'table.plugins tr[data-slug=' + that.slug + '] span.deactivate a' ).attr( 'href' )
|
265 |
-
);
|
266 |
-
}
|
267 |
}
|
268 |
);
|
269 |
},
|
191 |
},
|
192 |
showError: function (errorType) {
|
193 |
$( '#lc-deactivation-feedback-form-' + errorType + '-error' ).show();
|
194 |
+
},
|
195 |
+
redirectToDeactivation: function () {
|
196 |
+
return window.location.replace(
|
197 |
+
$( 'table.plugins tr[data-slug=' + this.slug + '] span.deactivate a' ).attr( 'href' )
|
198 |
+
)
|
199 |
}
|
200 |
},
|
201 |
deactivationModalOpenHandler: function() {
|
248 |
var that = this;
|
249 |
response = response ? this.sanitize( response ) : 'skipped';
|
250 |
comment = comment ? this.sanitize( comment ) : '';
|
251 |
+
|
252 |
+
var redirectToDeactivation = this.deactivationFormHelpers.redirectToDeactivation.bind( this );
|
253 |
+
|
254 |
+
var deactivationDetails = window.deactivationDetails;
|
255 |
+
|
256 |
+
if ( ! deactivationDetails ) {
|
257 |
+
return redirectToDeactivation();
|
258 |
+
}
|
259 |
+
|
260 |
$.ajax(
|
261 |
{
|
262 |
method: 'POST',
|
265 |
{
|
266 |
plugin: that.slug,
|
267 |
url: window.location.href.replace( /(.*)wp-admin.*/, '$1' ),
|
268 |
+
license: deactivationDetails.license,
|
269 |
+
name: deactivationDetails.name,
|
270 |
+
wpEmail: deactivationDetails.wpEmail,
|
271 |
response,
|
272 |
comment
|
273 |
}
|
274 |
),
|
275 |
dataType: 'jsonp',
|
276 |
+
complete: redirectToDeactivation
|
|
|
|
|
|
|
|
|
277 |
}
|
278 |
);
|
279 |
},
|
plugin_files/templates/connect.html.twig
CHANGED
@@ -8,6 +8,7 @@
|
|
8 |
var USER_EMAIL = '{{ userEmail }}';
|
9 |
var WP_VER = '{{ wpVer }}';
|
10 |
var MODULE_VER = '{{ moduleVer }}';
|
|
|
11 |
(function () {
|
12 |
var interval = setInterval(function () {
|
13 |
if (window.AppBridge === undefined) {
|
@@ -15,24 +16,52 @@
|
|
15 |
}
|
16 |
clearInterval(interval);
|
17 |
|
18 |
-
function
|
19 |
-
jQuery.ajax({
|
20 |
url: ajaxurl, //ajaxurl is WP global variable
|
21 |
-
type
|
22 |
data: {
|
23 |
-
|
24 |
-
|
25 |
-
store_token: storeToken,
|
26 |
security: ajax_nonce.value
|
27 |
}
|
28 |
});
|
29 |
}
|
30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
var eventsRegister = new AppBridge.EventsRegister();
|
32 |
-
eventsRegister.register(AppBridge.UserSignedInEvent,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
|
34 |
-
|
|
|
|
|
|
|
|
|
|
|
35 |
document.getElementsByTagName('iframe')[0].classList.add('lc-iframe');
|
|
|
36 |
if (LC_TOKEN) {
|
37 |
return bridge.call(new AppBridge.SignInCommand(LC_TOKEN, bridge.platform, WP_VER, MODULE_VER));
|
38 |
}
|
8 |
var USER_EMAIL = '{{ userEmail }}';
|
9 |
var WP_VER = '{{ wpVer }}';
|
10 |
var MODULE_VER = '{{ moduleVer }}';
|
11 |
+
|
12 |
(function () {
|
13 |
var interval = setInterval(function () {
|
14 |
if (window.AppBridge === undefined) {
|
16 |
}
|
17 |
clearInterval(interval);
|
18 |
|
19 |
+
function adminAjaxCall(action, data = {}, type = 'POST') {
|
20 |
+
return jQuery.ajax({
|
21 |
url: ajaxurl, //ajaxurl is WP global variable
|
22 |
+
type,
|
23 |
data: {
|
24 |
+
...data,
|
25 |
+
action,
|
|
|
26 |
security: ajax_nonce.value
|
27 |
}
|
28 |
});
|
29 |
}
|
30 |
|
31 |
+
function userSignedInHandler(userToken, storeToken) {
|
32 |
+
return adminAjaxCall('lc_connect', {
|
33 |
+
user_token: userToken,
|
34 |
+
store_token: storeToken
|
35 |
+
});
|
36 |
+
}
|
37 |
+
|
38 |
+
function entityNotFound(entity) {
|
39 |
+
return adminAjaxCall(`lc_${entity}_not_found`).done(() => {
|
40 |
+
window.location.reload();
|
41 |
+
});
|
42 |
+
}
|
43 |
+
|
44 |
var eventsRegister = new AppBridge.EventsRegister();
|
45 |
+
eventsRegister.register(AppBridge.UserSignedInEvent, function (data) {
|
46 |
+
return userSignedInHandler(data.userToken, data.storeToken)
|
47 |
+
});
|
48 |
+
eventsRegister.register(AppBridge.ErrorOccurredEvent, function (data) {
|
49 |
+
if (data.statusCode !== 404) {
|
50 |
+
return console.error(new Error(data.errorMessage));
|
51 |
+
}
|
52 |
+
|
53 |
+
if (data.errorMessage === 'Store was not found') {
|
54 |
+
return entityNotFound('store');
|
55 |
+
}
|
56 |
|
57 |
+
if (data.errorMessage === 'User was not found') {
|
58 |
+
return entityNotFound('user');
|
59 |
+
}
|
60 |
+
});
|
61 |
+
|
62 |
+
AppBridge.AppBridgeParent.init('wordpress', eventsRegister, document.getElementById('lc-container'), '{{ appUrl }}').then(function (bridge) {
|
63 |
document.getElementsByTagName('iframe')[0].classList.add('lc-iframe');
|
64 |
+
|
65 |
if (LC_TOKEN) {
|
66 |
return bridge.call(new AppBridge.SignInCommand(LC_TOKEN, bridge.platform, WP_VER, MODULE_VER));
|
67 |
}
|
readme.txt
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
=== LiveChat - WP live chat plugin for WordPress ===
|
2 |
Contributors: LiveChat
|
3 |
Tags: live chat, chat plugin, live chat plugin, wordpress live chat, live support, wordpress chat, chat
|
4 |
-
Stable tag: 4.1.
|
5 |
Requires PHP: 5.6
|
6 |
-
Tested up to: 5.
|
7 |
Requires at least: 4.0
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
@@ -382,17 +382,20 @@ For more detailed instructions, go to the [live chat plugin page](https://www.li
|
|
382 |
|
383 |
== Changelog ==
|
384 |
|
385 |
-
= 4.1.
|
|
|
|
|
|
|
386 |
* CSS improvements
|
387 |
|
388 |
-
= 4.1.1
|
389 |
* bug fixes
|
390 |
|
391 |
-
= 4.1.0
|
392 |
* 'Resources' section added
|
393 |
* bug fixes
|
394 |
|
395 |
-
= 4.0.0
|
396 |
* revised in-admin signup/login page view
|
397 |
* introducing a new way of creating accounts in LiveChat
|
398 |
* added the possibility of creating or logging into a LiveChat account to all users in WordPress
|
1 |
=== LiveChat - WP live chat plugin for WordPress ===
|
2 |
Contributors: LiveChat
|
3 |
Tags: live chat, chat plugin, live chat plugin, wordpress live chat, live support, wordpress chat, chat
|
4 |
+
Stable tag: 4.1.3
|
5 |
Requires PHP: 5.6
|
6 |
+
Tested up to: 5.4
|
7 |
Requires at least: 4.0
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
382 |
|
383 |
== Changelog ==
|
384 |
|
385 |
+
= 4.1.3 =
|
386 |
+
* bug fixes
|
387 |
+
|
388 |
+
= 4.1.2 =
|
389 |
* CSS improvements
|
390 |
|
391 |
+
= 4.1.1 =
|
392 |
* bug fixes
|
393 |
|
394 |
+
= 4.1.0 =
|
395 |
* 'Resources' section added
|
396 |
* bug fixes
|
397 |
|
398 |
+
= 4.0.0 =
|
399 |
* revised in-admin signup/login page view
|
400 |
* introducing a new way of creating accounts in LiveChat
|
401 |
* added the possibility of creating or logging into a LiveChat account to all users in WordPress
|
vendor/autoload.php
CHANGED
@@ -4,4 +4,4 @@
|
|
4 |
|
5 |
require_once __DIR__ . '/composer/autoload_real.php';
|
6 |
|
7 |
-
return
|
4 |
|
5 |
require_once __DIR__ . '/composer/autoload_real.php';
|
6 |
|
7 |
+
return ComposerAutoloaderInit9ce5d947644a28eccfc8dcb22ba6207d::getLoader();
|
vendor/composer/autoload_real.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
-
class
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
@@ -19,15 +19,15 @@ class ComposerAutoloaderInit40732b7730cdf5348c07356d7267c06c
|
|
19 |
return self::$loader;
|
20 |
}
|
21 |
|
22 |
-
spl_autoload_register(array('
|
23 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
24 |
-
spl_autoload_unregister(array('
|
25 |
|
26 |
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
27 |
if ($useStaticLoader) {
|
28 |
require_once __DIR__ . '/autoload_static.php';
|
29 |
|
30 |
-
call_user_func(\Composer\Autoload\
|
31 |
} else {
|
32 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
33 |
foreach ($map as $namespace => $path) {
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
+
class ComposerAutoloaderInit9ce5d947644a28eccfc8dcb22ba6207d
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
19 |
return self::$loader;
|
20 |
}
|
21 |
|
22 |
+
spl_autoload_register(array('ComposerAutoloaderInit9ce5d947644a28eccfc8dcb22ba6207d', 'loadClassLoader'), true, true);
|
23 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
24 |
+
spl_autoload_unregister(array('ComposerAutoloaderInit9ce5d947644a28eccfc8dcb22ba6207d', 'loadClassLoader'));
|
25 |
|
26 |
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
27 |
if ($useStaticLoader) {
|
28 |
require_once __DIR__ . '/autoload_static.php';
|
29 |
|
30 |
+
call_user_func(\Composer\Autoload\ComposerStaticInit9ce5d947644a28eccfc8dcb22ba6207d::getInitializer($loader));
|
31 |
} else {
|
32 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
33 |
foreach ($map as $namespace => $path) {
|
vendor/composer/autoload_static.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
|
5 |
namespace Composer\Autoload;
|
6 |
|
7 |
-
class
|
8 |
{
|
9 |
public static $prefixLengthsPsr4 = array (
|
10 |
'L' =>
|
@@ -72,9 +72,9 @@ class ComposerStaticInit40732b7730cdf5348c07356d7267c06c
|
|
72 |
public static function getInitializer(ClassLoader $loader)
|
73 |
{
|
74 |
return \Closure::bind(function () use ($loader) {
|
75 |
-
$loader->prefixLengthsPsr4 =
|
76 |
-
$loader->prefixDirsPsr4 =
|
77 |
-
$loader->classMap =
|
78 |
|
79 |
}, null, ClassLoader::class);
|
80 |
}
|
4 |
|
5 |
namespace Composer\Autoload;
|
6 |
|
7 |
+
class ComposerStaticInit9ce5d947644a28eccfc8dcb22ba6207d
|
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 = ComposerStaticInit9ce5d947644a28eccfc8dcb22ba6207d::$prefixLengthsPsr4;
|
76 |
+
$loader->prefixDirsPsr4 = ComposerStaticInit9ce5d947644a28eccfc8dcb22ba6207d::$prefixDirsPsr4;
|
77 |
+
$loader->classMap = ComposerStaticInit9ce5d947644a28eccfc8dcb22ba6207d::$classMap;
|
78 |
|
79 |
}, null, ClassLoader::class);
|
80 |
}
|
vendor/composer/installed.json
CHANGED
@@ -1,26 +1,26 @@
|
|
1 |
[
|
2 |
{
|
3 |
"name": "firebase/php-jwt",
|
4 |
-
"version": "v5.
|
5 |
-
"version_normalized": "5.
|
6 |
"source": {
|
7 |
"type": "git",
|
8 |
"url": "https://github.com/firebase/php-jwt.git",
|
9 |
-
"reference": "
|
10 |
},
|
11 |
"dist": {
|
12 |
"type": "zip",
|
13 |
-
"url": "https://api.github.com/repos/firebase/php-jwt/zipball/
|
14 |
-
"reference": "
|
15 |
"shasum": ""
|
16 |
},
|
17 |
"require": {
|
18 |
"php": ">=5.3.0"
|
19 |
},
|
20 |
"require-dev": {
|
21 |
-
"phpunit/phpunit": "
|
22 |
},
|
23 |
-
"time": "
|
24 |
"type": "library",
|
25 |
"installation-source": "dist",
|
26 |
"autoload": {
|
@@ -45,6 +45,10 @@
|
|
45 |
}
|
46 |
],
|
47 |
"description": "A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec.",
|
48 |
-
"homepage": "https://github.com/firebase/php-jwt"
|
|
|
|
|
|
|
|
|
49 |
}
|
50 |
]
|
1 |
[
|
2 |
{
|
3 |
"name": "firebase/php-jwt",
|
4 |
+
"version": "v5.2.0",
|
5 |
+
"version_normalized": "5.2.0.0",
|
6 |
"source": {
|
7 |
"type": "git",
|
8 |
"url": "https://github.com/firebase/php-jwt.git",
|
9 |
+
"reference": "feb0e820b8436873675fd3aca04f3728eb2185cb"
|
10 |
},
|
11 |
"dist": {
|
12 |
"type": "zip",
|
13 |
+
"url": "https://api.github.com/repos/firebase/php-jwt/zipball/feb0e820b8436873675fd3aca04f3728eb2185cb",
|
14 |
+
"reference": "feb0e820b8436873675fd3aca04f3728eb2185cb",
|
15 |
"shasum": ""
|
16 |
},
|
17 |
"require": {
|
18 |
"php": ">=5.3.0"
|
19 |
},
|
20 |
"require-dev": {
|
21 |
+
"phpunit/phpunit": ">=4.8 <=9"
|
22 |
},
|
23 |
+
"time": "2020-03-25T18:49:23+00:00",
|
24 |
"type": "library",
|
25 |
"installation-source": "dist",
|
26 |
"autoload": {
|
45 |
}
|
46 |
],
|
47 |
"description": "A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec.",
|
48 |
+
"homepage": "https://github.com/firebase/php-jwt",
|
49 |
+
"keywords": [
|
50 |
+
"jwt",
|
51 |
+
"php"
|
52 |
+
]
|
53 |
}
|
54 |
]
|
vendor/firebase/php-jwt/README.md
CHANGED
@@ -23,7 +23,7 @@ Example
|
|
23 |
use \Firebase\JWT\JWT;
|
24 |
|
25 |
$key = "example_key";
|
26 |
-
$
|
27 |
"iss" => "http://example.org",
|
28 |
"aud" => "http://example.com",
|
29 |
"iat" => 1356999524,
|
@@ -36,7 +36,7 @@ $token = array(
|
|
36 |
* https://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-40
|
37 |
* for a list of spec-compliant algorithms.
|
38 |
*/
|
39 |
-
$jwt = JWT::encode($
|
40 |
$decoded = JWT::decode($jwt, $key, array('HS256'));
|
41 |
|
42 |
print_r($decoded);
|
@@ -93,14 +93,14 @@ ehde/zUxo6UvS7UrBQIDAQAB
|
|
93 |
-----END PUBLIC KEY-----
|
94 |
EOD;
|
95 |
|
96 |
-
$
|
97 |
"iss" => "example.org",
|
98 |
"aud" => "example.com",
|
99 |
"iat" => 1356999524,
|
100 |
"nbf" => 1357000000
|
101 |
);
|
102 |
|
103 |
-
$jwt = JWT::encode($
|
104 |
echo "Encode:\n" . print_r($jwt, true) . "\n";
|
105 |
|
106 |
$decoded = JWT::decode($jwt, $publicKey, array('RS256'));
|
23 |
use \Firebase\JWT\JWT;
|
24 |
|
25 |
$key = "example_key";
|
26 |
+
$payload = array(
|
27 |
"iss" => "http://example.org",
|
28 |
"aud" => "http://example.com",
|
29 |
"iat" => 1356999524,
|
36 |
* https://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-40
|
37 |
* for a list of spec-compliant algorithms.
|
38 |
*/
|
39 |
+
$jwt = JWT::encode($payload, $key);
|
40 |
$decoded = JWT::decode($jwt, $key, array('HS256'));
|
41 |
|
42 |
print_r($decoded);
|
93 |
-----END PUBLIC KEY-----
|
94 |
EOD;
|
95 |
|
96 |
+
$payload = array(
|
97 |
"iss" => "example.org",
|
98 |
"aud" => "example.com",
|
99 |
"iat" => 1356999524,
|
100 |
"nbf" => 1357000000
|
101 |
);
|
102 |
|
103 |
+
$jwt = JWT::encode($payload, $privateKey, 'RS256');
|
104 |
echo "Encode:\n" . print_r($jwt, true) . "\n";
|
105 |
|
106 |
$decoded = JWT::decode($jwt, $publicKey, array('RS256'));
|
vendor/firebase/php-jwt/composer.json
CHANGED
@@ -2,6 +2,10 @@
|
|
2 |
"name": "firebase/php-jwt",
|
3 |
"description": "A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec.",
|
4 |
"homepage": "https://github.com/firebase/php-jwt",
|
|
|
|
|
|
|
|
|
5 |
"authors": [
|
6 |
{
|
7 |
"name": "Neuman Vong",
|
@@ -24,6 +28,6 @@
|
|
24 |
}
|
25 |
},
|
26 |
"require-dev": {
|
27 |
-
"phpunit/phpunit": "
|
28 |
}
|
29 |
}
|
2 |
"name": "firebase/php-jwt",
|
3 |
"description": "A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec.",
|
4 |
"homepage": "https://github.com/firebase/php-jwt",
|
5 |
+
"keywords": [
|
6 |
+
"php",
|
7 |
+
"jwt"
|
8 |
+
],
|
9 |
"authors": [
|
10 |
{
|
11 |
"name": "Neuman Vong",
|
28 |
}
|
29 |
},
|
30 |
"require-dev": {
|
31 |
+
"phpunit/phpunit": ">=4.8 <=9"
|
32 |
}
|
33 |
}
|
vendor/firebase/php-jwt/src/BeforeValidException.php
CHANGED
@@ -3,5 +3,4 @@ namespace Firebase\JWT;
|
|
3 |
|
4 |
class BeforeValidException extends \UnexpectedValueException
|
5 |
{
|
6 |
-
|
7 |
}
|
3 |
|
4 |
class BeforeValidException extends \UnexpectedValueException
|
5 |
{
|
|
|
6 |
}
|
vendor/firebase/php-jwt/src/ExpiredException.php
CHANGED
@@ -3,5 +3,4 @@ namespace Firebase\JWT;
|
|
3 |
|
4 |
class ExpiredException extends \UnexpectedValueException
|
5 |
{
|
6 |
-
|
7 |
}
|
3 |
|
4 |
class ExpiredException extends \UnexpectedValueException
|
5 |
{
|
|
|
6 |
}
|
vendor/firebase/php-jwt/src/JWK.php
ADDED
@@ -0,0 +1,171 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Firebase\JWT;
|
4 |
+
|
5 |
+
use DomainException;
|
6 |
+
use UnexpectedValueException;
|
7 |
+
|
8 |
+
/**
|
9 |
+
* JSON Web Key implementation, based on this spec:
|
10 |
+
* https://tools.ietf.org/html/draft-ietf-jose-json-web-key-41
|
11 |
+
*
|
12 |
+
* PHP version 5
|
13 |
+
*
|
14 |
+
* @category Authentication
|
15 |
+
* @package Authentication_JWT
|
16 |
+
* @author Bui Sy Nguyen <nguyenbs@gmail.com>
|
17 |
+
* @license http://opensource.org/licenses/BSD-3-Clause 3-clause BSD
|
18 |
+
* @link https://github.com/firebase/php-jwt
|
19 |
+
*/
|
20 |
+
class JWK
|
21 |
+
{
|
22 |
+
/**
|
23 |
+
* Parse a set of JWK keys
|
24 |
+
*
|
25 |
+
* @param array $jwks The JSON Web Key Set as an associative array
|
26 |
+
*
|
27 |
+
* @return array An associative array that represents the set of keys
|
28 |
+
*
|
29 |
+
* @throws InvalidArgumentException Provided JWK Set is empty
|
30 |
+
* @throws UnexpectedValueException Provided JWK Set was invalid
|
31 |
+
* @throws DomainException OpenSSL failure
|
32 |
+
*
|
33 |
+
* @uses parseKey
|
34 |
+
*/
|
35 |
+
public static function parseKeySet(array $jwks)
|
36 |
+
{
|
37 |
+
$keys = array();
|
38 |
+
|
39 |
+
if (!isset($jwks['keys'])) {
|
40 |
+
throw new UnexpectedValueException('"keys" member must exist in the JWK Set');
|
41 |
+
}
|
42 |
+
if (empty($jwks['keys'])) {
|
43 |
+
throw new InvalidArgumentException('JWK Set did not contain any keys');
|
44 |
+
}
|
45 |
+
|
46 |
+
foreach ($jwks['keys'] as $k => $v) {
|
47 |
+
$kid = isset($v['kid']) ? $v['kid'] : $k;
|
48 |
+
if ($key = self::parseKey($v)) {
|
49 |
+
$keys[$kid] = $key;
|
50 |
+
}
|
51 |
+
}
|
52 |
+
|
53 |
+
if (0 === \count($keys)) {
|
54 |
+
throw new UnexpectedValueException('No supported algorithms found in JWK Set');
|
55 |
+
}
|
56 |
+
|
57 |
+
return $keys;
|
58 |
+
}
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Parse a JWK key
|
62 |
+
*
|
63 |
+
* @param array $jwk An individual JWK
|
64 |
+
*
|
65 |
+
* @return resource|array An associative array that represents the key
|
66 |
+
*
|
67 |
+
* @throws InvalidArgumentException Provided JWK is empty
|
68 |
+
* @throws UnexpectedValueException Provided JWK was invalid
|
69 |
+
* @throws DomainException OpenSSL failure
|
70 |
+
*
|
71 |
+
* @uses createPemFromModulusAndExponent
|
72 |
+
*/
|
73 |
+
private static function parseKey(array $jwk)
|
74 |
+
{
|
75 |
+
if (empty($jwk)) {
|
76 |
+
throw new InvalidArgumentException('JWK must not be empty');
|
77 |
+
}
|
78 |
+
if (!isset($jwk['kty'])) {
|
79 |
+
throw new UnexpectedValueException('JWK must contain a "kty" parameter');
|
80 |
+
}
|
81 |
+
|
82 |
+
switch ($jwk['kty']) {
|
83 |
+
case 'RSA':
|
84 |
+
if (\array_key_exists('d', $jwk)) {
|
85 |
+
throw new UnexpectedValueException('RSA private keys are not supported');
|
86 |
+
}
|
87 |
+
if (!isset($jwk['n']) || !isset($jwk['e'])) {
|
88 |
+
throw new UnexpectedValueException('RSA keys must contain values for both "n" and "e"');
|
89 |
+
}
|
90 |
+
|
91 |
+
$pem = self::createPemFromModulusAndExponent($jwk['n'], $jwk['e']);
|
92 |
+
$publicKey = \openssl_pkey_get_public($pem);
|
93 |
+
if (false === $publicKey) {
|
94 |
+
throw new DomainException(
|
95 |
+
'OpenSSL error: ' . \openssl_error_string()
|
96 |
+
);
|
97 |
+
}
|
98 |
+
return $publicKey;
|
99 |
+
default:
|
100 |
+
// Currently only RSA is supported
|
101 |
+
break;
|
102 |
+
}
|
103 |
+
}
|
104 |
+
|
105 |
+
/**
|
106 |
+
* Create a public key represented in PEM format from RSA modulus and exponent information
|
107 |
+
*
|
108 |
+
* @param string $n The RSA modulus encoded in Base64
|
109 |
+
* @param string $e The RSA exponent encoded in Base64
|
110 |
+
*
|
111 |
+
* @return string The RSA public key represented in PEM format
|
112 |
+
*
|
113 |
+
* @uses encodeLength
|
114 |
+
*/
|
115 |
+
private static function createPemFromModulusAndExponent($n, $e)
|
116 |
+
{
|
117 |
+
$modulus = JWT::urlsafeB64Decode($n);
|
118 |
+
$publicExponent = JWT::urlsafeB64Decode($e);
|
119 |
+
|
120 |
+
$components = array(
|
121 |
+
'modulus' => \pack('Ca*a*', 2, self::encodeLength(\strlen($modulus)), $modulus),
|
122 |
+
'publicExponent' => \pack('Ca*a*', 2, self::encodeLength(\strlen($publicExponent)), $publicExponent)
|
123 |
+
);
|
124 |
+
|
125 |
+
$rsaPublicKey = \pack(
|
126 |
+
'Ca*a*a*',
|
127 |
+
48,
|
128 |
+
self::encodeLength(\strlen($components['modulus']) + \strlen($components['publicExponent'])),
|
129 |
+
$components['modulus'],
|
130 |
+
$components['publicExponent']
|
131 |
+
);
|
132 |
+
|
133 |
+
// sequence(oid(1.2.840.113549.1.1.1), null)) = rsaEncryption.
|
134 |
+
$rsaOID = \pack('H*', '300d06092a864886f70d0101010500'); // hex version of MA0GCSqGSIb3DQEBAQUA
|
135 |
+
$rsaPublicKey = \chr(0) . $rsaPublicKey;
|
136 |
+
$rsaPublicKey = \chr(3) . self::encodeLength(\strlen($rsaPublicKey)) . $rsaPublicKey;
|
137 |
+
|
138 |
+
$rsaPublicKey = \pack(
|
139 |
+
'Ca*a*',
|
140 |
+
48,
|
141 |
+
self::encodeLength(\strlen($rsaOID . $rsaPublicKey)),
|
142 |
+
$rsaOID . $rsaPublicKey
|
143 |
+
);
|
144 |
+
|
145 |
+
$rsaPublicKey = "-----BEGIN PUBLIC KEY-----\r\n" .
|
146 |
+
\chunk_split(\base64_encode($rsaPublicKey), 64) .
|
147 |
+
'-----END PUBLIC KEY-----';
|
148 |
+
|
149 |
+
return $rsaPublicKey;
|
150 |
+
}
|
151 |
+
|
152 |
+
/**
|
153 |
+
* DER-encode the length
|
154 |
+
*
|
155 |
+
* DER supports lengths up to (2**8)**127, however, we'll only support lengths up to (2**8)**4. See
|
156 |
+
* {@link http://itu.int/ITU-T/studygroups/com17/languages/X.690-0207.pdf#p=13 X.690 paragraph 8.1.3} for more information.
|
157 |
+
*
|
158 |
+
* @param int $length
|
159 |
+
* @return string
|
160 |
+
*/
|
161 |
+
private static function encodeLength($length)
|
162 |
+
{
|
163 |
+
if ($length <= 0x7F) {
|
164 |
+
return \chr($length);
|
165 |
+
}
|
166 |
+
|
167 |
+
$temp = \ltrim(\pack('N', $length), \chr(0));
|
168 |
+
|
169 |
+
return \pack('Ca*', 0x80 | \strlen($temp), $temp);
|
170 |
+
}
|
171 |
+
}
|
vendor/firebase/php-jwt/src/JWT.php
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
namespace Firebase\JWT;
|
|
|
4 |
use \DomainException;
|
5 |
use \InvalidArgumentException;
|
6 |
use \UnexpectedValueException;
|
@@ -21,6 +22,9 @@ use \DateTime;
|
|
21 |
*/
|
22 |
class JWT
|
23 |
{
|
|
|
|
|
|
|
24 |
|
25 |
/**
|
26 |
* When checking nbf, iat or expiration times,
|
@@ -38,9 +42,10 @@ class JWT
|
|
38 |
public static $timestamp = null;
|
39 |
|
40 |
public static $supported_algs = array(
|
|
|
41 |
'HS256' => array('hash_hmac', 'SHA256'),
|
42 |
-
'HS512' => array('hash_hmac', 'SHA512'),
|
43 |
'HS384' => array('hash_hmac', 'SHA384'),
|
|
|
44 |
'RS256' => array('openssl', 'SHA256'),
|
45 |
'RS384' => array('openssl', 'SHA384'),
|
46 |
'RS512' => array('openssl', 'SHA512'),
|
@@ -49,11 +54,11 @@ class JWT
|
|
49 |
/**
|
50 |
* Decodes a JWT string into a PHP object.
|
51 |
*
|
52 |
-
* @param string
|
53 |
-
* @param string|array
|
54 |
-
*
|
55 |
-
* @param array
|
56 |
-
*
|
57 |
*
|
58 |
* @return object The JWT's payload as a PHP object
|
59 |
*
|
@@ -68,13 +73,13 @@ class JWT
|
|
68 |
*/
|
69 |
public static function decode($jwt, $key, array $allowed_algs = array())
|
70 |
{
|
71 |
-
$timestamp = is_null(static::$timestamp) ? time() : static::$timestamp;
|
72 |
|
73 |
if (empty($key)) {
|
74 |
throw new InvalidArgumentException('Key may not be empty');
|
75 |
}
|
76 |
-
$tks = explode('.', $jwt);
|
77 |
-
if (count($tks) != 3) {
|
78 |
throw new UnexpectedValueException('Wrong number of segments');
|
79 |
}
|
80 |
list($headb64, $bodyb64, $cryptob64) = $tks;
|
@@ -93,10 +98,15 @@ class JWT
|
|
93 |
if (empty(static::$supported_algs[$header->alg])) {
|
94 |
throw new UnexpectedValueException('Algorithm not supported');
|
95 |
}
|
96 |
-
if (
|
97 |
throw new UnexpectedValueException('Algorithm not allowed');
|
98 |
}
|
99 |
-
if (
|
|
|
|
|
|
|
|
|
|
|
100 |
if (isset($header->kid)) {
|
101 |
if (!isset($key[$header->kid])) {
|
102 |
throw new UnexpectedValueException('"kid" invalid, unable to lookup correct key');
|
@@ -112,11 +122,11 @@ class JWT
|
|
112 |
throw new SignatureInvalidException('Signature verification failed');
|
113 |
}
|
114 |
|
115 |
-
// Check
|
116 |
// token can actually be used. If it's not yet that time, abort.
|
117 |
if (isset($payload->nbf) && $payload->nbf > ($timestamp + static::$leeway)) {
|
118 |
throw new BeforeValidException(
|
119 |
-
'Cannot handle token prior to ' . date(DateTime::ISO8601, $payload->nbf)
|
120 |
);
|
121 |
}
|
122 |
|
@@ -125,7 +135,7 @@ class JWT
|
|
125 |
// correctly used the nbf claim).
|
126 |
if (isset($payload->iat) && $payload->iat > ($timestamp + static::$leeway)) {
|
127 |
throw new BeforeValidException(
|
128 |
-
'Cannot handle token prior to ' . date(DateTime::ISO8601, $payload->iat)
|
129 |
);
|
130 |
}
|
131 |
|
@@ -144,7 +154,7 @@ class JWT
|
|
144 |
* @param string $key The secret key.
|
145 |
* If the algorithm used is asymmetric, this is the private key
|
146 |
* @param string $alg The signing algorithm.
|
147 |
-
* Supported algorithms are 'HS256', 'HS384', 'HS512' and '
|
148 |
* @param mixed $keyId
|
149 |
* @param array $head An array with header elements to attach
|
150 |
*
|
@@ -159,18 +169,18 @@ class JWT
|
|
159 |
if ($keyId !== null) {
|
160 |
$header['kid'] = $keyId;
|
161 |
}
|
162 |
-
if (
|
163 |
-
$header = array_merge($head, $header);
|
164 |
}
|
165 |
$segments = array();
|
166 |
$segments[] = static::urlsafeB64Encode(static::jsonEncode($header));
|
167 |
$segments[] = static::urlsafeB64Encode(static::jsonEncode($payload));
|
168 |
-
$signing_input = implode('.', $segments);
|
169 |
|
170 |
$signature = static::sign($signing_input, $key, $alg);
|
171 |
$segments[] = static::urlsafeB64Encode($signature);
|
172 |
|
173 |
-
return implode('.', $segments);
|
174 |
}
|
175 |
|
176 |
/**
|
@@ -179,7 +189,7 @@ class JWT
|
|
179 |
* @param string $msg The message to sign
|
180 |
* @param string|resource $key The secret key
|
181 |
* @param string $alg The signing algorithm.
|
182 |
-
* Supported algorithms are 'HS256', 'HS384', 'HS512' and '
|
183 |
*
|
184 |
* @return string An encrypted message
|
185 |
*
|
@@ -191,15 +201,18 @@ class JWT
|
|
191 |
throw new DomainException('Algorithm not supported');
|
192 |
}
|
193 |
list($function, $algorithm) = static::$supported_algs[$alg];
|
194 |
-
switch($function) {
|
195 |
case 'hash_hmac':
|
196 |
-
return hash_hmac($algorithm, $msg, $key, true);
|
197 |
case 'openssl':
|
198 |
$signature = '';
|
199 |
-
$success = openssl_sign($msg, $signature, $key, $algorithm);
|
200 |
if (!$success) {
|
201 |
throw new DomainException("OpenSSL unable to sign data");
|
202 |
} else {
|
|
|
|
|
|
|
203 |
return $signature;
|
204 |
}
|
205 |
}
|
@@ -225,9 +238,9 @@ class JWT
|
|
225 |
}
|
226 |
|
227 |
list($function, $algorithm) = static::$supported_algs[$alg];
|
228 |
-
switch($function) {
|
229 |
case 'openssl':
|
230 |
-
$success = openssl_verify($msg, $signature, $key, $algorithm);
|
231 |
if ($success === 1) {
|
232 |
return true;
|
233 |
} elseif ($success === 0) {
|
@@ -235,19 +248,19 @@ class JWT
|
|
235 |
}
|
236 |
// returns 1 on success, 0 on failure, -1 on error.
|
237 |
throw new DomainException(
|
238 |
-
'OpenSSL error: ' . openssl_error_string()
|
239 |
);
|
240 |
case 'hash_hmac':
|
241 |
default:
|
242 |
-
$hash = hash_hmac($algorithm, $msg, $key, true);
|
243 |
-
if (function_exists('hash_equals')) {
|
244 |
-
return hash_equals($signature, $hash);
|
245 |
}
|
246 |
-
$len = min(static::safeStrlen($signature), static::safeStrlen($hash));
|
247 |
|
248 |
$status = 0;
|
249 |
for ($i = 0; $i < $len; $i++) {
|
250 |
-
$status |= (ord($signature[$i]) ^ ord($hash[$i]));
|
251 |
}
|
252 |
$status |= (static::safeStrlen($signature) ^ static::safeStrlen($hash));
|
253 |
|
@@ -266,23 +279,23 @@ class JWT
|
|
266 |
*/
|
267 |
public static function jsonDecode($input)
|
268 |
{
|
269 |
-
if (version_compare(PHP_VERSION, '5.4.0', '>=') && !(defined('JSON_C_VERSION') && PHP_INT_SIZE > 4)) {
|
270 |
/** In PHP >=5.4.0, json_decode() accepts an options parameter, that allows you
|
271 |
* to specify that large ints (like Steam Transaction IDs) should be treated as
|
272 |
* strings, rather than the PHP default behaviour of converting them to floats.
|
273 |
*/
|
274 |
-
$obj = json_decode($input, false, 512, JSON_BIGINT_AS_STRING);
|
275 |
} else {
|
276 |
/** Not all servers will support that, however, so for older versions we must
|
277 |
* manually detect large ints in the JSON string and quote them (thus converting
|
278 |
*them to strings) before decoding, hence the preg_replace() call.
|
279 |
*/
|
280 |
-
$max_int_length = strlen((string) PHP_INT_MAX) - 1;
|
281 |
-
$json_without_bigints = preg_replace('/:\s*(-?\d{'.$max_int_length.',})/', ': "$1"', $input);
|
282 |
-
$obj = json_decode($json_without_bigints);
|
283 |
}
|
284 |
|
285 |
-
if (
|
286 |
static::handleJsonError($errno);
|
287 |
} elseif ($obj === null && $input !== 'null') {
|
288 |
throw new DomainException('Null result with non-null input');
|
@@ -301,8 +314,8 @@ class JWT
|
|
301 |
*/
|
302 |
public static function jsonEncode($input)
|
303 |
{
|
304 |
-
$json = json_encode($input);
|
305 |
-
if (
|
306 |
static::handleJsonError($errno);
|
307 |
} elseif ($json === 'null' && $input !== null) {
|
308 |
throw new DomainException('Null result with non-null input');
|
@@ -319,12 +332,12 @@ class JWT
|
|
319 |
*/
|
320 |
public static function urlsafeB64Decode($input)
|
321 |
{
|
322 |
-
$remainder = strlen($input) % 4;
|
323 |
if ($remainder) {
|
324 |
$padlen = 4 - $remainder;
|
325 |
-
$input .= str_repeat('=', $padlen);
|
326 |
}
|
327 |
-
return base64_decode(strtr($input, '-_', '+/'));
|
328 |
}
|
329 |
|
330 |
/**
|
@@ -336,7 +349,7 @@ class JWT
|
|
336 |
*/
|
337 |
public static function urlsafeB64Encode($input)
|
338 |
{
|
339 |
-
return str_replace('=', '', strtr(base64_encode($input), '+/', '-_'));
|
340 |
}
|
341 |
|
342 |
/**
|
@@ -365,15 +378,135 @@ class JWT
|
|
365 |
/**
|
366 |
* Get the number of bytes in cryptographic strings.
|
367 |
*
|
368 |
-
* @param string
|
369 |
*
|
370 |
* @return int
|
371 |
*/
|
372 |
private static function safeStrlen($str)
|
373 |
{
|
374 |
-
if (function_exists('mb_strlen')) {
|
375 |
-
return mb_strlen($str, '8bit');
|
376 |
}
|
377 |
-
return strlen($str);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
378 |
}
|
379 |
}
|
1 |
<?php
|
2 |
|
3 |
namespace Firebase\JWT;
|
4 |
+
|
5 |
use \DomainException;
|
6 |
use \InvalidArgumentException;
|
7 |
use \UnexpectedValueException;
|
22 |
*/
|
23 |
class JWT
|
24 |
{
|
25 |
+
const ASN1_INTEGER = 0x02;
|
26 |
+
const ASN1_SEQUENCE = 0x10;
|
27 |
+
const ASN1_BIT_STRING = 0x03;
|
28 |
|
29 |
/**
|
30 |
* When checking nbf, iat or expiration times,
|
42 |
public static $timestamp = null;
|
43 |
|
44 |
public static $supported_algs = array(
|
45 |
+
'ES256' => array('openssl', 'SHA256'),
|
46 |
'HS256' => array('hash_hmac', 'SHA256'),
|
|
|
47 |
'HS384' => array('hash_hmac', 'SHA384'),
|
48 |
+
'HS512' => array('hash_hmac', 'SHA512'),
|
49 |
'RS256' => array('openssl', 'SHA256'),
|
50 |
'RS384' => array('openssl', 'SHA384'),
|
51 |
'RS512' => array('openssl', 'SHA512'),
|
54 |
/**
|
55 |
* Decodes a JWT string into a PHP object.
|
56 |
*
|
57 |
+
* @param string $jwt The JWT
|
58 |
+
* @param string|array|resource $key The key, or map of keys.
|
59 |
+
* If the algorithm used is asymmetric, this is the public key
|
60 |
+
* @param array $allowed_algs List of supported verification algorithms
|
61 |
+
* Supported algorithms are 'ES256', 'HS256', 'HS384', 'HS512', 'RS256', 'RS384', and 'RS512'
|
62 |
*
|
63 |
* @return object The JWT's payload as a PHP object
|
64 |
*
|
73 |
*/
|
74 |
public static function decode($jwt, $key, array $allowed_algs = array())
|
75 |
{
|
76 |
+
$timestamp = \is_null(static::$timestamp) ? \time() : static::$timestamp;
|
77 |
|
78 |
if (empty($key)) {
|
79 |
throw new InvalidArgumentException('Key may not be empty');
|
80 |
}
|
81 |
+
$tks = \explode('.', $jwt);
|
82 |
+
if (\count($tks) != 3) {
|
83 |
throw new UnexpectedValueException('Wrong number of segments');
|
84 |
}
|
85 |
list($headb64, $bodyb64, $cryptob64) = $tks;
|
98 |
if (empty(static::$supported_algs[$header->alg])) {
|
99 |
throw new UnexpectedValueException('Algorithm not supported');
|
100 |
}
|
101 |
+
if (!\in_array($header->alg, $allowed_algs)) {
|
102 |
throw new UnexpectedValueException('Algorithm not allowed');
|
103 |
}
|
104 |
+
if ($header->alg === 'ES256') {
|
105 |
+
// OpenSSL expects an ASN.1 DER sequence for ES256 signatures
|
106 |
+
$sig = self::signatureToDER($sig);
|
107 |
+
}
|
108 |
+
|
109 |
+
if (\is_array($key) || $key instanceof \ArrayAccess) {
|
110 |
if (isset($header->kid)) {
|
111 |
if (!isset($key[$header->kid])) {
|
112 |
throw new UnexpectedValueException('"kid" invalid, unable to lookup correct key');
|
122 |
throw new SignatureInvalidException('Signature verification failed');
|
123 |
}
|
124 |
|
125 |
+
// Check the nbf if it is defined. This is the time that the
|
126 |
// token can actually be used. If it's not yet that time, abort.
|
127 |
if (isset($payload->nbf) && $payload->nbf > ($timestamp + static::$leeway)) {
|
128 |
throw new BeforeValidException(
|
129 |
+
'Cannot handle token prior to ' . \date(DateTime::ISO8601, $payload->nbf)
|
130 |
);
|
131 |
}
|
132 |
|
135 |
// correctly used the nbf claim).
|
136 |
if (isset($payload->iat) && $payload->iat > ($timestamp + static::$leeway)) {
|
137 |
throw new BeforeValidException(
|
138 |
+
'Cannot handle token prior to ' . \date(DateTime::ISO8601, $payload->iat)
|
139 |
);
|
140 |
}
|
141 |
|
154 |
* @param string $key The secret key.
|
155 |
* If the algorithm used is asymmetric, this is the private key
|
156 |
* @param string $alg The signing algorithm.
|
157 |
+
* Supported algorithms are 'ES256', 'HS256', 'HS384', 'HS512', 'RS256', 'RS384', and 'RS512'
|
158 |
* @param mixed $keyId
|
159 |
* @param array $head An array with header elements to attach
|
160 |
*
|
169 |
if ($keyId !== null) {
|
170 |
$header['kid'] = $keyId;
|
171 |
}
|
172 |
+
if (isset($head) && \is_array($head)) {
|
173 |
+
$header = \array_merge($head, $header);
|
174 |
}
|
175 |
$segments = array();
|
176 |
$segments[] = static::urlsafeB64Encode(static::jsonEncode($header));
|
177 |
$segments[] = static::urlsafeB64Encode(static::jsonEncode($payload));
|
178 |
+
$signing_input = \implode('.', $segments);
|
179 |
|
180 |
$signature = static::sign($signing_input, $key, $alg);
|
181 |
$segments[] = static::urlsafeB64Encode($signature);
|
182 |
|
183 |
+
return \implode('.', $segments);
|
184 |
}
|
185 |
|
186 |
/**
|
189 |
* @param string $msg The message to sign
|
190 |
* @param string|resource $key The secret key
|
191 |
* @param string $alg The signing algorithm.
|
192 |
+
* Supported algorithms are 'ES256', 'HS256', 'HS384', 'HS512', 'RS256', 'RS384', and 'RS512'
|
193 |
*
|
194 |
* @return string An encrypted message
|
195 |
*
|
201 |
throw new DomainException('Algorithm not supported');
|
202 |
}
|
203 |
list($function, $algorithm) = static::$supported_algs[$alg];
|
204 |
+
switch ($function) {
|
205 |
case 'hash_hmac':
|
206 |
+
return \hash_hmac($algorithm, $msg, $key, true);
|
207 |
case 'openssl':
|
208 |
$signature = '';
|
209 |
+
$success = \openssl_sign($msg, $signature, $key, $algorithm);
|
210 |
if (!$success) {
|
211 |
throw new DomainException("OpenSSL unable to sign data");
|
212 |
} else {
|
213 |
+
if ($alg === 'ES256') {
|
214 |
+
$signature = self::signatureFromDER($signature, 256);
|
215 |
+
}
|
216 |
return $signature;
|
217 |
}
|
218 |
}
|
238 |
}
|
239 |
|
240 |
list($function, $algorithm) = static::$supported_algs[$alg];
|
241 |
+
switch ($function) {
|
242 |
case 'openssl':
|
243 |
+
$success = \openssl_verify($msg, $signature, $key, $algorithm);
|
244 |
if ($success === 1) {
|
245 |
return true;
|
246 |
} elseif ($success === 0) {
|
248 |
}
|
249 |
// returns 1 on success, 0 on failure, -1 on error.
|
250 |
throw new DomainException(
|
251 |
+
'OpenSSL error: ' . \openssl_error_string()
|
252 |
);
|
253 |
case 'hash_hmac':
|
254 |
default:
|
255 |
+
$hash = \hash_hmac($algorithm, $msg, $key, true);
|
256 |
+
if (\function_exists('hash_equals')) {
|
257 |
+
return \hash_equals($signature, $hash);
|
258 |
}
|
259 |
+
$len = \min(static::safeStrlen($signature), static::safeStrlen($hash));
|
260 |
|
261 |
$status = 0;
|
262 |
for ($i = 0; $i < $len; $i++) {
|
263 |
+
$status |= (\ord($signature[$i]) ^ \ord($hash[$i]));
|
264 |
}
|
265 |
$status |= (static::safeStrlen($signature) ^ static::safeStrlen($hash));
|
266 |
|
279 |
*/
|
280 |
public static function jsonDecode($input)
|
281 |
{
|
282 |
+
if (\version_compare(PHP_VERSION, '5.4.0', '>=') && !(\defined('JSON_C_VERSION') && PHP_INT_SIZE > 4)) {
|
283 |
/** In PHP >=5.4.0, json_decode() accepts an options parameter, that allows you
|
284 |
* to specify that large ints (like Steam Transaction IDs) should be treated as
|
285 |
* strings, rather than the PHP default behaviour of converting them to floats.
|
286 |
*/
|
287 |
+
$obj = \json_decode($input, false, 512, JSON_BIGINT_AS_STRING);
|
288 |
} else {
|
289 |
/** Not all servers will support that, however, so for older versions we must
|
290 |
* manually detect large ints in the JSON string and quote them (thus converting
|
291 |
*them to strings) before decoding, hence the preg_replace() call.
|
292 |
*/
|
293 |
+
$max_int_length = \strlen((string) PHP_INT_MAX) - 1;
|
294 |
+
$json_without_bigints = \preg_replace('/:\s*(-?\d{'.$max_int_length.',})/', ': "$1"', $input);
|
295 |
+
$obj = \json_decode($json_without_bigints);
|
296 |
}
|
297 |
|
298 |
+
if ($errno = \json_last_error()) {
|
299 |
static::handleJsonError($errno);
|
300 |
} elseif ($obj === null && $input !== 'null') {
|
301 |
throw new DomainException('Null result with non-null input');
|
314 |
*/
|
315 |
public static function jsonEncode($input)
|
316 |
{
|
317 |
+
$json = \json_encode($input);
|
318 |
+
if ($errno = \json_last_error()) {
|
319 |
static::handleJsonError($errno);
|
320 |
} elseif ($json === 'null' && $input !== null) {
|
321 |
throw new DomainException('Null result with non-null input');
|
332 |
*/
|
333 |
public static function urlsafeB64Decode($input)
|
334 |
{
|
335 |
+
$remainder = \strlen($input) % 4;
|
336 |
if ($remainder) {
|
337 |
$padlen = 4 - $remainder;
|
338 |
+
$input .= \str_repeat('=', $padlen);
|
339 |
}
|
340 |
+
return \base64_decode(\strtr($input, '-_', '+/'));
|
341 |
}
|
342 |
|
343 |
/**
|
349 |
*/
|
350 |
public static function urlsafeB64Encode($input)
|
351 |
{
|
352 |
+
return \str_replace('=', '', \strtr(\base64_encode($input), '+/', '-_'));
|
353 |
}
|
354 |
|
355 |
/**
|
378 |
/**
|
379 |
* Get the number of bytes in cryptographic strings.
|
380 |
*
|
381 |
+
* @param string $str
|
382 |
*
|
383 |
* @return int
|
384 |
*/
|
385 |
private static function safeStrlen($str)
|
386 |
{
|
387 |
+
if (\function_exists('mb_strlen')) {
|
388 |
+
return \mb_strlen($str, '8bit');
|
389 |
}
|
390 |
+
return \strlen($str);
|
391 |
+
}
|
392 |
+
|
393 |
+
/**
|
394 |
+
* Convert an ECDSA signature to an ASN.1 DER sequence
|
395 |
+
*
|
396 |
+
* @param string $sig The ECDSA signature to convert
|
397 |
+
* @return string The encoded DER object
|
398 |
+
*/
|
399 |
+
private static function signatureToDER($sig)
|
400 |
+
{
|
401 |
+
// Separate the signature into r-value and s-value
|
402 |
+
list($r, $s) = \str_split($sig, (int) (\strlen($sig) / 2));
|
403 |
+
|
404 |
+
// Trim leading zeros
|
405 |
+
$r = \ltrim($r, "\x00");
|
406 |
+
$s = \ltrim($s, "\x00");
|
407 |
+
|
408 |
+
// Convert r-value and s-value from unsigned big-endian integers to
|
409 |
+
// signed two's complement
|
410 |
+
if (\ord($r[0]) > 0x7f) {
|
411 |
+
$r = "\x00" . $r;
|
412 |
+
}
|
413 |
+
if (\ord($s[0]) > 0x7f) {
|
414 |
+
$s = "\x00" . $s;
|
415 |
+
}
|
416 |
+
|
417 |
+
return self::encodeDER(
|
418 |
+
self::ASN1_SEQUENCE,
|
419 |
+
self::encodeDER(self::ASN1_INTEGER, $r) .
|
420 |
+
self::encodeDER(self::ASN1_INTEGER, $s)
|
421 |
+
);
|
422 |
+
}
|
423 |
+
|
424 |
+
/**
|
425 |
+
* Encodes a value into a DER object.
|
426 |
+
*
|
427 |
+
* @param int $type DER tag
|
428 |
+
* @param string $value the value to encode
|
429 |
+
* @return string the encoded object
|
430 |
+
*/
|
431 |
+
private static function encodeDER($type, $value)
|
432 |
+
{
|
433 |
+
$tag_header = 0;
|
434 |
+
if ($type === self::ASN1_SEQUENCE) {
|
435 |
+
$tag_header |= 0x20;
|
436 |
+
}
|
437 |
+
|
438 |
+
// Type
|
439 |
+
$der = \chr($tag_header | $type);
|
440 |
+
|
441 |
+
// Length
|
442 |
+
$der .= \chr(\strlen($value));
|
443 |
+
|
444 |
+
return $der . $value;
|
445 |
+
}
|
446 |
+
|
447 |
+
/**
|
448 |
+
* Encodes signature from a DER object.
|
449 |
+
*
|
450 |
+
* @param string $der binary signature in DER format
|
451 |
+
* @param int $keySize the number of bits in the key
|
452 |
+
* @return string the signature
|
453 |
+
*/
|
454 |
+
private static function signatureFromDER($der, $keySize)
|
455 |
+
{
|
456 |
+
// OpenSSL returns the ECDSA signatures as a binary ASN.1 DER SEQUENCE
|
457 |
+
list($offset, $_) = self::readDER($der);
|
458 |
+
list($offset, $r) = self::readDER($der, $offset);
|
459 |
+
list($offset, $s) = self::readDER($der, $offset);
|
460 |
+
|
461 |
+
// Convert r-value and s-value from signed two's compliment to unsigned
|
462 |
+
// big-endian integers
|
463 |
+
$r = \ltrim($r, "\x00");
|
464 |
+
$s = \ltrim($s, "\x00");
|
465 |
+
|
466 |
+
// Pad out r and s so that they are $keySize bits long
|
467 |
+
$r = \str_pad($r, $keySize / 8, "\x00", STR_PAD_LEFT);
|
468 |
+
$s = \str_pad($s, $keySize / 8, "\x00", STR_PAD_LEFT);
|
469 |
+
|
470 |
+
return $r . $s;
|
471 |
+
}
|
472 |
+
|
473 |
+
/**
|
474 |
+
* Reads binary DER-encoded data and decodes into a single object
|
475 |
+
*
|
476 |
+
* @param string $der the binary data in DER format
|
477 |
+
* @param int $offset the offset of the data stream containing the object
|
478 |
+
* to decode
|
479 |
+
* @return array [$offset, $data] the new offset and the decoded object
|
480 |
+
*/
|
481 |
+
private static function readDER($der, $offset = 0)
|
482 |
+
{
|
483 |
+
$pos = $offset;
|
484 |
+
$size = \strlen($der);
|
485 |
+
$constructed = (\ord($der[$pos]) >> 5) & 0x01;
|
486 |
+
$type = \ord($der[$pos++]) & 0x1f;
|
487 |
+
|
488 |
+
// Length
|
489 |
+
$len = \ord($der[$pos++]);
|
490 |
+
if ($len & 0x80) {
|
491 |
+
$n = $len & 0x1f;
|
492 |
+
$len = 0;
|
493 |
+
while ($n-- && $pos < $size) {
|
494 |
+
$len = ($len << 8) | \ord($der[$pos++]);
|
495 |
+
}
|
496 |
+
}
|
497 |
+
|
498 |
+
// Value
|
499 |
+
if ($type == self::ASN1_BIT_STRING) {
|
500 |
+
$pos++; // Skip the first contents octet (padding indicator)
|
501 |
+
$data = \substr($der, $pos, $len - 1);
|
502 |
+
$pos += $len - 1;
|
503 |
+
} elseif (!$constructed) {
|
504 |
+
$data = \substr($der, $pos, $len);
|
505 |
+
$pos += $len;
|
506 |
+
} else {
|
507 |
+
$data = null;
|
508 |
+
}
|
509 |
+
|
510 |
+
return array($pos, $data);
|
511 |
}
|
512 |
}
|
vendor/firebase/php-jwt/src/SignatureInvalidException.php
CHANGED
@@ -3,5 +3,4 @@ namespace Firebase\JWT;
|
|
3 |
|
4 |
class SignatureInvalidException extends \UnexpectedValueException
|
5 |
{
|
6 |
-
|
7 |
}
|
3 |
|
4 |
class SignatureInvalidException extends \UnexpectedValueException
|
5 |
{
|
|
|
6 |
}
|