Documentation

UserExtended extends Module

User Extended by Shawn Clake Class UserExtended User Extended is licensed under the MIT license.

Tags
author

Shawn Clake shawn.clake@gmail.com

link
https://github.com/ShawnClake/UserExtended
license

https://github.com/ShawnClake/UserExtended/blob/master/LICENSE MIT

UserExtended Modular Control

Extend this class to build a module for UserExtended.

Usage example: Module Name: clakeForum Function Call: getUserActivity() Then the call would look like: UserExtended::clakeForum()->getUserActivity();

In order to add your module to the module registry you must create an instance of your extensible class on run inside of your plugin's plugin.php

Table of Contents

$author  : null
The full name of the author of the plugin For example: Shawn Clake
$description  : null
A brief description of the module's purpose In the case of the forum module the description might be something like: "Provides user stats and forum content for other plugins to easily utilize"
$name  : null
The name of the module Please use the syntax of authorModuleName
$version  : null
The version the module is running on.
$visible  : bool
Whether or not other modules are able to access your modules extensible class.
$assets  : array<string|int, mixed>
Asset injection registry
$bonds  : array<string|int, mixed>
Bonds injection registry These are for injecting more relation states between users
$components  : array<string|int, mixed>
Component injection registry
$lang  : array<string|int, mixed>
Lang injection registry
$modules  : array<string|int, mixed>
The module registry An array of all the registered modules. This is populated at runtime.
$navigation  : array<string|int, mixed>
Navigation injection registry
$settings  : array<string|int, mixed>
Stores an array of settings from the backend module manager page.
__callStatic()  : bool
Utilize a registered module The call might look like: UserExtended::clakeForum()->getUserActivity();
__construct()  : mixed
UserExtended constructor.
boot()  : mixed
The boot function should be called once from the UserExtended plugin.
dumpModules()  : mixed
Dumps the contents of all the registered modules.
getAssets()  : mixed
Returns the injected assets
getAuthor()  : null
Returns the modules author
getBonds()  : array<string|int, mixed>
Returns the injected bonds
getComponents()  : array<string|int, mixed>
Returns the injected components
getDescription()  : null
Returns the modules description
getDocumentation()  : array<string|int, mixed>
Returns an array of documentation for the module Returns documentation in MD or html format back to display on the module manager.
getLang()  : array<string|int, mixed>
Returns the injected lang
getModule()  : bool|UserExtended
Returns a loaded module by name Useful for grabbing a specific module for debugging by looking at its values.
getModules()  : array<string|int, mixed>
Returns all modules
getModuleVersion()  : bool
Returns the version of a loaded module Useful for ensuring code doesn't break if modules get updated.
getName()  : null
Returns the modules name
getNavigation()  : array<string|int, mixed>
Returns the injected navigation
getSettings()  : array<string|int, mixed>
Returns the injected settings
getUpdateNotes()  : array<string|int, mixed>
Returns an array of update notes for the module Returns an array where the key is the version number and value at that key is the update notes for that version.
getVersion()  : null
Returns the modules version
getVisible()  : bool
Returns the modules visibility state
initialize()  : mixed
Called after all the modules are loaded.
injectAssets()  : mixed
Override with an assets array to inject assets into UserExtended
injectBonds()  : mixed
Override with a bonds array to inject bonds into UserExtended
injectComponents()  : mixed
Override with an array to inject components into UserExtended
injectLang()  : mixed
Override with a lang array to inject lang into UserExtended
injectNavigation()  : mixed
Override with an array to inject navigation into UserExtended
isModuleLoaded()  : bool
Determines whether a module is loaded or not.
register()  :
registerFactory()  : mixed
Allows us to use a factory pattern for registering modules. IE. syntax becomes ModuleClass::register(); instead of $module = new ModuleClass();
fixDuplicates()  : mixed
Renames component codes in the case that several components are injected with the same component code.
initializeModules()  : mixed
Runs the initialize function on each module
inject()  : mixed
Preforms the module injection
registerModule()  : mixed
Creates a module record for the module registry.
setup()  : mixed
Sets up the class via getting settings

Properties

$author

The full name of the author of the plugin For example: Shawn Clake

public null $author = ''

$description

A brief description of the module's purpose In the case of the forum module the description might be something like: "Provides user stats and forum content for other plugins to easily utilize"

public null $description = ''

$name

The name of the module Please use the syntax of authorModuleName

public null $name = ''

$version

The version the module is running on.

public null $version = ''

For example: 0.0.1

$visible

Whether or not other modules are able to access your modules extensible class.

public bool $visible = true

Typically this should always be true, the only cases where you would want to override this would be if your module does not provide any extra functions for other modules to use.

$assets

Asset injection registry

private static array<string|int, mixed> $assets = []

$bonds

Bonds injection registry These are for injecting more relation states between users

private static array<string|int, mixed> $bonds = []

$components

Component injection registry

private static array<string|int, mixed> $components = []

$lang

Lang injection registry

private static array<string|int, mixed> $lang = []

$modules

The module registry An array of all the registered modules. This is populated at runtime.

private static array<string|int, mixed> $modules = []

$navigation

Navigation injection registry

private static array<string|int, mixed> $navigation = []

$settings

Stores an array of settings from the backend module manager page.

private static array<string|int, mixed> $settings = []

These determine whether or not modules will be loaded, and enable/disable injections

Methods

__callStatic()

Utilize a registered module The call might look like: UserExtended::clakeForum()->getUserActivity();

public static __callStatic( $name,  $args) : bool
Parameters
$name :
$args :
Return values
bool

__construct()

UserExtended constructor.

public __construct() : mixed

This will return false if the child class doesn't have the required class properties This will then register the module and inject what the modules specifies to inject.

Return values
mixed

boot()

The boot function should be called once from the UserExtended plugin.

public static boot() : mixed

Don't override this function and don't use it otherwise you may break the modular load.

Return values
mixed

dumpModules()

Dumps the contents of all the registered modules.

public static dumpModules() : mixed

This is useful for debugging

Return values
mixed

getAssets()

Returns the injected assets

public static getAssets() : mixed
Return values
mixed

getAuthor()

Returns the modules author

public getAuthor() : null
Return values
null

getBonds()

Returns the injected bonds

public static getBonds() : array<string|int, mixed>
Return values
array<string|int, mixed>

getComponents()

Returns the injected components

public static getComponents() : array<string|int, mixed>
Return values
array<string|int, mixed>

getDescription()

Returns the modules description

public getDescription() : null
Return values
null

getDocumentation()

Returns an array of documentation for the module Returns documentation in MD or html format back to display on the module manager.

public getDocumentation() : array<string|int, mixed>

The key is the page name in slug form and the value is the documentation content for that page.

Return values
array<string|int, mixed>

getLang()

Returns the injected lang

public static getLang() : array<string|int, mixed>
Return values
array<string|int, mixed>

getModule()

Returns a loaded module by name Useful for grabbing a specific module for debugging by looking at its values.

public static getModule( $moduleName) : bool|UserExtended

If you want to run operations on the module, use the static call method instead.

Parameters
$moduleName :
Return values
bool|UserExtended

getModules()

Returns all modules

public static getModules() : array<string|int, mixed>
Return values
array<string|int, mixed>

getModuleVersion()

Returns the version of a loaded module Useful for ensuring code doesn't break if modules get updated.

public static getModuleVersion( $moduleName) : bool

Also useful if you want to provide multiple versions of the same module.

Parameters
$moduleName :
Return values
bool

getName()

Returns the modules name

public getName() : null
Return values
null

getNavigation()

Returns the injected navigation

public static getNavigation() : array<string|int, mixed>
Return values
array<string|int, mixed>

getSettings()

Returns the injected settings

public static getSettings() : array<string|int, mixed>
Return values
array<string|int, mixed>

getUpdateNotes()

Returns an array of update notes for the module Returns an array where the key is the version number and value at that key is the update notes for that version.

public getUpdateNotes() : array<string|int, mixed>
Return values
array<string|int, mixed>

getVersion()

Returns the modules version

public getVersion() : null
Return values
null

getVisible()

Returns the modules visibility state

public getVisible() : bool
Return values
bool

initialize()

Called after all the modules are loaded.

public abstract initialize() : mixed
Return values
mixed

injectAssets()

Override with an assets array to inject assets into UserExtended

public abstract injectAssets() : mixed
Return values
mixed

injectBonds()

Override with a bonds array to inject bonds into UserExtended

public abstract injectBonds() : mixed
Return values
mixed

injectComponents()

Override with an array to inject components into UserExtended

public abstract injectComponents() : mixed
Return values
mixed

injectLang()

Override with a lang array to inject lang into UserExtended

public abstract injectLang() : mixed
Return values
mixed

injectNavigation()

Override with an array to inject navigation into UserExtended

public abstract injectNavigation() : mixed
Return values
mixed

isModuleLoaded()

Determines whether a module is loaded or not.

public static isModuleLoaded( $moduleName) : bool

Useful for debugging

Parameters
$moduleName :
Return values
bool

registerFactory()

Allows us to use a factory pattern for registering modules. IE. syntax becomes ModuleClass::register(); instead of $module = new ModuleClass();

public registerFactory() : mixed
Return values
mixed

fixDuplicates()

Renames component codes in the case that several components are injected with the same component code.

private static fixDuplicates() : mixed

This helps to avoid the 'duplicate component' error. If 4 components have the same code ( userSettings ), the 4 components, in order of registration, will have the following codes:

  1. userSettings
  2. userSettingsClassName where ClassName is the class name of the component
  3. userSettingsClassName1
  4. userSettingsClassName2 It will continue to append an increasing number for any further tie breakers.
Return values
mixed

initializeModules()

Runs the initialize function on each module

private static initializeModules() : mixed
Return values
mixed

inject()

Preforms the module injection

private inject() : mixed
Return values
mixed

registerModule()

Creates a module record for the module registry.

private registerModule() : mixed

The module registry has the format: [moduleName=>moduleRecord]

Return values
mixed

setup()

Sets up the class via getting settings

private setup() : mixed
Return values
mixed

Search results