-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathstart.php
More file actions
94 lines (86 loc) · 2.24 KB
/
start.php
File metadata and controls
94 lines (86 loc) · 2.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<?php
/**
* @package wp-content-aware-engine
* @author Joachim Jensen <joachim@dev.institute>
* @license GPLv3
* @copyright 2023 by Joachim Jensen
*/
defined('ABSPATH') || exit;
/**
* Version of this WPCA
* @var string
*/
$this_wpca_version = '19.0';
/**
* 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 = [];
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;
}
uasort(self::$_paths, 'version_compare');
foreach (array_reverse(self::$_paths, true) 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',
['WPCALoader','load'],
defined('PHP_INT_MIN') ? PHP_INT_MIN : ~PHP_INT_MAX
);
}
WPCALoader::add(plugin_dir_path(__FILE__), $this_wpca_version);