PluginProbe ʕ •ᴥ•ʔ
ShopEngine Elementor WooCommerce Builder Addon – All in One WooCommerce Solution with eCommerce Templates & Woo Widgets / 4.9.3
ShopEngine Elementor WooCommerce Builder Addon – All in One WooCommerce Solution with eCommerce Templates & Woo Widgets v4.9.3
4.9.5 4.9.4 4.9.3 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 / init / route.php
shopengine / widgets / init Last commit date
assets 3 weeks ago enqueue-scripts.php 1 year ago route.php 3 weeks ago
route.php
114 lines
1 <?php
2
3 namespace ShopEngine\Widgets\Init;
4
5 use ShopEngine\Base\Api;
6 defined('ABSPATH') || exit;
7 class Route extends Api
8 {
9
10 public function config() {
11
12 $this->prefix = 'widgets_partials';
13 $this->param = "";
14 }
15
16 public function get_filter_cat_products() {
17
18 $data = $this->request->get_params();
19
20 $products = $data['products'];
21 $order = isset($data['order']) ? $data['order'] : 'DESC';
22 $order_by = isset($data['order_by']) ? $data['order_by'] : 'date';
23 $settings = isset($data['settings']) ? $data['settings'] : null;
24
25 if(empty($products)) {
26
27 echo "<p class='error'>" . esc_html__('No products were found.', 'shopengine') . "</p>";
28
29 exit();
30 }
31
32 $args = array(
33 'post_type' => 'product',
34 'order' => $order,
35 'orderby' => $order_by,
36 'post__in' => $products,
37 'posts_per_page' => 50
38 );
39
40
41 $query = new \WP_Query($args);
42
43 if($query->have_posts()) :
44 while($query->have_posts()) : $query->the_post();
45
46 $default_content = [
47 'image' => 0,
48 'category' => 0,
49 'title' => 0,
50 'rating' => 0,
51 'price' => 0,
52 'description' => 0,
53 'buttons' => 0,
54 ];
55
56
57
58 $content = (!empty($view) ? $view : $default_content);
59 asort($content, SORT_NUMERIC);
60
61 if( $settings['shopengine_is_cats'] != 'yes' ) unset($content['category']);
62 if( $settings['shopengine_is_details'] != 'yes' ) {
63 unset($content['description']);
64 }
65 if( $settings['shopengine_is_product_rating'] != 'yes' ) unset($content['rating']);
66
67
68 ?> <div class='shopengine-single-product-item'> <?php
69 foreach($content as $key => $value) {
70 $function = '_product_' . $key;
71 \ShopEngine\Utils\Helper::$function($settings);
72 }
73 ?> </div> <?php
74
75 endwhile;
76 endif;
77
78 wp_reset_postdata();
79
80 exit();
81 }
82
83 public function post_checkout_login() {
84
85 // Verify nonce for CSRF protection
86 $nonce = $this->request->get_header('X-WP-Nonce');
87 if (empty($nonce) || !wp_verify_nonce($nonce, 'wp_rest')) {
88 return new \WP_Error('rest_forbidden', esc_html__('Invalid nonce.', 'shopengine'), array('status' => 403));
89 }
90
91 // The wp_rest nonce above is not session-bound for logged-out requests, so it
92 // can be harvested from any public page and replayed cross-origin. Require the
93 // request to actually originate from this site as the real CSRF guard.
94 $source = $this->request->get_header('Origin');
95 if (empty($source)) {
96 $source = $this->request->get_header('Referer');
97 }
98 $source_host = $source ? wp_parse_url($source, PHP_URL_HOST) : '';
99 if (empty($source_host) || strcasecmp($source_host, wp_parse_url(home_url(), PHP_URL_HOST)) !== 0) {
100 return new \WP_Error('rest_forbidden', esc_html__('Invalid request origin.', 'shopengine'), array('status' => 403));
101 }
102
103 $data = $this->request->get_params();
104 if(isset($data['rememberme'])) {
105 $data['rememberme'] = $data['rememberme'] == 'true' ? true : false;
106 }
107 $user = wp_signon($data);
108 if(is_wp_error($user)) {
109 return new \WP_Error('failed_login', $user->get_error_message(), ['status' => 404]);
110 }
111 return true;
112 }
113 }
114