Skip to content

Commit

Permalink
V 1.6.4 - Minor enhancement release 🚧 (#26)
Browse files Browse the repository at this point in the history
* fix: Use Elementor to render the post content

* fix: Incorrect terms page id name

* Add support for parsing styles

* Avoid escaping post content

* fix: Update class_exists

* Add new version changelog

* Bump plugin version

* Generate

* Update changelog

* Add get_error function

* Get error message from the terms class

* refactor: show_error method

* Generate

* refactor: Remove plugin_basename variable

* fix: Remove params from the Meta class
  • Loading branch information
mahdiyazdani authored Aug 31, 2023
1 parent 5dd75a2 commit 7eecdc7
Show file tree
Hide file tree
Showing 10 changed files with 146 additions and 99 deletions.
89 changes: 52 additions & 37 deletions docs/CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,80 +1,95 @@
= 1.6.4 =
* Compatibility for rendering terms page content created with Elementor.

= 1.6.3 =
* Resolved the issue that prevented the assignment of non-published pages as terms pages.
* Addressed a PHP error that occurred when retrieving order meta information for display on the order page.

= 1.6.2 =
* Isolated the dependency injection container package to prevent potential PHP fatal errors when utilized by other third-party plugins.

= 1.6.1 =
* Prevented checkout error in the checkout block when additional terms & conditions are deactivated.
* Enhanced display of additional terms acceptance below the billing address.
* Ensured compatibility with the "WooCommerce PayPal Payments" plugin.
* Verified compatibility with WordPress version 6.3.
* Verified compatibility with WooCommerce version 8.0.

= 1.6.0 =
* Added: Ability to define the status of the additional terms checkbox.
* Added: Customization option to choose how the terms page is displayed (modal, embed, or new tab).
* Added: Option to make the terms and conditions checkbox skippable.
* Added: Recording the acceptance of the additional terms in the order notes.
* Improved: Optimized the underlying code structure for better performance and maintainability.
* Added ability to define the status of the additional terms checkbox.
* Added customization option to choose how the terms page is displayed (modal, embed, or new tab).
* Added new option to make the terms and conditions checkbox skippable.
* Save the acceptance of the additional terms in the order notes.
* Optimized the underlying code structure for better performance and maintainability.

= 1.5.2 =
* Compatibility with WordPress 6.2
* Compatibility with WooCommerce 7.5
* Compatibility with WordPress 6.2.
* Compatibility with WooCommerce 7.5.

= 1.5.1 =
* Update font-size for the checkout block
* Compatibility with WooCommerce 7.4
* Updated font-size for the checkout block.
* Compatibility with WooCommerce 7.4.

= 1.5.0 =
* Compatibility with WooCommerce Checkout block
* Compatibility with WooCommerce 7.3
* Compatibility with WooCommerce Checkout block.
* Compatibility with WooCommerce 7.3.

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

= 1.4.0 =
* Compatibility with WooCommerce 7.2
* Compatibility with WooCommerce 7.2.

= 1.3.6 =
* Compatibility with WordPress 6.1
* Compatibility with WooCommerce 7.0
* Compatibility with WordPress 6.1.
* Compatibility with WooCommerce 7.0.

= 1.3.5 =
* Compatibility with WordPress 6.0
* Compatibility with WooCommerce 6.9
* Compatibility with WordPress 6.0.
* Compatibility with WooCommerce 6.9.

= 1.3.4 =
* Compatibility with WordPress 5.6
* Compatibility with WooCommerce 4.8
* Compatibility with WordPress 5.6.
* Compatibility with WooCommerce 4.8.

= 1.3.3 =
* Multiple code standards improvements.
* Compatibility with WordPress 5.5
* Compatibility with WooCommerce 4.4
* Compatibility with WordPress 5.5.
* Compatibility with WooCommerce 4.4.

= 1.3.2 =
* Compatibility with WooCommerce 4.3
* Compatibility with WooCommerce 4.3.

= 1.3.1 =
* Display the acceptance of terms & conditions on the order edit page.

= 1.3.0 =
* Additional terms content can now open up on the page when the link is clicked, and customers can review without leaving checkout.
* Compatibility with WooCommerce 4.2.0
* Additional terms content can now open up on the page when the link is clicked, allowing customers to review without leaving checkout.
* Compatibility with WooCommerce 4.2.0.

= 1.2.2 =
* Added language configuration file to support WPML/Polylang.
* Compatibility with WordPress 5.4.1
* Compatibility with WooCommerce 4.1.1
* Compatibility with WordPress 5.4.1.
* Compatibility with WooCommerce 4.1.1.

= 1.2.1 =
* Multiple code standards improvements.
* Compatibility with WordPress 5.4.0
* Compatibility with WooCommerce 4.0.1
* Compatibility with WordPress 5.4.0.
* Compatibility with WooCommerce 4.0.1.

= 1.2.0 =
* Updated language file.
* Refactored and re-organized underlying code in plugin settings page/ controls.
* Compatibility with WordPress 5.3.1
* Compatibility with WooCommerce 3.8.1
* Refactored and re-organized underlying code in plugin settings page/controls.
* Compatibility with WordPress 5.3.1.
* Compatibility with WooCommerce 3.8.1.

= 1.1.0 =
* Compatible with WordPress 4.9.6
* Compatible with WordPress 3.4.2

= 1.0.3 =
* Compatible with WordPress 4.9.6.
* Compatible with WooCommerce 3.4.2.

= 1.0.2 =
* Compatible with WordPress 4.7.0
* Compatible with WordPress 2.6.9
* Compatible with WordPress 4.7.0.
* Compatible with WooCommerce 2.6.9.

= 1.0.1 =
* Added screenshots.
Expand Down
21 changes: 10 additions & 11 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.6.3\n"
"Project-Id-Version: Woo Additional Terms 1.6.4\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: 2023-08-23T10:14:46+00:00\n"
"POT-Creation-Date: 2023-08-27T13:06:55+00:00\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"X-Generator: WP-CLI 2.8.1\n"
"X-Domain: woo-additional-terms\n"
Expand All @@ -32,25 +32,25 @@ msgid "MyPreview"
msgstr ""

#. translators: 1: Open anchor tag, 2: Close anchor tag.
#: src/Enhancements/Meta.php:67
#: src/Enhancements/Meta.php:53
msgctxt "plugin link"
msgid "%1$sDocs%2$s"
msgstr ""

#. translators: 1: Open anchor tag, 2: Close anchor tag.
#: src/Enhancements/Meta.php:75
#: src/Enhancements/Meta.php:61
msgctxt "plugin link"
msgid "%1$sCommunity support%2$s"
msgstr ""

#. translators: 1: Open anchor tag, 2: Close anchor tag.
#: src/Enhancements/Meta.php:101
#: src/Enhancements/Meta.php:93
msgctxt "plugin link"
msgid "%1$sGet PRO%2$s"
msgstr ""

#. translators: 1: Open anchor tag, 2: Close anchor tag.
#: src/Enhancements/Meta.php:109
#: src/Enhancements/Meta.php:103
msgctxt "plugin settings page"
msgid "%1$sSettings%2$s"
msgstr ""
Expand Down Expand Up @@ -201,16 +201,15 @@ msgstr ""
msgid "Customer did not accept the additional terms."
msgstr ""

#: src/WooCommerce/Block/Block.php:177
#: src/WooCommerce/Checkout.php:173
msgid "Please accept the additional terms to continue."
msgstr ""

#. translators: %s: Render the type of the variable.
#: src/WooCommerce/Block/Block.php:209
msgid "Value of field %s was posted with incorrect data type."
msgstr ""

#: src/WooCommerce/Terms.php:76
msgid "Please accept the additional terms to continue."
msgstr ""

#: templates/checkout/checkbox.php:52
msgid "Required"
msgstr ""
Expand Down
22 changes: 12 additions & 10 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.3
Requires PHP: 7.4
Stable tag: 1.6.3
Stable tag: 1.6.4
License: GPLv3 or later
License URI: http://www.gnu.org/licenses/gpl-3.0.txt

Expand Down Expand Up @@ -123,12 +123,15 @@ Yes, it does. The [Woo Additional Terms PRO](https://mypreview.one/woo-additiona
5. Additional terms and condition checkbox on the WooCommerce checkout block page.

== Changelog ==
= 1.6.4 =
* Compatibility for rendering terms page content created with Elementor.

= 1.6.3 =
* Fix: Resolved the issue that prevented the assignment of non-published pages as terms pages.
* Fix: Addressed a PHP error that occurred when retrieving order meta information for display on the order page.
* Resolved the issue that prevented the assignment of non-published pages as terms pages.
* Addressed a PHP error that occurred when retrieving order meta information for display on the order page.

= 1.6.2 =
* Fix: Isolated the dependency injection container package to prevent potential PHP fatal errors when utilized by other third-party plugins.
* Isolated the dependency injection container package to prevent potential PHP fatal errors when utilized by other third-party plugins.

= 1.6.1 =
* Prevented checkout error in the checkout block when additional terms & conditions are deactivated.
Expand All @@ -138,11 +141,11 @@ Yes, it does. The [Woo Additional Terms PRO](https://mypreview.one/woo-additiona
* Verified compatibility with WooCommerce version 8.0.

= 1.6.0 =
* Added: Ability to define the status of the additional terms checkbox.
* Added: Customization option to choose how the terms page is displayed (modal, embed, or new tab).
* Added: Option to make the terms and conditions checkbox skippable.
* Added: Recording the acceptance of the additional terms in the order notes.
* Improved: Optimized the underlying code structure for better performance and maintainability.
* Added ability to define the status of the additional terms checkbox.
* Added customization option to choose how the terms page is displayed (modal, embed, or new tab).
* Added new option to make the terms and conditions checkbox skippable.
* Save the acceptance of the additional terms in the order notes.
* Optimized the underlying code structure for better performance and maintainability.

= 1.5.2 =
* Compatibility with WordPress 6.2.
Expand Down Expand Up @@ -218,4 +221,3 @@ Yes, it does. The [Woo Additional Terms PRO](https://mypreview.one/woo-additiona

= 1.0.0 =
* Initial release.

63 changes: 36 additions & 27 deletions src/Enhancements/Meta.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,31 +18,17 @@
*/
class Meta {

/**
* The plugin basename.
*
* @since 1.0.0
*
* @var string
*/
private $plugin_basename;

/**
* Setup hooks and filters.
*
* @since 1.0.0
*
* @param string $plugin_basename The plugin basename.
*
* @return void
*/
public function setup( $plugin_basename ) {

// Set the plugin basename.
$this->plugin_basename = $plugin_basename;
public function setup() {

add_filter( 'plugin_row_meta', array( $this, 'meta_links' ), 10, 2 );
add_filter( "plugin_action_links_{$this->plugin_basename}", array( $this, 'action_links' ) );
add_filter( 'plugin_action_links', array( $this, 'action_links' ), 10, 2 );
}

/**
Expand All @@ -58,7 +44,7 @@ public function setup( $plugin_basename ) {
public function meta_links( $links, $file ) {

// Return early if not on the plugin page.
if ( $this->plugin_basename !== $file ) {
if ( ! $this->is_this_plugin( $file ) ) {
return $links;
}

Expand Down Expand Up @@ -90,11 +76,17 @@ public function meta_links( $links, $file ) {
*
* @since 1.0.0
*
* @param array $links Plugin table/item action links.
* @param array $links Plugin table/item action links.
* @param string $file Path to the plugin file relative to the plugins' directory.
*
* @return array
*/
public function action_links( $links ) {
public function action_links( $links, $file ) {

// Leave early if the filter is not for this plugin.
if ( ! $this->is_this_plugin( $file ) ) {
return $links;
}

$plugin_links = array();
$plugin_links[] = sprintf( /* translators: 1: Open anchor tag, 2: Close anchor tag. */
Expand All @@ -105,15 +97,32 @@ public function action_links( $links ) {
),
'</a>'
);
$plugin_links[] = sprintf( /* translators: 1: Open anchor tag, 2: Close anchor tag. */
esc_html_x( '%1$sSettings%2$s', 'plugin settings page', 'woo-additional-terms' ),
sprintf(
'<a href="%s">',
esc_url( Helper\Settings::page_uri() )
),
'</a>'
);

if ( current_user_can( 'manage_woocommerce' ) ) {
$plugin_links[] = sprintf( /* translators: 1: Open anchor tag, 2: Close anchor tag. */
esc_html_x( '%1$sSettings%2$s', 'plugin settings page', 'woo-additional-terms' ),
sprintf(
'<a href="%s">',
esc_url( Helper\Settings::page_uri() )
),
'</a>'
);
}

return array_merge( $plugin_links, $links );
}

/**
* Check if the current plugin is the one we are looking for.
*
* @since 1.0.0
*
* @param string $file Path to the plugin file relative to the plugins' directory.
*
* @return bool
*/
private function is_this_plugin( $file ) {

return woo_additional_terms()->service( 'file' )->plugin_basename() === $file;
}
}
3 changes: 0 additions & 3 deletions src/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,6 @@ private function get_classes() {
),
'Enhancements\\Meta' => array(
'condition' => $is_admin,
'params' => array(
$this['file']->plugin_basename(),
),
),
'Enhancements\\Notices' => array(
'condition' => $is_admin,
Expand Down
2 changes: 1 addition & 1 deletion src/WooCommerce/Block/Block.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ public function get_script_data() {
'display_action' => woo_additional_terms()->service( 'options' )->get( 'action', 'embed' ),
'page_content' => woo_additional_terms()->service( 'terms' )->get( 'content' ),
'checkbox_label' => woo_additional_terms()->service( 'terms' )->get( 'label' ),
'error_message' => woo_additional_terms()->service( 'options' )->get( 'error', __( 'Please accept the additional terms to continue.', 'woo-additional-terms' ) ),
'error_message' => woo_additional_terms()->service( 'terms' )->get( 'error' ),
);
}

Expand Down
Loading

0 comments on commit 7eecdc7

Please sign in to comment.