Documentation

CRM_Core_CommunityMessages
in package

Manage the download, validation, and rendering of community messages

Table of Contents

Constants

DEFAULT_MESSAGES_URL  = 'https://alert.civicrm.org/alert?prot=1&ver={ver}&uf={uf}&sid={sid}&lang={lang}&co={co}'
DEFAULT_PERMISSION  = 'administer CiviCRM'
DEFAULT_RETRY  = 7200
Default time to wait before retrying.

Properties

$cache  : CRM_Utils_Cache_Interface
$client  : CRM_Utils_HttpClient
$messagesUrl  : false|string
Url to retrieve community messages from.

Methods

__construct()  : mixed
Class constructor.
create()  : CRM_Core_CommunityMessages
Create default instance.
evalMarkup()  : string
fetchDocument()  : null|array<string|int, mixed>
Download document from URL and parse as JSON.
getDocument()  : null|array<string|int, mixed>
Get the messages document (either from the cache or by downloading).
getRenderedUrl()  : false|string
Get the final, usable URL string (after interpolating any variables)
isEnabled()  : bool
pick()  : null|array<string|int, mixed>
Pick a message to display.
validateDocument()  : bool
Ensure that a document is well-formed

Constants

DEFAULT_MESSAGES_URL

public mixed DEFAULT_MESSAGES_URL = 'https://alert.civicrm.org/alert?prot=1&ver={ver}&uf={uf}&sid={sid}&lang={lang}&co={co}'

DEFAULT_RETRY

Default time to wait before retrying.

public mixed DEFAULT_RETRY = 7200

Properties

$messagesUrl

Url to retrieve community messages from.

protected false|string $messagesUrl

False means a retrieval will not be attempted.

Methods

evalMarkup()

public static evalMarkup(string $markup) : string
Parameters
$markup : string
Return values
string

fetchDocument()

Download document from URL and parse as JSON.

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

parsed JSON

getDocument()

Get the messages document (either from the cache or by downloading).

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

getRenderedUrl()

Get the final, usable URL string (after interpolating any variables)

public getRenderedUrl() : false|string
Return values
false|string

pick()

Pick a message to display.

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

validateDocument()

Ensure that a document is well-formed

public validateDocument(array<string|int, mixed> $document) : bool
Parameters
$document : array<string|int, mixed>
Return values
bool

        
On this page

Search results