You've already forked wc-tier-and-package-prices
Release version 1.1.12 - Final redeclaration fix
Fixed critical class redeclaration error for WC_Tier_Package_Prices affecting version 1.1.11. This completes all redeclaration protection by protecting the main plugin class. Fixes: - Class redeclaration error for WC_Tier_Package_Prices - Fatal error "Cannot redeclare class WC_Tier_Package_Prices" when plugin file loaded multiple times - Plugin activation failures caused by class redeclaration Technical Changes: - Wrapped WC_Tier_Package_Prices class declaration in class_exists() check - Completes comprehensive redeclaration protection for all plugin components - All functions, constants, and classes now safely guarded against redeclaration - Plugin now fully protected from all redeclaration scenarios Protected Components: - Functions: wc_tpp_woocommerce_missing_notice(), wc_tpp_init() - Constants: WC_TPP_VERSION, WC_TPP_PLUGIN_DIR, WC_TPP_PLUGIN_URL, WC_TPP_PLUGIN_BASENAME - Classes: WC_Tier_Package_Prices Updated Files: - wc-tier-and-package-prices.php (version 1.1.12, class protection) - composer.json (version 1.1.12) - CHANGELOG.md (v1.1.12 section) - All translation files compiled (.mo files) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
15
CHANGELOG.md
15
CHANGELOG.md
@@ -5,6 +5,21 @@ All notable changes to WooCommerce Tier and Package Prices will be documented in
|
|||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [1.1.12] - 2025-12-22
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- **CRITICAL:** Class redeclaration error for `WC_Tier_Package_Prices` affecting version 1.1.11
|
||||||
|
- Fatal error "Cannot redeclare class WC_Tier_Package_Prices" when plugin file loaded multiple times
|
||||||
|
- Plugin activation failures caused by class redeclaration
|
||||||
|
|
||||||
|
### Technical Details
|
||||||
|
|
||||||
|
- Wrapped `WC_Tier_Package_Prices` class declaration in `class_exists()` check
|
||||||
|
- Completes comprehensive redeclaration protection for all plugin components
|
||||||
|
- Prevents fatal errors during WordPress plugin activation/deactivation cycles
|
||||||
|
- All functions, constants, and classes now safely guarded against redeclaration
|
||||||
|
|
||||||
## [1.1.11] - 2025-12-22
|
## [1.1.11] - 2025-12-22
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "magdev/wc-tier-package-prices",
|
"name": "magdev/wc-tier-package-prices",
|
||||||
"description": "WooCommerce plugin for tier pricing and package prices with Twig templates",
|
"description": "WooCommerce plugin for tier pricing and package prices with Twig templates",
|
||||||
"version": "1.1.11",
|
"version": "1.1.12",
|
||||||
"type": "wordpress-plugin",
|
"type": "wordpress-plugin",
|
||||||
"license": "GPL-2.0-or-later",
|
"license": "GPL-2.0-or-later",
|
||||||
"authors": [
|
"authors": [
|
||||||
|
|||||||
BIN
releases/wc-tier-and-package-prices-1.1.12.zip
Normal file
BIN
releases/wc-tier-and-package-prices-1.1.12.zip
Normal file
Binary file not shown.
1
releases/wc-tier-and-package-prices-1.1.12.zip.md5
Normal file
1
releases/wc-tier-and-package-prices-1.1.12.zip.md5
Normal file
@@ -0,0 +1 @@
|
|||||||
|
c1c0b5880636686227246be2c37dc42a releases/wc-tier-and-package-prices-1.1.12.zip
|
||||||
1
releases/wc-tier-and-package-prices-1.1.12.zip.sha256
Normal file
1
releases/wc-tier-and-package-prices-1.1.12.zip.sha256
Normal file
@@ -0,0 +1 @@
|
|||||||
|
05b32356d46803dbb7fa17c13a2d8da96f77126746e2895e2f5c6dd0e7b490ff releases/wc-tier-and-package-prices-1.1.12.zip
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
* Plugin Name: WooCommerce Tier and Package Prices
|
* Plugin Name: WooCommerce Tier and Package Prices
|
||||||
* Plugin URI: https://src.bundespruefstelle.ch/magdev/wc-tier-package-prices
|
* Plugin URI: https://src.bundespruefstelle.ch/magdev/wc-tier-package-prices
|
||||||
* Description: Add tier pricing and package prices to WooCommerce products with configurable quantities at fixed prices
|
* Description: Add tier pricing and package prices to WooCommerce products with configurable quantities at fixed prices
|
||||||
* Version: 1.1.11
|
* Version: 1.1.12
|
||||||
* Author: Marco Graetsch
|
* Author: Marco Graetsch
|
||||||
* Author URI: https://src.bundespruefstelle.ch/magdev
|
* Author URI: https://src.bundespruefstelle.ch/magdev
|
||||||
* Text Domain: wc-tier-package-prices
|
* Text Domain: wc-tier-package-prices
|
||||||
@@ -23,7 +23,7 @@ if (!defined('ABSPATH')) {
|
|||||||
|
|
||||||
// Define plugin constants
|
// Define plugin constants
|
||||||
if (!defined('WC_TPP_VERSION')) {
|
if (!defined('WC_TPP_VERSION')) {
|
||||||
define('WC_TPP_VERSION', '1.1.11');
|
define('WC_TPP_VERSION', '1.1.12');
|
||||||
}
|
}
|
||||||
if (!defined('WC_TPP_PLUGIN_DIR')) {
|
if (!defined('WC_TPP_PLUGIN_DIR')) {
|
||||||
define('WC_TPP_PLUGIN_DIR', plugin_dir_path(__FILE__));
|
define('WC_TPP_PLUGIN_DIR', plugin_dir_path(__FILE__));
|
||||||
@@ -62,67 +62,69 @@ if (!in_array('woocommerce/woocommerce.php', apply_filters('active_plugins', get
|
|||||||
/**
|
/**
|
||||||
* Main plugin class
|
* Main plugin class
|
||||||
*/
|
*/
|
||||||
class WC_Tier_Package_Prices {
|
if (!class_exists('WC_Tier_Package_Prices')) {
|
||||||
|
class WC_Tier_Package_Prices {
|
||||||
|
|
||||||
private static $instance = null;
|
private static $instance = null;
|
||||||
|
|
||||||
public static function get_instance() {
|
public static function get_instance() {
|
||||||
if (null === self::$instance) {
|
if (null === self::$instance) {
|
||||||
self::$instance = new self();
|
self::$instance = new self();
|
||||||
|
}
|
||||||
|
return self::$instance;
|
||||||
}
|
}
|
||||||
return self::$instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
private function __construct() {
|
private function __construct() {
|
||||||
$this->init_hooks();
|
$this->init_hooks();
|
||||||
$this->includes();
|
$this->includes();
|
||||||
}
|
|
||||||
|
|
||||||
private function init_hooks() {
|
|
||||||
add_action('plugins_loaded', array($this, 'load_textdomain'));
|
|
||||||
add_action('before_woocommerce_init', array($this, 'declare_hpos_compatibility'));
|
|
||||||
register_activation_hook(__FILE__, array($this, 'activate'));
|
|
||||||
register_deactivation_hook(__FILE__, array($this, 'deactivate'));
|
|
||||||
}
|
|
||||||
|
|
||||||
private function includes() {
|
|
||||||
require_once WC_TPP_PLUGIN_DIR . 'includes/class-wc-tpp-template-loader.php';
|
|
||||||
require_once WC_TPP_PLUGIN_DIR . 'includes/class-wc-tpp-admin.php';
|
|
||||||
require_once WC_TPP_PLUGIN_DIR . 'includes/class-wc-tpp-product-meta.php';
|
|
||||||
require_once WC_TPP_PLUGIN_DIR . 'includes/class-wc-tpp-frontend.php';
|
|
||||||
require_once WC_TPP_PLUGIN_DIR . 'includes/class-wc-tpp-cart.php';
|
|
||||||
|
|
||||||
// Instantiate classes after WooCommerce is loaded
|
|
||||||
add_action('woocommerce_loaded', array($this, 'init_classes'));
|
|
||||||
}
|
|
||||||
|
|
||||||
public function init_classes() {
|
|
||||||
new WC_TPP_Admin();
|
|
||||||
new WC_TPP_Product_Meta();
|
|
||||||
new WC_TPP_Frontend();
|
|
||||||
new WC_TPP_Cart();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function declare_hpos_compatibility() {
|
|
||||||
if (class_exists(\Automattic\WooCommerce\Utilities\FeaturesUtil::class)) {
|
|
||||||
\Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility('custom_order_tables', __FILE__, true);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public function load_textdomain() {
|
private function init_hooks() {
|
||||||
load_plugin_textdomain('wc-tier-package-prices', false, dirname(WC_TPP_PLUGIN_BASENAME) . '/languages');
|
add_action('plugins_loaded', array($this, 'load_textdomain'));
|
||||||
}
|
add_action('before_woocommerce_init', array($this, 'declare_hpos_compatibility'));
|
||||||
|
register_activation_hook(__FILE__, array($this, 'activate'));
|
||||||
|
register_deactivation_hook(__FILE__, array($this, 'deactivate'));
|
||||||
|
}
|
||||||
|
|
||||||
public function activate() {
|
private function includes() {
|
||||||
// Add default options
|
require_once WC_TPP_PLUGIN_DIR . 'includes/class-wc-tpp-template-loader.php';
|
||||||
add_option('wc_tpp_enable_tier_pricing', 'yes');
|
require_once WC_TPP_PLUGIN_DIR . 'includes/class-wc-tpp-admin.php';
|
||||||
add_option('wc_tpp_enable_package_pricing', 'yes');
|
require_once WC_TPP_PLUGIN_DIR . 'includes/class-wc-tpp-product-meta.php';
|
||||||
add_option('wc_tpp_display_table', 'yes');
|
require_once WC_TPP_PLUGIN_DIR . 'includes/class-wc-tpp-frontend.php';
|
||||||
flush_rewrite_rules();
|
require_once WC_TPP_PLUGIN_DIR . 'includes/class-wc-tpp-cart.php';
|
||||||
}
|
|
||||||
|
|
||||||
public function deactivate() {
|
// Instantiate classes after WooCommerce is loaded
|
||||||
flush_rewrite_rules();
|
add_action('woocommerce_loaded', array($this, 'init_classes'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function init_classes() {
|
||||||
|
new WC_TPP_Admin();
|
||||||
|
new WC_TPP_Product_Meta();
|
||||||
|
new WC_TPP_Frontend();
|
||||||
|
new WC_TPP_Cart();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function declare_hpos_compatibility() {
|
||||||
|
if (class_exists(\Automattic\WooCommerce\Utilities\FeaturesUtil::class)) {
|
||||||
|
\Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility('custom_order_tables', __FILE__, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function load_textdomain() {
|
||||||
|
load_plugin_textdomain('wc-tier-package-prices', false, dirname(WC_TPP_PLUGIN_BASENAME) . '/languages');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function activate() {
|
||||||
|
// Add default options
|
||||||
|
add_option('wc_tpp_enable_tier_pricing', 'yes');
|
||||||
|
add_option('wc_tpp_enable_package_pricing', 'yes');
|
||||||
|
add_option('wc_tpp_display_table', 'yes');
|
||||||
|
flush_rewrite_rules();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deactivate() {
|
||||||
|
flush_rewrite_rules();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user