Moodle PHP Documentation 4.3
Moodle 4.3.5 (Build: 20240610) (7dcfaa79f78)
|
Collection of components related methods. More...
Static Public Member Functions | |
static | classloader ($classname) |
Class loader for Frankenstyle named classes in standard locations. | |
static | get_cache_content () |
Create cache file content. | |
Static Protected Member Functions | |
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_plugins ($plugintype, $fulldir) |
Returns list of plugins of given type in given directory. | |
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 | fill_classmap_cache () |
Find all classes that can be autoloaded including frankenstyle namespaces. | |
static | fill_filemap_cache () |
Fills up the cache defining what plugins have certain files. | |
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_developer () |
Are we in developer debug mode? | |
static | load_classes ($component, $fulldir, $namespace='') |
Find classes in directory and recurse to subdirs. | |
static | psr_classloader ($class) |
Return the path to a class from our defined PSR-0 or PSR-4 standard namespaces on demand. | |
Static Protected Attributes | |
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 | $filemap = null |
list of some known files that can be included. | |
static array | $filestomap = array('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 = array('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.
|
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
string | $classname |
|
staticprotected |
Returns list of core APIs.
stdClass[] |
|
staticprotected |
Returns the component source content as loaded from /lib/components.json.
array |
|
staticprotected |
Get the core version.
In order for this to work properly, opcache should be reset beforehand.
float | core version. |
|
staticprotected |
Returns list of plugins of given type in given directory.
string | $plugintype | |
string | $fulldir |
array |
|
staticprotected |
Returns list of known plugin types.
array |
|
staticprotected |
Returns list of core subsystems.
array |
|
staticprotected |
Returns list of subtypes.
string | $ownerdir |
array |
|
staticprotected |
Fills up the cache defining what plugins have certain files.
void |
|
static |
Create cache file content.
this is intended for $CFG->alternative_component_cache only.
string |
|
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.
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. |
string|bool | The full path to the file defining the class. Or false if it could not be resolved. |
|
staticprotected |
Are we in developer debug mode?
Note: You need to set "$CFG->debug = (E_ALL | E_STRICT);" in config.php, the reason is we need to use this before we setup DB connection or caches for CFG.
bool |
|
staticprotected |
Find classes in directory and recurse to subdirs.
string | $component | |
string | $fulldir | |
string | $namespace |
|
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.
string | $class | the name of the class. |
string|bool | The full path to the file defining the class. Or false if it could not be resolved or does not exist. |
|
staticprotected |
list of ignored directories in plugin type roots - watch out for auth/db exception
|
staticprotected |
associative array of PSR-0 namespaces and corresponding paths.
|
staticprotected |
associative array of PRS-4 namespaces and corresponding paths.