Utils
in package
Uses
UtilsProvider
Utils functionality.
Table of Contents
Methods
- getCurrentHostname() : string
- Get current home url, normalized without schema, `www` subdomain and path.
- getIpAddress() : mixed
- Get the IP address of the current request.
- getOptionRaw() : mixed
- Get the raw value of a `wp_options` value by respecting the object cache. It is not modified through option-filters.
- getPluginConstantPrefix() : string
- Get the prefix of this package so we can utils package natively.
- getUserFullName() : mixed
- Get the full name for the currently logged in user.
- isRedirected() : mixed
- Check if the current page request gets redirected.
- mapBlogsToHosts() : mixed
- To avoid issues with multisites without own domains, we need to map blog ids to their `site_url`'s host so we can determine the used license for a given blog.
- setupConstants() : mixed
- Make sure the RPM_WP_CLIENT constants are available.
- startsWith() : mixed
- Check if a string starts with a given needle.
Methods
getCurrentHostname()
Get current home url, normalized without schema, `www` subdomain and path.
public
static getCurrentHostname() : string
This avoids general conflicts for situations, when customers move their HTTP site to HTTPS.
Return values
string —Can be empty, e.g. for WP CLI and WP Cronjob when Object Cache is active
getIpAddress()
Get the IP address of the current request.
public
static getIpAddress() : mixed
getOptionRaw()
Get the raw value of a `wp_options` value by respecting the object cache. It is not modified through option-filters.
public
static getOptionRaw(string $optionName[, mixed $default = false ]) : mixed
Parameters
- $optionName : string
- $default : mixed = false
getPluginConstantPrefix()
Get the prefix of this package so we can utils package natively.
public
getPluginConstantPrefix() : string
Return values
stringgetUserFullName()
Get the full name for the currently logged in user.
public
static getUserFullName([WP_User $user = null ]) : mixed
Parameters
- $user : WP_User = null
-
Fall back to current user
isRedirected()
Check if the current page request gets redirected.
public
static isRedirected() : mixed
mapBlogsToHosts()
To avoid issues with multisites without own domains, we need to map blog ids to their `site_url`'s host so we can determine the used license for a given blog.
public
static mapBlogsToHosts(array<string|int, int> $blogIds) : mixed
Parameters
- $blogIds : array<string|int, int>
setupConstants()
Make sure the RPM_WP_CLIENT constants are available.
public
static setupConstants() : mixed
startsWith()
Check if a string starts with a given needle.
public
static startsWith(string $haystack, string $needle) : mixed
Parameters
- $haystack : string
-
The string to search in
- $needle : string
-
The starting string