Skip to content

Commit

Permalink
Fix - Micromodal is not defined
Browse files Browse the repository at this point in the history
  • Loading branch information
pablo-sg-pacheco committed Sep 14, 2023
1 parent c47fdec commit a9f9a58
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 16 deletions.
2 changes: 1 addition & 1 deletion popup-notices-for-woocommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
15 changes: 8 additions & 7 deletions src/php/class-core.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down Expand Up @@ -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() {
Expand All @@ -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 );
Expand Down
15 changes: 8 additions & 7 deletions src/php/class-modal.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down Expand Up @@ -45,8 +45,9 @@ function handle_outside_click( $template ) {
'yes' === get_option( 'ttt_pnwc_opt_prevent_closing_if_clicking_out', 'no' )
&& preg_match( '/\<div.+class\=\"ttt-pnwc-overlay\".+\>/', $template, $output_array )
) {
$template = preg_replace('/(\<div.+class\=\"ttt-pnwc-overlay\")(.+)?(\sdata-micromodal-close)/', '$1$2', $template);
$template = preg_replace( '/(\<div.+class\=\"ttt-pnwc-overlay\")(.+)?(\sdata-micromodal-close)/', '$1$2', $template );
}

return $template;
}

Expand All @@ -59,7 +60,7 @@ function handle_outside_click( $template ) {
* @return void
*/
public function add_audio_html() {
if ( 'yes' !== get_option( 'ttt_pnwc_opt_audio_enable','no' ) ) {
if ( 'yes' !== get_option( 'ttt_pnwc_opt_audio_enable', 'no' ) ) {
return;
}
$plugin = \WPFactory\PNWC\Core::instance();
Expand All @@ -69,7 +70,7 @@ public function add_audio_html() {
/**
* Adds modal scripts
*
* @version 1.2.5
* @version 1.4.5
* @since 1.0.0
*/
public function add_modal_scripts() {
Expand All @@ -87,9 +88,9 @@ public function add_modal_scripts() {
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
$plugin_url = $plugin->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' );
}
}
Expand Down

0 comments on commit a9f9a58

Please sign in to comment.