| @@ -4,14 +4,14 @@ | ||
| 4 | 4 | * Description: WooCommerce Product compare plugin |
| 5 | 5 | * Plugin URI: https://hasthemes.com/plugins/ |
| 6 | 6 | * Author: HasTheme |
| 7 | 7 | * Author URI: https://hasthemes.com/ |
| 8 | - * Version: 1.2.4 | |
| 8 | + * Version: 1.3.7 | |
| 9 | 9 | * License: GPL2 or later |
| 10 | 10 | * License URI: https://www.gnu.org/licenses/gpl-2.0.html |
| 11 | 11 | * Text Domain: ever-compare |
| 12 | 12 | * Domain Path: /languages |
| 13 | - * WC tested up to: 7.7.0 | |
| 13 | + * WC tested up to: 10.0.2 | |
| 14 | 14 | */ |
| 15 | 15 | |
| 16 | 16 | if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
| 17 | 17 | |
| @@ -24,9 +24,9 @@ | ||
| 24 | 24 | * Plugin version |
| 25 | 25 | * |
| 26 | 26 | * @var string |
| 27 | 27 | */ |
| 28 | - const version = '1.2.4'; | |
| 28 | + const version = '1.3.7'; | |
| 29 | 29 | |
| 30 | 30 | /** |
| 31 | 31 | * [$_instance] |
| 32 | 32 | * @var null |
| @@ -49,9 +49,9 @@ | ||
| 49 | 49 | */ |
| 50 | 50 | private function __construct(){ |
| 51 | 51 | |
| 52 | 52 | $this->define_constants(); |
| 53 | - $this->includes(); | |
| 53 | + add_action( 'plugins_loaded', [ $this, 'includes' ] ); | |
| 54 | 54 | |
| 55 | 55 | register_activation_hook( EVERCOMPARE_FILE, [ $this, 'activate' ] ); |
| 56 | 56 | |
| 57 | 57 | add_action( 'init', [ $this, 'i18n' ] ); |
| @@ -56,12 +56,14 @@ | ||
| 56 | 56 | |
| 57 | 57 | add_action( 'init', [ $this, 'i18n' ] ); |
| 58 | 58 | add_action( 'plugins_loaded', [ $this, 'init_plugin' ] ); |
| 59 | 59 | |
| 60 | - // Compatible With WooCommerce Custom Order Tables | |
| 60 | + // Compatible With WooCommerce Features | |
| 61 | 61 | add_action( 'before_woocommerce_init', function() { |
| 62 | 62 | if ( class_exists( '\Automattic\WooCommerce\Utilities\FeaturesUtil' ) ) { |
| 63 | 63 | \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', EVERCOMPARE_FILE, true ); |
| 64 | + \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'cart_checkout_blocks', EVERCOMPARE_FILE, true ); | |
| 65 | + \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'product_block_editor', EVERCOMPARE_FILE, true ); | |
| 64 | 66 | } |
| 65 | 67 | } ); |
| 66 | 68 | } |
| 67 | 69 | |
| @@ -105,16 +107,22 @@ | ||
| 105 | 107 | public function init_plugin() { |
| 106 | 108 | |
| 107 | 109 | EverCompare\Assets::instance(); |
| 108 | 110 | |
| 111 | + if ( is_admin() ) { | |
| 112 | + $this->admin_notices(); | |
| 113 | + EverCompare\Admin::instance(); | |
| 114 | + new EverCompare\Admin\Dashboard_Widget(); | |
| 115 | + } | |
| 116 | + | |
| 117 | + if ( ! ever_compare_woocommerce_installed() ) { | |
| 118 | + return; | |
| 119 | + } | |
| 120 | + | |
| 109 | 121 | if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { |
| 110 | 122 | EverCompare\Ajax::instance(); |
| 111 | 123 | } |
| 112 | 124 | |
| 113 | - if ( is_admin() ) { | |
| 114 | - $this->admin_notices(); | |
| 115 | - EverCompare\Admin::instance(); | |
| 116 | - } | |
| 117 | 125 | EverCompare\Frontend::instance(); |
| 118 | 126 | |
| 119 | 127 | // add image size |
| 120 | 128 | $this->set_image_size(); |
| @@ -121,8 +129,21 @@ | ||
| 121 | 129 | |
| 122 | 130 | // let's filter the woocommerce image size |
| 123 | 131 | add_filter( 'woocommerce_get_image_size_ever-compare-image', [ $this, 'wc_image_filter_size' ], 10, 1 ); |
| 124 | 132 | |
| 133 | + // let's filter the speculation rules | |
| 134 | + add_filter( 'wp_speculation_rules_href_exclude_paths', function( $exclude_paths ) { | |
| 135 | + $compare_page_id = ever_compare_get_option( 'compare_page', 'ever_compare_table_settings_tabs' ); | |
| 136 | + if ( $compare_page_id ) { | |
| 137 | + $compare_page_url = get_permalink( $compare_page_id ); | |
| 138 | + $compare_path = parse_url( $compare_page_url, PHP_URL_PATH ); | |
| 139 | + if ( $compare_path ) { | |
| 140 | + $compare_path = trailingslashit( $compare_path ); | |
| 141 | + $exclude_paths[] = "{$compare_path}*"; | |
| 142 | + } | |
| 143 | + } | |
| 144 | + return $exclude_paths; | |
| 145 | + }); | |
| 125 | 146 | } |
| 126 | 147 | |
| 127 | 148 | /** |
| 128 | 149 | * Do stuff upon plugin activation |
| @@ -129,8 +150,9 @@ | ||
| 129 | 150 | * |
| 130 | 151 | * @return void |
| 131 | 152 | */ |
| 132 | 153 | public function activate() { |
| 154 | + $this->includes(); | |
| 133 | 155 | $installer = new EverCompare\Installer(); |
| 134 | 156 | $installer->run(); |
| 135 | 157 | } |
| 136 | 158 | |
| @@ -171,9 +193,14 @@ | ||
| 171 | 193 | 'height' => isset( $image_dimention['height'] ) ? absint( $image_dimention['height'] ) : 300, |
| 172 | 194 | 'crop' => isset( $hard_crop ) ? 1 : 0, |
| 173 | 195 | ); |
| 174 | 196 | } |
| 175 | - | |
| 197 | + | |
| 198 | + return array( | |
| 199 | + 'width' => 300, | |
| 200 | + 'height' => 300, | |
| 201 | + 'crop' => 0, | |
| 202 | + ); | |
| 176 | 203 | } |
| 177 | 204 | |
| 178 | 205 | } |
| 179 | 206 | |
| @@ -188,5 +215,5 @@ | ||
| 188 | 215 | } |
| 189 | 216 | } |
| 190 | 217 | |
| 191 | 218 | // Start Our journey |
| 192 | -ever_compare(); | |
| 219 | +ever_compare(); | |