PluginProbe
Filter Everything — WordPress & WooCommerce Filters / 1.9.1
Filter Everything — WordPress & WooCommerce Filters v1.9.1
1.9.6 1.9.5 1.9.4 1.9.3 1.9.2.2 1.9.2.1 trunk 1.2.1 1.2.3 1.2.4 1.2.5 1.3.0 1.3.1 1.3.2 1.4.1 1.4.4 1.4.5 1.4.8 1.4.9 1.5.0 1.5.1 1.6.0 1.6.1 1.6.2 1.6.3 All 51 releases
filter-everything / filter-everything.php

filter-everything.php in Filter Everything — WordPress & WooCommerce Filters 1.9.1, at filter-everything.php

255 lines 9.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /*
3 Plugin Name: Filter Everything&nbsp;— WooCommerce Product & WordPress Filter
4 Plugin URI: https://filtereverything.pro
5 Description: Filters everything in WordPress & WooCommerce: Products, any Post types, by Any Criteria. Compatible with WPML, ACF and others popular. Supports AJAX.
6 Version: 1.9.1
7 Author: Andrii Stepasiuk
8 Author URI: https://filtereverything.pro/about/
9 Text Domain: filter-everything
10 Domain Path: /lang
11 */
12
13 // If this file is called directly, abort.
14 if ( ! defined('ABSPATH') ) {
15 exit;
16 }
17
18 if( ! class_exists( 'FlrtFilter' ) ):
19
20 class FlrtFilter{
21
22 public function init()
23 {
24 global $flrt_sets, $wpc_not_fired, $chips_count;
25
26 $chips_count = 0;
27 $wpc_not_fired = true;
28 $flrt_sets = [];
29
30 $this->define( 'FLRT_PLUGIN_DIR_PATH', plugin_dir_path( __FILE__ ) );
31 $this->define( 'FLRT_PLUGIN_DIR_URL', plugin_dir_url( __FILE__ ) );
32 $this->define( 'FLRT_PLUGIN_BASENAME', plugin_basename(__FILE__) );
33 $this->define( 'FLRT_PLUGIN_SLUG', 'filter-everything-pro' );
34 $this->define( 'FLRT_PLUGIN_VER', '1.9.1' );
35 $this->define( 'FLRT_PLUGIN_URL', 'https://filtereverything.pro' );
36 $this->define( 'FLRT_PLUGIN_TESTED_TO', '6.9' );
37 $this->define( 'FLRT_PLUGIN_DEBUG', false );
38 $this->define( 'FLRT_TEMPLATES_DIR_NAME', 'filters' );
39
40 $this->define( 'FLRT_FILTERS_SET_POST_TYPE', 'filter-set' );
41 $this->define( 'FLRT_FILTERS_POST_TYPE', 'filter-field' );
42 $this->define( 'FLRT_PREFIX_SEPARATOR', '-' );
43 $this->define( 'FLRT_QUERY_TERMS_SEPARATOR', ';' );
44 $this->define( 'FLRT_DATE_TIME_SEPARATOR', 't' );
45 $this->define( 'FLRT_FOLDING_COOKIE_NAME', 'wpcContainersStatus' );
46 $this->define( 'FLRT_MORELESS_COOKIE_NAME', 'wpcMoreLessStatus' );
47 $this->define( 'FLRT_HIERARCHY_LIST_COOKIE_NAME', 'wpcHierarchyListStatus' );
48 $this->define( 'FLRT_OPEN_CLOSE_BUTTON_COOKIE_NAME', 'wpcWidgetStatus' );
49 $this->define( 'FLRT_APPLY_BUTTON_META_KEY', 'wpc_filter_set_apply_button_post_name' );
50 $this->define( 'FLRT_TRANSIENT_PERIOD_HOURS', 12 );
51 $this->define( 'FLRT_BEAVER_BUILDER_VAR', 'fl_builder' );
52 $this->define( 'FLRT_LICENSE_KEY', 'wpc_filter_license' );
53 $this->define( 'FLRT_MARKET', 'codecanyon' );
54 $this->define( 'FLRT_RELEASER', 'stepasiuk' );
55 $this->define( 'FLRT_APPROVED', 'victor' );
56 $this->define( 'FLRT_ITERATION', 'first' );
57
58 require_once FLRT_PLUGIN_DIR_PATH . 'src/wpc-helpers.php';
59
60 flrt_include('src/wpc-compat.php');
61 flrt_include('src/wpc-default-hooks.php');
62 flrt_include('src/wpc-third-party.php');
63
64 flrt_include('src/Plugin.php');
65 flrt_include('src/PostTypes.php');
66 flrt_include('src/Settings/TabInterface.php');
67 flrt_include('src/Settings/BaseSettings.php');
68 flrt_include('src/Settings/TabRenderer.php');
69 flrt_include('src/Settings/Container.php');
70
71 flrt_include('src/Entities/Entity.php');
72
73 flrt_include('src/Entities/TaxonomyEntity.php');
74 flrt_include('src/Entities/PostMetaEntity.php');
75 flrt_include('src/Entities/PostMetaNumEntity.php');
76 flrt_include('src/Entities/AuthorEntity.php');
77 flrt_include('src/Entities/PostDateEntity.php');
78
79 // Include PRO
80 // flrt_include('pro/filters-pro.php');
81
82 flrt_include('src/Entities/DefaultEntity.php');
83 flrt_include('src/Entities/EntityManager.php');
84
85 flrt_include('src/Settings/Tabs/SettingsTab.php');
86 flrt_include('src/Settings/Tabs/PermalinksTab.php');
87 flrt_include('src/Settings/Tabs/ExperimentalTab.php');
88 flrt_include('src/Settings/Tabs/AboutProTab.php');
89 flrt_include('src/Settings/Tabs/HelpMeTab.php');
90
91 flrt_include('src/Settings/Filter.php');
92
93 flrt_include('src/RequestParser.php');
94 flrt_include('src/UrlManager.php');
95 flrt_include('src/Chips.php');
96 flrt_include('src/Sorting.php');
97 flrt_include('src/Swatches.php');
98
99 flrt_include('src/Walkers/WalkerCheckbox.php');
100
101 flrt_include('src/TemplateManager.php');
102 flrt_include('src/WpManager.php');
103
104 flrt_include('src/Admin/FilterSet.php');
105 flrt_include('src/Admin/FilterFields.php');
106 flrt_include('src/Admin/Admin.php');
107 flrt_include('src/Admin/AdminHooks.php');
108 flrt_include('src/Admin/MetaBoxes.php');
109 flrt_include('src/Admin/Widgets/FiltersWidget.php');
110 flrt_include('src/Admin/Widgets/ChipsWidget.php');
111 flrt_include('src/Admin/Widgets/SortingWidget.php');
112 flrt_include('src/Admin/Widgets.php');
113 flrt_include('src/Admin/Shortcodes.php');
114 flrt_include('src/Admin/Validator.php');
115 flrt_include('src/Admin/DuplicateFilterSet.php');
116
117 flrt_include('src/FormFields/Input.php');
118 flrt_include('src/wpc-api.php');
119
120 $this->registerHooks();
121
122 $this->initSettings();
123
124 flrt_check_update_mobile_settings();
125
126 if( flrt_get_experimental_option( 'disable_woo_orderby' ) === 'on' ) {
127 if( ! function_exists('woocommerce_catalog_ordering') ){
128 function woocommerce_catalog_ordering()
129 {
130 return false;
131 }
132 }
133 }
134 }
135
136 public function registerHooks()
137 {
138 // Backward compatibility. From v1.3.2
139 add_action( 'init', [ $this, 'convertShowChipsInContent' ], -1 );
140
141 add_action( 'init', [ $this, 'oneTwoThreeGo' ] );
142
143 add_action( 'init', [ $this, 'loadTextdomain' ], 0 );
144
145 add_action( 'after_setup_theme', [$this, 'afterSetupTheme'] );
146
147 register_activation_hook(__FILE__, ['FilterEverything\Filter\Plugin', 'activate']);
148
149 register_uninstall_hook(__FILE__, ['FilterEverything\Filter\Plugin', 'uninstall']);
150
151 add_action('after_switch_theme', ['FilterEverything\Filter\Plugin', 'switchTheme'] );
152 }
153
154 public function convertShowChipsInContent()
155 {
156 // Backward compatibility. From v1.3.2
157 $filter_settings = get_option('wpc_filter_settings');
158
159 if ( isset( $filter_settings['show_terms_in_content'] ) && $filter_settings['show_terms_in_content'] === 'on' ) {
160 $new_chips_hooks = [];
161 $theme_dependencies = flrt_get_theme_dependencies();
162
163 if ( flrt_is_woocommerce() ) {
164 $new_chips_hooks[] = 'woocommerce_no_products_found';
165 $new_chips_hooks[] = 'woocommerce_archive_description';
166 }
167
168 if ( isset( $theme_dependencies['chips_hook'] ) && is_array($theme_dependencies['chips_hook'] ) ) {
169 foreach ( $theme_dependencies['chips_hook'] as $compat_chips_hook ) {
170 $new_chips_hooks[] = $compat_chips_hook;
171 }
172 }
173
174 $filter_settings['show_terms_in_content'] = $new_chips_hooks;
175 update_option('wpc_filter_settings', $filter_settings );
176 }
177 }
178
179 public function loadTextdomain()
180 {
181 load_plugin_textdomain( 'filter-everything', false, dirname(FLRT_PLUGIN_BASENAME) . '/lang' );
182 }
183
184 public function oneTwoThreeGo()
185 {
186 global $flrt_plugin;
187 $flrt_plugin = new \FilterEverything\Filter\Plugin();
188 }
189
190 /**
191 * @since 1.6.1
192 */
193 public function afterSetupTheme()
194 {
195 $this->define( 'FLRT_ALLOW_PLL_TRANSLATIONS', true );
196 }
197
198 private function initSettings(){
199 $container = \FilterEverything\Filter\Container::instance();
200
201 $settings['php_to_js_date_formats'] = array(
202 'Y' => 'yy',
203 'y' => 'y',
204 'm' => 'mm',
205 'n' => 'm',
206 'F' => 'MM',
207 'M' => 'M',
208 'l' => 'DD',
209 'D' => 'D',
210 'd' => 'dd',
211 'j' => 'd',
212 'S' => '',
213 );
214
215 $settings['php_to_js_time_formats'] = array(
216 'a' => 'tt',
217 'A' => 'TT',
218 'h' => 'hh',
219 'g' => 'h',
220 'H' => 'HH',
221 'G' => 'H',
222 'i' => 'mm',
223 's' => 'ss',
224 );
225
226 foreach ( $settings as $key => $value ) {
227 $container->storeParam( $key, $value );
228 }
229 }
230
231 public function define( $name, $value = true )
232 {
233 if( ! defined( $name ) ) {
234 define( $name, $value );
235 }
236 }
237
238 }
239
240 function flrt_filter()
241 {
242 global $wpcFilter;
243
244 if( ! isset( $wpcFilter ) ) {
245 $wpcFilter = new FlrtFilter();
246 $wpcFilter->init();
247 }
248
249 return $wpcFilter;
250
251 }
252
253 flrt_filter();
254
255 endif;