PluginProbe ʕ •ᴥ•ʔ
ShopEngine Elementor WooCommerce Builder Addon – All in One WooCommerce Solution / 1.0.0
ShopEngine Elementor WooCommerce Builder Addon – All in One WooCommerce Solution v1.0.0
4.9.1 4.9.0 2.0.0 2.1.0 2.2.0 2.2.1 2.2.2 2.3.0 2.4.0 2.5.0 2.5.1 3.0.0 3.1.0 3.1.1 4.0.0 4.0.1 4.1.0 4.1.1 4.2.0 4.2.1 4.3.0 4.3.1 4.4.0 4.5.0 4.5.1 4.6.0 4.6.1 4.6.2 4.6.3 4.6.4 4.6.5 4.6.6 4.6.7 4.6.8 4.6.9 4.7.0 4.7.1 4.7.2 4.7.3 4.7.4 4.7.5 4.7.6 4.7.7 4.7.8 4.7.9 4.8.0 4.8.1 4.8.2 4.8.3 4.8.4 4.8.5 4.8.6 4.8.7 4.8.8 4.8.9 trunk 0.1.2-beta 0.1.3-beta 0.1.4-beta 1.0.0 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.2.1 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.4.0 1.4.1 1.5.0 1.5.1 1.6.0 1.6.1 1.7.0 1.8.0 1.8.1 1.9.0
shopengine / widgets / widget-helper.php
shopengine / widgets Last commit date
account-address 5 years ago account-dashboard 5 years ago account-details 5 years ago account-downloads 5 years ago account-form-login 5 years ago account-form-register 5 years ago account-logout 5 years ago account-navigation 5 years ago account-order-details 5 years ago account-orders 5 years ago add-to-cart 5 years ago additional-information 5 years ago advanced-search 5 years ago archive-description 5 years ago archive-products 5 years ago archive-result-count 5 years ago archive-title 5 years ago archive-view-mode 5 years ago breadcrumbs 5 years ago cart-table 5 years ago cart-totals 5 years ago categories 5 years ago checkout-coupon-form 5 years ago checkout-form-additional 5 years ago checkout-form-billing 5 years ago checkout-form-login 5 years ago checkout-form-shipping 5 years ago checkout-payment 5 years ago checkout-review-order 5 years ago checkout-shipping-methods 5 years ago cross-sells 5 years ago deal-products 5 years ago empty-cart-message 5 years ago filter-orderby 5 years ago filter-products-per-page 5 years ago filterable-product-list 5 years ago init 5 years ago product-categories 5 years ago product-category-lists 5 years ago product-description 5 years ago product-excerpt 5 years ago product-filters 5 years ago product-image 5 years ago product-list 5 years ago product-meta 5 years ago product-price 5 years ago product-rating 5 years ago product-review 5 years ago product-share 5 years ago product-sku 5 years ago product-stock 5 years ago product-tabs 5 years ago product-tags 5 years ago product-title 5 years ago recently-viewed-products 5 years ago related 5 years ago return-to-shop 5 years ago thankyou-address-details 5 years ago thankyou-order-confirm 5 years ago thankyou-order-details 5 years ago thankyou-thankyou 5 years ago up-sells 5 years ago lazy-cache.php 5 years ago manifest.php 5 years ago prod-short-code.php 5 years ago products.php 5 years ago shop.php 5 years ago widget-helper.php 5 years ago
widget-helper.php
187 lines
1 <?php
2
3 namespace ShopEngine\Widgets;
4
5 use ShopEngine\Traits\Singleton;
6
7 class Widget_Helper {
8
9 use Singleton;
10
11 public function wc_template_filter_by_match($match, $replace_with) {
12
13 add_filter(
14 'wc_get_template',
15 function (
16 $template,
17 $template_name = '',
18 $args = '',
19 $template_path = '',
20 $default_path = ''
21 ) use ($match, $replace_with) {
22
23 if(strpos($template, $match) !== false) {
24
25 $template = WC_ABSPATH . $replace_with;
26
27 return $template;
28 }
29
30 return $template;
31 }
32 );
33 }
34
35 public function wc_template_part_filter_by_match($match, $replace_with) {
36
37 add_filter('wc_get_template_part', function ($template, $slug = '', $name = '') use ($match, $replace_with) {
38
39 if(strpos($template, $match) !== false) {
40
41 $template = WC_ABSPATH . $replace_with;
42 }
43
44 return $template;
45 });
46 }
47
48 public function wc_template_part_filter() {
49
50 add_filter('wc_get_template_part', function ($template, $slug = '', $name = '') {
51
52 if(strpos($template, 'woocommerce/content-product.php') !== false) {
53
54 $template = WC_ABSPATH . 'templates/content-product.php';
55
56 }elseif(strpos($template, 'woocommerce/content-product-base.php') !== false) {
57
58 //$template = WC_ABSPATH . 'templates/content-product.php';
59
60 }
61
62 return $template;
63
64 }, 999);
65 }
66
67
68 public function wc_template_filter() {
69
70 add_filter('wc_get_template', function ($template, $template_name = '', $args = '', $template_path = '', $default_path = '') {
71
72 if(strpos($template, 'woocommerce/global/breadcrumb.php') !== false) {
73
74 $template = WC_ABSPATH . 'templates/global/breadcrumb.php';
75
76 }elseif(strpos($template, 'single-product/up-sells.php') !== false) {
77
78 $template = WC_ABSPATH . 'templates/single-product/up-sells.php';
79
80 } elseif(strpos($template, 'woocommerce/loop/loop-start.php') !== false) {
81
82 $template = WC_ABSPATH . 'templates/loop/loop-start.php';
83
84 } elseif(strpos($template, 'woocommerce/loop/loop-end.php') !== false) {
85
86 $template = WC_ABSPATH . 'templates/loop/loop-end.php';
87
88 } elseif(strpos($template, 'woocommerce/global/wrapper-end.php') !== false) {
89
90 $template = WC_ABSPATH . 'templates/global/wrapper-end.php';
91
92 } elseif(strpos($template, 'woocommerce/global/wrapper-start.php') !== false) {
93
94 $template = WC_ABSPATH . 'templates/global/wrapper-start.php';
95
96 } elseif(strpos($template, 'woocommerce/loop/sale-flash.php') !== false) {
97
98 $template = WC_ABSPATH . 'templates/loop/sale-flash.php';
99
100 } elseif(strpos($template, 'woocommerce/single-product/product-image.php') !== false) {
101
102 $template = WC_ABSPATH.'templates/single-product/product-image.php';
103
104 } elseif(strpos($template, 'woocommerce/single-product/product-thumbnails.php') !== false) {
105
106 $template = WC_ABSPATH.'templates/single-product/product-thumbnails.php';
107
108 } elseif(strpos($template, 'woocommerce/global/wrapper-end.php') !== false) {
109
110 $template = WC_ABSPATH.'templates/global/wrapper-end.php';
111
112 } elseif(strpos($template, 'woocommerce/global/wrapper-start.php') !== false) {
113
114 $template = WC_ABSPATH.'templates/global/wrapper-start.php';
115
116 } elseif(strpos($template, 'woocommerce/loop/result-count.php') !== false) {
117
118 $template = WC_ABSPATH.'templates/loop/result-count.php';
119
120 } elseif(strpos($template, 'woocommerce/loop/rating.php') !== false) {
121
122 $template = WC_ABSPATH.'templates/loop/rating.php';
123
124 } elseif(strpos($template, 'woocommerce/loop/add-to-cart.php') !== false) {
125
126 $template = WC_ABSPATH.'templates/loop/add-to-cart.php';
127
128 } elseif(strpos($template, 'woocommerce/single-product/product-thumbnails.php') !== false) {
129
130 $template = WC_ABSPATH.'templates/single-product/product-thumbnails.php';
131
132 } elseif(strpos($template, 'woocommerce/single-product/product-image.php') !== false) {
133
134 $template = WC_ABSPATH.'templates/single-product/product-image.php';
135
136 } elseif(strpos($template, 'woocommerce/single-product/related.php') !== false) {
137
138 $template = WC_ABSPATH.'templates/single-product/related.php';
139
140 } elseif(strpos($template, 'woocommerce/single-product/up-sells.php') !== false) {
141
142 $template = WC_ABSPATH.'templates/single-product/up-sells.php';
143 }
144
145 return $template;
146 }, 999);
147 }
148
149
150 public function wc_breadcrumb_default_filter($iconClass) {
151
152 add_filter('woocommerce_breadcrumb_defaults', function ($param) use ($iconClass) {
153
154 $param['delimiter'] = '<i class="' . $iconClass . '" aria-hidden="true"></i>';
155 $param['wrap_before'] = '<nav class="woocommerce-breadcrumb">';
156 $param['wrap_after'] = '</nav>';
157
158 return $param;
159 }, 999);
160 }
161
162 public function comment_template_filter_checker() {
163
164 add_filter('comments_template', function ($template) {
165
166 if(strpos($template, '/single-product-advanced-reviews.php') !== false) {
167
168 /**
169 * Fix for electro theme.................
170 */
171
172 $template = WC_ABSPATH . 'templates/single-product-reviews.php';
173
174 } elseif(strpos($template, '/woocommerce/single-product-reviews.php') !== false) {
175
176 /**
177 * Fix for all other theme.................
178 */
179
180 $template = WC_ABSPATH . 'templates/single-product-reviews.php';
181 }
182
183 return $template;
184 }, 999);
185 }
186 }
187