Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F5978428
Autoloader.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
Autoloader.php
View Options
<?php
/**
* Autoloader
*/
class
Less_Autoloader
{
/** @var bool */
protected
static
$registered
=
false
;
/**
* Register the autoloader in the SPL autoloader
*
* @return void
* @throws Exception If there was an error in registration
*/
public
static
function
register
()
{
if
(
self
::
$registered
)
{
return
;
}
if
(
!
spl_autoload_register
(
[
__CLASS__
,
'loadClass'
]
)
)
{
throw
new
Exception
(
'Unable to register Less_Autoloader::loadClass as an autoloading method.'
);
}
self
::
$registered
=
true
;
}
/**
* Unregister the autoloader
*
* @return void
*/
public
static
function
unregister
()
{
spl_autoload_unregister
(
[
__CLASS__
,
'loadClass'
]
);
self
::
$registered
=
false
;
}
/**
* Load the class
*
* @param string $className The class to load
*/
public
static
function
loadClass
(
$className
)
{
// handle only package classes
if
(
strpos
(
$className
,
'Less_'
)
!==
0
)
{
return
;
}
$className
=
substr
(
$className
,
5
);
$fileName
=
__DIR__
.
DIRECTORY_SEPARATOR
.
str_replace
(
'_'
,
DIRECTORY_SEPARATOR
,
$className
)
.
'.php'
;
require
$fileName
;
return
true
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, Oct 3, 20:24 (3 d, 18 h ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
1f/85/aaef4c05f80d1e76f5b6b6b70aeb
Default Alt Text
Autoloader.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment