From a9f9a5861d68de95c313d6194928447193b6a790 Mon Sep 17 00:00:00 2001 From: Pablo Pacheco Date: Thu, 14 Sep 2023 19:57:08 -0300 Subject: [PATCH] Fix - Micromodal is not defined --- popup-notices-for-woocommerce.php | 2 +- readme.txt | 5 ++++- src/php/class-core.php | 15 ++++++++------- src/php/class-modal.php | 15 ++++++++------- 4 files changed, 21 insertions(+), 16 deletions(-) diff --git a/popup-notices-for-woocommerce.php b/popup-notices-for-woocommerce.php index fb1e69e..e4ffe39 100644 --- a/popup-notices-for-woocommerce.php +++ b/popup-notices-for-woocommerce.php @@ -3,7 +3,7 @@ * Plugin Name: Popups for WooCommerce: Add to Cart, Checkout & More * Plugin URI: https://wordpress.org/plugins/popup-notices-for-woocommerce * Description: Turn your WooCommerce Notices into Popups - * Version: 1.4.4 + * Version: 1.4.5 * Author: WPFactory * Author URI: https://wpfactory.com * License: GNU General Public License v3.0 diff --git a/readme.txt b/readme.txt index e30db9b..19e6fda 100644 --- a/readme.txt +++ b/readme.txt @@ -3,7 +3,7 @@ Contributors: wpcodefactory, omardabbas, karzin, anbinder, algoritmika, kousikmu Tags: popup,notices,woocommerce,notice,modal Requires at least: 4.4 Tested up to: 6.3 -Stable tag: 1.4.4 +Stable tag: 1.4.5 Requires PHP: 5.6.0 License: GNU General Public License v3.0 License URI: http://www.gnu.org/licenses/gpl-3.0.html @@ -99,6 +99,9 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI == Changelog == += 1.4.5 - 14/09/2023 = +* Fix - Micromodal is not defined. + = 1.4.4 - 13/09/2023 = * Fix - Javascript Uncaught TypeError. * Dev - Migrate from Gulp to Webpack. diff --git a/src/php/class-core.php b/src/php/class-core.php index 4c667e6..4460dcd 100644 --- a/src/php/class-core.php +++ b/src/php/class-core.php @@ -2,7 +2,7 @@ /** * Pop-up Notices for WooCommerce (TTT) - Core Class * - * @version 1.4.4 + * @version 1.4.5 * @since 1.0.0 * @author WPFactory */ @@ -357,8 +357,9 @@ public function add_action_links( $links ) { } /** - * Adds scripts - * @version 1.4.4 + * Adds scripts. + * + * @version 1.4.5 * @since 1.0.0 */ public function add_scripts() { @@ -372,14 +373,14 @@ public function add_scripts() { // Main css file $css_file = 'pnwc-frontend' . $suffix . '.css'; - $css_ver = date( "ymd-Gis", filemtime( $plugin_dir . '/assets/css/' . $css_file ) ); - wp_register_style( 'ttt-pnwc', $plugin_url . '/assets/css/' . $css_file, array(), $css_ver ); + $css_ver = date( "ymd-Gis", filemtime( $plugin_dir . 'assets/css/' . $css_file ) ); + wp_register_style( 'ttt-pnwc', $plugin_url . 'assets/css/' . $css_file, array(), $css_ver ); wp_enqueue_style( 'ttt-pnwc' ); // Main js file $js_file = 'pnwc-frontend' . $suffix . '.js'; - $js_ver = date( "ymd-Gis", filemtime( $plugin_dir . '/assets/js/' . $js_file ) ); - wp_register_script( 'ttt-pnwc', $plugin_url . '/assets/js/' . $js_file, array( + $js_ver = date( "ymd-Gis", filemtime( $plugin_dir . 'assets/js/' . $js_file ) ); + wp_register_script( 'ttt-pnwc', $plugin_url . 'assets/js/' . $js_file, array( 'jquery', 'ttt_pnwc_micromodal' ), $js_ver, true ); diff --git a/src/php/class-modal.php b/src/php/class-modal.php index f323240..0e7b5d7 100644 --- a/src/php/class-modal.php +++ b/src/php/class-modal.php @@ -2,7 +2,7 @@ /** * Pop-up Notices for WooCommerce (TTT) - Modal * - * @version 1.4.4 + * @version 1.4.5 * @since 1.0.0 * @author WPFactory */ @@ -45,8 +45,9 @@ function handle_outside_click( $template ) { 'yes' === get_option( 'ttt_pnwc_opt_prevent_closing_if_clicking_out', 'no' ) && preg_match( '/\/', $template, $output_array ) ) { - $template = preg_replace('/(\get_plugin_url(); $plugin_dir = $plugin->get_plugin_dir(); - $js_file = 'src/assets/dist/frontend/js/vendor/micromodal' . $suffix . '.js'; - $js_ver = date( "ymd-Gis", filemtime( $plugin_dir . $js_file ) ); - wp_register_script( 'ttt_pnwc_micromodal', $plugin_url . $js_file, array( 'jquery' ), $js_ver, true ); + $js_file = 'micromodal' . $suffix . '.js'; + $js_ver = date( "ymd-Gis", filemtime( $plugin_dir . 'assets/vendor/micromodal/' . $js_file ) ); + wp_register_script( 'ttt_pnwc_micromodal', $plugin_url . 'assets/vendor/micromodal/' . $js_file, array( 'jquery' ), $js_ver, true ); wp_enqueue_script( 'ttt_pnwc_micromodal' ); } }