Loader.php
Zend Framework
LICENSE
This source file is subject to the new BSD license that is bundled
with this package in the file LICENSE.txt.
It is also available through the world-wide-web at this URL:
http://framework.zend.com/license/new-bsd
If you did not receive a copy of the license and are unable to
obtain it through the world-wide-web, please send an email
to license@zend.com so we can send you a copy immediately.
- Category
- Zend
- Copyright
- Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Package
- Zend_Loader
- Version
- $Id$
Package: Zend_LoaderStatic methods for loading classes and files.
- Category
- Zend
- Copyright
- Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
Methods
_includeFile(string $filespec, boolean $once = false) : boolean
staticAttempt to include() the file.
include() is not prefixed with the @ operator because if
the file is loaded and contains a parse error, execution
will halt silently and this is difficult to debug.
Always set display_errors = Off on production servers!
ParametersName | Type | Description |
---|
$filespec | string | |
---|
$once | boolean | |
---|
ReturnsDetails- Deprecated
- Since 1.5.0; use loadFile() instead
_securityCheck(string $filename) : void
staticEnsure that filename does not contain exploits
ParametersName | Type | Description |
---|
$filename | string | |
---|
Throws autoload(string $class) : string | false
staticspl_autoload() suitable implementation for supporting class autoloading.
Attach to spl_autoload() using the following:
spl_autoload_register(array('Zend_Loader', 'autoload'));
ParametersName | Type | Description |
---|
$class | string | |
---|
ReturnsType | Description |
---|
string | false | Class name on success; false on failure |
Details- Deprecated
- Since 1.8.0
explodeIncludePath(string | null $path = null) : array
staticExplode an include path into an array
If no path provided, uses current include_path. Works around issues that
occur when the path includes stream schemas.
ParametersName | Type | Description |
---|
$path | string | null | |
---|
ReturnsisReadable(string $filename) : boolean
staticReturns TRUE if the $filename is readable, or FALSE otherwise.
This function uses the PHP include_path, where PHP's is_readable()
does not.
Note from ZF-2900:
If you use custom error handler, please check whether return value
from error_reporting() is zero or not.
At mark of fopen() can not suppress warning if the handler is used.
ParametersName | Type | Description |
---|
$filename | string | |
---|
ReturnsloadClass(string $class, string | array $dirs = null) : void
staticLoads a class from a PHP file. The filename must be formatted
as "$class.php".
If $dirs is a string or an array, it will search the directories
in the order supplied, and attempt to load the first matching file.
If $dirs is null, it will split the class name at underscores to
generate a path hierarchy (e.g., "Zend_Example_Class" will map
to "Zend/Example/Class.php").
If the file was not found in the $dirs, or if no $dirs were specified,
it will attempt to load it from PHP's include_path.
ParametersName | Type | Description |
---|
$class | string |
- The full class name of a Zend component.
|
---|
$dirs | string | array |
- OPTIONAL Either a path or an array of paths
to search.
|
---|
ThrowsloadFile(string $filename, string | array $dirs = null, boolean $once = false) : boolean
staticLoads a PHP file. This is a wrapper for PHP's include() function.
$filename must be the complete filename, including any
extension such as ".php". Note that a security check is performed that
does not permit extended characters in the filename. This method is
intended for loading Zend Framework files.
If $dirs is a string or an array, it will search the directories
in the order supplied, and attempt to load the first matching file.
If the file was not found in the $dirs, or if no $dirs were specified,
it will attempt to load it from PHP's include_path.
If $once is TRUE, it will use include_once() instead of include().
ParametersName | Type | Description |
---|
$filename | string | |
---|
$dirs | string | array |
- OPTIONAL either a path or array of paths
to search.
|
---|
$once | boolean | |
---|
ReturnsThrowsregisterAutoload(string $class = 'Zend_Loader', boolean $enabled = true) : void
staticRegister {@link autoload()} with spl_autoload()
ParametersName | Type | Description |
---|
$class | string | (optional) |
---|
$enabled | boolean | (optional) |
---|
ThrowsException | Description |
---|
\Zend_Exception | if spl_autoload() is not found
or if the specified class does not have an autoload() method. |
Details- Deprecated
- Since 1.8.0
standardiseFile(string $file) : string
staticStandardise the filename.
Convert the supplied filename into the namespace-aware standard,
based on the Framework Interop Group reference implementation:
http://groups.google.com/group/php-standards/web/psr-0-final-proposal
The filename must be formatted as "$file.php".
ParametersName | Type | Description |
---|
$file | string |
- The file name to be loaded.
|
---|
Returns