Auto Terms of Service and Privacy Policy - Version 2.2.5

Version Description

Download this release

Release Info

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

Code changes from version 2.2.4 to 2.2.5

README.txt CHANGED
@@ -4,7 +4,7 @@ Tags: gdpr, privacy policy, terms and conditions, cookie consent, terms of servi
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
 
@@ -119,6 +119,13 @@ Installing the plugin is easy. Just follow these steps:
119
 
120
  == Changelog ==
121
 
 
 
 
 
 
 
 
122
  = Version 2.2.4 =
123
  * Feb 7, 2019
124
  * Bug fixes
4
  Requires at least: 4.2
5
  Tested up to: 5.1.1
6
  Requires PHP: 5.3
7
+ Stable tag: 2.2.5
8
  License: GPL version 3 or any later version
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
119
 
120
  == Changelog ==
121
 
122
+ = Version 2.2.5 =
123
+ * Apr 9, 2019
124
+ * Bug fix: Legal Page won't appear under the Category page
125
+ * Bug fix: Deleting plugin via WP Dashboard > Plugins can return "Internal Server Error" on some hosts
126
+ * Bug fix: Use the correct response class for "Too Many Requests" use case
127
+ * Bug fix: Fix Settings page where our Countries & States list will return a JS error
128
+
129
  = Version 2.2.4 =
130
  * Feb 7, 2019
131
  * Bug fixes
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.2.4
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.2.5
9
  License: GPLv2 or later
10
  Text Domain: wpautoterms
11
  Domain Path: /languages
includes/api/response.php CHANGED
@@ -44,7 +44,7 @@ class Response {
44
  $this->code = $this->_response['response']['code'];
45
  $this->error = $this->_response['response']['code'];
46
  $this->error_info = $this->_response['response']['message'];
47
- if ( $this->code == \WP_Http::TOO_MANY_REQUESTS ) {
48
  $retry = $this->_response['http_response']->get_response_object()->headers->getValues( static::HEADER_RETRY_AFTER );
49
  if ( ! empty( $retry ) ) {
50
  $this->delay = intval( $retry );
@@ -79,7 +79,7 @@ class Response {
79
  if ( $json !== null && isset( $json[ static::MESSAGE_KEY ] ) ) {
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 );
44
  $this->code = $this->_response['response']['code'];
45
  $this->error = $this->_response['response']['code'];
46
  $this->error_info = $this->_response['response']['message'];
47
+ if ( $this->code == static::HTTP_LIMIT ) {
48
  $retry = $this->_response['http_response']->get_response_object()->headers->getValues( static::HEADER_RETRY_AFTER );
49
  if ( ! empty( $retry ) ) {
50
  $this->delay = intval( $retry );
79
  if ( $json !== null && isset( $json[ static::MESSAGE_KEY ] ) ) {
80
  $error = $json[ static::MESSAGE_KEY ];
81
  } else {
82
+ if ( $this->code == static::HTTP_LIMIT ) {
83
  $error = __( 'Too many requests. Please, wait.', WPAUTOTERMS_SLUG );
84
  } else {
85
  $error = sprintf( __( 'Server response code: %s', WPAUTOTERMS_SLUG ), $this->code );
includes/countries.php CHANGED
@@ -93,9 +93,12 @@ abstract class Countries {
93
  array( 'underscore', 'wp-util' ), false, true );
94
  $ret = static::select_locale( static::LOCALE_PATH );
95
  if ( $ret !== false ) {
 
96
  $locale = $ret[0];
97
  $locale = WPAUTOTERMS_PLUGIN_URL . substr( $locale, strlen( WPAUTOTERMS_PLUGIN_DIR ) );
98
  wp_enqueue_script( WPAUTOTERMS_SLUG . '_countries_locale', $locale, false, false, true );
 
 
99
  }
100
  wp_enqueue_script( WPAUTOTERMS_SLUG . '_states_js', WPAUTOTERMS_PLUGIN_URL . 'js/data/states.js',
101
  false, false, true );
@@ -103,7 +106,7 @@ abstract class Countries {
103
  wp_localize_script( WPAUTOTERMS_SLUG . '_countries', 'wpautotermsCountry', array(
104
  'country' => Options::get_option( Options::COUNTRY ),
105
  'state' => Options::get_option( Options::STATE ),
106
- 'locale' => $ret[1]
107
  ) );
108
  }
109
 
93
  array( 'underscore', 'wp-util' ), false, true );
94
  $ret = static::select_locale( static::LOCALE_PATH );
95
  if ( $ret !== false ) {
96
+ $lang = $ret[1];
97
  $locale = $ret[0];
98
  $locale = WPAUTOTERMS_PLUGIN_URL . substr( $locale, strlen( WPAUTOTERMS_PLUGIN_DIR ) );
99
  wp_enqueue_script( WPAUTOTERMS_SLUG . '_countries_locale', $locale, false, false, true );
100
+ } else {
101
+ $lang = static::DEFAULT_LOCALE;
102
  }
103
  wp_enqueue_script( WPAUTOTERMS_SLUG . '_states_js', WPAUTOTERMS_PLUGIN_URL . 'js/data/states.js',
104
  false, false, true );
106
  wp_localize_script( WPAUTOTERMS_SLUG . '_countries', 'wpautotermsCountry', array(
107
  'country' => Options::get_option( Options::COUNTRY ),
108
  'state' => Options::get_option( Options::STATE ),
109
+ 'locale' => $lang
110
  ) );
111
  }
112
 
includes/cpt/cpt.php CHANGED
@@ -17,6 +17,7 @@ abstract class CPT {
17
  add_filter( 'theme_' . static::type() . '_templates', array( __CLASS__, 'filter_templates' ), 10, 2 );
18
  add_filter( 'map_meta_cap', array( __CLASS__, 'map_meta_cap' ), 10, 4 );
19
  add_action( 'admin_menu', array( __CLASS__, 'remove_taxonomies' ) );
 
20
  }
21
 
22
  public static function edit_cap() {
@@ -108,8 +109,10 @@ abstract class CPT {
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
 
@@ -179,4 +182,15 @@ abstract class CPT {
179
  'edit-tags.php?taxonomy=' . $t . '&post_type=' . static::type() );
180
  }
181
  }
 
 
 
 
 
 
 
 
 
 
 
182
  }
17
  add_filter( 'theme_' . static::type() . '_templates', array( __CLASS__, 'filter_templates' ), 10, 2 );
18
  add_filter( 'map_meta_cap', array( __CLASS__, 'map_meta_cap' ), 10, 4 );
19
  add_action( 'admin_menu', array( __CLASS__, 'remove_taxonomies' ) );
20
+ add_filter( 'pre_get_posts', array( __CLASS__, 'extend_query_for_category' ) );
21
  }
22
 
23
  public static function edit_cap() {
109
 
110
  protected static function _remove_role_caps( $role_name ) {
111
  $role = get_role( $role_name );
112
+ if ( $role != null ) {
113
+ foreach ( static::caps() as $k => $v ) {
114
+ $role->remove_cap( $k );
115
+ }
116
  }
117
  }
118
 
182
  'edit-tags.php?taxonomy=' . $t . '&post_type=' . static::type() );
183
  }
184
  }
185
+
186
+ public static function extend_query_for_category( \WP_Query $query ) {
187
+ if ( is_category() && $query->is_archive() ) {
188
+ $query->set( 'post_type', array(
189
+ 'post',
190
+ static::type()
191
+ ) );
192
+ }
193
+
194
+ return $query;
195
+ }
196
  }