Skip to content

Commit dc7da91

Browse files
authored
Merge pull request #17 from mypreview/rate-5stars-notice
Encourage leaving a 5-star review from regular users
2 parents 02d8548 + a49d92c commit dc7da91

File tree

9 files changed

+190
-122
lines changed

9 files changed

+190
-122
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Woo Additional Terms
2-
[![Woo Additional Terms Downloads](https://img.shields.io/wordpress/plugin/dt/woo-additional-terms.svg)](https://wordpress.org/plugins/woo-additional-terms) [![Woo Additional Terms Active Installs](https://img.shields.io/wordpress/plugin/installs/woo-additional-terms.svg)](https://wordpress.org/plugins/woo-additional-terms) [![Woo Additional Terms Ratings](https://img.shields.io/wordpress/plugin/r/woo-additional-terms.svg)](https://wordpress.org/plugins/woo-additional-terms) [![Woo Additional Terms Tested](https://img.shields.io/wordpress/plugin/tested/woo-additional-terms.svg)](https://wordpress.org/plugins/woo-additional-terms) [![Woo Additional Terms Version](https://img.shields.io/wordpress/plugin/v/woo-additional-terms.svg)](https://wordpress.org/plugins/woo-additional-terms) [![Woo Additional Terms License](https://img.shields.io/github/license/mypreview/woo-additional-terms)](https://wordpress.org/plugins/woo-additional-terms) [![Donate to support this plugin](https://img.shields.io/badge/☕-Buy%20me%20a%20coffee-%23fedd04)](https://www.buymeacoffee.com/mahdiyazdani)
2+
[![Woo Additional Terms Downloads](https://img.shields.io/wordpress/plugin/dt/woo-additional-terms.svg)](https://wordpress.org/plugins/woo-additional-terms) [![Woo Additional Terms Active Installs](https://img.shields.io/wordpress/plugin/installs/woo-additional-terms.svg)](https://wordpress.org/plugins/woo-additional-terms) [![Woo Additional Terms Ratings](https://img.shields.io/wordpress/plugin/r/woo-additional-terms.svg)](https://wordpress.org/plugins/woo-additional-terms) [![Woo Additional Terms Tested](https://img.shields.io/wordpress/plugin/tested/woo-additional-terms.svg)](https://wordpress.org/plugins/woo-additional-terms) [![Woo Additional Terms Version](https://img.shields.io/wordpress/plugin/v/woo-additional-terms.svg)](https://wordpress.org/plugins/woo-additional-terms) [![Woo Additional Terms License](https://img.shields.io/github/license/mypreview/woo-additional-terms)](https://wordpress.org/plugins/woo-additional-terms) [![Upgrade to premium version to unlock more features](https://img.shields.io/badge/💰-Upgrade%20to%20PRO-%23fedd04)](https://mypreview.one/woo-additional-terms)
33

44
[![Woo Additional Terms](https://ps.w.org/woo-additional-terms/assets/banner-1544x500.jpg?rev=1542924)](https://mypreview.one/woo-additional-terms)
55

assets/js/admin.js

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,39 @@
11
/* global jQuery, ajaxurl, watVars */
22

33
( function ( wp, $ ) {
4-
const wooTermsAdmin = {
4+
'use strict';
5+
6+
if ( ! wp ) {
7+
return;
8+
}
9+
10+
const watAdmin = {
511
cache() {
612
this.vars = {};
7-
this.vars.upsell = '.notice-info.woocommerce-message.is-dismissible .notice-dismiss';
13+
this.vars.rate = '#woo-additional-terms-dismiss-rate .notice-dismiss';
14+
this.vars.upsell = '#woo-additional-terms-dismiss-upsell .notice-dismiss';
815
},
916

1017
init() {
1118
this.cache();
12-
$( document.body ).on( 'click', this.vars.upsell, this.handleOnDismiss );
19+
$( document.body ).on( 'click', this.vars.rate, ( event ) => this.handleOnDismiss( event, 'rate' ) );
20+
$( document.body ).on( 'click', this.vars.upsell, ( event ) => this.handleOnDismiss( event, 'upsell' ) );
1321
},
1422

15-
handleOnDismiss() {
23+
handleOnDismiss( event, action ) {
24+
event.preventDefault();
25+
1626
$.ajax( {
1727
type: 'POST',
1828
url: ajaxurl,
1929
data: {
2030
_ajax_nonce: watVars.dismiss_nonce,
21-
action: 'woo_additional_terms_dismiss_upsell',
31+
action: `woo_additional_terms_dismiss_${ action }`,
2232
},
2333
dataType: 'json',
2434
} );
2535
},
2636
};
2737

28-
wooTermsAdmin.init();
38+
watAdmin.init();
2939
} )( window.wp, jQuery );

assets/js/minified/admin.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

languages/woo-additional-terms.pot

Lines changed: 52 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
# This file is distributed under the GPL-3.0.
33
msgid ""
44
msgstr ""
5-
"Project-Id-Version: Woo Additional Terms 1.4.0\n"
5+
"Project-Id-Version: Woo Additional Terms 1.4.1\n"
66
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/woo-additional-terms\n"
77
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
88
"Language-Team: LANGUAGE <[email protected]>\n"
99
"MIME-Version: 1.0\n"
1010
"Content-Type: text/plain; charset=UTF-8\n"
1111
"Content-Transfer-Encoding: 8bit\n"
12-
"POT-Creation-Date: 2022-11-24T19:48:18+00:00\n"
12+
"POT-Creation-Date: 2022-12-23T17:55:56+00:00\n"
1313
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
1414
"X-Generator: WP-CLI 2.7.1\n"
1515
"X-Domain: woo-additional-terms\n"
@@ -31,153 +31,160 @@ msgstr ""
3131
msgid "MyPreview"
3232
msgstr ""
3333

34-
#: woo-additioanl-terms.php:128
34+
#: woo-additioanl-terms.php:131
3535
msgctxt "clone"
3636
msgid "Cloning instances of this class is forbidden."
3737
msgstr ""
3838

39-
#: woo-additioanl-terms.php:138
39+
#: woo-additioanl-terms.php:141
4040
msgctxt "wakeup"
4141
msgid "Unserializing instances of this class is forbidden."
4242
msgstr ""
4343

4444
#. translators: 1: Dashicon, Open anchor tag, 2: Close anchor tag.
45-
#: woo-additioanl-terms.php:162
45+
#: woo-additioanl-terms.php:186
4646
msgctxt "admin notice"
4747
msgid "%1$s requires the following plugin: %2$sWooCommerce%3$s"
4848
msgstr ""
4949

50-
#. translators: 1: Dashicon, 2: HTML symbol, 3: Open anchor tag, 4: Close anchor tag.
51-
#: woo-additioanl-terms.php:174
50+
#. translators: 1: HTML Symbol, 2: HTML symbol, 3: Open anchor tag, 4: Close anchor tag.
51+
#: woo-additioanl-terms.php:198
5252
msgctxt "admin notice"
5353
msgid "%1$s Add unlimited “I Agree with terms & conditions” checkboxes to the WooCommerce checkout without any manual effort needed. %2$s %3$sUpgrade to PRO%4$s"
5454
msgstr ""
5555

56+
#. translators: 1: HTML symbol, 2: Plugin name, 3: Activation duration, 4: HTML symbol, 5: Open anchor tag, 6: Close anchor tag.
5657
#: woo-additioanl-terms.php:202
58+
msgctxt "admin notice"
59+
msgid "%1$s You have been using the %2$s plugin for %3$s now, do you like it as much as we like you? %4$s %5$sRate 5-Stars%6$s"
60+
msgstr ""
61+
62+
#: woo-additioanl-terms.php:242
5763
msgctxt "tab title"
5864
msgid "Additional Terms"
5965
msgstr ""
6066

61-
#: woo-additioanl-terms.php:287
67+
#. translators: 1: Open H2 tag, 2: Close H2 tag.
68+
#: woo-additioanl-terms.php:276
69+
msgctxt "upsell"
70+
msgid "%1$sLooking to add more terms & condition checkboxes?%2$s"
71+
msgstr ""
72+
73+
#. translators: 1: Open anchor tag, 2: Close anchor tag.
74+
#: woo-additioanl-terms.php:278
75+
msgctxt "upsell"
76+
msgid "%1$sBuy PRO &#8594;%2$s"
77+
msgstr ""
78+
79+
#. translators: 1: Open anchor tag, 2: Close anchor tag.
80+
#: woo-additioanl-terms.php:278
81+
msgctxt "upsell"
82+
msgid "Upgrade to premium version to unlock more features!"
83+
msgstr ""
84+
85+
#: woo-additioanl-terms.php:343
6286
msgid "required"
6387
msgstr ""
6488

65-
#: woo-additioanl-terms.php:347
89+
#: woo-additioanl-terms.php:403
6690
msgid "Accepted"
6791
msgstr ""
6892

69-
#: woo-additioanl-terms.php:347
93+
#: woo-additioanl-terms.php:403
7094
msgid "N/A"
7195
msgstr ""
7296

7397
#. translators: 1: Open anchor tag, 2: Close anchor tag.
74-
#: woo-additioanl-terms.php:374
98+
#: woo-additioanl-terms.php:430
7599
msgctxt "plugin settings page"
76100
msgid "%1$sSettings%2$s"
77101
msgstr ""
78102

79103
#. translators: 1: Open anchor tag, 2: Close anchor tag.
80-
#: woo-additioanl-terms.php:395
104+
#: woo-additioanl-terms.php:451
81105
msgctxt "plugin link"
82106
msgid "%1$sCommunity support%2$s"
83107
msgstr ""
84108

85109
#. translators: 1: Open anchor tag, 2: Close anchor tag.
86-
#: woo-additioanl-terms.php:397
110+
#: woo-additioanl-terms.php:453
87111
msgctxt "plugin link"
88112
msgid "%1$sDonate%2$s"
89113
msgstr ""
90114

91115
#. translators: 1: Open anchor tag, 2: Close anchor tag.
92-
#: woo-additioanl-terms.php:397
116+
#: woo-additioanl-terms.php:453
93117
msgid "Donate to support this plugin"
94118
msgstr ""
95119

96120
#. translators: 1: Open anchor tag, 2: Close anchor tag.
97-
#: woo-additioanl-terms.php:399
121+
#: woo-additioanl-terms.php:455
98122
msgctxt "plugin link"
99123
msgid "%1$sUpgrade to PRO%2$s"
100124
msgstr ""
101125

102126
#. translators: 1: Dashicon, 2: Plugin name, 3: Open anchor tag, 4: Close anchor tag.
103-
#: woo-additioanl-terms.php:420
127+
#: woo-additioanl-terms.php:476
104128
msgctxt "admin notice"
105129
msgid "%1$s Thanks for installing %2$s plugin! To get started, visit the %3$splugin’s settings page%4$s."
106130
msgstr ""
107131

108-
#: woo-additioanl-terms.php:444
109-
msgctxt "upsell"
110-
msgid "Looking to add more terms & condition checkboxes?"
111-
msgstr ""
112-
113-
#. translators: 1: Open anchor tag, 2: Close anchor tag.
114-
#: woo-additioanl-terms.php:447
115-
msgctxt "upsell"
116-
msgid "%1$sUpgrade to PRO &#8594;%2$s"
117-
msgstr ""
118-
119-
#. translators: 1: Open anchor tag, 2: Close anchor tag.
120-
#: woo-additioanl-terms.php:447
121-
msgctxt "upsell"
122-
msgid "Upgrade to premium version to unlock more features!"
123-
msgstr ""
124-
125-
#: woo-additioanl-terms.php:453
132+
#: woo-additioanl-terms.php:501
126133
msgctxt "settings section name"
127134
msgid "Terms and Conditions"
128135
msgstr ""
129136

130-
#: woo-additioanl-terms.php:455
137+
#: woo-additioanl-terms.php:503
131138
msgctxt "settings section description"
132139
msgid "This section controls the display of your additional terms and condition fieldset."
133140
msgstr ""
134141

135-
#: woo-additioanl-terms.php:458
142+
#: woo-additioanl-terms.php:506
136143
msgctxt "settings field name"
137144
msgid "Terms page"
138145
msgstr ""
139146

140-
#: woo-additioanl-terms.php:459
147+
#: woo-additioanl-terms.php:507
141148
msgctxt "settings field description"
142149
msgid "If you define a \"Terms\" page the customer will be asked if they accept additional terms when checking out."
143150
msgstr ""
144151

145-
#: woo-additioanl-terms.php:468
152+
#: woo-additioanl-terms.php:516
146153
msgctxt "settings field name"
147154
msgid "Notice content"
148155
msgstr ""
149156

150-
#: woo-additioanl-terms.php:469
157+
#: woo-additioanl-terms.php:517
151158
msgctxt "settings field description"
152159
msgid "Text for the additional terms checkbox that customers must accept."
153160
msgstr ""
154161

155-
#: woo-additioanl-terms.php:470
162+
#: woo-additioanl-terms.php:518
156163
msgctxt "settings field default value"
157164
msgid "I have read and agree to the website [additional-terms]"
158165
msgstr ""
159166

160-
#: woo-additioanl-terms.php:471
167+
#: woo-additioanl-terms.php:519
161168
msgctxt "settings field placeholder"
162169
msgid "I have read and agree to the website [additional-terms]"
163170
msgstr ""
164171

165-
#: woo-additioanl-terms.php:479
172+
#: woo-additioanl-terms.php:527
166173
msgctxt "settings field name"
167174
msgid "Error message"
168175
msgstr ""
169176

170-
#: woo-additioanl-terms.php:480
177+
#: woo-additioanl-terms.php:528
171178
msgctxt "settings field description"
172179
msgid "Display friendly notice whenever customer doesn&rsquo;t accept additional terms."
173180
msgstr ""
174181

175-
#: woo-additioanl-terms.php:481
182+
#: woo-additioanl-terms.php:529
176183
msgctxt "settings field default value"
177184
msgid "Please read and accept the additional terms and conditions to proceed with your order. "
178185
msgstr ""
179186

180-
#: woo-additioanl-terms.php:482
187+
#: woo-additioanl-terms.php:530
181188
msgctxt "setting field placeholder"
182189
msgid "You must accept our additional terms."
183190
msgstr ""

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@mypreview/woo-additional-terms",
3-
"version": "1.4.0",
3+
"version": "1.4.1",
44
"private": true,
55
"description": "Add additional terms and condition checkbox to the WooCommerce checkout.",
66
"homepage": "https://github.com/mypreview/woo-additional-terms#readme",
@@ -21,7 +21,7 @@
2121
"lint:js": "eslint assets/js/*.js",
2222
"lint:js:fix": "eslint assets/js/*.js --fix",
2323
"lint:wpcs": "composer lint:wpcs",
24-
"lint:wpcs-fix": "composer lint:wpcbf",
24+
"lint:wpcs:fix": "composer lint:wpcbf",
2525
"makepot": "composer make-pot",
2626
"minify": "cross-env BABEL_ENV=default NODE_ENV=production npm run minify:css && npm run minify:js",
2727
"minify:css": "rimraf assets/css/minified && cleancss --batch --batch-suffix '' assets/css/*.css --output assets/css/minified",

phpcs.xml.dist

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@
4848
<!-- Include the WordPress ruleset, with select exclusions. -->
4949
<rule ref="WordPress">
5050
<exclude name="WordPress.NamingConventions.PrefixAllGlobals.ShortPrefixPassed" />
51-
<exclude name="PSR2.Methods.MethodDeclaration.Underscore" />
52-
<exclude name="PSR2.Classes.PropertyDeclaration.Underscore" />
5351
<exclude name="WordPress.Files.FileName.InvalidClassFileName" />
5452
<exclude name="Core.Commenting.CommentTags.AccessTag" />
5553
<exclude name="Core.Commenting.CommentTags.AuthorTag" />

readme.txt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Donate link: https://mypreview.one/woo-additional-terms
55
Requires at least: 5.0
66
Tested up to: 6.1
77
Requires PHP: 7.4
8-
Stable tag: 1.4.0
8+
Stable tag: 1.4.1
99
License: GPLv3 or later
1010
License URI: http://www.gnu.org/licenses/gpl-3.0.txt
1111

@@ -81,10 +81,6 @@ We welcome contributions in any form, and you can help reporting, testing, and d
8181
Here’s the [GitHub development repository &#8594;](https://github.com/mypreview/woo-additional-terms "GitHub development repository")
8282

8383
= Did you like the idea behind this plugin? =
84-
If you or your company use any of my projects or like what I’m doing, please consider [making a donation](https://www.buymeacoffee.com/mahdiyazdani) so I can continue maintaining and evolving all my projects and new ones. I’m in this for the long run.
85-
86-
--AND/OR--
87-
8884
Please share your experience by leaving this plugin [5 shining stars](https://wordpress.org/support/plugin/woo-additional-terms/reviews/ "Rate Woo Additional Terms 5 stars") if you like it, thanks!
8985

9086
= Is there a premium version to upgrade? =
@@ -106,6 +102,9 @@ Currently, the key features offered by the premium (paid) version of the plugin
106102
3. Plugin settings page.
107103

108104
== Changelog ==
105+
= 1.4.1 =
106+
* Improved logic in displaying admin-notices.
107+
109108
= 1.4.0 =
110109
* Compatibility with WooCommerce 7.2
111110

uninstall.php

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,30 @@
44
* Fired when the plugin is uninstalled.
55
*
66
* @package Woo Additional Terms
7-
* @since 1.3.3
7+
* @since 1.0.0
88
*/
99

10-
// If uninstall not called from WordPress, then exit.
11-
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
12-
exit;
13-
}
10+
defined( 'ABSPATH' ) || exit; // Exit if accessed directly.
11+
defined( 'WP_UNINSTALL_PLUGIN' ) || exit; // If uninstall not called from WordPress, then exit.
12+
13+
// Reset the activation timestamp as the user already decided to delete the plugin.
14+
delete_site_option( 'woo_additional_terms_activation_timestamp' );
1415

15-
$woo_additional_terms_page_id = '_woo_additional_terms_page_id';
16-
$woo_additional_terms_notice = '_woo_additional_terms_notice';
17-
$woo_additional_terms_error = '_woo_additional_terms_error';
16+
/*
17+
* Only perform uninstall if WC_REMOVE_ALL_DATA constant is set to true in user's
18+
* wp-config.php. This is to prevent data loss when deleting the plugin from the backend
19+
* and to ensure only the site owner can perform this action.
20+
*/
21+
if ( defined( 'WC_REMOVE_ALL_DATA' ) && true === WC_REMOVE_ALL_DATA ) {
22+
$woo_additional_terms_page_id = '_woo_additional_terms_page_id';
23+
$woo_additional_terms_notice = '_woo_additional_terms_notice';
24+
$woo_additional_terms_error = '_woo_additional_terms_error';
1825

19-
delete_option( $woo_additional_terms_page_id );
20-
delete_option( $woo_additional_terms_notice );
21-
delete_option( $woo_additional_terms_error );
22-
// For site options in Multisite.
23-
delete_site_option( $woo_additional_terms_page_id );
24-
delete_site_option( $woo_additional_terms_notice );
25-
delete_site_option( $woo_additional_terms_error );
26+
delete_option( $woo_additional_terms_page_id );
27+
delete_option( $woo_additional_terms_notice );
28+
delete_option( $woo_additional_terms_error );
29+
// For site options in Multisite.
30+
delete_site_option( $woo_additional_terms_page_id );
31+
delete_site_option( $woo_additional_terms_notice );
32+
delete_site_option( $woo_additional_terms_error );
33+
}

0 commit comments

Comments
 (0)