Documentation

rex
in package

REX base class for core properties etc.

Tags
author

gharlan

Table of Contents

Constants

CONFIG_NAMESPACE  = 'core'

Properties

$properties  : array<string, mixed>
Array of properties.

Methods

getAccesskey()  : string
Returns the title tag and if the property "use_accesskeys" is true, the accesskey tag.
getConfig()  : mixed
getConsole()  : rex_console_application|null
Returns the console application.
getDbConfig()  : rex_config_db
getDebugFlags()  : array{enabled: bool, throw_always_exception: bool|int}
Returns the debug flags.
getDirPerm()  : int
Returns the dir perm.
getEnvironment()  : string
Returns the environment.
getErrorEmail()  : string
Returns the error email.
getFilePerm()  : int
Returns the file perm.
getImpersonator()  : rex_user|null
Returns the current impersonator user.
getPackageConfig()  : array<non-empty-string, array{install: bool, status: bool, plugins?: array}>
getPackageOrder()  : array<int, non-empty-string>
getProperty()  : mixed
Returns a property.
getRequest()  : Request
getServer()  : string
Returns the server URL.
getServerName()  : string
Returns the server name.
getTable()  : non-empty-string
Adds the table prefix to the table name.
getTablePrefix()  : non-empty-string
Returns the table prefix.
getTempPrefix()  : non-empty-string
Returns the temp prefix.
getTheme()  : "dark"|"light"|null
Returns the current backend theme.
getUser()  : rex_user|null
Returns the current user.
getVersion()  : string
Returns the redaxo version.
getVersionHash()  : non-empty-string|false
hasConfig()  : bool
hasProperty()  : bool
Returns if a property is set.
isBackend()  : bool
Returns if the environment is the backend.
isDebugMode()  : bool
Returns if the debug mode is active.
isFrontend()  : bool
Returns if the environment is the frontend.
isLiveMode()  : bool
Returns if the live mode is active.
isSafeMode()  : bool
Returns if the safe mode is active.
isSetup()  : bool
Returns if the setup is active.
removeConfig()  : bool
removeProperty()  : bool
Removes a property.
requireUser()  : rex_user
Returns the current user.
setConfig()  : bool
setProperty()  : bool
Sets a property. Changes will not be persisted accross http request boundaries.

Constants

CONFIG_NAMESPACE

public mixed CONFIG_NAMESPACE = 'core'

Properties

$properties

Array of properties.

protected static array<string, mixed> $properties = []

Methods

getAccesskey()

Returns the title tag and if the property "use_accesskeys" is true, the accesskey tag.

public static getAccesskey(string $title, string $key) : string
Parameters
$title : string

Title

$key : string

Key for the accesskey

Return values
string

getConfig()

public static getConfig([T $key = null ][, mixed $default = null ]) : mixed
Parameters
$key : T = null

The associated key

$default : mixed = null

Default return value if no associated-value can be found

Tags
see
rex_config::get()
template

T as ?string

throws
InvalidArgumentException
psalm-return

(T is string ? mixed|null : array<string, mixed>)

Return values
mixed —

the value for $key or $default if $key cannot be found in the given $namespace

getDebugFlags()

Returns the debug flags.

public static getDebugFlags() : array{enabled: bool, throw_always_exception: bool|int}
Return values
array{enabled: bool, throw_always_exception: bool|int}

getDirPerm()

Returns the dir perm.

public static getDirPerm() : int
Return values
int

getEnvironment()

Returns the environment.

public static getEnvironment() : string
Tags
psalm-return

'console'|'backend'|'frontend'

Return values
string

getErrorEmail()

Returns the error email.

public static getErrorEmail() : string
Return values
string

getFilePerm()

Returns the file perm.

public static getFilePerm() : int
Return values
int

getImpersonator()

Returns the current impersonator user.

public static getImpersonator() : rex_user|null
Return values
rex_user|null

getPackageConfig()

public static getPackageConfig() : array<non-empty-string, array{install: bool, status: bool, plugins?: array}>
Tags
psalm-suppress

MixedReturnTypeCoercion

Return values
array<non-empty-string, array{install: bool, status: bool, plugins?: array}>

getPackageOrder()

public static getPackageOrder() : array<int, non-empty-string>
Return values
array<int, non-empty-string>

getProperty()

Returns a property.

public static getProperty(string $key[, mixed $default = null ]) : mixed
Parameters
$key : string

Key of the property

$default : mixed = null

Default value, will be returned if the property isn't set

Tags
throws
InvalidArgumentException

on invalid parameters

psalm-return

( $key is 'login' ? rex_backend_login|null : ($key is 'live_mode' ? bool : ($key is 'safe_mode' ? bool : ($key is 'debug' ? array{enabled: bool, throw_always_exception: bool|int} : ($key is 'lang_fallback' ? string[] : ($key is 'use_accesskeys' ? bool : ($key is 'accesskeys' ? array<string, string> : ($key is 'editor' ? string|null : ($key is 'editor_basepath' ? string|null : ($key is 'timer' ? rex_timer : ($key is 'timezone' ? string : ($key is 'table_prefix' ? non-empty-string : ($key is 'temp_prefix' ? non-empty-string : ($key is 'version' ? string : ($key is 'server' ? string : ($key is 'servername' ? string : ($key is 'error_email' ? string : ($key is 'lang' ? non-empty-string : ($key is 'instname' ? non-empty-string : ($key is 'theme' ? string : ($key is 'start_page' ? non-empty-string : ($key is 'socket_proxy' ? non-empty-string|null : ($key is 'password_policy' ? array<string, scalar> : ($key is 'backend_login_policy' ? array<string, bool|int> : ($key is 'db' ? array<int, string[]> : ($key is 'setup' ? bool|array<string, int> : ($key is 'system_addons' ? non-empty-string[] : ($key is 'setup_addons' ? non-empty-string[] : mixed|null ))))))))))))))))))))))))))) )

Return values
mixed —

The value for $key or $default if $key cannot be found

getRequest()

public static getRequest() : Request
Return values
Request

getServer()

Returns the server URL.

public static getServer([string|null $protocol = null ]) : string
Parameters
$protocol : string|null = null
Return values
string

getServerName()

Returns the server name.

public static getServerName() : string
Return values
string

getTable()

Adds the table prefix to the table name.

public static getTable(non-empty-string $table) : non-empty-string
Parameters
$table : non-empty-string

Table name

Return values
non-empty-string

getTablePrefix()

Returns the table prefix.

public static getTablePrefix() : non-empty-string
Tags
phpstandba-inference-placeholder

'rex_'

psalm-taint-escape

sql

Return values
non-empty-string

getTempPrefix()

Returns the temp prefix.

public static getTempPrefix() : non-empty-string
Tags
phpstandba-inference-placeholder

'tmp_'

psalm-taint-escape

sql

Return values
non-empty-string

getTheme()

Returns the current backend theme.

public static getTheme() : "dark"|"light"|null
Return values
"dark"|"light"|null

getUser()

Returns the current user.

public static getUser() : rex_user|null
Return values
rex_user|null

getVersion()

Returns the redaxo version.

public static getVersion([string $format = null ]) : string
Parameters
$format : string = null

See

Return values
string

getVersionHash()

public static getVersionHash(string $path[, string|null $repo = null ]) : non-empty-string|false
Parameters
$path : string
$repo : string|null = null
Tags
deprecated

since 5.10, use rex_version::gitHash instead

Return values
non-empty-string|false

hasConfig()

public static hasConfig(string $key) : bool
Parameters
$key : string

The associated key

Tags
see
rex_config::has()
Return values
bool —

TRUE if the key is set, otherwise FALSE

hasProperty()

Returns if a property is set.

public static hasProperty(string $key) : bool
Parameters
$key : string

Key of the property

Return values
bool —

TRUE if the key is set, otherwise FALSE

isBackend()

Returns if the environment is the backend.

public static isBackend() : bool
Return values
bool

isDebugMode()

Returns if the debug mode is active.

public static isDebugMode() : bool
Return values
bool

isFrontend()

Returns if the environment is the frontend.

public static isFrontend() : bool
Return values
bool

isLiveMode()

Returns if the live mode is active.

public static isLiveMode() : bool
Return values
bool

isSafeMode()

Returns if the safe mode is active.

public static isSafeMode() : bool
Return values
bool

isSetup()

Returns if the setup is active.

public static isSetup() : bool
Return values
bool

removeConfig()

public static removeConfig(string $key) : bool
Parameters
$key : string

The associated key

Tags
see
rex_config::remove()
Return values
bool —

TRUE if the value was found and removed, otherwise FALSE

removeProperty()

Removes a property.

public static removeProperty(string $key) : bool
Parameters
$key : string

Key of the property

Tags
throws
InvalidArgumentException

on invalid parameters

Return values
bool —

TRUE if the value was found and removed, otherwise FALSE

requireUser()

Returns the current user.

public static requireUser() : rex_user

In contrast to getUser, this method throw a rex_exception if the user does not exist.

Return values
rex_user

setConfig()

public static setConfig(string|array<string, mixed> $key[, mixed $value = null ]) : bool
Parameters
$key : string|array<string, mixed>

The associated key or an associative array of key/value pairs

$value : mixed = null

The value to save

Tags
see
rex_config::set()
Return values
bool —

TRUE when an existing value was overridden, otherwise FALSE

setProperty()

Sets a property. Changes will not be persisted accross http request boundaries.

public static setProperty(string $key, mixed $value) : bool
Parameters
$key : string

Key of the property

$value : mixed

Value for the property

Tags
throws
InvalidArgumentException

on invalid parameters

Return values
bool —

TRUE when an existing value was overridden, otherwise FALSE


        
On this page

Search results