Collection of components related methods.
More...
|
static | classloader ($classname) |
| Class loader for Frankenstyle named classes in standard locations.
|
|
static | get_cache_content () |
| Create cache file content.
|
|
static | register_autoloader () |
| Register the Moodle class autoloader.
|
|
static | reset (bool $fullreset=false,) |
| Reset the initialisation of the component utility.
|
|
|
static | fetch_apis () |
| Returns list of core APIs.
|
|
static | fetch_component_source (string $key) |
| Returns the component source content as loaded from /lib/components.json.
|
|
static | fetch_core_version () |
| Get the core version.
|
|
static | fetch_plugintypes () |
| Returns list of known plugin types.
|
|
static | fetch_subsystems () |
| Returns list of core subsystems.
|
|
static | fetch_subtypes ($ownerdir) |
| Returns list of subtypes.
|
|
static | fill_all_caches () |
| Fill all caches.
|
|
static | get_class_file ($class, $prefix, $path, $separators) |
| Return the path to the class based on the given namespace prefix and path it corresponds to.
|
|
static | init () |
| Initialise caches, always call before accessing self:: caches.
|
|
static | is_cache_valid (array $cache) |
| Check whether the cache content in the supplied cache is valid.
|
|
static | is_developer () |
| Are we in developer debug mode?
|
|
static | psr_classloader ($class) |
| Return the path to a class from our defined PSR-0 or PSR-4 standard namespaces on demand.
|
|
|
static array | $apis = null |
| cache of core APIs
|
|
static array | $classmap = null |
| list of all known classes that can be autoloaded
|
|
static array | $classmaprenames = null |
| list of all classes that have been renamed to be autoloaded
|
|
static object | $componentsource = null |
| JSON source of the component data.
|
|
static array< string > | $composerautoloadfiles |
| An array containing files which are normally in a package's composer/autoload.files section.
|
|
static array | $deletedplugins = null |
| deleted plugins
|
|
static array | $deletedplugintypes = null |
| deleted plugin types
|
|
static array | $deletedsubplugins = null |
| deleted sub plugins
|
|
static array | $deprecatedplugins = null |
| deprecated plugins
|
|
static array | $deprecatedplugintypes = null |
| deprecated plugin types
|
|
static array | $deprecatedsubplugins = null |
| deprecated sub plugins
|
|
static array | $filemap = null |
| list of some known files that can be included.
|
|
static array | $filestomap = ['lib.php', 'settings.php'] |
| list of the files to map.
|
|
static array | $ignoreddirs |
| list of ignored directories in plugin type roots - watch out for auth/db exception
|
|
static array | $parents = null |
| subplugin type parents
|
|
static array | $plugins = null |
| cache of plugin locations
|
|
static array | $plugintypes = null |
| cache of plugin types
|
|
static array | $psr0namespaces |
| associative array of PSR-0 namespaces and corresponding paths.
|
|
static array< string|array< string > > | $psr4namespaces |
| associative array of PRS-4 namespaces and corresponding paths.
|
|
static array | $subplugins = null |
| subplugins
|
|
static array | $subsystems = null |
| cache of core subsystems
|
|
static array | $supportsubplugins = ['mod', 'editor', 'tool', 'local'] |
| list plugin types that support subplugins, do not add more here unless absolutely necessary
|
|
static int float | $version = null |
| core version.
|
|
Collection of components related methods.
◆ classloader()
static core\component::classloader |
( |
| $classname | ) |
|
|
static |
Class loader for Frankenstyle named classes in standard locations.
Frankenstyle namespaces are supported.
The expected location for core classes is: 1/ core_xx_yy_zz ---> lib/classes/xx_yy_zz.php 2/ core::xx_yy_zz ---> lib/classes/xx_yy_zz.php 3/ core::xx::yy_zz ---> lib/classes/xx/yy_zz.php
The expected location for plugin classes is: 1/ mod_name_xx_yy_zz ---> mod/name/classes/xx_yy_zz.php 2/ mod_name::xx_yy_zz ---> mod/name/classes/xx_yy_zz.php 3/ mod_name::xx::yy_zz ---> mod/name/classes/xx/yy_zz.php
- Parameters
-
◆ fetch_apis()
static core\component::fetch_apis |
( |
| ) |
|
|
staticprotected |
Returns list of core APIs.
- Return values
-
◆ fetch_component_source()
static core\component::fetch_component_source |
( |
string | $key | ) |
|
|
staticprotected |
Returns the component source content as loaded from /lib/components.json.
- Return values
-
◆ fetch_core_version()
static core\component::fetch_core_version |
( |
| ) |
|
|
staticprotected |
Get the core version.
In order for this to work properly, opcache should be reset beforehand.
- Return values
-
◆ fetch_plugintypes()
static core\component::fetch_plugintypes |
( |
| ) |
|
|
staticprotected |
Returns list of known plugin types.
- Return values
-
◆ fetch_subsystems()
static core\component::fetch_subsystems |
( |
| ) |
|
|
staticprotected |
Returns list of core subsystems.
- Return values
-
◆ fetch_subtypes()
static core\component::fetch_subtypes |
( |
| $ownerdir | ) |
|
|
staticprotected |
Returns list of subtypes.
- Parameters
-
- Return values
-
◆ get_cache_content()
static core\component::get_cache_content |
( |
| ) |
|
|
static |
Create cache file content.
this is intended for $CFG->alternative_component_cache only.
- Return values
-
◆ get_class_file()
static core\component::get_class_file |
( |
| $class, |
|
|
| $prefix, |
|
|
| $path, |
|
|
| $separators ) |
|
staticprotected |
Return the path to the class based on the given namespace prefix and path it corresponds to.
Will return the path even if the file does not exist. Check the file esists before requiring.
- Parameters
-
string | $class | the name of the class. |
string | $prefix | The namespace prefix used to identify the base directory of the source files. |
string | $path | The relative path to the base directory of the source files. |
string[] | $separators | The characters that should be used for separating. |
- Return values
-
string|bool | The full path to the file defining the class. Or false if it could not be resolved. |
◆ is_cache_valid()
static core\component::is_cache_valid |
( |
array | $cache | ) |
|
|
staticprotected |
Check whether the cache content in the supplied cache is valid.
- Parameters
-
array | $cache | The content being loaded |
- Return values
-
◆ is_developer()
static core\component::is_developer |
( |
| ) |
|
|
staticprotected |
Are we in developer debug mode?
Note: You need to set "$CFG->debug = (E_ALL);" in config.php, the reason is we need to use this before we setup DB connection or caches for CFG.
- Return values
-
◆ psr_classloader()
static core\component::psr_classloader |
( |
| $class | ) |
|
|
staticprotected |
Return the path to a class from our defined PSR-0 or PSR-4 standard namespaces on demand.
Only returns paths to files that exist.
Adapated from http://www.php-fig.org/psr/psr-4/examples/ and made PSR-0 compatible.
- Parameters
-
string | $class | the name of the class. |
- Return values
-
string|bool | The full path to the file defining the class. Or false if it could not be resolved or does not exist. |
◆ reset()
static core\component::reset |
( |
bool | $fullreset = false | ) |
|
|
static |
Reset the initialisation of the component utility.
Note: It should not be necessary to call this in regular code. Please only use it where strictly required.
◆ $composerautoloadfiles
array<string> core\component::$composerautoloadfiles |
|
staticprotected |
Initial value:= [
'lib/aws-sdk/src/functions.php',
'lib/guzzlehttp/guzzle/src/functions_include.php',
'lib/jmespath/src/JmesPath.php',
'lib/nikic/fast-route/src/functions.php',
'lib/php-di/php-di/src/functions.php',
'lib/ralouphie/getallheaders/src/getallheaders.php',
'lib/symfony/deprecation-contracts/function.php',
]
An array containing files which are normally in a package's composer/autoload.files section.
PHP does not provide a mechanism for automatically including the files that methods are in.
The Composer autoloader includes all files in this section of the composer.json file during the instantiation of the loader.
◆ $ignoreddirs
array core\component::$ignoreddirs |
|
staticprotected |
Initial value:= [
'CVS' => true,
'_vti_cnf' => true,
'amd' => true,
'classes' => true,
'db' => true,
'fonts' => true,
'lang' => true,
'pix' => true,
'simpletest' => true,
'templates' => true,
'tests' => true,
'yui' => true,
]
list of ignored directories in plugin type roots - watch out for auth/db exception
◆ $psr0namespaces
array core\component::$psr0namespaces |
|
staticprotected |
Initial value:= [
'Mustache' => 'lib/mustache/src/Mustache',
]
associative array of PSR-0 namespaces and corresponding paths.
The documentation for this class was generated from the following file:
- lib/classes/component.php