Skip to content

Commit

Permalink
Merge pull request #17 from mypreview/rate-5stars-notice
Browse files Browse the repository at this point in the history
Encourage leaving a 5-star review from regular users
  • Loading branch information
gooklani authored Jan 5, 2023
2 parents 02d8548 + a49d92c commit dc7da91
Show file tree
Hide file tree
Showing 9 changed files with 190 additions and 122 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Woo Additional Terms
[![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)
[![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)

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

Expand Down
22 changes: 16 additions & 6 deletions assets/js/admin.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,39 @@
/* global jQuery, ajaxurl, watVars */

( function ( wp, $ ) {
const wooTermsAdmin = {
'use strict';

if ( ! wp ) {
return;
}

const watAdmin = {
cache() {
this.vars = {};
this.vars.upsell = '.notice-info.woocommerce-message.is-dismissible .notice-dismiss';
this.vars.rate = '#woo-additional-terms-dismiss-rate .notice-dismiss';
this.vars.upsell = '#woo-additional-terms-dismiss-upsell .notice-dismiss';
},

init() {
this.cache();
$( document.body ).on( 'click', this.vars.upsell, this.handleOnDismiss );
$( document.body ).on( 'click', this.vars.rate, ( event ) => this.handleOnDismiss( event, 'rate' ) );
$( document.body ).on( 'click', this.vars.upsell, ( event ) => this.handleOnDismiss( event, 'upsell' ) );
},

handleOnDismiss() {
handleOnDismiss( event, action ) {
event.preventDefault();

$.ajax( {
type: 'POST',
url: ajaxurl,
data: {
_ajax_nonce: watVars.dismiss_nonce,
action: 'woo_additional_terms_dismiss_upsell',
action: `woo_additional_terms_dismiss_${ action }`,
},
dataType: 'json',
} );
},
};

wooTermsAdmin.init();
watAdmin.init();
} )( window.wp, jQuery );
2 changes: 1 addition & 1 deletion assets/js/minified/admin.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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

#: woo-additioanl-terms.php:128
#: woo-additioanl-terms.php:131
msgctxt "clone"
msgid "Cloning instances of this class is forbidden."
msgstr ""

#: woo-additioanl-terms.php:138
#: woo-additioanl-terms.php:141
msgctxt "wakeup"
msgid "Unserializing instances of this class is forbidden."
msgstr ""

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

#. translators: 1: Dashicon, 2: HTML symbol, 3: Open anchor tag, 4: Close anchor tag.
#: woo-additioanl-terms.php:174
#. translators: 1: HTML Symbol, 2: HTML symbol, 3: Open anchor tag, 4: Close anchor tag.
#: woo-additioanl-terms.php:198
msgctxt "admin notice"
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"
msgstr ""

#. translators: 1: HTML symbol, 2: Plugin name, 3: Activation duration, 4: HTML symbol, 5: Open anchor tag, 6: Close anchor tag.
#: woo-additioanl-terms.php:202
msgctxt "admin notice"
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"
msgstr ""

#: woo-additioanl-terms.php:242
msgctxt "tab title"
msgid "Additional Terms"
msgstr ""

#: woo-additioanl-terms.php:287
#. translators: 1: Open H2 tag, 2: Close H2 tag.
#: woo-additioanl-terms.php:276
msgctxt "upsell"
msgid "%1$sLooking to add more terms & condition checkboxes?%2$s"
msgstr ""

#. translators: 1: Open anchor tag, 2: Close anchor tag.
#: woo-additioanl-terms.php:278
msgctxt "upsell"
msgid "%1$sBuy PRO &#8594;%2$s"
msgstr ""

#. translators: 1: Open anchor tag, 2: Close anchor tag.
#: woo-additioanl-terms.php:278
msgctxt "upsell"
msgid "Upgrade to premium version to unlock more features!"
msgstr ""

#: woo-additioanl-terms.php:343
msgid "required"
msgstr ""

#: woo-additioanl-terms.php:347
#: woo-additioanl-terms.php:403
msgid "Accepted"
msgstr ""

#: woo-additioanl-terms.php:347
#: woo-additioanl-terms.php:403
msgid "N/A"
msgstr ""

#. translators: 1: Open anchor tag, 2: Close anchor tag.
#: woo-additioanl-terms.php:374
#: woo-additioanl-terms.php:430
msgctxt "plugin settings page"
msgid "%1$sSettings%2$s"
msgstr ""

#. translators: 1: Open anchor tag, 2: Close anchor tag.
#: woo-additioanl-terms.php:395
#: woo-additioanl-terms.php:451
msgctxt "plugin link"
msgid "%1$sCommunity support%2$s"
msgstr ""

#. translators: 1: Open anchor tag, 2: Close anchor tag.
#: woo-additioanl-terms.php:397
#: woo-additioanl-terms.php:453
msgctxt "plugin link"
msgid "%1$sDonate%2$s"
msgstr ""

#. translators: 1: Open anchor tag, 2: Close anchor tag.
#: woo-additioanl-terms.php:397
#: woo-additioanl-terms.php:453
msgid "Donate to support this plugin"
msgstr ""

#. translators: 1: Open anchor tag, 2: Close anchor tag.
#: woo-additioanl-terms.php:399
#: woo-additioanl-terms.php:455
msgctxt "plugin link"
msgid "%1$sUpgrade to PRO%2$s"
msgstr ""

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

#: woo-additioanl-terms.php:444
msgctxt "upsell"
msgid "Looking to add more terms & condition checkboxes?"
msgstr ""

#. translators: 1: Open anchor tag, 2: Close anchor tag.
#: woo-additioanl-terms.php:447
msgctxt "upsell"
msgid "%1$sUpgrade to PRO &#8594;%2$s"
msgstr ""

#. translators: 1: Open anchor tag, 2: Close anchor tag.
#: woo-additioanl-terms.php:447
msgctxt "upsell"
msgid "Upgrade to premium version to unlock more features!"
msgstr ""

#: woo-additioanl-terms.php:453
#: woo-additioanl-terms.php:501
msgctxt "settings section name"
msgid "Terms and Conditions"
msgstr ""

#: woo-additioanl-terms.php:455
#: woo-additioanl-terms.php:503
msgctxt "settings section description"
msgid "This section controls the display of your additional terms and condition fieldset."
msgstr ""

#: woo-additioanl-terms.php:458
#: woo-additioanl-terms.php:506
msgctxt "settings field name"
msgid "Terms page"
msgstr ""

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

#: woo-additioanl-terms.php:468
#: woo-additioanl-terms.php:516
msgctxt "settings field name"
msgid "Notice content"
msgstr ""

#: woo-additioanl-terms.php:469
#: woo-additioanl-terms.php:517
msgctxt "settings field description"
msgid "Text for the additional terms checkbox that customers must accept."
msgstr ""

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

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

#: woo-additioanl-terms.php:479
#: woo-additioanl-terms.php:527
msgctxt "settings field name"
msgid "Error message"
msgstr ""

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

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

#: woo-additioanl-terms.php:482
#: woo-additioanl-terms.php:530
msgctxt "setting field placeholder"
msgid "You must accept our additional terms."
msgstr ""
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mypreview/woo-additional-terms",
"version": "1.4.0",
"version": "1.4.1",
"private": true,
"description": "Add additional terms and condition checkbox to the WooCommerce checkout.",
"homepage": "https://github.com/mypreview/woo-additional-terms#readme",
Expand All @@ -21,7 +21,7 @@
"lint:js": "eslint assets/js/*.js",
"lint:js:fix": "eslint assets/js/*.js --fix",
"lint:wpcs": "composer lint:wpcs",
"lint:wpcs-fix": "composer lint:wpcbf",
"lint:wpcs:fix": "composer lint:wpcbf",
"makepot": "composer make-pot",
"minify": "cross-env BABEL_ENV=default NODE_ENV=production npm run minify:css && npm run minify:js",
"minify:css": "rimraf assets/css/minified && cleancss --batch --batch-suffix '' assets/css/*.css --output assets/css/minified",
Expand Down
2 changes: 0 additions & 2 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@
<!-- Include the WordPress ruleset, with select exclusions. -->
<rule ref="WordPress">
<exclude name="WordPress.NamingConventions.PrefixAllGlobals.ShortPrefixPassed" />
<exclude name="PSR2.Methods.MethodDeclaration.Underscore" />
<exclude name="PSR2.Classes.PropertyDeclaration.Underscore" />
<exclude name="WordPress.Files.FileName.InvalidClassFileName" />
<exclude name="Core.Commenting.CommentTags.AccessTag" />
<exclude name="Core.Commenting.CommentTags.AuthorTag" />
Expand Down
9 changes: 4 additions & 5 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Donate link: https://mypreview.one/woo-additional-terms
Requires at least: 5.0
Tested up to: 6.1
Requires PHP: 7.4
Stable tag: 1.4.0
Stable tag: 1.4.1
License: GPLv3 or later
License URI: http://www.gnu.org/licenses/gpl-3.0.txt

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

= Did you like the idea behind this plugin? =
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.

--AND/OR--

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!

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

== Changelog ==
= 1.4.1 =
* Improved logic in displaying admin-notices.

= 1.4.0 =
* Compatibility with WooCommerce 7.2

Expand Down
38 changes: 23 additions & 15 deletions uninstall.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,30 @@
* Fired when the plugin is uninstalled.
*
* @package Woo Additional Terms
* @since 1.3.3
* @since 1.0.0
*/

// If uninstall not called from WordPress, then exit.
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
exit;
}
defined( 'ABSPATH' ) || exit; // Exit if accessed directly.
defined( 'WP_UNINSTALL_PLUGIN' ) || exit; // If uninstall not called from WordPress, then exit.

// Reset the activation timestamp as the user already decided to delete the plugin.
delete_site_option( 'woo_additional_terms_activation_timestamp' );

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

delete_option( $woo_additional_terms_page_id );
delete_option( $woo_additional_terms_notice );
delete_option( $woo_additional_terms_error );
// For site options in Multisite.
delete_site_option( $woo_additional_terms_page_id );
delete_site_option( $woo_additional_terms_notice );
delete_site_option( $woo_additional_terms_error );
delete_option( $woo_additional_terms_page_id );
delete_option( $woo_additional_terms_notice );
delete_option( $woo_additional_terms_error );
// For site options in Multisite.
delete_site_option( $woo_additional_terms_page_id );
delete_site_option( $woo_additional_terms_notice );
delete_site_option( $woo_additional_terms_error );
}
Loading

0 comments on commit dc7da91

Please sign in to comment.