Raydium Framework

Documentation

Packages

Application

Namespaces

WPframework

Table of Contents

ABSPATH  = __DIR__ . '/'
ABSPATH  = __DIR__ . '/'
ALLOW_MULTITENANT  = \false
APP_DIR_PATH  = $appDirPath
APP_HTTP_HOST  = $httpHost
APP_HTTP_HOST  = $this->tenant->domain
APP_TENANT_ID  = \null
APP_TENANT_ID  = md5($this->tenant->uuid)
CONCATENATE_SCRIPTS  = \false
DISABLE_AND_BLOCK_WPSERVER_UPDATES  = \false
DISALLOW_FILE_EDIT  = \true
DISALLOW_FILE_MODS  = \true
EMPTY_TRASH_DAYS  = 10
IS_MULTITENANT  = true
LANDLORD_UUID  = \null
RAYDIUM_ENVIRONMENT_TYPE  = $environment
REQUIRE_TENANT_CONFIG  = \false
SAVEQUERIES  = \true
SCRIPT_DEBUG  = \false
SITE_CONFIGS_DIR  = 'configs'
TENANCY_WEB_ROOT  = 'public'
USE_STRICT_ENV_VARS  = \false
WP_CRON_LOCK_TIMEOUT  = 120
WP_DEBUG  = \false
WP_DEBUG  = \false
WP_DEBUG  = \false
For developers: WordPress debugging mode.
WP_DEBUG_DISPLAY  = \false
WP_DEBUG_LOG  = \false
WP_DISABLE_FATAL_ERROR_HANDLER  = \true
asset()  : string
The Asset url.
assetUrl()  : string
The Asset url only.
env()  : mixed
Retrieves a sanitized, and optionally encrypted or modified, environment variable by name.
envWhitelist()  : array<string|int, mixed>
siteConfigsDir()  : string|null
config()  : mixed
Retrieves configuration data using dot notation.
envHash()  : false|string
Gets hash of given string.
wpSanitize()  : string
Basic Sanitize and prepare for a string input for safe usage in the application.
cleanSensitiveEnv()  : void
Cleans up sensitive environment variables.
get_packages()  : array<string|int, mixed>
Retrieves all packages listed in the 'require' section of the composer.json file.
_configsDir()  : string
isMultitenantApp()  : bool
Determines if the application is configured to operate in multi-tenant mode.
getWpframeworkHttpEnv()  : string|null
setMultitenantUploadDirectory()  : array<string|int, mixed|string>
Sets the upload directory to a tenant-specific location.
frameworkFooterLabel()  : string
Custom admin footer text.
frameworkCurrentThemeInfo()  : array<string|int, bool|string>
exitWithThemeError()  : void
logMessage()  : void
Logs a message with the specified level and an optional log file.
logWithStackTrace()  : void
customHeaderMiddleware()  : void

Constants

ABSPATH

public mixed ABSPATH = __DIR__ . '/'

ALLOW_MULTITENANT

public mixed ALLOW_MULTITENANT = \false

APP_DIR_PATH

public mixed APP_DIR_PATH = $appDirPath

APP_HTTP_HOST

public mixed APP_HTTP_HOST = $httpHost

APP_HTTP_HOST

public mixed APP_HTTP_HOST = $this->tenant->domain

APP_TENANT_ID

public mixed APP_TENANT_ID = md5($this->tenant->uuid)

CONCATENATE_SCRIPTS

public mixed CONCATENATE_SCRIPTS = \false

DISABLE_AND_BLOCK_WPSERVER_UPDATES

public mixed DISABLE_AND_BLOCK_WPSERVER_UPDATES = \false

DISALLOW_FILE_EDIT

public mixed DISALLOW_FILE_EDIT = \true

DISALLOW_FILE_MODS

public mixed DISALLOW_FILE_MODS = \true

EMPTY_TRASH_DAYS

public mixed EMPTY_TRASH_DAYS = 10

IS_MULTITENANT

public mixed IS_MULTITENANT = true

LANDLORD_UUID

public mixed LANDLORD_UUID = \null

RAYDIUM_ENVIRONMENT_TYPE

public mixed RAYDIUM_ENVIRONMENT_TYPE = $environment

REQUIRE_TENANT_CONFIG

public mixed REQUIRE_TENANT_CONFIG = \false

SAVEQUERIES

public mixed SAVEQUERIES = \true

SCRIPT_DEBUG

public mixed SCRIPT_DEBUG = \false

SITE_CONFIGS_DIR

public mixed SITE_CONFIGS_DIR = 'configs'

TENANCY_WEB_ROOT

public mixed TENANCY_WEB_ROOT = 'public'

USE_STRICT_ENV_VARS

public mixed USE_STRICT_ENV_VARS = \false

WP_CRON_LOCK_TIMEOUT

public mixed WP_CRON_LOCK_TIMEOUT = 120

WP_DEBUG

public mixed WP_DEBUG = \false

WP_DEBUG_DISPLAY

public mixed WP_DEBUG_DISPLAY = \false

WP_DEBUG_LOG

public mixed WP_DEBUG_LOG = \false

WP_DISABLE_FATAL_ERROR_HANDLER

public mixed WP_DISABLE_FATAL_ERROR_HANDLER = \true

Functions

asset()

The Asset url.

asset(string $asset[, null|string $path = null ]) : string

You can configure the asset URL by setting the ASSET_URL in your .env Or optionally in the main config file.

Parameters
$asset : string

path to the asset like: "/images/thing.png"

$path : null|string = null
Return values
string

assetUrl()

The Asset url only.

assetUrl([null|string $path = null ]) : string
Parameters
$path : null|string = null
Return values
string

env()

Retrieves a sanitized, and optionally encrypted or modified, environment variable by name.

env(string $name[, mixed $default = null ][, bool $encrypt = false ][, bool $strtolower = false ]) : mixed
Parameters
$name : string

The name of the environment variable to retrieve.

$default : mixed = null

Default value to return if the environment variable is not set.

$encrypt : bool = false

Indicate if the value should be encrypted. Defaults to false.

$strtolower : bool = false

Whether to convert the retrieved value to lowercase. Defaults to false.

Tags
throws
InvalidArgumentException

If the requested environment variable name is not in the whitelist or if encryption is requested but the encryption path is not defined.

Return values
mixed

The sanitized environment variable value, possibly encrypted or typecast, or transformed to lowercase if specified.

envWhitelist()

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

siteConfigsDir()

siteConfigsDir() : string|null
Return values
string|null

config()

Retrieves configuration data using dot notation.

config([null|string $key = null ][, mixed $default = null ]) : mixed

This function allows easy access to nested configuration data through dot notation syntax. When a specific dot notation key is provided, it returns the associated value from the configuration. If no key is specified, the full configuration object is returned.

Parameters
$key : null|string = null

Optional. The dot notation key to retrieve the data for. If null, the entire configuration object is returned. Default null.

$default : mixed = null

Optional. The default value to return if the specified key is not found. Default null.

Tags
see
https://github.com/devuri/dot-access

DotAccess library for dot notation access.

Return values
mixed

The value associated with the specified key or the default value if the key is not found. If no key is provided (null), the full configuration object is returned.

envHash()

Gets hash of given string.

envHash(string $data[, string $secretkey = null ][, string $algo = 'sha256' ]) : false|string

If no secret key is provided we will use the SECURE_AUTH_KEY wp key.

Parameters
$data : string

Message to be hashed.

$secretkey : string = null

Secret key used for generating the HMAC variant.

$algo : string = 'sha256'

Name of selected hashing algorithm (i.e. "md5", "sha256", "haval160,4", etc..)

Tags
see
https://www.php.net/manual/en/function.hash-hmac.php
Return values
false|string

Returns a string containing the calculated hash value.

wpSanitize()

Basic Sanitize and prepare for a string input for safe usage in the application.

wpSanitize(string $input) : string

This function sanitizes the input by removing leading/trailing whitespace, stripping HTML and PHP tags, converting special characters to HTML entities, and removing potentially dangerous characters for security.

Parameters
$input : string

The input string to sanitize.

Return values
string

The sanitized input ready for safe usage within the application.

cleanSensitiveEnv()

Cleans up sensitive environment variables.

cleanSensitiveEnv(array<string|int, mixed> $sensitives) : void

This function removes specified environment variables from the $_ENV superglobal and the environment to help secure sensitive information.

Parameters
$sensitives : array<string|int, mixed>

An array of environment variable names to be cleaned up.

Return values
void

get_packages()

Retrieves all packages listed in the 'require' section of the composer.json file.

get_packages(string $app_path) : array<string|int, mixed>
Parameters
$app_path : string

The path to the application root directory.

Return values
array<string|int, mixed>

An array of required packages, or an empty array if the file doesn't exist or on error.

_configsDir()

_configsDir() : string
Return values
string

isMultitenantApp()

Determines if the application is configured to operate in multi-tenant mode.

isMultitenantApp() : bool

This is based on the presence and value of the ALLOW_MULTITENANT constant. If ALLOW_MULTITENANT is defined and set to true, the application is considered to be in multi-tenant mode.

Return values
bool

Returns true if the application is in multi-tenant mode, otherwise false.

getWpframeworkHttpEnv()

getWpframeworkHttpEnv() : string|null
Return values
string|null

setMultitenantUploadDirectory()

Sets the upload directory to a tenant-specific location.

setMultitenantUploadDirectory(array<string|int, mixed> $dir) : array<string|int, mixed|string>

This function modifies the default WordPress upload directory paths to store tenant-specific uploads in a separate folder based on the tenant ID. It ensures that each tenant's uploads are organized and stored in an isolated directory.

Parameters
$dir : array<string|int, mixed>

The array containing the current upload directory's path and URL.

Tags
psalm-return

array{basedir: 'public/content/tenant/id/uploads', baseurl: string, path: string, url: string,...}

Return values
array<string|int, mixed|string>

frameworkFooterLabel()

Custom admin footer text.

frameworkFooterLabel() : string
Return values
string

The formatted footer text.

frameworkCurrentThemeInfo()

frameworkCurrentThemeInfo() : array<string|int, bool|string>
Tags
psalm-return

array{available: bool, error_message?: 'The current active theme is not available.', theme_info?: string}

Return values
array<string|int, bool|string>

exitWithThemeError()

exitWithThemeError(array<string|int, mixed> $themeInfo) : void
Parameters
$themeInfo : array<string|int, mixed>
Return values
void

logMessage()

Logs a message with the specified level and an optional log file.

logMessage(string $message[, string $level = 'info' ][, array<string|int, mixed> $context = [] ][, null|string $logFile = null ]) : void
Parameters
$message : string

The log message.

$level : string = 'info'

The log level (e.g., 'info', 'error', 'debug', etc.).

$context : array<string|int, mixed> = []

Optional context data for the log message.

$logFile : null|string = null

Optional log file to use. If null, the default or fallback will be used.

Return values
void

logWithStackTrace()

logWithStackTrace() : void
Return values
void

customHeaderMiddleware()

customHeaderMiddleware(AppInit $app) : void
Parameters
$app : AppInit
Return values
void

Search results