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
9d1905ee
Commit
9d1905ee
authored
Jan 27, 2012
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improve autoloader and load entire framework core using PSR-0 on the base_path.
parent
d76cf4ba
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
99 deletions
+20
-99
autoloader.php
laravel/autoloader.php
+16
-2
core.php
laravel/core.php
+4
-97
No files found.
laravel/autoloader.php
View file @
9d1905ee
...
@@ -60,6 +60,11 @@ class Autoloader {
...
@@ -60,6 +60,11 @@ class Autoloader {
{
{
$namespace
=
substr
(
$class
,
0
,
$slash
);
$namespace
=
substr
(
$class
,
0
,
$slash
);
if
(
$namespace
==
'Laravel'
)
{
return
static
::
load_psr
(
$class
,
BASE_PATH
);
}
// If the class namespace is mapped to a directory, we will load the class
// If the class namespace is mapped to a directory, we will load the class
// using the PSR-0 standards from that directory; however, we will trim
// using the PSR-0 standards from that directory; however, we will trim
// off the beginning of the namespace to account for files in the root
// off the beginning of the namespace to account for files in the root
...
@@ -108,7 +113,14 @@ class Autoloader {
...
@@ -108,7 +113,14 @@ class Autoloader {
// slashes to directory slashes.
// slashes to directory slashes.
$file
=
str_replace
(
array
(
'\\'
,
'_'
),
'/'
,
$class
);
$file
=
str_replace
(
array
(
'\\'
,
'_'
),
'/'
,
$class
);
$directories
=
(
is_nulL
(
$directory
))
?
static
::
$psr
:
array
(
$directory
);
if
(
is_null
(
$directory
))
{
$directories
=
static
::
$psr
;
}
else
{
$directories
=
array
(
$directory
);
}
// Once we have formatted the class name, we will simply spin
// Once we have formatted the class name, we will simply spin
// through the registered PSR-0 directories and attempt to
// through the registered PSR-0 directories and attempt to
...
@@ -117,9 +129,11 @@ class Autoloader {
...
@@ -117,9 +129,11 @@ class Autoloader {
// We will check for both lowercase and CamelCase files as
// We will check for both lowercase and CamelCase files as
// Laravel uses a lowercase version of PSR-0, while true
// Laravel uses a lowercase version of PSR-0, while true
// PSR-0 uses CamelCase for all file names.
// PSR-0 uses CamelCase for all file names.
$lower
=
strtolower
(
$file
);
foreach
(
$directories
as
$directory
)
foreach
(
$directories
as
$directory
)
{
{
if
(
file_exists
(
$path
=
$directory
.
strtolower
(
$file
)
.
EXT
))
if
(
file_exists
(
$path
=
$directory
.
$lower
.
EXT
))
{
{
return
require
$path
;
return
require
$path
;
}
}
...
...
laravel/core.php
View file @
9d1905ee
...
@@ -33,104 +33,11 @@ require SYS_PATH.'autoloader'.EXT;
...
@@ -33,104 +33,11 @@ require SYS_PATH.'autoloader'.EXT;
spl_autoload_register
(
array
(
'Laravel\\Autoloader'
,
'load'
));
spl_autoload_register
(
array
(
'Laravel\\Autoloader'
,
'load'
));
/**
/**
*
Build the Laravel framework class map. This provides a super fast
*
Register the "BASE_PATH" as a PSR-0 directory. This allows the
*
way of resolving any Laravel class name to its appropriate path.
*
entire Laravel framework to be laoded according to the PSR-0
*
More mappings can also be registered by the developer as needed
.
*
conventions, as the entire core follows the convention
.
*/
*/
Autoloader
::
$mappings
=
array
(
Autoloader
::
psr
(
BASE_PATH
);
'Laravel\\Auth'
=>
SYS_PATH
.
'auth'
.
EXT
,
'Laravel\\Asset'
=>
SYS_PATH
.
'asset'
.
EXT
,
'Laravel\\Benchmark'
=>
SYS_PATH
.
'benchmark'
.
EXT
,
'Laravel\\Blade'
=>
SYS_PATH
.
'blade'
.
EXT
,
'Laravel\\Bundle'
=>
SYS_PATH
.
'bundle'
.
EXT
,
'Laravel\\Cache'
=>
SYS_PATH
.
'cache'
.
EXT
,
'Laravel\\Config'
=>
SYS_PATH
.
'config'
.
EXT
,
'Laravel\\Cookie'
=>
SYS_PATH
.
'cookie'
.
EXT
,
'Laravel\\Crypter'
=>
SYS_PATH
.
'crypter'
.
EXT
,
'Laravel\\Database'
=>
SYS_PATH
.
'database'
.
EXT
,
'Laravel\\Error'
=>
SYS_PATH
.
'error'
.
EXT
,
'Laravel\\Event'
=>
SYS_PATH
.
'event'
.
EXT
,
'Laravel\\File'
=>
SYS_PATH
.
'file'
.
EXT
,
'Laravel\\Fluent'
=>
SYS_PATH
.
'fluent'
.
EXT
,
'Laravel\\Form'
=>
SYS_PATH
.
'form'
.
EXT
,
'Laravel\\Hash'
=>
SYS_PATH
.
'hash'
.
EXT
,
'Laravel\\HTML'
=>
SYS_PATH
.
'html'
.
EXT
,
'Laravel\\Input'
=>
SYS_PATH
.
'input'
.
EXT
,
'Laravel\\IoC'
=>
SYS_PATH
.
'ioc'
.
EXT
,
'Laravel\\Lang'
=>
SYS_PATH
.
'lang'
.
EXT
,
'Laravel\\Log'
=>
SYS_PATH
.
'log'
.
EXT
,
'Laravel\\Memcached'
=>
SYS_PATH
.
'memcached'
.
EXT
,
'Laravel\\Messages'
=>
SYS_PATH
.
'messages'
.
EXT
,
'Laravel\\Paginator'
=>
SYS_PATH
.
'paginator'
.
EXT
,
'Laravel\\Redirect'
=>
SYS_PATH
.
'redirect'
.
EXT
,
'Laravel\\Redis'
=>
SYS_PATH
.
'redis'
.
EXT
,
'Laravel\\Request'
=>
SYS_PATH
.
'request'
.
EXT
,
'Laravel\\Response'
=>
SYS_PATH
.
'response'
.
EXT
,
'Laravel\\Section'
=>
SYS_PATH
.
'section'
.
EXT
,
'Laravel\\Session'
=>
SYS_PATH
.
'session'
.
EXT
,
'Laravel\\Str'
=>
SYS_PATH
.
'str'
.
EXT
,
'Laravel\\URI'
=>
SYS_PATH
.
'uri'
.
EXT
,
'Laravel\\URL'
=>
SYS_PATH
.
'url'
.
EXT
,
'Laravel\\Validator'
=>
SYS_PATH
.
'validator'
.
EXT
,
'Laravel\\View'
=>
SYS_PATH
.
'view'
.
EXT
,
'Laravel\\Cache\\Drivers\\APC'
=>
SYS_PATH
.
'cache/drivers/apc'
.
EXT
,
'Laravel\\Cache\\Drivers\\Driver'
=>
SYS_PATH
.
'cache/drivers/driver'
.
EXT
,
'Laravel\\Cache\\Drivers\\File'
=>
SYS_PATH
.
'cache/drivers/file'
.
EXT
,
'Laravel\\Cache\\Drivers\\Memcached'
=>
SYS_PATH
.
'cache/drivers/memcached'
.
EXT
,
'Laravel\\Cache\\Drivers\\Redis'
=>
SYS_PATH
.
'cache/drivers/redis'
.
EXT
,
'Laravel\\Cache\\Drivers\\Database'
=>
SYS_PATH
.
'cache/drivers/database'
.
EXT
,
'Laravel\\CLI\\Console'
=>
SYS_PATH
.
'cli/console'
.
EXT
,
'Laravel\\CLI\\Command'
=>
SYS_PATH
.
'cli/command'
.
EXT
,
'Laravel\\CLI\\Tasks\\Task'
=>
SYS_PATH
.
'cli/tasks/task'
.
EXT
,
'Laravel\\CLI\\Tasks\\Bundle\\Bundler'
=>
SYS_PATH
.
'cli/tasks/bundle/bundler'
.
EXT
,
'Laravel\\CLI\\Tasks\\Bundle\\Repository'
=>
SYS_PATH
.
'cli/tasks/bundle/repository'
.
EXT
,
'Laravel\\CLI\\Tasks\\Bundle\\Publisher'
=>
SYS_PATH
.
'cli/tasks/bundle/publisher'
.
EXT
,
'Laravel\\CLI\\Tasks\\Bundle\\Providers\\Provider'
=>
SYS_PATH
.
'cli/tasks/bundle/providers/provider'
.
EXT
,
'Laravel\\CLI\\Tasks\\Bundle\\Providers\\Github'
=>
SYS_PATH
.
'cli/tasks/bundle/providers/github'
.
EXT
,
'Laravel\\CLI\\Tasks\\Migrate\\Migrator'
=>
SYS_PATH
.
'cli/tasks/migrate/migrator'
.
EXT
,
'Laravel\\CLI\\Tasks\\Migrate\\Resolver'
=>
SYS_PATH
.
'cli/tasks/migrate/resolver'
.
EXT
,
'Laravel\\CLI\\Tasks\\Migrate\\Database'
=>
SYS_PATH
.
'cli/tasks/migrate/database'
.
EXT
,
'Laravel\\CLI\\Tasks\\Key'
=>
SYS_PATH
.
'cli/tasks/key'
.
EXT
,
'Laravel\\CLI\\Tasks\\Session\\Manager'
=>
SYS_PATH
.
'cli/tasks/session/manager'
.
EXT
,
'Laravel\\Database\\Connection'
=>
SYS_PATH
.
'database/connection'
.
EXT
,
'Laravel\\Database\\Expression'
=>
SYS_PATH
.
'database/expression'
.
EXT
,
'Laravel\\Database\\Query'
=>
SYS_PATH
.
'database/query'
.
EXT
,
'Laravel\\Database\\Schema'
=>
SYS_PATH
.
'database/schema'
.
EXT
,
'Laravel\\Database\\Grammar'
=>
SYS_PATH
.
'database/grammar'
.
EXT
,
'Laravel\\Database\\Connectors\\Connector'
=>
SYS_PATH
.
'database/connectors/connector'
.
EXT
,
'Laravel\\Database\\Connectors\\MySQL'
=>
SYS_PATH
.
'database/connectors/mysql'
.
EXT
,
'Laravel\\Database\\Connectors\\Postgres'
=>
SYS_PATH
.
'database/connectors/postgres'
.
EXT
,
'Laravel\\Database\\Connectors\\SQLite'
=>
SYS_PATH
.
'database/connectors/sqlite'
.
EXT
,
'Laravel\\Database\\Connectors\\SQLServer'
=>
SYS_PATH
.
'database/connectors/sqlserver'
.
EXT
,
'Laravel\\Database\\Query\\Grammars\\Grammar'
=>
SYS_PATH
.
'database/query/grammars/grammar'
.
EXT
,
'Laravel\\Database\\Query\\Grammars\\MySQL'
=>
SYS_PATH
.
'database/query/grammars/mysql'
.
EXT
,
'Laravel\\Database\\Query\\Grammars\\SQLServer'
=>
SYS_PATH
.
'database/query/grammars/sqlserver'
.
EXT
,
'Laravel\\Database\\Schema\\Table'
=>
SYS_PATH
.
'database/schema/table'
.
EXT
,
'Laravel\\Database\\Schema\\Grammars\\Grammar'
=>
SYS_PATH
.
'database/schema/grammars/grammar'
.
EXT
,
'Laravel\\Database\\Schema\\Grammars\\MySQL'
=>
SYS_PATH
.
'database/schema/grammars/mysql'
.
EXT
,
'Laravel\\Database\\Schema\\Grammars\\Postgres'
=>
SYS_PATH
.
'database/schema/grammars/postgres'
.
EXT
,
'Laravel\\Database\\Schema\\Grammars\\SQLServer'
=>
SYS_PATH
.
'database/schema/grammars/sqlserver'
.
EXT
,
'Laravel\\Database\\Schema\\Grammars\\SQLite'
=>
SYS_PATH
.
'database/schema/grammars/sqlite'
.
EXT
,
'Laravel\\Routing\\Controller'
=>
SYS_PATH
.
'routing/controller'
.
EXT
,
'Laravel\\Routing\\Filter'
=>
SYS_PATH
.
'routing/filter'
.
EXT
,
'Laravel\\Routing\\Filter_Collection'
=>
SYS_PATH
.
'routing/filter'
.
EXT
,
'Laravel\\Routing\\Route'
=>
SYS_PATH
.
'routing/route'
.
EXT
,
'Laravel\\Routing\\Router'
=>
SYS_PATH
.
'routing/router'
.
EXT
,
'Laravel\\Session\\Payload'
=>
SYS_PATH
.
'session/payload'
.
EXT
,
'Laravel\\Session\\Drivers\\APC'
=>
SYS_PATH
.
'session/drivers/apc'
.
EXT
,
'Laravel\\Session\\Drivers\\Cookie'
=>
SYS_PATH
.
'session/drivers/cookie'
.
EXT
,
'Laravel\\Session\\Drivers\\Database'
=>
SYS_PATH
.
'session/drivers/database'
.
EXT
,
'Laravel\\Session\\Drivers\\Driver'
=>
SYS_PATH
.
'session/drivers/driver'
.
EXT
,
'Laravel\\Session\\Drivers\\File'
=>
SYS_PATH
.
'session/drivers/file'
.
EXT
,
'Laravel\\Session\\Drivers\\Memcached'
=>
SYS_PATH
.
'session/drivers/memcached'
.
EXT
,
'Laravel\\Session\\Drivers\\Redis'
=>
SYS_PATH
.
'session/drivers/redis'
.
EXT
,
'Laravel\\Session\\Drivers\\Sweeper'
=>
SYS_PATH
.
'session/drivers/sweeper'
.
EXT
,
);
/**
/**
* Register all of the core class aliases. These aliases provide a
* Register all of the core class aliases. These aliases provide a
...
...
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