Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
syncEnrollments
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Yeray Santana Hualde
syncEnrollments
Commits
fb984016
Commit
fb984016
authored
Aug 03, 2011
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added loader class.
parent
c70f0904
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
74 additions
and
18 deletions
+74
-18
index.php
public/index.php
+3
-18
loader.php
system/loader.php
+71
-0
No files found.
public/index.php
View file @
fb984016
...
@@ -67,31 +67,16 @@ define('EXT', '.php');
...
@@ -67,31 +67,16 @@ define('EXT', '.php');
// --------------------------------------------------------------
// --------------------------------------------------------------
// Load the classes used by the auto-loader.
// Load the classes used by the auto-loader.
// --------------------------------------------------------------
// --------------------------------------------------------------
require
SYS_PATH
.
'loader'
.
EXT
;
require
SYS_PATH
.
'config'
.
EXT
;
require
SYS_PATH
.
'config'
.
EXT
;
require
SYS_PATH
.
'arr'
.
EXT
;
require
SYS_PATH
.
'arr'
.
EXT
;
// --------------------------------------------------------------
// --------------------------------------------------------------
// Register the auto-loader.
// Register the auto-loader.
// --------------------------------------------------------------
// --------------------------------------------------------------
spl_autoload_register
(
function
(
$class
)
System\Loader
::
bootstrap
();
{
$file
=
strtolower
(
str_replace
(
'\\'
,
'/'
,
$class
));
if
(
array_key_exists
(
$class
,
$aliases
=
System\Config
::
get
(
'aliases'
)))
{
return
class_alias
(
$aliases
[
$class
],
$class
);
}
foreach
(
array
(
BASE_PATH
,
MODEL_PATH
,
LIBRARY_PATH
)
as
$directory
)
spl_autoload_register
(
array
(
'System\\Loader'
,
'load'
));
{
if
(
file_exists
(
$path
=
$directory
.
$file
.
EXT
))
{
require
$path
;
return
;
}
}
});
// --------------------------------------------------------------
// --------------------------------------------------------------
// Register the framework starting time with the Benchmarker.
// Register the framework starting time with the Benchmarker.
...
...
system/loader.php
0 → 100644
View file @
fb984016
<?php
namespace
System
;
class
Loader
{
/**
* The paths to be searched by the loader.
*
* @var array
*/
private
static
$paths
=
array
(
BASE_PATH
,
MODEL_PATH
,
LIBRARY_PATH
);
/**
* All of the class aliases.
*
* @var array
*/
private
static
$aliases
=
array
();
/**
* Bootstrap the auto-loader.
*
* @return void
*/
public
static
function
bootstrap
()
{
static
::
$aliases
=
require
CONFIG_PATH
.
'aliases'
.
EXT
;
}
/**
* Load a class file for a given class name.
*
* This function is registered on the SPL auto-loader stack by the front controller during each request.
*
* All Laravel class names follow a namespace to directory convention. So, if a class exists in
* application/libraries/user, it shouold be placed in the "User" namespace.
*
* @param string $class
* @return void
*/
public
static
function
load
(
$class
)
{
$file
=
strtolower
(
str_replace
(
'\\'
,
'/'
,
$class
));
if
(
array_key_exists
(
$class
,
static
::
$aliases
))
{
return
class_alias
(
static
::
$aliases
[
$class
],
$class
);
}
foreach
(
static
::
$paths
as
$directory
)
{
if
(
file_exists
(
$path
=
$directory
.
$file
.
EXT
))
{
require
$path
;
return
;
}
}
}
/**
* Register a path with the auto-loader.
*
* @param string $path
* @return void
*/
public
static
function
register
(
$path
)
{
static
::
$paths
[]
=
$path
;
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment