-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathincludes.inc.php
108 lines (91 loc) · 3.01 KB
/
includes.inc.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<?php
/*=======================================================================================
* *
* includes.inc.php *
* *
*======================================================================================*/
/**
* Global include file.
*
* This file should be included at the top level of the application or web site as the
* first entry, it includes the file paths to the relevant directories and the autoload
* function for this library.
*
* @package GEO
* @subpackage Definitions
*
* @author Milko A. Skofic <[email protected]>
* @version 1.00 31/07/2013
*/
/*=======================================================================================
* NAMESPACE ROOT *
*======================================================================================*/
/**
* MyWrapper namespace root.
*
* This string indicates the root namespace name for this library.
*/
define( "kPATH_GEOFEATURES_NAMESPACE_ROOT", "GeoFeatures" );
/*=======================================================================================
* LIBRARY SUB-PATHS *
*======================================================================================*/
/**
* GeoFeatures class library sources.
*
* This value defines the <b><i>absolute</i></b> path to the MyWrapper class library sources
* directory.
*/
define( "kPATH_GEOFEATURES_LIBRARY_CLASS", kPATH_GEOFEATURES_LIBRARY_ROOT."/classes" );
/**
* GeoFeatures batch scripts and files.
*
* This value defines the <b><i>absolute</i></b> path to the MyWrapper library data
* directory.
*/
define( "kPATH_GEOFEATURES_LIBRARY_BATCH", kPATH_GEOFEATURES_LIBRARY_ROOT."/batch" );
/**
* GeoFeatures service scripts and files.
*
* This value defines the <b><i>absolute</i></b> path to the MyWrapper library service
* directory.
*/
define( "kPATH_GEOFEATURES_LIBRARY_SERVICE", kPATH_GEOFEATURES_LIBRARY_ROOT."/service" );
/*=======================================================================================
* CLASS AUTOLOADER *
*======================================================================================*/
/**
* This section allows automatic inclusion of the library classes.
*/
function GeoFeaturesAutoload( $theClassName )
{
//
// Separate namespace elements.
//
$namespaces = explode( '\\', $theClassName );
//
// Handle our classes.
//
if( (count( $namespaces ) > 1) // Declared a namespace
&& ($namespaces[ 0 ] == kPATH_GEOFEATURES_LIBRARY_ROOT) ) // and corresponds.
{
//
// Replace root namespace with class directory.
//
$namespaces[ 0 ] = kPATH_GEOFEATURES_LIBRARY_CLASS;
//
// Create path.
//
$path = implode( DIRECTORY_SEPARATOR, $namespaces ).'.php';
} // This librarie's namespace.
//
// Handle without namespaces.
//
else
$path = kPATH_GEOFEATURES_LIBRARY_CLASS."/$theClassName.php";
//
// Require class.
//
if( file_exists( $path ) )
require_once( $path );
} spl_autoload_register( 'GeoFeaturesAutoload' );
?>