-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathautoload.php
77 lines (63 loc) · 1.54 KB
/
autoload.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
<?php
require_once __DIR__ . '/define.php';
require_once PR_LIBS_PATH . 'PR/utils.php';
class PR_Autoload {
public function __construct() {
$this->libs();
$this->api();
$this->taxonomies();
$this->post_types();
$this->packager();
$this->preview();
$this->server();
$this->pages();
}
public function api() {
require_once PR_ROOT . 'api.php';
}
public function libs() {
if ( is_dir( PR_LIBS_PATH ) ) {
$dirs = PR_Utils::search_dir( PR_LIBS_PATH );
if ( !empty( $dirs ) ) {
foreach ( $dirs as $dir ) {
$file = PR_LIBS_PATH . $dir . DS . strtolower( $dir ) . ".php";
require_once $file;
}
}
}
}
public function taxonomies() {
$this->_load_files( PR_TAXONOMIES_PATH );
}
public function post_types() {
$this->_load_files( PR_POST_TYPES_PATH );
}
public function packager() {
require_once PR_PACKAGER_PATH . 'packager.php';
}
public function preview() {
require_once PR_PREVIEW_PATH . 'preview.php';
}
public function server() {
require_once PR_SERVER_PATH . 'server.php';
}
public function pages() {
require_once PR_PAGES_PATH . 'options.php';
}
/**
* Load plugin custom types
*
* @void
*/
protected function _load_files( $path, $recursive = false ) {
if ( is_dir( $path ) ) {
$files = PR_Utils::search_files( $path, 'php' );
if ( !empty( $files ) ) {
foreach ( $files as $file ) {
require_once $file;
}
}
}
}
}
$pr_autoload = new PR_Autoload;