| @@ -66,9 +66,8 @@ | ||
| 66 | 66 | */ |
| 67 | 67 | |
| 68 | 68 | /** |
| 69 | 69 | * URL for fetch API |
| 70 | - * | |
| 71 | 70 | * @var string |
| 72 | 71 | */ |
| 73 | 72 | public $BASE_API = 'https://shopbuilderwp.com/wp-json/rtsb/v1/layouts/'; |
| 74 | 73 | |
| @@ -91,17 +90,18 @@ | ||
| 91 | 90 | register_deactivation_hook( RTSB_FILE, [ Installation::class, 'deactivation' ] ); |
| 92 | 91 | |
| 93 | 92 | SupportController::instance(); |
| 94 | 93 | |
| 95 | - // HPOS Declare compatibility. | |
| 94 | + // HPOS Declare compatibility | |
| 96 | 95 | add_action( |
| 97 | 96 | 'before_woocommerce_init', |
| 98 | - function () { | |
| 97 | + function() { | |
| 99 | 98 | if ( class_exists( \Automattic\WooCommerce\Utilities\FeaturesUtil::class ) ) { |
| 100 | 99 | \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', RTSB_FILE, true ); |
| 101 | 100 | } |
| 102 | 101 | } |
| 103 | 102 | ); |
| 103 | + | |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | /** |
| 107 | 107 | * Constants |
| @@ -115,8 +115,9 @@ | ||
| 115 | 115 | |
| 116 | 116 | if ( ! defined( 'RTSB_URL' ) ) { |
| 117 | 117 | define( 'RTSB_URL', plugins_url( '', RTSB_FILE ) ); |
| 118 | 118 | } |
| 119 | + | |
| 119 | 120 | } |
| 120 | 121 | |
| 121 | 122 | |
| 122 | 123 | /** |
| @@ -216,13 +217,22 @@ | ||
| 216 | 217 | * @return ShopBuilder |
| 217 | 218 | */ |
| 218 | 219 | function rtsb() { |
| 219 | 220 | static $cached_instance; |
| 220 | - if ( null !== $cached_instance ) { | |
| 221 | + | |
| 222 | + if (null !== $cached_instance) { | |
| 221 | 223 | return $cached_instance; |
| 222 | 224 | } |
| 223 | - $cached_instance = ShopBuilder::instance(); | |
| 225 | + | |
| 226 | + $cached_instance = wp_cache_get('shopbuilder_instance', 'shopbuilder_cache'); | |
| 227 | + | |
| 228 | + if (false === $cached_instance) { | |
| 229 | + $cached_instance = ShopBuilder::instance(); | |
| 230 | + wp_cache_set('shopbuilder_instance', $cached_instance, 'shopbuilder_cache'); | |
| 231 | + } | |
| 232 | + | |
| 224 | 233 | return $cached_instance; |
| 225 | 234 | } |
| 235 | + | |
| 226 | 236 | |
| 227 | 237 | rtsb(); |
| 228 | 238 | } |