Auto Terms of Service and Privacy Policy - Version 2.2.4

Version Description

Download this release

Release Info

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

Code changes from version 2.2.3 to 2.2.4

README.txt CHANGED
@@ -1,19 +1,21 @@
1
- === Auto Terms of Service and Privacy Policy (WP AutoTerms) ===
2
  Contributors: wpautoterms
3
- Tags: gdpr, privacy policy, terms and conditions, terms of service, terms of use, disclosure, disclaimer, affiliate, cookies, cookie consent, legal
4
  Requires at least: 4.2
5
- Tested up to: 5.0.2
6
  Requires PHP: 5.3
7
- Stable tag: 2.2.3
8
  License: GPL version 3 or any later version
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
11
- Create Privacy Policy (Simple or GDPR), Terms & Conditions, Disclaimers and 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
  = Create GDPR Privacy Policy and other legal agreements =
18
 
19
  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.
@@ -48,7 +50,7 @@ WP AutoTerms is provided with the purpose of helping you with compliance. While
48
 
49
  We're just getting started. Have a chat with us and let us know what you'd like to see added.
50
 
51
- == Honory Mention ==
52
 
53
  Special thanks to this plugin's original author, Clifford Paulick of https://tourkick.com/
54
 
@@ -117,6 +119,13 @@ Installing the plugin is easy. Just follow these steps:
117
 
118
  == Changelog ==
119
 
 
 
 
 
 
 
 
120
  = Version 2.2.3 =
121
  * Jan 7, 2019
122
  * Bug fix for short codes
1
+ === WP AutoTerms: GDPR Privacy Policy, Cookie Consent Banner, Terms & Conditions ===
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.1.1
6
  Requires PHP: 5.3
7
+ Stable tag: 2.2.4
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.
50
 
51
  We're just getting started. Have a chat with us and let us know what you'd like to see added.
52
 
53
+ == Honorary Mention ==
54
 
55
  Special thanks to this plugin's original author, Clifford Paulick of https://tourkick.com/
56
 
119
 
120
  == Changelog ==
121
 
122
+ = Version 2.2.4 =
123
+ * Feb 7, 2019
124
+ * Bug fixes
125
+ * Allow customization of the archive template file through the `archive-wpautoterms_page.php` file
126
+ * Show verbose errors if license key doesn't work
127
+ * Delete `wpautoterms` options in the database upon plugin delete
128
+
129
  = Version 2.2.3 =
130
  * Jan 7, 2019
131
  * Bug fix for short codes
auto-terms-of-service-privacy-policy.php CHANGED
@@ -2,10 +2,10 @@
2
  /*
3
  Plugin Name: WP AutoTerms
4
  Plugin URI: https://wpautoterms.com
5
- Description: Create Privacy Policy (Simple or GDPR), Terms & Conditions, Disclaimers and more. Compliance Kits to help you be compliant with the law.
6
  Author: WP AutoTerms
7
  Author URI: https://wpautoterms.com
8
- Version: 2.2.3
9
  License: GPLv2 or later
10
  Text Domain: wpautoterms
11
  Domain Path: /languages
2
  /*
3
  Plugin Name: WP AutoTerms
4
  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.2.4
9
  License: GPLv2 or later
10
  Text Domain: wpautoterms
11
  Domain Path: /languages
defines.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ exit;
5
+ }
6
+
7
+ define( 'WPAUTOTERMS_PLUGIN_DIR', __DIR__ . DIRECTORY_SEPARATOR );
8
+ define( 'WPAUTOTERMS_PLUGIN_URL', plugins_url( '/', __FILE__ ) );
9
+ define( 'WPAUTOTERMS_TAG', 'wpautoterms' );
10
+ define( 'WPAUTOTERMS_SLUG', 'wpautoterms' );
11
+ define( 'WPAUTOTERMS_OPTION_PREFIX', WPAUTOTERMS_SLUG . '_' );
12
+ define( 'WPAUTOTERMS_LEGAL_PAGES_DIR', 'legal-pages' . DIRECTORY_SEPARATOR );
13
+ define( 'WPAUTOTERMS_OPTION_ACTIVATED', 'activated' );
14
+ define( 'WPAUTOTERMS_LICENSE_RECHECK_TIME', 24 * 60 * 60 );
includes/api/license.php CHANGED
@@ -66,13 +66,16 @@ class License {
66
  $headers = array( WPAUTOTERMS_API_KEY_HEADER => $key );
67
  $resp = $this->_query->get( static::_EP_STATUS, array(), $headers );
68
  $json = $resp->json();
 
69
  if ( ! $resp->has_error() && isset( $json[ static::_RESP_STATUS ] ) &&
70
  $json[ static::_RESP_STATUS ] === static::STATUS_PAID ) {
71
  $this->_set_status( static::STATUS_PAID );
72
  } else {
73
  $this->_set_status( static::STATUS_FREE );
 
 
 
74
  }
75
- $this->_info['error'] = $resp->format_error( WP_DEBUG );
76
  $this->_save_status();
77
  }
78
 
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
  }
81
 
includes/api/query.php CHANGED
@@ -28,7 +28,7 @@ class Query {
28
  $all_headers = array_merge( $headers, $all_headers );
29
  }
30
 
31
- return $this->_exec( wp_remote_get( $url, array( 'headers' => $all_headers, 'body' => $params ) ), $url );
32
  }
33
 
34
  /**
@@ -51,14 +51,12 @@ class Query {
51
  $all_headers = array_merge( $headers, $all_headers );
52
  }
53
 
54
- return $this->_exec( wp_remote_post( $url, array(
55
- 'headers' => $all_headers,
56
- 'body' => $data
57
- ) ), $url );
58
  }
59
 
60
- protected function _exec( $resp, $url ) {
61
- $ret = new Response( $resp, $url, $this->_verbose );
 
62
  $ret->_done();
63
 
64
  return $ret;
28
  $all_headers = array_merge( $headers, $all_headers );
29
  }
30
 
31
+ return $this->_exec( 'wp_remote_get', $all_headers, $params, $url );
32
  }
33
 
34
  /**
51
  $all_headers = array_merge( $headers, $all_headers );
52
  }
53
 
54
+ return $this->_exec( 'wp_remote_post', $all_headers, $data, $url );
 
 
 
55
  }
56
 
57
+ protected function _exec( $fn, $headers, $body, $url ) {
58
+ $resp = $fn( $url, array( 'headers' => $headers, 'body' => $body ) );
59
+ $ret = new Response( $resp, $url, $headers, $body, $this->_verbose );
60
  $ret->_done();
61
 
62
  return $ret;
includes/api/response.php CHANGED
@@ -23,10 +23,15 @@ class Response {
23
  protected $_vs;
24
  public $headers = array();
25
  protected $_json;
 
 
26
 
27
- public function __construct( $response, $url, $verbose = false ) {
28
  $this->_response = $response;
29
  $this->_verbose = $verbose;
 
 
 
30
  $this->url = $url;
31
  }
32
 
@@ -75,7 +80,7 @@ class Response {
75
  $error = $json[ static::MESSAGE_KEY ];
76
  } else {
77
  if ( $this->code == \WP_Http::TOO_MANY_REQUESTS ) {
78
- $error = __( 'Too much requests. Please, wait.', WPAUTOTERMS_SLUG );
79
  } else {
80
  $error = sprintf( __( 'Server response code: %s', WPAUTOTERMS_SLUG ), $this->code );
81
  }
@@ -84,10 +89,22 @@ class Response {
84
  $error = '';
85
  }
86
  if ( ! empty( $error ) && $debug ) {
87
- $info = sprintf( __( 'URL: %s, error: %s, info: %s', WPAUTOTERMS_SLUG ), $this->url, $this->error, $this->error_info );
 
 
 
 
88
  $error = sprintf( _x( '%s, %s', 'class Response verbose error info', WPAUTOTERMS_SLUG ), $error, $info );
89
  }
90
 
91
  return $error;
92
  }
 
 
 
 
 
 
 
 
93
  }
23
  protected $_vs;
24
  public $headers = array();
25
  protected $_json;
26
+ protected $_request_headers;
27
+ protected $_request_body;
28
 
29
+ public function __construct( $response, $url, $headers, $body, $verbose = false ) {
30
  $this->_response = $response;
31
  $this->_verbose = $verbose;
32
+ $this->_request_headers = $headers;
33
+ $this->_request_body = $body;
34
+
35
  $this->url = $url;
36
  }
37
 
80
  $error = $json[ static::MESSAGE_KEY ];
81
  } else {
82
  if ( $this->code == \WP_Http::TOO_MANY_REQUESTS ) {
83
+ $error = __( 'Too many requests. Please, wait.', WPAUTOTERMS_SLUG );
84
  } else {
85
  $error = sprintf( __( 'Server response code: %s', WPAUTOTERMS_SLUG ), $this->code );
86
  }
89
  $error = '';
90
  }
91
  if ( ! empty( $error ) && $debug ) {
92
+ $info = sprintf( __( 'URL: %s, error: %s, info: %s, headers: %s', WPAUTOTERMS_SLUG ),
93
+ $this->url,
94
+ $this->error,
95
+ $this->error_info,
96
+ print_r( $this->_request_headers, true ) );
97
  $error = sprintf( _x( '%s, %s', 'class Response verbose error info', WPAUTOTERMS_SLUG ), $error, $info );
98
  }
99
 
100
  return $error;
101
  }
102
+
103
+ public function request_headers() {
104
+ return $this->_request_headers;
105
+ }
106
+
107
+ public function request_body() {
108
+ return $this->_request_body;
109
+ }
110
  }
includes/cpt/cpt.php CHANGED
@@ -106,7 +106,16 @@ abstract class CPT {
106
  }
107
  }
108
 
 
 
 
 
 
 
 
109
  public static function unregister_roles() {
 
 
110
  remove_role( static::ROLE );
111
  $users = get_users( array( 'role' => static::ROLE_EDITOR ) );
112
  if ( ! empty( $users ) ) {
@@ -115,10 +124,13 @@ abstract class CPT {
115
  */
116
  foreach ( $users as $user ) {
117
  $user->add_role( static::BASE_ROLE );
 
118
  $user->remove_role( static::ROLE_EDITOR );
119
  }
120
  }
 
121
  remove_role( static::ROLE_EDITOR );
 
122
  }
123
 
124
  /**
106
  }
107
  }
108
 
109
+ protected static function _remove_role_caps( $role_name ) {
110
+ $role = get_role( $role_name );
111
+ foreach ( static::caps() as $k => $v ) {
112
+ $role->remove_cap( $k );
113
+ }
114
+ }
115
+
116
  public static function unregister_roles() {
117
+ static::_remove_role_caps( static::ROLE );
118
+ static::_remove_role_caps( static::ROLE_EDITOR );
119
  remove_role( static::ROLE );
120
  $users = get_users( array( 'role' => static::ROLE_EDITOR ) );
121
  if ( ! empty( $users ) ) {
124
  */
125
  foreach ( $users as $user ) {
126
  $user->add_role( static::BASE_ROLE );
127
+
128
  $user->remove_role( static::ROLE_EDITOR );
129
  }
130
  }
131
+ static::_remove_role_caps( static::ROLE_EDITOR );
132
  remove_role( static::ROLE_EDITOR );
133
+ static::_remove_role_caps( 'administrator' );
134
  }
135
 
136
  /**
templates/options/license-status-option.php CHANGED
@@ -16,7 +16,7 @@ use wpautoterms\admin\action\Recheck_License;
16
  <span id="wpautoterms_license_last_check"><?php _ex( 'unknown', 'license_settings_page', WPAUTOTERMS_SLUG ); ?></span>
17
  <div class="wpautoterms-recheck-license-button">
18
  <a class="button" href="javascript:void(0);" id="wpautoterms_recheck" data-action="<?php
19
- echo esc_attr(Recheck_License::NAME);
20
  ?>"><?php _e( 'Recheck' ); ?></a>
21
  </div>
22
  </div>
16
  <span id="wpautoterms_license_last_check"><?php _ex( 'unknown', 'license_settings_page', WPAUTOTERMS_SLUG ); ?></span>
17
  <div class="wpautoterms-recheck-license-button">
18
  <a class="button" href="javascript:void(0);" id="wpautoterms_recheck" data-action="<?php
19
+ echo esc_attr( Recheck_License::NAME );
20
  ?>"><?php _e( 'Recheck' ); ?></a>
21
  </div>
22
  </div>
templates/pages/help-q-a.php CHANGED
@@ -18,4 +18,9 @@
18
  <li>Create a new Page Template.<br /> <small>Please read <a href="https://developer.wordpress.org/themes/template-files-section/page-template-files/#creating-custom-page-templates-for-global-use">Creating Custom Page Templates for Global Use</a>.</small></li>
19
  <li>Assign the new Page Template by going to WP AutoTerms > All Legal Pages > Select your legal page > Select the new Page Template from the "Page Attributes" widget.</li>
20
  </ol>
 
 
 
 
 
21
  </div>
18
  <li>Create a new Page Template.<br /> <small>Please read <a href="https://developer.wordpress.org/themes/template-files-section/page-template-files/#creating-custom-page-templates-for-global-use">Creating Custom Page Templates for Global Use</a>.</small></li>
19
  <li>Assign the new Page Template by going to WP AutoTerms > All Legal Pages > Select your legal page > Select the new Page Template from the "Page Attributes" widget.</li>
20
  </ol>
21
+ </div>
22
+
23
+ <h3 class="question-title">How can I update the design of my legal pages archive template?</h3>
24
+ <div class="question-answer">
25
+ <p>If you'd like to design the archive template file that contains all the generated legal pages, create a new file named `archive-wpautoterms_page.php`.</p>
26
  </div>
uninstall.php CHANGED
@@ -4,7 +4,13 @@ if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
4
  die;
5
  }
6
 
 
7
  require_once join( DIRECTORY_SEPARATOR, array( __DIR__, 'includes', 'cpt', 'cpt.php' ) );
 
8
  wpautoterms\cpt\CPT::unregister_roles();
9
- delete_option( WPAUTOTERMS_OPTION_PREFIX . WPAUTOTERMS_OPTION_ACTIVATED );
 
 
 
 
10
  flush_rewrite_rules();
4
  die;
5
  }
6
 
7
+ require_once __DIR__ . DIRECTORY_SEPARATOR . 'defines.php';
8
  require_once join( DIRECTORY_SEPARATOR, array( __DIR__, 'includes', 'cpt', 'cpt.php' ) );
9
+
10
  wpautoterms\cpt\CPT::unregister_roles();
11
+
12
+ global $wpdb;
13
+
14
+ $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->options WHERE option_name LIKE %s", WPAUTOTERMS_OPTION_PREFIX . '%' ) );
15
+
16
  flush_rewrite_rules();