Documentation

CRM_Utils_System
in package

System wide utilities.

Provides a collection of Civi utilities + access to the CMS-dependant utilities

FIXME: This is a massive and random collection that could be split into smaller services

Table of Contents

Properties

$_callbacks  : mixed
$title  : string

Methods

__callStatic()  : mixed
Access methods in the appropriate CMS class
absoluteURL()  : string
Produce an absolute URL from a possibly-relative URL.
addHTMLHead()  : void
alterAssetUrl()  : void
appendBreadCrumb()  : void
appendCoreResources()  : void
appendTPLFile()  : mixed
Append the contents of an 'extra' smarty template file.
authenticate()  : false|array<string|int, mixed>
Authenticate the user against the uf db.
authenticateAbort()  : bool
Authenticate or abort.
authenticateKey()  : bool
Authenticate key.
authenticateScript()  : bool
Authenticate script.
baseCMSURL()  : mixed|string
Get Base CMS url.
baseURL()  : string
Get the base URL of the system.
checkPHPVersion()  : bool
Assert that we are running on a particular PHP version.
checkURL()  : mixed
Check url.
civiExit()  : mixed
Exit with provided exit code.
cleanUrl()  : string
Clean url, replaces first '&' with '?'.
createDefaultCrudLink()  : array<string|int, mixed>|null
Determine the standard URL for view/update/delete of a given entity.
crmURL()  : string
Compose a URL. This is a wrapper for `url()` which is optimized for use in Smarty.
currentPath()  : string|null
docURL()  : null|string
Returns URL or link to documentation page, based on provided parameters.
docURL2()  : string
Returns URL or link to documentation page, based on provided parameters.
download()  : mixed
Download something or other.
evalUrl()  : string|false
Evaluate any tokens in a URL.
executeScheduledJobs()  : mixed
Execute scheduled jobs.
explode()  : array<string|int, string>
Like PHP's built-in explode(), but always return an array of $limit items.
externUrl()  : string
Generates an extern url.
fixURL()  : string
Take a URL (or partial URL) and make it better.
flushCache()  : mixed
Reset the various system caches and some important static variables.
formatDocUrl()  : mixed
Add language and version parameters to the doc url.
getAllHeaders()  : mixed
Wraps or emulates PHP's getallheaders() function.
getClassName()  : string
Gets a class name for an object.
getCMSPermissionsUrlParams()  : void
getContentTemplate()  : string
getDocBaseURL()  : string
Get the documentation base URL.
getLinksUrl()  : string
Get the query string and clean it up.
getLoggedInUfID()  : int
getModuleSetting()  : mixed
Get a setting from a loaded PHP module.
getNotifyUrl()  : string
Return the Notification URL for Payments.
getPluginList()  : array<string|int, mixed>
Get a list of all "plugins".
getRequestHeaders()  : array<string|int, mixed>|false
Get request headers.
getSiteID()  : string
Returns the unique identifier for this site, as used by community messages.
getUFLocale()  : string|null
getUrlPath()  : string|null
getWikiBaseURL()  : string
Returns wiki (alternate) documentation URL base.
href()  : string
Get href.
ipAddress()  : string
Get the client's IP address.
isInUpgradeMode()  : bool
Is in upgrade mode.
isNull()  : bool
Determine whether a value is null-ish.
isSSL()  : mixed
Determine whether this is an SSL request.
isUserLoggedIn()  : bool
isVersionFormatValid()  : bool
Determines whether a string is a valid CiviCRM version string.
jsRedirect()  : mixed
Redirect to another URL using JavaScript.
languageNegotiationURL()  : string
Format the url as per language Negotiation.
listIncludeFiles()  : array<string|int, mixed>
Get a list of all files that are found within the directories.
loadBootStrap()  : mixed
Load CMS bootstrap.
logout()  : mixed
majorVersion()  : string
Gives the first two parts of the version string E.g. 6.1.
makeQueryString()  : string|null
Generate a query string if input is an array.
makeURL()  : string
Compose a new URL string from the current URL string.
memory()  : mixed|string
Do something no-one bothered to document.
migrateExternUrl()  : mixed
Perform any current conversions/migrations on the extern URL.
mungeCreditCard()  : string
Obscure all but the last few digits of a credit card number.
permissionDenied()  : mixed
postURL()  : string
prePostRedirect()  : mixed
Perform any necessary actions prior to redirecting via POST.
redirect()  : mixed
Redirect to another URL.
redirectToSSL()  : mixed
Redirect to SSL.
refererPath()  : string
Get the referring / previous page URL.
relativeURL()  : string
Given a URL, return a relative URL if possible.
resetBreadCrumb()  : void
sendResponse()  : mixed
Return an HTTP Response with appropriate content and status code set.
setHttpHeader()  : void
setNoRobotsFlag()  : void
Set the html header to direct robots not to index the page.
setTitle()  : mixed
Sets the title of the page.
setUFLocale()  : bool
setUFMessage()  : mixed
Set a message in the UF to display to a user.
setUserContext()  : mixed
Figures and sets the userContext.
shouldExitAfterFatal()  : bool
synchronizeUsers()  : array<string|int, mixed>
theme()  : string
If we are using a theming system, invoke theme, else just print the content.
updateCategories()  : mixed
url()  : string
Generate an internal CiviCRM URL.
urlEncode()  : null|string
Encode url.
validCallback()  : bool
Make sure a callback is valid in the current context.
version()  : string
Return the running civicrm version.
versionXml()  : array<string|int, mixed>
xMemory()  : mixed
Gather and print (and possibly log) amount of used memory.
parsePHPModules()  : array<string|int, mixed>
Determine which PHP modules are loaded.

Properties

$_callbacks

public static mixed $_callbacks = \NULL

$title

public static string $title = ''

Page title

Methods

__callStatic()

Access methods in the appropriate CMS class

public static __callStatic(mixed $name, mixed $arguments) : mixed
Parameters
$name : mixed
$arguments : mixed

absoluteURL()

Produce an absolute URL from a possibly-relative URL.

public static absoluteURL(string $url[, bool $removeLanguagePart = FALSE ]) : string
Parameters
$url : string
$removeLanguagePart : bool = FALSE
Return values
string

addHTMLHead()

public static addHTMLHead([string $head = ]) : void

Append a string to the head of the HTML file.

Parameters
$head : string =

appendBreadCrumb()

public static appendBreadCrumb([array<string|int, mixed> $breadCrumbs = ]) : void

Append an additional breadcrumb link to the existing breadcrumbs.

Parameters
$breadCrumbs : array<string|int, mixed> =

appendTPLFile()

Append the contents of an 'extra' smarty template file.

public static appendTPLFile(string $fileName, string &$content[, string $overideFileName = NULL ]) : mixed

It must be present in the custom template directory. This does not work if there are multiple custom template directories

Parameters
$fileName : string

The name of the tpl file that we are processing.

$content : string

The current content string. May be modified by this function.

$overideFileName : string = NULL

(optional) Sent by contribution/event reg/profile pages which uses a id specific extra file name if present.

authenticate()

Authenticate the user against the uf db.

public static authenticate(string $name, string $password[, bool $loadCMSBootstrap = FALSE ][, string $realPath = NULL ]) : false|array<string|int, mixed>

In case of successful authentication, returns an array consisting of (contactID, ufID, unique string). Returns FALSE if authentication is unsuccessful.

Parameters
$name : string

The username.

$password : string

The password.

$loadCMSBootstrap : bool = FALSE
$realPath : string = NULL
Return values
false|array<string|int, mixed>

authenticateAbort()

Authenticate or abort.

public static authenticateAbort(string $message, bool $abort) : bool
Parameters
$message : string
$abort : bool
Return values
bool

authenticateKey()

Authenticate key.

public static authenticateKey([bool $abort = TRUE ]) : bool
Parameters
$abort : bool = TRUE

(optional) Whether to exit; defaults to true.

Return values
bool

authenticateScript()

Authenticate script.

public static authenticateScript([bool $abort = TRUE ][, string $name = NULL ][, string $pass = NULL ][, bool $storeInSession = TRUE ][, bool $loadCMSBootstrap = TRUE ][, bool $requireKey = TRUE ]) : bool
Parameters
$abort : bool = TRUE
$name : string = NULL
$pass : string = NULL
$storeInSession : bool = TRUE
$loadCMSBootstrap : bool = TRUE
$requireKey : bool = TRUE
Return values
bool

baseCMSURL()

Get Base CMS url.

public static baseCMSURL() : mixed|string
Return values
mixed|string

baseURL()

Get the base URL of the system.

public static baseURL() : string
Return values
string

checkPHPVersion()

Assert that we are running on a particular PHP version.

public static checkPHPVersion([int $ver = 5 ][, bool $abort = TRUE ]) : bool
Parameters
$ver : int = 5

The major version of PHP that is required.

$abort : bool = TRUE

(optional) Whether to fatally abort if the version requirement is not met. Defaults to TRUE.

Tags
throws
CRM_Core_Exception
Return values
bool

Returns TRUE if the requirement is met, FALSE if the requirement is not met and we're not aborting due to the failed requirement. If $abort is TRUE and the requirement fails, this function does not return.

checkURL()

Check url.

public static checkURL(string $url[, bool $addCookie = FALSE ]) : mixed
Parameters
$url : string

The URL to check.

$addCookie : bool = FALSE

(optional)

civiExit()

Exit with provided exit code.

public static civiExit([int $status = 0 ][, array<string|int, mixed> $testParameters = [] ]) : mixed
Parameters
$status : int = 0

(optional) Code with which to exit.

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

cleanUrl()

Clean url, replaces first '&' with '?'.

public static cleanUrl(string $url) : string
Parameters
$url : string
Return values
string

, clean url

Determine the standard URL for view/update/delete of a given entity.

public static createDefaultCrudLink(array<string|int, mixed> $crudLinkSpec[, bool $absolute = FALSE ]) : array<string|int, mixed>|null
Parameters
$crudLinkSpec : array<string|int, mixed>

With keys:.

  • action: sting|int, e.g. 'update' or CRM_Core_Action::UPDATE or 'view' or CRM_Core_Action::VIEW [default: 'view']
  • entity|entity_table: string, eg "Contact" or "civicrm_contact"
  • id|entity_id: int
$absolute : bool = FALSE

whether the generated link should have an absolute (external) URL beginning with http

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

NULL if unavailable, or an array. array has keys:

  • title: string
  • url: string

crmURL()

Compose a URL. This is a wrapper for `url()` which is optimized for use in Smarty.

public static crmURL(array<string|int, mixed> $params) : string
Parameters
$params : array<string|int, mixed>

URL properties. Keys are abbreviated ("p"<=>"path"). See Smarty doc for full details.

Tags
see
smarty_function_crmURL()
Return values
string

URL

currentPath()

public static currentPath() : string|null

Path of the current page e.g. 'civicrm/contact/view'

Return values
string|null

docURL()

Returns URL or link to documentation page, based on provided parameters.

public static docURL(array<string|int, mixed> $params) : null|string

For use in templates code.

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

An array of parameters (see CRM_Utils_System::docURL2 method for names)

Return values
null|string

URL or link to documentation page, based on provided parameters.

docURL2()

Returns URL or link to documentation page, based on provided parameters.

public static docURL2(string $page[, bool $URLonly = FALSE ][, string|null $text = NULL ][, string|null $title = NULL ][, string|null $style = NULL ][, string|null $resource = NULL ]) : string

For use in PHP code. WARNING: Always returns URL, if ts function is not defined ($URLonly has no effect).

Parameters
$page : string

Title of documentation wiki page.

$URLonly : bool = FALSE

(optional) Whether to return URL only or full HTML link (default).

$text : string|null = NULL

(optional) Text of HTML link (no effect if $URLonly = false).

$title : string|null = NULL

(optional) Tooltip text for HTML link (no effect if $URLonly = false)

$style : string|null = NULL

(optional) Style attribute value for HTML link (no effect if $URLonly = false)

$resource : string|null = NULL
Return values
string

URL or link to documentation page, based on provided parameters.

download()

Download something or other.

public static download(string $name, string $mimeType, string &$buffer[, string $ext = NULL ][, bool $output = TRUE ][, string $disposition = 'attachment' ]) : mixed
Parameters
$name : string
$mimeType : string
$buffer : string
$ext : string = NULL
$output : bool = TRUE
$disposition : string = 'attachment'

evalUrl()

Evaluate any tokens in a URL.

public static evalUrl(string|false $url) : string|false
Parameters
$url : string|false
Return values
string|false

executeScheduledJobs()

Execute scheduled jobs.

public static executeScheduledJobs() : mixed

explode()

Like PHP's built-in explode(), but always return an array of $limit items.

public static explode(string $separator, string $string, int $limit) : array<string|int, string>

This serves as a wrapper to the PHP explode() function. In the event that PHP's explode() returns an array with fewer than $limit elements, pad the end of the array with NULLs.

Parameters
$separator : string
$string : string
$limit : int
Return values
array<string|int, string>

externUrl()

Generates an extern url.

public static externUrl([string $path = NULL ][, string $query = NULL ][, string $fragment = NULL ][, bool $absolute = TRUE ][, bool $isSSL = NULL ]) : string
Parameters
$path : string = NULL

The extern path, such as "extern/url".

$query : string = NULL

A query string to append to the link.

$fragment : string = NULL

A fragment identifier (named anchor) to append to the link.

$absolute : bool = TRUE

Whether to force the output to be an absolute link (beginning with a URI-scheme such as 'http:').

$isSSL : bool = NULL

NULL to autodetect. TRUE to force to SSL.

Return values
string

rawencoded URL.

fixURL()

Take a URL (or partial URL) and make it better.

public static fixURL(string $url) : string

Currently, URLs pass straight through unchanged unless they are "seriously malformed" (see http://us2.php.net/parse_url).

Parameters
$url : string

The URL to operate on.

Return values
string

The fixed URL.

flushCache()

Reset the various system caches and some important static variables.

public static flushCache() : mixed

formatDocUrl()

Add language and version parameters to the doc url.

public static formatDocUrl(mixed $url) : mixed

Note that this function may run before CiviCRM is initialized and so should not call ts() or perform any db lookups.

Parameters
$url : mixed

getAllHeaders()

Wraps or emulates PHP's getallheaders() function.

public static getAllHeaders() : mixed

getClassName()

Gets a class name for an object.

public static getClassName(object $object) : string
Parameters
$object : object

Object whose class name is needed.

Return values
string

The class name of the object.

getCMSPermissionsUrlParams()

public static getCMSPermissionsUrlParams() : void

Immediately stop script execution and display a 401 "Access Denied" page.

getContentTemplate()

public static getContentTemplate([int|string $print = 0 ]) : string

Get the template path to render whole content.

Parameters
$print : int|string = 0
Return values
string

getDocBaseURL()

Get the documentation base URL.

public static getDocBaseURL() : string
Return values
string

Base URL of the CRM documentation.

getLinksUrl()

Get the query string and clean it up.

public static getLinksUrl(string $urlVar[, bool $includeReset = FALSE ][, bool $includeForce = TRUE ][, bool $skipUFVar = TRUE ]) : string

Strips some variables that should not be propagated, specifically variables like 'reset'. Also strips any side-affect actions (e.g. export).

This function is copied mostly verbatim from Pager.php (_getLinksUrl)

Parameters
$urlVar : string

The URL variable being considered (e.g. crmPageID, crmSortID etc).

$includeReset : bool = FALSE

(optional) By default this is FALSE, meaning that the reset parameter is skipped. Set to TRUE to leave the reset parameter as-is.

$includeForce : bool = TRUE

(optional)

$skipUFVar : bool = TRUE

(optional)

Return values
string

getLoggedInUfID()

public static getLoggedInUfID() : int

Get current logged in user id.

Return values
int

getModuleSetting()

Get a setting from a loaded PHP module.

public static getModuleSetting(string $pModuleName, string $pSetting) : mixed
Parameters
$pModuleName : string
$pSetting : string

getNotifyUrl()

Return the Notification URL for Payments.

public static getNotifyUrl([string $path = NULL ][, array<string|int, mixed>|string $query = NULL ][, bool $absolute = FALSE ][, string $fragment = NULL ][, bool $htmlize = NULL ][, bool $frontend = FALSE ][, bool $forceBackend = FALSE ]) : string
Parameters
$path : string = NULL

The path being linked to, such as "civicrm/add".

$query : array<string|int, mixed>|string = NULL

A query string to append to the link, or an array of key-value pairs.

$absolute : bool = FALSE

Whether to force the output to be an absolute link (beginning with a URI-scheme such as 'http:'). Useful for links that will be displayed outside the site, such as in an RSS feed.

$fragment : string = NULL

A fragment identifier (named anchor) to append to the link.

$htmlize : bool = NULL

Unused param

$frontend : bool = FALSE

This link should be to the CMS front end (applies to WP & Joomla).

$forceBackend : bool = FALSE

This link should be to the CMS back end (applies to WP & Joomla).

Return values
string

The Notification URL.

getPluginList()

Get a list of all "plugins".

public static getPluginList(string $relpath[, string $fext = '.php' ][, array<string|int, mixed> $skipList = [] ]) : array<string|int, mixed>

(PHP classes that implement a piece of functionality using a well-defined interface) that are found in a particular CiviCRM directory (both custom and core are searched).

Parameters
$relpath : string

A relative path referencing a directory that contains one or more plugins.

$fext : string = '.php'

(optional) Only files with this extension will be considered to be plugins.

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

(optional) List of files to skip.

Tags
author

Ken Zalewski

Return values
array<string|int, mixed>

List of plugins, where the plugin name is both the key and the value of each element.

getRequestHeaders()

Get request headers.

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

getSiteID()

Returns the unique identifier for this site, as used by community messages.

public static getSiteID() : string

SiteID will be generated if it is not already stored in the settings table.

Return values
string

getUFLocale()

public static getUFLocale() : string|null

Get the locale of the CMS.

Return values
string|null

getUrlPath()

public static getUrlPath() : string|null
Tags
see
CRM_Utils_System::currentPath
Return values
string|null

getWikiBaseURL()

Returns wiki (alternate) documentation URL base.

public static getWikiBaseURL() : string
Return values
string

documentation url

href()

Get href.

public static href(string $text[, string $path = NULL ][, string|array<string|int, mixed> $query = NULL ][, bool $absolute = TRUE ][, string $fragment = NULL ][, bool $htmlize = TRUE ][, bool $frontend = FALSE ][, bool $forceBackend = FALSE ]) : string
Parameters
$text : string
$path : string = NULL
$query : string|array<string|int, mixed> = NULL
$absolute : bool = TRUE
$fragment : string = NULL
$htmlize : bool = TRUE
$frontend : bool = FALSE
$forceBackend : bool = FALSE
Return values
string

ipAddress()

Get the client's IP address.

public static ipAddress([bool $strictIPV4 = TRUE ]) : string

Get IP address from HTTP REMOTE_ADDR header. If the CMS is Drupal then use the Drupal function as this also handles reverse proxies (based on proper configuration in settings.php)

Parameters
$strictIPV4 : bool = TRUE

(optional) Whether to return only IPv4 addresses.

Return values
string

IP address of logged in user.

isNull()

Determine whether a value is null-ish.

public static isNull(mixed $value) : bool
Parameters
$value : mixed

The value to check for null.

Return values
bool

isSSL()

Determine whether this is an SSL request.

public static isSSL() : mixed

Note that we inline this function in install/civicrm.php, so if you change this function, please go and change the code in the install script as well.

isUserLoggedIn()

public static isUserLoggedIn() : bool

Check if user is logged in.

Return values
bool

isVersionFormatValid()

Determines whether a string is a valid CiviCRM version string.

public static isVersionFormatValid(string $version) : bool
Parameters
$version : string

Version string to be checked.

Return values
bool

jsRedirect()

Redirect to another URL using JavaScript.

public static jsRedirect([string $url = NULL ][, string $title = NULL ][, string $message = NULL ]) : mixed

Use an html based file with javascript embedded to redirect to another url This prevent the too many redirect errors emitted by various browsers

Parameters
$url : string = NULL

(optional) The destination URL.

$title : string = NULL

(optional) The page title to use for the redirect page.

$message : string = NULL

(optional) The message to provide in the body of the redirect page.

languageNegotiationURL()

Format the url as per language Negotiation.

public static languageNegotiationURL(string $url[, bool $addLanguagePart = TRUE ][, bool $removeLanguagePart = FALSE ]) : string
Parameters
$url : string
$addLanguagePart : bool = TRUE
$removeLanguagePart : bool = FALSE
Return values
string

, formatted url.

listIncludeFiles()

Get a list of all files that are found within the directories.

public static listIncludeFiles(string $relpath) : array<string|int, mixed>

Files must be the result of appending the provided relative path to each component of the PHP include path.

Parameters
$relpath : string

A relative path, typically pointing to a directory with multiple class files.

Tags
author

Ken Zalewski

Return values
array<string|int, mixed>

An array of files that exist in one or more of the directories that are referenced by the relative path when appended to each element of the PHP include path.

loadBootStrap()

Load CMS bootstrap.

public static loadBootStrap([array<string|int, mixed> $params = [] ][, bool $loadUser = TRUE ][, bool $throwError = TRUE ][, string $realPath = NULL ]) : mixed
Parameters
$params : array<string|int, mixed> = []

Array with uid name and pass

$loadUser : bool = TRUE

Boolean load user or not.

$throwError : bool = TRUE
$realPath : string = NULL

logout()

public static logout() : mixed

Log out the current user.

majorVersion()

Gives the first two parts of the version string E.g. 6.1.

public static majorVersion() : string
Return values
string

makeQueryString()

Generate a query string if input is an array.

public static makeQueryString(array<string|int, mixed>|string $query) : string|null
Parameters
$query : array<string|int, mixed>|string
Return values
string|null

makeURL()

Compose a new URL string from the current URL string.

public static makeURL(string $urlVar[, bool $includeReset = FALSE ][, bool $includeForce = TRUE ][, string $path = NULL ][, bool|string $absolute = FALSE ]) : string

Used by all the framework components, specifically, pager, sort and qfc

Parameters
$urlVar : string

The url variable being considered (i.e. crmPageID, crmSortID etc).

$includeReset : bool = FALSE

(optional) Whether to include the reset GET string (if present).

$includeForce : bool = TRUE

(optional) Whether to include the force GET string (if present).

$path : string = NULL

(optional) The path to use for the new url.

$absolute : bool|string = FALSE

(optional) Whether to return an absolute URL.

Return values
string

The URL fragment.

memory()

Do something no-one bothered to document.

public static memory([string $title = NULL ]) : mixed|string
Parameters
$title : string = NULL

(optional)

Return values
mixed|string

migrateExternUrl()

Perform any current conversions/migrations on the extern URL.

public static migrateExternUrl(GenericHookEvent $e) : mixed
Parameters
$e : GenericHookEvent
Tags
see
CRM_Utils_Hook::alterExternUrl

mungeCreditCard()

Obscure all but the last few digits of a credit card number.

public static mungeCreditCard(string $number[, int $keep = 4 ]) : string
Parameters
$number : string

The credit card number to obscure.

$keep : int = 4

(optional) The number of digits to preserve unmodified.

Return values
string

The obscured credit card number.

permissionDenied()

public static permissionDenied() : mixed

Show access denied screen.

postURL()

public static postURL([int $action = ]) : string

Determine the post URL for a form.

Parameters
$action : int =
Return values
string

prePostRedirect()

Perform any necessary actions prior to redirecting via POST.

public static prePostRedirect() : mixed

redirect()

Redirect to another URL.

public static redirect([string $url = NULL ][, array<string|int, mixed> $context = [] ]) : mixed
Parameters
$url : string = NULL

The URL to provide to the browser via the Location header.

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

Optional additional information for the hook.

redirectToSSL()

Redirect to SSL.

public static redirectToSSL([bool|false $abort = FALSE ]) : mixed
Parameters
$abort : bool|false = FALSE
Tags
throws
CRM_Core_Exception

refererPath()

Get the referring / previous page URL.

public static refererPath() : string
Return values
string

The previous page URL

relativeURL()

Given a URL, return a relative URL if possible.

public static relativeURL(string $url) : string
Parameters
$url : string
Return values
string

resetBreadCrumb()

public static resetBreadCrumb() : void

Reset an additional breadcrumb tag to the existing breadcrumb.

sendResponse()

Return an HTTP Response with appropriate content and status code set.

public static sendResponse(ResponseInterface $response) : mixed
Parameters
$response : ResponseInterface

setHttpHeader()

public static setHttpHeader([string $name = ][, string $value = ]) : void

Set http header.

Parameters
$name : string =
$value : string =

setNoRobotsFlag()

Set the html header to direct robots not to index the page.

public static setNoRobotsFlag() : void

setTitle()

Sets the title of the page.

public static setTitle(string $title[, string $pageTitle = NULL ]) : mixed
Parameters
$title : string

Document title - plain text only

$pageTitle : string = NULL

Page title (if different) - may include html

setUFLocale()

public static setUFLocale([string $civicrm_language = ]) : bool

Set the locale of the CMS.

Parameters
$civicrm_language : string =
Return values
bool

setUFMessage()

Set a message in the UF to display to a user.

public static setUFMessage(string $message) : mixed
Parameters
$message : string

The message to set.

setUserContext()

Figures and sets the userContext.

public static setUserContext(array<string|int, mixed> $names[, string $default = NULL ]) : mixed

Uses the referrer if valid else uses the default.

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

Referrer should match any str in this array.

$default : string = NULL

(optional) The default userContext if no match found.

shouldExitAfterFatal()

public static shouldExitAfterFatal() : bool

Should the current execution exit after a fatal error?

Return values
bool

synchronizeUsers()

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

Create CRM contacts for all existing CMS users.

Return values
array<string|int, mixed>

theme()

If we are using a theming system, invoke theme, else just print the content.

public static theme(string &$content[, bool $print = FALSE ][, bool $maintenance = FALSE ]) : string
Parameters
$content : string

The content that will be themed.

$print : bool = FALSE

(optional) Are we displaying to the screen or bypassing theming?

$maintenance : bool = FALSE

(optional) For maintenance mode.

Return values
string

updateCategories()

public static updateCategories() : mixed

Clear CMS caches related to the user registration/profile forms.

url()

Generate an internal CiviCRM URL.

public static url([string $path = '' ][, array<string|int, mixed>|string $query = '' ][, bool $absolute = FALSE ][, string $fragment = NULL ][, bool $htmlize = TRUE ][, bool $frontend = FALSE ][, bool $forceBackend = FALSE ]) : string
Parameters
$path : string = ''

The path being linked to, such as "civicrm/add".

$query : array<string|int, mixed>|string = ''

A query string to append to the link, or an array of key-value pairs.

$absolute : bool = FALSE

Whether to force the output to be an absolute link (beginning with a URI-scheme such as 'http:'). Useful for links that will be displayed outside the site, such as in an RSS feed.

$fragment : string = NULL

A fragment identifier (named anchor) to append to the link.

$htmlize : bool = TRUE

Whether to encode special html characters such as &.

$frontend : bool = FALSE

This link should be to the CMS front end (applies to WP & Joomla).

$forceBackend : bool = FALSE

This link should be to the CMS back end (applies to WP & Joomla).

Return values
string

An HTML string containing a link to the given path.

urlEncode()

Encode url.

public static urlEncode(string $url) : null|string
Parameters
$url : string
Return values
null|string

validCallback()

Make sure a callback is valid in the current context.

public static validCallback(string $callback) : bool
Parameters
$callback : string

Name of the function to check.

Return values
bool

version()

Return the running civicrm version.

public static version() : string
Tags
throws
CRM_Core_Exception
Return values
string

civicrm version

versionXml()

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

xMemory()

Gather and print (and possibly log) amount of used memory.

public static xMemory([string $title = NULL ][, bool $log = FALSE ]) : mixed
Parameters
$title : string = NULL
$log : bool = FALSE

(optional) Whether to log the memory usage information.

parsePHPModules()

Determine which PHP modules are loaded.

private static parsePHPModules() : array<string|int, mixed>
Return values
array<string|int, mixed>

        
On this page

Search results