Class Zend_Loader

Description

Static methods for loading classes and files.

  • copyright: Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  • license: New BSD License

Located in /Loader.php (line 30)


	
			
Method Summary
 static string|false autoload (string $class)
 static array explodeIncludePath ([string|null $path = null])
 static boolean isReadable (string $filename)
 static void loadClass (string $class, [string|array $dirs = null])
 static boolean loadFile (string $filename, [string|array $dirs = null], [boolean $once = false])
 static void registerAutoload ([string $class = 'Zend_Loader'], [boolean $enabled = true])
 static boolean _includeFile (string $filespec, [boolean $once = false])
 static void _securityCheck (string $filename)
Methods
static autoload (line 243)

spl_autoload() suitable implementation for supporting class autoloading.

Attach to spl_autoload() using the following:

  1.  spl_autoload_register(array('Zend_Loader''autoload'));

  • return: Class name on success; false on failure
  • deprecated: Since 1.8.0
  • access: public
static string|false autoload (string $class)
  • string $class
static explodeIncludePath (line 214)

Explode 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.

  • access: public
static array explodeIncludePath ([string|null $path = null])
  • string|null $path
static isReadable (line 174)

Returns 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.

  • access: public
static boolean isReadable (string $filename)
  • string $filename
static loadClass (line 52)

Loads 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.

  • throws: Zend_Exception
  • access: public
static void loadClass (string $class, [string|array $dirs = null])
  • string $class:
    • The full class name of a Zend component.
  • string|array $dirs: - OPTIONAL Either a path or an array of paths to search.
static loadFile (line 126)

Loads 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().

  • throws: Zend_Exception
  • access: public
static boolean loadFile (string $filename, [string|array $dirs = null], [boolean $once = false])
  • string $filename
  • string|array $dirs: - OPTIONAL either a path or array of paths to search.
  • boolean $once
static registerAutoload (line 264)

Register autoload() with spl_autoload()

  • deprecated: Since 1.8.0
  • throws: Zend_Exception if spl_autoload() is not found or if the specified class does not have an autoload() method.
  • access: public
static void registerAutoload ([string $class = 'Zend_Loader'], [boolean $enabled = true])
  • string $class: (optional)
  • boolean $enabled: (optional)
static _includeFile (line 321)

Attempt 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!

  • deprecated: Since 1.5.0; use loadFile() instead
  • access: protected
static boolean _includeFile (string $filespec, [boolean $once = false])
  • string $filespec
  • boolean $once
static _securityCheck (line 296)

Ensure that filename does not contain exploits

  • throws: Zend_Exception
  • access: protected
static void _securityCheck (string $filename)
  • string $filename

Documentation generated on Mon, 21 Jun 2010 15:31:34 -0400 by phpDocumentor 1.4.3