PluginProbe ʕ •ᴥ•ʔ
ShopEngine Elementor WooCommerce Builder Addon – All in One WooCommerce Solution / 4.9.2
ShopEngine Elementor WooCommerce Builder Addon – All in One WooCommerce Solution v4.9.2
4.9.2 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
add-to-cart 6 days ago additional-information 3 years ago advanced-search 1 year ago archive-description 3 years ago archive-products 6 days ago archive-result-count 2 years ago archive-title 1 year ago archive-view-mode 2 years ago breadcrumbs 4 years ago call-for-price 10 months ago cart-table 6 days ago cart-totals 6 days ago checkout-coupon-form 6 days ago checkout-form-additional 3 years ago checkout-form-billing 2 years ago checkout-form-login 3 years ago checkout-form-shipping 6 days ago checkout-payment 3 years ago checkout-review-order 2 years ago checkout-shipping-methods 2 years ago cross-sells 6 days ago deal-products 2 years ago empty-cart-message 2 years ago filter-orderby 2 years ago filter-products-per-page 3 years ago filterable-product-list 1 year ago init 6 days ago notice 2 years ago product-categories 3 years ago product-category-lists 1 year ago product-description 2 years ago product-excerpt 3 years ago product-image 1 year ago product-list 6 days ago product-meta 2 years ago product-price 3 years ago product-rating 6 days ago product-review 2 years ago product-share 2 years ago product-sku 3 years ago product-stock 10 months ago product-tabs 6 days ago product-tags 3 years ago product-title 2 years ago qr-code 10 months ago recently-viewed-products 1 year ago related 6 days ago return-to-shop 2 years ago up-sells 6 days ago view-single-product 3 years ago lazy-cache.php 3 years ago manifest.php 6 days ago prod-short-code.php 2 years ago products.php 3 years ago shop.php 3 years ago widget-helper.php 6 days ago
widget-helper.php
275 lines
1 <?php
2
3 namespace ShopEngine\Widgets;
4
5 defined('ABSPATH') || exit;
6
7 use ShopEngine\Traits\Singleton;
8 class Widget_Helper {
9
10 use Singleton;
11
12 public function wc_template_filter_by_match($match, $replace_with) {
13
14 add_filter(
15 'wc_get_template',
16 function (
17 $template,
18 $template_name = '',
19 $args = '',
20 $template_path = '',
21 $default_path = ''
22 ) use ($match, $replace_with) {
23
24 if(strpos($template, $match) !== false) {
25
26 $template = WC_ABSPATH . $replace_with;
27
28 return $template;
29 }
30
31 return $template;
32 }
33 );
34 }
35
36 public function wc_template_part_filter_by_match($match, $replace_with) {
37
38 add_filter('wc_get_template_part', function ($template, $slug = '', $name = '') use ($match, $replace_with) {
39
40 if(strpos($template, $match) !== false) {
41
42 $template = WC_ABSPATH . $replace_with;
43 }
44
45 return $template;
46 });
47 }
48
49 public function wc_template_part_filter() {
50
51 add_filter('wc_get_template_part', function ($template, $slug = '', $name = '') {
52
53 if(strpos($template, 'woocommerce/content-product.php') !== false) {
54
55 $template = WC_ABSPATH . 'templates/content-product.php';
56
57 } elseif(strpos($template, 'woocommerce/content-product-base.php') !== false) {
58
59 //$template = WC_ABSPATH . 'templates/content-product.php';
60
61 }
62
63 return $template;
64 }, 999);
65 }
66
67 /**
68 * replace single woocommerce template .
69 * alternative function for wc_template_part_filter_by_match, wc_template_filter_by_match
70 *
71 * @param $needle
72 * @param string $filter_tag
73 */
74 public function wc_template_replace( $needle, $filter_tag = 'wc_get_template' ) {
75 add_filter( $filter_tag, function ( $template ) use ( $needle ) {
76
77 if ( strpos( $template, 'woocommerce/' . $needle ) !== false ) {
78 $template = WC_ABSPATH . 'templates/' . $needle;
79 }
80 return $template;
81 }, 999 );
82 }
83
84 /**
85 * replace multiple woocommerce templates .
86 * alternative function for wc_template_part_filter_by_match, wc_template_filter_by_match, wc_template_part_filter,wc_template_filter
87 *
88 * @param $needles
89 * @param string $filter_tag
90 */
91 public function wc_template_replace_multiple( $needles, $filter_tag = 'wc_get_template' ) {
92 add_filter($filter_tag, function ($template) use($needles){
93
94 foreach ($needles as $needle){
95 if(strpos($template, 'woocommerce/'.$needle) !== false) {
96 $template = WC_ABSPATH . 'templates/'.$needle;
97 break;
98 }
99 }
100 return $template;
101 }, 999);
102 }
103
104 public function wc_template_filter() {
105
106 add_filter('wc_get_template', function ($template, $template_name = '', $args = '', $template_path = '', $default_path = '') {
107
108 if(strpos($template, 'woocommerce/global/breadcrumb.php') !== false) {
109
110 $template = WC_ABSPATH . 'templates/global/breadcrumb.php';
111
112 } elseif(strpos($template, 'single-product/up-sells.php') !== false) {
113
114 $template = WC_ABSPATH . 'templates/single-product/up-sells.php';
115
116 } elseif(strpos($template, 'woocommerce/loop/loop-start.php') !== false) {
117
118 $template = WC_ABSPATH . 'templates/loop/loop-start.php';
119
120 } elseif(strpos($template, 'woocommerce/loop/loop-end.php') !== false) {
121
122 $template = WC_ABSPATH . 'templates/loop/loop-end.php';
123
124 } elseif(strpos($template, 'woocommerce/global/wrapper-end.php') !== false) {
125
126 $template = WC_ABSPATH . 'templates/global/wrapper-end.php';
127
128 } elseif(strpos($template, 'woocommerce/global/wrapper-start.php') !== false) {
129
130 $template = WC_ABSPATH . 'templates/global/wrapper-start.php';
131
132 } elseif(strpos($template, 'woocommerce/loop/sale-flash.php') !== false) {
133
134 $template = WC_ABSPATH . 'templates/loop/sale-flash.php';
135
136 } elseif(strpos($template, 'woocommerce/single-product/product-image.php') !== false) {
137
138 $template = WC_ABSPATH . 'templates/single-product/product-image.php';
139
140 } elseif(strpos($template, 'woocommerce/single-product/product-thumbnails.php') !== false) {
141
142 $template = WC_ABSPATH . 'templates/single-product/product-thumbnails.php';
143
144 } elseif(strpos($template, 'woocommerce/global/wrapper-end.php') !== false) {
145
146 $template = WC_ABSPATH . 'templates/global/wrapper-end.php';
147
148 } elseif(strpos($template, 'woocommerce/global/wrapper-start.php') !== false) {
149
150 $template = WC_ABSPATH . 'templates/global/wrapper-start.php';
151
152 } elseif(strpos($template, 'woocommerce/loop/result-count.php') !== false) {
153
154 $template = WC_ABSPATH . 'templates/loop/result-count.php';
155
156 } elseif(strpos($template, 'woocommerce/loop/rating.php') !== false) {
157
158 $template = WC_ABSPATH . 'templates/loop/rating.php';
159
160 } elseif(strpos($template, 'woocommerce/loop/add-to-cart.php') !== false) {
161
162 $template = WC_ABSPATH . 'templates/loop/add-to-cart.php';
163
164 } elseif(strpos($template, 'woocommerce/single-product/product-thumbnails.php') !== false) {
165
166 $template = WC_ABSPATH . 'templates/single-product/product-thumbnails.php';
167
168 } elseif(strpos($template, 'woocommerce/single-product/product-image.php') !== false) {
169
170 $template = WC_ABSPATH . 'templates/single-product/product-image.php';
171
172 } elseif(strpos($template, 'woocommerce/single-product/related.php') !== false) {
173
174 $template = WC_ABSPATH . 'templates/single-product/related.php';
175
176 } elseif(strpos($template, 'woocommerce/single-product/up-sells.php') !== false) {
177
178 $template = WC_ABSPATH . 'templates/single-product/up-sells.php';
179
180 } elseif(strpos($template, 'woocommerce/cart/cross-sells.php') !== false) {
181
182 $template = WC_ABSPATH . 'templates/cart/cross-sells.php';
183
184 } elseif(strpos($template, 'woocommerce/cart/cart-shipping.php') !== false) {
185
186 $template = WC_ABSPATH . 'templates/cart/cart-shipping.php';
187
188 } elseif(strpos($template, 'woocommerce/myaccount/my-address.php') !== false) {
189
190 $template = WC_ABSPATH.'templates/myaccount/my-address.php';
191
192 } elseif(strpos($template, 'woocommerce/myaccount/dashboard.php') !== false) {
193
194 $template = WC_ABSPATH.'templates/myaccount/dashboard.php';
195
196 } elseif(strpos($template, 'woocommerce/order/order-details.php') !== false) {
197
198 $template = WC_ABSPATH.'templates/order/order-details.php';
199
200 } elseif(strpos($template, 'woocommerce/order/order-downloads.php') !== false) {
201
202 $template = WC_ABSPATH.'templates/order/order-downloads.php';
203
204 } elseif(strpos($template, 'woocommerce/content-product.php') !== false) {
205
206 $template = WC_ABSPATH . 'templates/content-product.php';
207
208 } elseif(strpos($template, 'woocommerce/order/order-details-customer.php') !== false) {
209
210 $template = WC_ABSPATH.'templates/order/order-details-customer.php';
211
212 } elseif(strpos($template, 'woocommerce/loop/pagination.php') !== false) {
213
214 $template = WC_ABSPATH.'templates/loop/pagination.php';
215
216 } elseif(strpos($template, 'woocommerce/myaccount/orders.php') !== false) {
217
218 $template = WC_ABSPATH.'templates/myaccount/orders.php';
219
220 } elseif(strpos($template, 'woocommerce/myaccount/downloads.php') !== false) {
221
222 $template = WC_ABSPATH.'templates/myaccount/downloads.php';
223
224 } elseif(strpos($template, 'woocommerce/checkout/terms.php') !== false) {
225
226 $template = WC_ABSPATH.'templates/checkout/terms.php';
227
228 } elseif(strpos($template, 'woocommerce/myaccount/payment-methods.php') !== false) {
229
230 $template = WC_ABSPATH.'templates/myaccount/payment-methods.php';
231
232 }
233 return $template;
234 }, 999);
235 }
236
237
238 public function wc_breadcrumb_default_filter($iconClass) {
239
240 add_filter('woocommerce_breadcrumb_defaults', function ($param) use ($iconClass) {
241
242 $param['delimiter'] = '<i class="' . $iconClass . '" aria-hidden="true"></i>';
243 $param['wrap_before'] = '<nav class="woocommerce-breadcrumb">';
244 $param['wrap_after'] = '</nav>';
245
246 return $param;
247 }, 999);
248 }
249
250 public function comment_template_filter_checker() {
251
252 add_filter('comments_template', function ($template) {
253
254 if(strpos($template, '/single-product-advanced-reviews.php') !== false) {
255
256 /**
257 * Fix for electro theme.................
258 */
259
260 $template = WC_ABSPATH . 'templates/single-product-reviews.php';
261
262 } elseif(strpos($template, '/woocommerce/single-product-reviews.php') !== false) {
263
264 /**
265 * Fix for all other theme.................
266 */
267
268 $template = WC_ABSPATH . 'templates/single-product-reviews.php';
269 }
270
271 return $template;
272 }, 999);
273 }
274 }
275