-
Notifications
You must be signed in to change notification settings - Fork 2
/
class.wps.php
37 lines (29 loc) · 889 Bytes
/
class.wps.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
<?php
require_once(WPS_INCLUDES_DIR . '/class.autoloaders.php');
class WPS {
public static function init() {
self::load_wps_core();
}
private static function load_wps_core() {
WPS\Autoloaders::init();
WPS\ModelsLoader::init();
WPS\ControllersLoader::init();
}
public static function load_files_within($dir, $filter_iterator, $callback = null, $load_file = true) {
$dir_files = new RecursiveDirectoryIterator(
$dir,
RecursiveDirectoryIterator::SKIP_DOTS
);
$filtered_files = new $filter_iterator($dir_files);
$files_iterator = new RecursiveIteratorIterator(
$filtered_files,
RecursiveIteratorIterator::CHILD_FIRST
);
foreach($files_iterator as $file) {
if($file->isFile()) {
if($load_file) require_once($file->getPathname());
if(!empty($callback)) $callback($file);
}
}
}
}