core/model/modx/registry/modregistry.class.php
Represents a collection of message registers.
A register can consist of loggable audit events, error events, debug events, and any other messages that may be sent to a message queue and later retrieved or redirected to some other output source. Some key features will include:
-Logging of registry transactions to file or DB -Tracking progress of asynchonous processes -Can serve as a generic message queue, where MODX elements can register new messages or grab the latest messages via scheduled or ad hoc requests.
- Package
- modx
- Subpackage
- registry
- Todo
- Encapsulate all debugging, error handling, error reporting, and audit logging features into appropriate registers.
\modRegistry
Represents a collection of message registers.
A register can consist of loggable audit events, error events, debug events, and any other messages that may be sent to a message queue and later retrieved or redirected to some other output source. Some key features will include:
-Logging of registry transactions to file or DB -Tracking progress of asynchonous processes -Can serve as a generic message queue, where MODX elements can register new messages or grab the latest messages via scheduled or ad hoc requests.
- Todo
- Encapsulate all debugging, error handling, error reporting, and audit logging features into appropriate registers.
Properties

array
$_invalidKeys= 'array(
'modx',
)'
An array of register keys that are reserved from use.
array(
'modx',
)Details- Type
- array
- Access
- protected

\modRegister
$_loggingRegister= 'null'
nullDetails- Type
- \modRegister

array
$_options= 'array()'
An array of global options applied to the registry.
array()Details- Type
- array
- Access
- protected

integer
$_prevLogLevel= 'null'
nullDetails- Type
- integer

string
$_prevLogTarget= 'null'
nullDetails- Type
- string

array
$_registers= 'array()'
An array of MODX registers managed by the registry.
array()Details- Type
- array
- Access
- private

\modX
$modx= 'null'
A reference to the modX instance the registry is loaded by.
nullDetails- Type
- \modX
- Access
- public
Methods

__construct(
\modX $modx, array $options
=
array()
)
:
voidConstruct a new registry instance.
| Name | Type | Description |
|---|---|---|
| $modx | \modX | &$modx A reference to a modX instance. |
| $options | array | Optional array of registry options. |

_initRegister(
string $key, string $class, array $options
=
array()
)
:
\modRegisterInitialize a register within the registry.
| Name | Type | Description |
|---|---|---|
| $key | string | The key of the registry |
| $class | string | The class of the modRegister implementation to initialize. |
| $options | array | An optional array of register options. |
| Type | Description |
|---|---|
| \modRegister | The register instance. |
- Access
- protected

addRegister(
string $key, string $class, array $options
=
array()
)
:
voidAdd a modRegister instance to the registry.
Once a register is added, it is available directly from this registry instance by the key provided, e.g. $registry->key.
| Name | Type | Description |
|---|---|---|
| $key | string | A unique name for the register in the registry. Must be a valid PHP variable string. |
| $class | string | The actual modRegister derivative which implements the register functionality. |
| $options | array | An optional array of register options. |
- Access
- public

getRegister(
string $key, string $class, array $options
=
array()
)
:
\modRegisterGet a modRegister instance from the registry.
If the register does not exist, it is added to the registry.
| Name | Type | Description |
|---|---|---|
| $key | string | A unique name for the register in the registry. Must be a valid PHP variable string. |
| $class | string | The actual modRegister derivative which implements the register functionality. |
| $options | array | An optional array of register options. |
| Type | Description |
|---|---|
| \modRegister | A modRegister instance. |
- Access
- public

isLogging(
)
:
booleanCheck if logging is currently active
| Type | Description |
|---|---|
| boolean |
- Access
- public

removeRegister(
string $key
)
:
voidRemove a modRegister instance from the registry.
| Name | Type | Description |
|---|---|---|
| $key | string | The unique name of the register to remove. |
- Access
- public

setLogging(
\modRegister $register, string $topic, int $level
=
modX::LOG_LEVEL_ERROR
)
:
booleanSet the logging level for the topic.
| Name | Type | Description |
|---|---|---|
| $register | \modRegister | &$register |
| $topic | string | |
| $level | int |
| Type | Description |
|---|---|
| boolean | True if successful. |
- Access
- public