Auto Terms of Service and Privacy Policy - Version 2.4.0

Version Description

Download this release

Release Info

Developer wpautoterms
Plugin Icon Auto Terms of Service and Privacy Policy
Version 2.4.0
Comparing to
See all releases

Code changes from version 2.3.2 to 2.4.0

Files changed (55) hide show
  1. README.txt +19 -10
  2. api.php +7 -10
  3. auto-terms-of-service-privacy-policy.php +1 -1
  4. banner-1544x500.png +0 -0
  5. banner-1880x609.png +0 -0
  6. banner-772x250.png +0 -0
  7. bitbucket-pipelines.yml +0 -22
  8. css/admin.css +48 -2
  9. icon-128x128.png +0 -0
  10. icon-256x256.png +0 -0
  11. icon.svg +1 -1
  12. images/icon.png +0 -0
  13. images/icon.svg +1 -1
  14. includes/admin/action/recheck-license.php +11 -8
  15. includes/admin/action/toggle-action.php +1 -1
  16. includes/admin/action/transfer-license.php +32 -0
  17. includes/admin/admin.php +7 -4
  18. includes/admin/form/legal-page.php +19 -4
  19. includes/admin/form/licensed-legal-page.php +4 -5
  20. includes/admin/page/base.php +11 -4
  21. includes/admin/page/license-settings.php +17 -9
  22. includes/admin/page/settings-base.php +2 -1
  23. includes/admin/page/settings-page.php +2 -2
  24. includes/api/agreement.php +2 -2
  25. includes/api/license-info-vo.php +87 -0
  26. includes/api/license-transfer.php +38 -0
  27. includes/api/license.php +45 -36
  28. includes/api/query.php +1 -1
  29. includes/autoload.php +10 -8
  30. includes/box/licensed-box.php +3 -3
  31. includes/frontend.php +2 -2
  32. includes/frontend/endorsements.php +1 -1
  33. includes/frontend/notice/cookies-notice.php +1 -1
  34. includes/legal-pages/conf.php +8 -6
  35. includes/legal-pages/page.php +13 -1
  36. includes/option/checkbox-option-ex.php +2 -2
  37. includes/vo.php +65 -0
  38. includes/wpautoterms.php +5 -1
  39. js/box-page.js +1 -1
  40. js/contact-form.js +0 -2
  41. js/license-settings.js +44 -17
  42. js/license-transfer.js +86 -0
  43. screenshot-1.png +0 -0
  44. screenshot-2.png +0 -0
  45. screenshot-3.png +0 -0
  46. screenshot-4.png +0 -0
  47. screenshot-5.png +0 -0
  48. templates/auto-draft-page.php +8 -0
  49. templates/auto-draft.php +6 -2
  50. templates/legal-pages/admin/privacy-policy.php +7 -3
  51. templates/legal-pages/admin/terms-and-conditions.php +7 -4
  52. templates/options/box.php +27 -16
  53. templates/options/license-status-option.php +0 -27
  54. templates/pages/help.php +6 -2
  55. templates/pages/license_settings.php +197 -7
README.txt CHANGED
@@ -1,22 +1,22 @@
1
- === WP AutoTerms: Privacy Policy Generator, Cookie Notice Banner, Terms & Conditions Generator ===
2
  Contributors: wpautoterms
3
- Tags: gdpr, privacy policy, terms and conditions, cookie consent, terms of service, disclosure, disclaimer, affiliates, legal
4
  Requires at least: 4.2
5
- Tested up to: 5.3
6
  Requires PHP: 5.3
7
- Stable tag: 2.3.2
8
  License: GPL version 3 or any later version
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
11
- Install your GDPR Cookie Consent Banner. Create GDPR Privacy Policy, Terms & Conditions, Disclaimers. More Compliance Kits to help you get compliant with the law.
12
 
13
  == Description ==
14
 
15
- WP AutoTerms plugin helps you with a wide range of legal requirements your WordPress website might be required to keep up with, such as the GDPR law or the requirement to have a disclosure for affiliate links.
16
 
17
  Previously, WP AutoTerms was called "Auto Terms of Service and Privacy Policy".
18
 
19
- = Create GDPR Privacy Policy and other legal agreements =
20
 
21
  WP AutoTerms helps you create three of the most important legal pages your WordPress website needs using a simple wizard, such as a Privacy Policy, a Terms & Conditions agreement or a Cookies Policy.
22
 
@@ -34,7 +34,7 @@ You can also create your own legal pages and manage them through WP AutoTerms.
34
 
35
  The following features are available under WP AutoTerms Premium:
36
 
37
- * GDPR Privacy Policy. Create a Privacy Policy with GDPR wording.
38
 
39
  * Cookies Notice. Among other things, the EU Cookies Directive law requires you to inform users that you use cookies through your website. Use this Kit to show an announcement bar to comply with some of the EU Cookies Directive requirements.
40
 
@@ -61,7 +61,7 @@ Yes! The core features of WP AutoTerms are and always will be free.
61
 
62
  A premium license is available to purchase as a one-time fee if you'd like to upgrade WP AutoTerms toinclude more features:
63
 
64
- - Create Privacy Policy with GDPR wording
65
  - Include a Cookies Notice banner
66
  - Inform users of your affiliate links usage
67
 
@@ -69,8 +69,8 @@ A premium license is available to purchase as a one-time fee if you'd like to up
69
 
70
  You can create the following legal agreements with WP AutoTerms:
71
 
72
- - Terms & Conditions
73
  - Privacy Policy
 
74
  - Cookies Policy
75
 
76
  You also have the option to create your own custom legal page by selecting "Custom legal page" from the "Add Legal Page" menu.
@@ -119,6 +119,15 @@ Installing the plugin is easy. Just follow these steps:
119
 
120
  == Changelog ==
121
 
 
 
 
 
 
 
 
 
 
122
  = Version 2.3.2 =
123
  * Jan 27, 2020
124
  * Fix: Disable plugin if page is AMP endpoint (AMP does not allow JS scripts)
1
+ === WP AutoTerms: Privacy Policy Generator, Terms & Conditions Generator, Cookie Notice Banner ===
2
  Contributors: wpautoterms
3
+ Tags: privacy policy, terms and conditions, cookie consent, cookie notice, ccpa, gdpr, terms of service, disclosure, disclaimer, affiliates, consent, legal
4
  Requires at least: 4.2
5
+ Tested up to: 5.4
6
  Requires PHP: 5.3
7
+ Stable tag: 2.4.0
8
  License: GPL version 3 or any later version
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
11
+ GDPR & CCPA Privacy Policy Generator, Terms & Conditions Generator, Disclaimers for Affiliate links. Compliance Kits to help you get compliant with the law.
12
 
13
  == Description ==
14
 
15
+ WP AutoTerms plugin helps you with a wide range of legal requirements your WordPress website might be required to keep up with, such as the CCPA or the GDPR law or Amazon Associates requirement to have a disclosure for affiliate links.
16
 
17
  Previously, WP AutoTerms was called "Auto Terms of Service and Privacy Policy".
18
 
19
+ = Create GDPR & CCPA Privacy Policy and other legal agreements =
20
 
21
  WP AutoTerms helps you create three of the most important legal pages your WordPress website needs using a simple wizard, such as a Privacy Policy, a Terms & Conditions agreement or a Cookies Policy.
22
 
34
 
35
  The following features are available under WP AutoTerms Premium:
36
 
37
+ * CCPA & GDPR Privacy Policy. Create a Professional Privacy Policy with CCPA & GDPR wording.
38
 
39
  * Cookies Notice. Among other things, the EU Cookies Directive law requires you to inform users that you use cookies through your website. Use this Kit to show an announcement bar to comply with some of the EU Cookies Directive requirements.
40
 
61
 
62
  A premium license is available to purchase as a one-time fee if you'd like to upgrade WP AutoTerms toinclude more features:
63
 
64
+ - Create Privacy Policy with CCPA & GDPR wording
65
  - Include a Cookies Notice banner
66
  - Inform users of your affiliate links usage
67
 
69
 
70
  You can create the following legal agreements with WP AutoTerms:
71
 
 
72
  - Privacy Policy
73
+ - Terms & Conditions
74
  - Cookies Policy
75
 
76
  You also have the option to create your own custom legal page by selecting "Custom legal page" from the "Add Legal Page" menu.
119
 
120
  == Changelog ==
121
 
122
+ = Version 2.4.0 =
123
+ * Apr 26, 2020
124
+ * New logo & identity
125
+ * Feature: Upgraded our Privacy Policy wizard to include CCPA provisions (it's now called Professional Privacy Policy)
126
+ * Feature: Allow the transfer of a License key to another website (self-service)
127
+ * Feature: Upgrade License key to allow more websites (self-service)
128
+ * Fix: Fixed 404 Not Found error when visiting a generated Legal Page
129
+ * Update: Tested up to WordPress 5.4
130
+
131
  = Version 2.3.2 =
132
  * Jan 27, 2020
133
  * Fix: Disable plugin if page is AMP endpoint (AMP does not allow JS scripts)
api.php CHANGED
@@ -3,14 +3,11 @@ if ( ! defined( 'ABSPATH' ) ) {
3
  exit;
4
  }
5
 
6
- define( 'WPAUTOTERMS_API_URL', 'https://app.wpautoterms.com/' );
7
- define( 'WPAUTOTERMS_PURCHASE_URL', 'https://app.wpautoterms.com/product/v1/buy' );
 
 
 
8
 
9
- /*
10
- |
11
- | Only for development purposes
12
- | DO NOT MODIFY
13
- |
14
- */
15
- //define( 'WPAUTOTERMS_API_URL', 'http://127.0.0.1:5000/' );
16
- //define( 'WPAUTOTERMS_PURCHASE_URL', 'http://127.0.0.1:5000/product/v1/buy' );
3
  exit;
4
  }
5
 
6
+ if ( ! defined( 'WPAUTOTERMS_API_URL' ) ) {
7
+ define( 'WPAUTOTERMS_API_URL', 'https://app.wpautoterms.com/' );
8
+ // define( 'WPAUTOTERMS_API_URL', 'https://app.staging.wpautoterms.com/' );
9
+ // define( 'WPAUTOTERMS_API_URL', 'http://127.0.0.1:5000/' );
10
+ }
11
 
12
+ define( 'WPAUTOTERMS_PURCHASE_URL', WPAUTOTERMS_API_URL . 'product/v1/buy' );
13
+ define( 'WPAUTOTERMS_UPGRADE_URL', WPAUTOTERMS_API_URL . 'product/v1/upgrade' );
 
 
 
 
 
 
auto-terms-of-service-privacy-policy.php CHANGED
@@ -5,7 +5,7 @@ Plugin URI: https://wpautoterms.com
5
  Description: Create Privacy Policy, GDPR Privacy Policy, Terms & Conditions, Disclaimers. Cookie Consent Banner. More Compliance Kits to help you get compliant with the law.
6
  Author: WP AutoTerms
7
  Author URI: https://wpautoterms.com
8
- Version: 2.3.2
9
  License: GPLv2 or later
10
  Text Domain: wpautoterms
11
  Domain Path: /languages
5
  Description: Create Privacy Policy, GDPR Privacy Policy, Terms & Conditions, Disclaimers. Cookie Consent Banner. More Compliance Kits to help you get compliant with the law.
6
  Author: WP AutoTerms
7
  Author URI: https://wpautoterms.com
8
+ Version: 2.4.0
9
  License: GPLv2 or later
10
  Text Domain: wpautoterms
11
  Domain Path: /languages
banner-1544x500.png CHANGED
Binary file
banner-1880x609.png CHANGED
Binary file
banner-772x250.png CHANGED
Binary file
bitbucket-pipelines.yml DELETED
@@ -1,22 +0,0 @@
1
- # This is a sample build configuration for Docker.
2
- # Check our guides at https://confluence.atlassian.com/x/O1toN for more examples.
3
- # Only use spaces to indent your .yml configuration.
4
- # -----
5
- # You can specify a custom docker image from Docker Hub as your build environment.
6
- image: atlassian/default-image:2
7
-
8
- pipelines:
9
- default:
10
- - step:
11
- services:
12
- - docker
13
- script: # Modify the commands below to build your repository.
14
- # Set $DOCKER_HUB_USERNAME and $DOCKER_HUB_PASSWORD as environment variables in repository settings
15
- - export IMAGE_NAME=your-Dockerhub-account/your-docker-image-name:$BITBUCKET_COMMIT
16
-
17
- # build the Docker image (this will use the Dockerfile in the root of the repo)
18
- - docker build -t $IMAGE_NAME .
19
- # authenticate with the Docker Hub registry
20
- - docker login --username $DOCKER_HUB_USERNAME --password $DOCKER_HUB_PASSWORD
21
- # push the new Docker image to the Docker registry
22
- - docker push $IMAGE_NAME
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
css/admin.css CHANGED
@@ -135,8 +135,10 @@ ul.legal-pages-form-radio {
135
  color: lightgray !important;
136
  }
137
 
138
- .wpautoterms-license-key {
139
- width: 24em;
 
 
140
  }
141
 
142
  .wpautoterms-option-info {
@@ -377,3 +379,47 @@ ul.legal-pages-form-radio {
377
  .wpautoterms-sortable-list li.active a {
378
  color: #F9F9F9;
379
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
135
  color: lightgray !important;
136
  }
137
 
138
+ .wpautoterms-license-key,
139
+ .wpautoterms-transfer-email,
140
+ .wpautoterms-transfer-site {
141
+ width: 32em;
142
  }
143
 
144
  .wpautoterms-option-info {
379
  .wpautoterms-sortable-list li.active a {
380
  color: #F9F9F9;
381
  }
382
+
383
+ #wpautoterms_request_transfer, #wpautoterms_request_transfer_address {
384
+ background: #FFF;
385
+ border: 1px solid #CCC;
386
+ border-radius: 5px;
387
+ padding: 20px;
388
+ }
389
+
390
+ .wpautoterms-transfer-entry {
391
+ padding-top: 0;
392
+ padding-bottom: 4px;
393
+ }
394
+
395
+ .wpautoterms-transfer-entry label {
396
+ display: inline-block;
397
+ width: 12em;
398
+ }
399
+
400
+ #wpautoterms_transfer, #wpautoterms_transfer_address {
401
+ line-height: 2.3;
402
+ }
403
+
404
+ .wpautoterms-license-upgrade {
405
+ display: inline-block;
406
+ }
407
+
408
+ .wpautoterms-license-upgrade .button {
409
+ margin: 15px 0 0 0;
410
+ }
411
+
412
+ .wpautoterms-transfer-address .button {
413
+ margin: 15px 0 0 0;
414
+ }
415
+
416
+ .license-page .license-key-save-recheck td {
417
+ padding: 0 10px;
418
+ vertical-align: top;
419
+ margin: 0;
420
+ }
421
+
422
+ .license-page .license-key-save-recheck .submit {
423
+ margin: 0;
424
+ padding: 0;
425
+ }
icon-128x128.png CHANGED
Binary file
icon-256x256.png CHANGED
Binary file
icon.svg CHANGED
@@ -1 +1 @@
1
- <svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 150 150"><defs><style>.cls-1,.cls-3{fill:#1495a6;}.cls-2{fill:#fff;}.cls-3{stroke:#fff;stroke-miterlimit:10;stroke-width:0.75px;}</style></defs><title>icon</title><rect class="cls-1" width="150" height="150" rx="4" ry="4"/><path class="cls-2" d="M961.72,384.44c.24-4.49,4.57-6.93,8.67-2.84l9.85,9.85a7.7,7.7,0,0,0,10.87,0l6.93-6.93,3-3c3.86-4,1.34-8.27-3.07-8.59-7.41-.47-11.5-8.35-5.51-14.81,6.54-6.07,14.42-1.81,14.81,5.51.32,4.41,4.57,6.93,8.59,3.07l2.68-2.68,7.17-7.17h0l.08-.08a7.46,7.46,0,0,0,0-10.56l-10-10c-4.1-4.1-1.58-8.35,2.84-8.67,7.41-.47,11.5-8.35,5.51-14.81-6.54-6.07-14.34-1.89-14.73,5.44-.24,4.49-4.65,7-8.74,2.91l-9.77-9.77a7.46,7.46,0,0,0-10.56,0l-9.85,9.85c-4.1,4.1-8.43,1.5-8.74-2.91-.47-7.41-8.35-11.5-14.81-5.51-6.07,6.54-1.81,14.42,5.51,14.81,4.49.24,7,4.65,2.91,8.74l-9.85,9.85a7.46,7.46,0,0,0,0,10.56l9.77,9.77c4.1,4.1,1.65,8.27-2.76,8.59-7.41.47-11.42,8.27-5.51,14.81C953.53,395.94,961.33,391.77,961.72,384.44Z" transform="translate(-909.5 -276.5)"/><path class="cls-3" d="M1007.24,348.84A24.22,24.22,0,1,1,983,373.06,24.17,24.17,0,0,1,1007.24,348.84Z" transform="translate(-909.5 -276.5)"/><path class="cls-2" d="M1017.46,363.88a3.05,3.05,0,0,0-1.75.9l-13,13-3.93-3.93a3,3,0,1,0-4.26,4.3l6.05,6.05a3.14,3.14,0,0,0,4.26,0L1020,369.08a3,3,0,0,0-2.51-5.2Z" transform="translate(-909.5 -276.5)"/></svg>
1
+ <svg viewBox="0 0 128 128" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><radialGradient id="a" cx="-2409.47" cy="-392.07" gradientTransform="matrix(.69 0 0 .79 1781.43 339.43)" gradientUnits="userSpaceOnUse" r="197.62"><stop offset="0" stop-color="#009afd"/><stop offset=".22" stop-color="#0098fd"/><stop offset=".35" stop-color="#008ffd"/><stop offset=".46" stop-color="#0081fd"/><stop offset=".55" stop-color="#006efc"/><stop offset=".6" stop-color="#005ffc"/></radialGradient><linearGradient id="b" gradientUnits="userSpaceOnUse" x1="78.66" x2="42.39" y1="53.08" y2="52.83"><stop offset=".08" stop-opacity="0"/><stop offset=".81"/></linearGradient><linearGradient id="c" gradientUnits="userSpaceOnUse" x1="99.08" x2="87.08" y1="31.21" y2="43.91"><stop offset=".36" stop-color="#baf7fe"/><stop offset=".42" stop-color="#a6f5fe"/><stop offset=".56" stop-color="#74effd"/><stop offset=".74" stop-color="#23e7fb"/><stop offset=".76" stop-color="#1be6fb"/></linearGradient><linearGradient id="d" gradientUnits="userSpaceOnUse" x1="68.09" x2="37.97" y1="42.4" y2="42.4"><stop offset="0" stop-color="#01e3fb"/><stop offset=".23" stop-color="#01c5f7"/><stop offset=".51" stop-color="#01a6f3"/><stop offset=".75" stop-color="#0193f1"/><stop offset=".92" stop-color="#018cf0"/></linearGradient><linearGradient id="e" gradientUnits="userSpaceOnUse" x1="64.79" x2="38.89" y1="61.8" y2="61.8"><stop offset="0" stop-color="#01dffa"/><stop offset=".16" stop-color="#01c8f7"/><stop offset=".41" stop-color="#01a9f3"/><stop offset=".63" stop-color="#0196f1"/><stop offset=".78" stop-color="#018ff0"/></linearGradient><path d="m0 0h128v128h-128z" fill="#fff"/><path d="m87.91 32.27h-33.63l-1.49 9.73c-.12.82-.26 1.7-.4 2.65h1.14a5.13 5.13 0 0 1 3.92 1.76 7 7 0 0 1 1.43 5.73 9.53 9.53 0 0 1 -2.71 5.3 7.18 7.18 0 0 1 -4.84 2.19c0 .6.06 1.18.1 1.77.11 1.52.27 3 .48 4.4 3.16 21.15 17.12 30 17.12 30s25.73-13.63 31.72-47.6c.1-.58.2-1.17.29-1.76 2.16-14.17-13.13-14.17-13.13-14.17zm-4.46 29.19-.11.67a2.12 2.12 0 0 1 -1.91 1.87h-13.57a1.48 1.48 0 0 1 -1.34-1.87l.11-.67a2.12 2.12 0 0 1 1.9-1.87h13.58a1.49 1.49 0 0 1 1.34 1.87zm7.4-8.46a2.78 2.78 0 0 1 -.79 1.56 2.13 2.13 0 0 1 -1.46.65h-19.11a1.75 1.75 0 0 1 -1.57-2.21 2.89 2.89 0 0 1 .8-1.56 2.14 2.14 0 0 1 1.45-.64h19.11a1.74 1.74 0 0 1 1.57 2.2z" fill="url(#a)"/><path d="m67.92 53a1.75 1.75 0 0 0 1.57 2.21h8.21v4.4h-26.37a7.18 7.18 0 0 0 4.84-2.19 9.53 9.53 0 0 0 2.71-5.3 7 7 0 0 0 -1.43-5.73h20.25v4.41h-7.53a2.14 2.14 0 0 0 -1.45.64 2.89 2.89 0 0 0 -.8 1.56z" fill="url(#b)" opacity=".2"/><path d="m58.93 63.56a2.81 2.81 0 0 1 -.79 1.56 2.14 2.14 0 0 1 -1.46.64h-4.77c-.21-1.41-.37-2.88-.48-4.4h5.93a1.74 1.74 0 0 1 1.57 2.2z" opacity=".1"/><path d="m68 44.17a2.81 2.81 0 0 1 -.79 1.56 2.18 2.18 0 0 1 -1.46.64h-8.3a5.13 5.13 0 0 0 -3.92-1.76h-1.14c.14-1 .28-1.83.4-2.65h13.65a1.74 1.74 0 0 1 1.56 2.21z" opacity=".1"/><path d="m101 46.37c-.09.59-.19 1.18-.29 1.76h-16.4c-2.11 0-3.53-2-3.15-4.4l.84-5.51a11 11 0 0 0 -.49-5.95h6.4s15.29 0 13.09 14.1z" opacity=".1"/><path d="m52.05 54.3h-23.7a1.73 1.73 0 0 1 -1.57-2.2 2.5 2.5 0 0 1 2.22-2.2h23.72a1.74 1.74 0 0 1 1.58 2.2 2.5 2.5 0 0 1 -2.25 2.2z" fill="#01e3fb"/><path d="m46.79 73.7h-9.17a1.74 1.74 0 0 1 -1.57-2.21 2.5 2.5 0 0 1 2.24-2.2h9.18a1.74 1.74 0 0 1 1.53 2.2 2.51 2.51 0 0 1 -2.21 2.21z" fill="#01e3fb"/><path d="m87.91 32.27h-6.12c1.69 0 2.64 2.77 2.12 6.17l-.68 4.41c-.3 1.94.83 3.52 2.52 3.52h15.25c2.2-14.1-13.09-14.1-13.09-14.1z" fill="url(#c)"/><path d="m67.29 44.61h-31.29a1.74 1.74 0 0 1 -1.57-2.21 2.5 2.5 0 0 1 2.25-2.2h31.32a1.74 1.74 0 0 1 1.57 2.2 2.51 2.51 0 0 1 -2.28 2.21z" fill="url(#d)"/><path d="m58.21 64h-14.52a1.74 1.74 0 0 1 -1.58-2.2 2.52 2.52 0 0 1 2.25-2.21h14.53a1.74 1.74 0 0 1 1.57 2.21 2.51 2.51 0 0 1 -2.25 2.2z" fill="url(#e)"/></svg>
images/icon.png CHANGED
Binary file
images/icon.svg CHANGED
@@ -1 +1 @@
1
- <svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 150 150"><defs><style>.cls-1,.cls-3{fill:#1495a6;}.cls-2{fill:#fff;}.cls-3{stroke:#fff;stroke-miterlimit:10;stroke-width:0.75px;}</style></defs><title>icon</title><rect class="cls-1" width="150" height="150" rx="4" ry="4"/><path class="cls-2" d="M961.72,384.44c.24-4.49,4.57-6.93,8.67-2.84l9.85,9.85a7.7,7.7,0,0,0,10.87,0l6.93-6.93,3-3c3.86-4,1.34-8.27-3.07-8.59-7.41-.47-11.5-8.35-5.51-14.81,6.54-6.07,14.42-1.81,14.81,5.51.32,4.41,4.57,6.93,8.59,3.07l2.68-2.68,7.17-7.17h0l.08-.08a7.46,7.46,0,0,0,0-10.56l-10-10c-4.1-4.1-1.58-8.35,2.84-8.67,7.41-.47,11.5-8.35,5.51-14.81-6.54-6.07-14.34-1.89-14.73,5.44-.24,4.49-4.65,7-8.74,2.91l-9.77-9.77a7.46,7.46,0,0,0-10.56,0l-9.85,9.85c-4.1,4.1-8.43,1.5-8.74-2.91-.47-7.41-8.35-11.5-14.81-5.51-6.07,6.54-1.81,14.42,5.51,14.81,4.49.24,7,4.65,2.91,8.74l-9.85,9.85a7.46,7.46,0,0,0,0,10.56l9.77,9.77c4.1,4.1,1.65,8.27-2.76,8.59-7.41.47-11.42,8.27-5.51,14.81C953.53,395.94,961.33,391.77,961.72,384.44Z" transform="translate(-909.5 -276.5)"/><path class="cls-3" d="M1007.24,348.84A24.22,24.22,0,1,1,983,373.06,24.17,24.17,0,0,1,1007.24,348.84Z" transform="translate(-909.5 -276.5)"/><path class="cls-2" d="M1017.46,363.88a3.05,3.05,0,0,0-1.75.9l-13,13-3.93-3.93a3,3,0,1,0-4.26,4.3l6.05,6.05a3.14,3.14,0,0,0,4.26,0L1020,369.08a3,3,0,0,0-2.51-5.2Z" transform="translate(-909.5 -276.5)"/></svg>
1
+ <svg viewBox="0 0 128 128" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><radialGradient id="a" cx="-2409.47" cy="-392.07" gradientTransform="matrix(.69 0 0 .79 1781.43 339.43)" gradientUnits="userSpaceOnUse" r="197.62"><stop offset="0" stop-color="#009afd"/><stop offset=".22" stop-color="#0098fd"/><stop offset=".35" stop-color="#008ffd"/><stop offset=".46" stop-color="#0081fd"/><stop offset=".55" stop-color="#006efc"/><stop offset=".6" stop-color="#005ffc"/></radialGradient><linearGradient id="b" gradientUnits="userSpaceOnUse" x1="78.66" x2="42.39" y1="53.08" y2="52.83"><stop offset=".08" stop-opacity="0"/><stop offset=".81"/></linearGradient><linearGradient id="c" gradientUnits="userSpaceOnUse" x1="99.08" x2="87.08" y1="31.21" y2="43.91"><stop offset=".36" stop-color="#baf7fe"/><stop offset=".42" stop-color="#a6f5fe"/><stop offset=".56" stop-color="#74effd"/><stop offset=".74" stop-color="#23e7fb"/><stop offset=".76" stop-color="#1be6fb"/></linearGradient><linearGradient id="d" gradientUnits="userSpaceOnUse" x1="68.09" x2="37.97" y1="42.4" y2="42.4"><stop offset="0" stop-color="#01e3fb"/><stop offset=".23" stop-color="#01c5f7"/><stop offset=".51" stop-color="#01a6f3"/><stop offset=".75" stop-color="#0193f1"/><stop offset=".92" stop-color="#018cf0"/></linearGradient><linearGradient id="e" gradientUnits="userSpaceOnUse" x1="64.79" x2="38.89" y1="61.8" y2="61.8"><stop offset="0" stop-color="#01dffa"/><stop offset=".16" stop-color="#01c8f7"/><stop offset=".41" stop-color="#01a9f3"/><stop offset=".63" stop-color="#0196f1"/><stop offset=".78" stop-color="#018ff0"/></linearGradient><path d="m0 0h128v128h-128z" fill="#fff"/><path d="m87.91 32.27h-33.63l-1.49 9.73c-.12.82-.26 1.7-.4 2.65h1.14a5.13 5.13 0 0 1 3.92 1.76 7 7 0 0 1 1.43 5.73 9.53 9.53 0 0 1 -2.71 5.3 7.18 7.18 0 0 1 -4.84 2.19c0 .6.06 1.18.1 1.77.11 1.52.27 3 .48 4.4 3.16 21.15 17.12 30 17.12 30s25.73-13.63 31.72-47.6c.1-.58.2-1.17.29-1.76 2.16-14.17-13.13-14.17-13.13-14.17zm-4.46 29.19-.11.67a2.12 2.12 0 0 1 -1.91 1.87h-13.57a1.48 1.48 0 0 1 -1.34-1.87l.11-.67a2.12 2.12 0 0 1 1.9-1.87h13.58a1.49 1.49 0 0 1 1.34 1.87zm7.4-8.46a2.78 2.78 0 0 1 -.79 1.56 2.13 2.13 0 0 1 -1.46.65h-19.11a1.75 1.75 0 0 1 -1.57-2.21 2.89 2.89 0 0 1 .8-1.56 2.14 2.14 0 0 1 1.45-.64h19.11a1.74 1.74 0 0 1 1.57 2.2z" fill="url(#a)"/><path d="m67.92 53a1.75 1.75 0 0 0 1.57 2.21h8.21v4.4h-26.37a7.18 7.18 0 0 0 4.84-2.19 9.53 9.53 0 0 0 2.71-5.3 7 7 0 0 0 -1.43-5.73h20.25v4.41h-7.53a2.14 2.14 0 0 0 -1.45.64 2.89 2.89 0 0 0 -.8 1.56z" fill="url(#b)" opacity=".2"/><path d="m58.93 63.56a2.81 2.81 0 0 1 -.79 1.56 2.14 2.14 0 0 1 -1.46.64h-4.77c-.21-1.41-.37-2.88-.48-4.4h5.93a1.74 1.74 0 0 1 1.57 2.2z" opacity=".1"/><path d="m68 44.17a2.81 2.81 0 0 1 -.79 1.56 2.18 2.18 0 0 1 -1.46.64h-8.3a5.13 5.13 0 0 0 -3.92-1.76h-1.14c.14-1 .28-1.83.4-2.65h13.65a1.74 1.74 0 0 1 1.56 2.21z" opacity=".1"/><path d="m101 46.37c-.09.59-.19 1.18-.29 1.76h-16.4c-2.11 0-3.53-2-3.15-4.4l.84-5.51a11 11 0 0 0 -.49-5.95h6.4s15.29 0 13.09 14.1z" opacity=".1"/><path d="m52.05 54.3h-23.7a1.73 1.73 0 0 1 -1.57-2.2 2.5 2.5 0 0 1 2.22-2.2h23.72a1.74 1.74 0 0 1 1.58 2.2 2.5 2.5 0 0 1 -2.25 2.2z" fill="#01e3fb"/><path d="m46.79 73.7h-9.17a1.74 1.74 0 0 1 -1.57-2.21 2.5 2.5 0 0 1 2.24-2.2h9.18a1.74 1.74 0 0 1 1.53 2.2 2.51 2.51 0 0 1 -2.21 2.21z" fill="#01e3fb"/><path d="m87.91 32.27h-6.12c1.69 0 2.64 2.77 2.12 6.17l-.68 4.41c-.3 1.94.83 3.52 2.52 3.52h15.25c2.2-14.1-13.09-14.1-13.09-14.1z" fill="url(#c)"/><path d="m67.29 44.61h-31.29a1.74 1.74 0 0 1 -1.57-2.21 2.5 2.5 0 0 1 2.25-2.2h31.32a1.74 1.74 0 0 1 1.57 2.2 2.51 2.51 0 0 1 -2.28 2.21z" fill="url(#d)"/><path d="m58.21 64h-14.52a1.74 1.74 0 0 1 -1.58-2.2 2.52 2.52 0 0 1 2.25-2.21h14.53a1.74 1.74 0 0 1 1.57 2.21 2.51 2.51 0 0 1 -2.25 2.2z" fill="url(#e)"/></svg>
includes/admin/action/recheck-license.php CHANGED
@@ -4,7 +4,6 @@ namespace wpautoterms\admin\action;
4
 
5
 
6
  use wpautoterms\Action_Base;
7
- use wpautoterms\admin\Notices;
8
  use wpautoterms\api\License;
9
 
10
  class Recheck_License extends Action_Base {
@@ -13,10 +12,10 @@ class Recheck_License extends Action_Base {
13
  /**
14
  * @var License
15
  */
16
- protected $_license_query;
17
 
18
- public function set_license_query( License $license_query ) {
19
- $this->_license_query = $license_query;
20
  }
21
 
22
  protected function _handle( $admin_post ) {
@@ -24,12 +23,16 @@ class Recheck_License extends Action_Base {
24
  wp_die( 'Not supported.' );
25
  }
26
  // NOTE: check before update_option() call to avoid double recheck
27
- $this->_license_query->check( true );
28
  update_option( WPAUTOTERMS_OPTION_PREFIX . License::OPTION_KEY, $_REQUEST['apiKey'] );
 
29
  wp_send_json( array(
30
- 'status' => $this->_license_query->status(),
31
- 'timestamp' => $this->_license_query->timestamp(),
32
- 'errorMessage' => $this->_license_query->error_message()
 
 
 
33
  ) );
34
  }
35
  }
4
 
5
 
6
  use wpautoterms\Action_Base;
 
7
  use wpautoterms\api\License;
8
 
9
  class Recheck_License extends Action_Base {
12
  /**
13
  * @var License
14
  */
15
+ protected $_license;
16
 
17
+ public function set_license( License $license_query ) {
18
+ $this->_license = $license_query;
19
  }
20
 
21
  protected function _handle( $admin_post ) {
23
  wp_die( 'Not supported.' );
24
  }
25
  // NOTE: check before update_option() call to avoid double recheck
26
+ $this->_license->check( true );
27
  update_option( WPAUTOTERMS_OPTION_PREFIX . License::OPTION_KEY, $_REQUEST['apiKey'] );
28
+ $info = $this->_license->info();
29
  wp_send_json( array(
30
+ 'status' => $info->status,
31
+ 'shouldShowWebsites' => $info->should_show_websites(),
32
+ 'licenseType' => $info->license_type_string(),
33
+ 'summary' => $info->summary(),
34
+ 'websites' => $info->websites_info(),
35
+ 'maxSites' => $info->max_sites,
36
  ) );
37
  }
38
  }
includes/admin/action/toggle-action.php CHANGED
@@ -23,7 +23,7 @@ class Toggle_Action extends Action_Base {
23
  protected function _handle( $admin_post ) {
24
  $option = ! (bool) get_option( $this->_option_name, false );
25
  if ( ! empty( $this->_license ) ) {
26
- if ( $this->_license->status() === License::STATUS_FREE ) {
27
  $option = false;
28
  }
29
  }
23
  protected function _handle( $admin_post ) {
24
  $option = ! (bool) get_option( $this->_option_name, false );
25
  if ( ! empty( $this->_license ) ) {
26
+ if ( !$this->_license->is_paid() ) {
27
  $option = false;
28
  }
29
  }
includes/admin/action/transfer-license.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace wpautoterms\admin\action;
4
+
5
+
6
+ use wpautoterms\Action_Base;
7
+ use wpautoterms\api\License_Transfer;
8
+ use wpautoterms\api\Query;
9
+
10
+ class Transfer_License extends Action_Base {
11
+ const NAME = 'wpautoterms_transfer_license';
12
+ /**
13
+ * @var Query
14
+ */
15
+ protected $_query;
16
+
17
+ public function set_query( Query $query ) {
18
+ $this->_query = $query;
19
+ }
20
+
21
+ protected function _handle( $admin_post ) {
22
+ if ( $admin_post ) {
23
+ wp_die( 'Not supported.' );
24
+ }
25
+ $site = static::_request_var( 'site' );
26
+ $email = static::_request_var( 'email' );
27
+ $key = static::_request_var( 'key' );
28
+ $lt = new License_Transfer( $this->_query );
29
+ $res = $lt->execute( $site, $email, $key );
30
+ wp_send_json( array( 'result' => $res ) );
31
+ }
32
+ }
includes/admin/admin.php CHANGED
@@ -11,6 +11,7 @@ use wpautoterms\admin\action\Check_Updates;
11
  use wpautoterms\admin\action\Dismiss_Notice;
12
  use wpautoterms\admin\action\Recheck_License;
13
  use wpautoterms\admin\action\Set_Option;
 
14
  use wpautoterms\admin\form\Legal_Page;
15
  use wpautoterms\api\License;
16
  use wpautoterms\api\Query;
@@ -63,7 +64,10 @@ abstract class Admin {
63
  ), 10, 3 );
64
 
65
  $recheck_action = new Recheck_License( CPT::edit_cap(), '', null, null, __( 'Access denied', WPAUTOTERMS_SLUG ) );
66
- $recheck_action->set_license_query( static::$_license );
 
 
 
67
 
68
  // TODO: extract warnings class
69
  static::$_warning_action = new Set_Option( CPT::edit_cap(), 'settings_warning_disable' );
@@ -157,8 +161,7 @@ abstract class Admin {
157
  return $value;
158
  }
159
 
160
- return static::$_license->status() === License::STATUS_FREE ?
161
- Options::default_value( Options::LEGAL_PAGES_SLUG ) : $value;
162
  }
163
 
164
  public static function row_actions( $actions, $post ) {
@@ -191,7 +194,7 @@ abstract class Admin {
191
  }
192
  }
193
  if ( $page == 'edit.php' ) {
194
- wp_enqueue_script( WPAUTOTERMS_SLUG . '_row_actions', WPAUTOTERMS_PLUGIN_URL . 'js/row-actions.js', false, WPAUTOTERMS_VERSION, true );
195
  }
196
  if ( $page == 'post-new.php' && $post->post_status == 'auto-draft' ) {
197
  wp_enqueue_script( WPAUTOTERMS_SLUG . '_post_new', WPAUTOTERMS_PLUGIN_URL . 'js/post-new.js', false, WPAUTOTERMS_VERSION, true );
11
  use wpautoterms\admin\action\Dismiss_Notice;
12
  use wpautoterms\admin\action\Recheck_License;
13
  use wpautoterms\admin\action\Set_Option;
14
+ use wpautoterms\admin\action\Transfer_License;
15
  use wpautoterms\admin\form\Legal_Page;
16
  use wpautoterms\api\License;
17
  use wpautoterms\api\Query;
64
  ), 10, 3 );
65
 
66
  $recheck_action = new Recheck_License( CPT::edit_cap(), '', null, null, __( 'Access denied', WPAUTOTERMS_SLUG ) );
67
+ $recheck_action->set_license( static::$_license );
68
+
69
+ $transfer_action = new Transfer_License( CPT::edit_cap(), '', null, null, __( 'Access denied', WPAUTOTERMS_SLUG ) );
70
+ $transfer_action->set_query( static::$_query );
71
 
72
  // TODO: extract warnings class
73
  static::$_warning_action = new Set_Option( CPT::edit_cap(), 'settings_warning_disable' );
161
  return $value;
162
  }
163
 
164
+ return static::$_license->is_paid() ? $value : Options::default_value( Options::LEGAL_PAGES_SLUG );
 
165
  }
166
 
167
  public static function row_actions( $actions, $post ) {
194
  }
195
  }
196
  if ( $page == 'edit.php' ) {
197
+ wp_enqueue_script( WPAUTOTERMS_SLUG . '_row_actions', WPAUTOTERMS_PLUGIN_URL . 'js/row-actions.js', false, WPAUTOTERMS_VERSION, true );
198
  }
199
  if ( $page == 'post-new.php' && $post->post_status == 'auto-draft' ) {
200
  wp_enqueue_script( WPAUTOTERMS_SLUG . '_post_new', WPAUTOTERMS_PLUGIN_URL . 'js/post-new.js', false, WPAUTOTERMS_VERSION, true );
includes/admin/form/legal-page.php CHANGED
@@ -8,15 +8,25 @@ use wpautoterms\cpt\CPT;
8
  class Legal_Page {
9
  protected $_id;
10
  protected $_title;
 
11
  protected $_description;
12
 
13
  protected $_wizard;
14
  protected $_hidden;
15
  protected $_dependencies;
16
 
17
- public function __construct( $id, $title, $description ) {
 
 
 
 
 
 
 
 
18
  $this->_id = $id;
19
  $this->_title = $title;
 
20
  $this->_description = $description;
21
  add_action( 'save_post', array( $this, 'save_post' ) );
22
  add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
@@ -26,6 +36,10 @@ class Legal_Page {
26
  return $this->_id;
27
  }
28
 
 
 
 
 
29
  public function title() {
30
  return $this->_title;
31
  }
@@ -40,13 +54,14 @@ class Legal_Page {
40
  }
41
  Section::init();
42
  $this->_wizard = $this->_wizard_text() . \wpautoterms\print_template( WPAUTOTERMS_LEGAL_PAGES_DIR . 'common',
43
- array(), true );
44
  $this->_hidden = Section::get_start_hidden();
45
  $this->_dependencies = Section::get_dependencies();
46
  }
47
 
48
  protected function _wizard_text() {
49
- return \wpautoterms\print_template( WPAUTOTERMS_LEGAL_PAGES_DIR . 'admin/' . $this->id(), array(), true );
 
50
  }
51
 
52
  public function wizard() {
@@ -123,7 +138,7 @@ class Legal_Page {
123
  wp_update_post( array(
124
  'ID' => $post_id,
125
  'post_content' => $content,
126
- 'post_title' => $this->title(),
127
  'post_name' => $this->id(),
128
  ) );
129
  }
8
  class Legal_Page {
9
  protected $_id;
10
  protected $_title;
11
+ protected $_page_title;
12
  protected $_description;
13
 
14
  protected $_wizard;
15
  protected $_hidden;
16
  protected $_dependencies;
17
 
18
+ /**
19
+ * Legal_Page constructor.
20
+ *
21
+ * @param $id
22
+ * @param $title string: wizard and listing title.
23
+ * @param $description
24
+ * @param $page_title string: generated page title.
25
+ */
26
+ public function __construct( $id, $title, $description, $page_title ) {
27
  $this->_id = $id;
28
  $this->_title = $title;
29
+ $this->_page_title = $page_title;
30
  $this->_description = $description;
31
  add_action( 'save_post', array( $this, 'save_post' ) );
32
  add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
36
  return $this->_id;
37
  }
38
 
39
+ public function page_title() {
40
+ return $this->_page_title;
41
+ }
42
+
43
  public function title() {
44
  return $this->_title;
45
  }
54
  }
55
  Section::init();
56
  $this->_wizard = $this->_wizard_text() . \wpautoterms\print_template( WPAUTOTERMS_LEGAL_PAGES_DIR . 'common',
57
+ array( 'page' => $this ), true );
58
  $this->_hidden = Section::get_start_hidden();
59
  $this->_dependencies = Section::get_dependencies();
60
  }
61
 
62
  protected function _wizard_text() {
63
+ return \wpautoterms\print_template( WPAUTOTERMS_LEGAL_PAGES_DIR . 'admin/' . $this->id(),
64
+ array( 'page' => $this ), true );
65
  }
66
 
67
  public function wizard() {
138
  wp_update_post( array(
139
  'ID' => $post_id,
140
  'post_content' => $content,
141
+ 'post_title' => $this->page_title(),
142
  'post_name' => $this->id(),
143
  ) );
144
  }
includes/admin/form/licensed-legal-page.php CHANGED
@@ -23,17 +23,16 @@ class Licensed_Legal_Page extends Legal_Page {
23
  }
24
 
25
  protected function _get_content( $args ) {
26
- if ( $this->_license->status() === License::STATUS_FREE ) {
27
  return _( 'Invalid license', WPAUTOTERMS_SLUG );
28
  }
29
  $agreement = new Agreement( $this->_query, $this->_license );
30
- $text = $agreement->generate( $this->id(), $args );
31
 
32
- return $text;
33
  }
34
 
35
  protected function _wizard_text() {
36
- if ( $this->_license->status() === License::STATUS_FREE ) {
37
  return __( 'Invalid license', WPAUTOTERMS_SLUG );
38
  }
39
  $agreement = new Agreement( $this->_query, $this->_license );
@@ -42,7 +41,7 @@ class Licensed_Legal_Page extends Legal_Page {
42
  }
43
 
44
  public function availability() {
45
- if ( $this->_license->status() !== License::STATUS_FREE ) {
46
  return true;
47
  }
48
 
23
  }
24
 
25
  protected function _get_content( $args ) {
26
+ if ( !$this->_license->is_paid() ) {
27
  return _( 'Invalid license', WPAUTOTERMS_SLUG );
28
  }
29
  $agreement = new Agreement( $this->_query, $this->_license );
 
30
 
31
+ return $agreement->generate( $this->id(), $args );
32
  }
33
 
34
  protected function _wizard_text() {
35
+ if ( !$this->_license->is_paid() ) {
36
  return __( 'Invalid license', WPAUTOTERMS_SLUG );
37
  }
38
  $agreement = new Agreement( $this->_query, $this->_license );
41
  }
42
 
43
  public function availability() {
44
+ if ( $this->_license->is_paid() ) {
45
  return true;
46
  }
47
 
includes/admin/page/base.php CHANGED
@@ -14,7 +14,7 @@ class Base {
14
  protected $_menu_title;
15
  protected $_options;
16
 
17
- public function __construct( $id, $title, $menu_title = null ) {
18
  $this->_id = $id;
19
  $this->_title = $title;
20
  if ( $menu_title === null ) {
@@ -32,6 +32,9 @@ class Base {
32
  }
33
 
34
  public function register_menu() {
 
 
 
35
  add_submenu_page( 'edit.php?post_type=' . CPT::type(),
36
  $this->title(),
37
  $this->menu_title(),
@@ -44,10 +47,14 @@ class Base {
44
  public function enqueue_scripts() {
45
  }
46
 
47
- public function render() {
48
- \wpautoterms\print_template( 'pages/' . $this->_id, array(
49
  'page' => $this,
50
- ) );
 
 
 
 
51
  }
52
 
53
  public function title() {
14
  protected $_menu_title;
15
  protected $_options;
16
 
17
+ public function __construct( $id, $title = null, $menu_title = null ) {
18
  $this->_id = $id;
19
  $this->_title = $title;
20
  if ( $menu_title === null ) {
32
  }
33
 
34
  public function register_menu() {
35
+ if ( $this->menu_title() == null ) {
36
+ return;
37
+ }
38
  add_submenu_page( 'edit.php?post_type=' . CPT::type(),
39
  $this->title(),
40
  $this->menu_title(),
47
  public function enqueue_scripts() {
48
  }
49
 
50
+ protected function _render_args() {
51
+ return array(
52
  'page' => $this,
53
+ );
54
+ }
55
+
56
+ public function render() {
57
+ \wpautoterms\print_template( 'pages/' . $this->_id, $this->_render_args() );
58
  }
59
 
60
  public function title() {
includes/admin/page/license-settings.php CHANGED
@@ -3,8 +3,8 @@
3
  namespace wpautoterms\admin\page;
4
 
5
  use wpautoterms\admin\action\Recheck_License;
 
6
  use wpautoterms\api\License;
7
- use wpautoterms\option\License_Status_Option;
8
  use wpautoterms\option\Text_Option;
9
 
10
  if ( ! defined( 'ABSPATH' ) ) {
@@ -25,11 +25,7 @@ class License_Settings extends Settings_Base {
25
  public function define_options() {
26
  parent::define_options();
27
  new Text_Option( License::OPTION_KEY, __( 'License key', WPAUTOTERMS_SLUG ), '',
28
- $this->id(), static::SECTION_ID, Text_Option::TYPE_GENERIC, array(
29
- 'class' => 'wpautoterms-license-key'
30
- ) );
31
- $a = new License_Status_Option( 'license_status', __( 'License type', WPAUTOTERMS_SLUG ), '', $this->id(), static::SECTION_ID );
32
- $a->set_license( $this->_license );
33
  }
34
 
35
  public function defaults() {
@@ -38,13 +34,25 @@ class License_Settings extends Settings_Base {
38
  );
39
  }
40
 
 
 
 
 
 
 
 
41
  public function enqueue_scripts() {
42
  wp_enqueue_script( WPAUTOTERMS_SLUG . '_license_settings', WPAUTOTERMS_PLUGIN_URL . 'js/license-settings.js', false, WPAUTOTERMS_VERSION, true );
43
  wp_localize_script( WPAUTOTERMS_SLUG . '_license_settings', 'wpautotermsLicenseSettings', array(
44
  'nonce' => wp_create_nonce( Recheck_License::NAME ),
45
- 'lastCheck' => $this->_license->timestamp(),
46
- 'never' => _x( 'never', 'license_settings_page', WPAUTOTERMS_SLUG ),
47
- 'keyId' => WPAUTOTERMS_OPTION_PREFIX . License::OPTION_KEY
 
 
 
 
 
48
  ) );
49
  }
50
  }
3
  namespace wpautoterms\admin\page;
4
 
5
  use wpautoterms\admin\action\Recheck_License;
6
+ use wpautoterms\admin\action\Transfer_License;
7
  use wpautoterms\api\License;
 
8
  use wpautoterms\option\Text_Option;
9
 
10
  if ( ! defined( 'ABSPATH' ) ) {
25
  public function define_options() {
26
  parent::define_options();
27
  new Text_Option( License::OPTION_KEY, __( 'License key', WPAUTOTERMS_SLUG ), '',
28
+ $this->id(), static::SECTION_ID, Text_Option::TYPE_GENERIC, array(), array( 'wpautoterms-license-key' ) );
 
 
 
 
29
  }
30
 
31
  public function defaults() {
34
  );
35
  }
36
 
37
+ protected function _render_args() {
38
+ $res = parent::_render_args();
39
+ $res['info'] = $this->_license->info();
40
+
41
+ return $res;
42
+ }
43
+
44
  public function enqueue_scripts() {
45
  wp_enqueue_script( WPAUTOTERMS_SLUG . '_license_settings', WPAUTOTERMS_PLUGIN_URL . 'js/license-settings.js', false, WPAUTOTERMS_VERSION, true );
46
  wp_localize_script( WPAUTOTERMS_SLUG . '_license_settings', 'wpautotermsLicenseSettings', array(
47
  'nonce' => wp_create_nonce( Recheck_License::NAME ),
48
+ 'action' => Recheck_License::NAME,
49
+ 'keyId' => WPAUTOTERMS_OPTION_PREFIX . License::OPTION_KEY,
50
+ 'status' => $this->_license->info()->status,
51
+ ) );
52
+ wp_enqueue_script( WPAUTOTERMS_SLUG . '_license_transfer', WPAUTOTERMS_PLUGIN_URL . 'js/license-transfer.js', false, WPAUTOTERMS_VERSION, true );
53
+ wp_localize_script( WPAUTOTERMS_SLUG . '_license_transfer', 'wpautotermsLicenseTransfer', array(
54
+ 'nonce' => wp_create_nonce( Transfer_License::NAME ),
55
+ 'action' => Transfer_License::NAME,
56
  ) );
57
  }
58
  }
includes/admin/page/settings-base.php CHANGED
@@ -10,6 +10,7 @@ abstract class Settings_Base extends Base {
10
  const SECTION_ID = 'section';
11
 
12
  protected $_options;
 
13
 
14
  public function define_options() {
15
  // NOTE: PHP<5.5 compliance
@@ -18,7 +19,7 @@ abstract class Settings_Base extends Base {
18
  return;
19
  }
20
  add_settings_section( static::SECTION_ID,
21
- false,
22
  false,
23
  $this->id() );
24
  }
10
  const SECTION_ID = 'section';
11
 
12
  protected $_options;
13
+ protected $_section_title = false;
14
 
15
  public function define_options() {
16
  // NOTE: PHP<5.5 compliance
19
  return;
20
  }
21
  add_settings_section( static::SECTION_ID,
22
+ $this->_section_title,
23
  false,
24
  $this->id() );
25
  }
includes/admin/page/settings-page.php CHANGED
@@ -68,7 +68,7 @@ class Settings_Page extends Settings_Base {
68
  $states = array_diff( $states, $countries );
69
  $state->set_values( array_combine( $states, $states ) );
70
 
71
- $is_free = $this->_license->status() === License::STATUS_FREE;
72
  global $wp_rewrite;
73
  $does_rewrite = $wp_rewrite->using_permalinks();
74
  $attrs = ( $is_free || ! $does_rewrite ) ? array( 'disabled' => null ) : array();
@@ -104,7 +104,7 @@ class Settings_Page extends Settings_Base {
104
  public function slug_fail( $x ) {
105
  global $wp_rewrite;
106
  $value = $this->_default_slug();
107
- if ( $this->_license->status() === License::STATUS_FREE ) {
108
  $dv = Options::default_value( Options::LEGAL_PAGES_SLUG );
109
  if ( $value !== $dv ) {
110
  Notices::$instance->add( __( 'Using free license, set pages slug to default.', WPAUTOTERMS_SLUG ),
68
  $states = array_diff( $states, $countries );
69
  $state->set_values( array_combine( $states, $states ) );
70
 
71
+ $is_free = !$this->_license->is_paid();
72
  global $wp_rewrite;
73
  $does_rewrite = $wp_rewrite->using_permalinks();
74
  $attrs = ( $is_free || ! $does_rewrite ) ? array( 'disabled' => null ) : array();
104
  public function slug_fail( $x ) {
105
  global $wp_rewrite;
106
  $value = $this->_default_slug();
107
+ if ( !$this->_license->is_paid() ) {
108
  $dv = Options::default_value( Options::LEGAL_PAGES_SLUG );
109
  if ( $value !== $dv ) {
110
  Notices::$instance->add( __( 'Using free license, set pages slug to default.', WPAUTOTERMS_SLUG ),
includes/api/agreement.php CHANGED
@@ -46,14 +46,14 @@ class Agreement {
46
  }, explode( ',', $data['wizardUseValues'] ) );
47
  foreach ( $data as $k => $v ) {
48
  if ( in_array( $k, $allowed, true ) ) {
49
- $new_data[ $k ] = $v;
50
  }
51
  }
52
  } else {
53
  foreach ( $data as $k => $v ) {
54
  $lk = strtolower( $k );
55
  if ( false === strstr( $lk, 'nonce' ) && false === strstr( $lk, 'password' ) ) {
56
- $new_data[ $k ] = $v;
57
  }
58
  }
59
  }
46
  }, explode( ',', $data['wizardUseValues'] ) );
47
  foreach ( $data as $k => $v ) {
48
  if ( in_array( $k, $allowed, true ) ) {
49
+ $new_data[ $k ] = stripslashes_deep($v);
50
  }
51
  }
52
  } else {
53
  foreach ( $data as $k => $v ) {
54
  $lk = strtolower( $k );
55
  if ( false === strstr( $lk, 'nonce' ) && false === strstr( $lk, 'password' ) ) {
56
+ $new_data[ $k ] = stripslashes_deep($v);
57
  }
58
  }
59
  }
includes/api/license-info-vo.php ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace wpautoterms\api;
4
+
5
+ use wpautoterms\Vo;
6
+
7
+ define( 'WPAUTOTERMS_LICENSE_INFO_VO_STATUS_FREE', 'free' );
8
+
9
+ class License_Info_Vo extends Vo {
10
+ const STATUS_FREE = WPAUTOTERMS_LICENSE_INFO_VO_STATUS_FREE;
11
+ const STATUS_PAID = 'paid';
12
+ const STATUS_IP_MISMATCH = 'ip_mismatch';
13
+ const STATUS_MAX_SITES = 'max_sites';
14
+ const STATUS_BAD_RESPONSE = 'bad_response';
15
+ const STATUS_QUERY_FAILED = 'query_failed';
16
+
17
+ public $status;
18
+ public $timestamp;
19
+ public $error;
20
+ public $max_sites;
21
+ public $available_sites;
22
+ public $site_name;
23
+ public $ip;
24
+
25
+ protected static $_defaults = array(
26
+ 'status' => WPAUTOTERMS_LICENSE_INFO_VO_STATUS_FREE,
27
+ 'timestamp' => 0,
28
+ 'error' => '',
29
+ 'max_sites' => 0,
30
+ 'available_sites' => 0,
31
+ 'site_name' => '',
32
+ 'ip' => '',
33
+ );
34
+
35
+ public static function valid_statuses() {
36
+ return array(
37
+ static::STATUS_FREE,
38
+ static::STATUS_PAID,
39
+ static::STATUS_IP_MISMATCH,
40
+ static::STATUS_MAX_SITES,
41
+ );
42
+ }
43
+
44
+ public function license_type_string() {
45
+ return $this->is_paid() ? _x( 'premium', 'license type', WPAUTOTERMS_SLUG ) :
46
+ _x( 'free', 'license type', WPAUTOTERMS_SLUG );
47
+ }
48
+
49
+ public function is_paid() {
50
+ return $this->status === static::STATUS_PAID;
51
+ }
52
+
53
+ public function should_show_websites() {
54
+ return in_array( $this->status, array(
55
+ static::STATUS_MAX_SITES,
56
+ static::STATUS_PAID,
57
+ static::STATUS_IP_MISMATCH
58
+ ) );
59
+ }
60
+
61
+ public function websites_info() {
62
+ $used = $this->max_sites - $this->available_sites;
63
+ if ( $this->max_sites == 0 ) {
64
+ return _x( 'unlimited', 'license websites limit', WPAUTOTERMS_SLUG );
65
+ }
66
+
67
+ return sprintf( _x( '%d / %d', 'license websites limit', WPAUTOTERMS_SLUG ), $used, $this->max_sites );
68
+ }
69
+
70
+ public function summary() {
71
+ $query_failed_str = 'Server query failed. Please contact us from Help > Send us a message.';
72
+ $used = $this->max_sites - $this->available_sites;
73
+ $status_str = array(
74
+ License_Info_Vo::STATUS_FREE => __( 'Free license or invalid premium license key.', WPAUTOTERMS_SLUG ),
75
+ License_Info_Vo::STATUS_PAID => sprintf( __( 'License key is registered to %s (%s).', WPAUTOTERMS_SLUG ),
76
+ $this->site_name, $this->ip ),
77
+ License_Info_Vo::STATUS_IP_MISMATCH => sprintf( __( 'IP address mismatch (%s).', WPAUTOTERMS_SLUG ),
78
+ $this->ip ),
79
+ License_Info_Vo::STATUS_MAX_SITES => sprintf( __( 'Reached maximum number of allowed websites for this License key (%d of %d).', WPAUTOTERMS_SLUG ),
80
+ $used, $this->max_sites ),
81
+ License_Info_Vo::STATUS_QUERY_FAILED => __( $query_failed_str, WPAUTOTERMS_SLUG ),
82
+ License_Info_Vo::STATUS_BAD_RESPONSE => __( $query_failed_str, WPAUTOTERMS_SLUG ),
83
+ );
84
+
85
+ return $status_str[ $this->status ];
86
+ }
87
+ }
includes/api/license-transfer.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace wpautoterms\api;
4
+
5
+ class License_Transfer {
6
+ const _EP_STATUS = 'license/v2/transfer/';
7
+
8
+ const RESULT_QUERY_ERROR = 'query_error';
9
+ const RESULT_FAILED = 'failed';
10
+ const RESULT_SUCCESS = 'success';
11
+
12
+ /**
13
+ * @var Query
14
+ */
15
+ protected $_query;
16
+
17
+ public function __construct( Query $query ) {
18
+ $this->_query = $query;
19
+ }
20
+
21
+ public function execute( $site, $email, $key ) {
22
+ $site = trim( $site );
23
+ if ( empty( $site ) ) {
24
+ $site = get_site_url();
25
+ }
26
+ $resp = $this->_query->post_json( static::_EP_STATUS, array(
27
+ 'site' => $site,
28
+ 'email' => trim( $email ),
29
+ 'key' => trim( $key ),
30
+ ) );
31
+ if ( $resp->has_error() ) {
32
+ return static::RESULT_QUERY_ERROR;
33
+ }
34
+ $json = $resp->json();
35
+
36
+ return ( isset( $json['success'] ) && $json['success'] ) ? static::RESULT_SUCCESS : static::RESULT_FAILED;
37
+ }
38
+ }
includes/api/license.php CHANGED
@@ -6,26 +6,21 @@ class License {
6
  const OPTION_KEY = 'license';
7
  const OPTION_INFO = 'license_info';
8
 
9
- const _RECHECK_TIME = WPAUTOTERMS_LICENSE_RECHECK_TIME;
10
 
11
- const STATUS_FREE = 'free';
12
- const STATUS_PAID = 'paid';
13
-
14
- const _EP_STATUS = 'license/v1/status/';
15
-
16
- const _RESP_STATUS = 'status';
17
 
18
  protected $_query;
 
 
 
19
  protected $_info;
20
 
21
  public function __construct( Query $query ) {
22
  $this->_query = $query;
23
-
24
- $this->_info = get_option( WPAUTOTERMS_OPTION_PREFIX . static::OPTION_INFO, array(
25
- 'status' => static::STATUS_FREE,
26
- 'timestamp' => 0,
27
- 'error' => ''
28
- ) );
29
  add_action( 'update_option_' . WPAUTOTERMS_OPTION_PREFIX . static::OPTION_KEY, array(
30
  $this,
31
  'on_update_key'
@@ -37,7 +32,9 @@ class License {
37
  return;
38
  }
39
  if ( empty( $value ) ) {
40
- $this->_set_status( static::STATUS_FREE );
 
 
41
  $this->_save_status();
42
 
43
  return;
@@ -45,36 +42,49 @@ class License {
45
  $this->check( true );
46
  }
47
 
48
- protected function _set_status( $v ) {
49
- $this->_info['status'] = $v;
 
 
 
 
 
 
 
 
 
 
50
  }
51
 
52
  protected function _save_status() {
53
- $this->_info['timestamp'] = time();
54
- update_option( WPAUTOTERMS_OPTION_PREFIX . static::OPTION_INFO, $this->_info );
55
  }
56
 
57
  public function check( $force = false ) {
58
- $last_check = $this->timestamp();
59
- if ( ! $force && ( time() - $last_check ) < static::_RECHECK_TIME ) {
60
  return;
61
  }
62
  $key = $this->api_key();
63
  if ( empty( $key ) ) {
 
 
 
64
  return;
65
  }
66
  $headers = array( WPAUTOTERMS_API_KEY_HEADER => $key );
67
  $resp = $this->_query->get( static::_EP_STATUS, array(), $headers );
68
  $json = $resp->json();
69
- $this->_info['error'] = $resp->format_error( WP_DEBUG );
70
- if ( ! $resp->has_error() && isset( $json[ static::_RESP_STATUS ] ) &&
71
- $json[ static::_RESP_STATUS ] === static::STATUS_PAID ) {
72
- $this->_set_status( static::STATUS_PAID );
73
- } else {
74
- $this->_set_status( static::STATUS_FREE );
75
- if ( empty( $this->_info['error'] ) && isset( $json['message'] ) ) {
76
- $this->_info['error'] = $json['message'];
77
  }
 
 
78
  }
79
  $this->_save_status();
80
  }
@@ -83,15 +93,14 @@ class License {
83
  return get_option( WPAUTOTERMS_OPTION_PREFIX . static::OPTION_KEY, '' );
84
  }
85
 
86
- public function status() {
87
- return $this->_info['status'];
88
- }
89
-
90
- public function timestamp() {
91
- return $this->_info['timestamp'];
92
  }
93
 
94
- public function error_message() {
95
- return $this->_info['error'];
96
  }
97
  }
6
  const OPTION_KEY = 'license';
7
  const OPTION_INFO = 'license_info';
8
 
9
+ const _EP_STATUS = 'license/v2/status/';
10
 
11
+ const _FIELD_STATUS = 'status';
12
+ const _FIELD_SITES = 'sites';
 
 
 
 
13
 
14
  protected $_query;
15
+ /**
16
+ * @var License_Info_Vo
17
+ */
18
  protected $_info;
19
 
20
  public function __construct( Query $query ) {
21
  $this->_query = $query;
22
+ $this->_info = new License_Info_Vo( get_option( WPAUTOTERMS_OPTION_PREFIX . static::OPTION_INFO,
23
+ License_Info_Vo::defaults() ) );
 
 
 
 
24
  add_action( 'update_option_' . WPAUTOTERMS_OPTION_PREFIX . static::OPTION_KEY, array(
25
  $this,
26
  'on_update_key'
32
  return;
33
  }
34
  if ( empty( $value ) ) {
35
+ $this->_info->status = License_Info_Vo::STATUS_FREE;
36
+ $this->_info->max_sites = 0;
37
+ $this->_info->available_sites = 0;
38
  $this->_save_status();
39
 
40
  return;
42
  $this->check( true );
43
  }
44
 
45
+ protected function _set_status( $json ) {
46
+ $this->_info->status = $json[ static::_FIELD_STATUS ];
47
+ if ( isset( $json[ static::_FIELD_SITES ] ) ) {
48
+ $sites = $json[ static::_FIELD_SITES ];
49
+ $this->_info->max_sites = isset( $sites['total'] ) ? $sites['total'] : 0;
50
+ $this->_info->available_sites = isset( $sites['available'] ) ? $sites['available'] : 0;
51
+ } else {
52
+ $this->_info->max_sites = 0;
53
+ $this->_info->available_sites = 0;
54
+ }
55
+ $this->_info->site_name = isset( $json['site_name'] ) ? $json['site_name'] : '';
56
+ $this->_info->ip = isset( $json['ip'] ) ? $json['ip'] : '';
57
  }
58
 
59
  protected function _save_status() {
60
+ $this->_info->timestamp = time();
61
+ update_option( WPAUTOTERMS_OPTION_PREFIX . static::OPTION_INFO, $this->_info->to_array() );
62
  }
63
 
64
  public function check( $force = false ) {
65
+ $last_check = $this->_info->timestamp;
66
+ if ( ! $force && ( time() - $last_check ) < WPAUTOTERMS_LICENSE_RECHECK_TIME ) {
67
  return;
68
  }
69
  $key = $this->api_key();
70
  if ( empty( $key ) ) {
71
+ $this->_info->status = License_Info_Vo::STATUS_FREE;
72
+ $this->_info->error = '';
73
+
74
  return;
75
  }
76
  $headers = array( WPAUTOTERMS_API_KEY_HEADER => $key );
77
  $resp = $this->_query->get( static::_EP_STATUS, array(), $headers );
78
  $json = $resp->json();
79
+ $this->_info->error = $resp->format_error( WP_DEBUG );
80
+ if ( ! $resp->has_error() && isset( $json[ static::_FIELD_STATUS ] ) ) {
81
+ if ( in_array( $json[ static::_FIELD_STATUS ], License_Info_Vo::valid_statuses() ) ) {
82
+ $this->_set_status( $json );
83
+ } else {
84
+ $this->_info->status = License_Info_Vo::STATUS_BAD_RESPONSE;
 
 
85
  }
86
+ } else {
87
+ $this->_info->status = License_Info_Vo::STATUS_QUERY_FAILED;
88
  }
89
  $this->_save_status();
90
  }
93
  return get_option( WPAUTOTERMS_OPTION_PREFIX . static::OPTION_KEY, '' );
94
  }
95
 
96
+ /**
97
+ * @return License_Info_Vo
98
+ */
99
+ public function info() {
100
+ return $this->_info;
 
101
  }
102
 
103
+ public function is_paid() {
104
+ return $this->_info->is_paid();
105
  }
106
  }
includes/api/query.php CHANGED
@@ -47,7 +47,7 @@ class Query {
47
  'Referer' => get_site_url(),
48
  'X-WP-Locale' => get_locale()
49
  );
50
- if ( $headers ) {
51
  $all_headers = array_merge( $headers, $all_headers );
52
  }
53
 
47
  'Referer' => get_site_url(),
48
  'X-WP-Locale' => get_locale()
49
  );
50
+ if ( is_array( $headers ) ) {
51
  $all_headers = array_merge( $headers, $all_headers );
52
  }
53
 
includes/autoload.php CHANGED
@@ -4,18 +4,20 @@ namespace wpautoterms;
4
 
5
  spl_autoload_register( function ( $class ) {
6
  if ( substr_compare( $class, __NAMESPACE__ . '\\', 0, strlen( __NAMESPACE__ ) + 1 ) === 0 ) {
7
- $class = substr( $class, strlen( __NAMESPACE__ ) + 1 );
8
- $class = explode( '\\', str_replace( '_', '-', $class ) );
9
  $path = __DIR__;
10
- $c = count( $class );
11
  if ( $c > 1 ) {
12
- $path .= DIRECTORY_SEPARATOR . str_replace( '_', '-', join( DIRECTORY_SEPARATOR, array_slice( $class, 0, - 1 ) ) );
13
  }
14
- $class_name = str_replace( '_', '-', strtolower( $class[ $c - 1 ] ) );
15
  $path .= DIRECTORY_SEPARATOR . $class_name . '.php';
16
- $path = realpath( $path );
17
- if ( $path !== false ) {
18
- include_once $path;
 
 
19
  }
20
  }
21
  } );
4
 
5
  spl_autoload_register( function ( $class ) {
6
  if ( substr_compare( $class, __NAMESPACE__ . '\\', 0, strlen( __NAMESPACE__ ) + 1 ) === 0 ) {
7
+ $class_data = substr( $class, strlen( __NAMESPACE__ ) + 1 );
8
+ $class_data = explode( '\\', str_replace( '_', '-', $class_data ) );
9
  $path = __DIR__;
10
+ $c = count( $class_data );
11
  if ( $c > 1 ) {
12
+ $path .= DIRECTORY_SEPARATOR . str_replace( '_', '-', join( DIRECTORY_SEPARATOR, array_slice( $class_data, 0, - 1 ) ) );
13
  }
14
+ $class_name = str_replace( '_', '-', strtolower( $class_data[ $c - 1 ] ) );
15
  $path .= DIRECTORY_SEPARATOR . $class_name . '.php';
16
+ $real_path = realpath( $path );
17
+ if ( $real_path !== false ) {
18
+ include_once $real_path;
19
+ } else {
20
+ throw new \UnexpectedValueException( 'Class not found: ' . $class . ' at path: ' . $path );
21
  }
22
  }
23
  } );
includes/box/licensed-box.php CHANGED
@@ -22,8 +22,8 @@ class Licensed_Box extends Box {
22
 
23
  protected function _box_args() {
24
  $arr = parent::_box_args();
25
- $arr['license'] = $this->_license->status();
26
- if ( $arr['license'] == License::STATUS_FREE ) {
27
  $arr['status_text'] = __( 'Disabled', WPAUTOTERMS_SLUG );
28
  $arr['enabled'] = false;
29
  }
@@ -33,7 +33,7 @@ class Licensed_Box extends Box {
33
 
34
  public function define_options( $page_id, $section_id ) {
35
  $attrs = array();
36
- if ( $this->_license->status() === License::STATUS_FREE ) {
37
  $attrs['disabled'] = null;
38
  $tooltip = __( '<a href="' . esc_url( WPAUTOTERMS_PURCHASE_URL ) . '" target="wpautotermsGetLicense">
39
  Purchase license</a> to enable',
22
 
23
  protected function _box_args() {
24
  $arr = parent::_box_args();
25
+ $arr['license_paid'] = $this->_license->is_paid();
26
+ if ( ! $arr['license_paid'] ) {
27
  $arr['status_text'] = __( 'Disabled', WPAUTOTERMS_SLUG );
28
  $arr['enabled'] = false;
29
  }
33
 
34
  public function define_options( $page_id, $section_id ) {
35
  $attrs = array();
36
+ if ( ! $this->_license->is_paid() ) {
37
  $attrs['disabled'] = null;
38
  $tooltip = __( '<a href="' . esc_url( WPAUTOTERMS_PURCHASE_URL ) . '" target="wpautotermsGetLicense">
39
  Purchase license</a> to enable',
includes/frontend.php CHANGED
@@ -100,7 +100,6 @@ abstract class Frontend {
100
  foreach ( headers_list() as $h ) {
101
  $h = ltrim( $h );
102
  if ( strncasecmp( $h, $ct, $ct_len ) === 0 ) {
103
- // do not handle non-html content
104
  if ( 1 !== preg_match( '/^content-type:\s*(text\/html|application\/xhtml\+xml)([^[:alnum:]]+.*|)$/i', $h ) ) {
105
  return false;
106
  }
@@ -123,7 +122,8 @@ abstract class Frontend {
123
  if ( ! static::_is_html_content() ) {
124
  return $buf;
125
  }
126
- if ( ! Options::get_option( Options::CACHE_PLUGINS_SUPPRESS_WARNING ) && ! \is_user_logged_in() &&
 
127
  Options::get_option( Options::CACHE_PLUGINS_DETECTION ) ) {
128
  Options::set_option( Options::OB_NOT_INTERCEPTED, Options::get_option( Options::OB_NOT_INTERCEPTED ) + 1 );
129
  }
100
  foreach ( headers_list() as $h ) {
101
  $h = ltrim( $h );
102
  if ( strncasecmp( $h, $ct, $ct_len ) === 0 ) {
 
103
  if ( 1 !== preg_match( '/^content-type:\s*(text\/html|application\/xhtml\+xml)([^[:alnum:]]+.*|)$/i', $h ) ) {
104
  return false;
105
  }
122
  if ( ! static::_is_html_content() ) {
123
  return $buf;
124
  }
125
+ if ( function_exists( '\is_user_logged_in' ) && ! \is_user_logged_in() &&
126
+ ! Options::get_option( Options::CACHE_PLUGINS_SUPPRESS_WARNING ) &&
127
  Options::get_option( Options::CACHE_PLUGINS_DETECTION ) ) {
128
  Options::set_option( Options::OB_NOT_INTERCEPTED, Options::get_option( Options::OB_NOT_INTERCEPTED ) + 1 );
129
  }
includes/frontend/endorsements.php CHANGED
@@ -24,7 +24,7 @@ class Endorsements {
24
  if ( empty( $post ) ) {
25
  return $content;
26
  }
27
- if ( ! get_option( WPAUTOTERMS_OPTION_PREFIX . static::ID ) || $this->_license->status() == License::STATUS_FREE ) {
28
  return $content;
29
  }
30
  $when = get_option( WPAUTOTERMS_OPTION_PREFIX . static::ID . '_when' );
24
  if ( empty( $post ) ) {
25
  return $content;
26
  }
27
+ if ( ! get_option( WPAUTOTERMS_OPTION_PREFIX . static::ID ) || !$this->_license->is_paid() ) {
28
  return $content;
29
  }
30
  $when = get_option( WPAUTOTERMS_OPTION_PREFIX . static::ID . '_when' );
includes/frontend/notice/cookies-notice.php CHANGED
@@ -28,7 +28,7 @@ class Cookies_Notice extends Base_Notice {
28
  }
29
 
30
  protected function _is_enabled() {
31
- return $this->_license->status() != License::STATUS_FREE && parent::_is_enabled();
32
  }
33
 
34
  protected function _print_box() {
28
  }
29
 
30
  protected function _is_enabled() {
31
+ return $this->_license->is_paid() && parent::_is_enabled();
32
  }
33
 
34
  protected function _print_box() {
includes/legal-pages/conf.php CHANGED
@@ -23,17 +23,19 @@ abstract class Conf {
23
 
24
  protected static function _create_pages() {
25
  static::$_pages = array(
26
- new Page( 'gdpr-privacy-policy',
27
  static::get_group( static::GROUP_PRIVACY_POLICY ),
28
- __( 'GDPR Privacy Policy', WPAUTOTERMS_SLUG ),
29
- __( 'Create a GDPR Privacy Policy for your WordPress website.', WPAUTOTERMS_SLUG ),
30
- true
 
31
  ),
32
  new Page( 'privacy-policy',
33
  static::get_group( static::GROUP_PRIVACY_POLICY ),
34
- __( 'Privacy Policy', WPAUTOTERMS_SLUG ),
35
  __( 'Create a simple Privacy Policy for your WordPress website.', WPAUTOTERMS_SLUG ),
36
- false
 
37
  ),
38
  new Page( 'terms-and-conditions',
39
  static::get_group( static::GROUP_TERMS ),
23
 
24
  protected static function _create_pages() {
25
  static::$_pages = array(
26
+ new Page( 'professional-privacy-policy',
27
  static::get_group( static::GROUP_PRIVACY_POLICY ),
28
+ __( 'Professional Privacy Policy (CCPA & GPDR)', WPAUTOTERMS_SLUG ),
29
+ __( 'Create a Professional Privacy Policy for your WordPress website. Include CCPA & GDPR.', WPAUTOTERMS_SLUG ),
30
+ true,
31
+ __( 'Privacy Policy', WPAUTOTERMS_SLUG )
32
  ),
33
  new Page( 'privacy-policy',
34
  static::get_group( static::GROUP_PRIVACY_POLICY ),
35
+ __( 'Simple Privacy Policy', WPAUTOTERMS_SLUG ),
36
  __( 'Create a simple Privacy Policy for your WordPress website.', WPAUTOTERMS_SLUG ),
37
+ false,
38
+ __( 'Privacy Policy', WPAUTOTERMS_SLUG )
39
  ),
40
  new Page( 'terms-and-conditions',
41
  static::get_group( static::GROUP_TERMS ),
includes/legal-pages/page.php CHANGED
@@ -9,14 +9,26 @@ class Page {
9
  public $id;
10
  public $group;
11
  public $title;
 
12
  public $description;
13
  public $is_paid;
14
 
15
- public function __construct( $id, Group $group, $title, $description, $is_paid ) {
 
 
 
 
 
 
 
 
 
 
16
  $this->id = $id;
17
  $this->group = $group;
18
  $this->title = $title;
19
  $this->description = $description;
20
  $this->is_paid = $is_paid;
 
21
  }
22
  }
9
  public $id;
10
  public $group;
11
  public $title;
12
+ public $page_title;
13
  public $description;
14
  public $is_paid;
15
 
16
+ /**
17
+ * Page constructor.
18
+ *
19
+ * @param $id
20
+ * @param Group $group
21
+ * @param $title string: wizard and listing title.
22
+ * @param $description
23
+ * @param $is_paid bool
24
+ * @param $page_title false|string: generated page title, false if equals to wizard title.
25
+ */
26
+ public function __construct( $id, Group $group, $title, $description, $is_paid, $page_title = false ) {
27
  $this->id = $id;
28
  $this->group = $group;
29
  $this->title = $title;
30
  $this->description = $description;
31
  $this->is_paid = $is_paid;
32
+ $this->page_title = $page_title === false ? $title : $page_title;
33
  }
34
  }
includes/option/checkbox-option-ex.php CHANGED
@@ -19,7 +19,7 @@ class Checkbox_Option_Ex extends Checkbox_Option {
19
  }
20
 
21
  public function sanitize( $input ) {
22
- if ( $this->_license->status() == License::STATUS_FREE ) {
23
  return false;
24
  }
25
 
@@ -27,7 +27,7 @@ class Checkbox_Option_Ex extends Checkbox_Option {
27
  }
28
 
29
  public function get_value() {
30
- if ( $this->_license->status() == License::STATUS_FREE ) {
31
  return false;
32
  }
33
 
19
  }
20
 
21
  public function sanitize( $input ) {
22
+ if ( ! $this->_license->is_paid() ) {
23
  return false;
24
  }
25
 
27
  }
28
 
29
  public function get_value() {
30
+ if ( !$this->_license->is_paid() ) {
31
  return false;
32
  }
33
 
includes/vo.php ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace wpautoterms;
4
+
5
+ use ReflectionClass;
6
+ use ReflectionProperty;
7
+
8
+ abstract class Vo {
9
+ protected static $_fields;
10
+ protected static $_defaults = array();
11
+
12
+ /**
13
+ * Vo constructor.
14
+ *
15
+ * @param $values array
16
+ */
17
+ public function __construct( array $values ) {
18
+ if ( static::$_fields == null ) {
19
+ $reflect = new ReflectionClass( $this );
20
+ $props = $reflect->getProperties( ReflectionProperty::IS_PUBLIC | ReflectionProperty::IS_PROTECTED |
21
+ ReflectionProperty::IS_PRIVATE );
22
+ static::$_fields = array();
23
+ foreach ( $props as $x ) {
24
+ if ( static::_filter_fields( $x->name ) ) {
25
+ static::$_fields[] = $x->name;
26
+ }
27
+ }
28
+ }
29
+ foreach ( static::$_fields as $k ) {
30
+ if ( isset( $values[ $k ] ) ) {
31
+ $this->$k = $values[ $k ];
32
+ } elseif ( isset( static::$_defaults[ $k ] ) ) {
33
+ $this->$k = static::$_defaults[ $k ];
34
+ }
35
+ }
36
+ }
37
+
38
+ /**
39
+ * @param $field_name string
40
+ *
41
+ * @return bool
42
+ */
43
+ protected static function _filter_fields( $field_name ) {
44
+ return $field_name[0] !== '_';
45
+ }
46
+
47
+ /**
48
+ * @return array
49
+ */
50
+ public static function defaults() {
51
+ return static::$_defaults;
52
+ }
53
+
54
+ /**
55
+ * @return array
56
+ */
57
+ public function to_array() {
58
+ $res = array();
59
+ foreach ( static::$_fields as $k ) {
60
+ $res[ $k ] = $this->$k;
61
+ }
62
+
63
+ return $res;
64
+ }
65
+ }
includes/wpautoterms.php CHANGED
@@ -3,6 +3,7 @@
3
  namespace wpautoterms;
4
 
5
  use wpautoterms\admin\form\Legal_Page;
 
6
  use wpautoterms\admin\Notices;
7
  use wpautoterms\admin\Options;
8
  use wpautoterms\cpt\CPT;
@@ -20,8 +21,11 @@ abstract class Wpautoterms {
20
  } else {
21
  $c = '\wpautoterms\admin\form\Legal_Page';
22
  }
23
- $p = new $c( $page->id, $page->title, $page->description );
24
  if ( $page->is_paid ) {
 
 
 
25
  $p->set_params( $license, $query );
26
  }
27
  static::$_legal_pages[ $page->id ] = $p;
3
  namespace wpautoterms;
4
 
5
  use wpautoterms\admin\form\Legal_Page;
6
+ use wpautoterms\admin\form\Licensed_Legal_Page;
7
  use wpautoterms\admin\Notices;
8
  use wpautoterms\admin\Options;
9
  use wpautoterms\cpt\CPT;
21
  } else {
22
  $c = '\wpautoterms\admin\form\Legal_Page';
23
  }
24
+ $p = new $c( $page->id, $page->title, $page->description, $page->page_title );
25
  if ( $page->is_paid ) {
26
+ /**
27
+ * @var $p Licensed_Legal_Page
28
+ */
29
  $p->set_params( $license, $query );
30
  }
31
  static::$_legal_pages[ $page->id ] = $p;
js/box-page.js CHANGED
@@ -38,7 +38,7 @@ jQuery(document).ready(function ($) {
38
  var s = jQuery("#" + t.data("source"));
39
  if (depVal === "show") {
40
  p.hide();
41
- t.removeClass("wpautoterms-hidden");
42
  }
43
  s.change(function () {
44
  var show = depType === "show";
38
  var s = jQuery("#" + t.data("source"));
39
  if (depVal === "show") {
40
  p.hide();
41
+ t.show();
42
  }
43
  s.change(function () {
44
  var show = depType === "show";
js/contact-form.js CHANGED
@@ -1,7 +1,5 @@
1
  jQuery(document).ready(function () {
2
  var SITE_INFO_NONE = 0;
3
- var SITE_INFO_SHORT = 1;
4
- var SITE_INFO_EXTENDED = 2;
5
  var PREVIEW_SIZE = 80;
6
  var valid = false;
7
 
1
  jQuery(document).ready(function () {
2
  var SITE_INFO_NONE = 0;
 
 
3
  var PREVIEW_SIZE = 80;
4
  var valid = false;
5
 
js/license-settings.js CHANGED
@@ -1,36 +1,63 @@
1
  jQuery(document).ready(function () {
2
- function onClick() {
3
- var b = jQuery(this);
4
- b.attr("disabled", "disabled");
 
 
5
  jQuery.post(ajaxurl, {
6
- action: this.dataset.action,
7
  nonce: wpautotermsLicenseSettings.nonce,
8
  apiKey: jQuery("#" + wpautotermsLicenseSettings.keyId).val()
9
  }).done(function (response) {
10
  if (typeof response !== "object") {
11
  alert(response);
12
  } else {
13
- var text = response.status;
14
- if (response.errorMessage) {
15
- text += " (" + response.errorMessage + ")";
16
- }
17
- jQuery("#wpautoterms_license_status").text(text);
18
- updateLastCheck(response.timestamp);
 
19
  }
20
  }).fail(function (error) {
21
- console.log(error);
22
  alert(error.statusText);
23
  }).always(function () {
24
- b.removeAttr("disabled");
25
  });
26
  }
27
 
28
- function updateLastCheck(stamp) {
29
- var txt = stamp === 0 ? wpautotermsLicenseSettings.never : (new Date(stamp * 1000)).toLocaleString();
30
- jQuery("#wpautoterms_license_last_check").text(txt);
31
  }
32
 
33
- updateLastCheck(wpautotermsLicenseSettings.lastCheck);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
 
35
- jQuery("#wpautoterms_recheck").click(onClick);
 
 
 
36
  });
1
  jQuery(document).ready(function () {
2
+ var RECHECK_BUTTON = jQuery("#wpautoterms_recheck");
3
+ var TRANSFER_ERROR = jQuery("[data-control=wpautoterms_transfer_error]");
4
+
5
+ function onClickRecheck() {
6
+ RECHECK_BUTTON.attr("disabled", "disabled");
7
  jQuery.post(ajaxurl, {
8
+ action: wpautotermsLicenseSettings.action,
9
  nonce: wpautotermsLicenseSettings.nonce,
10
  apiKey: jQuery("#" + wpautotermsLicenseSettings.keyId).val()
11
  }).done(function (response) {
12
  if (typeof response !== "object") {
13
  alert(response);
14
  } else {
15
+ wpautotermsLicenseSettings.status = response.status;
16
+ jQuery("#wpautoterms_license_upgrade").toggle(response.maxSites !== 0);
17
+ jQuery("#wpautoterms_websites_limit_row").toggle(response.shouldShowWebsites);
18
+ jQuery("#wpautoterms_license_status").text(response.licenseType);
19
+ jQuery("#wpautoterms_websites_limit").text(response.websites);
20
+ jQuery("#wpautoterms_license_summary").text(response.summary);
21
+ updateTransferOptions();
22
  }
23
  }).fail(function (error) {
24
+ console.error(error);
25
  alert(error.statusText);
26
  }).always(function () {
27
+ RECHECK_BUTTON.removeAttr("disabled");
28
  });
29
  }
30
 
31
+ function updateTransferOptions() {
32
+ jQuery("#wpautoterms_transfer").toggle(wpautotermsLicenseSettings.status === "max_sites");
33
+ jQuery("#wpautoterms_transfer_address").toggle(wpautotermsLicenseSettings.status === "ip_mismatch");
34
  }
35
 
36
+ function transferResult(querySuccess, response) {
37
+ if (!querySuccess || typeof response !== "object") {
38
+ console.error(result);
39
+ alert(error.statusText);
40
+ return;
41
+ }
42
+ if (response.result === "success") {
43
+ wpautotermsLicenseTransfer.transferHide();
44
+ onClickRecheck();
45
+ } else {
46
+ TRANSFER_ERROR.show();
47
+ }
48
+ }
49
+
50
+ function onClickTransferBlock(selector, e) {
51
+ e.preventDefault();
52
+ e.stopPropagation();
53
+ TRANSFER_ERROR.hide();
54
+ if (!wpautotermsLicenseTransfer.transferShow(selector, transferResult)) {
55
+ wpautotermsLicenseTransfer.transferHide();
56
+ }
57
+ }
58
 
59
+ RECHECK_BUTTON.click(onClickRecheck);
60
+ jQuery("#wpautoterms_transfer_open").click(onClickTransferBlock.bind(null, "#wpautoterms_request_transfer"));
61
+ jQuery("#wpautoterms_transfer_address_open").click(onClickTransferBlock.bind(null, "#wpautoterms_request_transfer_address"));
62
+ updateTransferOptions();
63
  });
js/license-transfer.js ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function () {
2
+ var KEY_INPUT = "[data-control=wpautoterms_transfer_key]";
3
+ var SITE_INPUT = "[data-control=wpautoterms_transfer_site]";
4
+ var EMAIL_INPUT = "[data-control=wpautoterms_transfer_email]";
5
+ var INPUTS = [EMAIL_INPUT, SITE_INPUT, KEY_INPUT];
6
+ var XFER_BUTTON = "[data-control=wpautoterms_transfer_button]";
7
+ var LICENSE_KEY_OPTION = "#wpautoterms_license";
8
+ var _cb;
9
+ var button;
10
+ var inputs;
11
+ var node;
12
+ var query = false;
13
+
14
+ function val(selector) {
15
+ return node.find(selector).val() || "";
16
+ }
17
+
18
+ function onClickTransfer() {
19
+ button.attr("disabled", "disabled");
20
+ query = true;
21
+ jQuery.post(ajaxurl, {
22
+ action: wpautotermsLicenseTransfer.action,
23
+ nonce: wpautotermsLicenseTransfer.nonce,
24
+ key: val(KEY_INPUT),
25
+ email: val(EMAIL_INPUT),
26
+ site: val(SITE_INPUT),
27
+ }).done(function (response) {
28
+ _cb(true, response);
29
+ }).fail(function (error) {
30
+ _cb(false, error);
31
+ }).always(function () {
32
+ query = false;
33
+ updateTransferButton();
34
+ });
35
+ }
36
+
37
+ function areInputsGood() {
38
+ var result = true;
39
+ inputs.each(function () {
40
+ if (this.value.length < 1) {
41
+ result = false;
42
+ }
43
+ });
44
+ return result;
45
+ }
46
+
47
+ function updateTransferButton() {
48
+ if (button == null) {
49
+ return;
50
+ }
51
+ if (!query && areInputsGood()) {
52
+ button.removeAttr("disabled");
53
+ } else {
54
+ button.attr("disabled", "disabled");
55
+ }
56
+ }
57
+
58
+ function cleanup() {
59
+ button.off("click", onClickTransfer);
60
+ inputs.off("input", updateTransferButton);
61
+ button = null;
62
+ inputs = null;
63
+ node = null;
64
+ }
65
+
66
+ wpautotermsLicenseTransfer.transferShow = function (selector, cb) {
67
+ if (button == null) {
68
+ node = jQuery(selector).show();
69
+ _cb = cb;
70
+ node.find(KEY_INPUT).val(jQuery(LICENSE_KEY_OPTION).val());
71
+ button = node.find(XFER_BUTTON);
72
+ button.on("click", onClickTransfer);
73
+ inputs = node.find(INPUTS.join(",")).on("input", updateTransferButton);
74
+ return true;
75
+ }
76
+ return false;
77
+ };
78
+ wpautotermsLicenseTransfer.transferHide = function () {
79
+ if (button != null) {
80
+ node.hide();
81
+ cleanup();
82
+ return true;
83
+ }
84
+ return false;
85
+ };
86
+ });
screenshot-1.png CHANGED
Binary file
screenshot-2.png CHANGED
Binary file
screenshot-3.png CHANGED
Binary file
screenshot-4.png CHANGED
Binary file
screenshot-5.png ADDED
Binary file
templates/auto-draft-page.php CHANGED
@@ -1,7 +1,15 @@
1
  <?php
 
 
 
2
  if ( ! defined( 'ABSPATH' ) ) {
3
  exit;
4
  }
 
 
 
 
 
5
  // WARNING: #poststuff style block should reside here
6
  ?>
7
  <style>
1
  <?php
2
+
3
+ use wpautoterms\admin\form\Legal_Page;
4
+
5
  if ( ! defined( 'ABSPATH' ) ) {
6
  exit;
7
  }
8
+
9
+ /**
10
+ * @var $page Legal_Page
11
+ */
12
+
13
  // WARNING: #poststuff style block should reside here
14
  ?>
15
  <style>
templates/auto-draft.php CHANGED
@@ -18,6 +18,10 @@ if ( ! empty( $agreement_data ) ) {
18
  $wizard_args = $agreement_data[1];
19
  }
20
 
 
 
 
 
21
  // WARNING: #poststuff style block should reside here
22
  ?>
23
  <style>
@@ -138,8 +142,8 @@ if ( ! empty( $agreement_data ) ) {
138
  echo ' wpautoterms-link-disable';
139
  } ?>">
140
  <a class="button button-primary" href="<?php
141
- echo esc_url( admin_url( 'post-new.php?post_type=wpautoterms_page&page_name=custom' ) );
142
- ?>" id="legal-page-custom">
143
  <?php _e( 'Create', WPAUTOTERMS_SLUG ); ?>
144
  </a>
145
  </div>
18
  $wizard_args = $agreement_data[1];
19
  }
20
 
21
+ /**
22
+ * @var $pages_by_type array
23
+ */
24
+
25
  // WARNING: #poststuff style block should reside here
26
  ?>
27
  <style>
142
  echo ' wpautoterms-link-disable';
143
  } ?>">
144
  <a class="button button-primary" href="<?php
145
+ echo esc_url( admin_url( 'post-new.php?post_type=wpautoterms_page&page_name=custom' ) );
146
+ ?>" id="legal-page-custom">
147
  <?php _e( 'Create', WPAUTOTERMS_SLUG ); ?>
148
  </a>
149
  </div>
templates/legal-pages/admin/privacy-policy.php CHANGED
@@ -2,15 +2,19 @@
2
  if (!defined( 'ABSPATH' )) {
3
  exit;
4
  }
5
- ?>
6
- <?php
7
  use wpautoterms\admin\form\Controls;
 
8
  use wpautoterms\admin\form\Section;
 
 
 
 
9
  ?>
10
 
11
  <div class="legal-page-inner">
12
 
13
- <h1><?php _e( 'Privacy Policy', WPAUTOTERMS_SLUG ); ?></h1>
14
 
15
  <?php Section::begin('website_url_section', __('What is your website URL?', WPAUTOTERMS_SLUG)); ?>
16
  <input type="text" name="website_url" class="regular-text" value="<?php echo do_shortcode('[wpautoterms site_url]'); ?>" placeholder="Enter your website URL" />
2
  if (!defined( 'ABSPATH' )) {
3
  exit;
4
  }
5
+
 
6
  use wpautoterms\admin\form\Controls;
7
+ use wpautoterms\admin\form\Legal_Page;
8
  use wpautoterms\admin\form\Section;
9
+
10
+ /**
11
+ * @var $page Legal_Page
12
+ */
13
  ?>
14
 
15
  <div class="legal-page-inner">
16
 
17
+ <h1><?php echo esc_html($page->page_title()); ?></h1>
18
 
19
  <?php Section::begin('website_url_section', __('What is your website URL?', WPAUTOTERMS_SLUG)); ?>
20
  <input type="text" name="website_url" class="regular-text" value="<?php echo do_shortcode('[wpautoterms site_url]'); ?>" placeholder="Enter your website URL" />
templates/legal-pages/admin/terms-and-conditions.php CHANGED
@@ -1,17 +1,20 @@
1
  <?php
2
  if ( ! defined( 'ABSPATH' ) ) {
3
- exit;
4
  }
5
 
6
- ?>
7
- <?php
8
  use wpautoterms\admin\form\Controls;
 
9
  use wpautoterms\admin\form\Section;
 
 
 
 
10
  ?>
11
 
12
  <div class="legal-page-inner">
13
 
14
- <h1><?php _e('Terms and Conditions', WPAUTOTERMS_SLUG); ?></h1>
15
 
16
  <?php Section::begin('website_url_section', __('What is your website URL?', WPAUTOTERMS_SLUG)); ?>
17
  <input type="text" name="website_url" class="regular-text" value="<?php echo do_shortcode('[wpautoterms site_url]'); ?>" placeholder="Enter your website URL" />
1
  <?php
2
  if ( ! defined( 'ABSPATH' ) ) {
3
+ exit;
4
  }
5
 
 
 
6
  use wpautoterms\admin\form\Controls;
7
+ use wpautoterms\admin\form\Legal_Page;
8
  use wpautoterms\admin\form\Section;
9
+
10
+ /**
11
+ * @var $page Legal_Page
12
+ */
13
  ?>
14
 
15
  <div class="legal-page-inner">
16
 
17
+ <h1><?php echo esc_html($page->page_title()); ?></h1>
18
 
19
  <?php Section::begin('website_url_section', __('What is your website URL?', WPAUTOTERMS_SLUG)); ?>
20
  <input type="text" name="website_url" class="regular-text" value="<?php echo do_shortcode('[wpautoterms site_url]'); ?>" placeholder="Enter your website URL" />
templates/options/box.php CHANGED
@@ -3,37 +3,48 @@
3
  if ( ! defined( 'ABSPATH' ) ) {
4
  exit;
5
  }
6
- ?><div class="postbox wpautoterms-options-box">
7
- <h3><?php use wpautoterms\api\License;
8
 
9
- echo $box->title(); ?></h3>
10
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  <div class="inside">
12
  <p class="box-infotip"><?php echo $box->infotip(); ?></p>
13
  <p class="box-status <?php echo $enabled ? 'enabled' : 'disabled'; ?>"
14
  id="status_<?php echo $box->enable_action_id(); ?>"><?php echo $status_text; ?></p>
15
  </div>
16
  <div class="wpautoterms-box-enable-button">
17
- <?php
18
- if ( isset( $license ) && $license == License::STATUS_FREE ) {
19
- ?>
20
- <a class="button" href="<?php echo esc_url( WPAUTOTERMS_PURCHASE_URL ); ?>" target="wpautotermsGetLicense">
21
- <?php _e( 'Purchase License', WPAUTOTERMS_SLUG ); ?>
22
- </a>
23
- <?php
24
- } else {
25
- ?>
26
  <a class="button" data-type="enable" href="javascript:void(0);"
27
  id="<?php echo $box->enable_action_id(); ?>">
28
  <?php echo $enable_button_text; ?>
29
  </a>
30
- <?php
31
- }
32
- ?>
 
 
33
  </div>
34
  <div class="wpautoterms-box-configure-button">
35
  <a class="button button-primary"
36
- href="edit.php?post_type=<?php echo \wpautoterms\cpt\CPT::type(); ?>&page=wpautoterms_compliancekits&box=<?php echo $box->id(); ?>">
37
  <?php _e( 'Configure', WPAUTOTERMS_SLUG ); ?>
38
  </a>
39
  </div>
3
  if ( ! defined( 'ABSPATH' ) ) {
4
  exit;
5
  }
 
 
6
 
7
+ use \wpautoterms\cpt\CPT;
8
 
9
+ /**
10
+ * @var $box \wpautoterms\box\Box
11
+ */
12
+
13
+ /**
14
+ * @var $enabled bool
15
+ */
16
+
17
+ /**
18
+ * @var $status_text string
19
+ */
20
+
21
+ /**
22
+ * @var $enable_button_text string
23
+ */
24
+ ?>
25
+ <div class="postbox wpautoterms-options-box">
26
+ <h3><?php echo $box->title(); ?>
27
+ </h3>
28
  <div class="inside">
29
  <p class="box-infotip"><?php echo $box->infotip(); ?></p>
30
  <p class="box-status <?php echo $enabled ? 'enabled' : 'disabled'; ?>"
31
  id="status_<?php echo $box->enable_action_id(); ?>"><?php echo $status_text; ?></p>
32
  </div>
33
  <div class="wpautoterms-box-enable-button">
34
+ <?php if ( ! isset( $license_paid ) || ( isset( $license_paid ) && $license_paid ) ) { ?>
 
 
 
 
 
 
 
 
35
  <a class="button" data-type="enable" href="javascript:void(0);"
36
  id="<?php echo $box->enable_action_id(); ?>">
37
  <?php echo $enable_button_text; ?>
38
  </a>
39
+ <?php } else { ?>
40
+ <a class="button" href="<?php echo esc_url( WPAUTOTERMS_PURCHASE_URL ); ?>" target="wpautotermsGetLicense">
41
+ <?php _e( 'Purchase License', WPAUTOTERMS_SLUG ); ?>
42
+ </a>
43
+ <?php } ?>
44
  </div>
45
  <div class="wpautoterms-box-configure-button">
46
  <a class="button button-primary"
47
+ href="edit.php?post_type=<?php echo CPT::type(); ?>&page=wpautoterms_compliancekits&box=<?php echo $box->id(); ?>">
48
  <?php _e( 'Configure', WPAUTOTERMS_SLUG ); ?>
49
  </a>
50
  </div>
templates/options/license-status-option.php DELETED
@@ -1,27 +0,0 @@
1
- <?php
2
-
3
- if ( ! defined( 'ABSPATH' ) ) {
4
- exit;
5
- }
6
-
7
- use wpautoterms\admin\action\Recheck_License;
8
-
9
- ?>
10
- <div>
11
- <span id="wpautoterms_license_status">
12
- <?php echo $status;
13
- if ( ! empty( $error_message ) ) {
14
- echo ' (' . $error_message . ')';
15
- }
16
- ?>
17
- </span>
18
- <div>
19
- <?php _e( 'Last check:', WPAUTOTERMS_SLUG ); ?>
20
- <span id="wpautoterms_license_last_check"><?php _ex( 'unknown', 'license_settings_page', WPAUTOTERMS_SLUG ); ?></span>
21
- <div class="wpautoterms-recheck-license-button">
22
- <a class="button" href="javascript:void(0);" id="wpautoterms_recheck" data-action="<?php
23
- echo esc_attr( Recheck_License::NAME );
24
- ?>"><?php _e( 'Recheck' ); ?></a>
25
- </div>
26
- </div>
27
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
templates/pages/help.php CHANGED
@@ -2,10 +2,14 @@
2
 
3
  use wpautoterms\admin\action\Send_Message;
4
  use wpautoterms\admin\Options;
 
5
 
6
  if ( ! defined( 'ABSPATH' ) ) {
7
  exit;
8
  }
 
 
 
9
  $current_user = wp_get_current_user();
10
  $data = $page->action->get_data();
11
  $site_name = Options::get_option( Options::SITE_NAME );
@@ -70,7 +74,7 @@ if ( ! empty( $data ) ) {
70
  <input type="hidden" name="site_info" value=""/>
71
  <input type="hidden" name="locale" value="<?php echo esc_attr( get_locale() ); ?>"/>
72
  <input type="hidden" name="ret_url" value="<?php
73
- echo esc_url( admin_url( 'edit.php?post_type=' . \wpautoterms\cpt\CPT::type() . '&page=' . $page->id() ) ); ?>">
74
  <table class="form-table">
75
  <tbody>
76
  <tr>
@@ -106,7 +110,7 @@ if ( ! empty( $data ) ) {
106
  <option value="<?php echo $option; ?>"<?php
107
  if ( $site_info === $option ) {
108
  echo ' selected';
109
- };
110
  ?>><?php echo ucwords( $label ); ?></option>
111
  <?php
112
  }
2
 
3
  use wpautoterms\admin\action\Send_Message;
4
  use wpautoterms\admin\Options;
5
+ use wpautoterms\cpt\CPT;
6
 
7
  if ( ! defined( 'ABSPATH' ) ) {
8
  exit;
9
  }
10
+ /**
11
+ * @var $page \wpautoterms\admin\page\Help
12
+ */
13
  $current_user = wp_get_current_user();
14
  $data = $page->action->get_data();
15
  $site_name = Options::get_option( Options::SITE_NAME );
74
  <input type="hidden" name="site_info" value=""/>
75
  <input type="hidden" name="locale" value="<?php echo esc_attr( get_locale() ); ?>"/>
76
  <input type="hidden" name="ret_url" value="<?php
77
+ echo esc_url( admin_url( 'edit.php?post_type=' . CPT::type() . '&page=' . $page->id() ) ); ?>">
78
  <table class="form-table">
79
  <tbody>
80
  <tr>
110
  <option value="<?php echo $option; ?>"<?php
111
  if ( $site_info === $option ) {
112
  echo ' selected';
113
+ }
114
  ?>><?php echo ucwords( $label ); ?></option>
115
  <?php
116
  }
templates/pages/license_settings.php CHANGED
@@ -1,17 +1,207 @@
1
  <?php
2
 
 
 
 
 
 
 
3
  if ( ! defined( 'ABSPATH' ) ) {
4
  exit;
5
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  ?>
7
  <div class="wrap">
8
- <h2><?php echo esc_html($page->title()); ?></h2>
 
9
  <?php settings_errors(); ?>
10
 
11
- <form method="post" action="options.php"><?php
12
- settings_fields( $page->id() );
13
- do_settings_sections( $page->id() );
14
- submit_button();
15
- ?>
16
- </form>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  </div>
1
  <?php
2
 
3
+ use wpautoterms\admin\action\Recheck_License;
4
+ use wpautoterms\admin\action\Transfer_License;
5
+ use wpautoterms\admin\Options;
6
+ use wpautoterms\api\License;
7
+ use wpautoterms\api\License_Info_Vo;
8
+
9
  if ( ! defined( 'ABSPATH' ) ) {
10
  exit;
11
  }
12
+ /**
13
+ * @var $page \wpautoterms\admin\page\Base
14
+ */
15
+
16
+ /**
17
+ * @var $info \wpautoterms\api\License_Info_Vo
18
+ */
19
+
20
+ function url_base( $s ) {
21
+ $ssl = ( ! empty( $s['HTTPS'] ) && $s['HTTPS'] == 'on' );
22
+ $sp = strtolower( $s['SERVER_PROTOCOL'] );
23
+ $protocol = substr( $sp, 0, strpos( $sp, '/' ) ) . ( ( $ssl ) ? 's' : '' );
24
+ $port = $s['SERVER_PORT'];
25
+ $port = ( ( ! $ssl && $port == '80' ) || ( $ssl && $port == '443' ) ) ? '' : ':' . $port;
26
+ $host = isset( $s['HTTP_HOST'] ) ? $s['HTTP_HOST'] : null;
27
+ $host = isset( $host ) ? $host : $s['SERVER_NAME'] . $port;
28
+
29
+ return $protocol . '://' . $host;
30
+ }
31
+
32
+ $ret_url = url_base( $_SERVER ) . $_SERVER['REQUEST_URI'];
33
+
34
  ?>
35
  <div class="wrap">
36
+ <h2><?php echo esc_html( $page->title() ); ?></h2>
37
+
38
  <?php settings_errors(); ?>
39
 
40
+ <form method="post" action="options.php" class="license-page">
41
+
42
+ <?php
43
+ settings_fields( $page->id() );
44
+ do_settings_sections( $page->id() );
45
+ ?>
46
+
47
+ <table class="form-table license-key-save-recheck">
48
+ <tbody>
49
+ <tr>
50
+ <th scope="row">
51
+ &nbsp;
52
+ </th>
53
+ <td>
54
+ <p class="submit">
55
+ <?php
56
+ submit_button( null, 'primary', 'submit', false );
57
+ ?>
58
+ <input type="button" name="wpautoterms_recheck" id="wpautoterms_recheck"
59
+ class="button button-large"
60
+ value="<?php _ex( 'Recheck', 'license settings page', WPAUTOTERMS_SLUG ); ?>"
61
+ data-action="<?php esc_attr_e( Recheck_License::NAME ); ?>"/>
62
+ </p>
63
+ </td>
64
+ </tr>
65
+ </tbody>
66
+ </table>
67
+
68
+ </form>
69
+
70
+ <hr/>
71
+
72
+ <table class="form-table">
73
+ <tbody>
74
+ <tr>
75
+ <th scope="row"><?php _e( 'License type', WPAUTOTERMS_SLUG ); ?></th>
76
+ <td>
77
+ <div>
78
+ <span id="wpautoterms_license_status"><?php echo $info->license_type_string(); ?></span>
79
+ </div>
80
+ </td>
81
+ </tr>
82
+ <tr id="wpautoterms_websites_limit_row"<?php echo $info->should_show_websites() ? '' : ' class="wpautoterms-hidden"'; ?>>
83
+ <th scope="row"><?php _e( 'Allowed websites', WPAUTOTERMS_SLUG ); ?></th>
84
+ <td>
85
+ <div>
86
+ <span id="wpautoterms_websites_limit"><?php echo $info->websites_info(); ?></span>
87
+ </div>
88
+ <div class="wpautoterms-license-upgrade" id="wpautoterms_license_upgrade"
89
+ <?php echo $info->max_sites != 0 ? '' : 'style="display:none"'; ?>>
90
+ <form method="post" action="<?php esc_attr_e( WPAUTOTERMS_UPGRADE_URL ); ?>">
91
+ <input type="hidden" name="key"
92
+ value="<?php esc_attr_e( Options::get_option( License::OPTION_KEY, true ) ); ?>"/>
93
+ <input type="hidden" name="ret_url" value="<?php esc_attr_e( $ret_url ); ?>"/>
94
+ <input type="submit" class="button button-large"
95
+ value="<?php _e( 'Upgrade License key to allow more websites', WPAUTOTERMS_SLUG ); ?>"/>
96
+ </form>
97
+ </div>
98
+ </td>
99
+ </tr>
100
+ <tr>
101
+ <th scope="row"><?php _e( 'Summary', WPAUTOTERMS_SLUG ); ?></th>
102
+ <td>
103
+ <div>
104
+ <p id="wpautoterms_license_summary"><?php echo $info->summary(); ?></p>
105
+ <?php if($info->license_type_string() == "free") { ?>
106
+ <p>
107
+ <br />
108
+ Most features of our plugin work without a License key.
109
+ <br />If you're interested in having access to all plugin features,
110
+ <br />consider purchasing a License key.
111
+ <br />
112
+ <br />
113
+ <a class="button" href="<?php echo esc_url( WPAUTOTERMS_PURCHASE_URL ); ?>" target="wpautotermsGetLicense">
114
+ <?php _e( 'Purchase License', WPAUTOTERMS_SLUG ); ?>
115
+ </a>
116
+ </p>
117
+ <br />
118
+ <p>
119
+ If you already have a License key and the "License type" is "free" above,
120
+ <br />
121
+ contact us to troubleshoot this.
122
+ </p>
123
+ <?php } ?>
124
+ </div>
125
+
126
+ <!-- Transfer to New Website -->
127
+ <div id="wpautoterms_transfer" class="wpautoterms-hidden">
128
+ <small>
129
+ <a href="#" id="wpautoterms_transfer_open">
130
+ <?php _e( 'You can request to transfer the License key to this new website', WPAUTOTERMS_SLUG ); ?>.
131
+ </a>
132
+ </small>
133
+ </div>
134
+ <div id="wpautoterms_request_transfer" class="wpautoterms-hidden ">
135
+ <div class="wpautoterms-transfer-entry">
136
+ <label for="wpautoterms_transfer_key"><?php _e( 'License key', WPAUTOTERMS_SLUG ); ?></label>
137
+ <input type="text" class="wpautoterms-license-key" name="wpautoterms_transfer_key"
138
+ data-control="wpautoterms_transfer_key" disabled/>
139
+ </div>
140
+ <div class="wpautoterms-transfer-entry">
141
+ <label for="wpautoterms_transfer_email"><?php _e( 'Confirm email', WPAUTOTERMS_SLUG ); ?></label>
142
+ <input type="text" class="wpautoterms-transfer-email" name="wpautoterms_transfer_email"
143
+ data-control="wpautoterms_transfer_email" placeholder="me@domain.com"/>
144
+ </div>
145
+ <div class="wpautoterms-transfer-entry">
146
+ <label for="wpautoterms_transfer_site"><?php _e( 'Old website address', WPAUTOTERMS_SLUG ); ?></label>
147
+ <input type="text" class="wpautoterms-transfer-site" name="wpautoterms_transfer_site"
148
+ data-control="wpautoterms_transfer_site" placeholder="website.com"/>
149
+ </div>
150
+ <div class="wpautoterms-hidden wpautoterms-form-errors wpautoterms-transfer-entry"
151
+ data-control="wpautoterms_transfer_error">
152
+ <br/>
153
+ <?php _e( 'License key transfer to a new site address failed. Please contact us from WP AutoTerms > Help > Send us a message.', WPAUTOTERMS_SLUG ); ?>
154
+ </div>
155
+ <div class="wpautoterms-transfer-entry">
156
+ <br />
157
+ <input type="button" class="button button-primary" data-control="wpautoterms_transfer_button"
158
+ value="<?php _e( 'Transfer License key', WPAUTOTERMS_SLUG ); ?>"
159
+ data-action="<?php esc_attr_e( Transfer_License::NAME ); ?>"/>
160
+ </div>
161
+ <br/>
162
+ <hr/>
163
+ <br/>
164
+ <p>The <strong>old website address</strong> and <strong>email address</strong> must match the
165
+ website address and email address assigned to the License key.</p>
166
+ <p>For example: If you purchased the License key for "domain1.com" and you wish to move it to
167
+ "domain2.com", your old website address is "domain1.com".</p>
168
+ </div>
169
+
170
+ <!-- Transfer IP Address -->
171
+ <div id="wpautoterms_transfer_address" class="wpautoterms-transfer-address wpautoterms-hidden">
172
+ If your website server's IP address has changed,
173
+ <a href="#" id="wpautoterms_transfer_address_open" class=""><?php _e( 'transfer the License key of your website to this new IP address', WPAUTOTERMS_SLUG ); ?></a>.
174
+ </div>
175
+ <br />
176
+ <div id="wpautoterms_request_transfer_address" class="wpautoterms-request-transfer-address wpautoterms-hidden">
177
+ <div class="wpautoterms-transfer-entry">
178
+ <label for="wpautoterms_transfer_key"><?php _e( 'License key', WPAUTOTERMS_SLUG ); ?></label>
179
+ <input type="text" class="wpautoterms-license-key" name="wpautoterms_transfer_key"
180
+ data-control="wpautoterms_transfer_key" disabled/>
181
+ </div>
182
+ <div class="wpautoterms-transfer-entry">
183
+ <label for="wpautoterms_transfer_email"><?php _e( 'Confirm email', WPAUTOTERMS_SLUG ); ?></label>
184
+ <input type="text" class="wpautoterms-transfer-email" name="wpautoterms_transfer_email"
185
+ data-control="wpautoterms_transfer_email" placeholder="me@domain.com"/>
186
+ </div>
187
+ <div class="wpautoterms-hidden wpautoterms-form-errors wpautoterms-transfer-entry"
188
+ data-control="wpautoterms_transfer_error">
189
+ <br/>
190
+ <?php _e( 'License key transfer to a new IP address failed. Please contact us from WP AutoTerms > Help > Send us a message.', WPAUTOTERMS_SLUG ); ?>
191
+ </div>
192
+ <div class="wpautoterms-transfer-entry">
193
+ <br/>
194
+ <input type="button" class="button button-primary" data-control="wpautoterms_transfer_button"
195
+ value="<?php _e( 'Transfer License key', WPAUTOTERMS_SLUG ); ?>"
196
+ data-action="<?php esc_attr_e( Transfer_License::NAME ); ?>"/>
197
+ </div>
198
+ <br/>
199
+ <hr/>
200
+ <br/>
201
+ <p>The <strong>email address</strong> must match the email address assigned to the License key.</p>
202
+ </div>
203
+ </td>
204
+ </tr>
205
+ </tbody>
206
+ </table>
207
  </div>