forked from intoxstudio/wp-content-aware-engine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap.php
92 lines (79 loc) · 1.58 KB
/
bootstrap.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
88
89
90
91
92
<?php
/**
* @package WP Content Aware Engine
* @copyright Joachim Jensen <[email protected]>
* @license GPLv3
*/
if (!defined('ABSPATH')) {
exit;
}
/**
* Version of this WPCA
* @var string
*/
$this_wpca_version = '4.2.1';
/**
* Class to make sure the latest
* version of WPCA gets loaded
*
* @since 3.0
*/
if(!class_exists('WPCALoader')) {
class WPCALoader {
/**
* Absolute paths and versions
* @var array
*/
private static $_paths = array();
public function __construct() {
}
/**
* Add path to loader
*
* @since 3.0
* @param string $path
* @param string $version
*/
public static function add($path,$version) {
self::$_paths[$path] = $version;
}
/**
* Load file for newest version
* and setup engine
*
* @since 3.0
* @return void
*/
public static function load() {
//legacy version present, cannot continue
if(class_exists('WPCACore')) {
return;
}
arsort(self::$_paths);
foreach (self::$_paths as $path => $version) {
$file = $path.'core.php';
if(file_exists($file)) {
include($file);
define('WPCA_VERSION',$version);
WPCACore::init();
do_action('wpca/loaded');
break;
}
}
}
/**
* Get all paths added to loader
* Sorted if called after plugins_loaded
*
* @since 3.0
* @return array
*/
public static function debug() {
return self::$_paths;
}
}
//Hook as early as possible after plugins are loaded
add_action('plugins_loaded',array('WPCALoader','load'),-999999);
}
WPCALoader::add(plugin_dir_path( __FILE__ ),$this_wpca_version);
//