Documentation

Module extends UserExtended
in package
Uses StaticFactoryTrait

User Extended Core by Shawn Clake Class Module 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

Table of Contents

$author  : mixed
$description  : mixed
$name  : mixed
$version  : mixed
$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.
addUserToGroup()  : bool
Programmatically adds a user to a group
addUserToRole()  : bool
Programmatically adds a user to a role
bondExists()  : bool
Checks whether a bond state exists between the logged in user and the user specified by $userId
boot()  : mixed
The boot function should be called once from the UserExtended plugin.
dumpModules()  : mixed
Dumps the contents of all the registered modules.
factory()  : mixed
Helper function which can also be used to simply create an instance of a child class in cases where initialization functions aren't needed.
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 the plugin documentation for display in the Module Manager
getLang()  : array<string|int, mixed>
Returns the injected lang
getLoggedInUser()  : UserExtended|User
Returns the logged in user. Optional param $return_type is a flag for which type of user object to return
getLoggedInUsersTimezone()  : string|null
Returns the timezone code for the logged in user
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 the plugin version notes for display in the Module Manager
getUser()  : UserExtended
Returns a user with $property col = $value
getUsers()  : User
Returns users with $property col = $value
getUserSettings()  : array<string|int, mixed>
Returns an array of UserSettings
getUserTimezone()  : null|string
Returns the timezone code for a user who's $property col = $value
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
isLoggedIn()  : bool
Returns whether or not a user is logged in
isModuleLoaded()  : bool
Determines whether a module is loaded or not.
loginUser()  : mixed
Programmatically logs in a user The $data array requires the following indices: password, email or username (Depends on the default login field)
logoutUser()  : mixed
Programmatically logs out the currently logged in user
register()  :
registerFactory()  : mixed
Allows us to use a factory pattern for registering modules. IE. syntax becomes ModuleClass::register(); instead of $module = new ModuleClass();
registerUser()  : bool|mixed
Programmatically registers a user.
removeUserFromGroup()  : bool
Programmatically removes a user from a group
removeUserFromRole()  : bool
Programmatically removes a user from a role.
searchUsers()  : UserExtended
Returns a set of UserExtended models from users found with username, surname, firstname, or email containing $phrase
updateUser()  : bool|
Programmatically update a user. Defaults to logged in user if a UserExtended object isn't passed in.
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

public mixed $author = "Shawn Clake"

$description

public mixed $description = "User Extended Core contains all of the components, navigation, assets, utility functions, and documentation which User Extended depends on."

$name

public mixed $name = "clakeUserExtended"

$version

public mixed $version = "2.2.00"

$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

addUserToGroup()

Programmatically adds a user to a group

public addUserToGroup( $groupCode[, null $user = null ]) : bool
Parameters
$groupCode :
$user : null = null
Return values
bool

addUserToRole()

Programmatically adds a user to a role

public addUserToRole( $roleCode[, null $user = null ]) : bool
Parameters
$roleCode :
$user : null = null
Return values
bool

bondExists()

Checks whether a bond state exists between the logged in user and the user specified by $userId

public bondExists( $bond,  $userId) : bool
Parameters
$bond :
$userId :
Return values
bool

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

factory()

Helper function which can also be used to simply create an instance of a child class in cases where initialization functions aren't needed.

public static factory() : mixed

Generally you will want to use the static magic method below.

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 the plugin documentation for display in the Module Manager

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

getLang()

Returns the injected lang

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

getLoggedInUser()

Returns the logged in user. Optional param $return_type is a flag for which type of user object to return

public getLoggedInUser([string $return_type = "ue" ]) : UserExtended|User
Parameters
$return_type : string = "ue"
Return values
UserExtended|User

getLoggedInUsersTimezone()

Returns the timezone code for the logged in user

public getLoggedInUsersTimezone() : string|null
Return values
string|null

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 the plugin version notes for display in the Module Manager

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

getUser()

Returns a user with $property col = $value

public getUser( $value[, string $property = "id" ]) : UserExtended
Parameters
$value :
$property : string = "id"
Return values
UserExtended

getUsers()

Returns users with $property col = $value

public getUsers( $value[, string $property = "name" ]) : User
Parameters
$value :
$property : string = "name"
Return values
User

getUserSettings()

Returns an array of UserSettings

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

getUserTimezone()

Returns the timezone code for a user who's $property col = $value

public getUserTimezone( $value[, string $property = "id" ]) : null|string
Parameters
$value :
$property : string = "id"
Return values
null|string

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 initialize() : mixed
Return values
mixed

injectAssets()

Override with an assets array to inject assets into UserExtended

public injectAssets() : mixed
Return values
mixed

injectBonds()

Override with a bonds array to inject bonds into UserExtended

public injectBonds() : mixed
Return values
mixed

injectComponents()

Override with an array to inject components into UserExtended

public injectComponents() : mixed
Return values
mixed

injectLang()

Override with a lang array to inject lang into UserExtended

public injectLang() : mixed
Return values
mixed

injectNavigation()

Override with an array to inject navigation into UserExtended

public injectNavigation() : mixed
Return values
mixed

isLoggedIn()

Returns whether or not a user is logged in

public isLoggedIn( $userId) : bool
Parameters
$userId :
Return values
bool

isModuleLoaded()

Determines whether a module is loaded or not.

public static isModuleLoaded( $moduleName) : bool

Useful for debugging

Parameters
$moduleName :
Return values
bool

loginUser()

Programmatically logs in a user The $data array requires the following indices: password, email or username (Depends on the default login field)

public loginUser(array<string|int, mixed> $data) : mixed
Parameters
$data : array<string|int, mixed>
Return values
mixed

logoutUser()

Programmatically logs out the currently logged in user

public logoutUser() : mixed
Return values
mixed

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

registerUser()

Programmatically registers a user.

public registerUser(array<string|int, mixed> $data) : bool|mixed

The $data array requires the following indices: email, password, password_confirmation The $data array can optional have the following indices: username, name The $data array also supports dynamic user settings. The index names are the same as the setting code found in user_settings.yaml

Parameters
$data : array<string|int, mixed>
Return values
bool|mixed

removeUserFromGroup()

Programmatically removes a user from a group

public removeUserFromGroup( $groupCode[, null $user = null ]) : bool
Parameters
$groupCode :
$user : null = null
Return values
bool

removeUserFromRole()

Programmatically removes a user from a role.

public removeUserFromRole( $roleCode[, null $user = null ]) : bool
Parameters
$roleCode :
$user : null = null
Return values
bool

searchUsers()

Returns a set of UserExtended models from users found with username, surname, firstname, or email containing $phrase

public searchUsers( $phrase) : UserExtended
Parameters
$phrase :
Return values
UserExtended

updateUser()

Programmatically update a user. Defaults to logged in user if a UserExtended object isn't passed in.

public updateUser(array<string|int, mixed> $data[, UserExtended|null $user = null ]) : bool|

The $data array can contain the following indices: email, password, password_confirmation, username, name The $data array also supports dynamic user settings. The index names are the same as the setting code found in user_settings.yaml

Parameters
$data : array<string|int, mixed>
$user : UserExtended|null = null
Return values
bool|

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