-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwaboot-woo-product-filters.php
88 lines (79 loc) · 2.25 KB
/
waboot-woo-product-filters.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<?php
namespace WBWPF;
/**
* The plugin bootstrap file
*
* Plugin Name: Waboot Product Filters for WooCommerce
* Plugin URI: https://www.waboot.io/
* Description: Enhanced product filters for WooCommerce
* Version: 1.0.0
* Author: WAGA
* Author URI: https://www.waga.it/
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
* Text Domain: waboot-woo-product-filters
* Domain Path: /languages
*/
use WBWPF\Plugin;
if ( ! defined( 'WPINC' ) ) {
die; //If this file is called directly, abort.
}
// Custom PS4 autoloader
spl_autoload_register( function($class){
$prefix = "WBWPF\\";
$plugin_path = plugin_dir_path( __FILE__ );
$base_dir = $plugin_path."src/";
// does the class use the namespace prefix?
$len = strlen($prefix);
if (strncmp($prefix, $class, $len) !== 0) {
// no, move to the next registered autoloader
return;
}
// get the relative class name
$relative_class = substr($class, $len);
// replace the namespace prefix with the base directory, replace namespace
// separators with directory separators in the relative class name, append
// with .php
$file = $base_dir . str_replace('\\', '/', $relative_class) . '.php';
// if the file exists, require it
if (file_exists($file)) {
require_once $file;
}else{
return;
}
});
require_once 'src/includes/wbf-utils.php';
includes\include_wbf_autoloader();
if( version_compare(phpversion(),"5.6.0","<") ){
if(is_admin()){
add_action( 'admin_notices', function(){
?>
<div class="error">
<p><?php _e( basename(__FILE__). ' requires PHP >= 5.6, got '.phpversion() ); ?></p>
</div>
<?php
});
}
return;
}
if(class_exists("\\WBF\\components\\pluginsframework\\BasePlugin")){
require_once 'src/includes/template-tags.php';
require_once 'src/Plugin.php';
$plugin = new Plugin();
$plugin->run();
}else{
if(is_admin()){
add_action( 'admin_init' , function(){
includes\install_wbf_wp_update_hooks();
});
add_action( 'admin_notices', function(){
?>
<div class="error">
<p>
<?php echo includes\get_wbf_download_button('Waboot Product Filters for WooCommerce'); ?>
</p>
</div>
<?php
});
}
}