-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
executable file
·120 lines (93 loc) · 4.04 KB
/
index.php
File metadata and controls
executable file
·120 lines (93 loc) · 4.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<?php
/**
* Plugin Name: Woocommerce Custom Filter Widget
* Plugin URI: https://wordpress.org/plugins/woo-custom-filter-widget/
* Description: A powerfull and easy tool to enable horizontal product filter bar at your e-commerce website.
* Version: 0.0.5
* Author: emptyopssphere
* Author URI: https://profiles.wordpress.org/emptyopssphere
* Requires at least: 3.5
* Tested up to: 5.4
* License: GPLv3+
* License URI: http://www.gnu.org/licenses/gpl-3.0.txt
*/
/////////////////////////////////////////////////////////////////////////////////////
//***********************************************************************************
/////////////////////////////////////////////////////////////////////////////////////
function wcfw_sanitize(){
//Sanitize $_GET global variable
foreach ($_GET as $key => $value){
$_GET[$key]=sanitize_text_field($value);
}
//Sanitize $_POST global variable
foreach ($_POST as $key => $value){
$_POST[$key]=sanitize_text_field($value);
}
//Sanitize $_REQUEST global variable
foreach ($_REQUEST as $key => $value){
$_REQUEST[$key]=sanitize_text_field($value);
}
}
/////////////////////////////////////////////////////////////////////////////////////
//***********************************************************************************
/////////////////////////////////////////////////////////////////////////////////////
if(isset($_GET) && isset($_GET['woo_custome_filter']) ) {
wcfw_sanitize();
/////////////////////////////////////////////////////////////////////////////////////
//***********************************************************************************
/////////////////////////////////////////////////////////////////////////////////////
/*
* Ajax filter request handling section
*/
require_once apply_filters('woo_custome_filter_ajax','WOO_CUSTOME_FILTER_Ajax.php');
if(class_exists('WOO_CUSTOME_FILTER_Ajax')){
new WOO_CUSTOME_FILTER_Ajax();
}
/////////////////////////////////////////////////////////////////////////////////////
//***********************************************************************************
/////////////////////////////////////////////////////////////////////////////////////
}
else{
/////////////////////////////////////////////////////////////////////////////////////
//***********************************************************************************
/////////////////////////////////////////////////////////////////////////////////////
/*
* Plugin core section
*/
add_action('plugins_loaded',function() {
require_once apply_filters('woo_custome_filter_core','WOO_CUSTOME_FILTER_Core.php');
if(class_exists('WOO_CUSTOME_FILTER_Core')) {
new WOO_CUSTOME_FILTER_Core();
}
},20);
/////////////////////////////////////////////////////////////////////////////////////
//***********************************************************************************
/////////////////////////////////////////////////////////////////////////////////////
}
add_action('wp_ajax_eo_custom_filter','get_controls');
add_action('wp_ajax_nopriv_eo_custom_filter','get_controls');
function get_controls(){
wcfw_sanitize();
require_once apply_filters('woo_custome_filter_widget','application/frontend/WOO_CUSTOME_FILTER_Widget.php',30);
if (class_exists('WOO_CUSTOME_FILTER_Widget') && isset($_POST['slug']) && isset($_POST['type']) ) {
$widget=new WOO_CUSTOME_FILTER_Widget();
$slug = sanitize_text_field($_POST['slug']);
$term=get_term_by('slug',$slug,'product_cat');
$id=$term->term_id;
$label=sanitize_text_field($_POST['title']);
$type=sanitize_text_field($_POST['type']);
$filter=$widget->range_steps($id,$label,$type);
$widget->input_dropdown($filter['slug'],
array_column($filter['list'],'name'),
array_column($filter['list'],'slug'),
$id,
$type,
$label
);
}
else{
echo '';
}
exit();
}
?>