Auto Terms of Service and Privacy Policy - Version 2.4.2

Version Description

Download this release

Release Info

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

Code changes from version 2.4.1 to 2.4.2

README.txt CHANGED
@@ -2,9 +2,9 @@
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.1
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,11 @@ Installing the plugin is easy. Just follow these steps:
119
 
120
  == Changelog ==
121
 
 
 
 
 
 
122
  = Version 2.4.1 =
123
  * Jun 3, 2020
124
  * Fix: Fix for Add a New Legal Page missing wizards
@@ -335,16 +340,20 @@ Installing the plugin is easy. Just follow these steps:
335
  * Added link back to the table of contents (to the top) for the [my_terms_of_service_and_privacy_policy] shortcode.
336
  * Privacy Policy edited in line with Automattic's --> September 18, 2013: Added that blog commenter email addresses are disclosed to administrators of the blog where the comment was left.
337
 
338
- = Version: 1.3.2012.12.29 =
 
339
  * Fixed 2 more hard-coded references to "WordPress" within that same paragraph. That should be all of them now.
340
 
341
- = Version: 1.2.2012.12.29 =
 
342
  * Fixed a <a href="http://wordpress.org/support/topic/update-required?replies=1#post-3439913" target="_blank">hard-coded reference to "WordPress"</a>, reported by kc22033. Thanks!
343
  * Checked WordPress' Terms of Service and Privacy Policy for updates, and there weren't any changes since this plugin's creation.
344
 
345
- = Version: 1.1.2012.12.28 =
 
346
  * Changed shortcodes to return instead of echo, to fix the shortcode display issue. Thanks to <a href="http://profiles.wordpress.org/birgire" target="_blank">birgire</a>.
347
  * Fixed link anchor text to use the name specified in the settings, to fix the issue of displaying hard coded "Terms of Use" and "Privacy Policy" anchor text in the table of contents for the [my_terms_of_service_and_privacy_policy] shortcode.
348
 
349
- = Version: 1.0.2012.09.12 =
 
350
  * Initial release.
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.5.1
6
  Requires PHP: 5.3
7
+ Stable tag: 2.4.2
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.4.2 =
123
+ * Oct 1, 2020
124
+ * Fix: Prevent jQuery issues from showing Add a New Legal Page wizards
125
+ * Fix: Remove alert('error') from showing when a caching plugin & Compliance Kit are enabled
126
+
127
  = Version 2.4.1 =
128
  * Jun 3, 2020
129
  * Fix: Fix for Add a New Legal Page missing wizards
340
  * Added link back to the table of contents (to the top) for the [my_terms_of_service_and_privacy_policy] shortcode.
341
  * Privacy Policy edited in line with Automattic's --> September 18, 2013: Added that blog commenter email addresses are disclosed to administrators of the blog where the comment was left.
342
 
343
+ = Version: 1.3.20 =
344
+ * 12.12.29
345
  * Fixed 2 more hard-coded references to "WordPress" within that same paragraph. That should be all of them now.
346
 
347
+ = Version: 1.2.20 =
348
+ * 12.12.29
349
  * Fixed a <a href="http://wordpress.org/support/topic/update-required?replies=1#post-3439913" target="_blank">hard-coded reference to "WordPress"</a>, reported by kc22033. Thanks!
350
  * Checked WordPress' Terms of Service and Privacy Policy for updates, and there weren't any changes since this plugin's creation.
351
 
352
+ = Version: 1.1.20 =
353
+ * 12.12.28
354
  * Changed shortcodes to return instead of echo, to fix the shortcode display issue. Thanks to <a href="http://profiles.wordpress.org/birgire" target="_blank">birgire</a>.
355
  * Fixed link anchor text to use the name specified in the settings, to fix the issue of displaying hard coded "Terms of Use" and "Privacy Policy" anchor text in the table of contents for the [my_terms_of_service_and_privacy_policy] shortcode.
356
 
357
+ = Version: 1.0.20 =
358
+ * 12.09.12
359
  * Initial release.
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.4.1
9
  License: GPLv2 or later
10
  Text Domain: wpautoterms
11
  Domain Path: /languages
@@ -57,6 +57,8 @@ define( 'WPAUTOTERMS_OPTION_PREFIX', WPAUTOTERMS_SLUG . '_' );
57
  define( 'WPAUTOTERMS_LEGAL_PAGES_DIR', 'legal-pages' . DIRECTORY_SEPARATOR );
58
  define( 'WPAUTOTERMS_OPTION_ACTIVATED', 'activated' );
59
  define( 'WPAUTOTERMS_LICENSE_RECHECK_TIME', 24 * 60 * 60 );
 
 
60
 
61
  function get_version( $file_name ) {
62
 
@@ -115,12 +117,12 @@ function print_template( $__template, $args = array(), $__to_buffer = false ) {
115
  return true;
116
  }
117
 
118
- $query = new Query( WPAUTOTERMS_API_URL, WP_DEBUG );
119
- $license = new License( $query );
120
 
121
- Wpautoterms::init( $license, $query );
122
  if ( is_admin() ) {
123
- Admin::init( $license, $query );
124
  } else {
125
- Frontend::init( $license );
126
  }
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.2
9
  License: GPLv2 or later
10
  Text Domain: wpautoterms
11
  Domain Path: /languages
57
  define( 'WPAUTOTERMS_LEGAL_PAGES_DIR', 'legal-pages' . DIRECTORY_SEPARATOR );
58
  define( 'WPAUTOTERMS_OPTION_ACTIVATED', 'activated' );
59
  define( 'WPAUTOTERMS_LICENSE_RECHECK_TIME', 24 * 60 * 60 );
60
+ define( 'WPAUTOTERMS_JS_BASE', WPAUTOTERMS_SLUG . '_base' );
61
+ define( 'WPAUTOTERMS_JS_DEPS', array( WPAUTOTERMS_JS_BASE ) );
62
 
63
  function get_version( $file_name ) {
64
 
117
  return true;
118
  }
119
 
120
+ $_query = new Query( WPAUTOTERMS_API_URL, WP_DEBUG );
121
+ $_license = new License( $_query );
122
 
123
+ Wpautoterms::init( $_license, $_query );
124
  if ( is_admin() ) {
125
+ Admin::init( $_license, $_query );
126
  } else {
127
+ Frontend::init( $_license );
128
  }
css/admin.css CHANGED
@@ -55,6 +55,7 @@ ul.legal-pages-form-radio {
55
  -webkit-border-radius: 6px;
56
  -moz-border-radius: 6px;
57
  border-radius: 6px;
 
58
  }
59
 
60
  .wpautoterms-options-box.wpautoterms-paid {
55
  -webkit-border-radius: 6px;
56
  -moz-border-radius: 6px;
57
  border-radius: 6px;
58
+ position: relative;
59
  }
60
 
61
  .wpautoterms-options-box.wpautoterms-paid {
includes/admin/admin.php CHANGED
@@ -194,10 +194,12 @@ abstract class Admin {
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 );
 
201
  $hidden = array();
202
  $dependencies = array();
203
  /**
@@ -221,7 +223,8 @@ abstract class Admin {
221
  }
222
  wp_register_style( WPAUTOTERMS_SLUG . '_admin_css', WPAUTOTERMS_PLUGIN_URL . 'css/admin.css', WPAUTOTERMS_VERSION );
223
  wp_enqueue_style( WPAUTOTERMS_SLUG . '_admin_css', array(), WPAUTOTERMS_VERSION );
224
- wp_enqueue_script( WPAUTOTERMS_SLUG . '_common', WPAUTOTERMS_PLUGIN_URL . 'js/common.js', false, WPAUTOTERMS_VERSION, true );
 
225
  $nonce = array();
226
  /**
227
  * @var Action_Base $action
@@ -235,7 +238,8 @@ abstract class Admin {
235
  $prefix = WPAUTOTERMS_SLUG . '_';
236
  if ( strncmp( $page, $prefix, strlen( $prefix ) ) === 0 ) {
237
  Countries::enqueue_scripts();
238
- wp_enqueue_script( WPAUTOTERMS_SLUG . '_admin', WPAUTOTERMS_PLUGIN_URL . 'js/kits.js', false, WPAUTOTERMS_VERSION, true );
 
239
  }
240
  }
241
  }
194
  }
195
  }
196
  if ( $page == 'edit.php' ) {
197
+ wp_enqueue_script( WPAUTOTERMS_SLUG . '_row_actions', WPAUTOTERMS_PLUGIN_URL . 'js/row-actions.js',
198
+ WPAUTOTERMS_JS_DEPS, WPAUTOTERMS_VERSION, true );
199
  }
200
  if ( $page == 'post-new.php' && $post->post_status == 'auto-draft' ) {
201
+ wp_enqueue_script( WPAUTOTERMS_SLUG . '_post_new', WPAUTOTERMS_PLUGIN_URL . 'js/post-new.js',
202
+ WPAUTOTERMS_JS_DEPS, WPAUTOTERMS_VERSION, true );
203
  $hidden = array();
204
  $dependencies = array();
205
  /**
223
  }
224
  wp_register_style( WPAUTOTERMS_SLUG . '_admin_css', WPAUTOTERMS_PLUGIN_URL . 'css/admin.css', WPAUTOTERMS_VERSION );
225
  wp_enqueue_style( WPAUTOTERMS_SLUG . '_admin_css', array(), WPAUTOTERMS_VERSION );
226
+ wp_enqueue_script( WPAUTOTERMS_SLUG . '_common', WPAUTOTERMS_PLUGIN_URL . 'js/common.js', WPAUTOTERMS_JS_DEPS,
227
+ WPAUTOTERMS_VERSION, true );
228
  $nonce = array();
229
  /**
230
  * @var Action_Base $action
238
  $prefix = WPAUTOTERMS_SLUG . '_';
239
  if ( strncmp( $page, $prefix, strlen( $prefix ) ) === 0 ) {
240
  Countries::enqueue_scripts();
241
+ wp_enqueue_script( WPAUTOTERMS_SLUG . '_admin', WPAUTOTERMS_PLUGIN_URL . 'js/kits.js', WPAUTOTERMS_JS_DEPS,
242
+ WPAUTOTERMS_VERSION, true );
243
  }
244
  }
245
  }
includes/admin/page/compliancekits.php CHANGED
@@ -65,7 +65,8 @@ class Compliancekits extends Settings_Base {
65
 
66
  function enqueue_scripts() {
67
  if ( ! $this->_box ) {
68
- wp_enqueue_script( WPAUTOTERMS_SLUG . '_compliancekits_page', WPAUTOTERMS_PLUGIN_URL . 'js/compliancekits-page.js', false, WPAUTOTERMS_VERSION, true );
 
69
  wp_localize_script( WPAUTOTERMS_SLUG . '_compliancekits_page', 'wpautotermsComplianceKits', array(
70
  'boxData' => array_reduce( $this->_boxes, function ( $acc, Box $x ) {
71
  $acc[ $x->enable_action_id() ] = array(
@@ -82,7 +83,8 @@ class Compliancekits extends Settings_Base {
82
  ) );
83
  } else {
84
  wp_enqueue_style( 'wp-color-picker' );
85
- wp_enqueue_script( WPAUTOTERMS_SLUG . '_box_page', WPAUTOTERMS_PLUGIN_URL . 'js/box-page.js', array( 'wp-color-picker' ), WPAUTOTERMS_VERSION, true );
 
86
  $this->_box->enqueue_scripts();
87
  }
88
  }
65
 
66
  function enqueue_scripts() {
67
  if ( ! $this->_box ) {
68
+ wp_enqueue_script( WPAUTOTERMS_SLUG . '_compliancekits_page', WPAUTOTERMS_PLUGIN_URL . 'js/compliancekits-page.js',
69
+ WPAUTOTERMS_JS_DEPS, WPAUTOTERMS_VERSION, true );
70
  wp_localize_script( WPAUTOTERMS_SLUG . '_compliancekits_page', 'wpautotermsComplianceKits', array(
71
  'boxData' => array_reduce( $this->_boxes, function ( $acc, Box $x ) {
72
  $acc[ $x->enable_action_id() ] = array(
83
  ) );
84
  } else {
85
  wp_enqueue_style( 'wp-color-picker' );
86
+ wp_enqueue_script( WPAUTOTERMS_SLUG . '_box_page', WPAUTOTERMS_PLUGIN_URL . 'js/box-page.js',
87
+ array( 'wp-color-picker', WPAUTOTERMS_JS_BASE ), WPAUTOTERMS_VERSION, true );
88
  $this->_box->enqueue_scripts();
89
  }
90
  }
includes/admin/page/help.php CHANGED
@@ -23,7 +23,8 @@ class Help extends Base {
23
  wp_enqueue_style( 'jquery-ui-structure', WPAUTOTERMS_PLUGIN_URL . 'css/jquery-ui.structure.css', array(), WPAUTOTERMS_VERSION );
24
  wp_enqueue_style( 'jquery-ui-theme', WPAUTOTERMS_PLUGIN_URL . 'css/jquery-ui-themes/base/theme.css', array(), WPAUTOTERMS_VERSION );
25
  wp_enqueue_style( 'jquery-ui-accordion', WPAUTOTERMS_PLUGIN_URL . 'css/jquery-ui-accordion.css', array( 'wp-jquery-ui-dialog' ), WPAUTOTERMS_VERSION );
26
- wp_enqueue_script( WPAUTOTERMS_SLUG . '_contact_form', WPAUTOTERMS_PLUGIN_URL . 'js/contact-form.js', array( 'underscore', 'wp-util' ), WPAUTOTERMS_VERSION, true );
 
27
  wp_localize_script( WPAUTOTERMS_SLUG . '_contact_form', 'wpautotermsContact', array(
28
  'nonce' => $this->action->nonce(),
29
  'id' => $this->action->name(),
23
  wp_enqueue_style( 'jquery-ui-structure', WPAUTOTERMS_PLUGIN_URL . 'css/jquery-ui.structure.css', array(), WPAUTOTERMS_VERSION );
24
  wp_enqueue_style( 'jquery-ui-theme', WPAUTOTERMS_PLUGIN_URL . 'css/jquery-ui-themes/base/theme.css', array(), WPAUTOTERMS_VERSION );
25
  wp_enqueue_style( 'jquery-ui-accordion', WPAUTOTERMS_PLUGIN_URL . 'css/jquery-ui-accordion.css', array( 'wp-jquery-ui-dialog' ), WPAUTOTERMS_VERSION );
26
+ wp_enqueue_script( WPAUTOTERMS_SLUG . '_contact_form', WPAUTOTERMS_PLUGIN_URL . 'js/contact-form.js',
27
+ array( 'underscore', 'wp-util', WPAUTOTERMS_JS_BASE ), WPAUTOTERMS_VERSION, true );
28
  wp_localize_script( WPAUTOTERMS_SLUG . '_contact_form', 'wpautotermsContact', array(
29
  'nonce' => $this->action->nonce(),
30
  'id' => $this->action->name(),
includes/admin/page/legacy-settings.php CHANGED
@@ -131,7 +131,8 @@ class Legacy_Settings extends Settings_Base {
131
  }
132
 
133
  public function enqueue_scripts() {
134
- wp_enqueue_script( WPAUTOTERMS_SLUG . '_legacy_on_off', WPAUTOTERMS_PLUGIN_URL . 'js/legacy-on-off.js', false, WPAUTOTERMS_VERSION, true );
 
135
  wp_localize_script( WPAUTOTERMS_SLUG . '_legacy_on_off', 'wpautotermsLegacy', array(
136
  'required' => __( 'required', WPAUTOTERMS_SLUG ),
137
  'onOffNotice' => __( 'please, fill all required fields to enable', WPAUTOTERMS_SLUG ),
131
  }
132
 
133
  public function enqueue_scripts() {
134
+ wp_enqueue_script( WPAUTOTERMS_SLUG . '_legacy_on_off', WPAUTOTERMS_PLUGIN_URL . 'js/legacy-on-off.js',
135
+ WPAUTOTERMS_JS_DEPS, WPAUTOTERMS_VERSION, true );
136
  wp_localize_script( WPAUTOTERMS_SLUG . '_legacy_on_off', 'wpautotermsLegacy', array(
137
  'required' => __( 'required', WPAUTOTERMS_SLUG ),
138
  'onOffNotice' => __( 'please, fill all required fields to enable', WPAUTOTERMS_SLUG ),
includes/admin/page/license-settings.php CHANGED
@@ -42,14 +42,16 @@ class License_Settings extends Settings_Base {
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,
42
  }
43
 
44
  public function enqueue_scripts() {
45
+ wp_enqueue_script( WPAUTOTERMS_SLUG . '_license_settings', WPAUTOTERMS_PLUGIN_URL . 'js/license-settings.js',
46
+ WPAUTOTERMS_JS_DEPS, WPAUTOTERMS_VERSION, true );
47
  wp_localize_script( WPAUTOTERMS_SLUG . '_license_settings', 'wpautotermsLicenseSettings', array(
48
  'nonce' => wp_create_nonce( Recheck_License::NAME ),
49
  'action' => Recheck_License::NAME,
50
  'keyId' => WPAUTOTERMS_OPTION_PREFIX . License::OPTION_KEY,
51
  'status' => $this->_license->info()->status,
52
  ) );
53
+ wp_enqueue_script( WPAUTOTERMS_SLUG . '_license_transfer', WPAUTOTERMS_PLUGIN_URL . 'js/license-transfer.js',
54
+ WPAUTOTERMS_JS_DEPS, WPAUTOTERMS_VERSION, true );
55
  wp_localize_script( WPAUTOTERMS_SLUG . '_license_transfer', 'wpautotermsLicenseTransfer', array(
56
  'nonce' => wp_create_nonce( Transfer_License::NAME ),
57
  'action' => Transfer_License::NAME,
includes/box/box.php CHANGED
@@ -125,7 +125,8 @@ abstract class Box {
125
  wp_enqueue_style( WPAUTOTERMS_SLUG . '_codemirror_hint', WPAUTOTERMS_PLUGIN_URL . 'js/codemirror-5.42.0/addon/hint/show-hint.css' );
126
  wp_enqueue_style( WPAUTOTERMS_SLUG . '_codemirror_matchesonscrollbar', WPAUTOTERMS_PLUGIN_URL . 'js/codemirror-5.42.0/addon/search/matchesonscrollbar.css' );
127
 
128
- wp_enqueue_script( WPAUTOTERMS_SLUG . '_css_hint', WPAUTOTERMS_PLUGIN_URL . 'js/css-hints.js', false, WPAUTOTERMS_VERSION, true );
 
129
  }
130
 
131
  public function _render_revert_message($option) {
125
  wp_enqueue_style( WPAUTOTERMS_SLUG . '_codemirror_hint', WPAUTOTERMS_PLUGIN_URL . 'js/codemirror-5.42.0/addon/hint/show-hint.css' );
126
  wp_enqueue_style( WPAUTOTERMS_SLUG . '_codemirror_matchesonscrollbar', WPAUTOTERMS_PLUGIN_URL . 'js/codemirror-5.42.0/addon/search/matchesonscrollbar.css' );
127
 
128
+ wp_enqueue_script( WPAUTOTERMS_SLUG . '_css_hint', WPAUTOTERMS_PLUGIN_URL . 'js/css-hints.js', WPAUTOTERMS_JS_DEPS,
129
+ WPAUTOTERMS_VERSION, true );
130
  }
131
 
132
  public function _render_revert_message($option) {
includes/box/links-box.php CHANGED
@@ -76,7 +76,8 @@ class Links_Box extends Box {
76
  public function enqueue_scripts() {
77
  parent::enqueue_scripts();
78
  wp_enqueue_script( 'jquery-ui-sortable' );
79
- wp_enqueue_script( WPAUTOTERMS_SLUG . '_links_box_page', WPAUTOTERMS_PLUGIN_URL . 'js/links-box-page.js', false, WPAUTOTERMS_VERSION, true );
 
80
  }
81
 
82
  protected function _page_args( \wpautoterms\admin\page\Base $page ) {
76
  public function enqueue_scripts() {
77
  parent::enqueue_scripts();
78
  wp_enqueue_script( 'jquery-ui-sortable' );
79
+ wp_enqueue_script( WPAUTOTERMS_SLUG . '_links_box_page', WPAUTOTERMS_PLUGIN_URL . 'js/links-box-page.js',
80
+ WPAUTOTERMS_JS_DEPS, WPAUTOTERMS_VERSION, true );
81
  }
82
 
83
  protected function _page_args( \wpautoterms\admin\page\Base $page ) {
includes/countries.php CHANGED
@@ -89,17 +89,19 @@ abstract class Countries {
89
  }
90
 
91
  public static function enqueue_scripts() {
92
- wp_enqueue_script( WPAUTOTERMS_SLUG . '_countries', WPAUTOTERMS_PLUGIN_URL . 'js/countries.js', array( 'underscore', 'wp-util' ), WPAUTOTERMS_VERSION, true );
 
93
  $ret = static::select_locale( static::LOCALE_PATH );
94
  if ( $ret !== false ) {
95
  $lang = $ret[1];
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, WPAUTOTERMS_VERSION, true );
99
  } else {
100
  $lang = static::DEFAULT_LOCALE;
101
  }
102
- wp_enqueue_script( WPAUTOTERMS_SLUG . '_states_js', WPAUTOTERMS_PLUGIN_URL . 'js/data/states.js', false, WPAUTOTERMS_VERSION, true );
 
103
 
104
  wp_localize_script( WPAUTOTERMS_SLUG . '_countries', 'wpautotermsCountry', array(
105
  'country' => Options::get_option( Options::COUNTRY ),
89
  }
90
 
91
  public static function enqueue_scripts() {
92
+ wp_enqueue_script( WPAUTOTERMS_SLUG . '_countries', WPAUTOTERMS_PLUGIN_URL . 'js/countries.js',
93
+ array( 'underscore', 'wp-util', WPAUTOTERMS_JS_BASE ), WPAUTOTERMS_VERSION, 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, WPAUTOTERMS_JS_DEPS, WPAUTOTERMS_VERSION, 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
+ WPAUTOTERMS_JS_DEPS, WPAUTOTERMS_VERSION, true );
105
 
106
  wp_localize_script( WPAUTOTERMS_SLUG . '_countries', 'wpautotermsCountry', array(
107
  'country' => Options::get_option( Options::COUNTRY ),
includes/frontend/notice/base-notice.php CHANGED
@@ -56,10 +56,8 @@ abstract class Base_Notice {
56
  if ( static::is_amp() ) {
57
  return;
58
  }
59
- wp_enqueue_script( WPAUTOTERMS_SLUG . '_js', WPAUTOTERMS_PLUGIN_URL . 'js/wpautoterms.js', array(
60
- 'jquery',
61
- 'wp-util'
62
- ), WPAUTOTERMS_VERSION, true );
63
  wp_localize_script( WPAUTOTERMS_SLUG . '_js', 'wpautoterms_js_' . $this->id(), $this->_localize_args() );
64
  }
65
 
56
  if ( static::is_amp() ) {
57
  return;
58
  }
59
+ wp_enqueue_script( WPAUTOTERMS_SLUG . '_js', WPAUTOTERMS_PLUGIN_URL . 'js/wpautoterms.js',
60
+ array( 'jquery', 'wp-util', WPAUTOTERMS_JS_BASE ), WPAUTOTERMS_VERSION, true );
 
 
61
  wp_localize_script( WPAUTOTERMS_SLUG . '_js', 'wpautoterms_js_' . $this->id(), $this->_localize_args() );
62
  }
63
 
includes/wpautoterms.php CHANGED
@@ -31,6 +31,8 @@ abstract class Wpautoterms {
31
  static::$_legal_pages[ $page->id ] = $p;
32
  }
33
  add_action( 'init', array( __CLASS__, 'action_init' ) );
 
 
34
  add_action( 'plugins_loaded', array( __CLASS__, 'init_translations' ), 5 );
35
  CPT::init();
36
  Shortcodes::init();
@@ -39,6 +41,13 @@ abstract class Wpautoterms {
39
  Notices::$instance = new Notices( WPAUTOTERMS_OPTION_PREFIX . 'notices' );
40
  }
41
 
 
 
 
 
 
 
 
42
  /**
43
  * @return Legal_Page[]
44
  */
31
  static::$_legal_pages[ $page->id ] = $p;
32
  }
33
  add_action( 'init', array( __CLASS__, 'action_init' ) );
34
+ add_action( 'wp_enqueue_scripts', array( __CLASS__, '_enqueue_scripts' ), 1 );
35
+ add_action( 'admin_enqueue_scripts', array( __CLASS__, '_enqueue_scripts' ), 1 );
36
  add_action( 'plugins_loaded', array( __CLASS__, 'init_translations' ), 5 );
37
  CPT::init();
38
  Shortcodes::init();
41
  Notices::$instance = new Notices( WPAUTOTERMS_OPTION_PREFIX . 'notices' );
42
  }
43
 
44
+ public static function _enqueue_scripts() {
45
+ wp_enqueue_script( WPAUTOTERMS_JS_BASE, WPAUTOTERMS_PLUGIN_URL . 'js/base.js', array(
46
+ 'jquery',
47
+ 'wp-dom-ready'
48
+ ), WPAUTOTERMS_VERSION, false );
49
+ }
50
+
51
  /**
52
  * @return Legal_Page[]
53
  */
js/base.js ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function () {
2
+ var handlers = [];
3
+ var ran = false;
4
+
5
+ function runHandlers() {
6
+ if (ran) {
7
+ return;
8
+ }
9
+ ran = true;
10
+ for (var k in handlers) {
11
+ handlers[k](jQuery);
12
+ }
13
+ }
14
+
15
+ wp.domReady(runHandlers);
16
+
17
+ function wpAutoTermsDomReady(fn) {
18
+ handlers.push(fn);
19
+ }
20
+
21
+ window.wpAutoTermsDomReady = wpAutoTermsDomReady;
22
+ window.onerror = runHandlers;
23
+ jQuery.readyException = runHandlers;
24
+ })();
js/box-page.js CHANGED
@@ -1,4 +1,4 @@
1
- jQuery(document).ready(function ($) {
2
  $(".wpautoterms-color-selector").wpColorPicker();
3
  $(".wpautoterms-options-select-combo select").each(function () {
4
  var t = jQuery(this);
1
+ wpAutoTermsDomReady(function ($) {
2
  $(".wpautoterms-color-selector").wpColorPicker();
3
  $(".wpautoterms-options-select-combo select").each(function () {
4
  var t = jQuery(this);
js/common.js CHANGED
@@ -1,4 +1,4 @@
1
- jQuery(document).ready(function ($) {
2
  // Copy of wp-admin/js/common.js makeNoticesDismissible()
3
  $("[data-wpautoterms-dismissible]").each(function () {
4
  var $el = $(this);
1
+ wpAutoTermsDomReady(function ($) {
2
  // Copy of wp-admin/js/common.js makeNoticesDismissible()
3
  $("[data-wpautoterms-dismissible]").each(function () {
4
  var $el = $(this);
js/compliancekits-page.js CHANGED
@@ -1,4 +1,4 @@
1
- jQuery(document).ready(function () {
2
  jQuery(".wpautoterms-box-enable-button a.button[data-type='enable']").click(function () {
3
  var b = jQuery(this);
4
  b.attr("disabled", "disabled");
1
+ wpAutoTermsDomReady(function () {
2
  jQuery(".wpautoterms-box-enable-button a.button[data-type='enable']").click(function () {
3
  var b = jQuery(this);
4
  b.attr("disabled", "disabled");
js/contact-form.js CHANGED
@@ -1,4 +1,4 @@
1
- jQuery(document).ready(function () {
2
  var SITE_INFO_NONE = 0;
3
  var PREVIEW_SIZE = 80;
4
  var valid = false;
@@ -55,7 +55,7 @@ jQuery(document).ready(function () {
55
  });
56
  jQuery.post(ajaxurl, data).done(function (response) {
57
  if (typeof response !== "object") {
58
- alert(response);
59
  } else {
60
  if (response.valid) {
61
  valid = true;
@@ -65,8 +65,7 @@ jQuery(document).ready(function () {
65
  }
66
  }
67
  }).fail(function (error) {
68
- console.log(error);
69
- alert(error.statusText);
70
  }).always(function () {
71
  SUBMIT.prop('disabled', false);
72
  SENDING.hide();
1
+ wpAutoTermsDomReady(function () {
2
  var SITE_INFO_NONE = 0;
3
  var PREVIEW_SIZE = 80;
4
  var valid = false;
55
  });
56
  jQuery.post(ajaxurl, data).done(function (response) {
57
  if (typeof response !== "object") {
58
+ console.error("[WPAutoTerms][ContactForm] Response is not an object", response);
59
  } else {
60
  if (response.valid) {
61
  valid = true;
65
  }
66
  }
67
  }).fail(function (error) {
68
+ console.error("[WPAutoTerms][ContactForm] Query error", error);
 
69
  }).always(function () {
70
  SUBMIT.prop('disabled', false);
71
  SENDING.hide();
js/countries.js CHANGED
@@ -1,4 +1,4 @@
1
- jQuery(document).ready(function () {
2
  wpautotermsCountry.initCountrySelector = function () {
3
  var COUNTRIES = jQuery("[data-type='country-selector']");
4
  var LOCALES = [wpautotermsCountry.locale.split("_")[0]];
1
+ wpAutoTermsDomReady(function () {
2
  wpautotermsCountry.initCountrySelector = function () {
3
  var COUNTRIES = jQuery("[data-type='country-selector']");
4
  var LOCALES = [wpautotermsCountry.locale.split("_")[0]];
js/css-hints.js CHANGED
@@ -1,4 +1,4 @@
1
- jQuery(document).ready(function () {
2
  var targets = {};
3
 
4
  function onClick(e) {
1
+ wpAutoTermsDomReady(function () {
2
  var targets = {};
3
 
4
  function onClick(e) {
js/get-license.js CHANGED
@@ -1,4 +1,4 @@
1
- jQuery(document).ready(function () {
2
  var form = document.createElement("form");
3
  form.action = wpautotermsGetLicense.url;
4
  form.method = "POST";
1
+ wpAutoTermsDomReady(function () {
2
  var form = document.createElement("form");
3
  form.action = wpautotermsGetLicense.url;
4
  form.method = "POST";
js/legacy-on-off.js CHANGED
@@ -1,4 +1,4 @@
1
- jQuery(document).ready(function () {
2
  var ON_OFF_SELECT = jQuery("select[name='" + wpautotermsLegacy.onOffName + "']");
3
  var ON_OFF_NOTICE = jQuery("[data-type='notice'][data-name='" + wpautotermsLegacy.onOffName + "']");
4
  var onOffValue;
1
+ wpAutoTermsDomReady(function () {
2
  var ON_OFF_SELECT = jQuery("select[name='" + wpautotermsLegacy.onOffName + "']");
3
  var ON_OFF_NOTICE = jQuery("[data-type='notice'][data-name='" + wpautotermsLegacy.onOffName + "']");
4
  var onOffValue;
js/license-settings.js CHANGED
@@ -1,4 +1,4 @@
1
- jQuery(document).ready(function () {
2
  var RECHECK_BUTTON = jQuery("#wpautoterms_recheck");
3
  var TRANSFER_ERROR = jQuery("[data-control=wpautoterms_transfer_error]");
4
 
1
+ wpAutoTermsDomReady(function () {
2
  var RECHECK_BUTTON = jQuery("#wpautoterms_recheck");
3
  var TRANSFER_ERROR = jQuery("[data-control=wpautoterms_transfer_error]");
4
 
js/license-transfer.js CHANGED
@@ -1,4 +1,4 @@
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]";
1
+ wpAutoTermsDomReady(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]";
js/links-box-page.js CHANGED
@@ -1,4 +1,4 @@
1
- jQuery(document).ready(function ($) {
2
  var LINKS = $("#links_order");
3
  var OPTION = $("[name$=links_order]");
4
 
1
+ wpAutoTermsDomReady(function ($) {
2
  var LINKS = $("#links_order");
3
  var OPTION = $("[name$=links_order]");
4
 
js/post-new.js CHANGED
@@ -1,4 +1,4 @@
1
- jQuery(document).ready(function ($) {
2
  var CREATE_SELECTOR = $("#legal-page-create-selector").show();
3
 
4
  $('#post').attr('novalidate', true);
1
+ wpAutoTermsDomReady(function ($) {
2
  var CREATE_SELECTOR = $("#legal-page-create-selector").show();
3
 
4
  $('#post').attr('novalidate', true);
js/row-actions.js CHANGED
@@ -1,4 +1,4 @@
1
- jQuery( document ).ready( function( $ ){
2
  $( '.inline-row-action-summary' ).each( function(){
3
  var pSpan = $(this).parent();
4
  var pTarget = pSpan.parent();
1
+ wpAutoTermsDomReady( function( $ ){
2
  $( '.inline-row-action-summary' ).each( function(){
3
  var pSpan = $(this).parent();
4
  var pTarget = pSpan.parent();
js/wpautoterms.js CHANGED
@@ -1,4 +1,4 @@
1
- jQuery(document).ready(function ($) {
2
  var COOKIE_EXPIRE_DAYS = 100 * 365;
3
 
4
  function maxZIndex() {
@@ -92,14 +92,13 @@ jQuery(document).ready(function ($) {
92
  action: wpautoterms_js_update_notice.action
93
  }).done(function (response) {
94
  if (typeof response !== "object") {
95
- alert(response);
96
  } else {
97
  populateUpdateBox(response.data);
98
  bindClose();
99
  }
100
  }).fail(function (error) {
101
- console.log(error);
102
- alert(error.statusText);
103
  });
104
  } else {
105
  var data = wpautoterms_js_update_notice.data;
1
+ wpAutoTermsDomReady(function ($) {
2
  var COOKIE_EXPIRE_DAYS = 100 * 365;
3
 
4
  function maxZIndex() {
92
  action: wpautoterms_js_update_notice.action
93
  }).done(function (response) {
94
  if (typeof response !== "object") {
95
+ console.error("[WPAutoTerms][UpdateNotice] Response is not an object", response);
96
  } else {
97
  populateUpdateBox(response.data);
98
  bindClose();
99
  }
100
  }).fail(function (error) {
101
+ console.error("[WPAutoTerms][UpdateNotice] Query error", error);
 
102
  });
103
  } else {
104
  var data = wpautoterms_js_update_notice.data;
templates/review-banner.php CHANGED
@@ -7,7 +7,7 @@ esc_attr_e( 'Don\'t show this again', WPAUTOTERMS_SLUG ); ?>"
7
  <?php esc_html_e( 'We\'d appreciate your honest feedback of our plugin on WP Official Plugins Directory.', WPAUTOTERMS_SLUG ); ?>
8
  </p>
9
  <p>
10
- <a target="_blank" class="button-primary"
11
  href="https://wordpress.org/support/plugin/auto-terms-of-service-and-privacy-policy/reviews/#new-post">
12
  <?php esc_html_e( 'OK, I\'ll leave a review', WPAUTOTERMS_SLUG ); ?>
13
  </a>
7
  <?php esc_html_e( 'We\'d appreciate your honest feedback of our plugin on WP Official Plugins Directory.', WPAUTOTERMS_SLUG ); ?>
8
  </p>
9
  <p>
10
+ <a target="_blank" class="button-primary" rel="noopener noreferrer"
11
  href="https://wordpress.org/support/plugin/auto-terms-of-service-and-privacy-policy/reviews/#new-post">
12
  <?php esc_html_e( 'OK, I\'ll leave a review', WPAUTOTERMS_SLUG ); ?>
13
  </a>