7 ol-97"> 97
+		$model = $this->getModel();
98
+		if (method_exists($model, $name)) {
99
+			return $model->$name($arguments[0]);
100
+		} else {
101
+			return false;
102
+		}
103
+	}
104
+	/**
105
+	 * Retrive permissions for controller methods if exist.
106
+	 * If need - should be redefined in each controller where it required.
107
+	 *
108
+	 * @return array with permissions
109
+	 * Can be used on of sub-array - WPF_METHODS or WPF_USERLEVELS
110
+	 */
111
+	public function getPermissions() {
112
+		return array();
113
+	}
114
+	/**
115
+	 * Methods that require nonce to be generated
116
+	 * If need - should be redefined in each controller where it required.
117
+	 *
118
+	 * @return array
119
+	 */
120
+	public function getNoncedMethods() {
121
+		return array();
122
+	}
123
+	public function getModule() {
124
+		return FrameWpf::_()->getModule( $this->getCode() );
125
+	}
126
+	protected function _prepareTextLikeSearch( $val ) {
127
+		return '';	 // Should be re-defined for each type
128
+	}
129
+	protected function _prepareModelBeforeListSelect( $model ) {
130
+		return $model;
131
+	}
132
+	/**
133
+	 * Common method for list table data
134
+	 */
135
+	public function getListForTbl() {
136
+		$res = new ResponseWpf();
137
+		$res->ignoreShellData();
138
+		$model = $this->getModel();
139
+
140
+		$page = (int) ReqWpf::getVar('page');
141
+		$rowsLimit = (int) ReqWpf::getVar('rows');
142
+		$orderBy = ReqWpf::getVar('sidx');
143
+		$sortOrder = ReqWpf::getVar('sord');
144
+
145
+		// Our custom search
146
+		$search = ReqWpf::getVar('search');
147
+		if ($search && !empty($search) && is_array($search)) {
148
+			foreach ($search as $k => $v) {
149
+				$v = trim($v);
150
+				if (empty($v)) {
151
+					continue;
152
+				}
153
+				if ('text_like' == $k) {
154
+					$v = $this->_prepareTextLikeSearch( $v );
155
+					if (!empty($v)) {
156
+						$model->addWhere(array('additionalCondition' => $v));
157
+					}
158
+				} else {
159
+					$model->addWhere(array($k => $v));
160
+				}
161
+			}
162
+		}
163
+		// jqGrid search
164
+		$isSearch = ReqWpf::getVar('_search');
165
+		if ($isSearch) {
166
+			$searchField = trim(ReqWpf::getVar('searchField'));
167
+			$searchString = trim(ReqWpf::getVar('searchString'));
168
+			if (!empty($searchField) && !empty($searchString)) {
169
+				// For some cases - we will need to modify search keys and/or values before put it to the model
170
+				$model->addWhere(array(
171
+					$this->_prepareSearchField($searchField) => $this->_prepareSearchString($searchString)
172
+				));
173
+			}
174
+		}
175
+		$model = $this->_prepareModelBeforeListSelect($model);
176
+
177
+		// Get total pages count for current request
178
+		$totalCount = $model->getCount(array('clear' => array('selectFields')));
179
+		$totalPages = 0;
180
+		if ($totalCount > 0) {
181
+			$totalPages = ceil($totalCount / $rowsLimit);
182
+		}
183
+		if ($page > $totalPages) {
184
+			$page = $totalPages;
185
+		}
186
+		// Calc limits - to get data only for current set
187
+		$limitStart = $rowsLimit * $page - $rowsLimit; // do not put $limit*($page - 1)
188
+		if ($limitStart < 0) {
189
+			$limitStart = 0;
190
+		}
191
+		
192
+		$data = $model
193
+			->setLimit($limitStart . ', ' . $rowsLimit)
194
+			->setOrderBy( $this->_prepareSortOrder($orderBy) )
195
+			->setSortOrder( $sortOrder )
196
+			->setSimpleGetFields()
197
+			->getFromTbl();
198
+
199
+		$data = $this->_prepareListForTbl( $data );
200
+		$res->addData('page', $page);
201
+		$res->addData('total', $totalPages);
202
+		$res->addData('rows', $data);
203
+		$res->addData('records', $model->getLastGetCount());
204
+		$res = DispatcherWpf::applyFilters($this->getCode() . '_getListForTblResults', $res);
205
+		$res->ajaxExec();
206
+
207
+	}
208
+	public function removeGroup() {
209
+		check_ajax_referer('wpf-save-nonce', 'wpfNonce');
210
+		if (!current_user_can('manage_options')) {
211
+			wp_die();
212
+		}
213
+	
214
+		$res = new ResponseWpf();
215
+		if ($this->getModel()->removeGroup(ReqWpf::getVar('listIds', 'post'))) {
216
+			$res->addMessage(esc_html__('Done', 'woo-product-filter'));
217
+		} else {
218
+			$res->pushError($this->getModel()->getErrors());
219
+		}
220
+		$res->ajaxExec();
221
+	}
222
+	public function clear() {
223
+		$res = new ResponseWpf();
224
+		if ($this->getModel()->clear()) {
225
+			$res->addMessage(esc_html__('Done', 'woo-product-filter'));
226
+		} else {
227
+			$res->pushError($this->getModel()->getErrors());
228
+		}
229
+		$res->ajaxExec();
230
+	}
231
+	protected function _prepareListForTbl( $data ) {
232
+		return $data;
233
+	}
234
+	protected function _prepareSearchField( $searchField ) {
235
+		return $searchField;
236
+	}
237
+	protected function _prepareSearchString( $searchString ) {
238
+		return $searchString;
239
+	}
240
+	protected function _prepareSortOrder( $sortOrder ) {
241
+		return $sortOrder;
242
+	}
243
+}

+ 34 - 0
app/wp-content/plugins/woo-product-filter/classes/csvgenerator.php

@@ -0,0 +1,34 @@
1
+<?php
2
+class CsvgeneratorWpf {
3
+	protected $_filename = '';
4
+	protected $_delimiter = ';';
5
+	protected $_enclosure = "\n";
6
+	protected $_data = array();
7
+	protected $_escape = '\\';
8
+	public function __construct( $filename ) {
9
+		$this->_filename = $filename;
10
+	}
11
+	public function addCell( $x, $y, $value ) {
12
+		$this->_data[ $x ][ $y ] = '"' . $value . '"';    //If will not do "" then wymbol for example , will broke file
13
+	}
14
+	public function generate() {
15
+		$strData = '';
16
+		if (!empty($this->_data)) {
17
+			$rows = array();
18
+			foreach ($this->_data as $cells) {
19
+				$rows[] = implode($this->_delimiter, $cells);
20
+			}
21
+			$strData = implode($this->_enclosure, $rows);
22
+		}
23
+		FilegeneratorWpf::_($this->_filename, $strData, 'csv')->generate();
24
+	}
25
+	public function getDelimiter() {
26
+		return $this->_delimiter;
27
+	}
28
+	public function getEnclosure() {
29
+		return $this->_enclosure;
30
+	}
31
+	public function getEscape() {
32
+		return $this->_escape;
33
+	}
34
+}

+ 9 - 0
app/wp-content/plugins/woo-product-filter/classes/date.php

@@ -0,0 +1,9 @@
1
+<?php
2
+class DateWpf {
3
+	public static function _( $time = null ) {
4
+		if (is_null($time)) {
5
+			$time = time();
6
+		}
7
+		return gmdate(WPF_DATE_FORMAT_HIS, $time);
8
+	}
9
+}

+ 160 - 0
app/wp-content/plugins/woo-product-filter/classes/db.php

@@ -0,0 +1,160 @@
1
+<?php
2
+/**
3
+ * Shell - class to work with $wpdb global object
4
+ */
5
+class DbWpf {
6
+	/**
7
+	 * Execute query and return results
8
+	 *
9
+	 * @param string $query query to be executed
10
+	 * @param string $get what must be returned - one value (one), one row (row), one col (col) or all results (all - by default)
11
+	 * @param const $outputType type of returned data
12
+	 * @return mixed data from DB
13
+	 */
14
+	public static $query = '';
15
+	public static function get( $query, $get = 'all', $outputType = ARRAY_A ) {
16
+		global $wpdb;
17
+		$get = strtolower($get);
18
+		$res = null;
19
+		$query = self::prepareQuery($query);
20
+		self::$query = $query;
21
+		$wpdb->wpf_prepared_query = $query;
22
+		switch ($get) {
23
+			case 'one':
24
+				$res = $wpdb->get_var($wpdb->wpf_prepared_query);
25
+				break;
26
+			case 'row':
27
+				$res = $wpdb->get_row($wpdb->wpf_prepared_query, $outputType);
28
+				break;
29
+			case 'col':
30
+				$res = $wpdb->get_col($wpdb->wpf_prepared_query);
31
+				break;
32
+			case 'all':
33
+			default:
34
+				$res = $wpdb->get_results($wpdb->wpf_prepared_query, $outputType);
35
+				break;
36
+		}
37
+		return empty($wpdb->last_error) ? $res : false;
38
+	}
39
+	/**
40
+	 * Execute one query
41
+	 *
42
+	 * @return query results
43
+	 */
44
+	public static function query( $query, $affected = false ) {
45
+		global $wpdb;
46
+		$wpdb->wpf_prepared_query = self::prepareQuery($query);
47
+		return $affected ? $wpdb->query($wpdb->wpf_prepared_query) : ( $wpdb->query($wpdb->wpf_prepared_query) === false ? false : true );
48
+	}
49
+	/**
50
+	 * Get last insert ID
51
+	 *
52
+	 * @return int last ID
53
+	 */
54
+	public static function insertID() {
55
+		global $wpdb;
56
+		return $wpdb->insert_id;
57
+	}
58
+	/**
59
+	 * Get number of rows returned by last query
60
+	 *
61
+	 * @return int number of rows
62
+	 */
63
+	public static function numRows() {
64
+		global $wpdb;
65
+		return $wpdb->num_rows;
66
+	}
67
+	/**
68
+	 * Replace prefixes in custom query. Suported next prefixes:
69
+	 * #__  Worwpfess prefix
70
+	 * ^__  Store plugin tables prefix (@see WPF_DB_PREF if config.php)
71
+	 *
72
+	 * @__  Compared of WP table prefix + Store plugin prefix (@example wp_s_)
73
+	 * @param string $query query to be executed
74
+	 */
75
+	public static function prepareQuery( $query ) {
76
+		global $wpdb;
77
+		return str_replace(
78
+				array('#__', '^__', '@__'), 
79
+				array($wpdb->prefix, WPF_DB_PREF, $wpdb->prefix . WPF_DB_PREF),
80
+				$query);
81
+	}
82
+	public static function getTableName( $name ) {
83
+		global $wpdb;
84
+		return $wpdb->prefix . WPF_DB_PREF . $name;
85
+	}
86
+	public static function getError() {
87
+		global $wpdb;
88
+		return $wpdb->last_error;
89
+	}
90
+	public static function lastID() {
91
+		global $wpdb;        
92
+		return $wpdb->insert_id;
93
+	}
94
+	public static function timeToDate( $timestamp = 0 ) {
95
+		if ($timestamp) {
96
+			if (!is_numeric($timestamp)) {
97
+				$timestamp = dateToTimestampWpf($timestamp);
98
+			}
99
+			return gmdate('Y-m-d', $timestamp);
100
+		} else {
101
+			return gmdate('Y-m-d');
102
+		}
103
+	}
104
+	public static function dateToTime( $date ) {
105
+		if (empty($date)) {
106
+			return '';
107
+		}
108
+		if (strpos($date, WPF_DATE_DL)) {
109
+			return dateToTimestampWpf($date);
110
+		}
111
+		$arr = explode('-', $date);
112
+		return dateToTimestampWpf($arr[2] . WPF_DATE_DL . $arr[1] . WPF_DATE_DL . $arr[0]);
113
+	}
114
+	public static function exist( $table, $column = '', $value = '' ) {
115
+		if (empty($column) && empty($value)) {       //Check if table exist
116
+			$res = self::get('SHOW TABLES LIKE "' . $table . '"', 'one');
117
+		} elseif (empty($value)) {                   //Check if column exist
118
+			$res = self::get('SHOW COLUMNS FROM ' . $table . ' LIKE "' . $column . '"', 'one');
119
+		} else {                                    //Check if value in column table exist
120
+			$res = self::get('SELECT COUNT(*) AS total FROM ' . $table . ' WHERE ' . $column . ' = "' . $value . '"', 'one');
121
+		}
122
+		return !empty($res);
123
+	}
124
+	public static function prepareHtml( $d ) {
125
+		if (is_array($d)) {
126
+			foreach ($d as $i => $el) {
127
+				$d[ $i ] = self::prepareHtml( $el );
128
+			}
129
+		} else {
130
+			$d = esc_html($d);
131
+		}
132
+		return $d;
133
+	}
134
+	public static function prepareHtmlIn( $d ) {
135
+		if (is_array($d)) {
136
+			foreach ($d as $i => $el) {
137
+				$d[ $i ] = self::prepareHtml( $el );
138
+			}
139
+		} else {
140
+			$d = wp_filter_nohtml_kses($d);
141
+		}
142
+		return $d;
143
+	}
144
+	public static function escape( $data ) {
145
+		global $wpdb;
146
+		return $wpdb->_escape($data);
147
+	}
148
+	public static function getAutoIncrement( $table ) {
149
+		return (int) self::get('SELECT AUTO_INCREMENT
150
+			FROM information_schema.tables
151
+			WHERE table_name = "' . $table . '"
152
+			AND table_schema = DATABASE( );', 'one');
153
+	}
154
+	public static function setAutoIncrement( $table, $autoIncrement ) {
155
+		return self::query('ALTER TABLE `' . $table . '` AUTO_INCREMENT = ' . $autoIncrement . ';');
156
+	}
157
+	public static function existsTableColumn( $table, $column ) {
158
+		return self::get("SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name='" . $table . "' AND table_schema=DATABASE( ) AND column_name='" . $column . "'", 'one') == 1;
159
+	}
160
+}

+ 48 - 0
app/wp-content/plugins/woo-product-filter/classes/dispatcher.php

@@ -0,0 +1,48 @@
1
+<?php
2
+class DispatcherWpf {
3
+	protected static $_pref = 'wpf_';
4
+
5
+	public static function addAction( $tag, $function_to_add, $priority = 10, $accepted_args = 1 ) {
6
+		if (strpos($tag, 'wpf_') === false) {
7
+			$tag = self::$_pref . $tag;
8
+		}
9
+		return add_action( $tag, $function_to_add, $priority, $accepted_args );
10
+	}
11
+	public static function doAction( $tag ) {
12
+		$t = $tag;
13
+		if (strpos($t, 'wpf_') === false) {
14
+			$t = self::$_pref . $t;
15
+		}
16
+		$numArgs = func_num_args();
17
+		if ($numArgs > 1) {
18
+			$args = array( $t );
19
+			for ($i = 1; $i < $numArgs; $i++) {
20
+				$args[] = func_get_arg($i);
21
+			}
22
+			return call_user_func_array('do_action', $args);
23
+		}
24
+		return do_action($t);
25
+	}
26
+	public static function addFilter( $tag, $function_to_add, $priority = 10, $accepted_args = 1 ) {
27
+		$t = $tag;
28
+		if (strpos($t, 'wpf_') === false) {
29
+			$t = self::$_pref . $t;
30
+		}
31
+		return add_filter( $t, $function_to_add, $priority, $accepted_args );
32
+	}
33
+	public static function applyFilters( $tag, $value ) {
34
+		$t = $tag;
35
+		if (strpos($t, 'wpf_') === false) {
36
+			$t = self::$_pref . $t;
37
+		}
38
+		if (func_num_args() > 2) {
39
+			$args = array($t);
40
+			for ($i = 1; $i < func_num_args(); $i++) {
41
+				$args[] = func_get_arg($i);
42
+			}
43
+			return call_user_func_array('apply_filters', $args);
44
+		} else {
45
+			return apply_filters( $t, $value );
46
+		}
47
+	}
48
+}

+ 97 - 0
app/wp-content/plugins/woo-product-filter/classes/errors.php

@@ -0,0 +1,97 @@
1
+<?php
2
+class ErrorsWpf {
3
+	const FATAL = 'fatal';
4
+	const MOD_INSTALL = 'mod_install';
5
+	private static $errors = array();
6
+	private static $haveErrors = false;
7
+	
8
+	public static $current = array();
9
+	public static $displayed = false;
10
+	
11
+	public static function push( $error, $type = 'common' ) {
12
+		if (!isset(self::$errors[$type])) {
13
+			self::$errors[$type] = array();
14
+		}
15
+		if (is_array($error)) {
16
+			self::$errors[$type] = array_merge(self::$errors[$type], $error);
17
+		} else {
18
+			self::$errors[$type][] = $error;
19
+		}
20
+		self::$haveErrors = true;
21
+		
22
+		if ('session' == $type) {
23
+			self::setSession(self::$errors[$type]);
24
+		}
25
+	}
26
+	public static function setSession( $error ) {
27
+		$sesErrors = self::getSession();
28
+		if (empty($sesErrors)) {
29
+			$sesErrors = array();
30
+		}
31
+		if (is_array($error)) {
32
+			$sesErrors = array_merge($sesErrors, $error);
33
+		} else {
34
+			$sesErrors[] = $error;
35
+		}
36
+		ReqWpf::setVar('sesErrors', $sesErrors, 'session');
37
+	}
38
+	public static function init() {
39
+		$wpfErrors = ReqWpf::getVar('wpfErrors');
40
+		if (!empty($wpfErrors)) {
41
+			if (!is_array($wpfErrors)) {
42
+				$wpfErrors = array( $wpfErrors );
43
+			}
44
+			$wpfErrors = array_map('htmlspecialchars', array_map('stripslashes', array_map('trim', $wpfErrors)));
45
+			if (!empty($wpfErrors)) {
46
+				self::$current = $wpfErrors;
47
+				if (is_admin()) {
48
+					add_action('admin_notices', array('ErrorsWpf', 'showAdminErrors'));
49
+				} else {
50
+					add_filter('the_content', array('ErrorsWpf', 'appendErrorsContent'), 99999);
51
+				}
52
+			}
53
+		}
54
+	}
55
+	public static function showAdminErrors() {
56
+		if (self::$current) {
57
+			foreach (self::$current as $error) {
58
+				echo '<div class="error notice is-dismissible"><p><strong>' . esc_html($error) . '</strong></p></div>';
59
+			}
60
+		}
61
+	}
62
+	public static function appendErrorsContent( $content ) {
63
+		if (!self::$displayed && !empty(self::$current)) {
64
+			$content = '<div class="toeErrorMsg">' . implode('<br />', self::$current) . '</div>' . $content;
65
+			self::$displayed = true;
66
+		}
67
+		return $content;
68
+	}
69
+	public static function getSession() {
70
+		return ReqWpf::getVar('sesErrors', 'session');
71
+	}
72
+	public static function clearSession() {
73
+		ReqWpf::clearVar('sesErrors', 'session');
74
+	}
75
+	public static function get( $type = '' ) {
76
+		$res = array();
77
+		if (!empty(self::$errors)) {
78
+			if (empty($type)) {
79
+				foreach (self::$errors as $e) {
80
+					foreach ($e as $error) {
81
+						$res[] = $error;
82
+					}
83
+				}
84
+			} else {
85
+				$res = self::$errors[$type];
86
+			}
87
+		}
88
+		return $res;
89
+	}
90
+	public static function haveErrors( $type = '' ) {
91
+		if (empty($type)) {
92
+			return self::$haveErrors;
93
+		} else {
94
+			return isset(self::$errors[$type]);
95
+		}
96
+	}
97
+}

+ 261 - 0
app/wp-content/plugins/woo-product-filter/classes/field.php

@@ -0,0 +1,261 @@
1
+<?php
2
+class FieldWpf {
3
+	public $name = '';
4
+	public $html = '';
5
+	public $type = '';
6
+	public $default = '';
7
+	public $value = '';
8
+	public $label = '';
9
+	public $maxlen = 0;
10
+	public $id = 0;
11
+	public $htmlParams = array();
12
+	public $validate = array();
13
+	public $description = '';
14
+	/**
15
+	 * Wheter or not add error html element right after input field
16
+	 * if bool - will be added standard element
17
+	 * if string - it will be add this string
18
+	 */
19
+	public $errorEl = false;
20
+	/**
21
+	 * Name of method in table object to prepare data before insert / update operations
22
+	 */
23
+	public $adapt = array( 'HtmlWpf' => '', 'dbFrom' => '', 'dbTo' => '' );
24
+	/**
25
+	 * Init database field representation
26
+	 *
27
+	 * @param string $html html type of field (text, textarea, etc. @see html class)
28
+	 * @param string $type database type (int, varcahr, etc.)
29
+	 * @param mixed $default default value for this field
30
+	 */
31
+	public function __construct( $name, $html = 'text', $type = 'other', $default = '', $label = '', $maxlen = 0, $adaption = array(), $validate = '', $description = '' ) {
32
+		$this->name = $name;
33
+		$this->html = $html;
34
+		$this->type = $type;
35
+		$this->default = $default;
36
+		$this->value = $default;    //Init field value same as default
37
+		$this->label = $label;
38
+		$this->maxlen = $maxlen;
39
+		$this->description = $description;
40
+		if ($adaption) {
41
+			$this->adapt = $adaption;
42
+		}
43
+		if ($validate) {
44
+			$this->setValidation($validate);
45
+		}
46
+		if (( 'varchar' == $type ) && !empty($maxlen) && !in_array('validLen', $this->validate)) {
47
+			$this->addValidation('validLen');
48
+		}
49
+	}
50
+	/**
51
+	 * Function setErrorEl
52
+	 *
53
+	 * @param mixed $errorEl - if bool and "true" - than we will use standard error element, if string - we will use this string as error element
54
+	 */
55
+	public function setErrorEl( $errorEl ) {
56
+		$this->errorEl = $errorEl;
57
+	}
58
+	public function getErrorEl() {
59
+		return $this->errorEl;
60
+	}
61
+	public function setValidation( $validate ) {
62
+		if (is_array($validate)) {
63
+			$this->validate = $validate;
64
+		} else {
65
+			if (strpos($validate, ',')) {
66
+				$this->validate = array_map('trim', explode(',', $validate));
67
+			} else {
68
+				$this->validate = array(trim($validate));
69
+			}
70
+		}
71
+	}
72
+	public function addValidation( $validate ) {
73
+		$this->validate[] = $validate;
74
+	}
75
+	/**
76
+	 * Set $value property. 
77
+	 * Sure - it is public and can be set directly, but it can be more 
78
+	 * comfortable to use this method in future
79
+	 *
80
+	 * @param mixed $value value to be set
81
+	 */
82
+	public function setValue( $value, $fromDB = false ) {
83
+		if (isset($this->adapt['dbFrom']) && $this->adapt['dbFrom'] && $fromDB) {
84
+			$value = FieldAdapterWpf::_($value, $this->adapt['dbFrom'], FieldAdapterWpf::DB);
85
+		}
86
+		$this->value = $value;
87
+	}
88
+	public function setLabel( $label ) {
89
+		$this->label = $label;
90
+	}
91
+	public function setHtml( $html ) {
92
+		$this->html = $html;
93
+	}
94
+	public function getHtml() {
95
+		return $this->html;
96
+	}
97
+	public function setName( $name ) {
98
+		$this->name = $name;
99
+	}
100
+	public function getName() {
101
+		return $this->name;
102
+	}
103
+	public function getValue() {
104
+		return $this->value;
105
+	}
106
+	public function getLabel() {
107
+		return $this->label;
108
+	}
109
+	public function setID( $id ) {
110
+		$this->id = $id;
111
+	}
112
+	public function getID() {
113
+		return $this->id;
114
+	}
115
+	public function setAdapt( $adapt ) {
116
+		$this->adapt = $adapt;
117
+	}
118
+	public function displayValue() {
119
+		$value = '';
120
+		switch ($this->html) {
121
+			case 'checkboxlist':
122
+				$options = $this->getHtmlParam('OptionsWpf');
123
+				$value = array();
124
+				if (!empty($options) && is_array($options)) {
125
+					foreach ($options as $opt) {
126
+						if (isset($opt['checked']) && $opt['checked']) {
127
+							$value[] = $opt['text'];
128
+						}
129
+					}
130
+				}
131
+				if (empty($value)) {
132
+					$value = esc_html__('N/A', 'woo-product-filter');
133
+				} else {
134
+					$value = implode('<br />', $value);
135
+				}
136
+				break;
137
+			case 'selectbox':
138
+			case 'radiobuttons':
139
+				$options = $this->getHtmlParam('OptionsWpf');
140
+				if (!empty($options) && !empty($options[ $this->value ])) {
141
+					$value = $options[ $this->value ];
142
+				} else {
143
+					$value = esc_html__('N/A', 'woo-product-filter');
144
+				}
145
+				break;
146
+			default:
147
+				if ('' == $this->value) {
148
+					$value = esc_html__('N/A', 'woo-product-filter');
149
+				} else {
150
+					if (is_array($this->value)) {
151
+						$options = $this->getHtmlParam('OptionsWpf');
152
+						if (!empty($options) && is_array($options)) {
153
+							$valArr = array();
154
+							foreach ($this->value as $v) {
155
+								$valArr[] = $options[$v];
156
+							}
157
+							$value = recImplodeWpf('<br />', $valArr);
158
+						} else {
159
+							$value = recImplodeWpf('<br />', $this->value);
160
+						}
161
+					} else {
162
+						$value = $this->value;
163
+					}
164
+				}
165
+				break;
166
+		}
167
+		return $value;
168
+	}
169
+	public function showValue() {
170
+		HtmlWpf::echoEscapedHtml($this->displayValue());
171
+	}
172
+	public function addHtmlParam( $name, $value ) {
173
+		$this->htmlParams[$name] = $value;
174
+	}
175
+	/**
176
+	 * Alias for addHtmlParam();
177
+	 */
178
+	public function setHtmlParam( $name, $value ) {
179
+		$this->addHtmlParam($name, $value);
180
+	}
181
+	public function setHtmlParams( $params ) {
182
+		$this->htmlParams = $params;
183
+	}
184
+	public function getHtmlParam( $name ) {
185
+		return isset($this->htmlParams[$name]) ? $this->htmlParams[$name] : false;
186
+	}
187
+	/**
188
+	 * Check if the element exists in array
189
+	 *
190
+	 * @param array $param 
191
+	 */
192
+	public function checkVarFromParam( $param, $element ) {
193
+		return UtilsWpf::xmlAttrToStr($param, $element);
194
+	}
195
+
196
+	/**
197
+	 * Prepares configuration options
198
+	 * 
199
+	 * @param file $xml
200
+	 * @return array $config_params 
201
+	 */
202
+	public function prepareConfigOptions( $xml ) {
203
+		// load xml structure of parameters
204
+		$config = simplexml_load_file($xml);           
205
+		$config_params = array();
206
+		foreach ($config->params->param as $param) {
207
+			// read the variables
208
+			$name = $this->checkVarFromParam($param, 'name');
209
+			$type = $this->checkVarFromParam($param, 'type');
210
+			$label = $this->checkVarFromParam($param, 'label');
211
+			$helper = $this->checkVarFromParam($param, 'HelperWpf');
212
+			$module = $this->checkVarFromParam($param, 'ModuleWpf');
213
+			$values = $this->checkVarFromParam($param, 'values');
214
+			$default = $this->checkVarFromParam($param, 'default');
215
+			$description = $this->checkVarFromParam($param, 'description');
216
+			if ('' == $name) {
217
+				continue;
218
+			}
219
+			// fill in the variables to configuration array
220
+			$config_params[$name] = array(
221
+				'type' => $type,
222
+				'label' => $label,
223
+				'HelperWpf' => $helper,
224
+				'ModuleWpf' => $module,
225
+				'values' => $values,
226
+				'default' => $default,
227
+				'description' => $description,
228
+			);
229
+		}
230
+		return $config_params;
231
+	}
232
+	public function setDescription( $desc ) {
233
+		$this->description = $desc;
234
+	}
235
+	public function getDescription() {
236
+		return $this->description;
237
+	}
238
+	/**
239
+	 * This method will prepare internal value to it's type
240
+	 *
241
+	 * @see $this->type
242
+	 * @return mixed - prepared value on the basis of $this->type
243
+	 */
244
+	public function valToType() {
245
+		switch ($this->type) {
246
+			case 'int':
247
+			case 'mediumint':
248
+			case 'smallint':
249
+				$this->value = (int) $this->value;
250
+				break;
251
+			case 'float':
252
+				$this->value = (float) $this->value;
253
+				break;
254
+			case 'double':
255
+			case 'decimal':
256
+				$this->value = (float) $this->value;
257
+				break;
258
+		}
259
+		return $this->type;
260
+	}
261
+}

+ 198 - 0
app/wp-content/plugins/woo-product-filter/classes/fieldAdapter.php

@@ -0,0 +1,198 @@
1
+<?php
2
+/**
3
+ * Class to adapt field before display
4
+ * return ONLY htmlParams property
5
+ *
6
+ * @see field
7
+ */
8
+class FieldAdapterWpf {
9
+	const DB = 'DbWpf';
10
+	const HTML = 'HtmlWpf';
11
+	const STR = 'str';
12
+	public static $userfieldDest = array('registration', 'shipping', 'billing');
13
+	public static $countries = array();
14
+	public static $states = array();
15
+	/**
16
+	 * Executes field Adaption process
17
+	 *
18
+	 * @param object type field or value $fieldOrValue if DB adaption - this must be a value of field, elase if html - field object
19
+	 */
20
+	public static function _( $fieldOrValue, $method, $type ) {
21
+		if (method_exists('FieldAdapterWpf', $method)) {
22
+			switch ($type) {
23
+				case self::DB:
24
+					return self::$method($fieldOrValue);
25
+					break;
26
+				case self::HTML:
27
+					self::$method($fieldOrValue);
28
+					break;
29
+				case self::STR:
30
+					return self::$method($fieldOrValue);
31
+					break;
32
+			}
33
+		}
34
+		return $fieldOrValue;
35
+	}
36
+	public static function userFieldDestHtml( $field ) {
37
+		$field->htmlParams['OptionsWpf'] = array();
38
+		if (!is_array($field->value)) {
39
+			if (empty($field->value)) {
40
+				$field->value = array();
41
+			} else {
42
+				$field->value = json_decode($field->value);
43
+			}
44
+		}
45
+		foreach (self::$userfieldDest as $d) {
46
+			$field->htmlParams['OptionsWpf'][] = array(
47
+				'id' => $d,
48
+				'text' => $d,
49
+				'checked' => in_array($d, $field->value)
50
+			);
51
+		}
52
+	}
53
+	public static function userFieldDestToDB( $value ) {
54
+		return UtilsWpf::jsonEncode($value);
55
+	}
56
+	public static function userFieldDestFromDB( $value ) {
57
+		return UtilsWpf::jsonDecode($value);
58
+	}
59
+	
60
+	public static function displayCountry( $cid, $key = 'name' ) {
61
+		if ('name' == $key) {
62
+			$countries = self::getCountries();
63
+			return $countries[$cid];
64
+		} else {
65
+			if (empty(self::$countries)) {
66
+				self::$countries = self::getCachedCountries();
67
+			}
68
+			foreach (self::$countries as $c) {
69
+				if ($c['id'] == $cid) {
70
+					return $c[ $key ];
71
+				}
72
+			}
73
+		}
74
+		return false;
75
+	}
76
+	public static function displayState( $sid, $key = 'name' ) {
77
+		$states = self::getStates();
78
+		return empty($states[$sid]) ? $sid : $states[$sid][$key];
79
+	}
80
+	public static function getCountries( $notSelected = false ) {
81
+		static $options = array();
82
+		if (empty($options[ $notSelected ])) {
83
+			$options[ $notSelected ] = array();
84
+			if (empty(self::$countries)) {
85
+				self::$countries = self::getCachedCountries();
86
+			}
87
+			if ($notSelected) {
88
+				$options[ $notSelected ][0] = is_bool($notSelected) ? esc_html__('Not selected', 'woo-product-filter') : esc_html__($notSelected);
89
+			}
90
+			foreach (self::$countries as $c) {
91
+				$options[ $notSelected ][$c['id']] = $c['name'];
92
+			}
93
+		}
94
+		return $options[ $notSelected ];
95
+	}
96
+	public static function getStates( $notSelected = false ) {
97
+		static $options = array();
98
+		if (empty($options[ $notSelected ])) {
99
+			$options[ $notSelected ] = array();
100
+			if (empty(self::$states)) {
101
+				self::$states = self::getCachedStates();
102
+			}
103
+			if ($notSelected) {
104
+				$notSelectedLabel = is_bool($notSelected) ? 'Not selected' : $notSelected;
105
+				$options[ $notSelected ][0] = array('name' => esc_html__( $notSelectedLabel ), 'country_id' => null);
106
+			}
107
+			foreach (self::$states as $s) {
108
+				$options[ $notSelected ][$s['id']] = $s;
109
+			}
110
+		}
111
+		return $options[ $notSelected ];
112
+	}
113
+	/**
114
+	 * Function to get extra field options 
115
+	 * 
116
+	 * @param object $field
117
+	 * @return string 
118
+	 */
119
+	public static function getExtraFieldOptions( $field_id ) {
120
+		$output = '';
121
+		if (0 == $field_id) {
122
+			return '';
123
+		}
124
+		$options = FrameWpf::_()->getModule('OptionsWpf')->getHelper()->getOptions($field_id);
125
+		if (!empty($options)) {
126
+			foreach ($options as $key=>$value) {
127
+				$output .= '<p>' . $value . '<span class="delete_option" rel="' . $key . '"></span></p>';
128
+			}
129
+		}
130
+		return $output;
131
+	}
132
+	/**
133
+	 * Function to get field params
134
+	 * 
135
+	 * @param object $params 
136
+	 */
137
+	public static function getFieldAttributes( $params ) {
138
+		$output = '';
139
+		if (!empty($params->attr)) {
140
+			foreach ($params->attr as $key=>$value) {
141
+				$output .= esc_html__($key) . ':<br />';
142
+				$output .= HtmlWpf::text('params[attr][' . $key . ']', array('value' => $value)) . '<br />';
143
+			}
144
+		} else {
145
+			$output .= esc_html__('class', 'woo-product-filter') . ':<br />';
146
+			$output .= HtmlWpf::text('params[attr][class]', array('value' => '')) . '<br />';
147
+			$output .= esc_html__('id', 'woo-product-filter') . ':<br />';
148
+			$output .= HtmlWpf::text('params[attr][id]', array('value' => '')) . '<br />';
149
+		}
150
+		return $output;
151
+	}
152
+	/**
153
+	 * Generating the list of categories for product extra fields
154
+	 * 
155
+	 * @param object $field 
156
+	 */
157
+	public static function productFieldCategories( $field ) {
158
+		if (!empty($field->htmlParams['OptionsWpf'])) {
159
+			return;
160
+		}
161
+	}
162
+	public static function intToDB( $val ) {
163
+		return intval($val);
164
+	}
165
+	public static function floatToDB( $val ) {
166
+		return floatval($val);
167
+	}
168
+	/**
169
+	 * Save this in static var - to futher usage
170
+	 *
171
+	 * @return array with countries
172
+	 */
173
+	public static function getCachedCountries( $clearCache = false ) {
174
+		if (empty(self::$countries) || $clearCache) {
175
+			self::$countries = FrameWpf::_()->getTable('countries')->getAll('id, name, iso_code_2, iso_code_3');
176
+		}
177
+		return self::$countries;
178
+	}
179
+	/**
180
+	 * Save this in static var - to futher usage
181
+	 *
182
+	 * @return array with states
183
+	 */
184
+	public static function getCachedStates( $clearCache = false ) {
185
+		if (empty(self::$states) || $clearCache) {
186
+			self::$states = FrameWpf::_()->getTable('states')
187
+				->leftJoin( FrameWpf::_()->getTable('countries'), 'country_id' )
188
+				->getAll('toe_states.id,
189
+					toe_states.name, 
190
+					toe_states.code, 
191
+					toe_states.country_id, 
192
+					toe_cry.name AS c_name,
193
+					toe_cry.iso_code_2 AS c_iso_code_2, 
194
+					toe_cry.iso_code_3 AS c_iso_code_3');
195
+		}
196
+		return self::$states;
197
+	}
198
+}

+ 52 - 0
app/wp-content/plugins/woo-product-filter/classes/filegenerator.php

@@ -0,0 +1,52 @@
1
+<?php
2
+/**
3
+ * Class to generate fiels and output them in attachment by http (https) protocol
4
+ */
5
+class FilegeneratorWpf {
6
+	protected static $_instances = array();
7
+	protected $_filename = '';
8
+	protected $_data = '';
9
+	protected $_type = '';
10
+	public function __construct( $filename, $data, $type ) {
11
+		$this->_filename = $filename;
12
+		$this->_data = $data;
13
+		$this->_type = strtolower($type);
14
+	}
15
+	public static function getInstance( $filename, $data, $type ) {
16
+		$name = md5($filename . $data . $type);
17
+		if (!isset(self::$_instances[$name])) {
18
+			self::$_instances[$name] = new FilegeneratorWpf($filename, $data, $type);
19
+		}
20
+		return self::$_instances[$name];
21
+	}
22
+	public static function _( $filename, $data, $type ) {
23
+		return self::getInstance($filename, $data, $type);
24
+	}
25
+	public function generate() {
26
+		switch ($this->_type) {
27
+			case 'txt':
28
+				$this->_getTxtHeader();
29
+				break;
30
+			case 'csv':
31
+				$this->_getCsvHeader();
32
+				break;
33
+			default:
34
+				$this->_getDefaultHeader();
35
+				break;
36
+		}
37
+		HtmlWpf::echoEscapedHtml($this->_data);
38
+		exit();
39
+	}
40
+	protected function _getTxtHeader() {
41
+		header('Content-Disposition: attachment; filename="' . $this->_filename . '.txt"');
42
+		header('Content-type: text/plain');
43
+	}
44
+	protected function _getCsvHeader() {
45
+		header('Content-Disposition: attachment; filename="' . $this->_filename . '.csv"');
46
+		header('Content-type: application/csv');
47
+	}
48
+	protected function _getDefaultHeader() {
49
+		header('Content-Disposition: attachment; filename="' . $this->_filename . '"');
50
+		header('Content-type: ' . $this->_type);
51
+	}
52
+}

+ 559 - 0
app/wp-content/plugins/woo-product-filter/classes/frame.php

@@ -0,0 +1,559 @@
1
+<?php
2
+class FrameWpf {
3
+	private $_modules = array();
4
+	private $_tables = array();
5
+	private $_allModules = array();
6
+	/**
7
+	 * Uses to know if we are on one of the plugin pages
8
+	 */
9
+	private $_inPlugin = false;
10
+	/**
11
+	 * Array to hold all scripts and add them in one time in addScripts method
12
+	 */
13
+	private $_scripts = array();
14
+	private $_scriptsInitialized = false;
15
+	private $_styles = array();
16
+	private $_stylesInitialized = false;
17
+	private $_useFootAssets = false;
18
+
19
+	private $_scriptsVars = array();
20
+	private $_mod = '';
21
+	private $_action = '';
22
+	private $_proVersion = null;
23
+	/**
24
+	 * Object with result of executing non-ajax module request
25
+	 */
26
+	private $_res = null;
27
+
28
+	public function __construct() {
29
+		$this->_res = toeCreateObjWpf('response', array());
30
+
31
+	}
32
+	public static function getInstance() {
33
+		static $instance;
34
+		if (!$instance) {
35
+			$instance = new FrameWpf();
36
+		}
37
+		return $instance;
38
+	}
39
+	public static function _() {
40
+		return self::getInstance();
41
+	}
42
+	public function parseRoute() {
43
+		// Check plugin
44
+		$pl = ReqWpf::getVar('pl');
45
+		if (WPF_CODE == $pl) {
46
+			$mod = ReqWpf::getMode();
47
+			if ($mod) {
48
+				$this->_mod = $mod;
49
+			}
50
+			$action = ReqWpf::getVar('action');
51
+			if ($action) {
52
+				$this->_action = $action;
53
+			}
54
+		}
55
+	}
56
+	public function setMod( $mod ) {
57
+		$this->_mod = $mod;
58
+	}
59
+	public function getMod() {
60
+		return $this->_mod;
61
+	}
62
+	public function setAction( $action ) {
63
+		$this->_action = $action;
64
+	}
65
+	public function getAction() {
66
+		return $this->_action;
67
+	}
68
+	private function _checkPromoModName( $activeModules ) {
69
+		foreach ($activeModules as $i => $m) {
70
+			if ('supsystic_promo' == $m['code']) {	// Well, rename it ;)
71
+				$activeModules[$i]['code'] = 'promo';
72
+				$activeModules[$i]['label'] = 'promo';
73
+				DbWpf::query("UPDATE `@__modules` SET code = 'promo', label = 'promo' WHERE code = 'supsystic_promo'");
74
+			}
75
+		}
76
+		return $activeModules;
77
+	}
78
+	protected function _extractModules() {
79
+		$activeModules = $this->getTable('modules')
80
+				->innerJoin( $this->getTable('modules_type'), 'type_id' )
81
+				->get($this->getTable('modules')->alias() . '.*, ' . $this->getTable('modules_type')->alias() . '.label as type_name');
82
+		$activeModules = $this->_checkPromoModName($activeModules);
83
+		if ($activeModules) {
84
+			foreach ($activeModules as $m) {
85
+				$code = $m['code'];
86
+				$moduleLocationDir = WPF_MODULES_DIR;
87
+				if (!empty($m['ex_plug_dir'])) {
88
+					$moduleLocationDir = UtilsWpf::getExtModDir( $m['ex_plug_dir'] );
89
+				}
90
+				if (is_dir($moduleLocationDir . $code)) {
91
+					$this->_allModules[$m['code']] = 1;
92
+					if ((bool) $m['active']) {
93
+						importClassWpf($code . strFirstUpWpf(WPF_CODE), $moduleLocationDir . $code . DS . 'mod.php');
94
+						$moduleClass = toeGetClassNameWpf($code);
95
+						if (class_exists($moduleClass)) {
96
+							$this->_modules[$code] = new $moduleClass($m);
97
+							if (is_dir($moduleLocationDir . $code . DS . 'tables')) {
98
+								$this->_extractTables($moduleLocationDir . $code . DS . 'tables' . DS);
99
+							}
100
+						}
101
+					}
102
+				}
103
+			}
104
+		}
105
+	}
106
+	protected function _initModules() {
107
+		if (!empty($this->_modules)) {
108
+			foreach ($this->_modules as $mod) {
109
+				 $mod->init();
110
+			}
111
+		}
112
+	}
113
+	public function init() {
114
+		ReqWpf::init();
115
+		$this->_extractTables();
116
+		$this->_extractModules();
117
+
118
+		$this->_initModules();
119
+
120
+		DispatcherWpf::doAction('afterModulesInit');
121
+
122
+		ModInstallerWpf::checkActivationMessages();
123
+
124
+		$this->_execModules();
125
+
126
+		$addAssetsAction = $this->usePackAssets() && !is_admin() ? 'wp_footer' : 'init';
127
+
128
+		add_action($addAssetsAction, array($this, 'addScripts'));
129
+		add_action($addAssetsAction, array($this, 'addStyles'));
130
+		global $langOK;
131
+		register_activation_hook(WPF_DIR . DS . WPF_MAIN_FILE, array('UtilsWpf', 'activatePlugin')); //See classes/install.php file
132
+		register_uninstall_hook(WPF_DIR . DS . WPF_MAIN_FILE, array('UtilsWpf', 'deletePlugin'));
133
+		register_deactivation_hook(WPF_DIR . DS . WPF_MAIN_FILE, array( 'UtilsWpf', 'deactivatePlugin' ) );
134
+
135
+		add_action('init', array($this, 'connectLang'));
136
+		add_action('after_plugin_row_woofilter-pro/woofilter-pro.php', array($this, 'pluginRow'), 5, 3);
137
+		add_filter('the_content', array('WoofiltersWpf', 'getProductsShortcode'), -99999);
138
+	}
139
+
140
+	public function pluginRow( $plugin_file, $plugin_data, $status ) {
141
+		if ( !version_compare($plugin_data['Version'], WPF_PRO_REQUIRES, '>=') ) { 
142
+			$colspan = version_compare($GLOBALS['wp_version'], '5.5', '<') ? 3 : 4;
143
+			$active = is_plugin_active($plugin_file) ? ' active' : '';
144
+			?>
145
+			<style>
146
+				.plugins tr[data-slug="woo-product-filter-pro"] td,
147
+				.plugins tr[data-slug="woo-product-filter-pro"] th {
148
+					box-shadow:none;
149
+				}
150
+				<?php if ( isset($plugin_data['update']) && !empty($plugin_data['update']) ) { ?>
151
+				.plugins tr.wpf-pro-plugin-tr td{
152
+					box-shadow:none !important;
153
+				}
154
+				.plugins wpf-pro-plugin-tr .update-message{
155
+					margin-bottom:0;
156
+				}
157
+				<?php } ?>
158
+			</style>
159
+			<tr class="plugin-update-tr wpf-pro-plugin-tr<?php echo esc_attr($active); ?>">
160
+				<td colspan="<?php echo esc_attr($colspan); ?>" class="plugin-update colspanchange">
161
+					<div class="update-message notice inline notice-error notice-alt">
162
+						<p><?php echo 'Current version of Free (Base) plugin WooCommerce Product Filter by WooBeWoo requires version of Woo Product Filter PRO plugin at least ' . esc_html(WPF_PRO_REQUIRES) . '.'; ?></p>
163
+					</div>
164
+				</td>
165
+			</tr>
166
+		<?php
167
+		}
168
+	}
169
+
170
+	public function connectLang() {
171
+		global $langOK;
172
+		$langOK = load_plugin_textdomain('woo-product-filter', false, WPF_PLUG_NAME . '/languages/');
173
+	}
174
+	/**
175
+	 * Check permissions for action in controller by $code and made corresponding action
176
+	 *
177
+	 * @param string $code Code of controller that need to be checked
178
+	 * @param string $action Action that need to be checked
179
+	 * @return bool true if ok, else - should exit from application
180
+	 */
181
+	public function checkPermissions( $code, $action ) {
182
+		if ($this->havePermissions($code, $action)) {
183
+			return true;
184
+		} else {
185
+			exit(esc_html_e('You have no permissions to view this page', 'woo-product-filter'));
186
+		}
187
+	}
188
+	/**
189
+	 * Check permissions for action in controller by $code
190
+	 *
191
+	 * @param string $code Code of controller that need to be checked
192
+	 * @param string $action Action that need to be checked
193
+	 * @return bool true if ok, else - false
194
+	 */
195
+	public function havePermissions( $code, $action ) {
196
+		$res = true;
197
+		$mod = $this->getModule($code);
198
+		$action = strtolower($action);
199
+		if ($mod) {
200
+			$permissions = $mod->getController()->getPermissions();
201
+			if (!empty($permissions)) {  // Special permissions
202
+				if (isset($permissions[WPF_METHODS]) && !empty($permissions[WPF_METHODS])) {
203
+					foreach ($permissions[WPF_METHODS] as $method => $permissions) {   // Make case-insensitive
204
+						$permissions[WPF_METHODS][strtolower($method)] = $permissions;
205
+					}
206
+					if (array_key_exists($action, $permissions[WPF_METHODS])) {        // Permission for this method exists
207
+						$currentUserPosition = self::_()->getModule('user')->getCurrentUserPosition();
208
+						if ( ( is_array($permissions[ WPF_METHODS ][ $action ] ) && !in_array($currentUserPosition, $permissions[ WPF_METHODS ][ $action ]) )
209
+							|| ( !is_array($permissions[ WPF_METHODS ][ $action ]) && $permissions[WPF_METHODS][$action] != $currentUserPosition )
210
+						) {
211
+							$res = false;
212
+						}
213
+					}
214
+				}
215
+				if (isset($permissions[WPF_USERLEVELS])	&& !empty($permissions[WPF_USERLEVELS])) {
216
+					$currentUserPosition = self::_()->getModule('user')->getCurrentUserPosition();
217
+					// For multi-sites network admin role is undefined, let's do this here
218
+					if (is_multisite() && is_admin() && is_super_admin()) {
219
+						$currentUserPosition = WPF_ADMIN;
220
+					}
221
+					foreach ($permissions[WPF_USERLEVELS] as $userlevel => $methods) {
222
+						if (is_array($methods)) {
223
+							$lowerMethods = array_map('strtolower', $methods);          // Make case-insensitive
224
+							if (in_array($action, $lowerMethods)) {                      // Permission for this method exists
225
+								if ($currentUserPosition != $userlevel) {
226
+									$res = false;
227
+								}
228
+								break;
229
+							}
230
+						} else {
231
+							$lowerMethod = strtolower($methods);            // Make case-insensitive
232
+							if ($lowerMethod == $action) {                   // Permission for this method exists
233
+								if ($currentUserPosition != $userlevel) {
234
+									$res = false;
235
+								}
236
+								break;
237
+							}
238
+						}
239
+					}
240
+				}
241
+			}
242
+			if ($res) {	// Additional check for nonces
243
+				$noncedMethods = $mod->getController()->getNoncedMethods();
244
+				if (!empty($noncedMethods)) {
245
+					$noncedMethods = array_map('strtolower', $noncedMethods);
246
+					if (in_array($action, $noncedMethods)) {
247
+						$nonce = isset($_REQUEST['_wpnonce']) ? sanitize_text_field($_REQUEST['_wpnonce']) : reqCfs::getVar('_wpnonce');
248
+						if (!wp_verify_nonce( $nonce, $action )) {
249
+							$res = false;
250
+						}
251
+					}
252
+				}
253
+			}
254
+		}
255
+		return $res;
256
+	}
257
+	public function getRes() {
258
+		return $this->_res;
259
+	}
260
+	public function execAfterWpInit() {
261
+		$this->_doExec();
262
+	}
263
+	/**
264
+	 * Check if method for module require some special permission. We can detect users permissions only after wp init action was done.
265
+	 */
266
+	protected function _execOnlyAfterWpInit() {
267
+		$res = false;
268
+		$mod = $this->getModule( $this->_mod );
269
+		$action = strtolower( $this->_action );
270
+		if ($mod) {
271
+			$permissions = $mod->getController()->getPermissions();
272
+			if (!empty($permissions)) {  // Special permissions
273
+				if (isset($permissions[WPF_METHODS]) && !empty($permissions[WPF_METHODS])) {
274
+					foreach ($permissions[WPF_METHODS] as $method => $permissions) {   // Make case-insensitive
275
+						$permissions[WPF_METHODS][strtolower($method)] = $permissions;
276
+					}
277
+					if (array_key_exists($action, $permissions[WPF_METHODS])) {        // Permission for this method exists
278
+						$res = true;
279
+					}
280
+				}
281
+				if (isset($permissions[WPF_USERLEVELS])	&& !empty($permissions[WPF_USERLEVELS])) {
282
+					$res = true;
283
+				}
284
+			}
285
+		}
286
+		return $res;
287
+	}
288
+	protected function _execModules() {
289
+		if ($this->_mod) {
290
+			// If module exist and is active
291
+			$mod = $this->getModule($this->_mod);
292
+			if ($mod && !empty($this->_action)) {
293
+				if ($this->_execOnlyAfterWpInit()) {
294
+					add_action('init', array($this, 'execAfterWpInit'));
295
+				} else {
296
+					$this->_doExec();
297
+				}
298
+			}
299
+		}
300
+	}
301
+	protected function _doExec() {
302
+		$mod = $this->getModule($this->_mod);
303
+		if ($mod && $this->checkPermissions($this->_mod, $this->_action)) {
304
+			switch (ReqWpf::getVar('reqType')) {
305
+				case 'ajax':
306
+					add_action('wp_ajax_' . $this->_action, array($mod->getController(), $this->_action));
307
+					add_action('wp_ajax_nopriv_' . $this->_action, array($mod->getController(), $this->_action));
308
+					break;
309
+				default:
310
+					$this->_res = $mod->exec($this->_action);
311
+					break;
312
+			}
313
+		}
314
+	}
315
+	protected function _extractTables( $tablesDir = WPF_TABLES_DIR ) {
316
+		$mDirHandle = opendir($tablesDir);
317
+		while ( ( $file = readdir($mDirHandle) ) !== false ) {
318
+			if ( is_file($tablesDir . $file) && ( '.' != $file ) && ( '..' != $file ) && strpos($file, '.php') ) {
319
+				$this->_extractTable( str_replace('.php', '', $file), $tablesDir );
320
+			}
321
+		}
322
+	}
323
+	protected function _extractTable( $tableName, $tablesDir = WPF_TABLES_DIR ) {
324
+		importClassWpf('noClassNameHere', $tablesDir . $tableName . '.php');
325
+		$this->_tables[$tableName] = TableWpf::_($tableName);
326
+	}
327
+	/**
328
+	 * Public alias for _extractTables method
329
+	 *
330
+	 * @see _extractTables
331
+	 */
332
+	public function extractTables( $tablesDir ) {
333
+		if (!empty($tablesDir)) {
334
+			$this->_extractTables($tablesDir);
335
+		}
336
+	}
337
+	public function exec() {
338
+		//deprecated
339
+	}
340
+	public function getTables () {
341
+		return $this->_tables;
342
+	}
343
+	/**
344
+	 * Return table by name
345
+	 *
346
+	 * @param string $tableName table name in database
347
+	 * @return object table
348
+	 * @example FrameWpf::_()->getTable('products')->getAll()
349
+	 */
350
+	public function getTable( $tableName ) {
351
+		if (empty($this->_tables[$tableName])) {
352
+			$this->_extractTable($tableName);
353
+		}
354
+		return $this->_tables[$tableName];
355
+	}
356
+	public function getModules( $filter = array() ) {
357
+		$res = array();
358
+		if (empty($filter)) {
359
+			$res = $this->_modules;
360
+		} else {
361
+			foreach ($this->_modules as $code => $mod) {
362
+				if (isset($filter['type'])) {
363
+					if (is_numeric($filter['type']) && $filter['type'] == $mod->getTypeID()) {
364
+						$res[$code] = $mod;
365
+					} elseif ($filter['type'] == $mod->getType()) {
366
+						$res[$code] = $mod;
367
+					}
368
+				}
369
+			}
370
+		}
371
+		return $res;
372
+	}
373
+
374
+	public function getModule( $code ) {
375
+		return ( isset($this->_modules[$code]) ? $this->_modules[$code] : null );
376
+	}
377
+	public function inPlugin() {
378
+		return $this->_inPlugin;
379
+	}
380
+	public function usePackAssets() {
381
+		if (!$this->_useFootAssets && $this->getModule('options') && $this->getModule('options')->get('foot_assets')) {
382
+			$this->_useFootAssets = true;
383
+		}
384
+		return $this->_useFootAssets;
385
+	}
386
+	/**
387
+	 * Push data to script array to use it all in addScripts method
388
+	 *
389
+	 * @see wp_enqueue_script definition
390
+	 */
391
+	public function addScript( $handle, $src = '', $deps = array(), $ver = false, $in_footer = false, $vars = array() ) {
392
+		$src = empty($src) ? $src : UriWpf::_($src);
393
+		if (!$ver) {
394
+			$ver = WPF_VERSION;
395
+		}
396
+		if ($this->_scriptsInitialized) {
397
+			wp_enqueue_script($handle, $src, $deps, $ver, $in_footer);
398
+		} else {
399
+			$this->_scripts[] = array(
400
+				'handle' => $handle,
401
+				'src' => $src,
402
+				'deps' => $deps,
403
+				'ver' => $ver,
404
+				'in_footer' => $in_footer,
405
+				'vars' => $vars
406
+			);
407
+		}
408
+	}
409
+	/**
410
+	 * Add all scripts from _scripts array to wordpress
411
+	 */
412
+	public function addScripts() {
413
+		if (!empty($this->_scripts)) {
414
+			foreach ($this->_scripts as $s) {
415
+
416
+				if ( ! function_exists( 'is_plugin_active' ) ) {
417
+					require_once ABSPATH . 'wp-admin/includes/plugin.php';
418
+				}
419
+
420
+				$enqueue = true;
421
+
422
+				// if the oxygen plugin is activated then check if the script is already registered
423
+				if ( is_plugin_active( 'oxygen/functions.php' ) && 'jquery-ui-autocomplete' === $s['handle'] ) {
424
+					$wp_scripts = wp_scripts();
425
+					if ( isset( $wp_scripts->registered[ $s['handle'] ] ) ) {
426
+						$enqueue = false;
427
+					}
428
+				}
429
+
430
+				if ( $enqueue ) {
431
+					wp_enqueue_script( $s['handle'], $s['src'], $s['deps'], $s['ver'], $s['in_footer'] );
432
+				}
433
+
434
+				if ($s['vars'] || isset($this->_scriptsVars[$s['handle']])) {
435
+					$vars = array();
436
+					if ($s['vars']) {
437
+						$vars = $s['vars'];
438
+					}
439
+					if ($this->_scriptsVars[$s['handle']]) {
440
+						$vars = array_merge($vars, $this->_scriptsVars[$s['handle']]);
441
+					}
442
+					if ($vars) {
443
+						foreach ($vars as $k => $v) {
444
+							if ( is_array( $v ) ) {
445
+								wp_localize_script( $s['handle'], $k, $v );
446
+							}
447
+						}
448
+					}
449
+				}
450
+			}
451
+		}
452
+		$this->_scriptsInitialized = true;
453
+	}
454
+	public function addJSVar( $script, $name, $val ) {
455
+		if ($this->_scriptsInitialized) {
456
+			if ( is_array( $val ) ) {
457
+				wp_localize_script( $script, $name, $val );
458
+			} else {
459
+				$code = "var {$name} = '{$val}';";
460
+				wp_add_inline_script( $script, $code, 'before' );
461
+			}
462
+		} else {
463
+			$this->_scriptsVars[$script][$name] = $val;
464
+		}
465
+	}
466
+
467
+	public function addStyle( $handle, $src = false, $deps = array(), $ver = false, $media = 'all' ) {
468
+		$src = empty($src) ? $src : UriWpf::_($src);
469
+		if (!$ver) {
470
+			$ver = WPF_VERSION;
471
+		}
472
+		if ($this->_stylesInitialized) {
473
+			wp_enqueue_style($handle, $src, $deps, $ver, $media);
474
+		} else {
475
+			$this->_styles[] = array(
476
+				'handle' => $handle,
477
+				'src' => $src,
478
+				'deps' => $deps,
479
+				'ver' => $ver,
480
+				'media' => $media
481
+			);
482
+		}
483
+	}
484
+	public function addStyles() {
485
+		if (!empty($this->_styles)) {
486
+			foreach ($this->_styles as $s) {
487
+				wp_enqueue_style($s['handle'], $s['src'], $s['deps'], $s['ver'], $s['media']);
488
+			}
489
+		}
490
+		$this->_stylesInitialized = true;
491
+	}
492
+	//Very interesting thing going here.............
493
+	public function loadPlugins() {
494
+		require_once(ABSPATH . 'wp-includes/pluggable.php');
495
+	}
496
+	public function loadWPSettings() {
497
+		require_once(ABSPATH . 'wp-settings.php');
498
+	}
499
+	public function loadLocale() {
500
+		require_once(ABSPATH . 'wp-includes/locale.php');
501
+	}
502
+	public function moduleActive( $code ) {
503
+		return isset($this->_modules[$code]);
504
+	}
505
+	public function moduleExists( $code ) {
506
+		if ($this->moduleActive($code)) {
507
+			return true;
508
+		}
509
+		return isset($this->_allModules[$code]);
510
+	}
511
+	public function isTplEditor() {
512
+		$tplEditor = ReqWpf::getVar('tplEditor');
513
+		return (bool) $tplEditor;
514
+	}
515
+	/**
516
+	 * This is custom method for each plugin and should be modified if you create copy from this instance.
517
+	 */
518
+	public function isAdminPlugOptsPage() {
519
+		$page = ReqWpf::getVar('page');
520
+		if (is_admin() && strpos($page, self::_()->getModule('adminmenu')->getMainSlug()) !== false) {
521
+			return true;
522
+		}
523
+		return false;
524
+	}
525
+	public function isAdminPlugPage() {
526
+		if ($this->isAdminPlugOptsPage()) {
527
+			return true;
528
+		}
529
+		return false;
530
+	}
531
+	public function licenseDeactivated() {
532
+		return ( !$this->getModule('license') && $this->moduleExists('license') );
533
+	}
534
+	public function savePluginActivationErrors() {
535
+		update_option(WPF_CODE . '_plugin_activation_errors', ob_get_contents());
536
+	}
537
+	public function getActivationErrors() {
538
+		return get_option(WPF_CODE . '_plugin_activation_errors');
539
+	}
540
+	public function isPro() {
541
+		return $this->moduleExists('license') && $this->getModule('license') && $this->getModule('access');
542
+	}
543
+
544
+	public function proVersionCompare( $requires, $compare = '>', $notPro = true ) {
545
+		if ( is_null( $this->_proVersion ) ) {
546
+			if ( $this->isPro() && function_exists( 'getProPlugFullPathWpf' ) ) {
547
+				if ( ! function_exists( 'get_plugin_data' ) ) {
548
+					require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
549
+				}
550
+				$plugin_data       = get_file_data( getProPlugFullPathWpf(), array( 'Version' => 'Version' ) );
551
+				$this->_proVersion = $plugin_data['Version'];
552
+			} else {
553
+				$this->_proVersion = false;
554
+			}
555
+		}
556
+
557
+		return ( ( $notPro && false === $this->_proVersion ) || version_compare( $this->_proVersion, $requires, $compare ) );
558
+	}
559
+}

+ 40 - 0
app/wp-content/plugins/woo-product-filter/classes/helper.php

@@ -0,0 +1,40 @@
1
+<?php
2
+/**
3
+ * Abstract class of module helper
4
+ * Module helper has all the functions that are needed in module workflow
5
+ * Besides it contains the methods to build html elements
6
+ */
7
+abstract class HelperWpf {
8
+	protected $_code = '';
9
+	protected $_module = '';
10
+	/**
11
+	 * Construct helper class
12
+	 *
13
+	 * @param string $code 
14
+	 */
15
+	public function __construct( $code ) {
16
+		$this->setCode($code);
17
+	}
18
+	/**
19
+	 * Init function
20
+	 */
21
+	public function init() {
22
+
23
+	}
24
+	/**
25
+	 * Set the helper name
26
+	 *
27
+	 * @param string $code 
28
+	 */
29
+	public function setCode( $code ) {
30
+		$this->_code = $code;
31
+	}
32
+	/**
33
+	 * Get the helper name
34
+	 *
35
+	 * @return string 
36
+	 */
37
+	public function getCode() {
38
+		return $this->_code;
39
+	}
40
+}

File diff suppressed because it is too large
+ 1420 - 0
app/wp-content/plugins/woo-product-filter/classes/helpers/mobileDetect.php


+ 395 - 0
app/wp-content/plugins/woo-product-filter/classes/html.php

@@ -0,0 +1,395 @@
1
+<?php
2
+class HtmlWpf {
3
+	public static $categoriesOptions = array();
4
+	public static $productsOptions = array();
5
+	public static function echoEscapedHtml( $html ) {
6
+		remove_all_filters( 'esc_html');
7
+		add_filter('esc_html', array('HtmlWpf', 'skipHtmlEscape'), 99, 2);
8
+		echo esc_html($html);
9
+		remove_filter('esc_html', array('HtmlWpf', 'skipHtmlEscape'), 99, 2);
10
+	}
11
+	public static function skipHtmlEscape( $safe_text, $text ) {
12
+		return $text;
13
+	}
14
+	public static function block( $name, $params = array('attrs' => '', 'value' => '') ) {
15
+		$output .= '<p class="toe_' . self::nameToClassId($name) . '">' . $params['value'] . '</p>';
16
+		return $output;
17
+	}
18
+	public static function nameToClassId( $name, $params = array() ) {
19
+		if (!empty($params) && isset($params['attrs']) && strpos($params['attrs'], 'id="') !== false) {
20
+			preg_match('/id="(.+)"/ui', $params['attrs'], $idMatches);
21
+			if ($idMatches[1]) {
22
+				return $idMatches[1];
23
+			}
24
+		}
25
+		return str_replace(array('[', ']'), '', $name);
26
+	}
27
+	public static function textarea( $name, $params = array('attrs' => '', 'value' => '', 'rows' => 3, 'cols' => 50) ) {
28
+		$params['attrs'] = isset($params['attrs']) ? $params['attrs'] : '';
29
+		$params['rows'] = isset($params['rows']) ? $params['rows'] : 3;
30
+		$params['cols'] = isset($params['cols']) ? $params['cols'] : 50;
31
+		if (isset($params['required']) && $params['required']) {
32
+			$params['attrs'] .= ' required ';	// HTML5 "required" validation attr
33
+		}
34
+		if (isset($params['placeholder']) && $params['placeholder']) {
35
+			$params['attrs'] .= ' placeholder="' . esc_attr($params['placeholder']) . '"';	// HTML5 "required" validation attr
36
+		}
37
+		if (isset($params['disabled']) && $params['disabled']) {
38
+			$params['attrs'] .= ' disabled ';
39
+		}
40
+		if (isset($params['readonly']) && $params['readonly']) {
41
+			$params['attrs'] .= ' readonly ';
42
+		}
43
+		if (isset($params['auto_width']) && $params['auto_width']) {
44
+			unset($params['rows']);
45
+			unset($params['cols']);
46
+		}
47
+		echo '<textarea name="' . esc_attr($name) . '" ';
48
+		if (!empty($params['attrs'])) {
49
+			self::echoEscapedHtml($params['attrs']);
50
+		}
51
+		echo ( isset($params['rows']) ? ' rows="' . esc_attr($params['rows']) . '"' : '' ) .
52
+			( isset($params['cols']) ? ' cols="' . esc_attr($params['cols']) . '"' : '' ) . '>' .
53
+			( isset($params['value']) ? esc_html($params['value']) : '' ) .
54
+		'</textarea>';
55
+	}
56
+	public static function input( $name, $params = array('attrs' => '', 'type' => 'text', 'value' => '') ) {
57
+		$params['attrs'] = isset($params['attrs']) ? $params['attrs'] : '';
58
+		$params['attrs'] .= self::_dataToAttrs($params);
59
+		if (isset($params['required']) && $params['required']) {
60
+			$params['attrs'] .= ' required ';	// HTML5 "required" validation attr
61
+		}
62
+		if (isset($params['placeholder']) && $params['placeholder']) {
63
+			$params['attrs'] .= ' placeholder="' . esc_attr($params['placeholder']) . '"';	// HTML5 "required" validation attr
64
+		}
65
+		if (isset($params['disabled']) && $params['disabled']) {
66
+			$params['attrs'] .= ' disabled ';
67
+		}
68
+		if (isset($params['readonly']) && $params['readonly']) {
69
+			$params['attrs'] .= ' readonly ';
70
+		}
71
+		$params['type'] = isset($params['type']) ? $params['type'] : 'text';
72
+		$params['value'] = isset($params['value']) ? $params['value'] : '';
73
+
74
+		echo '<input type="' . esc_attr($params['type']) . '" name="' . esc_attr($name) . '" value="' . esc_attr($params['value']) . '" ';
75
+		if (!empty($params['attrs'])) {
76
+			self::echoEscapedHtml($params['attrs']);
77
+		}
78
+		echo ' />';
79
+	}
80
+	private static function _dataToAttrs( $params ) {
81
+		$res = '';
82
+		foreach ($params as $k => $v) {
83
+			if (strpos($k, 'data-') === 0) {
84
+				$res .= ' ' . $k . '="' . $v . '"';
85
+			}
86
+		}
87
+		return $res;
88
+	}
89
+	public static function text( $name, $params = array('attrs' => '', 'value' => '') ) {
90
+		$params['type'] = 'text';
91
+		self::input($name, $params);
92
+	}
93
+	public static function email( $name, $params = array('attrs' => '', 'value' => '') ) {
94
+		$params['type'] = 'email';
95
+		self::input($name, $params);
96
+	}
97
+	public static function reset( $name, $params = array('attrs' => '', 'value' => '') ) {
98
+		$params['type'] = 'reset';
99
+		self::input($name, $params);
100
+	}
101
+	public static function password( $name, $params = array('attrs' => '', 'value' => '') ) {
102
+		$params['type'] = 'password';
103
+		self::input($name, $params);
104
+	}
105
+	public static function hidden( $name, $params = array('attrs' => '', 'value' => '') ) {
106
+		$params['type'] = 'hidden';
107
+		self::input($name, $params);
108
+	}
109
+	public static function checkbox( $name, $params = array('attrs' => '', 'value' => '', 'checked' => '') ) {
110
+		$params['type'] = 'checkbox';
111
+		if ( isset($params['checked']) && $params['checked'] ) {
112
+			$params['checked'] = 'checked';
113
+		}
114
+		if ( !isset($params['value']) || null == $params['value'] ) {
115
+			$params['value'] = 1;
116
+		}
117
+		if (!isset($params['attrs'])) {
118
+			$params['attrs'] = '';
119
+		}
120
+		$params['attrs'] .= ' ' . ( isset($params['checked']) ? $params['checked'] : '' );
121
+		self::input($name, $params);
122
+	}
123
+	public static function checkboxToggle( $name, $params = array('attrs' => '', 'value' => '', 'checked' => '') ) {
124
+		$params['type'] = 'checkbox';
125
+		$params['checked'] = isset($params['checked']) && $params['checked'] ? 'checked' : '';
126
+		if ( !isset($params['value']) || ( null === $params['value'] ) ) {
127
+			$params['value'] = 1;
128
+		}
129
+		$id = ( empty($params['id']) ? self::nameToClassId($name) . mt_rand(9, 9999) : $params['id'] );
130
+		$params['attrs'] = 'id="' . esc_attr($id) . '" class="toggle" ' . ( isset($params['attrs']) ? $params['attrs'] . ' ' : '' ) . $params['checked'];
131
+		
132
+		self::input($name, $params);
133
+		echo '<label for="' . esc_attr($id) . '" class="toggle"></label>';
134
+	}
135
+	public static function checkboxlist( $name, $params = array('options' => array(), 'attrs' => '', 'checked' => '', 'delim' => '<br />', 'usetable' => 5), $delim = '<br />' ) {
136
+		if (!strpos($name, '[]')) {
137
+			$name .= '[]';
138
+		}
139
+		$i = 0;
140
+		if ($params['options']) {
141
+			if (!isset($params['delim'])) {
142
+				$params['delim'] = $delim;
143
+			}
144
+			if (!empty($params['usetable'])) {
145
+				echo '<table><tr>';
146
+			}
147
+			foreach ($params['options'] as $v) {
148
+				if (!empty($params['usetable'])) {
149
+					if ( ( 0 != $i ) && ( 0 == $i%$params['usetable'] ) ) {
150
+						echo '</tr><tr>';
151
+					}
152
+					echo '<td>';
153
+				}
154
+				self::checkboxToggle($name, array(
155
+					'attrs' => !empty($params['attrs']),
156
+					'value' => empty($v['value']) ? $v['id'] : $v['value'],
157
+					'checked' => $v['checked'],
158
+					'id' => $v['id'],
159
+				));
160
+				echo '&nbsp;';
161
+				if (!empty($v['text'])) {
162
+					self::echoEscapedHtml($v['text']);
163
+				}
164
+				if (!empty($params['delim'])) {
165
+					self::echoEscapedHtml($params['delim']);
166
+				}
167
+				if (!empty($params['usetable'])) {
168
+					echo '</td>';
169
+				}
170
+				$i++;
171
+			}
172
+			if (!empty($params['usetable'])) {
173
+				echo '</tr></table>';
174
+			}
175
+		}
176
+	}
177
+	public static function submit( $name, $params = array('attrs' => '', 'value' => '') ) {
178
+		$params['type'] = 'submit';
179
+		self::input($name, $params);
180
+	}
181
+	public static function img( $src, $usePlugPath = 1, $params = array('width' => '', 'height' => '', 'attrs' => '') ) {
182
+		if ($usePlugPath) {
183
+			$src = WPF_IMG_PATH . $src;
184
+		}
185
+		echo '<img src="' . esc_url($src) . '" '
186
+				. ( isset($params['width']) ? 'width="' . esc_attr($params['width']) . '"' : '' )
187
+				. ' '
188
+				. ( isset($params['height']) ? 'height="' . esc_attr($params['height']) . '"' : '' )
189
+				. ' ';
190
+		if (!empty($params['attrs'])) {
191
+			self::echoEscapedHtml($params['attrs']);
192
+		}
193
+		echo ' />';
194
+	}
195
+	public static function selectbox( $name, $params = array('attrs' => '', 'options' => array(), 'value' => '') ) {
196
+		$params['attrs'] = isset($params['attrs']) ? $params['attrs'] : '';
197
+		$params['attrs'] .= self::_dataToAttrs($params);
198
+		if (isset($params['required']) && $params['required']) {
199
+			$params['attrs'] .= ' required ';	// HTML5 "required" validation attr
200
+		}
201
+		echo '<select name="' . esc_attr($name) . '" ';
202
+		if (!empty($params['attrs'])) {
203
+			self::echoEscapedHtml($params['attrs']);
204
+		}
205
+		echo '>';
206
+		$existValue = isset($params['value']);
207
+		if (!empty($params['options'])) {
208
+			foreach ($params['options'] as $k => $v) {
209
+				echo '<option value="' . esc_attr($k) . '"' . ( $existValue && $k == $params['value'] ? ' selected="true"' : '' ) . '>' . esc_html($v) . '</option>';
210
+			}
211
+		}
212
+		echo '</select>';
213
+	}
214
+	public static function selectlist( $name, $params = array('attrs'=>'', 'size'=> 5, 'options' => array(), 'value' => '') ) {
215
+		if (!strpos($name, '[]')) {
216
+			$name .= '[]';
217
+		}
218
+		if ( !isset($params['size']) || !is_numeric($params['size']) || ( '' == $params['size'] ) ) {
219
+			$params['size'] = 5;
220
+		}
221
+		$params['attrs'] = isset($params['attrs']) ? $params['attrs'] : '';
222
+		$params['attrs'] .= self::_dataToAttrs($params);
223
+
224
+		echo '<select multiple="multiple" size="' . esc_attr($params['size']) . '" name="' . esc_attr($name) . '" ';
225
+		if (!empty($params['attrs'])) {
226
+			self::echoEscapedHtml($params['attrs']);
227
+		}
228
+		echo '>';
229
+
230
+		$params['value'] = isset($params['value']) ? $params['value'] : array();
231
+		if (!empty($params['options'])) {
232
+			foreach ($params['options'] as $k => $v) {
233
+				$selected = ( in_array($k, (array) $params['value']) ? 'selected="true"' : '' );
234
+				echo '<option value="' . esc_attr($k) . '" ' . esc_attr($selected) . '>' . esc_html($v) . '</option>';
235
+			}
236
+		}
237
+		echo '</select>';
238
+	}
239
+	public static function file( $name, $params = array() ) {
240
+		$params['type'] = 'file';
241
+		self::input($name, $params);
242
+	}
243
+	public static function button( $params = array('attrs' => '', 'value' => '') ) {
244
+		echo '<button ';
245
+		if (!empty($params['attrs'])) {
246
+			self::echoEscapedHtml($params['attrs']);
247
+		}
248
+		echo '>' . esc_html($params['value']) . '</button>';
249
+	}
250
+	public static function buttonA( $params = array('attrs' => '', 'value' => '') ) {
251
+		echo '<a href="#" ';
252
+		if (!empty($params['attrs'])) {
253
+			self::echoEscapedHtml($params['attrs']);
254
+		}
255
+		echo '>' . esc_html($params['value']) . '</a>';
256
+	}
257
+	public static function inputButton( $params = array('attrs' => '', 'value' => '') ) {
258
+		if (!is_array($params)) {
259
+			$params = array();
260
+		}
261
+		$params['type'] = 'button';
262
+		self::input('', $params);
263
+	}
264
+	public static function radiobuttons( $name, $params = array('attrs' => '', 'options' => array(), 'value' => '', '') ) {
265
+		if (isset($params['options']) && is_array($params['options']) && !empty($params['options'])) {
266
+			$params['labeled'] = isset($params['labeled']) ? $params['labeled'] : false;
267
+			$params['attrs'] = isset($params['attrs']) ? $params['attrs'] : '';
268
+			$params['no_br'] = isset($params['no_br']) ? $params['no_br'] : false;
269
+			foreach ($params['options'] as $key => $val) {
270
+				$checked = ( $key == $params['value'] ) ? 'checked' : '';
271
+				if ($params['labeled']) {
272
+					echo '<label>' . esc_html($val) . '&nbsp;';
273
+				}
274
+				self::input($name, array('attrs' => $params['attrs'] . ' ' . $checked, 'type' => 'radio', 'value' => $key));
275
+				if ($params['labeled']) {
276
+					echo '</label>';
277
+				}
278
+				if (!$params['no_br']) {
279
+					echo '<br />';
280
+				}
281
+			}
282
+		}
283
+	}
284
+	public static function radiobutton( $name, $params = array('attrs' => '', 'value' => '', 'checked' => '') ) {
285
+		$params['type'] = 'radio';
286
+		$params['attrs'] = isset($params['attrs']) ? $params['attrs'] : '';
287
+		if (isset($params['checked']) && $params['checked']) {
288
+			$params['attrs'] .= ' checked';
289
+		}
290
+		self::input($name, $params);
291
+	}
292
+	public static function formStart( $name, $params = array('action' => '', 'method' => 'GET', 'attrs' => '', 'hideMethodInside' => false) ) {
293
+		$params['attrs'] = isset($params['attrs']) ? $params['attrs'] : '';
294
+		$params['action'] = isset($params['action']) ? $params['action'] : '';
295
+		$params['method'] = isset($params['method']) ? $params['method'] : 'GET';
296
+		echo '<form name="' . esc_attr($name) . '" action="' . esc_attr($params['action']) . '" method="' . esc_attr($params['method']) . '" ';
297
+		if (!empty($params['attrs'])) {
298
+			self::echoEscapedHtml($params['attrs']);
299
+		}
300
+		echo '>';
301
+
302
+		if (isset($params['hideMethodInside']) && $params['hideMethodInside']) {
303
+			self::hidden('method', array('value' => $params['method']));
304
+		}
305
+	}
306
+	public static function formEnd() {
307
+		echo '</form>';
308
+	}
309
+	public static function categorySelectlist( $name, $params = array('attrs'=>'', 'size'=> 5, 'value' => '') ) {
310
+		self::_loadCategoriesOptions();
311
+		if (self::$categoriesOptions) {
312
+			$params['options'] = self::$categoriesOptions;
313
+			self::selectlist($name, $params);
314
+		}
315
+		return false;
316
+	}
317
+	public static function categorySelectbox( $name, $params = array('attrs'=>'', 'size'=> 5, 'value' => '') ) {
318
+		self::_loadCategoriesOptions();
319
+		if (!empty(self::$categoriesOptions)) {
320
+			$params['options'] = self::$categoriesOptions;
321
+			self::selectbox($name, $params);
322
+		}
323
+		return false;
324
+	}
325
+	public static function productsSelectlist( $name, $params = array('attrs'=>'', 'size'=> 5, 'value' => '') ) {
326
+		self::_loadProductsOptions();
327
+		if (!empty(self::$productsOptions)) {
328
+			$params['options'] = self::$productsOptions;
329
+			self::selectlist($name, $params);
330
+		}
331
+		return false;
332
+	}
333
+	public static function productsSelectbox( $name, $params = array('attrs'=>'', 'size'=> 5, 'value' => '') ) {
334
+		self::_loadProductsOptions();
335
+		if (!empty(self::$productsOptions)) {
336
+			$params['options'] = self::$productsOptions;
337
+			self::selectbox($name, $params);
338
+		}
339
+		return false;
340
+	}
341
+	protected static function _loadCategoriesOptions() {
342
+		if (empty(self::$categoriesOptions)) {
343
+			$categories = FrameWpf::_()->getModule('products')->getCategories();
344
+			if (!empty($categories)) {
345
+				foreach ($categories as $c) {
346
+					self::$categoriesOptions[$c->term_taxonomy_id] = $c->cat_name;
347
+				}
348
+			}
349
+		}
350
+	}
351
+	protected static function _loadProductsOptions() {
352
+		if (empty(self::$productsOptions)) {
353
+			$products = FrameWpf::_()->getModule('products')->getModel()->get(array('getFields' => 'post.ID, post.post_title'));
354
+			if (!empty($products)) {
355
+				foreach ($products as $p) {
356
+					self::$productsOptions[$p['ID']] = $p['post_title'];
357
+				}
358
+			}
359
+		}
360
+	}
361
+	public static function colorpicker( $name, $params = array('value' => '') ) {
362
+		$value = isset($params['value']) ? $params['value'] : '';
363
+		echo '<div class="woobewoo-color-picker">';
364
+		self::text('', array('value' => $value, 'attrs' => ' data-alpha="true" class="woobewoo-color-result"'));
365
+		self::text($name, array('value' => $value, 'attrs' => 'class="woobewoo-color-result-text"'));
366
+		echo '</div>';
367
+	}
368
+	public static function checkboxHiddenVal( $name, $params = array('attrs' => '', 'value' => '', 'checked' => '') ) {
369
+		$params['attrs'] = isset($params['attrs']) ? $params['attrs'] : '';
370
+		$paramsCheck = $params;
371
+		$paramsHidden = $params;
372
+
373
+		$paramsCheck['attrs'] .= ' data-hiden-input=1';
374
+		$paramsCheck['value'] = isset($paramsCheck['value']) ? $paramsCheck['value'] : '';
375
+		$paramsCheck['checked'] = $paramsCheck['value'] ? '1' : '0';
376
+		self::checkbox(self::nameToClassId($name), $paramsCheck);
377
+		self::hidden($name, $paramsHidden);
378
+	}
379
+	public static function checkedOpt( $arr, $key, $value = true, $default = false ) {
380
+		if (!isset($arr[ $key ])) {
381
+			return $default ? true : false;
382
+		}
383
+		return true === $value ? $arr[ $key ] : $arr[ $key ] == $value;
384
+	}
385
+	public static function nonceForAction( $action ) {
386
+		self::hidden('_wpnonce', array('value' => wp_create_nonce(strtolower($action))));
387
+	}
388
+	public static function selectIcon( $name, $params ) {
389
+		echo '<div class="button chooseLoaderIcon">' . esc_html__('Choose Icon', 'woo-product-filter') . '</div>';
390
+	}
391
+
392
+	public static function startMetaButton( $name, $params ) {
393
+		echo '<button id="wpfStartMetaIndexing" class="button button-primary"><i class="fa fa-play" aria-hidden="true"></i></button>';
394
+	}
395
+}

+ 205 - 0
app/wp-content/plugins/woo-product-filter/classes/installer.php

@@ -0,0 +1,205 @@
1
+<?php
2
+class InstallerWpf {
3
+	public static $update_to_version_method = '';
4
+	private static $_firstTimeActivated = false;
5
+	public static function init( $isUpdate = false ) {
6
+		global $wpdb;
7
+		$wpPrefix = $wpdb->prefix; /* add to 0.0.3 Versiom */
8
+		require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
9
+		$current_version = get_option($wpPrefix . WPF_DB_PREF . 'db_version', 0);
10
+		if (!$current_version) {
11
+			self::$_firstTimeActivated = true;
12
+		}
13
+		/**
14
+		 * Table modules 
15
+		 */
16
+		if (!DbWpf::exist('@__modules')) {
17
+			dbDelta(DbWpf::prepareQuery("CREATE TABLE IF NOT EXISTS `@__modules` (
18
+			  `id` smallint(3) NOT NULL AUTO_INCREMENT,
19
+			  `code` varchar(32) NOT NULL,
20
+			  `active` tinyint(1) NOT NULL DEFAULT '0',
21
+			  `type_id` tinyint(1) NOT NULL DEFAULT '0',
22
+			  `label` varchar(64) DEFAULT NULL,
23
+			  `ex_plug_dir` varchar(255) DEFAULT NULL,
24
+			  PRIMARY KEY (`id`),
25
+			  UNIQUE INDEX `code` (`code`)
26
+			) DEFAULT CHARSET=utf8;"));
27
+			DbWpf::query("INSERT INTO `@__modules` (id, code, active, type_id, label) VALUES
28
+				(NULL, 'adminmenu',1,1,'Admin Menu'),
29
+				(NULL, 'options',1,1,'Options'),
30
+				(NULL, 'user',1,1,'Users'),
31
+				(NULL, 'pages',1,1,'Pages'),
32
+				(NULL, 'templates',1,1,'templates'),
33
+				(NULL, 'promo',1,1,'promo'),
34
+				(NULL, 'admin_nav',1,1,'admin_nav'),			  
35
+				(NULL, 'woofilters',1,1,'woofilters'),
36
+				(NULL, 'woofilters_widget',1,1,'woofilters_widget'),
37
+				(NULL, 'mail',1,1,'mail'),
38
+				(NULL, 'meta',1,1,'meta');");
39
+		}
40
+		/**
41
+		 *  Table modules_type 
42
+		 */
43
+		if (!DbWpf::exist('@__modules_type')) {
44
+			dbDelta(DbWpf::prepareQuery('CREATE TABLE IF NOT EXISTS `@__modules_type` (
45
+			  `id` smallint(3) NOT NULL AUTO_INCREMENT,
46
+			  `label` varchar(32) NOT NULL,
47
+			  PRIMARY KEY (`id`)
48
+			) AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;'));
49
+			DbWpf::query("INSERT INTO `@__modules_type` VALUES
50
+				(1,'system'),
51
+				(6,'addons');");
52
+		}
53
+		/**
54
+		 * Table filters
55
+		 */
56
+		if (!DbWpf::exist('@__filters')) {
57
+			dbDelta(DbWpf::prepareQuery('CREATE TABLE IF NOT EXISTS `@__filters` (
58
+				`id` INT(11) NOT NULL AUTO_INCREMENT,
59
+				`title` VARCHAR(128) NULL DEFAULT NULL,
60
+				`setting_data` MEDIUMTEXT NOT NULL,
61
+				PRIMARY KEY (`id`)
62
+			) DEFAULT CHARSET=utf8;'));
63
+		}
64
+		if (version_compare($current_version, '1.3.6') != 1) {
65
+			DbWpf::query('ALTER TABLE `@__filters` MODIFY setting_data MEDIUMTEXT;');
66
+		}
67
+		/**
68
+		* Plugin usage statistwpf
69
+		*/
70
+		if (!DbWpf::exist('@__usage_stat')) {
71
+			dbDelta(DbWpf::prepareQuery("CREATE TABLE `@__usage_stat` (
72
+			  `id` int(11) NOT NULL AUTO_INCREMENT,
73
+			  `code` varchar(64) NOT NULL,
74
+			  `visits` int(11) NOT NULL DEFAULT '0',
75
+			  `spent_time` int(11) NOT NULL DEFAULT '0',
76
+			  `modify_timestamp` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
77
+			  UNIQUE INDEX `code` (`code`),
78
+			  PRIMARY KEY (`id`)
79
+			) DEFAULT CHARSET=utf8"));
80
+			DbWpf::query("INSERT INTO `@__usage_stat` (code, visits) VALUES ('installed', 1)");
81
+		}
82
+		/**
83
+		 *  Table meta_keys 
84
+		 */
85
+		if (!DbWpf::exist('@__meta_keys')) {
86
+			dbDelta(DbWpf::prepareQuery('CREATE TABLE IF NOT EXISTS `@__meta_keys` (
87
+			  `id` INT(11) NOT NULL AUTO_INCREMENT,
88
+			  `meta_mode` smallint(3) NOT NULL,
89
+			  `meta_key` varchar(255) NOT NULL,
90
+			  `taxonomy` varchar(255) NOT NULL,
91
+			  `meta_like` smallint(3) NOT NULL,
92
+			  `parent` INT(11) NOT NULL,
93
+			  `meta_type` smallint(3) NOT NULL,
94
+			  `status` smallint(3) NOT NULL,
95
+			  `added` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
96
+			  `updated` TIMESTAMP,
97
+			  `locked` TIMESTAMP,
98
+			  `calculated` TIMESTAMP,
99
+			  PRIMARY KEY (`id`),
100
+			  UNIQUE INDEX `meta_key` (`meta_key`)
101
+			) DEFAULT CHARSET=utf8;'));
102
+			DbWpf::query("INSERT INTO `@__meta_keys` VALUES
103
+				(NULL,0,'_wpf_product_type','',0,0,0,0,CURRENT_TIMESTAMP,NULL,NULL,NULL),
104
+				(NULL,0,'_product_attributes','',0,0,8,0,CURRENT_TIMESTAMP,NULL,NULL,NULL),
105
+				(NULL,0,'attribute_%','',1,0,0,0,CURRENT_TIMESTAMP,NULL,NULL,NULL),
106
+				(NULL,0,'_wc_average_rating','',0,0,3,0,CURRENT_TIMESTAMP,NULL,NULL,NULL),
107
+				(NULL,0,'_stock_status','',0,0,0,0,CURRENT_TIMESTAMP,NULL,NULL,NULL),
108
+				(NULL,0,'_price','',0,0,1,0,CURRENT_TIMESTAMP,NULL,NULL,NULL),
109
+				(NULL,0,'_sale_price','',0,0,1,0,CURRENT_TIMESTAMP,NULL,NULL,NULL);");
110
+		}
111
+		/**
112
+		 *  Table meta_data 
113
+		 */
114
+		if (!DbWpf::exist('@__meta_data')) {
115
+			dbDelta(DbWpf::prepareQuery('CREATE TABLE IF NOT EXISTS `@__meta_data` (
116
+			  `id` bigint NOT NULL AUTO_INCREMENT,
117
+			  `product_id` bigint NOT NULL,
118
+			  `is_var` smallint(3) NOT NULL DEFAULT 0,
119
+			  `key_id` INT(11) NOT NULL,
120
+			  `val_int` bigint,
121
+			  `val_dec` decimal(19,4),
122
+			  `val_id` bigint,
123
+			  `updated` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
124
+			  PRIMARY KEY (`id`)
125
+			) DEFAULT CHARSET=utf8;'));
126
+		}
127
+		/**
128
+		 *  Table meta_values 
129
+		 */
130
+		if (!DbWpf::exist('@__meta_values')) {
131
+			dbDelta(DbWpf::prepareQuery('CREATE TABLE IF NOT EXISTS `@__meta_values` (
132
+			  `id` bigint NOT NULL AUTO_INCREMENT,
133
+			  `key_id` INT(11) NOT NULL,
134
+			  `key2` varchar(32) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
135
+			  `key3` varchar(32) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
136
+			  `key4` varchar(32) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
137
+			  `value` varchar(150) CHARACTER SET utf8 COLLATE utf8_bin,
138
+			  `product_cnt` INT(11) NOT NULL DEFAULT 0,
139
+			  `variation_cnt` INT(11) NOT NULL DEFAULT 0,
140
+			  PRIMARY KEY (`id`)
141
+			) DEFAULT CHARSET=utf8;'));
142
+		}
143
+		/**
144
+		 *  Table meta_values_bk
145
+		 */
146
+		if (!DbWpf::exist('@__meta_values_bk')) {
147
+			dbDelta(DbWpf::prepareQuery('CREATE TABLE IF NOT EXISTS `@__meta_values_bk` (
148
+			  `id` bigint NOT NULL,
149
+			  `key_id` INT(11) NOT NULL,
150
+			  `key2` varchar(32) NOT NULL,
151
+			  `key3` varchar(32) NOT NULL,
152
+			  `key4` varchar(32) NOT NULL,
153
+			  `value` varchar(150),
154
+			  PRIMARY KEY (`id`),
155
+			  INDEX `key_id` (`key_id`)
156
+			) DEFAULT CHARSET=utf8;'));
157
+		}
158
+		InstallerDbUpdaterWpf::runUpdate($current_version);
159
+		if ($current_version && !self::$_firstTimeActivated) {
160
+			self::setUsed();
161
+			// For users that just updated our plugin - don't need tp show step-by-step tutorial
162
+			update_user_meta(get_current_user_id(), WPF_CODE . '-tour-hst', array('closed' => 1));
163
+		}
164
+		update_option($wpPrefix . WPF_DB_PREF . 'db_version', WPF_VERSION);
165
+		add_option($wpPrefix . WPF_DB_PREF . 'db_installed', 1);
166
+		if ( !wp_next_scheduled( 'wpf_calc_meta_indexing' ) ) {
167
+			wp_schedule_single_event( time() + 5, 'wpf_calc_meta_indexing' );
168
+		}		
169
+	}
170
+	public static function setUsed() {
171
+		update_option(WPF_DB_PREF . 'plug_was_used', 1);
172
+	}
173
+	public static function isUsed() {
174
+		return (int) get_option(WPF_DB_PREF . 'plug_was_used');
175
+	}
176
+	public static function delete() {
177
+		self::_checkSendStat('delete');
178
+		global $wpdb;
179
+		$wpPrefix = $wpdb->prefix;
180
+		$wpdb->query('DROP TABLE IF EXISTS `' . $wpdb->prefix . esc_sql(WPF_DB_PREF) . 'modules`');
181
+		$wpdb->query('DROP TABLE IF EXISTS `' . $wpdb->prefix . esc_sql(WPF_DB_PREF) . 'modules_type`');
182
+		$wpdb->query('DROP TABLE IF EXISTS `' . $wpdb->prefix . esc_sql(WPF_DB_PREF) . 'usage_stat`');
183
+		$wpdb->query('DROP TABLE IF EXISTS `' . $wpdb->prefix . esc_sql(WPF_DB_PREF) . 'meta_data`');
184
+		delete_option($wpPrefix . WPF_DB_PREF . 'db_version');
185
+		delete_option($wpPrefix . WPF_DB_PREF . 'db_installed');
186
+	}
187
+	public static function deactivate() {
188
+		self::_checkSendStat('deactivate');
189
+	}
190
+	private static function _checkSendStat( $statCode ) {
191
+		if (class_exists('FrameWpf') && FrameWpf::_()->getModule('promo') && FrameWpf::_()->getModule('options')) {
192
+			FrameWpf::_()->getModule('promo')->getModel()->saveUsageStat( $statCode );
193
+			FrameWpf::_()->getModule('promo')->getModel()->checkAndSend( true );
194
+		}
195
+	}
196
+	public static function update() {
197
+		global $wpdb;
198
+		$wpPrefix = $wpdb->prefix; /* add to 0.0.3 Versiom */
199
+		$currentVersion = get_option($wpPrefix . WPF_DB_PREF . 'db_version', 0);
200
+		if (!$currentVersion || version_compare(WPF_VERSION, $currentVersion, '>')) {
201
+			self::init( true );
202
+			update_option($wpPrefix . WPF_DB_PREF . 'db_version', WPF_VERSION);
203
+		}
204
+	}
205
+}

+ 12 - 0
app/wp-content/plugins/woo-product-filter/classes/installerDbUpdater.php

@@ -0,0 +1,12 @@
1
+<?php
2
+
3
+class InstallerDbUpdaterWpf {
4
+	public static function runUpdate( $current_version ) {
5
+		if ( DbWpf::get( "SELECT 1 FROM `@__modules` WHERE code='meta'", 'one' ) != 1 ) {
6
+			DbWpf::query( "INSERT INTO `@__modules` (id, code, active, type_id, label) VALUES (NULL, 'meta', 1, 1, 'meta');" );
7
+		}
8
+		if ( ! DbWpf::existsTableColumn( '@__filters', 'meta_keys' ) ) {
9
+			DbWpf::query( 'ALTER TABLE `@__filters` ADD COLUMN `meta_keys` varchar(255) NULL DEFAULT NULL AFTER `setting_data`' );
10
+		}
11
+	}
12
+}

+ 106 - 0
app/wp-content/plugins/woo-product-filter/classes/lang.php

@@ -0,0 +1,106 @@
1
+<?php
2
+class LangWpf {
3
+	private static $_codeStorage = array();
4
+	private static $_data = array();
5
+	/**
6
+	 * Initialize language for plugin
7
+	 */
8
+	public static function init() {
9
+	}
10
+	public static function attach( $d ) {
11
+		self::$_data = array_merge(self::$_data, self::extract($d));
12
+	}
13
+	public static function extract( $d = array('dir' => '', 'LangWpf' => '') ) {
14
+		$data = array();
15
+		if (isset($d['dir']) && !empty($d['dir'])) {
16
+			$langDirPath = $d['dir'];
17
+		} else if (isset($d['LangWpf']) && !empty($d['LangWpf'])) {
18
+			$langDirPath = WPF_LANG_DIR . $d['LangWpf'] . DS;
19
+		} else {
20
+			$langDirPath = WPF_LANG_DIR . WPF_WPLANG . DS;
21
+		}
22
+
23
+		if (is_dir($langDirPath)) {
24
+			$dh = opendir($langDirPath);
25
+			while ( ( $file = readdir($dh) ) !== false ) {
26
+				if (!in_array($file, array('.', '..')) && !empty($file)) {
27
+					$fileinfo = pathinfo($langDirPath . $file);
28
+					if ('ini' == $fileinfo['extension']) {
29
+						$langArr = parse_ini_file($langDirPath . $file, true);
30
+						if (is_array($langArr) && !empty($langArr)) {
31
+							$normalLangArr = array();
32
+							foreach ($langArr as $k => $v) {
33
+								$normalLangArr[ self::unEscKey($k) ] = $v;
34
+							}
35
+							$data = array_merge($data, $normalLangArr);
36
+						}
37
+					}
38
+				}
39
+			}
40
+			closedir($dh);
41
+		}
42
+		if (!is_array($data)) {
43
+			$data = array();
44
+		}
45
+		return $data;
46
+	}
47
+	/**
48
+	 * Get string for output
49
+	 *
50
+	 * @param mixed $name if string given - return it's translation, of array - return translation for each element imploded by " "
51
+	 * @return string if found translation - return translated string, if no - return string $name
52
+	 */
53
+	public static function _( $name ) {
54
+		if (is_array($name)) {
55
+			$res = array();
56
+			foreach ($name as $n) {
57
+				$res[] = self::_($n);
58
+			}
59
+			return implode(' ', $res);
60
+		} elseif (isset(self::$_data[$name])) {
61
+			return self::$_data[$name];
62
+		}
63
+		return $name;
64
+	}
65
+	public static function getData() {
66
+		return self::$_data;
67
+	}
68
+	public static function unEscKey( $key ) {
69
+		$illegals = self::getIllegalIniChars();
70
+		return str_replace(
71
+				$illegals,
72
+				array_keys($illegals),
73
+				$key);
74
+	}
75
+	public static function escKey( $key ) {
76
+		$illegals = self::getIllegalIniChars();
77
+		return str_replace(
78
+				array_keys($illegals),
79
+				$illegals,
80
+				$key);
81
+	}
82
+	/**
83
+	 * Illegal characters for keys in .ini files and it's representation for us
84
+	 */
85
+	public static function getIllegalIniChars() {
86
+		return array(
87
+			'?' => '%quest%',
88
+			'{' => '%opening_brace%',
89
+			'}' => '%closing_brace%',
90
+			'|' => '%vertical_bar%',
91
+			'&' => '%ampersand%',
92
+			'~' => '%tilde%',
93
+			'!' => '%exclamation_point%',
94
+			'[' => '%opening_bracket%',
95
+			']' => '%closing_bracket%',
96
+			'(' => '%opening_parenthesis%',
97
+			')' => '%closing_parenthesis%',
98
+			'^' => '%caret%',
99
+			'Yes'	=> '%Yes%',
100
+			'yes'	=> '%yes%',
101
+			'No'	=> '%No%',
102
+			'no'	=> '%no%',
103
+			'none'	=> '%none%',
104
+		);
105
+	}
106
+}

+ 296 - 0
app/wp-content/plugins/woo-product-filter/classes/modInstaller.php

@@ -0,0 +1,296 @@
1
+<?php
2
+class ModInstallerWpf {
3
+	private static $_current = array();
4
+	/**
5
+	 * Install new ModuleWpf into plugin
6
+	 *
7
+	 * @param string $module new ModuleWpf data (@see classes/tables/modules.php)
8
+	 * @param string $path path to the main plugin file from what module is installed
9
+	 * @return bool true - if install success, else - false
10
+	 */
11
+	public static function install( $module, $path ) {
12
+		$exPlugDest = explode('plugins', $path);
13
+		if (!empty($exPlugDest[1])) {
14
+			$module['ex_plug_dir'] = str_replace(DS, '', $exPlugDest[1]);
15
+		}
16
+		$path = $path . DS . $module['code'];
17
+		if (!empty($module) && !empty($path) && is_dir($path)) {
18
+			if (self::isModule($path)) {
19
+				$filesMoved = false;
20
+				if (empty($module['ex_plug_dir'])) {
21
+					$filesMoved = self::moveFiles($module['code'], $path);
22
+				} else {
23
+					$filesMoved = true;     //Those modules doesn't need to move their files
24
+				}
25
+				if ($filesMoved) {
26
+					if (FrameWpf::_()->getTable('modules')->exists($module['code'], 'code')) {
27
+						FrameWpf::_()->getTable('modules')->delete(array('code' => $module['code']));
28
+					}
29
+					if ('license' != $module['code']) {
30
+						$module['active'] = 0;
31
+					}
32
+					FrameWpf::_()->getTable('modules')->insert($module);
33
+					self::_runModuleInstall($module);
34
+					self::_installTables($module);
35
+					return true;
36
+				} else {
37
+					/* translators: %s: module name */
38
+					ErrorsWpf::push(esc_html(sprintf(__('Move files for %s failed'), $module['code'])), ErrorsWpf::MOD_INSTALL);
39
+				}
40
+			} else {
41
+				/* translators: %s: module name */
42
+				ErrorsWpf::push(esc_html(sprintf(__('%s is not plugin module'), $module['code'])), ErrorsWpf::MOD_INSTALL);
43
+			}
44
+		}
45
+		return false;
46
+	}
47
+	protected static function _runModuleInstall( $module, $action = 'install' ) {
48
+		$moduleLocationDir = WPF_MODULES_DIR;
49
+		if (!empty($module['ex_plug_dir'])) {
50
+			$moduleLocationDir = UtilsWpf::getPluginDir( $module['ex_plug_dir'] );
51
+		}
52
+		if (is_dir($moduleLocationDir . $module['code'])) {
53
+			if (!class_exists($module['code'] . strFirstUpWpf(WPF_CODE))) {
54
+				importClassWpf($module['code'] . strFirstUpWpf(WPF_CODE), $moduleLocationDir . $module['code'] . DS . 'mod.php');
55
+			}
56
+			$moduleClass = toeGetClassNameWpf($module['code']);
57
+			$moduleObj = new $moduleClass($module);
58
+			if ($moduleObj) {
59
+				$moduleObj->$action();
60
+			}
61
+		}
62
+	}
63
+	/**
64
+	 * Check whether is or no module in given path
65
+	 *
66
+	 * @param string $path path to the module
67
+	 * @return bool true if it is module, else - false
68
+	 */
69
+	public static function isModule( $path ) {
70
+		return true;
71
+	}
72
+	/**
73
+	 * Move files to plugin modules directory
74
+	 *
75
+	 * @param string $code code for module
76
+	 * @param string $path path from what module will be moved
77
+	 * @return bool is success - true, else - false
78
+	 */
79
+	public static function moveFiles( $code, $path ) {
80
+		if (!is_dir(WPF_MODULES_DIR . $code)) {
81
+			if (mkdir(WPF_MODULES_DIR . $code)) {
82
+				UtilsWpf::copyDirectories($path, WPF_MODULES_DIR . $code);
83
+				return true;
84
+			} else {
85
+				ErrorsWpf::push(esc_html__('Cannot create module directory. Try to set permission to ' . WPF_MODULES_DIR . ' directory 755 or 777', 'woo-product-filter'), ErrorsWpf::MOD_INSTALL);
86
+			}
87
+		} else {
88
+			return true;
89
+		}
90
+		return false;
91
+	}
92
+	private static function _getPluginLocations() {
93
+		$locations = array();
94
+		$plug = ReqWpf::getVar('plugin');
95
+		if ( empty( $plug ) ) {
96
+			$plug = ReqWpf::getVar( 'checked' );
97
+			if ( isset( $plug[0] ) ) {
98
+				$plug = $plug[0];
99
+			}
100
+		}
101
+
102
+		$locations['plugPath'] = empty($plug) && function_exists('getProPlugFullPathWpf') ? plugin_basename(getProPlugFullPathWpf()) : plugin_basename( trim( $plug ) );
103
+		$locations['plugDir'] = dirname(WP_PLUGIN_DIR . DS . $locations['plugPath']);
104
+		$locations['plugMainFile'] = WP_PLUGIN_DIR . DS . $locations['plugPath'];
105
+		$locations['xmlPath'] = $locations['plugDir'] . DS . 'install.xml';
106
+		return $locations;
107
+	}
108
+
109
+	/**
110
+	 * Try to parse xml file with module data
111
+	 *
112
+	 * @param string $xmlPath
113
+	 *
114
+	 * @return array
115
+	 */
116
+	private static function _getModulesFromXml( $xmlPath ) {
117
+		$modDataArr = array();
118
+
119
+		if (function_exists('simplexml_load_file')) {
120
+			$xml = UtilsWpf::getXml($xmlPath);
121
+			if ($xml) {
122
+				if (isset($xml->modules) && isset($xml->modules->mod)) {
123
+					$modules = array();
124
+					$xmlMods = $xml->modules->children();
125
+					foreach ($xmlMods->mod as $mod) {
126
+						$modules[] = $mod;
127
+					}
128
+					if (empty($modules)) {
129
+						ErrorsWpf::push(esc_html__('No modules were found in XML file', 'woo-product-filter'), ErrorsWpf::MOD_INSTALL);
130
+					} else {
131
+						foreach ($modules as $m) {
132
+							$modDataArr[] = UtilsWpf::xmlNodeAttrsToArr($m);
133
+						}
134
+					}
135
+				} else {
136
+					ErrorsWpf::push(esc_html__('Invalid XML file', 'woo-product-filter'), ErrorsWpf::MOD_INSTALL);
137
+				}
138
+			} else {
139
+				ErrorsWpf::push(esc_html__('No XML file were found', 'woo-product-filter'), ErrorsWpf::MOD_INSTALL);
140
+			}
141
+		} else {
142
+			$modDataArr = unserialize(WPF_PRO_MODULES);
143
+		}
144
+		return $modDataArr;
145
+	}
146
+	/**
147
+	 * Check whether modules is installed or not, if not and must be activated - install it
148
+	 *
149
+	 * @param array $codes array with modules data to store in database
150
+	 * @param string $path path to plugin file where modules is stored (__FILE__ for example)
151
+	 * @return bool true if check ok, else - false
152
+	 */
153
+	public static function check( $extPlugName = '' ) {
154
+		if (WPF_TEST_MODE) {
155
+			add_action('activated_plugin', array(FrameWpf::_(), 'savePluginActivationErrors'));
156
+		}
157
+		$locations = self::_getPluginLocations();
158
+
159
+		$modules = self::_getModulesFromXml($locations['xmlPath']);
160
+		foreach ($modules as $modDataArr) {
161
+			if (!empty($modDataArr)) {
162
+				//If module Exists - just activate it, we can't check this using FrameWpf::moduleExists because this will not work for multy-site WP
163
+				if (FrameWpf::_()->getTable('modules')->exists($modDataArr['code'], 'code')) {
164
+					self::activate($modDataArr);
165
+					//  if not - install it
166
+				} else {
167
+					if (!self::install($modDataArr, $locations['plugDir'])) {
168
+						/* translators: %s: module name */
169
+						ErrorsWpf::push(esc_html(sprintf(__('Install %s failed'), $modDataArr['code'])), ErrorsWpf::MOD_INSTALL);
170
+					}
171
+				}
172
+			}
173
+		}
174
+		if (ErrorsWpf::haveErrors(ErrorsWpf::MOD_INSTALL)) {
175
+			self::displayErrors(false);
176
+			return false;
177
+		}
178
+		update_option(WPF_CODE . '_full_installed', 1);
179
+		return true;
180
+	}
181
+	/**
182
+	 * Public alias for _getCheckRegPlugs()
183
+	 * We will run this each time plugin start to check modules activation messages
184
+	 */
185
+	public static function checkActivationMessages() {
186
+
187
+	}
188
+	/**
189
+	 * Deactivate module after deactivating external plugin
190
+	 */
191
+	public static function deactivate( $exclude = array() ) {
192
+		$locations = self::_getPluginLocations();
193
+		$modules = self::_getModulesFromXml($locations['xmlPath']);
194
+		if (empty($exclude)) {
195
+			$exclude = array();
196
+		}
197
+
198
+		foreach ($modules as $modDataArr) {
199
+			if (FrameWpf::_()->moduleActive($modDataArr['code']) && !in_array($modDataArr['code'], $exclude)) { //If module is active - then deacivate it
200
+				if (FrameWpf::_()->getModule('options')->getModel('modules')->put(array(
201
+					'id' => FrameWpf::_()->getModule($modDataArr['code'])->getID(),
202
+					'active' => 0,
203
+				))->error) {
204
+					ErrorsWpf::push(esc_html__('Error Deactivation module', 'woo-product-filter'), ErrorsWpf::MOD_INSTALL);
205
+				}
206
+			}
207
+		}
208
+
209
+		if (ErrorsWpf::haveErrors(ErrorsWpf::MOD_INSTALL)) {
210
+			self::displayErrors(false);
211
+			return false;
212
+		}
213
+		return true;
214
+	}
215
+	public static function activate( $modDataArr ) {
216
+		$locations = self::_getPluginLocations();
217
+		$modules = self::_getModulesFromXml($locations['xmlPath']);
218
+		foreach ($modules as $modDataArr) {
219
+			if (!FrameWpf::_()->moduleActive($modDataArr['code'])) { //If module is not active - then acivate it
220
+				if (FrameWpf::_()->getModule('options')->getModel('modules')->put(array(
221
+					'code' => $modDataArr['code'],
222
+					'active' => 1,
223
+				))->error) {
224
+					ErrorsWpf::push(esc_html__('Error Activating module', 'woo-product-filter'), ErrorsWpf::MOD_INSTALL);
225
+				} else {
226
+					$dbModData = FrameWpf::_()->getModule('options')->getModel('modules')->get(array('code' => $modDataArr['code']));
227
+					if (!empty($dbModData) && !empty($dbModData[0])) {
228
+						$modDataArr['ex_plug_dir'] = $dbModData[0]['ex_plug_dir'];
229
+					}
230
+					self::_runModuleInstall($modDataArr, 'activate');
231
+				}
232
+			}
233
+		}
234
+	} 
235
+	/**
236
+	 * Display all errors for module installer, must be used ONLY if You realy need it
237
+	 */
238
+	public static function displayErrors( $exit = true ) {
239
+		$errors = ErrorsWpf::get(ErrorsWpf::MOD_INSTALL);
240
+		foreach ($errors as $e) {
241
+			echo '<b class="woobewoo-error">' . esc_html($e) . '</b><br />';
242
+		}
243
+		if ($exit) {
244
+			exit();
245
+		}
246
+	}
247
+	public static function uninstall() {
248
+		$isPro = false;
249
+		$locations = self::_getPluginLocations();
250
+		$modules = self::_getModulesFromXml($locations['xmlPath']);
251
+		foreach ($modules as $modDataArr) {
252
+			self::_uninstallTables($modDataArr);
253
+			FrameWpf::_()->getModule('options')->getModel('modules')->delete(array('code' => $modDataArr['code']));
254
+			UtilsWpf::deleteDir(WPF_MODULES_DIR . $modDataArr['code']);
255
+
256
+			if ('license' == $modDataArr['code']) {
257
+				$isPro = true;
258
+			}
259
+		}
260
+
261
+		if ($isPro) {
262
+			self::uninstallLicense();
263
+		}
264
+	}
265
+	public static function uninstallLicense() {
266
+		FrameWpf::_()->getModule('options')->getModel()->save('license_save_name', '');
267
+	}
268
+	protected static function _uninstallTables( $module ) {
269
+		if (is_dir(WPF_MODULES_DIR . $module['code'] . DS . 'tables')) {
270
+			$tableFiles = UtilsWpf::getFilesList(WPF_MODULES_DIR . $module['code'] . DS . 'tables');
271
+			if (!empty($tableNames)) {
272
+				foreach ($tableFiles as $file) {
273
+					$tableName = str_replace('.php', '', $file);
274
+					if (FrameWpf::_()->getTable($tableName)) {
275
+						FrameWpf::_()->getTable($tableName)->uninstall();
276
+					}
277
+				}
278
+			}
279
+		}
280
+	}
281
+	public static function _installTables( $module, $action = 'install' ) {
282
+		$modDir = empty($module['ex_plug_dir']) ? WPF_MODULES_DIR . $module['code'] . DS : UtilsWpf::getPluginDir($module['ex_plug_dir']) . $module['code'] . DS; 
283
+		if (is_dir($modDir . 'tables')) {
284
+			$tableFiles = UtilsWpf::getFilesList($modDir . 'tables');
285
+			if (!empty($tableFiles)) {
286
+				FrameWpf::_()->extractTables($modDir . 'tables' . DS);
287
+				foreach ($tableFiles as $file) {
288
+					$tableName = str_replace('.php', '', $file);
289
+					if (FrameWpf::_()->getTable($tableName)) {
290
+						FrameWpf::_()->getTable($tableName)->$action();
291
+					}
292
+				}
293
+			}
294
+		}
295
+	}
296
+}

+ 292 - 0
app/wp-content/plugins/woo-product-filter/classes/model.php

@@ -0,0 +1,292 @@
1
+<?php
2
+abstract class ModelWpf extends BaseObjectWpf {
3
+	protected $_data = array();
4
+	protected $_code = '';
5
+	
6
+	protected $_orderBy = '';
7
+	protected $_sortOrder = '';
8
+	protected $_groupBy = '';
9
+	protected $_limit = '';
10
+	protected $_where = array();
11
+	protected $_stringWhere = '';
12
+	protected $_selectFields = '*';
13
+	protected $_tbl = '';
14
+	protected $_lastGetCount = 0;
15
+	protected $_idField = 'id';
16
+	protected $_indexes = array();
17
+
18
+	public function setCode( $code ) {
19
+		$this->_code = $code;
20
+	}
21
+	public function getCode() {
22
+		return $this->_code;
23
+	}
24
+	public function getModule() {
25
+		return FrameWpf::_()->getModule( $this->_code );
26
+	}
27
+	
28
+	protected function _setTbl( $tbl ) {
29
+		$this->_tbl = $tbl;
30
+	}	
31
+	public function setOrderBy( $orderBy ) {
32
+		$this->_orderBy = $orderBy;
33
+		return $this;
34
+	}
35
+	public function setIndexes( $indexes ) {
36
+		$this->_indexes = $indexes;
37
+	}
38
+	/**
39
+	 * ASC, DESC
40
+	 */
41
+	public function setSortOrder( $sortOrder ) {
42
+		$this->_sortOrder = $sortOrder;
43
+		return $this;
44
+	}
45
+	public function setLimit( $limit ) {
46
+		$this->_limit = $limit;
47
+		return $this;
48
+	}
49
+	public function setWhere( $where ) {
50
+		$this->_where = $where;
51
+		return $this;
52
+	}
53
+	public function addWhere( $where ) {
54
+		if (empty($this->_where) && !is_string($where)) {
55
+			$this->setWhere( $where );
56
+		} elseif (is_array($this->_where) && is_array($where)) {
57
+			$this->_where = array_merge($this->_where, $where);
58
+		} elseif (is_string($where)) {
59
+			if (!isset($this->_where['additionalCondition'])) {
60
+				$this->_where['additionalCondition'] = '';
61
+			}
62
+			if (!empty($this->_where['additionalCondition'])) {
63
+				$this->_where['additionalCondition'] .= ' AND ';
64
+			}
65
+			$this->_where['additionalCondition'] .= $where;
66
+		}
67
+		return $this;
68
+	}
69
+	public function setSelectFields( $selectFields ) {
70
+		if (is_array($selectFields)) {
71
+			$selectFields = implode(',', $selectFields);
72
+		}
73
+		$this->_selectFields = $selectFields;
74
+		return $this;
75
+	}
76
+	public function groupBy( $groupBy ) {
77
+		$this->_groupBy = $groupBy;
78
+		return $this;
79
+	}
80
+	public function getLastGetCount() {
81
+		return $this->_lastGetCount;
82
+	}
83
+	public function getFromTbl( $params = array() ) {
84
+		$this->_lastGetCount = 0;
85
+		$tbl = isset($params['tbl']) ? $params['tbl'] : $this->_tbl;
86
+		$table = FrameWpf::_()->getTable( $tbl );
87
+		$this->_buildQuery( $table );
88
+		$return = isset($params['return']) ? $params['return'] : 'all';
89
+		$data = $table->get($this->_selectFields, $this->_where, '', $return);
90
+		if (!empty($data)) {
91
+			switch ($return) {
92
+				case 'one':
93
+					$this->_lastGetCount = 1;
94
+					break;
95
+				case 'row':
96
+					$data = $this->_afterGetFromTbl( $data );
97
+					$this->_lastGetCount = 1;
98
+					break;
99
+				default:
100
+					foreach ($data as $i => $row) {
101
+						$data[ $i ] = $this->_afterGetFromTbl( $row );
102
+					}
103
+					$this->_lastGetCount = count( $data );
104
+					break;
105
+			}
106
+		}
107
+		$this->_clearQuery( $params );
108
+		return $data;
109
+	}
110
+	protected function _clearQuery( $params = array() ) {
111
+		$clear = isset($params['clear']) ? $params['clear'] : array();
112
+		if (!is_array($clear)) {
113
+			$clear = array($clear);
114
+		}
115
+		if (empty($clear) || in_array('limit', $clear)) {
116
+			$this->_limit = '';
117
+		}
118
+		if (empty($clear) || in_array('orderBy', $clear)) {
119
+			$this->_orderBy = '';
120
+		}
121
+		if (empty($clear) || in_array('sortOrder', $clear)) {
122
+			$this->_sortOrder = '';
123
+		}
124
+		if (empty($clear) || in_array('where', $clear)) {
125
+			$this->_where = array();
126
+		}
127
+		if (empty($clear) || in_array('selectFields', $clear)) {
128
+			$this->_selectFields = '*';
129
+		}
130
+		if (empty($clear) || in_array('groupBy', $clear)) {
131
+			$this->_groupBy = '';
132
+		}
133
+	}
134
+	public function getCount( $params = array() ) {
135
+		$tbl = isset($params['tbl']) ? $params['tbl'] : $this->_tbl;
136
+		$table = FrameWpf::_()->getTable( $tbl );
137
+		$this->setSelectFields('COUNT(*) AS total');
138
+		$this->_buildQuery( $table );
139
+		$data = (int) $table->get($this->_selectFields, $this->_where, '', 'one');
140
+		$this->_clearQuery($params);
141
+		return $data;
142
+	}
143
+	protected function _afterGetFromTbl( $row ) {
144
+		// You can re-define this method in your own model
145
+		return $row;
146
+	}
147
+	protected function _buildQuery( $table = null ) {
148
+		if (!$table) {
149
+			$table = FrameWpf::_()->getTable( $this->_tbl );
150
+		}
151
+		if (!empty($this->_orderBy)) {
152
+			$order = $this->_orderBy;
153
+			if (!empty($this->_sortOrder)) {
154
+				$order .= ' ' . strtoupper($this->_sortOrder);
155
+			}
156
+			$table->orderBy( $order );
157
+		}
158
+		if (!empty($this->_groupBy)) {
159
+			$table->groupBy( $this->_groupBy );
160
+		}
161
+		if (!empty($this->_limit)) {
162
+			$table->setLimit( $this->_limit );
163
+		}
164
+	}
165
+	public function removeGroup( $ids ) {
166
+		if (!is_array($ids)) {
167
+			$ids = array($ids);
168
+		}
169
+		// Remove all empty values
170
+		$ids = array_filter(array_map('intval', $ids));
171
+		if (!empty($ids)) {
172
+			if (FrameWpf::_()->getTable( $this->_tbl )->delete(array('additionalCondition' => 'id IN (' . implode(',', $ids) . ')'))) {
173
+				return true;
174
+			} else {
175
+				$this->pushError(esc_html__('Database error detected', 'woo-product-filter'));
176
+			}
177
+		} else {
178
+			$this->pushError(esc_html__('Invalid ID', 'woo-product-filter'));
179
+		}
180
+		return false;
181
+	}
182
+	public function clear() {
183
+		return $this->delete();	// Just delete all
184
+	}
185
+	public function delete( $params = array() ) {
186
+		if (FrameWpf::_()->getTable( $this->_tbl )->delete( $params )) {
187
+			return true;
188
+		} else {
189
+			$this->pushError(esc_html__('Database error detected', 'woo-product-filter'));
190
+		}
191
+		return false;
192
+	}
193
+	public function getById( $id ) {
194
+		$data = $this->setWhere(array($this->_idField => $id))->getFromTbl();
195
+		return empty($data) ? false : array_shift($data);
196
+	}
197
+	public function insert( $data ) {
198
+		$data = $this->_dataSave($data, false);
199
+		$id = FrameWpf::_()->getTable( $this->_tbl)->insert( $data );
200
+		if ($id) {
201
+			return $id;
202
+		}
203
+		$this->pushError(FrameWpf::_()->getTable( $this->_tbl )->getErrors());
204
+		return false;
205
+	}
206
+	public function updateById( $data, $id = 0 ) {
207
+		if (!$id) {
208
+			$id = isset($data[ $this->_idField ]) ? (int) $data[ $this->_idField ] : 0;
209
+		}
210
+		if ($id) {
211
+			return $this->update($data, array($this->_idField => $id));
212
+		} else {
213
+			$this->pushError(esc_html__('Empty or invalid ID', 'woo-product-filter'));
214
+		}
215
+		return false;
216
+	}
217
+	public function update( $data, $where ) {
218
+		$data = $this->_dataSave($data, true);
219
+		if (FrameWpf::_()->getTable( $this->_tbl )->update( $data, $where )) {
220
+			return true;
221
+		}
222
+		$this->pushError(FrameWpf::_()->getTable( $this->_tbl )->getErrors());
223
+		return false;
224
+	}
225
+	protected function _dataSave( $data, $update = false ) {
226
+		return $data;
227
+	}
228
+	public function getTbl() {
229
+		return $this->_tbl;
230
+	}
231
+	/**
232
+	 * We can re-define this method to not retrive all data - for simple tables
233
+	 */
234
+	public function setSimpleGetFields() {
235
+		return $this;
236
+	}
237
+	public function dropIndexes( $withPrimary = false ) {
238
+		$table = $this->_tbl;
239
+		$indexes = DbWpf::get('SHOW INDEX FROM `@__' . $table . '`');
240
+		if (!$indexes) {
241
+			$this->pushError(DbWpf::getError());
242
+			return false;
243
+		}
244
+
245
+		$drop = array();
246
+		foreach ($indexes as $index) {
247
+			$name = $index['Key_name'];
248
+			if ($withPrimary || 'PRIMARY' != $name) {
249
+				$drop[] = ' DROP INDEX ' . $name;
250
+			}
251
+		}
252
+		if (!empty($drop)) {
253
+			if (!DbWpf::query('ALTER TABLE `@__' . $table . '`' . implode(',', array_unique($drop)))) {
254
+				$this->pushError(DbWpf::getError());
255
+				return false;
256
+			}
257
+		}
258
+		return true;
259
+	}
260
+	public function addIndexes( $delete = true ) {
261
+		if (empty($this->_indexes)) {
262
+			return true;
263
+		}
264
+		$table = $this->_tbl;
265
+		$indexes = DbWpf::get('SHOW INDEX FROM `@__' . $table . '`');
266
+		if (!$indexes) {
267
+			$this->pushError(DbWpf::getError());
268
+			return false;
269
+		}
270
+		$exists = array();
271
+		foreach ($indexes as $index) {
272
+			$exists[] = $index['Key_name'];
273
+		}
274
+
275
+		$alter = '';
276
+		foreach ($this->_indexes as $name => $index) {
277
+			if (!in_array($name, $exists)) {
278
+				$alter .= ' ADD ' . $index . ',';
279
+			}
280
+		}
281
+		if (!empty($alter)) {
282
+			if (!DbWpf::query('ALTER TABLE `@__' . $table . '`' . substr($alter, 0, -1))) {
283
+				$this->pushError(DbWpf::getError());
284
+				if ($delete) {
285
+					$this->delete();
286
+				}
287
+				return false;
288
+			}
289
+		}
290
+		return true;
291
+	}
292
+}

+ 210 - 0
app/wp-content/plugins/woo-product-filter/classes/module.php

@@ -0,0 +1,210 @@
1
+<?php
2
+abstract class ModuleWpf extends BaseObjectWpf {
3
+	protected $_controller = null;
4
+	protected $_helper = null;
5
+	protected $_code = '';
6
+	protected $_onAdmin = false;
7
+	protected $_typeID = 0;
8
+	protected $_type = '';
9
+	protected $_label = '';
10
+	/*
11
+	 * ID in modules table
12
+	 */
13
+	protected $_id = 0;
14
+	/**
15
+	 * If module is not in primary package - here wil be it's path
16
+	 */
17
+	protected $_externalDir = '';
18
+	protected $_externalPath = '';
19
+	protected $_isExternal = false;
20
+
21
+	public function __construct( $d) {
22
+		$this->setTypeID($d['type_id']);
23
+		$this->setCode($d['code']);
24
+		$this->setLabel($d['label']);
25
+		if (isset($d['id'])) {
26
+			$this->_setID($d['id']);
27
+		}
28
+		if (isset($d['ex_plug_dir']) && !empty($d['ex_plug_dir'])) {
29
+			$this->isExternal(true);
30
+			$this->setExternalDir( UtilsWpf::getExtModDir($d['ex_plug_dir']) );
31
+			$this->setExternalPath( UtilsWpf::getExtModPath($d['ex_plug_dir']) );
32
+		}
33
+	}
34
+	public function isExternal( $newVal = null ) {
35
+		if (is_null($newVal)) {
36
+			return $this->_isExternal;
37
+		}
38
+		$this->_isExternal = $newVal;
39
+	}
40
+	public function getModDir() {
41
+		if (empty($this->_externalDir)) {
42
+			return WPF_MODULES_DIR . $this->getCode() . DS;
43
+		} else {
44
+			return $this->_externalDir . $this->getCode() . DS;
45
+		}
46
+	}
47
+	public function getModPath() {
48
+		if (empty($this->_externalPath)) {
49
+			return WPF_MODULES_PATH . $this->getCode() . '/';
50
+		} else {
51
+			return $this->_externalPath . $this->getCode() . '/';
52
+		}
53
+	}
54
+	public function getModRealDir() {
55
+		return dirname(__FILE__) . DS;
56
+	}
57
+	public function setExternalDir( $dir ) {
58
+		$this->_externalDir = $dir;
59
+	}
60
+	public function getExternalDir() {
61
+		return $this->_externalDir;
62
+	}
63
+	public function setExternalPath( $path ) {
64
+		$this->_externalPath = $path;
65
+	}
66
+	public function getExternalPath() {
67
+		return $this->_externalPath;
68
+	}
69
+	/*
70
+	 * Set ID for module, protected - to limit opportunity change this value
71
+	 */
72
+	protected function _setID( $id ) {
73
+		$this->_id = $id;
74
+	}
75
+	/**
76
+	 * Get module ID from modules table in database
77
+	 *
78
+	 * @return int ID of module
79
+	 */
80
+	public function getID() {
81
+		return $this->_id;
82
+	}
83
+	public function setTypeID( $typeID ) {
84
+		$this->_typeID = $typeID;
85
+	}
86
+	public function getTypeID() {
87
+		return $this->_typeID;
88
+	}
89
+	public function setType( $type ) {
90
+		$this->_type = $type;
91
+	}
92
+	public function getType() {
93
+		return $this->_type;
94
+	}
95
+	public function getLabel() {
96
+		return $this->_label;
97
+	}
98
+	public function setLabel( $label ) {
99
+		$this->_label = $label;
100
+	}
101
+	public function init() {
102
+
103
+	}
104
+	public function exec( $task = '' ) {
105
+		if ($task) {
106
+			$controller = $this->getController();
107
+			if ($controller) {
108
+				return $controller->exec($task);
109
+			}
110
+		}
111
+		return null;
112
+	}
113
+	public function getController() {
114
+		if (!$this->_controller) {
115
+			$this->_createController();
116
+		}
117
+		return $this->_controller;
118
+	}
119
+	protected function _createController() {
120
+		if (!file_exists($this->getModDir() . 'controller.php')) {
121
+			return false;	// EXCEPTION!!!
122
+		}
123
+		if ($this->_controller) {
124
+			return true;
125
+		}
126
+		if (file_exists($this->getModDir() . 'controller.php')) {
127
+			$className = '';
128
+			if (importWpf($this->getModDir() . 'controller.php')) {
129
+				$className = toeGetClassNameWpf($this->getCode() . 'Controller');
130
+			}
131
+			if (!empty($className)) {
132
+				$this->_controller = new $className($this->getCode());
133
+				$this->_controller->init();
134
+				return true;
135
+			}
136
+		}
137
+		return false;
138
+	}
139
+	/**
140
+	 * Method to call module helper if it exists
141
+	 *
142
+	 * @return class HelperWpf 
143
+	 */
144
+	public function getHelper() {
145
+		if (!$this->_helper) {
146
+			$this->_createHelper();
147
+		}
148
+		return $this->_helper;
149
+	}
150
+	/**
151
+	 * Method to create class of module helper
152
+	 *
153
+	 * @return class HelperWpf 
154
+	 */
155
+	protected function _createHelper() {
156
+		if ($this->_helper) {
157
+			return true;
158
+		}
159
+		if (file_exists($this->getModDir() . 'helper.php')) {
160
+			$helper = $this->getCode() . 'Helper';
161
+			importClassWpf($helper, $this->getModDir() . 'helper.php');
162
+			if (class_exists($helper)) {
163
+				$this->_helper = new $helper($this->_code);
164
+				$this->_helper->init();
165
+				return true;
166
+			}
167
+		}
168
+	}
169
+	public function setCode( $code ) {
170
+		$this->_code = $code;
171
+	}
172
+	public function getCode() {
173
+		return $this->_code;
174
+	}
175
+	public function onAdmin() {
176
+		return $this->_onAdmin;
177
+	}
178
+	public function getModel( $modelName = '' ) {
179
+		return $this->getController()->getModel($modelName);
180
+	}
181
+	public function getView( $viewName = '' ) {
182
+		return $this->getController()->getView($viewName);
183
+	}
184
+	public function install() {
185
+
186
+	}
187
+	public function uninstall() {
188
+
189
+	}
190
+	public function activate() {
191
+		
192
+	}
193
+	/**
194
+	 * Returns the available tabs
195
+	 *
196
+	 * @return array of tab
197
+	 */
198
+	public function getTabs() {
199
+		return array();
200
+	}
201
+	public function getConstant( $name ) {
202
+		$thisClassRefl = new ReflectionObject($this);
203
+		return $thisClassRefl->getConstant($name);
204
+	}
205
+	public function loadAssets() { }
206
+	public function loadAdminAssets() { }
207
+	public function translate( $str ) {
208
+		return esc_html__($str, 'woo-product-filter');
209
+	}
210
+}

+ 228 - 0
app/wp-content/plugins/woo-product-filter/classes/req.php

@@ -0,0 +1,228 @@
1
+<?php
2
+class ReqWpf {
3
+	protected static $_requestData;
4
+	protected static $_requestMethod;
5
+	public static $_requestWithNonce = false;
6
+
7
+	public static function init() {
8
+		add_filter('sanitize_text_field', array('ReqWpf', 'sanitizeData'), 999, 2);
9
+	}
10
+	public static function startSession() {
11
+		if (!UtilsWpf::isSessionStarted()) {
12
+			session_start();
13
+		}
14
+	}
15
+
16
+	/**
17
+	 * Function getVar
18
+	 *
19
+	 * @param string $name key in variables array
20
+	 * @param string $from from where get result = "all", "input", "get"
21
+	 * @param mixed $default default value - will be returned if $name wasn't found
22
+	 * @return mixed value of a variable, if didn't found - $default (NULL by default)
23
+	*/
24
+	public static function getVar( $name, $from = 'all', $default = null ) {
25
+		if (self::$_requestWithNonce) {
26
+			$nonce = empty($_REQUEST['_wpnonce']) ? '' : sanitize_text_field($_REQUEST['_wpnonce']);
27
+			if (!wp_verify_nonce($nonce, 'my-nonce')) {
28
+				echo esc_html__('Security check', 'woo-product-filter');
29
+				exit(); 
30
+			}
31
+		}
32
+
33
+		$from = strtolower($from);
34
+		if ('all' == $from) {
35
+			if (isset($_GET[$name])) {
36
+				$from = 'get';
37
+			} elseif (isset($_POST[$name])) {
38
+				$from = 'post';
39
+			}
40
+		}
41
+
42
+		switch ($from) {
43
+			case 'get':
44
+				if (isset($_GET[$name])) {
45
+					return sanitize_text_field($_GET[$name]);
46
+				}
47
+				break;
48
+			case 'post':
49
+				if (isset($_POST[$name])) {
50
+					return sanitize_text_field($_POST[$name]);
51
+				}
52
+				break;
53
+			case 'file':
54
+			case 'files':
55
+				if (isset($_FILES[$name])) {
56
+					return sanitize_file_name($_FILES[$name]);
57
+				}
58
+				break;
59
+			case 'session':
60
+				if (isset($_SESSION[$name])) {
61
+					return sanitize_text_field($_SESSION[$name]);
62
+				}
63
+				break;
64
+			case 'server':
65
+				if (isset($_SERVER[$name])) {
66
+					return sanitize_text_field($_SERVER[$name]);
67
+				}
68
+				break;
69
+			case 'cookie':
70
+				if (isset($_COOKIE[$name])) {
71
+					$value = sanitize_text_field($_COOKIE[$name]);
72
+					if (strpos($value, '_JSON:') === 0) {
73
+						$value = explode('_JSON:', $value);
74
+						$value = UtilsWpf::jsonDecode(array_pop($value));
75
+					}
76
+					return $value;
77
+				}
78
+				break;
79
+		}
80
+		return $default;
81
+	}
82
+
83
+
84
+	/**
85
+	 * Getting similar parameters when redirecting to set filter values
86
+	 *
87
+	 * @param string $part part of parameter
88
+	 * @return string
89
+	 */
90
+	public static function getFilterRedirect( $part ) {
91
+		$params = [];
92
+		if (self::$_requestWithNonce) {
93
+			$nonce = empty($_REQUEST['_wpnonce']) ? '' : sanitize_text_field($_REQUEST['_wpnonce']);
94
+			if (!wp_verify_nonce($nonce, 'my-nonce')) {
95
+				echo esc_html__('Security check', 'woo-product-filter');
96
+				exit();
97
+			}
98
+		}
99
+		if ( isset($_GET['redirect']) ) {
100
+			foreach ( $_GET as $key => $value ) {
101
+				if ( strpos ($key, $part) === 0 ) {
102
+					$params[] = sanitize_text_field( $value );
103
+				}
104
+			}
105
+		}
106
+
107
+		return implode('|', $params);
108
+	}
109
+
110
+	public static function sanitizeData( $filtered, $value ) {
111
+		return is_array($value) ? self::sanitizeArray($value) : $filtered;
112
+	}
113
+	public static function sanitizeArray( $arr ) {
114
+		$newArr = array();
115
+		foreach ($arr as $k => $v) {
116
+			$newArr[$k] = is_array($v) ? self::sanitizeArray($v) : _sanitize_text_fields($v, false);
117
+		}
118
+		return $newArr;
119
+	}
120
+	public static function isEmpty( $name, $from = 'all' ) {
121
+		$val = self::getVar($name, $from);
122
+		return empty($val);
123
+	}
124
+	public static function setVar( $name, $val, $in = 'input', $params = array() ) {
125
+		$in = strtolower($in);
126
+		switch ($in) {
127
+			case 'get':
128
+				$_GET[$name] = $val;
129
+				break;
130
+			case 'post':
131
+				$_POST[$name] = $val;
132
+				break;
133
+			case 'session':
134
+				$_SESSION[$name] = $val;
135
+				break;
136
+			case 'cookie':
137
+				$expire = isset($params['expire']) ? time() + $params['expire'] : 0;
138
+				$path = isset($params['path']) ? $params['path'] : '/';
139
+				if (is_array($val) || is_object($val)) {
140
+					$saveVal = '_JSON:' . UtilsWpf::jsonEncode( $val );
141
+				} else {
142
+					$saveVal = $val;
143
+				}
144
+				setcookie($name, $saveVal, $expire, $path);
145
+				break;
146
+		}
147
+	}
148
+	public static function clearVar( $name, $in = 'input', $params = array() ) {
149
+		if (self::$_requestWithNonce) {
150
+			$nonce = empty($_REQUEST['_wpnonce']) ? '' : sanitize_text_field($_REQUEST['_wpnonce']);
151
+			if (!wp_verify_nonce($nonce, 'my-nonce')) {
152
+				esc_html__('Security check', 'woo-product-filter');
153
+				exit(); 
154
+			}
155
+		}
156
+		$in = strtolower($in);
157
+		switch ($in) {
158
+			case 'get':
159
+				if (isset($_GET[$name])) {
160
+					unset($_GET[$name]);
161
+				}
162
+				break;
163
+			case 'post':
164
+				if (isset($_POST[$name])) {
165
+					unset($_POST[$name]);
166
+				}
167
+				break;
168
+			case 'session':
169
+				if (isset($_SESSION[$name])) {
170
+					unset($_SESSION[$name]);
171
+				}
172
+				break;
173
+			case 'cookie':
174
+				$path = isset($params['path']) ? $params['path'] : '/';
175
+				setcookie($name, '', time() - 3600, $path);
176
+				break;
177
+		}
178
+	}
179
+	public static function get( $what ) {
180
+		if (self::$_requestWithNonce) {
181
+			$nonce = empty($_REQUEST['_wpnonce']) ? '' : sanitize_text_field($_REQUEST['_wpnonce']);
182
+			if (!wp_verify_nonce($nonce, 'my-nonce')) {
183
+				esc_html__('Security check', 'woo-product-filter');
184
+				exit(); 
185
+			}
186
+		}
187
+		$what = strtolower($what);
188
+		switch ($what) {
189
+			case 'get':
190
+				return $_GET;
191
+				break;
192
+			case 'post':
193
+				return $_POST;
194
+				break;
195
+			case 'session':
196
+				return $_SESSION;
197
+				break;
198
+			case 'files':
199
+				return $_FILES;
200
+				break;
201
+		}
202
+		return null;
203
+	}
204
+	public static function getMethod() {
205
+		if (!self::$_requestMethod) {
206
+			self::$_requestMethod = strtoupper( self::getVar('method', 'all', isset($_SERVER['REQUEST_METHOD']) ? sanitize_text_field($_SERVER['REQUEST_METHOD']) : '') );
207
+		}
208
+		return self::$_requestMethod;
209
+	}
210
+	public static function getAdminPage() {
211
+		$pagePath = self::getVar('page');
212
+		if (!empty($pagePath) && strpos($pagePath, '/') !== false) {
213
+			$pagePath = explode('/', $pagePath);
214
+			return str_replace('.php', '', $pagePath[count($pagePath) - 1]);
215
+		}
216
+		return false;
217
+	}
218
+	public static function getRequestUri() {
219
+		return isset($_SERVER['REQUEST_URI']) ? sanitize_text_field($_SERVER['REQUEST_URI']) : '';
220
+	}
221
+	public static function getMode() {
222
+		$mod = self::getVar('mod');
223
+		if (!$mod) {
224
+			$mod = self::getVar('page');     //Admin usage
225
+		}
226
+		return $mod;
227
+	}
228
+}

+ 107 - 0
app/wp-content/plugins/woo-product-filter/classes/response.php

@@ -0,0 +1,107 @@
1
+<?php
2
+class ResponseWpf {
3
+	public $code = 0;
4
+	public $error = false;
5
+	public $errors = array();
6
+	public $messages = array();
7
+	public $html = '';
8
+	public $data = array();
9
+	/**
10
+	 * Marker to set data not in internal $data var, but set it as object parameters
11
+	 */
12
+	private $_ignoreShellData = false;
13
+	public function getReqType() {
14
+		return ReqWpf::getVar('reqType');
15
+	}
16
+	public function isAjax() {
17
+		return $this->getReqType() == 'ajax';
18
+	}
19
+	public function ajaxExec( $forceAjax = false ) {
20
+		$isAjax = $this->isAjax();
21
+		$redirect = ReqWpf::getVar('redirect');
22
+		if (count($this->errors) > 0) {
23
+			$this->error = true;
24
+		}
25
+		if ($isAjax || $forceAjax) {
26
+			HtmlWpf::echoEscapedHtml(jsonEncodeUTFnormalWpf($this));
27
+			exit();
28
+		}
29
+		return $this;
30
+	}
31
+	public function mainRedirect( $redirectUrl = '' ) {
32
+		$redirectUrl = empty($redirectUrl) ? WPF_SITE_URL : $redirectUrl;
33
+		$redirectData = array();
34
+		if (!empty($this->errors)) {
35
+			$redirectData['wpfErrors'] = $this->errors;
36
+		}
37
+		if (!empty($this->messages)) {
38
+			$redirectData['wpfMsgs'] = $this->messages;
39
+		}
40
+		return redirectWpf( $redirectUrl . ( strpos($redirectUrl, '?') ? '&' : '?' ) . http_build_query($redirectData) );
41
+	}
42
+	public function error() {
43
+		return $this->error;
44
+	}
45
+	public function addError( $error, $key = '' ) {
46
+		if (empty($error)) {
47
+			return;
48
+		}
49
+		$this->error = true;
50
+		if (is_array($error)) {
51
+			$this->errors = array_merge($this->errors, $error);
52
+		} else {
53
+			if (empty($key)) {
54
+				$this->errors[] = $error;
55
+			} else {
56
+				$this->errors[$key] = $error;
57
+			}
58
+		}
59
+	}
60
+	/**
61
+	 * Alias for ResponseWpf::addError, @see addError method
62
+	 */
63
+	public function pushError( $error, $key = '' ) {
64
+		return $this->addError($error, $key);
65
+	}
66
+	public function addMessage( $msg ) {
67
+		if (empty($msg)) {
68
+			return;
69
+		}
70
+		if (is_array($msg)) {
71
+			$this->messages = array_merge($this->messages, $msg);
72
+		} else {
73
+			$this->messages[] = $msg;
74
+		}
75
+	}
76
+	public function getMessages() {
77
+		return $this->messages;
78
+	}
79
+	public function setHtml( $html ) {
80
+		$this->html = $html;
81
+	}
82
+	public function addData( $data, $value = null ) {
83
+		if (empty($data)) {
84
+			return;
85
+		}
86
+		if ($this->_ignoreShellData) {
87
+			if (!is_array($data)) {
88
+				$data = array($data => $value);
89
+			}
90
+			foreach ($data as $key => $val) {
91
+				$this->{$key} = $val;
92
+			}
93
+		} else {
94
+			if (is_array($data)) {
95
+				$this->data = array_merge($this->data, $data);
96
+			} else {
97
+				$this->data[$data] = $value;
98
+			}
99
+		}
100
+	}
101
+	public function getErrors() {
102
+		return $this->errors;
103
+	}
104
+	public function ignoreShellData() {
105
+		$this->_ignoreShellData = true;
106
+	}
107
+}

+ 524 - 0
app/wp-content/plugins/woo-product-filter/classes/table.php

@@ -0,0 +1,524 @@
1
+<?php
2
+abstract class TableWpf {
3
+	/**
4
+	 * ID column name
5
+	 */
6
+	protected $_id ='';
7
+	/**
8
+	 * Table name
9
+	 */
10
+	protected $_table = '';
11
+	/**
12
+	 * Array to store there fields for table
13
+	 */
14
+	protected $_fields = array();
15
+	/**
16
+	 * Alias for this table, make shure that it ia unique
17
+	 */
18
+	protected $_alias = '';
19
+	/**
20
+	 * Table to be joined
21
+	 */
22
+	protected $_join = array();
23
+	/**
24
+	 * Limit
25
+	 */
26
+	protected $_limit = '';
27
+	/**
28
+	 * Order BY
29
+	 */
30
+	protected $_order = '';
31
+	/**
32
+	 * Group BY
33
+	 */
34
+	protected $_group = '';
35
+	/**
36
+	 * Table errors data
37
+	 */
38
+	protected $_errors = array();
39
+	/**
40
+	 * Escape data before action
41
+	 */
42
+	protected $_escape = false;
43
+	
44
+	protected $_limitFrom = '';
45
+	protected $_limitTo = '';
46
+	
47
+	public static function getInstance( $table = '' ) {
48
+		static $instances = array();
49
+		if (!$table) {
50
+			throw new Exception('Unknown table [' . $table . ']');
51
+		}
52
+		if (!isset($instances[$table])) {
53
+			$class = 'table' . strFirstUpWpf($table) . strFirstUpWpf(WPF_CODE);
54
+			if (class_exists($class)) {
55
+				$instances[$table] = new $class();
56
+			} else {
57
+				$instances[$table] = null; 
58
+			}
59
+		}
60
+		return $instances[$table];
61
+	}
62
+	public function setEscape( $f ) {
63
+		$this->_escape = true;
64
+	}
65
+	public static function _( $table = '' ) {
66
+		return self::getInstance($table);
67
+	}
68
+	public function innerJoin( $table, $on ) {
69
+		$this->_join[] = 'INNER JOIN ' . $table->getTable() . ' ' . $table->alias() . ' ON ' . $table->alias() . '.' . $table->getID() . ' = ' . $this->_alias . '.' . $on;
70
+		return $this;
71
+	}
72
+	public function leftJoin( $table, $on ) {
73
+		if ($this->haveField($on)) {
74
+			$this->_join[] = 'LEFT JOIN ' . $table->getTable() . ' ' . $table->alias() . ' ON ' . $table->alias() . '.' . $table->getID() . ' = ' . $this->_alias . '.' . $on;
75
+		} else {
76
+			$this->_join[] = 'LEFT JOIN ' . $table->getTable() . ' ' . $table->alias() . ' ON ' . $table->alias() . '.' . $on . ' = ' . $this->_alias . '.' . $this->getID();
77
+		}
78
+		return $this;
79
+	}
80
+	public function arbitraryJoin( $join ) {
81
+		$this->_join[] = $join;
82
+	}
83
+	public function haveField( $field ) {
84
+		return isset($this->_fields[$field]);
85
+	}
86
+	public function addJoin( $params = array('tbl' => '', 'a' => '', 'on' => '', 'joinOnID' => true, 'joinOn' => '') ) {
87
+		$params['joinOnID'] = isset($params['joinOnID']) ? $params['joinOnID'] : true;
88
+		$params['joinOn'] = ( $params['joinOnID'] && !isset($params['joinOn']) ) ? $this->_id : $params['joinOn'];
89
+		$this->_join[] = 'INNER JOIN ' . $params['tbl'] . ' ' . $params['a'] . ' ON ' . $params['a'] . '.' . $params['on'] . ' = ' . $this->_alias . '.' . $params['joinOn'];
90
+		return $this;
91
+	}
92
+	public function fillFromDB( $id = 0, $where = '' ) {
93
+		$res = $this;
94
+		if ($id) {
95
+			$data = $this->getById($id);
96
+		} elseif ($where) {
97
+			$data = $this->get('*', $where);
98
+		} else {
99
+			$data = $this->getAll();
100
+		}
101
+		
102
+		if ($data) {
103
+			if ($id) {
104
+				foreach ($data as $k => $v) {
105
+					if (isset($this->_fields[$k])) {
106
+						$this->_fields[$k]->setValue($v, true);
107
+					}
108
+				}
109
+			} else {
110
+				$res = array();
111
+				foreach ($data as $field) {
112
+					$row = array();
113
+					foreach ($field as $k => $v) {
114
+						if (isset($this->_fields[$k])) {
115
+							$row[$k] = toeCreateObjWpf('FieldWpf', array(
116
+									$this->_fields[$k]->name,
117
+									$this->_fields[$k]->html,
118
+									$this->_fields[$k]->type,
119
+									$this->_fields[$k]->default,
120
+									$this->_fields[$k]->label,
121
+									$this->_fields[$k]->maxlen,
122
+									$this->_fields[$k]->description
123
+									));
124
+							$row[$k]->setValue($v, true);
125
+						}
126
+					}
127
+					if (!empty($row)) {
128
+						$res[] = $row;
129
+					}
130
+				}
131
+			}
132
+		}
133
+		return $res;
134
+	}
135
+	/**
136
+	 * Return table name
137
+	 *
138
+	 * @param bool $transform need to transform to standard WP tables view or not
139
+	 * @return string table name
140
+	 */
141
+	public function getTable( $transform = false ) {
142
+		if ($transform) {
143
+			return DbWpf::prepareQuery($this->_table);
144
+		} else {
145
+			return $this->_table;
146
+		}
147
+	}
148
+	public function setTable( $table ) {
149
+		$this->_table = $table;
150
+	}
151
+	/**
152
+	 * Get name of ID column
153
+	 *
154
+	 * @return string name of ID column
155
+	 */
156
+	public function getID() {
157
+		return $this->_id;
158
+	}
159
+	public function setID( $id ) {
160
+		$this->_id = $id;
161
+	} 
162
+	public function getAll( $fields = '*' ) {
163
+		return $this->get($fields);
164
+	}
165
+	public function getById( $id, $fields = '*', $return = 'row' ) {
166
+		$condition = 'WHERE ' . $this->_alias . '.' . $this->_id . ' = "' . ( (int) $id ) . '"';
167
+		return $this->get($fields, $condition, null, $return);
168
+	}
169
+	protected function _addJoin() {
170
+		$res = '';
171
+		if (!empty($this->_join)) {
172
+			$res = ' ' . implode(' ', $this->_join);
173
+			$this->_join = array();
174
+		}
175
+		return $res;
176
+	}
177
+	/**
178
+	 * Add LIMIT to SQL
179
+	 */
180
+	public function limit( $limit = '' ) {
181
+		if (is_numeric($limit)) {
182
+			$this->_limit = $limit;
183
+		} else {
184
+			$this->_limit = '';
185
+		}
186
+		return $this;
187
+	}
188
+	public function setLimit( $limit = '' ) {
189
+		$this->_limit = $limit;
190
+		return $this;
191
+	}
192
+	public function limitFrom( $limit = '' ) {
193
+		if (is_numeric($limit)) {
194
+			$this->_limitFrom = (int) $limit;
195
+		}
196
+		return $this;
197
+	}
198
+	public function limitTo( $limit = '' ) {
199
+		if (is_numeric($limit)) {
200
+			$this->_limitTo = (int) $limit;
201
+		}
202
+		return $this;
203
+	}
204
+	/**
205
+	 * Add ORDER BY to SQL
206
+	 * 
207
+	 * @param mixed $fields 
208
+	 */
209
+	public function orderBy( $fields ) {
210
+		if (is_array($fields)) {
211
+			$order = implode(',', $fields);
212
+		} elseif ('' != $fields) {
213
+			$order = $fields;
214
+		}
215
+		$this->_order = $order;
216
+		return $this;
217
+	}
218
+	/**
219
+	 * Add GROUP BY to SQL
220
+	 * 
221
+	 * @param mixed $fields 
222
+	 */
223
+	public function groupBy( $fields ) {
224
+		if (is_array($fields)) {
225
+			$group = implode(',', $fields);
226
+		} elseif ('' != $fields) {
227
+			$group = $fields;
228
+		}
229
+		$this->_group = $group;
230
+		return $this;
231
+	}
232
+	public function get( $fields = '*', $where = '', $tables = '', $return = 'all' ) {
233
+		if (!$tables) {
234
+			$tables = $this->_table . ' ' . $this->_alias;
235
+		}
236
+		if (strpos($this->_alias, $fields)) {
237
+			$fields = $this->_alias . '.' . $fields;
238
+		}
239
+		$query = 'SELECT ' . $fields . ' FROM ' . $tables;
240
+		$query .= $this->_addJoin();
241
+		if ($where) {
242
+			$where = trim($this->_getQueryString($where, 'AND'));
243
+			if (!empty($where)) {
244
+				if (!preg_match('/^WHERE/i', $where)) {
245
+					$where = 'WHERE ' . $where;
246
+				}
247
+				$query .= ' ' . $where;
248
+			}
249
+		}
250
+		if ('' != $this->_group) {
251
+			$query .= ' GROUP BY ' . $this->_group;
252
+			$this->_group = '';
253
+		}
254
+		if ('' != $this->_order) {
255
+			$query .= ' ORDER BY ' . $this->_order;
256
+			$this->_order = '';
257
+		}
258
+		if ('' != $this->_limit) {
259
+			if (is_numeric($this->_limit)) {
260
+				$query .= ' LIMIT 0,' . $this->_limit;
261
+			} else {
262
+				$query .= ' LIMIT ' . $this->_limit;
263
+			}
264
+			
265
+			$this->_limit = '';
266
+		} elseif ( ( '' !== $this->_limitFrom ) && ( '' !== $this->_limitTo ) ) {
267
+			$query .= ' LIMIT ' . $this->_limitFrom . ',' . $this->_limitTo;
268
+			$this->_limitFrom = '';
269
+			$this->_limitTo = '';
270
+		}
271
+		return DbWpf::get($query, $return);
272
+	}
273
+	public function store( $data, $method = 'INSERT', $where = '' ) {
274
+		$this->_clearErrors();
275
+		$method = strtoupper($method);
276
+		if ($this->_escape) {
277
+			$data = DbWpf::escape($data);
278
+		}
279
+		$query = '';
280
+		switch ($method) {
281
+			case 'INSERT':
282
+				$query = 'INSERT INTO ';
283
+				if (isset($data[$this->_id]) && empty($data[$this->_id])) {
284
+					unset($data[$this->_id]);
285
+				}
286
+				break;
287
+			case 'UPDATE':
288
+				$query = 'UPDATE ';
289
+				break;
290
+		}
291
+		
292
+		$fields = $this->_getQueryString($data, ',', true);
293
+		if (empty($fields)) {
294
+			$this->_addError(esc_html__('Nothing to update', 'woo-product-filter'));
295
+			return false;
296
+		}
297
+		
298
+		$query .= $this->_table . ' SET ' . $fields;
299
+
300
+		if (!empty($this->_errors)) {
301
+			return false;
302
+		}
303
+		if ( ( 'UPDATE' == $method ) && !empty($where) ) {
304
+			$query .= ' WHERE ' . $this->_getQueryString($where, 'AND'); 
305
+		}
306
+		if (DbWpf::query($query)) {
307
+			if ('INSERT' == $method) {
308
+				return DbWpf::lastID();
309
+			} else {
310
+				return true;
311
+			}
312
+		} else {
313
+			$this->_addError(WPF_TEST_MODE ? DbWpf::getError() : esc_html__('Database error. Please contact your developer.', 'woo-product-filter'));
314
+		}
315
+		return false;
316
+	}
317
+	public function insert( $data ) {
318
+		return $this->store($data);
319
+	}
320
+	public function update( $data, $where ) {
321
+		if (is_numeric($where)) {
322
+			$where = array($this->_id => $where);
323
+		}
324
+		return $this->store($data, 'UPDATE', $where);
325
+	}
326
+	public function alias( $alias = null ) {
327
+		if (!is_null($alias)) {
328
+			$this->_alias = $alias;
329
+		}
330
+		return $this->_alias;
331
+	}
332
+	/**
333
+	 * Delete record(s)
334
+	 *
335
+	 * @param mixed $where condition to use in query, if numeric givven - use delete by ID column
336
+	 * @return query result
337
+	 */
338
+	public function delete( $where = '' ) {
339
+		if ($where) {
340
+			$q = 'DELETE FROM ' . $this->_table;
341
+			if (is_numeric($where)) {
342
+				$where = array($this->_id => $where);
343
+			}
344
+			$q .= ' WHERE ' . $this->_getQueryString($where, 'AND');
345
+		} else {
346
+			$q = 'TRUNCATE TABLE ' . $this->_table;
347
+		}
348
+		return DbWpf::query($q);
349
+	}
350
+	/**
351
+	 * Convert to database query
352
+	 *
353
+	 * @param mixed $data if array given - convert it into string where key - is column name, value - database value to set;
354
+	 * if key == "additionalCondition" then we will just add value to string
355
+	 * if string givven - just return it without changes
356
+	 * @param string $delim delimiter to use in query, recommended - ',', 'AND', 'OR'
357
+	 * @return string query string
358
+	 */
359
+	public function _getQueryString( $data, $delim = ',', $validate = false ) {
360
+		$res = '';
361
+		if (is_array($data) && !empty($data)) {
362
+			foreach ($data as $k => $v) {
363
+				if (array_key_exists($k, $this->_fields) || $k == $this->_id) {
364
+					$val = $v;
365
+					if (isset($this->_fields[$k]) && $this->_fields[$k]->adapt['dbTo']) {
366
+						$val = FieldAdapterWpf::_($val, $this->_fields[$k]->adapt['dbTo'], FieldAdapterWpf::DB);
367
+					}
368
+					if ($validate) {
369
+						if (isset($this->_fields[$k]) && is_object($this->_fields[$k])) {
370
+							$objForValidation = clone $this->_fields[$k];
371
+							$objForValidation->setValue($val);
372
+							$errors = ValidatorWpf::_($objForValidation);
373
+							if ($errors) {
374
+								$this->_addError($errors);
375
+							}
376
+						}
377
+					}
378
+					if (isset($this->_fields[$k])) {
379
+						switch ($this->_fields[$k]->type) {
380
+							case 'int':
381
+							case 'tinyint':
382
+								$res .= $k . ' = ' . ( (int) $val ) . ' ' . $delim . ' ';
383
+								break;
384
+							case 'float':
385
+								$res .= $k . ' = ' . ( (float) $val ) . ' ' . $delim . ' ';
386
+								break;
387
+							case 'decimal':
388
+								$res .= $k . ' = ' . ( (float) $val ) . ' ' . $delim . ' ';
389
+								break;
390
+							case 'free':    //Just set it as it is
391
+								$res .= $k . ' = ' . $val . ' ' . $delim . ' ';
392
+								break;
393
+							default:
394
+								$res .= $k . ' = \'' . $val . '\' ' . $delim . ' ';
395
+								break;
396
+						}
397
+					} else {					
398
+						$res .= $k . ' = \'' . $val . '\' ' . $delim . ' ';
399
+					}
400
+				} elseif ('additionalCondition' == $k) {    //just add some string to query
401
+					$res .= $v . ' ' . $delim . ' ';
402
+				}
403
+			}
404
+			$res = substr($res, 0, -( strlen($delim) + 1 ));
405
+		} elseif (is_string($data)) {
406
+			$res = $data;
407
+		}
408
+		return $res;
409
+	}
410
+	/**
411
+	 * Add new FieldWpfWpf for children table (@see class field)
412
+	 *
413
+	 * @param string $name name of a field
414
+	 * @param string $html html type of field (text, textarea, etc. @see html class)
415
+	 * @param string $type database type (int, varcahr, etc.)
416
+	 * @param mixed $default default value for this field
417
+	 * @return object $this - pointer to current object
418
+	 */
419
+	protected function _addField( $name, $html = 'text', $type = 'other', $default = '', $label = '', $maxlen = 0, $dbAdapt = '', $htmlAdapt = '', $description = '' ) {
420
+		$this->_fields[$name] = toeCreateObjWpf('FieldWpf', array($name, $html, $type, $default, $label, $maxlen, $dbAdapt, $htmlAdapt, $description));
421
+		return $this;
422
+	}
423
+	/**
424
+	 * Public alias for _addField() method
425
+	 */
426
+	public function addField() {
427
+		$args = func_get_args();
428
+		return call_user_func_array(array($this, '_addField'), $args);
429
+	}
430
+	public function getFields() {
431
+		return $this->_fields;
432
+	}
433
+	public function getField( $name ) {
434
+		return $this->_fields[$name];
435
+	}
436
+	public function exists( $value, $field = '' ) {
437
+		if (!$field) {
438
+			$field = $this->_id;
439
+		}
440
+		return DbWpf::get('SELECT ' . $this->_id . ' FROM ' . $this->_table . ' WHERE ' . $field . ' = "' . $value . '"', 'one');
441
+	}
442
+	protected function _addError( $error ) {
443
+		if (is_array($error)) {
444
+			$this->_errors = array_merge($this->_errors, $error);
445
+		} else {
446
+			$this->_errors[] = $error;
447
+		}
448
+	}
449
+	public function getErrors() {
450
+		return $this->_errors;
451
+	}
452
+	protected function _clearErrors() {
453
+		$this->_errors = array();
454
+	}
455
+	/**
456
+	 * Prepare data before send it to database
457
+	 */
458
+	public function prepareInput( $d = array() ) {
459
+		$ignore = isset($d['ignore']) ? $d['ignore'] : array();
460
+		foreach ($this->_fields as $key => $f) {
461
+			if ('tinyint' == $f->type) {
462
+				if ('true' == $d[$key]) {
463
+					$d[$key] = 1;
464
+				}
465
+				if (empty($d[$key]) && !in_array($key, $ignore)) {
466
+					$d[$key] = 0;
467
+				}
468
+			}
469
+			if ('date' == $f->type) {
470
+				if (empty($d[$key]) && !in_array($key, $ignore)) {
471
+					$d[$key] = '0000-00-00';
472
+				} elseif (!empty($d[$key])) {
473
+					$d[$key] = DbWpf::timeToDate($d[$key]);
474
+				}
475
+			}
476
+		}
477
+		$d[$this->_id] = isset($d[$this->_id]) ? intval($d[$this->_id]) : 0;
478
+		return $d;
479
+	}
480
+	/**
481
+	 * Prepare data after extracting it from database
482
+	 */
483
+	public function prepareOutput( $d = array()) {
484
+		$ignore = isset($d['ignore']) ? $d['ignore'] : array();
485
+		foreach ($this->_fields as $key => $f) {
486
+			switch ($f->type) {
487
+				case 'date':
488
+					if ('0000-00-00' == $d[$key] || empty($d[$key])) {
489
+						$d[$key] = '';
490
+					} else {
491
+						$d[$key] = gmdate(WPF_DATE_FORMAT, DbWpf::dateToTime($d[$key]));
492
+					}
493
+					break;
494
+				case 'int':
495
+				case 'tinyint':
496
+					if ('true' == $d[$key]) {
497
+						$d[$key] = 1;
498
+					}
499
+					if ('false' == $d[$key]) {
500
+						$d[$key] = 0;
501
+					}
502
+					$d[$key] = (int) $d[$key];
503
+					break;
504
+			}
505
+		}
506
+		$d[$this->_id] = isset($d[$this->_id]) ? intval($d[$this->_id]) : 0;
507
+		return $d;
508
+	}
509
+	public function install( $d = array() ) {
510
+		
511
+	}
512
+	public function uninstall( $d = array() ) {
513
+		
514
+	}
515
+	public function activate() {
516
+		
517
+	}
518
+	public function getLastInsertID() {
519
+		return DbWpf::get('SELECT MAX(' . $this->_id . ') FROM ' . $this->_table, 'one');
520
+	}
521
+	public function adaptHtml( $val ) {
522
+		return htmlspecialchars($val);
523
+	}
524
+}

+ 16 - 0
app/wp-content/plugins/woo-product-filter/classes/tables/meta_data.php

@@ -0,0 +1,16 @@
1
+<?php
2
+class TableMeta_DataWpf extends TableWpf {
3
+	public function __construct() {
4
+		$this->_table = '@__meta_data';
5
+		$this->_id = 'id';
6
+		$this->_alias = 'wpf_meta_data';
7
+		$this->_addField('id', 'text', 'int')
8
+			 ->_addField('product_id', 'text', 'int')
9
+			 ->_addField('is_var', 'text', 'int')
10
+			 ->_addField('key_id', 'text', 'int')
11
+			 ->_addField('val_int', 'text', 'int')
12
+			 ->_addField('val_dec', 'text', 'decimal')
13
+			 ->_addField('val_id', 'text', 'int')
14
+			 ->_addField('updated', 'text', 'text');
15
+	}
16
+}

+ 20 - 0
app/wp-content/plugins/woo-product-filter/classes/tables/meta_keys.php

@@ -0,0 +1,20 @@
1
+<?php
2
+class TableMeta_KeysWpf extends TableWpf {
3
+	public function __construct() {
4
+		$this->_table = '@__meta_keys';
5
+		$this->_id = 'id';
6
+		$this->_alias = 'wpf_meta_keys';
7
+		$this->_addField('id', 'text', 'int')
8
+			 ->_addField('meta_mode', 'text', 'int')
9
+			 ->_addField('meta_key', 'text', 'text')
10
+			 ->_addField('taxonomy', 'text', 'text')
11
+			 ->_addField('meta_like', 'text', 'int')
12
+			 ->_addField('parent', 'text', 'int')
13
+			 ->_addField('meta_type', 'text', 'int')
14
+			 ->_addField('status', 'text', 'int')
15
+			 ->_addField('added', 'text', 'text')
16
+			 ->_addField('updated', 'text', 'text')
17
+			 ->_addField('locked', 'text', 'text')
18
+			 ->_addField('calculated', 'text', 'text');
19
+	}
20
+}

+ 16 - 0
app/wp-content/plugins/woo-product-filter/classes/tables/meta_values.php

@@ -0,0 +1,16 @@
1
+<?php
2
+class TableMeta_ValuesWpf extends TableWpf {
3
+	public function __construct() {
4
+		$this->_table = '@__meta_values';
5
+		$this->_id = 'id';
6
+		$this->_alias = 'wpf_meta_values';
7
+		$this->_addField('id', 'text', 'int')
8
+			 ->_addField('key_id', 'text', 'int')
9
+			 ->_addField('key2', 'text', 'text')
10
+			 ->_addField('key3', 'text', 'text')
11
+			 ->_addField('key4', 'text', 'text')
12
+			 ->_addField('value', 'text', 'text')
13
+			 ->_addField('product_cnt', 'text', 'int')
14
+			 ->_addField('variation_cnt', 'text', 'int');
15
+	}
16
+}

+ 14 - 0
app/wp-content/plugins/woo-product-filter/classes/tables/modules.php

@@ -0,0 +1,14 @@
1
+<?php
2
+class TableModulesWpf extends TableWpf {
3
+	public function __construct() {
4
+		$this->_table = '@__modules';
5
+		$this->_id = 'id';     /*Let's associate it with posts*/
6
+		$this->_alias = 'sup_m';
7
+		$this->_addField('label', 'text', 'varchar', 0, esc_html__('Label', 'woo-product-filter'), 128)
8
+				->_addField('type_id', 'selectbox', 'smallint', 0, esc_html__('Type', 'woo-product-filter'))
9
+				->_addField('active', 'checkbox', 'tinyint', 0, esc_html__('Active', 'woo-product-filter'))
10
+				->_addField('params', 'textarea', 'text', 0, esc_html__('Params', 'woo-product-filter'))
11
+				->_addField('code', 'hidden', 'varchar', '', esc_html__('Code', 'woo-product-filter'), 64)
12
+				->_addField('ex_plug_dir', 'hidden', 'varchar', '', esc_html__('External plugin directory', 'woo-product-filter'), 255);
13
+	}
14
+}

+ 10 - 0
app/wp-content/plugins/woo-product-filter/classes/tables/modules_type.php

@@ -0,0 +1,10 @@
1
+<?php
2
+class TableModules_TypeWpf extends TableWpf {
3
+	public function __construct() {
4
+		$this->_table = '@__modules_type';
5
+		$this->_id = 'id';     /*Let's associate it with posts*/
6
+		$this->_alias = 'sup_m_t';
7
+		$this->_addField($this->_id, 'text', 'int', '', esc_html__('ID', 'woo-product-filter'))->
8
+				_addField('label', 'text', 'varchar', '', esc_html__('Label', 'woo-product-filter'), 128);
9
+	}
10
+}

+ 12 - 0
app/wp-content/plugins/woo-product-filter/classes/tables/tables.php

@@ -0,0 +1,12 @@
1
+<?php
2
+class TableFiltersWpf extends TableWpf {
3
+	public function __construct() {
4
+		$this->_table = '@__filters';
5
+		$this->_id = 'id';
6
+		$this->_alias = 'wpf_filters';
7
+		$this->_addField('id', 'text', 'int')
8
+			 ->_addField('title', 'text', 'varchar')
9
+			 ->_addField('setting_data', 'text', 'text')
10
+			 ->_addField('meta_keys', 'text', 'text');
11
+	}
12
+}

+ 13 - 0
app/wp-content/plugins/woo-product-filter/classes/tables/usage_stat.php

@@ -0,0 +1,13 @@
1
+<?php
2
+class TableUsage_StatWpf extends TableWpf {
3
+	public function __construct() {
4
+		$this->_table = '@__usage_stat';
5
+		$this->_id = 'id';     
6
+		$this->_alias = 'sup_usage_stat';
7
+		$this->_addField('id', 'hidden', 'int', 0, esc_html__('id', 'woo-product-filter'))
8
+			->_addField('code', 'hidden', 'text', 0, esc_html__('code', 'woo-product-filter'))
9
+			->_addField('visits', 'hidden', 'int', 0, esc_html__('visits', 'woo-product-filter'))
10
+			->_addField('spent_time', 'hidden', 'int', 0, esc_html__('spent_time', 'woo-product-filter'))
11
+			->_addField('modify_timestamp', 'hidden', 'int', 0, esc_html__('modify_timestamp', 'woo-product-filter'));
12
+	}
13
+}

+ 129 - 0
app/wp-content/plugins/woo-product-filter/classes/uri.php

@@ -0,0 +1,129 @@
1
+<?php
2
+class UriWpf {
3
+	/**
4
+	 * Tell link form method to replace symbols for special html caracters only for ONE output
5
+	 */
6
+	private static $_oneHtmlEnc = false;
7
+	public static function fileToPageParam( $file ) {
8
+		$file = str_replace(DS, '/', $file);
9
+		return substr($file, strpos($file, WPF_PLUG_NAME));
10
+	}
11
+	public static function _( $params ) {
12
+		global $wp_rewrite;
13
+		$link = '';
14
+		if ( is_string($params) && ( strpos($params, 'http') === 0 || strpos($params, WPF_PLUG_NAME) !== false ) ) {
15
+			if (self::isHttps()) {
16
+				$params = self::makeHttps($params);
17
+			}
18
+			return $params;
19
+		} elseif (is_array($params) && isset($params['page_id'])) {
20
+			$link = get_page_link($params['page_id']);
21
+			unset($params['page_id']);
22
+		} elseif (is_array($params) && isset($params['baseUrl'])) {
23
+			$link = $params['baseUrl'];
24
+			unset($params['baseUrl']);
25
+		} else {
26
+			$link = WPF_URL;
27
+		}
28
+		if (!empty($params)) {
29
+			$query = is_array($params) ? http_build_query($params, '', '&') : $params;
30
+			$link .= ( strpos($link, '?') === false ? '?' : '&' ) . $query;
31
+		}
32
+		if (self::$_oneHtmlEnc) {
33
+			$link = str_replace('&', '&amp;', $link);
34
+			self::$_oneHtmlEnc = false;
35
+		}
36
+		return $link;
37
+	}
38
+	public static function page( $id ) {
39
+		return get_page_link($id);
40
+	}
41
+	public static function getGetParams( $exclude = array() ) {
42
+		$res = array();
43
+		if (isset($_GET) && !empty($_GET)) {
44
+			foreach ($_GET as $key => $val) {
45
+				if (in_array($key, $exclude)) {
46
+					continue;
47
+				}
48
+				$res[$key] = $val;
49
+			}
50
+		}
51
+		return $res;
52
+	}
53
+	public static function mod( $name, $action = '', $data = null ) {
54
+		$params = array('mod' => $name);
55
+		if ($action) {
56
+			$params['action'] = $action;
57
+		}
58
+		$params['pl'] = WPF_CODE;
59
+		if ($data) {
60
+			if (is_array($data)) {
61
+				$params = array_merge($params, $data);
62
+				if ( isset($data['reqType']) && ( 'ajax' == $data['reqType'] ) ) {
63
+					$params['baseUrl'] = admin_url('admin-ajax.php');
64
+				}
65
+			} elseif (is_string($data)) {
66
+				$params = http_build_query($params);
67
+				$params .= '&' . $data;
68
+			}
69
+		}
70
+		return self::_($params);
71
+	}
72
+	public static function atach( $params ) {
73
+		$getData = self::getGetParams();
74
+		if (!empty($getData)) {
75
+			if (is_array($params)) {
76
+				$params = array_merge($getData, $params);
77
+			} else {
78
+				$params = http_build_query($getData) . '&' . $params;
79
+			}
80
+		}
81
+		return self::_($params);
82
+	}
83
+	/**
84
+	 * Get current path
85
+	 *
86
+	 * @return string current link
87
+	 */
88
+	public static function getCurrent() {
89
+		$url = ( empty($_SERVER['HTTP_HOST']) ? '' : sanitize_text_field($_SERVER['HTTP_HOST']) ) . ( empty($_SERVER['SCRIPT_NAME']) ? '' : sanitize_text_field($_SERVER['SCRIPT_NAME']) );
90
+		if (!empty($_SERVER['HTTPS'])) {
91
+			return 'https://' . $url;
92
+		} else {
93
+			return 'http://' . $url;
94
+		}
95
+	}
96
+	public static function getFullUrl() {
97
+		$url = isset($_SERVER['HTTPS']) && !empty($_SERVER['HTTPS']) ? 'https://' : 'http://';
98
+		$url .= ( empty($_SERVER['HTTP_HOST']) ? '' : sanitize_text_field($_SERVER['HTTP_HOST']) ) . ( empty($_SERVER['REQUEST_URI']) ? '' : sanitize_text_field($_SERVER['REQUEST_URI']) );
99
+		return $url;
100
+	}
101
+	/**
102
+	 * Replace symbols to special html caracters in one output
103
+	 */
104
+	public static function oneHtmlEnc() {
105
+		self::$_oneHtmlEnc = true;
106
+	}
107
+	public static function makeHttps( $link ) {
108
+		if (strpos($link, 'https:') === false) {
109
+			$link = str_replace('http:', 'https:', $link);
110
+		}
111
+		return $link;
112
+	}
113
+	public static function isHttps() {
114
+		return is_ssl();
115
+	}
116
+	/**
117
+	 * If url is without http:// - just domain name for example - we will add it here
118
+	 *
119
+	 * @param string $url Url to check
120
+	 * @return string Checked and corrected URL (if this will be required)
121
+	 */
122
+	public static function normal( $url ) {
123
+		$url = trim($url);
124
+		if (strpos($url, 'http') !== 0) {
125
+			$url = 'http://' . $url;
126
+		}
127
+		return $url;
128
+	}
129
+}

+ 719 - 0
app/wp-content/plugins/woo-product-filter/classes/utils.php

@@ -0,0 +1,719 @@
1
+<?php
2
+class UtilsWpf {
3
+	public static function jsonEncode( $arr ) {
4
+		return ( is_array($arr) || is_object($arr) ) ? jsonEncodeUTFnormalWpf($arr) : jsonEncodeUTFnormalWpf(array());
5
+	}
6
+	public static function jsonDecode( $str ) {
7
+		if (is_array($str)) {
8
+			return $str;
9
+		}
10
+		if (is_object($str)) {
11
+			return (array) $str;
12
+		}
13
+		return empty($str) ? array() : json_decode($str, true);
14
+	}
15
+	public static function unserialize( $data ) {
16
+		return unserialize($data);
17
+	}
18
+	public static function serialize( $data ) {
19
+		return serialize($data);
20
+	}
21
+	public static function createDir( $path, $params = array('chmod' => null, 'httpProtect' => false) ) {
22
+		if (@mkdir($path)) {
23
+			if (!is_null($params['chmod'])) {
24
+				@chmod($path, $params['chmod']);
25
+			}
26
+			if (!empty($params['httpProtect'])) {
27
+				self::httpProtectDir($path);
28
+			}
29
+			return true;
30
+		}
31
+		return false;
32
+	}
33
+	public static function httpProtectDir( $path ) {
34
+		$content = 'DENY FROM ALL';
35
+		if (strrpos($path, DS) != strlen($path)) {
36
+			$path .= DS;
37
+		}
38
+		if (file_put_contents($path . '.htaccess', $content)) {
39
+			return true;
40
+		}
41
+		return false;
42
+	}
43
+	/**
44
+	 * Copy all files from one directory ($source) to another ($destination)
45
+	 *
46
+	 * @param string $source path to source directory
47
+	 * @params string $destination path to destination directory
48
+	 */
49
+	public static function copyDirectories( $source, $destination ) {
50
+		if (is_dir($source)) {
51
+			@mkdir($destination);
52
+			$directory = dir($source);
53
+			while ( false !== ( $readdirectory = $directory->read() ) ) {
54
+				if ( ( '.' == $readdirectory ) || ( '..' == $readdirectory ) ) {
55
+					continue;
56
+				}
57
+				$PathDir = $source . '/' . $readdirectory; 
58
+				if (is_dir($PathDir)) {
59
+					self::copyDirectories( $PathDir, $destination . '/' . $readdirectory );
60
+					continue;
61
+				}
62
+				copy( $PathDir, $destination . '/' . $readdirectory );
63
+			}
64
+			$directory->close();
65
+		} else {
66
+			copy( $source, $destination );
67
+		}
68
+	}
69
+	public static function getIP() {
70
+		$res = '';
71
+		if (!isset($_SERVER['HTTP_CLIENT_IP']) || empty($_SERVER['HTTP_CLIENT_IP'])) {
72
+			if (!isset($_SERVER['HTTP_X_REAL_IP']) || empty($_SERVER['HTTP_X_REAL_IP'])) {
73
+				if (!isset($_SERVER['HTTP_X_SUCURI_CLIENTIP']) || empty($_SERVER['HTTP_X_SUCURI_CLIENTIP'])) {
74
+					if (!isset($_SERVER['HTTP_X_FORWARDED_FOR']) || empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
75
+						$res = empty($_SERVER['REMOTE_ADDR']) ? '' : sanitize_text_field($_SERVER['REMOTE_ADDR']);
76
+					} else {
77
+						$res = sanitize_text_field($_SERVER['HTTP_X_FORWARDED_FOR']);
78
+					}
79
+				} else {
80
+					$res = sanitize_text_field($_SERVER['HTTP_X_SUCURI_CLIENTIP']);
81
+				}
82
+			} else {
83
+				$res = sanitize_text_field($_SERVER['HTTP_X_REAL_IP']);
84
+			}
85
+		} else {
86
+			$res = sanitize_text_field($_SERVER['HTTP_CLIENT_IP']);
87
+		}
88
+		
89
+		return $res;
90
+	}
91
+	
92
+	/**
93
+	 * Parse xml file into simpleXML object
94
+	 *
95
+	 * @param string $path path to xml file
96
+	 * @return mixed object SimpleXMLElement if success, else - false
97
+	 */
98
+	public static function getXml( $path ) {
99
+		if (is_file($path)) {
100
+			return simplexml_load_file($path);
101
+		}
102
+		return false;
103
+	}
104
+	/**
105
+	 * Check if the element exists in array
106
+	 *
107
+	 * @param array $param 
108
+	 */
109
+	public static function xmlAttrToStr( $param, $element ) {
110
+		if (isset($param[$element])) {
111
+			// convert object element to string
112
+			return (string) $param[$element];
113
+		} else {
114
+			return '';
115
+		}
116
+	}
117
+	public static function xmlNodeAttrsToArr( $node ) {
118
+		$arr = array();
119
+		foreach ($node->attributes() as $a => $b) {
120
+			$arr[$a] = self::xmlAttrToStr($node, $a);
121
+		}
122
+		return $arr;
123
+	}
124
+	public static function deleteFile( $str ) {
125
+		return @unlink($str);
126
+	}
127
+	public static function deleteDir( $str ) {
128
+		if (is_file($str)) {
129
+			return self::deleteFile($str);
130
+		} elseif (is_dir($str)) {
131
+			$scan = glob(rtrim($str, '/') . '/*');
132
+			foreach ($scan as $index => $path) {
133
+				self::deleteDir($path);
134
+			}
135
+			return @rmdir($str);
136
+		}
137
+	}
138
+	/**
139
+	 * Retrives list of directories ()
140
+	 */
141
+	public static function getDirList( $path ) {
142
+		$res = array();
143
+		if (is_dir($path)) {
144
+			$files = scandir($path);
145
+			foreach ($files as $f) {
146
+				if ( ( '.' == $f ) || ( '..' == $f ) || ( '.svn' == $f ) ) {
147
+					continue;
148
+				}
149
+				if (!is_dir($path . $f)) {
150
+					continue;
151
+				}
152
+				$res[$f] = array('path' => $path . $f . DS);
153
+			}
154
+		}
155
+		return $res;
156
+	}
157
+	/**
158
+	 * Retrives list of files
159
+	 */
160
+	public static function getFilesList( $path ) {
161
+		$files = array();
162
+		if (is_dir($path)) {
163
+			$dirHandle = opendir($path);
164
+			while ( ( $file = readdir($dirHandle) ) !== false ) {
165
+				if ( ( '.' != $file ) && ( '..' != $file ) && ( '.svn' != $f ) && is_file($path . DS . $file) ) {
166
+					$files[] = $file;
167
+				}
168
+			}
169
+		}
170
+		return $files;
171
+	}
172
+	/**
173
+	 * Check if $var is object or something another in future
174
+	 */
175
+	public static function is( $var, $what = '' ) {
176
+		if (!is_object($var)) {
177
+			return false;
178
+		}
179
+		if (get_class($var) == $what) {
180
+			return true;
181
+		}
182
+		return false;
183
+	}
184
+	/**
185
+	 * Get array with all monthes of year, uses in paypal pro and sagepay payment modules for now, than - who knows)
186
+	 *
187
+	 * @return array monthes
188
+	 */
189
+	public static function getMonthesArray() {
190
+		static $monthsArray = array();
191
+		//Some cache
192
+		if (!empty($monthsArray)) {
193
+			return $monthsArray;
194
+		}
195
+		for ($i = 1; $i < 13; $i++) {
196
+			$monthsArray[sprintf('%02d', $i)] = strftime('%B', mktime(0, 0, 0, $i, 1, 2000));
197
+		}
198
+		return $monthsArray;
199
+	}
200
+	public static function getWeekDaysArray() {
201
+		$timestamp = strtotime('next Sunday');
202
+		$days = array();
203
+		for ($i = 0; $i < 7; $i++) {
204
+			$day = strftime('%A', $timestamp);
205
+			$days[ strtolower($day) ] = $day;
206
+			$timestamp = strtotime('+1 day', $timestamp);
207
+		}
208
+		return $days;
209
+	}
210
+	/**
211
+	 * Get an array with years range from current year
212
+	 *
213
+	 * @param int $from - how many years from today ago
214
+	 * @param int $to - how many years in future
215
+	 * @param $formatKey - format for keys in array, @see strftime
216
+	 * @param $formatVal - format for values in array, @see strftime
217
+	 * @return array - years 
218
+	 */
219
+	public static function getYearsArray( $from, $to, $formatKey = '%Y', $formatVal = '%Y' ) {
220
+		$today = getdate();
221
+		$yearsArray = array();
222
+		for ($i = $today['year'] - $from; $i <= $today['year'] + $to; $i++) {
223
+			$yearsArray[strftime($formatKey, mktime(0, 0, 0, 1, 1, $i))] = strftime($formatVal, mktime(0, 0, 0, 1, 1, $i));
224
+		}
225
+		return $yearsArray;
226
+	}
227
+	/**
228
+	 * Make replacement in $text, where it will be find all keys with prefix ":" and replace it with corresponding value
229
+	 *
230
+	 * @see email_templatesModel::renderContent()
231
+	 * @see checkoutView::getSuccessPage()
232
+	 */
233
+	public static function makeVariablesReplacement( $text, $variables ) {
234
+		if (!empty($text) && !empty($variables) && is_array($variables)) {
235
+			foreach ($variables as $k => $v) {
236
+				$text = str_replace(':' . $k, $v, $text);
237
+			}
238
+			return $text;
239
+		}
240
+		return false;
241
+	}
242
+	/**
243
+	 * Retrive full directory of plugin
244
+	 *
245
+	 * @param string $name - plugin name
246
+	 * @return string full path in file system to plugin directory
247
+	 */
248
+	public static function getPluginDir( $name = '' ) {
249
+		return WP_PLUGIN_DIR . DS . $name . DS;
250
+	}
251
+	public static function getPluginPath( $name = '' ) {
252
+		$path = plugins_url($name) . '/';
253
+		if (substr($path, 0, 4) != 'http') {
254
+			$home = home_url();
255
+			if (is_ssl() && substr($home, 0, 5) != 'https') {
256
+				$home = 'https' . substr($home, 4);
257
+			}
258
+			$path = $home . ( substr($path, 0, 1) == '/' ? '' : '/' ) . $path;
259
+		}
260
+		return $path;
261
+	}
262
+	public static function getExtModDir( $plugName ) {
263
+		return self::getPluginDir($plugName);
264
+	}
265
+	public static function getExtModPath( $plugName ) {
266
+		return self::getPluginPath($plugName);
267
+	}
268
+	public static function getCurrentWPThemePath() {
269
+		return get_template_directory_uri();
270
+	}
271
+	public static function isThisCommercialEdition() {
272
+		foreach (FrameWpf::_()->getModules() as $m) {
273
+			if (is_object($m) && $m->isExternal()) {
274
+				return true;
275
+			}
276
+		}
277
+		return false;
278
+	}
279
+	public static function checkNum( $val, $default = 0 ) {
280
+		if (!empty($val) && is_numeric($val)) {
281
+			return $val;
282
+		}
283
+		return $default;
284
+	}
285
+	public static function checkString( $val, $default = '' ) {
286
+		if (!empty($val) && is_string($val)) {
287
+			return $val;
288
+		}
289
+		return $default;
290
+	}
291
+	/**
292
+	 * Retrives extension of file
293
+	 *
294
+	 * @param string $path - path to a file
295
+	 * @return string - file extension
296
+	 */
297
+	public static function getFileExt( $path ) {
298
+		return strtolower( pathinfo($path, PATHINFO_EXTENSION) );
299
+	}
300
+	public static function getRandStr( $length = 10, $allowedChars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890', $params = array() ) {
301
+		$result = '';
302
+		$allowedCharsLen = strlen($allowedChars);
303
+		if (isset($params['only_lowercase']) && $params['only_lowercase']) {
304
+			$allowedChars = strtolower($allowedChars);
305
+		}
306
+		while (strlen($result) < $length) {
307
+			$result .= substr($allowedChars, rand(0, $allowedCharsLen), 1);
308
+		}
309
+
310
+		return $result;
311
+	}
312
+	/**
313
+	 * Get current host location
314
+	 *
315
+	 * @return string host string
316
+	 */
317
+	public static function getHost() {
318
+		return empty($_SERVER['HTTP_HOST']) ? '' : sanitize_text_field($_SERVER['HTTP_HOST']);
319
+	}
320
+	/**
321
+	 * Check if device is mobile
322
+	 *
323
+	 * @return bool true if user are watching this site from mobile device
324
+	 */
325
+	public static function isMobile() {
326
+		importClassWpf('Mobile_Detect', WPF_HELPERS_DIR . 'mobileDetect.php');
327
+		$mobileDetect = new Mobile_Detect();
328
+		return $mobileDetect->isMobile();
329
+	}
330
+	/**
331
+	 * Check if device is tablet
332
+	 *
333
+	 * @return bool true if user are watching this site from tablet device
334
+	 */
335
+	public static function isTablet() {
336
+		importClassWpf('Mobile_Detect', WPF_HELPERS_DIR . 'mobileDetect.php');
337
+		$mobileDetect = new Mobile_Detect();
338
+		return $mobileDetect->isTablet();
339
+	}
340
+	public static function getUploadsDir() {
341
+		$uploadDir = wp_upload_dir();
342
+		return $uploadDir['basedir'];
343
+	}
344
+	public static function getUploadsPath() {
345
+		$uploadDir = wp_upload_dir();
346
+		return $uploadDir['baseurl'];
347
+	}
348
+	public static function arrToCss( $data ) {
349
+		$res = '';
350
+		if (!empty($data)) {
351
+			foreach ($data as $k => $v) {
352
+				$res .= $k . ':' . $v . ';';
353
+			}
354
+		}
355
+		return $res;
356
+	}
357
+	/**
358
+	 * Activate all CSP Plugins
359
+	 * 
360
+	 * @return NULL Check if it's site or multisite and activate.
361
+	 */
362
+	public static function activatePlugin() {
363
+		global $wpdb;
364
+		if (WPF_TEST_MODE) {
365
+			add_action('activated_plugin', array(FrameWpf::_(), 'savePluginActivationErrors'));
366
+		}
367
+		if (function_exists('is_multisite') && is_multisite()) {
368
+			$blog_id = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
369
+			foreach ($blog_id as $id) {
370
+				if (switch_to_blog($id)) {
371
+					InstallerWpf::init();
372
+				} 
373
+			}
374
+			restore_current_blog();
375
+			return;
376
+		} else {
377
+			InstallerWpf::init();
378
+		}
379
+	}
380
+
381
+	/**
382
+	 * Delete All CSP Plugins
383
+	 * 
384
+	 * @return NULL Check if it's site or multisite and decativate it.
385
+	 */
386
+	public static function deletePlugin() {
387
+		global $wpdb;
388
+		if (function_exists('is_multisite') && is_multisite()) {
389
+			$blog_id = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
390
+			foreach ($blog_id as $id) {
391
+				if (switch_to_blog($id)) {
392
+					InstallerWpf::delete();
393
+				} 
394
+			}
395
+			restore_current_blog();
396
+			return;
397
+		} else {
398
+			InstallerWpf::delete();
399
+		}
400
+	}
401
+	public static function deactivatePlugin() {
402
+		global $wpdb;
403
+		if (function_exists('is_multisite') && is_multisite()) {
404
+			$blog_id = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
405
+			foreach ($blog_id as $id) {
406
+				if (switch_to_blog($id)) {
407
+					InstallerWpf::deactivate();
408
+				} 
409
+			}
410
+			restore_current_blog();
411
+			return;
412
+		} else {
413
+			InstallerWpf::deactivate();
414
+		}
415
+	}
416
+	public static function isWritable( $filename ) {
417
+		return is_writable($filename);
418
+	}
419
+	
420
+	public static function isReadable( $filename ) {
421
+		return is_readable($filename);
422
+	}
423
+	
424
+	public static function fileExists( $filename ) {
425
+		return file_exists($filename);
426
+	}
427
+	public static function isPluginsPage() {
428
+		return ( basename(ReqWpf::getVar('SCRIPT_NAME', 'server')) === 'plugins.php' );
429
+	}
430
+	public static function isSessionStarted() {
431
+		if (version_compare(PHP_VERSION, '5.4.0') >= 0 && function_exists('session_status')) {
432
+			return !( session_status() == PHP_SESSION_NONE );
433
+		} else {
434
+			return !( session_id() == '' );
435
+		}
436
+	}
437
+	public static function generateBgStyle( $data ) {
438
+		$stageBgStyles = array();
439
+		$stageBgStyle = '';
440
+		switch ($data['type']) {
441
+			case 'color':
442
+				$stageBgStyles[] = 'background-color: ' . $data['color'];
443
+				$stageBgStyles[] = 'opacity: ' . $data['opacity'];
444
+				break;
445
+			case 'img':
446
+				$stageBgStyles[] = 'background-image: url(' . $data['img'] . ')';
447
+				switch ($data['img_pos']) {
448
+					case 'center':
449
+						$stageBgStyles[] = 'background-repeat: no-repeat';
450
+						$stageBgStyles[] = 'background-position: center center';
451
+						break;
452
+					case 'tile':
453
+						$stageBgStyles[] = 'background-repeat: repeat';
454
+						break;
455
+					case 'stretch':
456
+						$stageBgStyles[] = 'background-repeat: no-repeat';
457
+						$stageBgStyles[] = '-moz-background-size: 100% 100%';
458
+						$stageBgStyles[] = '-webkit-background-size: 100% 100%';
459
+						$stageBgStyles[] = '-o-background-size: 100% 100%';
460
+						$stageBgStyles[] = 'background-size: 100% 100%';
461
+						break;
462
+				}
463
+				break;
464
+		}
465
+		if (!empty($stageBgStyles)) {
466
+			$stageBgStyle = implode(';', $stageBgStyles);
467
+		}
468
+		return $stageBgStyle;
469
+	}
470
+	/**
471
+	 * Parse worwpfess post/page/custom post type content for images and return it's IDs if there are images
472
+	 *
473
+	 * @param string $content Post/page/custom post type content
474
+	 * @return array List of images IDs from content
475
+	 */
476
+	public static function parseImgIds( $content ) {
477
+		$res = array();
478
+		preg_match_all('/wp-image-(?<ID>\d+)/', $content, $matches);
479
+		if ($matches && isset($matches['ID']) && !empty($matches['ID'])) {
480
+			$res = $matches['ID'];
481
+		}
482
+		return $res;
483
+	}
484
+	/**
485
+	 * Retrive file path in file system from provided URL, it should be in wp-content/uploads
486
+	 *
487
+	 * @param string $url File url path, should be in wp-content/uploads
488
+	 * @return string Path in file system to file
489
+	 */
490
+	public static function getUploadFilePathFromUrl( $url ) {
491
+		$uploadsPath = self::getUploadsPath();
492
+		$uploadsDir = self::getUploadsDir();
493
+		return str_replace($uploadsPath, $uploadsDir, $url);
494
+	}
495
+	/**
496
+	 * Retrive file URL from provided file system path, it should be in wp-content/uploads
497
+	 *
498
+	 * @param string $path File path, should be in wp-content/uploads
499
+	 * @return string URL to file
500
+	 */
501
+	public static function getUploadUrlFromFilePath( $path ) {
502
+		$uploadsPath = self::getUploadsPath();
503
+		$uploadsDir = self::getUploadsDir();
504
+		return str_replace($uploadsDir, $uploadsPath, $path);
505
+	}
506
+	public static function getUserBrowserString() {
507
+		return isset($_SERVER['HTTP_USER_AGENT']) ? sanitize_text_field($_SERVER['HTTP_USER_AGENT']) : false;
508
+	}
509
+	public static function getBrowser() {
510
+		$u_agent = self::getUserBrowserString();
511
+		$bname = 'Unknown';
512
+		$platform = 'Unknown';
513
+		$version = '';
514
+		$pattern = '';
515
+		
516
+		if ($u_agent) {
517
+			//First get the platform?
518
+			if (preg_match('/linux/i', $u_agent)) {
519
+				$platform = 'linux';
520
+			} elseif (preg_match('/macintosh|mac os x/i', $u_agent)) {
521
+				$platform = 'mac';
522
+			} elseif (preg_match('/windows|win32/i', $u_agent)) {
523
+				$platform = 'windows';
524
+			}
525
+			// Next get the name of the useragent yes seperately and for good reason
526
+			if ( ( preg_match('/MSIE/i', $u_agent) && !preg_match('/Opera/i', $u_agent) ) || ( strpos($u_agent, 'Trident/7.0; rv:11.0') !== false ) ) {
527
+				$bname = 'Internet Explorer';
528
+				$ub = 'MSIE';
529
+			} elseif (preg_match('/Firefox/i', $u_agent)) {
530
+				$bname = 'Mozilla Firefox';
531
+				$ub = 'Firefox';
532
+			} elseif (preg_match('/Chrome/i', $u_agent)) {
533
+				$bname = 'Google Chrome';
534
+				$ub = 'Chrome';
535
+			} elseif (preg_match('/Safari/i', $u_agent)) {
536
+				$bname = 'Apple Safari';
537
+				$ub = 'Safari';
538
+			} elseif (preg_match('/Opera/i', $u_agent)) {
539
+				$bname = 'Opera';
540
+				$ub = 'Opera';
541
+			} elseif (preg_match('/Netscape/i', $u_agent)) {
542
+				$bname = 'Netscape';
543
+				$ub = 'Netscape';
544
+			}
545
+
546
+			// finally get the correct version number
547
+			$known = array('Version', $ub, 'other');
548
+			$pattern = '#(?<browser>' . join('|', $known) . ')[/ ]+(?<version>[0-9.|a-zA-Z.]*)#';
549
+
550
+			// see how many we have
551
+			$i = count($matches['browser']);
552
+			if (1 != $i) {
553
+				//we will have two since we are not using 'other' argument yet
554
+				//see if version is before or after the name
555
+				if ( strripos($u_agent, 'Version') < strripos($u_agent, $ub) ) {
556
+					$version = $matches['version'][0];
557
+				} else {
558
+					$version = $matches['version'][1];
559
+				}
560
+			} else {
561
+				$version = $matches['version'][0];
562
+			}
563
+		}
564
+
565
+		// check if we have a number
566
+		if ( ( null == $version ) || ( '' == $version ) ) {
567
+			$version = '?';
568
+		}
569
+
570
+		return array(
571
+			'userAgent' => $u_agent,
572
+			'name'      => $bname,
573
+			'version'   => $version,
574
+			'platform'  => $platform,
575
+			'pattern'    => $pattern
576
+		);
577
+	}
578
+	public static function getBrowsersList() {
579
+		return array(
580
+			'Unknown', 'Internet Explorer', 'Mozilla Firefox', 'Google Chrome', 'Apple Safari', 
581
+			'Opera', 'Netscape',
582
+		);
583
+	}
584
+	public static function getLangCode2Letter() {
585
+		$langCode = self::getLangCode();
586
+		return strlen($langCode) > 2 ? substr($langCode, 0, 2) : $langCode;
587
+	}
588
+	public static function getLangCode() {
589
+		return get_locale();
590
+	}
591
+	public static function getBrowserLangCode() {
592
+		return isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) && !empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])
593
+			? strtolower(substr(sanitize_text_field($_SERVER['HTTP_ACCEPT_LANGUAGE']), 0, 2))
594
+			: self::getLangCode2Letter();
595
+	}
596
+	public static function getTimeRange() {
597
+		$time = array();
598
+		$hours = range(1, 11);
599
+		array_unshift($hours, 12);
600
+		$k = 0;
601
+		$count = count($hours);
602
+		for ($i = 0; $i < 4 * $count; $i++) {
603
+			$newItem = $hours[ $k ];
604
+			$newItem .= ':' . ( ( $i % 2 ) ? '30' : '00' );
605
+			$newItem .= ( $i < $count * 2 ) ? 'am' : 'pm';
606
+			if ($i % 2) {
607
+				$k++;
608
+			}
609
+			if ($i == $count * 2 - 1) {
610
+				$k = 0;
611
+			}
612
+			$time[] = $newItem;
613
+		}
614
+		return array_combine($time, $time);
615
+	}
616
+	public static function getSearchEnginesList() {
617
+		return array(
618
+			'google.com' => array('label' => 'Google'),
619
+			'yahoo.com' => array('label' => 'Yahoo!'),
620
+			'youdao.com' => array('label' => 'Youdao'),
621
+			'yandex' => array('label' => 'Yandex'),
622
+			'sogou.com' => array('label' => 'Sogou'),
623
+			'qwant.com' => array('label' => 'Qwant'),
624
+			'bing.com' => array('label' => 'Bing'),
625
+			'munax.com' => array('label' => 'Munax'),
626
+		);
627
+	}
628
+	public static function getSocialList() {
629
+		return array(
630
+			'facebook.com' => array('label' => 'Facebook'),
631
+			'pinterest.com' => array('label' => 'Pinterest'),
632
+			'instagram.com' => array('label' => 'Instagram'),
633
+			'yelp.com' => array('label' => 'Yelp'),
634
+			'vk.com' => array('label' => 'VKontakte'),
635
+			'myspace.com' => array('label' => 'Myspace'),
636
+			'linkedin.com' => array('label' => 'LinkedIn'),
637
+			'plus.google.com' => array('label' => 'Google+'),
638
+			'google.com' => array('label' => 'Google'),
639
+		);
640
+	}
641
+	public static function getReferalUrl() {
642
+		// Simple for now
643
+		return ReqWpf::getVar('HTTP_REFERER', 'server');
644
+	}
645
+	public static function getReferalHost() {
646
+		$refUrl = self::getReferalUrl();
647
+		if (!empty($refUrl)) {
648
+			$refer = parse_url( $refUrl );
649
+			if ($refer && isset($refer['host']) && !empty($refer['host'])) {
650
+				return $refer['host'];
651
+			}
652
+		}
653
+		return false;
654
+	}
655
+	public static function getCurrentUserRole() {
656
+		$roles = self::getCurrentUserRoleList();
657
+		if ($roles) {
658
+			$ncaps = count($roles);
659
+			$role = $roles[$ncaps - 1];
660
+			return $role;
661
+		}
662
+		return false;
663
+	}
664
+	public static function getCurrentUserRoleList() {
665
+		global $current_user, $wpdb;
666
+		if ($current_user) {
667
+			$roleKey = $wpdb->prefix . 'capabilities';
668
+			if (isset($current_user->$roleKey) && !empty($current_user->$roleKey)) {
669
+				return array_keys($current_user->$roleKey);
670
+			}
671
+		}
672
+		return false;
673
+	}
674
+	public static function getAllUserRoles() {
675
+		return get_editable_roles();
676
+	}
677
+	public static function getAllUserRolesList() {
678
+		$res = array();
679
+		$roles = self::getAllUserRoles();
680
+		if (!empty($roles)) {
681
+			foreach ($roles as $k => $data) {
682
+				$res[ $k ] = $data['name'];
683
+			}
684
+		}
685
+		return $res;
686
+	}
687
+	public static function rgbToArray( $rgb ) {
688
+		$rgb = array_map('trim', explode(',', trim(str_replace(array('rgb', 'a', '(', ')'), '', $rgb))));
689
+		return $rgb;
690
+	}
691
+	public static function hexToRgb( $hex ) {
692
+		if (strpos($hex, 'rgb') !== false) {	// Maybe it's already in rgb format - just return it as array
693
+			return self::rgbToArray($hex);
694
+		}
695
+		$hex = str_replace('#', '', $hex);
696
+
697
+		if (strlen($hex) == 3) {
698
+			$r = hexdec(substr($hex, 0, 1) . substr($hex, 0, 1));
699
+			$g = hexdec(substr($hex, 1, 1) . substr($hex, 1, 1));
700
+			$b = hexdec(substr($hex, 2, 1) . substr($hex, 2, 1));
701
+		} else {
702
+			$r = hexdec(substr($hex, 0, 2));
703
+			$g = hexdec(substr($hex, 2, 2));
704
+			$b = hexdec(substr($hex, 4, 2));
705
+		}
706
+		$rgb = array($r, $g, $b);
707
+		return $rgb; // returns an array with the rgb values
708
+	}
709
+	public static function hexToRgbaStr( $hex, $alpha = 1 ) {
710
+		$rgbArr = self::hexToRgb($hex);
711
+		return 'rgba(' . implode(',', $rgbArr) . ',' . $alpha . ')';
712
+	}
713
+	public static function controlNumericValues( $values, $field ) {
714
+		foreach ($values as $k => $val) {
715
+			$values[$k] = ( 'dec' == $field ? (float) $val : (int) $val );
716
+		}
717
+		return $values;
718
+	}
719
+}

+ 145 - 0
app/wp-content/plugins/woo-product-filter/classes/validator.php

@@ -0,0 +1,145 @@
1
+<?php
2
+class ValidatorWpf {
3
+	public static $errors = array();
4
+	public static function validate( $field, $label = '', $validate = array() ) {
5
+		self::$errors = array();
6
+		if (is_object($field) && get_class($field) != 'FieldWpf') {
7
+			$value = $field;
8
+			$field = new FieldWpf('noMatter');
9
+			$field->label = $label;
10
+			$field->setValue($value);
11
+			$field->setValidation($validate);
12
+		}
13
+		if (!empty($field->validate)) {
14
+			foreach ($field->validate as $v) {
15
+				if (method_exists('ValidatorWpf', $v)) {
16
+					self::$v($field);
17
+				}
18
+			}
19
+		}
20
+		if (method_exists('ValidatorWpf', $field->type)) {
21
+			$validate = $field->type;
22
+			self::$validate($field);
23
+		}
24
+		if ($field->maxlen) {
25
+			self::validLen($field);
26
+		}
27
+		return self::$errors;
28
+	}
29
+	public static function validLen( $field, $label = '', $validate = array() ) {
30
+		if ( !(bool) ( strlen($field->value) <= $field->maxlen ) ) {
31
+			/* translators: 1: label 2: max length */
32
+			self::addError(esc_html(sprintf(__('Invalid length for %1$s, max length is %2$s'), $field->label, $field->maxlen)), $field->name);
33
+			return false;
34
+		}
35
+		return true;
36
+	}
37
+	public static function _( $field ) {
38
+		return self::validate($field);
39
+	}
40
+	public static function getErrors() {
41
+		return self::$errors;
42
+	}
43
+	public static function numeric( $field ) {
44
+		if (!is_numeric($field->value) && !empty($field->value)) {
45
+			/* translators: %s: label */
46
+			self::addError(esc_html(sprintf(__('Invalid numeric value for %s'), $field->label)), $field->name);
47
+			return false;
48
+		}
49
+		return true;
50
+	}
51
+	public static function int( $field ) {
52
+		return self::numeric($field);
53
+	}
54
+	public static function float( $field ) {
55
+		return self::numeric($field);
56
+	}
57
+	public static function double( $field ) {
58
+		return self::numeric($field);
59
+	}
60
+	protected static function _notEmpty( $value ) {
61
+		if (is_array($value)) {
62
+			foreach ($value as $v) {
63
+				if (self::_notEmpty($v)) {       //If at least 1 element of array are not empty - all array will be not empty
64
+					$res = true;
65
+					break;
66
+				}
67
+			}
68
+		} else {
69
+			$res = !empty($value);
70
+		}
71
+		return $res;
72
+	}
73
+	public static function notEmpty( $field ) {
74
+		if (!self::_notEmpty($field->value)) {
75
+			/* translators: %s: label */
76
+			self::addError(esc_html(sprintf(__('Please enter %s'), $field->label)), $field->name);
77
+			return false;
78
+		}
79
+		return true;
80
+	}
81
+	public static function selectNotEmpty( $field ) {
82
+		if (empty($field->value)) {
83
+			/* translators: %s: label */
84
+			self::addError(esc_html(sprintf(__('Please select %s'), $field->label)), $field->name);
85
+			return false;
86
+		}
87
+		return true;
88
+	}
89
+	public static function email( $field ) {
90
+		if (!is_email($field->value)) {
91
+			/* translators: %s: label */
92
+			self::addError(esc_html(sprintf(__('Invalid %s'), $field->label)), $field->name);
93
+			return false;
94
+		} elseif (email_exists($field->value)) {
95
+			/* translators: %s: label */
96
+			self::addError(esc_html(sprintf(__('%s is already registered'), $field->label)), $field->name);
97
+			return false;
98
+		}
99
+		return true;
100
+	}
101
+	public static function addError( $error, $key = '' ) {
102
+		if ($key) {
103
+			self::$errors[$key] = $error;
104
+		} else {
105
+			self::$errors[] = $error;
106
+		}
107
+	}
108
+	public static function string( $field ) {
109
+		if (preg_match('/([0-9].*)/', $field->value)) {
110
+			/* translators: %s: label */
111
+			self::addError(esc_html(sprintf(__('Invalid %s'), $field->label)), $field->name);
112
+			return false;
113
+		}
114
+		return true;
115
+	}
116
+	public static function getProductValidationMethods() {
117
+		$res = array();
118
+		$all = get_class_methods('ValidatorWpf');
119
+		foreach ($all as $m) {
120
+			if (in_array($m, array('int', 'none', 'string'))) {
121
+				$res[$m] = esc_html__($m);
122
+			}
123
+		}
124
+		return $res;
125
+	}
126
+	public static function getUserValidationMethods() {
127
+		// here validation for user fields
128
+		$res = array();
129
+		$all = get_class_methods('ValidatorWpf');
130
+		foreach ($all as $m) {
131
+			if (in_array($m, array('int', 'none', 'string', 'email', 'validLen'))) {
132
+				$res[$m] = esc_html__($m);
133
+			}
134
+		}
135
+		return $res;
136
+	}
137
+	public static function prepareInput( $input ) {
138
+		global $wpdb;
139
+		if (is_array($input)) {
140
+			return array_map(array(validator, 'prepareInput'), $input);
141
+		} else {
142
+			return $wpdb->_real_escape($input);
143
+		}
144
+	}
145
+}

+ 97 - 0
app/wp-content/plugins/woo-product-filter/classes/view.php

@@ -0,0 +1,97 @@
1
+<?php
2
+abstract class ViewWpf extends BaseObjectWpf {
3
+	/*
4
+	 * @deprecated
5
+	 */
6
+	protected $_tpl = WPF_DEFAULT;
7
+	/*
8
+	 * @var string name of theme to load from templates, if empty - default values will be used
9
+	 */
10
+	protected $_theme = '';
11
+	/*
12
+	 * @var string module code for this view
13
+	 */
14
+	protected $_code = '';
15
+
16
+	public function display( $tpl = '' ) {
17
+		$tpl = ( empty($tpl) ) ? $this->_tpl : $tpl;
18
+		$content = $this->getContent($tpl);
19
+		if (false !== $content) {
20
+			HtmlWpf::echoEscapedHtml($content);
21
+		}
22
+	}
23
+	public function getPath( $tpl ) {
24
+		$path = '';
25
+		$parentModule = FrameWpf::_()->getModule( $this->_code );
26
+		if (file_exists($parentModule->getModDir() . 'views' . DS . 'tpl' . DS . $tpl . '.php')) { //Then try to find it in module directory
27
+			$path = $parentModule->getModDir() . DS . 'views' . DS . 'tpl' . DS . $tpl . '.php';
28
+		}
29
+		return $path;
30
+	}
31
+	public function getModule() {
32
+		return FrameWpf::_()->getModule( $this->_code );
33
+	}
34
+	public function getModel( $code = '' ) {
35
+		return FrameWpf::_()->getModule( $this->_code )->getController()->getModel($code);
36
+	}
37
+	public function getContent( $tpl = '' ) {
38
+		$tpl = ( empty($tpl) ) ? $this->_tpl : $tpl;
39
+		$path = $this->getPath($tpl);
40
+		if ($path) {
41
+			$content = '';
42
+			ob_start();
43
+			require($path);
44
+			$content = ob_get_contents();
45
+			ob_end_clean();
46
+			return $content;
47
+		}
48
+		return false;
49
+	}
50
+	public function setTheme( $theme ) {
51
+		$this->_theme = $theme;
52
+	}
53
+	public function getTheme() {
54
+		return $this->_theme;
55
+	}
56
+	public function setTpl( $tpl ) {
57
+		$this->_tpl = $tpl;
58
+	}
59
+	public function getTpl() {
60
+		return $this->_tpl;
61
+	}
62
+	public function init() {
63
+
64
+	}
65
+	public function assign( $name, $value ) {
66
+		$this->$name = $value;
67
+	}
68
+	public function setCode( $code ) {
69
+		$this->_code = $code;
70
+	}
71
+	public function getCode() {
72
+		return $this->_code;
73
+	}
74
+
75
+	/**
76
+	 * This will display form for our widgets
77
+	 */
78
+	public function displayWidgetForm( $data = array(), $widget = array(), $formTpl = 'form' ) {
79
+		$this->assign('data', $data);
80
+		$this->assign('widget', $widget);
81
+		if (FrameWpf::_()->isTplEditor()) {
82
+			if ($this->getPath($formTpl . '_ext')) {
83
+				$formTpl .= '_ext';
84
+			}
85
+		}
86
+		self::display($formTpl);
87
+	}
88
+	public function sizeToPxPt( $size ) {
89
+		if (!strpos($size, 'px') && !strpos($size, '%')) {
90
+			$size .= 'px';
91
+		}
92
+		return $size;
93
+	}
94
+	public function getInlineContent( $tpl = '' ) {
95
+		return preg_replace('/\s+/', ' ', $this->getContent($tpl));
96
+	}
97
+}

+ 89 - 0
app/wp-content/plugins/woo-product-filter/config.php

@@ -0,0 +1,89 @@
1
+<?php
2
+global $wpdb;
3
+if (!defined('WPLANG') || WPLANG == '') {
4
+	define('WPF_WPLANG', 'en_GB');
5
+} else {
6
+	define('WPF_WPLANG', WPLANG);
7
+}
8
+if (!defined('DS')) {
9
+	define('DS', DIRECTORY_SEPARATOR);
10
+}
11
+
12
+define('WPF_PLUG_NAME', basename(dirname(__FILE__)));
13
+define('WPF_DIR', WP_PLUGIN_DIR . DS . WPF_PLUG_NAME . DS);
14
+define('WPF_TPL_DIR', WPF_DIR . 'tpl' . DS);
15
+define('WPF_CLASSES_DIR', WPF_DIR . 'classes' . DS);
16
+define('WPF_TABLES_DIR', WPF_CLASSES_DIR . 'tables' . DS);
17
+define('WPF_HELPERS_DIR', WPF_CLASSES_DIR . 'helpers' . DS);
18
+define('WPF_LANG_DIR', WPF_DIR . 'languages' . DS);
19
+define('WPF_IMG_DIR', WPF_DIR . 'img' . DS);
20
+define('WPF_TEMPLATES_DIR', WPF_DIR . 'templates' . DS);
21
+define('WPF_MODULES_DIR', WPF_DIR . 'modules' . DS);
22
+define('WPF_FILES_DIR', WPF_DIR . 'files' . DS);
23
+define('WPF_ADMIN_DIR', ABSPATH . 'wp-admin' . DS);
24
+
25
+define('WPF_PLUGINS_URL', plugins_url());
26
+if (!defined('WPF_SITE_URL')) {
27
+	define('WPF_SITE_URL', get_bloginfo('wpurl') . '/');
28
+}
29
+define('WPF_JS_PATH', WPF_PLUGINS_URL . '/' . WPF_PLUG_NAME . '/js/');
30
+define('WPF_CSS_PATH', WPF_PLUGINS_URL . '/' . WPF_PLUG_NAME . '/css/');
31
+define('WPF_IMG_PATH', WPF_PLUGINS_URL . '/' . WPF_PLUG_NAME . '/img/');
32
+define('WPF_MODULES_PATH', WPF_PLUGINS_URL . '/' . WPF_PLUG_NAME . '/modules/');
33
+define('WPF_TEMPLATES_PATH', WPF_PLUGINS_URL . '/' . WPF_PLUG_NAME . '/templates/');
34
+define('WPF_JS_DIR', WPF_DIR . 'js/');
35
+
36
+define('WPF_URL', WPF_SITE_URL);
37
+
38
+define('WPF_LOADER_IMG', WPF_IMG_PATH . 'loading.gif');
39
+define('WPF_TIME_FORMAT', 'H:i:s');
40
+define('WPF_DATE_DL', '/');
41
+define('WPF_DATE_FORMAT', 'm/d/Y');
42
+define('WPF_DATE_FORMAT_HIS', 'm/d/Y (' . WPF_TIME_FORMAT . ')');
43
+define('WPF_DATE_FORMAT_JS', 'mm/dd/yy');
44
+define('WPF_DATE_FORMAT_CONVERT', '%m/%d/%Y');
45
+define('WPF_WPDB_PREF', $wpdb->prefix);
46
+define('WPF_DB_PREF', 'wpf_');
47
+define('WPF_MAIN_FILE', 'woo-product-filter.php');
48
+
49
+define('WPF_DEFAULT', 'default');
50
+define('WPF_CURRENT', 'current');
51
+
52
+define('WPF_EOL', "\n");
53
+
54
+define('WPF_PLUGIN_INSTALLED', true);
55
+define('WPF_VERSION', '2.0.2');
56
+define('WPF_PRO_REQUIRES', '2.0.0');
57
+define('WPF_USER', 'user');
58
+
59
+define('WPF_CLASS_PREFIX', 'wpfc');
60
+define('WPF_FREE_VERSION', false);
61
+define('WPF_TEST_MODE', true);
62
+
63
+define('WPF_SUCCESS', 'Success');
64
+define('WPF_FAILED', 'Failed');
65
+define('WPF_ERRORS', 'wpfErrors');
66
+
67
+define('WPF_ADMIN',	'admin');
68
+define('WPF_LOGGED', 'logged');
69
+define('WPF_GUEST',	'guest');
70
+
71
+define('WPF_ALL', 'all');
72
+
73
+define('WPF_METHODS', 'methods');
74
+define('WPF_USERLEVELS', 'userlevels');
75
+define('WPF_LANG_CODE', 'woo-product-filter');
76
+/**
77
+ * Framework instance code
78
+ */
79
+define('WPF_CODE', 'wpf');
80
+/**
81
+ * Plugin name
82
+ */
83
+define('WPF_WP_PLUGIN_NAME', 'Woo Product Filter');
84
+/**
85
+ * Custom defined for plugin
86
+ */
87
+define('WPF_SHORTCODE', 'wpf-filters');
88
+define('WPF_SHORTCODE_PRODUCTS', 'wpf-products');
89
+define('WPF_SHORTCODE_SELECTED_FILTERS', 'wpf-selected-filters');

+ 80 - 0
app/wp-content/plugins/woo-product-filter/css/bootstrap-alerts.css

@@ -0,0 +1,80 @@
1
+.alert i.fa {
2
+	color: #28282a;
3
+}
4
+.alert, .alert td {
5
+	padding: 15px;
6
+	margin-bottom: 20px;
7
+	/*border: 1px solid transparent;
8
+	border-radius: 4px;*/
9
+	background-color: transparent;
10
+	font-size: 15px;
11
+}
12
+.alert h4 {
13
+	margin-top: 0;
14
+	color: inherit;
15
+}
16
+.alert .alert-link, .alert td .alert-link {
17
+  font-weight: bold;
18
+}
19
+.alert > p,
20
+.alert > ul {
21
+  margin-bottom: 0;
22
+}
23
+.alert > p + p {
24
+  margin-top: 5px;
25
+}
26
+.alert-dismissable,
27
+.alert-dismissible {
28
+  padding-right: 35px;
29
+}
30
+.alert-dismissable .close,
31
+.alert-dismissible .close {
32
+  position: relative;
33
+  top: -2px;
34
+  right: -21px;
35
+  color: inherit;
36
+}
37
+.alert-success, .alert-success td {
38
+  color: #4ae8ea;
39
+  /*background-color: #dff0d8;
40
+  border-color: #d6e9c6;*/
41
+}
42
+/*.alert-success hr {
43
+  border-top-color: #c9e2b3;
44
+}
45
+.alert-success .alert-link {
46
+  color: #2b542c;
47
+}*/
48
+.alert-info, .alert-info td {
49
+  color: #54b1ff;
50
+  /*background-color: #d9edf7;
51
+  border-color: #bce8f1;*/
52
+}
53
+/*.alert-info hr {
54
+  border-top-color: #a6e1ec;
55
+}
56
+.alert-info .alert-link {
57
+  color: #245269;
58
+}*/
59
+.alert-warning, .alert-warning td {
60
+  color: #e89b07;
61
+  /*background-color: #fcf8e3;
62
+  border-color: #faebcc;*/
63
+}
64
+/*.alert-warning hr {
65
+  border-top-color: #f7e1b5;
66
+}
67
+.alert-warning .alert-link {
68
+  color: #66512c;
69
+}*/
70
+.alert-danger, .alert-danger td {
71
+  color: #fa4e7f;
72
+  /*background-color: #f2dede;
73
+  border-color: #ebccd1;*/
74
+}
75
+/*.alert-danger hr {
76
+  border-top-color: #e4b9c0;
77
+}
78
+.alert-danger .alert-link {
79
+  color: #843534;
80
+}*/

File diff suppressed because it is too large
+ 5 - 0
app/wp-content/plugins/woo-product-filter/css/bootstrap-simple.css


File diff suppressed because it is too large
+ 10 - 0
app/wp-content/plugins/woo-product-filter/css/bootstrap.min.css


BIN
app/wp-content/plugins/woo-product-filter/css/images/arrows-sprite.png


BIN
app/wp-content/plugins/woo-product-filter/css/images/down.png


BIN
app/wp-content/plugins/woo-product-filter/css/images/minimal.png


BIN
app/wp-content/plugins/woo-product-filter/css/images/minimal@2x.png


BIN
app/wp-content/plugins/woo-product-filter/css/images/ui-bg_flat_0_aaaaaa_40x100.png


BIN
app/wp-content/plugins/woo-product-filter/css/images/ui-bg_glass_95_fef1ec_1x400.png


BIN
app/wp-content/plugins/woo-product-filter/css/images/ui-bg_gloss-wave_16_121212_500x100.png


BIN
app/wp-content/plugins/woo-product-filter/css/images/ui-bg_highlight-hard_15_888888_1x100.png


BIN
app/wp-content/plugins/woo-product-filter/css/images/ui-bg_highlight-hard_55_555555_1x100.png


BIN
app/wp-content/plugins/woo-product-filter/css/images/ui-bg_highlight-soft_35_adadad_1x100.png


BIN
app/wp-content/plugins/woo-product-filter/css/images/ui-bg_highlight-soft_60_dddddd_1x100.png


BIN
app/wp-content/plugins/woo-product-filter/css/images/ui-bg_inset-soft_15_121212_1x100.png


BIN
app/wp-content/plugins/woo-product-filter/css/images/ui-icons_666666_256x240.png


BIN
app/wp-content/plugins/woo-product-filter/css/images/ui-icons_aaaaaa_256x240.png


BIN
app/wp-content/plugins/woo-product-filter/css/images/ui-icons_bbbbbb_256x240.png


BIN
app/wp-content/plugins/woo-product-filter/css/images/ui-icons_c98000_256x240.png


BIN
app/wp-content/plugins/woo-product-filter/css/images/ui-icons_cccccc_256x240.png


BIN
app/wp-content/plugins/woo-product-filter/css/images/ui-icons_cd0a0a_256x240.png


BIN
app/wp-content/plugins/woo-product-filter/css/images/ui-icons_f29a00_256x240.png


+ 4 - 0
app/wp-content/plugins/woo-product-filter/css/jquery-dialog.css

@@ -0,0 +1,4 @@
1
+.ui-dialog-titlebar .ui-dialog-titlebar-close .ui-icon-closethick {
2
+	display: inline;
3
+	float: right;
4
+}

+ 24 - 0
app/wp-content/plugins/woo-product-filter/css/jquery-slider.css

@@ -0,0 +1,24 @@
1
+/*!
2
+ * jQuery UI Slider 1.8.23
3
+ *
4
+ * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
5
+ * Dual licensed under the MIT or GPL Version 2 licenses.
6
+ * http://jquery.org/license
7
+ *
8
+ * http://docs.jquery.com/UI/Slider#theming
9
+ */
10
+.ui-slider { position: relative; text-align: left; }
11
+.ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; }
12
+.ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; }
13
+
14
+.ui-slider-horizontal { height: .8em; }
15
+.ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; }
16
+.ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; }
17
+.ui-slider-horizontal .ui-slider-range-min { left: 0; }
18
+.ui-slider-horizontal .ui-slider-range-max { right: 0; }
19
+
20
+.ui-slider-vertical { width: .8em; height: 100px; }
21
+.ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; }
22
+.ui-slider-vertical .ui-slider-range { left: 0; width: 100%; }
23
+.ui-slider-vertical .ui-slider-range-min { bottom: 0; }
24
+.ui-slider-vertical .ui-slider-range-max { top: 0; }

File diff suppressed because it is too large
+ 14 - 0
app/wp-content/plugins/woo-product-filter/css/jquery-ui.min.css


File diff suppressed because it is too large
+ 5 - 0
app/wp-content/plugins/woo-product-filter/css/jquery-ui.structure.min.css


File diff suppressed because it is too large
+ 245 - 0
app/wp-content/plugins/woo-product-filter/css/jquery-ui.theme.min.css


+ 59 - 0
app/wp-content/plugins/woo-product-filter/css/jquery.icheck.css

@@ -0,0 +1,59 @@
1
+/* iCheck plugin Minimal skin, black
2
+----------------------------------- */
3
+.icheckbox_minimal,
4
+.iradio_minimal {
5
+    display: inline-block;
6
+    *display: inline;
7
+    vertical-align: middle;
8
+    margin: 0;
9
+    padding: 0;
10
+    width: 18px;
11
+    height: 18px;
12
+    background: url(images/minimal.png) no-repeat;
13
+    border: none;
14
+    cursor: pointer;
15
+}
16
+
17
+.icheckbox_minimal {
18
+    background-position: 0 0;
19
+}
20
+    .icheckbox_minimal.hover {
21
+        background-position: -20px 0;
22
+    }
23
+    .icheckbox_minimal.checked {
24
+        background-position: -40px 0;
25
+    }
26
+    .icheckbox_minimal.disabled {
27
+        background-position: -60px 0;
28
+        cursor: default;
29
+    }
30
+    .icheckbox_minimal.checked.disabled {
31
+        background-position: -80px 0;
32
+    }
33
+
34
+.iradio_minimal {
35
+    background-position: -100px 0;
36
+}
37
+    .iradio_minimal.hover {
38
+        background-position: -120px 0;
39
+    }
40
+    .iradio_minimal.checked {
41
+        background-position: -140px 0;
42
+    }
43
+    .iradio_minimal.disabled {
44
+        background-position: -160px 0;
45
+        cursor: default;
46
+    }
47
+    .iradio_minimal.checked.disabled {
48
+        background-position: -180px 0;
49
+    }
50
+
51
+/* HiDPI support */
52
+@media (-o-min-device-pixel-ratio: 5/4), (-webkit-min-device-pixel-ratio: 1.25), (min-resolution: 120dpi) {
53
+    .icheckbox_minimal,
54
+    .iradio_minimal {
55
+        background-image: url(images/minimal@2x.png);
56
+        -webkit-background-size: 200px 20px;
57
+        background-size: 200px 20px;
58
+    }
59
+}

+ 115 - 0
app/wp-content/plugins/woo-product-filter/css/progressmeter.css

@@ -0,0 +1,115 @@
1
+.progress-button{
2
+	display: inline-block;
3
+	font-size:14px;
4
+	color:#fff !important;
5
+	text-decoration: none !important;
6
+	overflow: hidden;
7
+	position:relative;
8
+
9
+	box-shadow: 0 1px 1px #ccc;
10
+	-webkit-box-shadow: 0 1px 1px #ccc;
11
+	-moz-box-shadow: 0 1px 1px #ccc;
12
+	
13
+	border-radius: 2px;
14
+
15
+	background-color: #ccc;
16
+}
17
+
18
+/*	Hide the original text of the button. Then the loading or finished
19
+	text will be shown in the :after element above it. */
20
+
21
+.progress-button.in-progress,
22
+.progress-button.finished{
23
+	color:transparent !important;
24
+}
25
+
26
+.progress-button.in-progress:after,
27
+.progress-button.finished:after{
28
+	position: absolute;
29
+	z-index: 2;
30
+	width: 100%;
31
+	height: 100%;
32
+	text-align: center;
33
+	top: 0;
34
+	padding-top: inherit;
35
+	color: #fff !important;
36
+	left: 0;
37
+}
38
+
39
+/*	If the .in-progress class is set on the button, show the
40
+	contents of the data-loading attribute on the butotn */
41
+
42
+.progress-button.in-progress:after{
43
+	content:attr(data-loading);
44
+}
45
+
46
+/* The same goes for the .finished class */
47
+
48
+.progress-button.finished:after{
49
+	content:attr(data-finished);
50
+}
51
+
52
+/* The colorful bar that grows depending on the progress */
53
+
54
+.progress-button .tz-bar{
55
+	background-color:#51b7e6;
56
+	background-image:-webkit-linear-gradient(top, #51b7e6, #4dafdd);
57
+	background-image:-moz-linear-gradient(top, #51b7e6, #4dafdd);
58
+	background-image:linear-gradient(top, #51b7e6, #4dafdd);
59
+	
60
+	height:3px;
61
+	bottom:0;
62
+	left:0;
63
+	width:0;
64
+	position:absolute;
65
+	z-index:1;
66
+
67
+	border-radius:0 0 2px 2px;
68
+
69
+	-webkit-transition: width 0.5s, height 0.5s;
70
+	-moz-transition: width 0.5s, height 0.5s;
71
+	transition: width 0.5s, height 0.5s;
72
+}
73
+
74
+/* The bar can be either horizontal, or vertical */
75
+
76
+.progress-button .tz-bar.background-horizontal{
77
+	height:100%;
78
+	border-radius:2px;
79
+}
80
+
81
+.progress-button .tz-bar.background-vertical{
82
+	height:0;
83
+	top:0;
84
+	width:100%;
85
+	border-radius:2px;
86
+}
87
+
88
+
89
+/*----------------------------
90
+	Color themes
91
+-----------------------------*/
92
+
93
+
94
+.progress-button.red{
95
+	background-color: #e6537d;
96
+	background-image:-webkit-linear-gradient(top, #e6537d, #df5179);
97
+	background-image:-moz-linear-gradient(top, #e6537d, #df5179);
98
+	background-image:linear-gradient(top, #e6537d, #df5179);
99
+}
100
+
101
+.progress-button.red .tz-bar{
102
+	background-color:#6876b4;
103
+}
104
+
105
+
106
+.progress-button.green{
107
+	background-color: #64c896;
108
+	background-image:-webkit-linear-gradient(top, #64c896, #5fbd8e);
109
+	background-image:-moz-linear-gradient(top, #64c896, #5fbd8e);
110
+	background-image:linear-gradient(top, #64c896, #5fbd8e);
111
+}
112
+
113
+.progress-button.green .tz-bar{
114
+	background-color:#9e81d6;
115
+}

+ 59 - 0
app/wp-content/plugins/woo-product-filter/css/style-rtl.css

@@ -0,0 +1,59 @@
1
+.woobewoo-wrap{
2
+	margin-right: -20px;
3
+	margin-left: 0;
4
+}
5
+.woobewoo-plugin .woobewoo-content .woobewoo-navigation {
6
+	left: 0;
7
+}
8
+.woobewoo-plugin .woobewoo-content .woobewoo-navigation.woobewoo-sticky-active {
9
+	left: 6px;
10
+}
11
+#woobewoo-breadcrumbs {
12
+	left: 0;
13
+}
14
+#wpfPopupMainControllsShell {
15
+	padding-right: 15px !important;
16
+}
17
+#woobewoo-breadcrumbs.woobewoo-sticky-active #wpfPopupMainControllsShell {
18
+	padding-right: 270px !important;
19
+}
20
+.woobewoo-tour-btns .woobewoo-tour-next-btn {
21
+	float: right;
22
+}
23
+.woobewoo-plugin .wpfCopyTextCode,
24
+#wpfPopupEditors textarea, 
25
+#wpfPopupEditors .CodeMirror {
26
+	direction: ltr;
27
+}
28
+.chosen-container-single.chosen-container-single-nosearch .chosen-search,
29
+.chosen-container .chosen-drop {
30
+	left: 9999px;
31
+}
32
+.woobewoo-plugin select {
33
+    background: #fff url(images/down.png) no-repeat left 5px top 55%;
34
+    padding-left: 24px !important;
35
+}
36
+#wpfFiltersEditForm .chosen-container-multi {
37
+	max-width: 100% !important;
38
+}
39
+.sub-block-values {
40
+	direction: ltr;
41
+}
42
+.sub-block-values input, .sub-block-values select, .sub-block-values .woobewoo-color-picker {
43
+	direction: rtl;
44
+}
45
+.woobewoo-plugin .wp-color-result {
46
+	border-left-style: none !important;
47
+	border-right: #d8dfe3 solid 1px !important;
48
+}
49
+.wpfRightLabel {
50
+    margin-right: 5px;
51
+    margin-left: 0;
52
+}
53
+.settings-value-label {
54
+	margin-left: 5px;
55
+}
56
+.wpfFilterWrapper i, .wpfFilterWrapper svg{
57
+    float: left !important;
58
+}
59
+

+ 38 - 0
app/wp-content/plugins/woo-product-filter/css/style.css

@@ -0,0 +1,38 @@
1
+.wpfErrorMsg {
2
+    color: #fa4e7f;
3
+}
4
+.wpfSuccessMsg {
5
+    color: #4ae8ea;
6
+}
7
+.wpfInputError {
8
+    border: 1px #fa4e7f solid !important;
9
+}
10
+.toeUpdateQtyButtonsWrapper {float:left; margin:4px 0 0 -22px;}
11
+
12
+.toeIncDecButton {
13
+    width: 8px;
14
+    height: 7px;
15
+    background: url("../img/toeIncDec.png") top right no-repeat;
16
+    text-decoration:none;
17
+    cursor: pointer;
18
+    text-indent: -9999px;
19
+}
20
+.toeIncButton {
21
+    margin-bottom:5px;
22
+    background-position: top left;
23
+}
24
+#toplevel_page_wpf-table-press li.wp-first-item{
25
+	display: none;
26
+}
27
+.wpfDialogSave {
28
+	padding: 4px 10px;
29
+}
30
+.wpfIconRotate360 {
31
+	-webkit-animation:spin 1s linear infinite;
32
+    -moz-animation:spin 1s linear infinite;
33
+    animation:spin 1s linear infinite;
34
+	margin-right: 5px;
35
+}
36
+@-moz-keyframes spin { 100% { -moz-transform: rotate(360deg); } }
37
+@-webkit-keyframes spin { 100% { -webkit-transform: rotate(360deg); } }
38
+@keyframes spin { 100% { -webkit-transform: rotate(360deg); transform:rotate(360deg); } }

+ 24 - 0
app/wp-content/plugins/woo-product-filter/css/woobewoo-for-all-admin.css

@@ -0,0 +1,24 @@
1
+/*remove duplicated WP menu item*/
2
+#toplevel_page_wpf-filters li.wp-first-item{
3
+	display: none;
4
+}
5
+/*Admin tour styles*/
6
+#woobewoo-admin-tour {
7
+	display: none;
8
+}
9
+.woobewoo-tour-btns .close {
10
+	float: left;
11
+	margin-left: 10px;
12
+}
13
+.wp-pointer.woobewoo-pointer {
14
+	z-index: 999999 !important;
15
+}
16
+.woobewoo-error {
17
+	color: #ff0000;
18
+}
19
+.error strong {
20
+    font-size: 15px;
21
+}
22
+.wpfHidden {
23
+	display: none;
24
+}

File diff suppressed because it is too large
+ 1151 - 0
app/wp-content/plugins/woo-product-filter/css/woobewoo-ui.css


BIN
app/wp-content/plugins/woo-product-filter/files/SxGeo.dat


+ 331 - 0
app/wp-content/plugins/woo-product-filter/functions.php

@@ -0,0 +1,331 @@
1
+<?php
2
+/**
3
+ * Set first leter in a string as UPPERCASE
4
+ *
5
+ * @param string $str string to modify
6
+ * @return string string with first Uppercase letter
7
+ */
8
+if (!function_exists('strFirstUpWpf')) {
9
+	function strFirstUpWpf( $str ) {
10
+		return strtoupper(substr($str, 0, 1)) . strtolower(substr($str, 1, strlen($str)));
11
+	}
12
+}
13
+/**
14
+ * Deprecated - class must be created
15
+ */
16
+if (!function_exists('dateToTimestampWpf')) {
17
+	function dateToTimestampWpf( $date ) {
18
+		if (empty($a)) {
19
+			return false;
20
+		}
21
+		$a = explode(WPF_DATE_DL, $date);
22
+		return mktime(0, 0, 0, $a[1], $a[0], $a[2]);
23
+	}
24
+}
25
+/**
26
+ * Generate random string name
27
+ *
28
+ * @param int $lenFrom min len
29
+ * @param int $lenTo max len
30
+ * @return string random string with length from $lenFrom to $lenTo
31
+ */
32
+if (!function_exists('getRandNameWpf')) {
33
+	function getRandNameWpf( $lenFrom = 6, $lenTo = 9 ) {
34
+		$res = '';
35
+		$len = mt_rand($lenFrom, $lenTo);
36
+		if ($len) {
37
+			for ($i = 0; $i < $len; $i++) {
38
+				$res .= chr(mt_rand(97, 122));	/*rand symbol from a to z*/
39
+			}
40
+		}
41
+		return $res;
42
+	}
43
+}
44
+if (!function_exists('importWpf')) {
45
+	function importWpf( $path ) {
46
+		if (file_exists($path)) {
47
+			require($path);
48
+			return true;
49
+		}
50
+		return false;
51
+	}
52
+}
53
+if (!function_exists('setDefaultParamsWpf')) {
54
+	function setDefaultParamsWpf( $params, $default ) {
55
+		foreach ($default as $k => $v) {
56
+			$params[$k] = isset($params[$k]) ? $params[$k] : $default[$k];
57
+		}
58
+		return $params;
59
+	}
60
+}
61
+if (!function_exists('importClassWpf')) {
62
+	function importClassWpf( $class, $path = '' ) {
63
+		if (!class_exists($class)) {
64
+			if (!$path) {
65
+				$classFile = lcfirst($class);
66
+				if (strpos(strtolower($classFile), WPF_CODE) !== false) {
67
+					$classFile = preg_replace('/' . WPF_CODE . '/i', '', $classFile);
68
+				}
69
+				$path = WPF_CLASSES_DIR . $classFile . '.php';
70
+			}
71
+			return importWpf($path);
72
+		}
73
+		return false;
74
+	}
75
+}
76
+/**
77
+ * Check if class name exist with prefix or not
78
+ *
79
+ * @param strin $class preferred class name
80
+ * @return string existing class name
81
+ */
82
+if (!function_exists('toeGetClassNameWpf')) {
83
+	function toeGetClassNameWpf( $class ) {
84
+		$className = '';
85
+		if (class_exists($class . strFirstUpWpf(WPF_CODE))) {
86
+			$className = $class . strFirstUpWpf(WPF_CODE);
87
+		} else if (class_exists(WPF_CLASS_PREFIX . $class)) {
88
+			$className = WPF_CLASS_PREFIX . $class;
89
+		} else {
90
+			$className = $class;
91
+		}
92
+		return $className;
93
+	}
94
+}
95
+/**
96
+ * Create object of specified class
97
+ *
98
+ * @param string $class class that you want to create
99
+ * @param array $params array of arguments for class __construct function
100
+ * @return object new object of specified class
101
+ */
102
+if (!function_exists('toeCreateObjWpf')) {
103
+	function toeCreateObjWpf( $class, $params ) {
104
+		$className = toeGetClassNameWpf($class);
105
+		$obj = null;
106
+		if (class_exists('ReflectionClass')) {
107
+			$reflection = new ReflectionClass($className);
108
+			try {
109
+				$obj = $reflection->newInstanceArgs($params);
110
+			} catch (ReflectionException $e) {	// If class have no constructor
111
+				$obj = $reflection->newInstanceArgs();
112
+			}
113
+		} else {
114
+			$obj = new $className();
115
+			call_user_func_array(array($obj, '__construct'), $params);
116
+		}
117
+		return $obj;
118
+	}
119
+}
120
+/**
121
+ * Redirect user to specified location. Be advised that it should redirect even if headers alredy sent.
122
+ *
123
+ * @param string $url where page must be redirected
124
+ */
125
+if (!function_exists('redirectWpf')) {
126
+	function redirectWpf( $url ) {
127
+		if (headers_sent()) {
128
+			echo '<script type="text/javascript"> document.location.href = "' . esc_url($url) . '"; </script>';
129
+		} else {
130
+			header('Location: ' . $url);
131
+		}
132
+		exit();
133
+	}
134
+}
135
+if (!function_exists('jsonEncodeUTFnormalWpf')) {
136
+	function jsonEncodeUTFnormalWpf( $value ) {
137
+		if (is_int($value)) {
138
+			return (string) $value;   
139
+		} elseif (is_string($value)) {
140
+			$value = str_replace(array('\\', '/', '"', "\r", "\n", "\b", "\f", "\t"), 
141
+								 array('\\\\', '\/', '\"', '\r', '\n', '\b', '\f', '\t'), $value);
142
+			$convmap = array(0x80, 0xFFFF, 0, 0xFFFF);
143
+			$result = '';
144
+			for ($i = strlen($value) - 1; $i >= 0; $i--) {
145
+				$mb_char = substr($value, $i, 1);
146
+				$result = $mb_char . $result;
147
+			}
148
+			return '"' . $result . '"';                
149
+		} elseif (is_float($value)) {
150
+			return str_replace(',', '.', $value);         
151
+		} elseif (is_null($value)) {
152
+			return 'null';
153
+		} elseif (is_bool($value)) {
154
+			return $value ? 'true' : 'false';
155
+		} elseif (is_array($value)) {
156
+			$with_keys = false;
157
+			$n = count($value);
158
+			for ($i = 0, reset($value); $i < $n; $i++, next($value)) {
159
+				if (key($value) !== $i) {
160
+					$with_keys = true;
161
+					break;
162
+				}
163
+			}
164
+		} elseif (is_object($value)) {
165
+			$with_keys = true;
166
+		} else {
167
+			return '';
168
+		}
169
+		$result = array();
170
+		if ($with_keys) {
171
+			foreach ($value as $key => $v) {
172
+				$result[] = jsonEncodeUTFnormalWpf((string) $key) . ':' . jsonEncodeUTFnormalWpf($v);    
173
+			}
174
+			return '{' . implode(',', $result) . '}';                
175
+		} else {
176
+			foreach ($value as $key => $v) {
177
+				$result[] = jsonEncodeUTFnormalWpf($v);    
178
+			}
179
+			return '[' . implode(',', $result) . ']';
180
+		}
181
+	} 
182
+}
183
+/**
184
+ * Prepares the params values to store into db
185
+ * 
186
+ * @param array $d $_POST array
187
+ * @return array
188
+ */
189
+if (!function_exists('prepareParamsWpf')) {
190
+	function prepareParamsWpf( &$d = array(), &$options = array() ) {
191
+		if (!empty($d['params'])) {
192
+			if (isset($d['params']['options'])) {
193
+				$options = $d['params']['options'];
194
+			}
195
+			if (is_array($d['params'])) {
196
+				$params = UtilsWpf::jsonEncode($d['params']);
197
+				$params = str_replace(array('\n\r', "\n\r", '\n', "\r", '\r', "\r"), '<br />', $params);
198
+				$params = str_replace(array('<br /><br />', '<br /><br /><br />'), '<br />', $params);
199
+				$d['params'] = $params;
200
+			}
201
+		} elseif (isset($d['params'])) {
202
+			$d['params']['attr']['class'] = '';
203
+			$d['params']['attr']['id'] = '';
204
+			$params = UtilsWpf::jsonEncode($d['params']);
205
+			$d['params'] = $params;
206
+		}
207
+		if (empty($options)) {
208
+			$options = array('value' => array('EMPTY'), 'data' => array());
209
+		}
210
+		if (isset($d['code'])) {
211
+			if ('' == $d['code']) {
212
+				$d['code'] = prepareFieldCodeWpf($d['label']) . '_' . rand(0, 9999999);
213
+			}
214
+		}
215
+		return $d;
216
+	}
217
+}
218
+if (!function_exists('prepareFieldCodeWpf')) {
219
+	function prepareFieldCodeWpf( $string ) {   
220
+		$string = preg_replace('/[^a-zA-Z0-9\s]/', ' ', $string);
221
+		$string = preg_replace('/\s+/', ' ', $string);
222
+		$string = preg_replace('/ /', '', $string);
223
+
224
+		$code = substr($string, 0, 8);
225
+		$code = strtolower($code);
226
+		if ('' == $code) {
227
+			$code = 'field_' . gmdate('dhis');
228
+		}
229
+		return $code;
230
+	}
231
+}
232
+/**
233
+ * Recursive implode of array
234
+ *
235
+ * @param string $glue imploder
236
+ * @param array $array array to implode
237
+ * @return string imploded array in string
238
+ */
239
+if (!function_exists('recImplodeWpf')) {
240
+	function recImplodeWpf( $glue, $array ) {
241
+		$res = '';
242
+		$i = 0;
243
+		$count = count($array);
244
+		foreach ($array as $el) {
245
+			$str = '';
246
+			if (is_array($el)) {
247
+				$str = recImplodeWpf('', $el);
248
+			} else {
249
+				$str = $el;
250
+			}
251
+			$res .= $str;
252
+			if ($i < ( $count-1 )) {
253
+				$res .= $glue;
254
+			}
255
+			$i++;
256
+		}
257
+		return $res;
258
+	}
259
+}
260
+/**
261
+ * Twig require this function, but it is present not on all servers
262
+ */
263
+if (!function_exists('hash')) {
264
+	function hash( $method, $data ) {
265
+		return md5($data);
266
+	}
267
+}
268
+if (!function_exists('ctype_alpha')) {
269
+	function ctype_alpha( $text ) {
270
+		return (bool) preg_match('/[^\pL]+/', $text);
271
+	}
272
+}
273
+
274
+if ( ! function_exists( 'trueRequestWpf' ) ) {
275
+	function trueRequestWpf() {
276
+		$request = true;
277
+		$uri     = ( isset( $_SERVER['REQUEST_URI'] ) && '' !== $_SERVER['REQUEST_URI'] ) ? esc_url_raw( $_SERVER['REQUEST_URI'] ) : '';
278
+
279
+		if ( '' === $uri ) {
280
+			$request = false;
281
+		} else {
282
+			preg_match( '/\.png$|\.jpg$|\.ico$/', $uri, $matches );
283
+			if ( ! empty( $matches ) ) {
284
+				$request = false;
285
+			}
286
+		}
287
+
288
+		return $request;
289
+	}
290
+}
291
+add_action('admin_notices', 'woofilterInstallBaseMsg');
292
+if (!function_exists('woofilterInstallBaseMsg')) {
293
+	function woofilterInstallBaseMsg() {
294
+		if ( class_exists('FrameWpf') ) {
295
+			if ( !FrameWpf::_()->proVersionCompare(WPF_PRO_REQUIRES, '>=') ) {
296
+				$plugName = 'WooCommerce Product Filter by WooBeWoo';
297
+				$plugWpUrl = 'https://wordpress.org/plugins/woo-product-filter/';
298
+				echo '<div class="notice error is-dismissible"><p><strong>
299
+					Please install latest PRO version of ' . esc_html($plugName) . ' plugin (requires at least ' . esc_html(WPF_PRO_REQUIRES) . ').
300
+					In this way you will have full and upgraded PRO version of ' . esc_html($plugName) . '.</strong></p></div>';
301
+			} else if (FrameWpf::_()->getModule('options')->getModel()->get('start_indexing') == 2) {
302
+				$plugName = 'WooCommerce Product Filter by WooBeWoo';
303
+				$plugWpUrl = 'https://wordpress.org/plugins/woo-product-filter/';
304
+				echo '<div class="notice error is-dismissible"><p><strong>
305
+					The plugin ' . esc_html($plugName) . ' started indexing the product database metadata.
306
+					If you have a large database, this may take a while, but in the future it will significantly increase your filtering speed.</strong></p></div>';
307
+			}
308
+		}
309
+	}
310
+}
311
+add_action( 'admin_init', 'woofilterProDeactivate' );
312
+if (!function_exists('woofilterProDeactivate')) {
313
+	function woofilterProDeactivate() {
314
+		if (class_exists('FrameWpf') && function_exists('getProPlugFullPathWpf')) {
315
+			$pathPro = getProPlugFullPathWpf();
316
+			$proPlugin = plugin_basename($pathPro);
317
+			if (is_plugin_active($proPlugin)) {
318
+				$pluginData = get_file_data( $pathPro, array( 'Version' => 'Version' ) );
319
+				$isProActive = FrameWpf::_()->moduleActive('access');
320
+				if ( !version_compare($pluginData['Version'], WPF_PRO_REQUIRES, '>=') ) { 
321
+					//deactivate_plugins($proPlugin);
322
+					if ($isProActive) {
323
+						call_user_func_array(array('ModInstallerWpf', 'deactivate'), array(array('license')));
324
+					}
325
+				} elseif (!$isProActive) {
326
+					call_user_func_array(array('ModInstallerWpf', 'activate'), array(true));
327
+				}
328
+			}
329
+		}
330
+	}
331
+}

BIN
app/wp-content/plugins/woo-product-filter/img/ajax-loader.gif


BIN
app/wp-content/plugins/woo-product-filter/img/buttonsPlusMinus.png


BIN
app/wp-content/plugins/woo-product-filter/img/down.png


BIN
app/wp-content/plugins/woo-product-filter/img/loading.gif


BIN
app/wp-content/plugins/woo-product-filter/img/no-img.jpg


BIN
app/wp-content/plugins/woo-product-filter/img/pointer-up.png


BIN
app/wp-content/plugins/woo-product-filter/img/tick.png


BIN
app/wp-content/plugins/woo-product-filter/img/up.png


+ 523 - 0
app/wp-content/plugins/woo-product-filter/js/admin.options.js

@@ -0,0 +1,523 @@
1
+"use strict";
2
+var wpfAdminFormChanged = [];
3
+window.onbeforeunload = function(){
4
+	// If there are at lease one unsaved form - show message for confirnation for page leave
5
+	if(wpfAdminFormChanged.length)
6
+		return 'Some changes were not-saved. Are you sure you want to leave?';
7
+};
8
+jQuery(document).ready(function(){
9
+	if(typeof(wpfActiveTab) != 'undefined' && wpfActiveTab != 'main_page' && jQuery('#toplevel_page_wpf-comparison-slider').hasClass('wp-has-current-submenu')) {
10
+		var subMenus = jQuery('#toplevel_page_wpf-comparison-slider').find('.wp-submenu li');
11
+		subMenus.removeClass('current').each(function(){
12
+			if(jQuery(this).find('a[href$="&tab='+ wpfActiveTab+ '"]').length) {
13
+				jQuery(this).addClass('current');
14
+			}
15
+		});
16
+	}
17
+	
18
+	// Timeout - is to count only user changes, because some changes can be done auto when form is loaded
19
+	setTimeout(function() {
20
+		// If some changes was made in those forms and they were not saved - show message for confirnation before page reload
21
+		var formsPreventLeave = [];
22
+		if(formsPreventLeave && formsPreventLeave.length) {
23
+			jQuery('#'+ formsPreventLeave.join(', #')).find('input,select').change(function(){
24
+				var formId = jQuery(this).parents('form:first').attr('id');
25
+				changeAdminFormWpf(formId);
26
+			});
27
+			jQuery('#'+ formsPreventLeave.join(', #')).find('input[type=text],textarea').keyup(function(){
28
+				var formId = jQuery(this).parents('form:first').attr('id');
29
+				changeAdminFormWpf(formId);
30
+			});
31
+			jQuery('#'+ formsPreventLeave.join(', #')).submit(function(){
32
+				adminFormSavedWpf( jQuery(this).attr('id') );
33
+			});
34
+		}
35
+	}, 1000);
36
+
37
+	if(jQuery('.wpfInputsWithDescrForm').length) {
38
+		jQuery('.wpfInputsWithDescrForm').find('input[type=checkbox][data-optkey]').change(function(){
39
+			var optKey = jQuery(this).data('optkey')
40
+			,	descShell = jQuery('#wpfFormOptDetails_'+ optKey);
41
+			if(descShell.length) {
42
+				if(jQuery(this).is(':checked')) {
43
+					descShell.slideDown( 300 );
44
+				} else {
45
+					descShell.slideUp( 300 );
46
+				}
47
+			}
48
+		}).trigger('change');
49
+	}
50
+	wpfInitStickyItem();
51
+	
52
+	jQuery('.wpfFieldsetToggled').each(function(){
53
+		var self = this;
54
+		jQuery(self).find('.wpfFieldsetContent').hide();
55
+		jQuery(self).find('.wpfFieldsetToggleBtn').click(function(){
56
+			var icon = jQuery(this).find('i')
57
+			,	show = icon.hasClass('fa-plus');
58
+			show ? icon.removeClass('fa-plus').addClass('fa-minus') : icon.removeClass('fa-minus').addClass('fa-plus');
59
+			jQuery(self).find('.wpfFieldsetContent').slideToggle( 300, function(){
60
+				if(show) {
61
+					jQuery(this).find('textarea').each(function(i, el){
62
+						if(typeof(this.CodeMirrorEditor) !== 'undefined') {
63
+							this.CodeMirrorEditor.refresh();
64
+						}
65
+					});
66
+				}
67
+			} );
68
+			return false;
69
+		});
70
+	});
71
+
72
+	// for checkboxHiddenVal type, see class HtmlWpf
73
+	jQuery('input[data-hiden-input=1]').change(function() {
74
+		var hidenInput = jQuery(this).next();
75
+
76
+		if (jQuery(this).prop("checked")) {
77
+			jQuery(hidenInput).val("1");
78
+		} else {
79
+			jQuery(hidenInput).val("0");
80
+		}
81
+	});
82
+
83
+	// Go to Top button init
84
+	if(jQuery('#wpfPopupGoToTopBtn').length) {
85
+		jQuery('#wpfPopupGoToTopBtn').click(function(){
86
+			jQuery('html, body').animate({
87
+				scrollTop: 0
88
+			}, 1000);
89
+			jQuery(this).parents('#wpfPopupGoToTop:first').hide();
90
+			return false;
91
+		});
92
+	}
93
+	wpfInitTooltips();
94
+	jQuery(document.body).on('changeTooltips', function (e) {
95
+		wpfInitTooltips(e.target);
96
+		jQuery(e.target).find('.tooltipstered').removeAttr('title');
97
+	});
98
+	if(jQuery('.wpfCopyTextCode').length) {
99
+		setTimeout(function(){	// Give it some time - wait until all other elements will be initialized
100
+			var cloneWidthElement =  jQuery('<span class="sup-shortcode" />').appendTo('.woobewoo-plugin');
101
+			jQuery('.wpfCopyTextCode').attr('readonly', 'readonly').click(function(){
102
+				this.setSelectionRange(0, this.value.length);
103
+			}).focus(function(){
104
+				this.setSelectionRange(0, this.value.length);
105
+			});
106
+			jQuery('input.wpfCopyTextCode').each(function(){
107
+				cloneWidthElement.html( str_replace(jQuery(this).val(), '<', 'P') );
108
+				var parentSelector = jQuery(this).data('parent-selector')
109
+				,	parentWidth = (parentSelector && parentSelector != '' 
110
+						? jQuery(this).parents(parentSelector+ ':first') 
111
+						: jQuery(this).parent()
112
+					).width()
113
+				,	txtWidth = cloneWidthElement.width();
114
+				if(parentWidth <= 0 || parentWidth > txtWidth) {
115
+					jQuery(this).width( cloneWidthElement.width() );
116
+				}
117
+			});
118
+			cloneWidthElement.remove();
119
+		}, 500);
120
+	}
121
+	// Check for showing review notice after a week usage
122
+	wpfInitPlugNotices();
123
+	jQuery('.woobewoo-plugin-loader').css('display', 'none');
124
+	jQuery('.woobewoo-main').css('display', 'block');
125
+	jQuery(".woobewoo-plugin .tooltipstered").removeAttr("title");
126
+});
127
+function wpfInitTooltips( selector ) {
128
+	var tooltipsterSettings = {
129
+		contentAsHTML: true
130
+	,	interactive: true
131
+	,	speed: 0
132
+	,	delay: 0
133
+	,	maxWidth: 450
134
+	}
135
+	,	findPos = {
136
+		'.woobewoo-tooltip': 'top-left'
137
+	,	'.woobewoo-tooltip-bottom': 'bottom-left'
138
+	,	'.woobewoo-tooltip-left': 'left'
139
+	,	'.woobewoo-tooltip-right': 'right'
140
+	}
141
+	,	$findIn = selector ? jQuery( selector ) : false;
142
+	for(var k in findPos) {
143
+		if(typeof(k) === 'string') {
144
+			var $tips = $findIn ? $findIn.find( k ) : jQuery( k ).not('.no-tooltip');
145
+			if($tips && $tips.length) {
146
+				tooltipsterSettings.position = findPos[ k ];
147
+				// Fallback for case if library was not loaded
148
+				if(!$tips.tooltipster) continue;
149
+				$tips.tooltipster( tooltipsterSettings );
150
+			}
151
+		}
152
+	}
153
+}
154
+function changeAdminFormWpf(formId) {
155
+	if(jQuery.inArray(formId, wpfAdminFormChanged) == -1)
156
+		wpfAdminFormChanged.push(formId);
157
+}
158
+function adminFormSavedWpf(formId) {
159
+	if(wpfAdminFormChanged.length) {
160
+		for(var i in wpfAdminFormChanged) {
161
+			if(wpfAdminFormChanged[i] == formId) {
162
+				wpfAdminFormChanged.pop(i);
163
+			}
164
+		}
165
+	}
166
+}
167
+function checkAdminFormSaved() {
168
+	if(wpfAdminFormChanged.length) {
169
+		if(!confirm(toeLangWpf('Some changes were not-saved. Are you sure you want to leave?'))) {
170
+			return false;
171
+		}
172
+		wpfAdminFormChanged = [];	// Clear unsaved forms array - if user wanted to do this
173
+	}
174
+	return true;
175
+}
176
+function isAdminFormChanged(formId) {
177
+	if(wpfAdminFormChanged.length) {
178
+		for(var i in wpfAdminFormChanged) {
179
+			if(wpfAdminFormChanged[i] == formId) {
180
+				return true;
181
+			}
182
+		}
183
+	}
184
+	return false;
185
+}
186
+/*Some items should be always on users screen*/
187
+function wpfInitStickyItem() {
188
+	jQuery(window).scroll(function(){
189
+		var stickiItemsSelectors = ['.woobewoo-sticky']
190
+		,	elementsUsePaddingNext = ['.woobewoo-bar']	// For example - if we stick row - then all other should not offest to top after we will place element as fixed
191
+		,	wpTollbarHeight = 32
192
+		,	wndScrollTop = jQuery(window).scrollTop() + wpTollbarHeight
193
+		,	footer = jQuery('.wpfAdminFooterShell')
194
+		,	footerHeight = footer && footer.length ? footer.height() : 0
195
+		,	docHeight = jQuery(document).height()
196
+		,	wasSticking = false
197
+		,	wasUnSticking = false;
198
+		/*if(jQuery('#wpbody-content .update-nag').length) {	// Not used for now
199
+			wpTollbarHeight += parseInt(jQuery('#wpbody-content .update-nag').outerHeight());
200
+		}*/
201
+		for(var i = 0; i < stickiItemsSelectors.length; i++) {
202
+			jQuery(stickiItemsSelectors[ i ]).each(function(){
203
+				var element = jQuery(this);
204
+				if(element && element.length && !element.hasClass('sticky-ignore')) {
205
+					var scrollMinPos = element.offset().top
206
+					,	prevScrollMinPos = parseInt(element.data('scrollMinPos'))
207
+					,	useNextElementPadding = toeInArray(stickiItemsSelectors[ i ], elementsUsePaddingNext) !== -1 || element.hasClass('sticky-padd-next')
208
+					,	currentScrollTop = wndScrollTop
209
+					,	calcPrevHeight = element.data('prev-height')
210
+					,	currentBorderHeight = wpTollbarHeight
211
+					,	usePrevHeight = 0;
212
+					if(calcPrevHeight) {
213
+						usePrevHeight = jQuery(calcPrevHeight).outerHeight();
214
+						currentBorderHeight += usePrevHeight;
215
+					}
216
+					if(currentScrollTop > scrollMinPos && !element.hasClass('woobewoo-sticky-active')) {	// Start sticking
217
+						if(element.hasClass('sticky-save-width')) {
218
+							element.width( element.width() );
219
+						}
220
+						element.addClass('woobewoo-sticky-active').data('scrollMinPos', scrollMinPos).css({
221
+							'top': currentBorderHeight
222
+						});
223
+						if(useNextElementPadding) {
224
+							var nextElement = element.next();
225
+							if(nextElement && nextElement.length) {
226
+								nextElement.data('prevPaddingTop', nextElement.css('padding-top'));
227
+								var addToNextPadding = parseInt(element.data('next-padding-add'));
228
+								addToNextPadding = addToNextPadding ? addToNextPadding : 0;
229
+								nextElement.css({
230
+									'padding-top': (element.hasClass('sticky-outer-height') ? element.outerHeight() : element.height()) + usePrevHeight + addToNextPadding
231
+								});
232
+							}
233
+						}
234
+						wasSticking = true;
235
+						element.trigger('startSticky');
236
+					} else if(!isNaN(prevScrollMinPos) && currentScrollTop <= prevScrollMinPos) {	// Stop sticking
237
+						element.removeClass('woobewoo-sticky-active').data('scrollMinPos', 0).css({
238
+							'top': 0
239
+						});
240
+						if(element.hasClass('sticky-save-width')) {
241
+							if(element.hasClass('sticky-base-width-auto')) {
242
+								element.css('width', 'auto');
243
+							}
244
+						}
245
+						if(useNextElementPadding) {
246
+							var nextElement = element.next();
247
+							if(nextElement && nextElement.length) {
248
+								var nextPrevPaddingTop = parseInt(nextElement.data('prevPaddingTop'));
249
+								if(isNaN(nextPrevPaddingTop))
250
+									nextPrevPaddingTop = 0;
251
+								nextElement.css({
252
+									'padding-top': nextPrevPaddingTop
253
+								});
254
+							}
255
+						}
256
+						element.trigger('stopSticky');
257
+						wasUnSticking = true;
258
+					} else {	// Check new stick position
259
+						if(element.hasClass('woobewoo-sticky-active')) {
260
+							if(footerHeight) {
261
+								var elementHeight = element.height()
262
+								,	heightCorrection = 32
263
+								,	topDiff = docHeight - footerHeight - (currentScrollTop + elementHeight + heightCorrection);
264
+								if(topDiff < 0) {
265
+									element.css({
266
+										'top': currentBorderHeight + topDiff
267
+									});
268
+								} else {
269
+									element.css({
270
+										'top': currentBorderHeight
271
+									});
272
+								}
273
+							}
274
+							// If at least on element is still sticking - count it as all is working
275
+							wasSticking = wasUnSticking = false;
276
+						}
277
+					}
278
+				}
279
+			});
280
+		}
281
+		if(wasSticking) {
282
+			if(jQuery('#wpfPopupGoToTop').length)
283
+				jQuery('#wpfPopupGoToTop').show();
284
+		} else if(wasUnSticking) {
285
+			if(jQuery('#wpfPopupGoToTop').length)
286
+				jQuery('#wpfPopupGoToTop').hide();
287
+		}
288
+	});
289
+}
290
+function wpfInitCustomCheckRadio(selector) {
291
+	if(!jQuery.fn.iCheck) return;
292
+	if(!selector)
293
+		selector = document;
294
+	jQuery(selector).find('input').iCheck('destroy').iCheck({
295
+		checkboxClass: 'icheckbox_minimal'
296
+	,	radioClass: 'iradio_minimal'
297
+	}).on('ifChanged', function(e){
298
+		// for checkboxHiddenVal type, see class HtmlWpf
299
+		jQuery(this).trigger('change');
300
+		if(jQuery(this).hasClass('cbox')) {
301
+			var parentRow = jQuery(this).parents('.jqgrow:first');
302
+			if(parentRow && parentRow.length) {
303
+				jQuery(this).parents('td:first').trigger('click');
304
+			} else {
305
+				var checkId = jQuery(this).attr('id');
306
+				if(checkId && checkId != '' && strpos(checkId, 'cb_') === 0) {
307
+					var parentTblId = str_replace(checkId, 'cb_', '');
308
+					if(parentTblId && parentTblId != '' && jQuery('#'+ parentTblId).length) {
309
+						jQuery('#'+ parentTblId).find('input[type=checkbox]').iCheck('update');
310
+					}
311
+				}
312
+			}
313
+		}
314
+	}).on('ifClicked', function(e){
315
+		jQuery(this).trigger('click');
316
+	});
317
+}
318
+function wpfCheckDestroy(checkbox) {
319
+	if(!jQuery.fn.iCheck) return;
320
+	jQuery(checkbox).iCheck('destroy');
321
+}
322
+function wpfCheckDestroyArea(selector) {
323
+	if(!jQuery.fn.iCheck) return;
324
+	jQuery(selector).find('input[type=checkbox]').iCheck('destroy');
325
+}
326
+function wpfCheckUpdate(checkbox) {
327
+	if(!jQuery.fn.iCheck) return;
328
+	jQuery(checkbox).iCheck('update');
329
+}
330
+function wpfCheckUpdateArea(selector) {
331
+	if(!jQuery.fn.iCheck) return;
332
+	jQuery(selector).find('input[type=checkbox]').iCheck('update');
333
+}
334
+function wpfGetTxtEditorVal(id) {
335
+	if(typeof(tinyMCE) !== 'undefined' 
336
+		&& tinyMCE.get( id ) 
337
+		&& !jQuery('#'+ id).is(':visible') 
338
+		&& tinyMCE.get( id ).getDoc 
339
+		&& typeof(tinyMCE.get( id ).getDoc) == 'function' 
340
+		&& tinyMCE.get( id ).getDoc()
341
+	)
342
+		return tinyMCE.get( id ).getContent();
343
+	else
344
+		return jQuery('#'+ id).val();
345
+}
346
+function wpfSetTxtEditorVal(id, content) {
347
+	if(typeof(tinyMCE) !== 'undefined' 
348
+		&& tinyMCE 
349
+		&& tinyMCE.get( id ) 
350
+		&& !jQuery('#'+ id).is(':visible')
351
+		&& tinyMCE.get( id ).getDoc 
352
+		&& typeof(tinyMCE.get( id ).getDoc) == 'function' 
353
+		&& tinyMCE.get( id ).getDoc()
354
+	)
355
+		tinyMCE.get( id ).setContent(content);
356
+	else
357
+		jQuery('#'+ id).val( content );
358
+}
359
+/**
360
+ * Add data to jqGrid object post params search
361
+ * @param {object} param Search params to set
362
+ * @param {string} gridSelectorId ID of grid table html element
363
+ */
364
+function wpfGridSetListSearch(param, gridSelectorId) {
365
+	jQuery('#'+ gridSelectorId).setGridParam({
366
+		postData: {
367
+			search: param
368
+		}
369
+	});
370
+}
371
+/**
372
+ * Set data to jqGrid object post params search and trigger search
373
+ * @param {object} param Search params to set
374
+ * @param {string} gridSelectorId ID of grid table html element
375
+ */
376
+function wpfGridDoListSearch(param, gridSelectorId) {
377
+	wpfGridSetListSearch(param, gridSelectorId);
378
+	jQuery('#'+ gridSelectorId).trigger( 'reloadGrid' );
379
+}
380
+/**
381
+ * Get row data from jqGrid
382
+ * @param {number} id Item ID (from database for example)
383
+ * @param {string} gridSelectorId ID of grid table html element
384
+ * @return {object} Row data
385
+ */
386
+function wpfGetGridDataById(id, gridSelectorId) {
387
+	var rowId = getGridRowId(id, gridSelectorId);
388
+	if(rowId) {
389
+		return jQuery('#'+ gridSelectorId).jqGrid ('getRowData', rowId);
390
+	}
391
+	return false;
392
+}
393
+/**
394
+ * Get cell data from jqGrid
395
+ * @param {number} id Item ID (from database for example)
396
+ * @param {string} column Column name
397
+ * @param {string} gridSelectorId ID of grid table html element
398
+ * @return {string} Cell data
399
+ */
400
+function wpfGetGridColDataById(id, column, gridSelectorId) {
401
+	var rowId = getGridRowId(id, gridSelectorId);
402
+	if(rowId) {
403
+		return jQuery('#'+ gridSelectorId).jqGrid ('getCell', rowId, column);
404
+	}
405
+	return false;
406
+}
407
+/**
408
+ * Get grid row ID (ID of table row) from item ID (from database ID for example)
409
+ * @param {number} id Item ID (from database for example)
410
+ * @param {string} gridSelectorId ID of grid table html element
411
+ * @return {number} Table row ID
412
+ */
413
+function getGridRowId(id, gridSelectorId) {
414
+	var rowId = parseInt(jQuery('#'+ gridSelectorId).find('[aria-describedby='+ gridSelectorId+ '_id][title='+ id+ ']').parent('tr:first').index());
415
+	if(!rowId) {
416
+		console.log('CAN NOT FIND ITEM WITH ID  '+ id);
417
+		return false;
418
+	}
419
+	return rowId;
420
+}
421
+function prepareToPlotDate(data) {
422
+	if(typeof(data) === 'string') {
423
+		if(data) {
424
+			data = str_replace(data, '/', '-');
425
+			return (new Date(data)).getTime();
426
+		}
427
+	}
428
+	return data;
429
+}
430
+function wpfInitPlugNotices() {
431
+	var $notices = jQuery('.woobewoo-admin-notice');
432
+	if($notices && $notices.length) {
433
+		$notices.each(function(){
434
+			jQuery(this).find('.notice-dismiss').click(function(){
435
+				var $notice = jQuery(this).parents('.woobewoo-admin-notice');
436
+				if(!$notice.data('stats-sent')) {
437
+					// User closed this message - that is his choise, let's respect this and save it's saved status
438
+					jQuery.sendFormWpf({
439
+						data: {mod: 'promo', action: 'addNoticeAction', code: $notice.data('code'), choice: 'hide'}
440
+					});
441
+				}
442
+			});
443
+			jQuery(this).find('[data-statistic-code]').click(function(){
444
+				var href = jQuery(this).attr('href')
445
+				,	$notice = jQuery(this).parents('.woobewoo-admin-notice');
446
+				jQuery.sendFormWpf({
447
+					data: {mod: 'promo', action: 'addNoticeAction', code: $notice.data('code'), choice: jQuery(this).data('statistic-code')}
448
+				});
449
+				$notice.data('stats-sent', 1).find('.notice-dismiss').trigger('click');
450
+				if(!href || href === '' || href === '#')
451
+					return false;
452
+			});
453
+			var $enbStatsBtn = jQuery(this).find('.wpfEnbStatsAdBtn');
454
+			if($enbStatsBtn && $enbStatsBtn.length) {
455
+				$enbStatsBtn.click(function(){
456
+					jQuery.sendFormWpf({
457
+						data: {mod: 'promo', action: 'enbStatsOpt'}
458
+					});
459
+					return false;
460
+				});
461
+			}
462
+		});
463
+	}
464
+}
465
+/**
466
+ * Main promo popup will show each time user will try to modify PRO option with free version only
467
+ */
468
+function wpfGetMainPromoPopup() {
469
+	if(jQuery('#wpfOptInProWnd').hasClass('ui-dialog-content')) {
470
+		return jQuery('#wpfOptInProWnd');
471
+	}
472
+	return jQuery('#wpfOptInProWnd').dialog({
473
+		modal:    true
474
+	,	autoOpen: false
475
+	,	width: 540
476
+	,	height: 200
477
+	,	open: function() {
478
+			jQuery('#wpfOptWndTemplateTxt').hide();
479
+			jQuery('#wpfOptWndOptionTxt').show();
480
+		}
481
+	});
482
+}
483
+function wpfInitMainPromoPopup() {
484
+	if(!WPF_DATA.isPro) {
485
+		var $proOptWnd = wpfGetMainPromoPopup();
486
+		jQuery('.wpfProOpt').change(function(e){
487
+			e.stopPropagation();
488
+			var needShow = true
489
+			,	isRadio = jQuery(this).attr('type') == 'radio'
490
+			,	isCheck = jQuery(this).attr('type') == 'checkbox';
491
+			if(isRadio && !jQuery(this).attr('checked')) {
492
+				needShow = false;
493
+			}
494
+			if(!needShow) {
495
+				return;
496
+			}
497
+			if(isRadio) {
498
+				jQuery('input[name="'+ jQuery(this).attr('name')+ '"]:first').parents('label:first').click();
499
+				if(jQuery(this).parents('.iradio_minimal:first').length) {
500
+					var self = this;
501
+					setTimeout(function(){
502
+						jQuery(self).parents('.iradio_minimal:first').removeClass('checked');
503
+					}, 10);
504
+				}
505
+			}
506
+			var parent = null;
507
+			if(jQuery(this).parents('#wpfPopupMainOpts').length) {
508
+				parent = jQuery(this).parents('label:first');
509
+			} else if(jQuery(this).parents('.wpfPopupOptRow:first').length) {
510
+				parent = jQuery(this).parents('.wpfPopupOptRow:first');
511
+			} else {
512
+				parent = jQuery(this).parents('tr:first');
513
+			}
514
+			if(!parent.length) return;
515
+			var promoLink = parent.find('.wpfProOptMiniLabel a').attr('href');
516
+			if(promoLink && promoLink != '') {
517
+				jQuery('#wpfOptInProWnd a').attr('href', promoLink);
518
+			}
519
+			$proOptWnd.dialog('open');
520
+			return false;
521
+		});
522
+	}
523
+}

File diff suppressed because it is too large
+ 11 - 0
app/wp-content/plugins/woo-product-filter/js/admin.wp.colorpicker.alpha.js


File diff suppressed because it is too large
+ 679 - 0
app/wp-content/plugins/woo-product-filter/js/common.js


+ 426 - 0
app/wp-content/plugins/woo-product-filter/js/core.js

@@ -0,0 +1,426 @@
1
+"use strict";
2
+if(typeof(WPF_DATA) == 'undefined')
3
+	var WPF_DATA = {};
4
+if(isNumber(WPF_DATA.animationSpeed)) 
5
+    WPF_DATA.animationSpeed = parseInt(WPF_DATA.animationSpeed);
6
+else if(jQuery.inArray(WPF_DATA.animationSpeed, ['fast', 'slow']) == -1)
7
+    WPF_DATA.animationSpeed = 'fast';
8
+WPF_DATA.showSubscreenOnCenter = parseInt(WPF_DATA.showSubscreenOnCenter);
9
+var sdLoaderImgWpf = '<img src="'+ WPF_DATA.loader+ '" />';
10
+var g_wpfAnimationSpeed = 300;
11
+
12
+jQuery.fn.showLoaderWpf = function() {
13
+    return jQuery(this).html( sdLoaderImgWpf );
14
+};
15
+jQuery.fn.appendLoaderWpf = function() {
16
+    jQuery(this).append( sdLoaderImgWpf );
17
+};
18
+jQuery.sendFormWpf = function(params) {
19
+	// Any html element can be used here
20
+	return jQuery('<br />').sendFormWpf(params);
21
+};
22
+/**
23
+ * Send form or just data to server by ajax and route response
24
+ * @param string params.fid form element ID, if empty - current element will be used
25
+ * @param string params.msgElID element ID to store result messages, if empty - element with ID "msg" will be used. Can be "noMessages" to not use this feature
26
+ * @param function params.onSuccess funstion to do after success receive response. Be advised - "success" means that ajax response will be success
27
+ * @param array params.data data to send if You don't want to send Your form data, will be set instead of all form data
28
+ * @param array params.appendData data to append to sending request. In contrast to params.data will not erase form data
29
+ * @param string params.inputsWraper element ID for inputs wraper, will be used if it is not a form
30
+ * @param string params.clearMsg clear msg element after receive data, if is number - will use it to set time for clearing, else - if true - will clear msg element after 5 seconds
31
+ */
32
+jQuery.fn.sendFormWpf = function(params) {
33
+    var form = null;
34
+    if(!params)
35
+        params = {fid: false, msgElID: false, onSuccess: false};
36
+    if(params.fid)
37
+        form = jQuery('#'+ fid);
38
+    else
39
+        form = jQuery(this);
40
+    
41
+    /* This method can be used not only from form data sending, it can be used just to send some data and fill in response msg or errors*/
42
+    var sentFromForm = (jQuery(form).tagName() == 'FORM');
43
+    var data = new Array();
44
+    if(params.data)
45
+        data = params.data;
46
+    else if(sentFromForm)
47
+        data = jQuery(form).serialize();
48
+
49
+    if(params.appendData) {
50
+		var dataIsString = typeof(data) == 'string';
51
+		var addStrData = [];
52
+        for(var i in params.appendData) {
53
+			if(dataIsString) {
54
+				addStrData.push(i+ '='+ params.appendData[i]);
55
+			} else
56
+            data[i] = params.appendData[i];
57
+        }
58
+		if(dataIsString)
59
+			data += '&'+ addStrData.join('&');
60
+    }
61
+    var msgEl = null;
62
+    if(params.msgElID) {
63
+        if(params.msgElID == 'noMessages')
64
+            msgEl = false;
65
+        else if(typeof(params.msgElID) == 'object')
66
+           msgEl = params.msgElID;
67
+       else
68
+            msgEl = jQuery('#'+ params.msgElID);
69
+    }
70
+	if(typeof(params.inputsWraper) == 'string') {
71
+		form = jQuery('#'+ params.inputsWraper);
72
+		sentFromForm = true;
73
+	}
74
+	if(sentFromForm && form) {
75
+        jQuery(form).find('.wpfInputError').removeClass('wpfInputError');
76
+    }
77
+	if(msgEl && !params.btn) {
78
+		jQuery(msgEl)
79
+			.removeClass('wpfSuccessMsg')
80
+			.removeClass('wpfErrorMsg');
81
+		if(!params.btn) {
82
+			jQuery(msgEl).showLoaderWpf();
83
+		}
84
+	} 
85
+	if(params.btn) {
86
+		jQuery(params.btn).attr('disabled', 'disabled');
87
+		// Font awesome usage
88
+		params.btnIconElement = jQuery(params.btn).find('.fa').length ? jQuery(params.btn).find('.fa') : jQuery(params.btn);
89
+		if(jQuery(params.btn).find('.fa').length) {
90
+			params.btnIconElement
91
+				.data('prev-class', params.btnIconElement.attr('class'))
92
+				.attr('class', 'fa fa-spinner fa-spin');
93
+		}
94
+	}
95
+    var url = '';
96
+	if(typeof(params.url) != 'undefined')
97
+		url = params.url;
98
+    else if(typeof(ajaxurl) == 'undefined' || typeof(ajaxurl) !== 'string')
99
+        url = WPF_DATA.ajaxurl;
100
+    else
101
+        url = ajaxurl;
102
+    
103
+    jQuery('.wpfErrorForField').hide(WPF_DATA.animationSpeed);
104
+	var dataType = params.dataType ? params.dataType : 'json';
105
+	// Set plugin orientation
106
+	if(typeof(data) == 'string') {
107
+		data += '&pl='+ WPF_DATA.WPF_CODE;
108
+		data += '&reqType=ajax';
109
+	} else {
110
+		data['pl'] = WPF_DATA.WPF_CODE;
111
+		data['reqType'] = 'ajax';
112
+	}
113
+
114
+    jQuery.ajax({
115
+        url: url,
116
+        data: data,
117
+        type: 'POST',
118
+        dataType: dataType,
119
+        success: function(res) {
120
+            toeProcessAjaxResponseWpf(res, msgEl, form, sentFromForm, params);
121
+			if(params.clearMsg) {
122
+				setTimeout(function(){
123
+					if(msgEl)
124
+						jQuery(msgEl).animateClear();
125
+				}, typeof(params.clearMsg) == 'boolean' ? 5000 : params.clearMsg);
126
+			}
127
+        }
128
+    });
129
+};
130
+/**
131
+ * Hide content in element and then clear it
132
+ */
133
+jQuery.fn.animateClear = function() {
134
+	var newContent = jQuery('<span>'+ jQuery(this).html()+ '</span>');
135
+	jQuery(this).html( newContent );
136
+	jQuery(newContent).hide(WPF_DATA.animationSpeed, function(){
137
+		jQuery(newContent).remove();
138
+	});
139
+};
140
+/**
141
+ * Hide content in element and then remove it
142
+ */
143
+jQuery.fn.animateRemoveWpf = function(animationSpeed, onSuccess) {
144
+	animationSpeed = animationSpeed == undefined ? WPF_DATA.animationSpeed : animationSpeed;
145
+	jQuery(this).hide(animationSpeed, function(){
146
+		jQuery(this).remove();
147
+		if(typeof(onSuccess) === 'function')
148
+			onSuccess();
149
+	});
150
+};
151
+function toeProcessAjaxResponseWpf(res, msgEl, form, sentFromForm, params) {
152
+    if(typeof(params) == 'undefined')
153
+        params = {};
154
+    if(typeof(msgEl) == 'string')
155
+        msgEl = jQuery('#'+ msgEl);
156
+    if(msgEl)
157
+        jQuery(msgEl).html('');
158
+	if(params.btn) {
159
+		jQuery(params.btn).removeAttr('disabled');
160
+		if(params.btnIconElement) {
161
+			params.btnIconElement.attr('class', params.btnIconElement.data('prev-class'));
162
+		}
163
+	}
164
+    /*if(sentFromForm) {
165
+        jQuery(form).find('*').removeClass('wpfInputError');
166
+    }*/
167
+    if(typeof(res) == 'object') {
168
+        if(res.error) {
169
+            if(msgEl) {
170
+                jQuery(msgEl)
171
+					.removeClass('wpfSuccessMsg')
172
+					.addClass('wpfErrorMsg');
173
+            }
174
+			var errorsArr = [];
175
+            for(var name in res.errors) {
176
+                if(sentFromForm) {
177
+					var inputError = jQuery(form).find('[name*="'+ name+ '"]');
178
+                    inputError.addClass('wpfInputError');
179
+					if(!inputError.data('keyup-error-remove-binded')) {
180
+						inputError.keydown(function(){
181
+							jQuery(this).removeClass('wpfInputError');
182
+						}).data('keyup-error-remove-binded', 1);
183
+					}
184
+                }
185
+                if(jQuery('.wpfErrorForField.toe_'+ nameToClassId(name)+ '').exists())
186
+                    jQuery('.wpfErrorForField.toe_'+ nameToClassId(name)+ '').show().html(res.errors[name]);
187
+                else if(msgEl)
188
+                    jQuery(msgEl).append(res.errors[name]).append('<br />');
189
+				else
190
+					errorsArr.push( res.errors[name] );
191
+            }
192
+			if(errorsArr.length && params.btn && jQuery.fn.dialog && !msgEl) {
193
+				jQuery('<div title="'+ toeLangWpf("Really small warning :)")+ '" />').html( errorsArr.join('<br />') ).appendTo('body').dialog({
194
+					modal: true
195
+				,	width: '500px'
196
+				});
197
+			}
198
+        } else if(res.messages.length) {
199
+            if(msgEl) {
200
+                jQuery(msgEl)
201
+					.removeClass('wpfErrorMsg')
202
+					.addClass('wpfSuccessMsg');
203
+                for(var i = 0; i < res.messages.length; i++) {
204
+                    jQuery(msgEl).append(res.messages[i]).append('<br />');
205
+                }
206
+            }
207
+        }
208
+    }
209
+    if(params.onSuccess && typeof(params.onSuccess) == 'function') {
210
+        params.onSuccess(res);
211
+    }
212
+}
213
+
214
+function getDialogElementWpf() {
215
+	return jQuery('<div/>').appendTo(jQuery('body'));
216
+}
217
+
218
+function toeOptionWpf(key) {
219
+	if(WPF_DATA.options && WPF_DATA.options[ key ])
220
+		return WPF_DATA.options[ key ];
221
+	return false;
222
+}
223
+function toeLangWpf(key) {
224
+	if(WPF_DATA.siteLang && WPF_DATA.siteLang[key])
225
+		return WPF_DATA.siteLang[key];
226
+	return key;
227
+}
228
+function toePagesWpf(key) {
229
+	if(typeof(WPF_DATA) != 'undefined' && WPF_DATA[key])
230
+		return WPF_DATA[key];
231
+	return false;;
232
+}
233
+/**
234
+ * This function will help us not to hide desc right now, but wait - maybe user will want to select some text or click on some link in it.
235
+ */
236
+function toeOptTimeoutHideDescriptionWpf() {
237
+	jQuery('#wpfOptDescription').removeAttr('toeFixTip');
238
+	setTimeout(function(){
239
+		if(!jQuery('#wpfOptDescription').attr('toeFixTip'))
240
+			toeOptHideDescriptionWpf();
241
+	}, 500);
242
+}
243
+/**
244
+ * Show description for options
245
+ */
246
+function toeOptShowDescriptionWpf(description, x, y, moveToLeft) {
247
+    if(typeof(description) != 'undefined' && description != '') {
248
+        if(!jQuery('#wpfOptDescription').length) {
249
+            jQuery('body').append('<div id="wpfOptDescription"></div>');
250
+        }
251
+		if(moveToLeft)
252
+			jQuery('#wpfOptDescription').css('right', jQuery(window).width() - (x - 10));	// Show it on left side of target
253
+		else
254
+			jQuery('#wpfOptDescription').css('left', x + 10);
255
+        jQuery('#wpfOptDescription').css('top', y);
256
+        jQuery('#wpfOptDescription').show(200);
257
+        jQuery('#wpfOptDescription').html(description);
258
+    }
259
+}
260
+/**
261
+ * Hide description for options
262
+ */
263
+function toeOptHideDescriptionWpf() {
264
+	jQuery('#wpfOptDescription').removeAttr('toeFixTip');
265
+    jQuery('#wpfOptDescription').hide(200);
266
+}
267
+function toeInArrayWpf(needle, haystack) {
268
+	if(haystack) {
269
+		for(var i in haystack) {
270
+			if(haystack[i] == needle)
271
+				return true;
272
+		}
273
+	}
274
+	return false;
275
+}
276
+function toeShowDialogCustomized(element, options) {
277
+	options = jQuery.extend({
278
+		resizable: false
279
+	,	width: 500
280
+	,	height: 300
281
+	,	closeOnEscape: true
282
+	,	open: function(event, ui) {
283
+			jQuery('.ui-dialog-titlebar').css({
284
+				'background-color': '#222222'
285
+			,	'background-image': 'none'
286
+			,	'border': 'none'
287
+			,	'margin': '0'
288
+			,	'padding': '0'
289
+			,	'border-radius': '0'
290
+			,	'color': '#CFCFCF'
291
+			,	'height': '27px'
292
+			});
293
+			jQuery('.ui-dialog-titlebar-close').css({
294
+				'background': 'url("'+ WPF_DATA.cssPath+ 'img/tb-close.png") no-repeat scroll 0 0 transparent'
295
+			,	'border': '0'
296
+			,	'width': '15px'
297
+			,	'height': '15px'
298
+			,	'padding': '0'
299
+			,	'border-radius': '0'
300
+			,	'margin': '7px 7px 0'
301
+			}).html('');
302
+			jQuery('.ui-dialog').css({
303
+				'border-radius': '3px'
304
+			,	'background-color': '#FFFFFF'
305
+			,	'background-image': 'none'
306
+			,	'padding': '1px'
307
+			,	'z-index': '300000'
308
+			,	'position': 'fixed'
309
+			,	'top': '60px'
310
+			});
311
+			jQuery('.ui-dialog-buttonpane').css({
312
+				'background-color': '#FFFFFF'
313
+			});
314
+			jQuery('.ui-dialog-title').css({
315
+				'color': '#CFCFCF'
316
+			,	'font': '12px sans-serif'
317
+			,	'padding': '6px 10px 0'
318
+			});
319
+			if(options.openCallback && typeof(options.openCallback) == 'function') {
320
+				options.openCallback(event, ui);
321
+			}
322
+			jQuery('.ui-widget-overlay').css({
323
+				'z-index': jQuery( event.target ).parents('.ui-dialog:first').css('z-index') - 1
324
+			,	'background-image': 'none'
325
+			});
326
+			if(options.modal && options.closeOnBg) {
327
+				jQuery('.ui-widget-overlay').unbind('click').bind('click', function() {
328
+					jQuery( element ).dialog('close');
329
+				});
330
+			}
331
+		}
332
+	}, options);
333
+	return jQuery(element).dialog(options);
334
+}
335
+/**
336
+ * @see html::slider();
337
+ **/
338
+function toeSliderMove(event, ui) {
339
+    var id = jQuery(event.target).attr('id');
340
+    jQuery('#toeSliderDisplay_'+ id).html( ui.value );
341
+    jQuery('#toeSliderInput_'+ id).val( ui.value ).change();
342
+}
343
+function wpfCorrectJqueryUsed() {
344
+	return (typeof(jQuery.fn.sendFormWpf) === 'function');
345
+}
346
+function wpfReloadCoreJs(clb, params) {
347
+	var scriptsHtml = ''
348
+	,	coreScripts = ['common.js', 'core.js'];
349
+	for(var i = 0; i < coreScripts.length; i++) {
350
+		scriptsHtml += '<script type="text/javascript" class="wpfReloadedScript" src="'+ WPF_DATA.jsPath+ coreScripts[ i ]+ '"></script>';
351
+	}
352
+	jQuery('head').append( scriptsHtml );
353
+	if(clb) {
354
+		_wpfRunClbAfterCoreReload( clb, params );
355
+	}
356
+}
357
+function _wpfRunClbAfterCoreReload(clb, params) {
358
+	if(wpfCorrectJqueryUsed()) {
359
+		callUserFuncArray(clb, params);
360
+		return;
361
+	}
362
+	setTimeout(function(){
363
+		wpfCorrectJqueryUsed(clb, params);
364
+	}, 500);
365
+}
366
+function wpfGetStyleSheetRule(sheetId, rule, isLike) {
367
+	var obj = document.getElementById(sheetId),
368
+		sheet = obj.sheet || obj.styleSheet,
369
+		rules = sheet.cssRules || sheet.rules,
370
+		isLike = typeof isLike == 'undefined' ? false : isLike;
371
+	for (var r = 0; r < rules.length; r++) {
372
+		if(isLike) {
373
+			if(rules[r].selectorText.indexOf(rule) === 0) return rules[r];
374
+		} else if(rules[r].selectorText == rule) return rules[r];
375
+	}
376
+	return false;
377
+}
378
+function wpfGetColorText(bg) {
379
+	if(typeof bg !== 'undefined' && bg.length >= 7) {
380
+		var rgb = (/^#[0-9A-F]{6}$/i.test(bg))
381
+			? [0, parseInt(bg.substring(1,3),16), parseInt(bg.substring(3,5),16), parseInt(bg.substring(5,7),16)]
382
+			: bg.replace(/\s/g,'').match(/^rgba?\((\d+),(\d+),(\d+)/i);
383
+		if(rgb.length >= 4 && (1 - (0.299 * rgb[1] + 0.587 * rgb[2] + 0.114 * rgb[3]) / 255) > 0.5) return '#dddddd';
384
+	}
385
+	return '#444444';
386
+}
387
+function wpfLightenDarkenColor(col, amt) {
388
+	var usePound = false,
389
+		r = 255,
390
+		g = 255,
391
+		b = 255;
392
+	if(typeof col !== 'undefined' && col.length >= 7) {
393
+		if(col.indexOf('rgb') == -1) {
394
+			if(col[0] == "#") {
395
+				col = col.slice(1);
396
+				usePound = true;
397
+			}
398
+ 			var num = parseInt(col, 16);
399
+			r = (num >> 16);
400
+			b = ((num >> 8) & 0x00FF);
401
+			g = (num & 0x0000FF);
402
+		} else {
403
+			var withA = col.indexOf('rgba') != -1,
404
+				rgb = withA ? col.replace(/\s/g,'').match(/^rgba?\((\d+),(\d+),(\d+),(\d+)/i) : col.replace(/\s/g,'').match(/^rgba?\((\d+),(\d+),(\d+)/i);
405
+			if(rgb.length >= 4) {
406
+				var a = withA ? rgb[3] : 1,
407
+					bg = (1 - a) * 255;
408
+				r = rgb[1] * a + bg;
409
+				g = rgb[2] * a + bg;
410
+				b = rgb[3] * a + bg;
411
+			}
412
+			usePound = true;
413
+		}
414
+	}
415
+	r = r + amt;
416
+	b = b + amt;
417
+	g = g + amt;
418
+	if(r > 255) r = 255;
419
+	else if(r < 0) r = 0;
420
+	if(b > 255) b = 255;
421
+	else if(b < 0) b = 0;
422
+	if(g > 255) g = 255;
423
+	else if(g < 0) g = 0;
424
+	var res = (g | (b << 8) | (r << 16)).toString(16);
425
+	return (usePound?"#":"") + '0'.repeat(6 - res.length) + res;
426
+}

File diff suppressed because it is too large
+ 11 - 0
app/wp-content/plugins/woo-product-filter/js/icheck.min.js


+ 58 - 0
app/wp-content/plugins/woo-product-filter/js/notify.js

@@ -0,0 +1,58 @@
1
+(function($) {
2
+"use strict";
3
+	$.sNotify = function(options) {
4
+		if (!this.length) {
5
+			return this;
6
+		}
7
+
8
+		var $wrapper = $('<div class="s-notify">').css({
9
+			position: 'fixed',
10
+			display: 'none',
11
+			right: '1.7em',
12
+			top: '3.3em',
13
+			padding: '1em',
14
+			'background-color': 'white',
15
+			'box-shadow': '0px 0px 6px 0px rgba(0,0,0,0.1)'
16
+		});
17
+
18
+		$wrapper.wrapInner(this);
19
+		$wrapper.appendTo('body');
20
+
21
+		if (options.icon) {
22
+			$('<i/>').addClass(options.icon).appendTo($wrapper);
23
+		}
24
+
25
+		if (options.content) {
26
+			$('<div class="notify-content"></div>').css('display', 'inline-block').wrapInner(options.content).appendTo($wrapper);
27
+		}
28
+
29
+		setTimeout(function() {
30
+			$wrapper.fadeIn();
31
+			if (options.delay) {
32
+				setTimeout(function() {
33
+					$wrapper.fadeOut(function() {
34
+						$wrapper.remove();
35
+					});
36
+				}, options.delay);
37
+			}
38
+		}, 200);
39
+
40
+		return $.extend($wrapper, {
41
+			close: function(timeout) {
42
+				setTimeout(function() {
43
+					$wrapper.fadeOut(function() {
44
+						$wrapper.remove();
45
+					});
46
+				}, timeout || '0');
47
+			},
48
+			update: function(content, icon) {
49
+				this.find('.notify-content').empty().append(content);
50
+				if (icon) {
51
+					this.find('i').removeClass().addClass(icon);
52
+				}
53
+				return this;
54
+			}
55
+		});
56
+	};
57
+
58
+})(jQuery);

+ 156 - 0
app/wp-content/plugins/woo-product-filter/js/progressmeter.js

@@ -0,0 +1,156 @@
1
+(function($){
2
+"use strict";
3
+	// Creating a number of jQuery plugins that you can use to
4
+	// initialize and control the progress meters.
5
+	$.fn.progressInitialize = function(){
6
+		// This function creates the necessary markup for the progress meter
7
+		// and sets up a few event listeners.
8
+
9
+		// Loop through all the buttons:
10
+		return this.each(function(){
11
+
12
+			var button = $(this),
13
+				progress = 0;
14
+
15
+			// Extract the data attributes into the options object.
16
+			// If they are missing, they will receive default values.
17
+
18
+			var options = $.extend({
19
+				type:'background-horizontal',
20
+				loading: 'Loading..',
21
+				finished: 'Done!'
22
+			}, button.data());
23
+
24
+			// Add the data attributes if they are missing from the element.
25
+			// They are used by our CSS code to show the messages
26
+			button.attr({'data-loading': options.loading, 'data-finished': options.finished});
27
+
28
+			// Add the needed markup for the progress bar to the button
29
+			var bar = $('<span class="tz-bar ' + options.type + '">').appendTo(button);
30
+
31
+			// The progress event tells the button to update the progress bar
32
+			button.on('progress', function(e, val, absolute, finish){
33
+
34
+				if(!button.hasClass('in-progress')){
35
+
36
+					// This is the first progress event for the button (or the
37
+					// first after it has finished in a previous run). Re-initialize
38
+					// the progress and remove some classes that may be left.
39
+					bar.show();
40
+					progress = 0;
41
+					button.removeClass('finished').addClass('in-progress')
42
+				}
43
+
44
+				// val, absolute and finish are event data passed by the progressIncrement
45
+				// and progressSet methods that you can see near the end of this file.
46
+				if(absolute){
47
+					progress = val;
48
+				}
49
+				else{
50
+					progress += val;
51
+				}
52
+
53
+				if(progress >= 100){
54
+					progress = 100;
55
+				}
56
+
57
+				if(finish){
58
+					button.removeClass('in-progress').addClass('finished');
59
+					bar.delay(500).fadeOut(function(){
60
+
61
+						// Trigger the custom progress-finish event
62
+						button.trigger('progress-finish');
63
+						setProgress(0);
64
+					});
65
+				}
66
+				setProgress(progress);
67
+			});
68
+
69
+			function setProgress(percentage){
70
+				bar.filter('.background-horizontal,.background-bar').width(percentage+'%');
71
+				bar.filter('.background-vertical').height(percentage+'%');
72
+			}
73
+		});
74
+	};
75
+
76
+	// progressStart simulates activity on the progress meter. Call it first,
77
+	// if the progress is going to take a long time to finish.
78
+
79
+	$.fn.progressStart = function(){
80
+
81
+		var button = this.first(),
82
+			last_progress = new Date().getTime();
83
+
84
+		if(button.hasClass('in-progress')){
85
+			// Don't start it a second time!
86
+			return this;
87
+		}
88
+
89
+		button.on('progress', function(){
90
+			last_progress = new Date().getTime();
91
+		});
92
+
93
+		// Every half a second check whether the progress
94
+		// has been incremented in the last two seconds
95
+
96
+		var interval = window.setInterval(function(){
97
+			if( new Date().getTime() > 2000+last_progress){
98
+
99
+				// There has been no activity for two seconds. Increment the progress
100
+				// bar a little bit to show that something is happening
101
+				button.progressIncrement(5);
102
+			}
103
+		}, 500);
104
+
105
+		button.on('progress-finish',function(){
106
+			window.clearInterval(interval);
107
+		});
108
+
109
+		return button.progressIncrement(10);
110
+	};
111
+
112
+	$.fn.progressFinish = function(){
113
+		return this.first().progressSet(100);
114
+	};
115
+
116
+	$.fn.progressIncrement = function(val){
117
+		val = val || 10;
118
+		var button = this.first();
119
+		button.trigger('progress',[val])
120
+		return this;
121
+	};
122
+
123
+	$.fn.progressSet = function(val){
124
+		val = val || 10;
125
+		var finish = false;
126
+		if(val >= 100){
127
+			finish = true;
128
+		}
129
+		return this.first().trigger('progress',[val, true, finish]);
130
+	};
131
+
132
+	// This function creates a progress meter that
133
+	// finishes in a specified amount of time.
134
+
135
+	$.fn.progressTimed = function(seconds, cb){
136
+		var button = this.first(),
137
+			bar = button.find('.tz-bar');
138
+
139
+		if(button.is('.in-progress')){
140
+			return this;
141
+		}
142
+
143
+		// Set a transition declaration for the duration of the meter.
144
+		// CSS will do the job of animating the progress bar for us.
145
+		bar.css('transition', seconds+'s linear');
146
+		button.progressSet(99);
147
+
148
+		window.setTimeout(function(){
149
+			bar.css('transition','');
150
+			button.progressFinish();
151
+			if($.isFunction(cb)){
152
+				cb();
153
+			}
154
+		}, seconds*1000);
155
+	};
156
+})(jQuery);

File diff suppressed because it is too large
+ 16 - 0
app/wp-content/plugins/woo-product-filter/js/slimscroll.min.js


+ 80 - 0
app/wp-content/plugins/woo-product-filter/js/wp.tabs.js

@@ -0,0 +1,80 @@
1
+(function( $ ){
2
+"use strict";
3
+	var methods = {
4
+		init : function( options ) {
5
+			return this.each(function(){
6
+				var $this = $(this);
7
+				this._options = options || {};
8
+				if (!$this.hasClass('wpfWpTabs')) {
9
+					$this.addClass('wpfWpTabs');
10
+					var navigations = $this.find('.nav-tab-wrapper:first').find('a.nav-tab:not(.notTab)')
11
+					,	firstNavigation = null;
12
+					navigations.each(function(){
13
+						if(!firstNavigation)
14
+							firstNavigation = jQuery(this);
15
+						jQuery(this).click(function(){
16
+							$this.wpTabs('activate', jQuery(this).attr('href'));
17
+							return false;
18
+						});
19
+					});
20
+					var locationHash = document.location.hash;
21
+					if(locationHash && locationHash != '' && $this.find(locationHash) && $this.find(locationHash).length) {
22
+						$this.wpTabs('activate', locationHash);
23
+						if(jQuery(locationHash).length) {
24
+							// Avoid scrolling to hashes
25
+							jQuery(window).load(function(){
26
+								setTimeout(function(){
27
+									jQuery('html, body').animate({
28
+										scrollTop: 0
29
+									}, 100);
30
+								}, 1);
31
+							});
32
+						}
33
+					} else {
34
+						$this.wpTabs('activate', firstNavigation.attr('href'));
35
+					}
36
+				}
37
+			});
38
+		}
39
+	,	activate: function(selector) {
40
+			return this.each(function(){
41
+				var $this = $(this);
42
+				if($this.find(selector).length) {
43
+					this._activeTab = selector;
44
+					var navigations = $this.find('.nav-tab-wrapper:first').find('a.nav-tab:not(.notTab)');
45
+					if(!this._firstInit) {
46
+						if(this._options.uniqId)
47
+							$this.find('.wpfTabContent').attr('data-tabs-for', this._options.uniqId);
48
+						this._firstInit = 1;
49
+					}
50
+					var allTabsContent = this._options.uniqId 
51
+						? $this.find('.wpfTabContent[data-tabs-for="'+ this._options.uniqId + '"]')
52
+						: $this.find('.wpfTabContent');
53
+					allTabsContent.hide();
54
+					$this.find(selector).show();
55
+					navigations.removeClass('nav-tab-active');
56
+					$this.find('[href="'+ selector+ '"]').addClass('nav-tab-active');
57
+					if(this._options.change) {
58
+						this._options.change(selector);
59
+					}
60
+				}
61
+			});
62
+		}
63
+	,	getActiveTab: function() {
64
+			var activeTab = null;
65
+			this.each(function(){
66
+				activeTab = this._activeTab;
67
+			});
68
+			return activeTab;
69
+		}
70
+	};
71
+	$.fn.wpTabs = function( method ) {
72
+		if ( methods[method] ) {
73
+			return methods[method].apply( this, Array.prototype.slice.call( arguments, 1 ));
74
+		} else if ( typeof method === 'object' || ! method ) {
75
+			return methods.init.apply( this, arguments );
76
+		} else {
77
+			$.error( 'There are no method with name: '+ method);
78
+		}
79
+	};
80
+})( jQuery );

BIN
app/wp-content/plugins/woo-product-filter/languages/woo-product-filter-de_DE.mo


File diff suppressed because it is too large
+ 5160 - 0
app/wp-content/plugins/woo-product-filter/languages/woo-product-filter-de_DE.po


BIN
app/wp-content/plugins/woo-product-filter/languages/woo-product-filter-fr_FR.mo


File diff suppressed because it is too large
+ 4865 - 0
app/wp-content/plugins/woo-product-filter/languages/woo-product-filter-fr_FR.po


BIN
app/wp-content/plugins/woo-product-filter/languages/woo-product-filter-pl_PL.mo


File diff suppressed because it is too large
+ 3123 - 0
app/wp-content/plugins/woo-product-filter/languages/woo-product-filter-pl_PL.po


BIN
app/wp-content/plugins/woo-product-filter/languages/woo-product-filter-ru_RU.mo


File diff suppressed because it is too large
+ 4212 - 0
app/wp-content/plugins/woo-product-filter/languages/woo-product-filter-ru_RU.po


BIN
app/wp-content/plugins/woo-product-filter/languages/woo-product-filter.mo


File diff suppressed because it is too large
+ 3247 - 0
app/wp-content/plugins/woo-product-filter/languages/woo-product-filter.po


File diff suppressed because it is too large
+ 3950 - 0
app/wp-content/plugins/woo-product-filter/languages/woo-product-filter.pot


+ 10 - 0
app/wp-content/plugins/woo-product-filter/modules/admin_nav/controller.php

@@ -0,0 +1,10 @@
1
+<?php
2
+class Admin_NavControllerWpf extends ControllerWpf {
3
+	public function getPermissions() {
4
+		return array(
5
+			WPF_USERLEVELS => array(
6
+				WPF_ADMIN => array()
7
+			),
8
+		);
9
+	}
10
+}

+ 0 - 0
app/wp-content/plugins/woo-product-filter/modules/admin_nav/mod.php


Some files were not shown because too many files changed in this diff

tum/whitesports - Gogs: Simplico Git Service

Bez popisu

block.json 577B

12345678910111213141516171819202122232425262728293031323334
  1. {
  2. "apiVersion": 2,
  3. "name": "core/query-title",
  4. "title": "Query Title",
  5. "category": "design",
  6. "description": "Display the query title.",
  7. "textdomain": "default",
  8. "attributes": {
  9. "type": {
  10. "type": "string"
  11. },
  12. "textAlign": {
  13. "type": "string"
  14. },
  15. "level": {
  16. "type": "number",
  17. "default": 1
  18. }
  19. },
  20. "supports": {
  21. "align": [ "wide", "full" ],
  22. "html": false,
  23. "color": {
  24. "gradients": true
  25. },
  26. "typography": {
  27. "fontSize": true,
  28. "lineHeight": true,
  29. "__experimentalFontFamily": true
  30. }
  31. },
  32. "editorStyle": "wp-block-query-title-editor"
  33. }