diff --git a/readme.txt b/readme.txt index 9be832562fa..6667a45274d 100644 --- a/readme.txt +++ b/readme.txt @@ -171,6 +171,7 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woothemes/wooc * Fix - Payment method animation on the checkout. * Fix - Updated chosen library. * Fix - Saving of attributes/variations with custom product-level attributes. +* Fix - Include once to prevent class exist errors with widgets. = 2.0.1 - 04/03/2013 = * Fix - Added an extra permalink flush after upgrade to save needing to do it manually. diff --git a/woocommerce.php b/woocommerce.php index 3c221578937..2a7eb7d19f6 100644 --- a/woocommerce.php +++ b/woocommerce.php @@ -191,7 +191,7 @@ class Woocommerce { $file = 'class-' . str_replace( '_', '-', $class ) . '.php'; if ( is_readable( $path . $file ) ) { - include( $path . $file ); + include_once( $path . $file ); return; } @@ -201,7 +201,7 @@ class Woocommerce { $file = 'class-' . str_replace( '_', '-', $class ) . '.php'; if ( is_readable( $path . $file ) ) { - include( $path . $file ); + include_once( $path . $file ); return; } @@ -211,7 +211,7 @@ class Woocommerce { $file = 'class-' . str_replace( '_', '-', $class ) . '.php'; if ( is_readable( $path . $file ) ) { - include( $path . $file ); + include_once( $path . $file ); return; } } @@ -222,7 +222,7 @@ class Woocommerce { $file = 'class-' . str_replace( '_', '-', $class ) . '.php'; if ( is_readable( $path . $file ) ) { - include( $path . $file ); + include_once( $path . $file ); return; } } @@ -270,25 +270,25 @@ class Woocommerce { $this->frontend_includes(); // Functions - include( 'woocommerce-core-functions.php' ); // Contains core functions for the front/back end + include_once( 'woocommerce-core-functions.php' ); // Contains core functions for the front/back end // Include abstract classes - include( 'classes/abstracts/abstract-wc-product.php' ); // Products - include( 'classes/abstracts/abstract-wc-settings-api.php' ); // Settings API (for gateways, shipping, and integrations) - include( 'classes/abstracts/abstract-wc-shipping-method.php' ); // A Shipping method - include( 'classes/abstracts/abstract-wc-payment-gateway.php' ); // A Payment gateway - include( 'classes/abstracts/abstract-wc-integration.php' ); // An integration with a service + include_once( 'classes/abstracts/abstract-wc-product.php' ); // Products + include_once( 'classes/abstracts/abstract-wc-settings-api.php' ); // Settings API (for gateways, shipping, and integrations) + include_once( 'classes/abstracts/abstract-wc-shipping-method.php' ); // A Shipping method + include_once( 'classes/abstracts/abstract-wc-payment-gateway.php' ); // A Payment gateway + include_once( 'classes/abstracts/abstract-wc-integration.php' ); // An integration with a service // Classes (used on all pages) - include( 'classes/class-wc-product-factory.php' ); // Product factory - include( 'classes/class-wc-countries.php' ); // Defines countries and states - include( 'classes/class-wc-integrations.php' ); // Loads integrations + include_once( 'classes/class-wc-product-factory.php' ); // Product factory + include_once( 'classes/class-wc-countries.php' ); // Defines countries and states + include_once( 'classes/class-wc-integrations.php' ); // Loads integrations // Include Core Integrations - these are included sitewide - include( 'classes/integrations/google-analytics/class-wc-google-analytics.php' ); - include( 'classes/integrations/sharethis/class-wc-sharethis.php' ); - include( 'classes/integrations/shareyourcart/class-wc-shareyourcart.php' ); - include( 'classes/integrations/sharedaddy/class-wc-sharedaddy.php' ); + include_once( 'classes/integrations/google-analytics/class-wc-google-analytics.php' ); + include_once( 'classes/integrations/sharethis/class-wc-sharethis.php' ); + include_once( 'classes/integrations/shareyourcart/class-wc-shareyourcart.php' ); + include_once( 'classes/integrations/sharedaddy/class-wc-sharedaddy.php' ); } @@ -299,7 +299,7 @@ class Woocommerce { * @return void */ public function admin_includes() { - include( 'admin/woocommerce-admin-init.php' ); // Admin section + include_once( 'admin/woocommerce-admin-init.php' ); // Admin section } @@ -310,7 +310,7 @@ class Woocommerce { * @return void */ public function ajax_includes() { - include( 'woocommerce-ajax.php' ); // Ajax functions for admin and the front-end + include_once( 'woocommerce-ajax.php' ); // Ajax functions for admin and the front-end } @@ -322,17 +322,17 @@ class Woocommerce { */ public function frontend_includes() { // Functions - include( 'woocommerce-hooks.php' ); // Template hooks used on the front-end - include( 'woocommerce-functions.php' ); // Contains functions for various front-end events + include_once( 'woocommerce-hooks.php' ); // Template hooks used on the front-end + include_once( 'woocommerce-functions.php' ); // Contains functions for various front-end events // Classes - include( 'classes/class-wc-query.php' ); // The main store queries - include( 'classes/class-wc-cart.php' ); // The main cart class - include( 'classes/class-wc-tax.php' ); // Tax class - include( 'classes/class-wc-customer.php' ); // Customer class - include( 'classes/abstracts/abstract-wc-session.php' ); // Abstract for session implementations - include( 'classes/class-wc-session-handler.php' ); // WC Session class - include( 'classes/class-wc-shortcodes.php' ); // Shortcodes class + include_once( 'classes/class-wc-query.php' ); // The main store queries + include_once( 'classes/class-wc-cart.php' ); // The main cart class + include_once( 'classes/class-wc-tax.php' ); // Tax class + include_once( 'classes/class-wc-customer.php' ); // Customer class + include_once( 'classes/abstracts/abstract-wc-session.php' ); // Abstract for session implementations + include_once( 'classes/class-wc-session-handler.php' ); // WC Session class + include_once( 'classes/class-wc-shortcodes.php' ); // Shortcodes class } @@ -343,7 +343,7 @@ class Woocommerce { * @return void */ public function include_template_functions() { - include( 'woocommerce-template.php' ); + include_once( 'woocommerce-template.php' ); } @@ -389,22 +389,22 @@ class Woocommerce { */ function register_widgets() { // Include - no need to use autoload as WP loads them anyway - include( 'classes/widgets/class-wc-widget-cart.php' ); - include( 'classes/widgets/class-wc-widget-featured-products.php' ); - include( 'classes/widgets/class-wc-widget-layered-nav.php' ); - include( 'classes/widgets/class-wc-widget-layered-nav-filters.php' ); - include( 'classes/widgets/class-wc-widget-price-filter.php' ); - include( 'classes/widgets/class-wc-widget-product-categories.php' ); - include( 'classes/widgets/class-wc-widget-product-search.php' ); - include( 'classes/widgets/class-wc-widget-product-tag-cloud.php' ); - include( 'classes/widgets/class-wc-widget-recent-products.php' ); - include( 'classes/widgets/class-wc-widget-top-rated-products.php' ); - include( 'classes/widgets/class-wc-widget-recent-reviews.php' ); - include( 'classes/widgets/class-wc-widget-recently-viewed.php' ); - include( 'classes/widgets/class-wc-widget-best-sellers.php' ); - include( 'classes/widgets/class-wc-widget-onsale.php' ); - include( 'classes/widgets/class-wc-widget-login.php' ); - include( 'classes/widgets/class-wc-widget-random-products.php' ); + include_once( 'classes/widgets/class-wc-widget-cart.php' ); + include_once( 'classes/widgets/class-wc-widget-featured-products.php' ); + include_once( 'classes/widgets/class-wc-widget-layered-nav.php' ); + include_once( 'classes/widgets/class-wc-widget-layered-nav-filters.php' ); + include_once( 'classes/widgets/class-wc-widget-price-filter.php' ); + include_once( 'classes/widgets/class-wc-widget-product-categories.php' ); + include_once( 'classes/widgets/class-wc-widget-product-search.php' ); + include_once( 'classes/widgets/class-wc-widget-product-tag-cloud.php' ); + include_once( 'classes/widgets/class-wc-widget-recent-products.php' ); + include_once( 'classes/widgets/class-wc-widget-top-rated-products.php' ); + include_once( 'classes/widgets/class-wc-widget-recent-reviews.php' ); + include_once( 'classes/widgets/class-wc-widget-recently-viewed.php' ); + include_once( 'classes/widgets/class-wc-widget-best-sellers.php' ); + include_once( 'classes/widgets/class-wc-widget-onsale.php' ); + include_once( 'classes/widgets/class-wc-widget-login.php' ); + include_once( 'classes/widgets/class-wc-widget-random-products.php' ); // Register widgets register_widget( 'WC_Widget_Recent_Products' ); @@ -1983,4 +1983,4 @@ class Woocommerce { */ $GLOBALS['woocommerce'] = new Woocommerce(); -} // class_exists check +} // class_exists check \ No newline at end of file