Source for file Loader.php
Documentation is available at Loader.php
* "THE BEER-WARE LICENSE" (Revision 42):
* "Sven Strittmatter" <ausserirdisch@sven-space.de> wrote this file.
* As long as you retain this notice you can do whatever you want with
* this stuff. If we meet some day, and you think this stuff is worth it,
* you can buy me a beer in return.
* @package Console_Application
* @copyright Copyright (c) 2009 Sven Strittmatter
require_once('Console/Exception.php');
* Class for running a Console_Application_Abstract-Script.
* @package Console_Application
* @uses Console_Exception
* @copyright Copyright (c) 2009 Sven Strittmatter
* Loads a class depending on the class name.
* All _ in the classname are replaced with DIRECTORY_SEPARATOR.
* @throws Console_Exception If the generated filename is not valid
* @throws Console_Exception If the file is not readable
* @throws Console_Exception If the file doesnt contain the class/interface
$file = str_replace('_', DIRECTORY_SEPARATOR, $name) . '.php';
if (!self::isFileNameValid($file)) {
$message = 'Illegal character in filename: ' . $file;
if (!self::isReadable($file)) {
$message = "File: $file is not readable!";
$message = "Class or interface '$name' ";
$message .= "was not found in the file '$file'";
* Checks if a file is readable.
* @param string $filename
if (!$fh = @fopen($filename, 'r', true)) {
* Checks if a filename is valid.
* @param string $filename
if (0 === preg_match('/[^a-z0-9\\/\\\\_.:-]/i', $filename)) {
|