| [ Index ] |
PHP Cross Reference of MantisBT |
[Source view] [Print] [Project Stats]
File containing the ezcBase class.
| Copyright: | Copyright (C) 2005-2009 eZ Systems AS. All rights reserved. |
| License: | http://ez.no/licenses/new_bsd New BSD License |
| Version: | 1.8 |
| File Size: | 658 lines (22 kb) |
| Included or required: | 1 time |
| Referenced: | 0 times |
| Includes or requires: | 0 files |
ezcBase:: (15 methods):
setOptions()
autoload()
setWorkingDirectory()
setPackageDir()
requireFile()
loadFile()
loadExternalFile()
checkDependency()
getRepositoryDirectories()
addClassRepository()
getInstallationPath()
setRunMode()
getRunMode()
inDevMode()
getInstallMethod()
| setOptions( ezcBaseAutoloadOptions $options ) X-Ref |
| Associates an option object with this static class. param: ezcBaseAutoloadOptions $options |
| autoload( $className ) X-Ref |
| Tries to autoload the given className. If the className could be found this method returns true, otherwise false. This class caches the requested class names (including the ones who failed to load). param: string $className The name of the class that should be loaded. return: bool |
| setWorkingDirectory( $directory ) X-Ref |
| Sets the current working directory to $directory. param: string $directory |
| setPackageDir() X-Ref |
| Figures out the base path of the eZ Components installation. It stores the path that it finds in a static member variable. The path depends on the installation method of the eZ Components. The SVN version has a different path than the PEAR installed version. |
| requireFile( $fileName, $className, $prefix ) X-Ref |
| Tries to load the autoload array and, if loaded correctly, includes the class. param: string $fileName Name of the autoload file. param: string $className Name of the class that should be autoloaded. param: string $prefix The prefix of the class repository. return: bool True is returned when the file is correctly loaded. |
| loadFile( $file ) X-Ref |
| Loads, require(), the given file name. If we are in development mode, "/src/" is inserted into the path. param: string $file The name of the file that should be loaded. |
| loadExternalFile( $file ) X-Ref |
| Loads, require(), the given file name from an external package. param: string $file The name of the file that should be loaded. |
| checkDependency( $component, $type, $value ) X-Ref |
| Checks for dependencies on PHP versions or extensions The function as called by the $component component checks for the $type dependency. The dependency $type is compared against the $value. The function aborts the script if the dependency is not matched. param: string $component param: int $type param: mixed $value |
| getRepositoryDirectories() X-Ref |
| Return the list of directories that contain class repositories. The path to the eZ components directory is always included in the result array. Each element in the returned array has the format of: packageDirectory => ezcBaseRepositoryDirectory return: array(string=>ezcBaseRepositoryDirectory) |
| addClassRepository( $basePath, $autoloadDirPath = null, $prefix = null ) X-Ref |
| Adds an additional class repository. Used for adding class repositoryies outside the eZ components to be loaded by the autoload system. This function takes two arguments: $basePath is the base path for the whole class repository and $autoloadDirPath the path where autoload files for this repository are found. The paths in the autoload files are relative to the package directory as specified by the $basePath argument. I.e. class definition file will be searched at location $basePath + path to the class definition file as stored in the autoload file. addClassRepository() should be called somewhere in code before external classes are used. Example: Take the following facts: <ul> <li>there is a class repository stored in the directory "./repos"</li> <li>autoload files for that repository are stored in "./repos/autoloads"</li> <li>there are two components in this repository: "Me" and "You"</li> <li>the "Me" component has the classes "erMyClass1" and "erMyClass2"</li> <li>the "You" component has the classes "erYourClass1" and "erYourClass2"</li> </ul> In this case you would need to create the following files in "./repos/autoloads". Please note that the part before _autoload.php in the filename is the first part of the <b>classname</b>, not considering the all lower-case letter prefix. "my_autoload.php": <code> <?php return array ( 'erMyClass1' => 'Me/myclass1.php', 'erMyClass2' => 'Me/myclass2.php', ); ?> </code> "your_autoload.php": <code> <?php return array ( 'erYourClass1' => 'You/yourclass1.php', 'erYourClass2' => 'You/yourclass2.php', ); ?> </code> The directory structure for the external repository is then: <code> ./repos/autoloads/my_autoload.php ./repos/autoloads/you_autoload.php ./repos/Me/myclass1.php ./repos/Me/myclass2.php ./repos/You/yourclass1.php ./repos/You/yourclass2.php </code> To use this repository with the autoload mechanism you have to use the following code: <code> <?php ezcBase::addClassRepository( './repos', './repos/autoloads' ); $myVar = new erMyClass2(); ?> </code> param: string $basePath param: string $autoloadDirPath param: string $prefix |
| getInstallationPath() X-Ref |
| Returns the base path of the eZ Components installation This method returns the base path, including a trailing directory separator. return: string |
| setRunMode( $runMode ) X-Ref |
| Sets the development mode to the one specified. param: int $runMode |
| getRunMode() X-Ref |
| Returns the current development mode. return: int |
| inDevMode() X-Ref |
| Returns true when we are in development mode. return: bool |
| getInstallMethod() X-Ref |
| Returns the installation method Possible return values are 'custom', 'devel', 'tarball' and 'pear'. Only 'tarball' and 'pear' are returned for user-installed versions. return: string |
| Generated: Thu Jul 28 15:48:31 2011 | Cross-referenced by PHPXref 0.7 |