golden hour
/home/godaofbq/hyperxmed.com/wp-content/plugins/shopengine/widgets
⬆️ Go Up
Upload
File/Folder
Size
Actions
add-to-cart
-
Del
OK
additional-information
-
Del
OK
advanced-search
-
Del
OK
archive-description
-
Del
OK
archive-products
-
Del
OK
archive-result-count
-
Del
OK
archive-title
-
Del
OK
archive-view-mode
-
Del
OK
breadcrumbs
-
Del
OK
cart-table
-
Del
OK
cart-totals
-
Del
OK
checkout-coupon-form
-
Del
OK
checkout-form-additional
-
Del
OK
checkout-form-billing
-
Del
OK
checkout-form-login
-
Del
OK
checkout-form-shipping
-
Del
OK
checkout-payment
-
Del
OK
checkout-review-order
-
Del
OK
checkout-shipping-methods
-
Del
OK
cross-sells
-
Del
OK
deal-products
-
Del
OK
empty-cart-message
-
Del
OK
filter-orderby
-
Del
OK
filter-products-per-page
-
Del
OK
filterable-product-list
-
Del
OK
init
-
Del
OK
lazy-cache.php
2.7 KB
Del
OK
manifest.php
3.08 KB
Del
OK
notice
-
Del
OK
prod-short-code.php
1.6 KB
Del
OK
product-categories
-
Del
OK
product-category-lists
-
Del
OK
product-description
-
Del
OK
product-excerpt
-
Del
OK
product-image
-
Del
OK
product-list
-
Del
OK
product-meta
-
Del
OK
product-price
-
Del
OK
product-rating
-
Del
OK
product-review
-
Del
OK
product-share
-
Del
OK
product-sku
-
Del
OK
product-stock
-
Del
OK
product-tabs
-
Del
OK
product-tags
-
Del
OK
product-title
-
Del
OK
products.php
6.42 KB
Del
OK
recently-viewed-products
-
Del
OK
related
-
Del
OK
return-to-shop
-
Del
OK
shop.php
9.14 KB
Del
OK
up-sells
-
Del
OK
view-single-product
-
Del
OK
widget-helper.php
7.99 KB
Del
OK
Edit: lazy-cache.php
<?php namespace ShopEngine\Widgets; use ShopEngine\Modules\Swatches\Swatches; defined('ABSPATH') || exit; trait Lazy_Cache { private $cache_objects; private function cache($query_type, $query_arg) { $cache_key = $this->generate_key_hash($query_type, $query_arg); if(isset($this->cache_objects[$cache_key])) { return $this->cache_objects[$cache_key]; } switch($query_type) { default: case 'wc_get_products': $query_object = wc_get_products($query_arg); break; case 'wc_get_orders-woocommerce_my_account_my_orders_query': $query_object = wc_get_orders( apply_filters( 'woocommerce_my_account_my_orders_query', $query_arg ) ); break; case 'wc_get_orders': $query_object = wc_get_orders($query_arg); break; case 'get_posts': $query_object = get_posts($query_arg); break; case 'wc_get_product': $query_object = wc_get_product($query_arg); break; case 'get_post_meta': $query_object = get_post_meta($query_arg[0], $query_arg[1], $query_arg[2]); break; case 'get_all_color_terms': $query_object = $this->get_custom_terms(Swatches::PA_COLOR, 'color'); break; case 'get_all_image_terms': $query_object = $this->get_custom_terms(Swatches::PA_IMAGE, 'image'); break; case 'get_all_label_terms': $query_object = $this->get_custom_terms(Swatches::PA_LABEL, 'label'); break; } $this->cache_objects[$cache_key] = $query_object; return $query_object; } public function get_custom_terms($option_key, $key) { $attribute_taxonomies = wc_get_attribute_taxonomies(); $taxonomy_terms = []; if(!empty($attribute_taxonomies)) { foreach($attribute_taxonomies as $tax) { if($option_key === $tax->attribute_type) { $attribute_name = wc_attribute_taxonomy_name($tax->attribute_name); if(taxonomy_exists($attribute_name)) { $taxonomy_terms[$tax->attribute_name] = get_terms($attribute_name, 'hide_empty=0'); } } } } $terms = $this->array_flatten($taxonomy_terms); if(is_array($terms) && !empty($terms)) { foreach($terms as $term) { $term_id = $term->term_id; $meta_value = get_term_meta($term_id, $option_key, true); $term->{$key} = $meta_value; } } return $terms; } public function array_flatten($array) { if(!is_array($array)) { return false; } $result = []; foreach($array as $key => $value) { if(is_array($value)) { $result = array_merge($result, $this->array_flatten($value)); } else { $result[$key] = $value; } } return $result; } public function get_cache_objects() { return $this->cache_objects; } private function generate_key_hash($string, $array) { return $string . md5(serialize($array)); } }
Save