-
Notifications
You must be signed in to change notification settings - Fork 0
/
autoload.php
63 lines (56 loc) · 1.35 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
<?php
/**
* @version 2.0
* @author Sammy
*
* @keywords Samils, ils, php framework
* -----------------
* @namespace php
* - Autoload, application dependencies
*/
namespace php {
/**
* Root
* Absoluete path to the current directory
* whish phpmodule will considere as its
* root directory
*/
const Root = __DIR__;
if (!function_exists ('php\\pm_is_php_file')) {
function pm_is_php_file ($file = null){
# Verify if '$file' a php file
return ( boolean )( is_string($file) &&
!empty($file) &&
in_array (strtolower (pathinfo ($file, PATHINFO_EXTENSION)),
preg_split ('/\s+/', 'php php5 php7')
)
);
}}
if (!function_exists ('php\\pm_autoload_directory_files')) {
function pm_autoload_directory_files ($dir = null) {
if (!(is_string($dir) && !empty($dir) && is_dir($dir)))
$dir = dirname(__FILE__);
$dir = preg_replace('/(\\|\/)+$/', '', $dir) . (
'/*'
);
$dir_files = glob($dir);
foreach ($dir_files as $key => $value) {
if ( is_dir ($value) ) {
pm_autoload_directory_files (
$value
);
}else{
if (pm_is_php_file ($value)) {
include_once $value;
}
}
}
}}
pm_autoload_directory_files ( Root .
'/pm_classes'
);
pm_autoload_directory_files ( Root .
'/pm_functions'
);
include (dirname(__FILE__) . '/index.php');
}