Version Description
- New: Support for Full Site Editing navigation blocks (WP5.9+)
- Tested up to WooCommerce 6.4
Download this release
Release Info
Developer | wpovernight |
Plugin | WooCommerce Menu Cart |
Version | 2.11.0 |
Comparing to | |
See all releases |
Code changes from version 2.11.0-beta-1 to 2.11.0
- includes/wpmenucart-settings.php +15 -13
- readme.txt +5 -1
- wp-menu-cart.php +48 -14
includes/wpmenucart-settings.php
CHANGED
@@ -4,7 +4,7 @@ class WpMenuCart_Settings {
|
|
4 |
public function __construct() {
|
5 |
add_action( 'admin_init', array( &$this, 'init_settings' ) ); // Registers settings
|
6 |
add_action( 'admin_menu', array( &$this, 'wpmenucart_add_page' ) );
|
7 |
-
add_filter( 'plugin_action_links_'.
|
8 |
|
9 |
//Menu admin, not using for now (very complex ajax structure...)
|
10 |
//add_action( 'admin_init', array( &$this, 'wpmenucart_add_meta_box' ) );
|
@@ -58,18 +58,20 @@ class WpMenuCart_Settings {
|
|
58 |
}
|
59 |
}
|
60 |
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
|
|
|
|
73 |
|
74 |
add_settings_field(
|
75 |
'always_display',
|
4 |
public function __construct() {
|
5 |
add_action( 'admin_init', array( &$this, 'init_settings' ) ); // Registers settings
|
6 |
add_action( 'admin_menu', array( &$this, 'wpmenucart_add_page' ) );
|
7 |
+
add_filter( 'plugin_action_links_'.WPO_Menu_Cart()->plugin_basename, array( &$this, 'wpmenucart_add_settings_link' ) );
|
8 |
|
9 |
//Menu admin, not using for now (very complex ajax structure...)
|
10 |
//add_action( 'admin_init', array( &$this, 'wpmenucart_add_meta_box' ) );
|
58 |
}
|
59 |
}
|
60 |
|
61 |
+
if ( ! WPO_Menu_Cart()->is_block_theme() ) {
|
62 |
+
add_settings_field(
|
63 |
+
'menu_slugs',
|
64 |
+
__( 'Select the menu(s) in which you want to display the Menu Cart', 'wp-menu-cart' ),
|
65 |
+
array( &$this, 'menus_select_element_callback' ),
|
66 |
+
$option,
|
67 |
+
'plugin_settings',
|
68 |
+
array(
|
69 |
+
'menu' => $option,
|
70 |
+
'id' => 'menu_slugs',
|
71 |
+
'options' => (array) $this->get_menu_array(),
|
72 |
+
)
|
73 |
+
);
|
74 |
+
}
|
75 |
|
76 |
add_settings_field(
|
77 |
'always_display',
|
readme.txt
CHANGED
@@ -5,7 +5,7 @@ Tags: woocommerce, menu, bar, cart, basket, header, shopping cart, navigation, e
|
|
5 |
Requires at least: 3.4
|
6 |
Tested up to: 5.9
|
7 |
Requires PHP: 5.3
|
8 |
-
Stable tag: 2.
|
9 |
|
10 |
Automatically displays a shopping cart in your menu bar. Works with WooCommerce, WP-Ecommerce, EDD, Eshop and Jigoshop
|
11 |
|
@@ -85,6 +85,10 @@ Once the plugin is activated navigate to Settings > Menu Cart Setup. Select your
|
|
85 |
|
86 |
== Changelog ==
|
87 |
|
|
|
|
|
|
|
|
|
88 |
= 2.10.4 =
|
89 |
* Tested up to WooCommerce 6.1 & WP5.9
|
90 |
|
5 |
Requires at least: 3.4
|
6 |
Tested up to: 5.9
|
7 |
Requires PHP: 5.3
|
8 |
+
Stable tag: 2.11.0
|
9 |
|
10 |
Automatically displays a shopping cart in your menu bar. Works with WooCommerce, WP-Ecommerce, EDD, Eshop and Jigoshop
|
11 |
|
85 |
|
86 |
== Changelog ==
|
87 |
|
88 |
+
= 2.11.0 =
|
89 |
+
* New: Support for Full Site Editing navigation blocks (WP5.9+)
|
90 |
+
* Tested up to WooCommerce 6.4
|
91 |
+
|
92 |
= 2.10.4 =
|
93 |
* Tested up to WooCommerce 6.1 & WP5.9
|
94 |
|
wp-menu-cart.php
CHANGED
@@ -3,14 +3,14 @@
|
|
3 |
* Plugin Name: WooCommerce Menu Cart
|
4 |
* Plugin URI: https://wpovernight.com/downloads/menu-cart-pro/
|
5 |
* Description: Extension for your e-commerce plugin (WooCommerce, WP-Ecommerce, Easy Digital Downloads, Eshop or Jigoshop) that places a cart icon with number of items and total cost in the menu bar. Activate the plugin, set your options and you're ready to go! Will automatically conform to your theme styles.
|
6 |
-
* Version: 2.11.0
|
7 |
* Author: WP Overnight
|
8 |
* Author URI: https://wpovernight.com/
|
9 |
* License: GPLv2 or later
|
10 |
* License URI: https://opensource.org/licenses/gpl-license.php
|
11 |
* Text Domain: wp-menu-cart
|
12 |
* WC requires at least: 2.0.0
|
13 |
-
* WC tested up to: 6.
|
14 |
*/
|
15 |
|
16 |
if ( ! defined( 'ABSPATH' ) ) {
|
@@ -21,23 +21,36 @@ if ( ! class_exists( 'WpMenuCart' ) && ! class_exists( 'WPO_Menu_Cart_Pro' ) ) :
|
|
21 |
|
22 |
class WpMenuCart {
|
23 |
|
24 |
-
protected
|
25 |
-
public
|
26 |
-
public
|
27 |
-
public
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
|
29 |
/**
|
30 |
* Construct.
|
31 |
*/
|
32 |
public function __construct() {
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
$this->
|
37 |
|
38 |
$this->define( 'WPMENUCART_VERSION', $this->plugin_version );
|
39 |
-
|
40 |
-
$this->asset_suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
|
41 |
|
42 |
// load the localisation & classes
|
43 |
add_action( 'plugins_loaded', array( &$this, 'languages' ), 0 ); // or use init?
|
@@ -491,6 +504,10 @@ class WpMenuCart {
|
|
491 |
}
|
492 |
|
493 |
public function register_cart_navigation_block() {
|
|
|
|
|
|
|
|
|
494 |
wp_register_script(
|
495 |
'wpmenucart-navigation-block',
|
496 |
plugins_url( '/assets/js/wpmenucart-navigation-block'.$this->asset_suffix.'.js', __FILE__ ),
|
@@ -527,6 +544,14 @@ class WpMenuCart {
|
|
527 |
return false;
|
528 |
}
|
529 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
530 |
/**
|
531 |
* Add filters to selected menus to add cart item <li>
|
532 |
*/
|
@@ -744,8 +769,6 @@ class WpMenuCart {
|
|
744 |
|
745 |
}
|
746 |
|
747 |
-
$wpMenuCart = new WpMenuCart();
|
748 |
-
|
749 |
/**
|
750 |
* Hide notifications
|
751 |
*/
|
@@ -755,3 +778,14 @@ if ( ! empty( $_GET['hide_wpmenucart_shop_check'] ) ) {
|
|
755 |
}
|
756 |
|
757 |
endif; // class_exists
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
* Plugin Name: WooCommerce Menu Cart
|
4 |
* Plugin URI: https://wpovernight.com/downloads/menu-cart-pro/
|
5 |
* Description: Extension for your e-commerce plugin (WooCommerce, WP-Ecommerce, Easy Digital Downloads, Eshop or Jigoshop) that places a cart icon with number of items and total cost in the menu bar. Activate the plugin, set your options and you're ready to go! Will automatically conform to your theme styles.
|
6 |
+
* Version: 2.11.0
|
7 |
* Author: WP Overnight
|
8 |
* Author URI: https://wpovernight.com/
|
9 |
* License: GPLv2 or later
|
10 |
* License URI: https://opensource.org/licenses/gpl-license.php
|
11 |
* Text Domain: wp-menu-cart
|
12 |
* WC requires at least: 2.0.0
|
13 |
+
* WC tested up to: 6.4
|
14 |
*/
|
15 |
|
16 |
if ( ! defined( 'ABSPATH' ) ) {
|
21 |
|
22 |
class WpMenuCart {
|
23 |
|
24 |
+
protected $plugin_version = '2.11.0';
|
25 |
+
public $plugin_slug;
|
26 |
+
public $plugin_basename;
|
27 |
+
public $options;
|
28 |
+
public $asset_suffix;
|
29 |
+
|
30 |
+
protected static $_instance = null;
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Main Plugin Instance
|
34 |
+
*
|
35 |
+
* Ensures only one instance of plugin is loaded or can be loaded.
|
36 |
+
*/
|
37 |
+
public static function instance() {
|
38 |
+
if ( is_null( self::$_instance ) ) {
|
39 |
+
self::$_instance = new self();
|
40 |
+
}
|
41 |
+
return self::$_instance;
|
42 |
+
}
|
43 |
|
44 |
/**
|
45 |
* Construct.
|
46 |
*/
|
47 |
public function __construct() {
|
48 |
+
$this->plugin_slug = basename( dirname( __FILE__ ) );
|
49 |
+
$this->plugin_basename = plugin_basename( __FILE__ );
|
50 |
+
$this->options = get_option( 'wpmenucart' );
|
51 |
+
$this->asset_suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
|
52 |
|
53 |
$this->define( 'WPMENUCART_VERSION', $this->plugin_version );
|
|
|
|
|
54 |
|
55 |
// load the localisation & classes
|
56 |
add_action( 'plugins_loaded', array( &$this, 'languages' ), 0 ); // or use init?
|
504 |
}
|
505 |
|
506 |
public function register_cart_navigation_block() {
|
507 |
+
if ( ! function_exists( 'register_block_type' ) ) {
|
508 |
+
return;
|
509 |
+
}
|
510 |
+
|
511 |
wp_register_script(
|
512 |
'wpmenucart-navigation-block',
|
513 |
plugins_url( '/assets/js/wpmenucart-navigation-block'.$this->asset_suffix.'.js', __FILE__ ),
|
544 |
return false;
|
545 |
}
|
546 |
|
547 |
+
public function is_block_theme() {
|
548 |
+
$theme = wp_get_theme();
|
549 |
+
if ( ! empty( $theme ) && is_callable( array( $theme, 'is_block_theme' ) ) ) {
|
550 |
+
return $theme->is_block_theme();
|
551 |
+
}
|
552 |
+
return false;
|
553 |
+
}
|
554 |
+
|
555 |
/**
|
556 |
* Add filters to selected menus to add cart item <li>
|
557 |
*/
|
769 |
|
770 |
}
|
771 |
|
|
|
|
|
772 |
/**
|
773 |
* Hide notifications
|
774 |
*/
|
778 |
}
|
779 |
|
780 |
endif; // class_exists
|
781 |
+
|
782 |
+
/**
|
783 |
+
* Returns the main instance of WP Menu Cart to prevent the need to use globals.
|
784 |
+
*
|
785 |
+
* @return WPO_Menu_Cart
|
786 |
+
*/
|
787 |
+
function WPO_Menu_Cart() {
|
788 |
+
return WpMenuCart::instance();
|
789 |
+
}
|
790 |
+
|
791 |
+
WPO_Menu_Cart(); // load plugin
|