CRM_Utils_System_Standalone
extends CRM_Utils_System_Base
in package
Standalone specific stuff goes here.
Table of Contents
Properties
- $is_drupal : bool
- Deprecated property to check if this is a drupal install.
- $is_joomla : bool
- Deprecated property to check if this is a joomla install. The correct method is to have functions on the UF classes for all UF specific functions and leave the codebase oblivious to the type of CMS
- $is_wordpress : bool
- deprecated property to check if this is a wordpress install. The correct method is to have functions on the UF classes for all UF specific functions and leave the codebase oblivious to the type of CMS
- $supports_form_extensions : bool
- $supports_UF_Logging : bool
- Does this CMS / UF support a CMS specific logging mechanism?
Methods
- addHTMLHead() : mixed
- Append a string to the head of the html file.
- addScript() : bool
- Add an inline script.
- addScriptUrl() : bool
- Add a script file.
- addStyle() : bool
- Add an inline style.
- addStyleUrl() : bool
- Add a css file.
- allowSynchronizeUsers() : bool
- CMS User Sync doesn't make sense when using standaloneusers (but leave open the door for other user extensions, which might have a sync method)
- alterAssetUrl() : mixed
- Modify dynamic assets.
- appendBreadCrumb() : mixed
- Append an additional breadcrumb tag to the existing breadcrumb.
- appendCoreResources() : mixed
- Append any Standalone js to coreResourcesList.
- authenticate() : array<string|int, mixed>|bool
- Authenticate the user against the CMS db.
- canSetBasePage() : bool
- Can set base page for CiviCRM By default, CiviCRM will generate front-facing pages using the home page. This allows a different template for CiviCRM pages.
- checkCleanurls() : mixed
- checkPermissionAddUser() : bool
- Is the current user permitted to add a user.
- checkUserNameEmailExists() : mixed
- Check if username and email exists in the CMS.
- clearResourceCache() : mixed
- Flush css/js caches.
- cmsRootPath() : null|string
- In Standalone, this returns the app root
- createUser() : int|bool
- Create a user in the CMS.
- currentPath() : string|null
- Path of the current page e.g. 'civicrm/contact/view'
- flush() : mixed
- Reset any system caches that may be required for proper CiviCRM integration.
- formatResourceUrl() : bool
- Check if a resource url is within the public webroot and format appropriately.
- getAbsoluteBaseURL() : bool|mixed|string
- Get the absolute path to the site's base url.
- getBestUFID() : int
- Return a UFID (user account ID from the UserFramework / CMS system.
- getBestUFUniqueIdentifier() : string
- Return a unique identifier (usually an email address or username) from the UserFramework / CMS system.
- getCiviSourceStorage() : array<string|int, mixed>
- Determine the location of the CiviCRM source tree.
- getCMSPermissionsUrlParams() : array<string|int, mixed>
- Return the CMS-specific url for its permissions page
- getContactDetailsFromUser() : array<string|int, mixed>
- Get Contact details from User The contact parameters here will be used to create a Contact record to match the user record.
- getContentTemplate() : string
- Returns the Smarty template path to the main template that renders the content.
- getCRMDatabasePrefix() : string
- Get the CRM database as a 'prefix'.
- getDefaultBlockLocation() : string
- getDefaultFileStorage() : array<string|int, mixed>
- Determine the default location for file storage.
- getDefaultSiteSettings() : array<string|int, mixed>
- Return default Site Settings.
- getEmailFieldName() : string
- Get email field name from form values
- getLoggedInUfID() : int|null
- Get currently logged in user uf id.
- getLoggedInUniqueIdentifier() : string|null
- Get currently logged in user unique identifier - this tends to be the email address or user name.
- getLoginDestination() : string|null
- Get the login destination string.
- getLoginURL() : string
- Get user login URL for hosting CMS (method declared in each CMS system class)
- getModules() : array<string|int, mixed>
- List modules installed in the CMS, including enabled and disabled ones.
- getNotifyUrl() : string
- Return the Notification URL for Payments.
- getRelativeBaseURL() : string|false
- Get the relative path to the sites base url.
- getRoleNames() : array<string|int, mixed>|null
- Get role names
- getSessionId() : mixed
- This exists because of https://www.drupal.org/node/3006306 where they changed so that they don't start sessions for anonymous, but we want that.
- getTimeZoneOffset() : string|false|null
- Get timezone offset from CMS
- getTimeZoneString() : string
- Get timezone from CMS as a string.
- getUfGroupTypes() : array<string|int, mixed>
- Return the CMS-specific UF Group Types for profiles.
- getUfId() : int|null
- Determine the CMS-native ID from the user name
- getUFLocale() : string|null
- Get the locale set in the CMS.
- getUniqueIdentifierFromUserObject() : mixed
- Get Unique Identifier from UserFramework system (CMS).
- getUser() : array<string|int, mixed>
- Get an array of user details for a contact, containing at minimum the user ID & name.
- getUserById() : array<string|int, mixed>|bool
- Load an active user by internal user ID.
- getUserIDFromUserObject() : null|int
- Get User ID from UserFramework system (CMS).
- getUserRecordUrl() : string|null
- Get Url to view user record.
- getVersion() : string
- Get CMS Version.
- hasUsersTable() : bool
- Has CMS users table
- initialize() : mixed
- invalidateRouteCache() : mixed
- Invalidates the cache of dynamic routes and forces a rebuild.
- ipAddress() : string
- Get the client's IP address.
- isFrontEndPage() : bool
- Is a front end page being accessed.
- isLoaded() : bool
- isPasswordUserGenerated() : bool
- Check if user can create passwords or is initially assigned a system-generated one.
- isUserLoggedIn() : bool
- Check if user is logged in to the CMS.
- isUserRegistrationPermitted() : bool
- Check if user registration is permitted.
- languageNegotiationURL() : string
- Format the url as per language Negotiation.
- loadBootStrap() : bool
- Bootstrap Standalone.
- loadUser() : bool
- Load user into session.
- logger() : mixed
- Log error to CMS.
- logout() : mixed
- Immediately stop script execution and log out the user
- mailingWorkflowIsEnabled() : bool
- Check if mailing workflow is enabled
- mapConfigToSSL() : mixed
- Changes to the base_url should be made in settings.php directly.
- modifyStandaloneProfile() : string
- Modify standalone profile
- outputError() : mixed
- Output code from error function.
- permissionDenied() : mixed
- Respond that permission has been denied.
- postContainerBoot() : void
- Standalone's session cannot be initialized until CiviCRM is booted, since it is defined in an extension,
- postURL() : string
- Figure out the post url for QuickForm.
- prePostRedirect() : mixed
- Perform any necessary actions prior to redirecting via POST.
- resetBreadCrumb() : mixed
- Reset an additional breadcrumb tag to the existing breadcrumb.
- sendResponse() : mixed
- Send an HTTP Response base on PSR HTTP RespnseInterface response.
- sessionStart() : mixed
- Start a new session.
- setHttpHeader() : mixed
- setMessage() : mixed
- Set a message in the CMS to display to a user.
- setMySQLTimeZone() : mixed
- Set MySQL timezone so that timestamp fields show the correct time.
- setPhpTimeZone() : mixed
- Set PHP timezone
- setTimeZone() : mixed
- Set system timezone (both PHP + MySQL)
- setTitle() : mixed
- Sets the title of the page.
- setUFLocale() : bool
- Set the localisation from the user framework.
- setUserSession() : mixed
- Set a init session with user object.
- showPasswordFieldWhenAdminCreatesUser() : mixed
- Should the admin be able to set the password when creating a user or does the CMS want it a different way.
- suppressProfileFormErrors() : bool
- Suppress profile form errors
- synchronizeUsers() : array<string|int, mixed>
- Create CRM contacts for all existing CMS users
- synchronizeUsersIfAllowed() : array<string|int, mixed>
- Run CMS user sync if allowed, otherwise just returns empty array
- theme() : string|null
- If we are using a theming system, invoke theme, else just print the content.
- updateCategories() : mixed
- Clear CMS caches related to the user registration/profile forms.
- updateCMSName() : mixed
- Update a user's email address in the CMS.
- url() : string
- Generate the url string to a CiviCRM path.
- userLoginFinalize() : mixed
- Perform any post login activities required by the CMS.
- verifyPassword() : mixed
- Verify password
- viewsExists() : bool
- Determine if the Views module exists.
- viewsIntegration() : string
- CiviCRM Table prefixes To display for CMS integration.
- isUserExtensionAvailable() : bool
- Standalone uses a CiviCRM Extension, Standaloneusers, to provide user functionality
- registerDefaultPaths() : void
- Specify the default computation for various paths/URLs.
Properties
$is_drupal
Deprecated property to check if this is a drupal install.
TRUE, if the CMS is Drupal.
public
bool
$is_drupal
= \FALSE
The correct method is to have functions on the UF classes for all UF specific functions and leave the codebase oblivious to the type of CMS
$is_joomla
Deprecated property to check if this is a joomla install. The correct method is to have functions on the UF classes for all UF specific functions and leave the codebase oblivious to the type of CMS
TRUE, if the CMS is Joomla!.
public
bool
$is_joomla
= \FALSE
$is_wordpress
deprecated property to check if this is a wordpress install. The correct method is to have functions on the UF classes for all UF specific functions and leave the codebase oblivious to the type of CMS
TRUE, if the CMS is WordPress.
public
bool
$is_wordpress
= \FALSE
$supports_form_extensions
public
bool
$supports_form_extensions
= \FALSE
TRUE, if the CMS allows CMS forms to be extended by hooks.
$supports_UF_Logging
Does this CMS / UF support a CMS specific logging mechanism?
public
bool
$supports_UF_Logging
= \FALSE
Tags
Methods
addHTMLHead()
Append a string to the head of the html file.
public
addHTMLHead(mixed $header) : mixed
Parameters
- $header : mixed
Tags
addScript()
Add an inline script.
public
addScript(string $code, string $region) : bool
Note: This function is not to be called directly
Parameters
- $code : string
-
javascript code
- $region : string
-
location within the document: 'html-header', 'page-header', 'page-footer'.
Tags
Return values
bool —TRUE if we support this operation in this CMS, FALSE otherwise
addScriptUrl()
Add a script file.
public
addScriptUrl(string $url, string $region) : bool
Note: This function is not to be called directly
Parameters
- $url : string
-
absolute path to file
- $region : string
-
location within the document: 'html-header', 'page-header', 'page-footer'.
Tags
Return values
bool —TRUE if we support this operation in this CMS, FALSE otherwise
addStyle()
Add an inline style.
public
addStyle(mixed $code, mixed $region) : bool
Parameters
- $code : mixed
-
css code
- $region : mixed
-
location within the document: 'html-header', 'page-header', 'page-footer'.
Tags
Return values
bool —TRUE if we support this operation in this CMS, FALSE otherwise
addStyleUrl()
Add a css file.
public
addStyleUrl(mixed $url, mixed $region) : bool
Parameters
- $url : mixed
-
absolute path to file
- $region : mixed
-
location within the document: 'html-header', 'page-header', 'page-footer'.
Tags
Return values
bool —TRUE if we support this operation in this CMS, FALSE otherwise
allowSynchronizeUsers()
CMS User Sync doesn't make sense when using standaloneusers (but leave open the door for other user extensions, which might have a sync method)
public
allowSynchronizeUsers() : bool
Return values
boolalterAssetUrl()
Modify dynamic assets.
public
alterAssetUrl(GenericHookEvent $e) : mixed
Parameters
- $e : GenericHookEvent
appendBreadCrumb()
Append an additional breadcrumb tag to the existing breadcrumb.
public
appendBreadCrumb(mixed $breadcrumbs) : mixed
Parameters
- $breadcrumbs : mixed
Tags
appendCoreResources()
Append any Standalone js to coreResourcesList.
public
appendCoreResources(GenericHookEvent $e) : mixed
Parameters
- $e : GenericHookEvent
authenticate()
Authenticate the user against the CMS db.
public
authenticate(string $name, string $password[, bool $loadCMSBootstrap = FALSE ][, string $realPath = NULL ]) : array<string|int, mixed>|bool
Parameters
- $name : string
-
The user name.
- $password : string
-
The password for the above user.
- $loadCMSBootstrap : bool = FALSE
-
Not used in Standalone context
- $realPath : string = NULL
-
Not used in Standalone context
Tags
Return values
array<string|int, mixed>|bool —[contactID, ufID, unique string] else false if no auth
canSetBasePage()
Can set base page for CiviCRM By default, CiviCRM will generate front-facing pages using the home page. This allows a different template for CiviCRM pages.
public
canSetBasePage() : bool
Return values
boolcheckCleanurls()
public
checkCleanurls() : mixed
checkPermissionAddUser()
Is the current user permitted to add a user.
public
checkPermissionAddUser() : bool
Return values
boolcheckUserNameEmailExists()
Check if username and email exists in the CMS.
public
checkUserNameEmailExists(array<string|int, mixed> &$params, array<string|int, mixed> &$errors[, string $emailName = 'email' ]) : mixed
Parameters
- $params : array<string|int, mixed>
-
Array of name and mail values.
- $errors : array<string|int, mixed>
-
Array of errors.
- $emailName : string = 'email'
-
Field label for the 'email'.
clearResourceCache()
Flush css/js caches.
public
clearResourceCache() : mixed
cmsRootPath()
In Standalone, this returns the app root
public
cmsRootPath() : null|string
The $appRootPath global is set in civicrm.standalone.php
Return values
null|stringcreateUser()
Create a user in the CMS.
public
createUser(mixed &$params, mixed $emailParam) : int|bool
Parameters
- $params : mixed
- $emailParam : mixed
Tags
Return values
int|bool —uid if user exists, false otherwise
currentPath()
Path of the current page e.g. 'civicrm/contact/view'
public
static currentPath() : string|null
Return values
string|null —the current menu path
flush()
Reset any system caches that may be required for proper CiviCRM integration.
public
flush() : mixed
formatResourceUrl()
Check if a resource url is within the public webroot and format appropriately.
public
formatResourceUrl(mixed &$url) : bool
This seems to be a legacy function. We assume all resources are ok directory and always return TRUE. As well, we clean up the $url.
Parameters
- $url : mixed
Tags
Return values
boolgetAbsoluteBaseURL()
Get the absolute path to the site's base url.
public
getAbsoluteBaseURL() : bool|mixed|string
Return values
bool|mixed|stringgetBestUFID()
Return a UFID (user account ID from the UserFramework / CMS system.
public
getBestUFID([object $user = NULL ]) : int
ID is based on the user object passed, defaulting to the logged in user if not passed.
Note that ambiguous situation occurs in CRM_Core_BAO_UFMatch::synchronize - a cleaner approach would seem to be resolving the user id before calling the function.
Note there is already a function getUFId which takes $username as a param - we could add $user as a second param to it but it seems messy - just overloading it because the name is taken.
Parameters
- $user : object = NULL
Return values
int —User ID of UF System
getBestUFUniqueIdentifier()
Return a unique identifier (usually an email address or username) from the UserFramework / CMS system.
public
getBestUFUniqueIdentifier([object $user = NULL ]) : string
This is based on the user object passed, defaulting to the logged in user if not passed.
Note that ambiguous situation occurs in CRM_Core_BAO_UFMatch::synchronize - a cleaner approach would seem to be resolving the unique identifier before calling the function.
Parameters
- $user : object = NULL
Return values
string —unique identifier from the UF System
getCiviSourceStorage()
Determine the location of the CiviCRM source tree.
public
getCiviSourceStorage() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —- url: string. ex: "http://example.com/sites/all/modules/civicrm"
- path: string. ex: "/var/www/sites/all/modules/civicrm"
getCMSPermissionsUrlParams()
Return the CMS-specific url for its permissions page
public
getCMSPermissionsUrlParams() : array<string|int, mixed>
Return values
array<string|int, mixed>getContactDetailsFromUser()
Get Contact details from User The contact parameters here will be used to create a Contact record to match the user record.
public
getContactDetailsFromUser(array<string|int, mixed> $uf_match) : array<string|int, mixed>
Parameters
- $uf_match : array<string|int, mixed>
-
Array of user object, unique ID.
Return values
array<string|int, mixed> —Array of contact parameters.
getContentTemplate()
Returns the Smarty template path to the main template that renders the content.
public
static getContentTemplate([mixed $print = 0 ]) : string
Parameters
- $print : mixed = 0
Tags
Return values
stringgetCRMDatabasePrefix()
Get the CRM database as a 'prefix'.
public
getCRMDatabasePrefix() : string
This returns a string that can be prepended to a query to include a CRM table.
However, this string should contain backticks, or not, in accordance with the CMS's drupal views expectations, if any.
Return values
stringgetDefaultBlockLocation()
public
getDefaultBlockLocation() : string
Return values
stringgetDefaultFileStorage()
Determine the default location for file storage.
public
getDefaultFileStorage() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —- url: string. ex: "http://example.com/sites/foo.com/files/civicrm"
- path: string. ex: "/var/www/sites/foo.com/files/civicrm"
getDefaultSiteSettings()
Return default Site Settings.
public
getDefaultSiteSettings(string $dir) : array<string|int, mixed>
Parameters
- $dir : string
Return values
array<string|int, mixed> —- $url, (Joomla - non admin url)
- $siteName,
- $siteRoot
getEmailFieldName()
Get email field name from form values
public
getEmailFieldName(CRM_Core_Form $form, array<string|int, mixed> $fields) : string
Parameters
- $form : CRM_Core_Form
- $fields : array<string|int, mixed>
Return values
stringgetLoggedInUfID()
Get currently logged in user uf id.
public
getLoggedInUfID() : int|null
Tags
Return values
int|null —logged in user uf id.
getLoggedInUniqueIdentifier()
Get currently logged in user unique identifier - this tends to be the email address or user name.
public
getLoggedInUniqueIdentifier() : string|null
Return values
string|null —logged in user unique identifier
getLoginDestination()
Get the login destination string.
public
getLoginDestination(CRM_Core_Form &$form) : string|null
When this is passed in the URL the user will be directed to it after filling in the CMS form.
Parameters
- $form : CRM_Core_Form
-
Form object representing the 'current' form - to which the user will be returned.
Return values
string|null —destination value for URL
getLoginURL()
Get user login URL for hosting CMS (method declared in each CMS system class)
public
getLoginURL([mixed $destination = '' ]) : string
Parameters
- $destination : mixed = ''
-
If present, add destination to querystring (works for Drupal and WordPress only).
Tags
Return values
string —loginURL for the current CMS
getModules()
List modules installed in the CMS, including enabled and disabled ones.
public
getModules() : array<string|int, mixed>
Return values
array<string|int, mixed> —[CRM_Core_Module]
getNotifyUrl()
Return the Notification URL for Payments.
public
getNotifyUrl([string $path = NULL ][, string $query = NULL ][, bool $absolute = FALSE ][, string $fragment = NULL ][, bool $frontend = FALSE ][, bool $forceBackend = FALSE ]) : string
The default is to pass the params through to url()
. However the WordPress
CMS class overrides this method because Notification URLs must always target
the Base Page to avoid IPN failures when Forms are embedded in pages that
require authentication.
Parameters
- $path : string = NULL
-
The path being linked to, such as "civicrm/add".
- $query : string = NULL
-
A query string to append to the link.
- $absolute : bool = FALSE
-
Whether to force the output to be an absolute link (beginning with 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.
- $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.
getRelativeBaseURL()
Get the relative path to the sites base url.
public
getRelativeBaseURL() : string|false
Return values
string|falsegetRoleNames()
Get role names
public
getRoleNames() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|nullgetSessionId()
This exists because of https://www.drupal.org/node/3006306 where they changed so that they don't start sessions for anonymous, but we want that.
public
getSessionId() : mixed
getTimeZoneOffset()
Get timezone offset from CMS
public
getTimeZoneOffset() : string|false|null
Return values
string|false|nullgetTimeZoneString()
Get timezone from CMS as a string.
public
getTimeZoneString() : string
Tags
Return values
string —Timezone string e.g. 'America/Los_Angeles'
getUfGroupTypes()
Return the CMS-specific UF Group Types for profiles.
public
getUfGroupTypes() : array<string|int, mixed>
Return values
array<string|int, mixed>getUfId()
Determine the CMS-native ID from the user name
public
getUfId(string $username) : int|null
In standalone this means the User ID.
Parameters
- $username : string
Return values
int|nullgetUFLocale()
Get the locale set in the CMS.
public
getUFLocale() : string|null
Return values
string|null —Locale or null for none
getUniqueIdentifierFromUserObject()
Get Unique Identifier from UserFramework system (CMS).
public
getUniqueIdentifierFromUserObject(object $user) : mixed
Parameters
- $user : object
-
Object as described by the User Framework.
Return values
mixed —Unique identifier from the user Framework system
getUser()
Get an array of user details for a contact, containing at minimum the user ID & name.
public
getUser(int $contactID) : array<string|int, mixed>
Parameters
- $contactID : int
Return values
array<string|int, mixed> —CMS user details including
- id
- name (ie the system user name.
getUserById()
Load an active user by internal user ID.
public
getUserById(int $userID) : array<string|int, mixed>|bool
Parameters
- $userID : int
Return values
array<string|int, mixed>|bool —FALSE if not found.
getUserIDFromUserObject()
Get User ID from UserFramework system (CMS).
public
getUserIDFromUserObject(mixed $user) : null|int
Parameters
- $user : mixed
-
Object as described by the User Framework.
Tags
Return values
null|intgetUserRecordUrl()
Get Url to view user record.
public
getUserRecordUrl(int $contactID) : string|null
Parameters
- $contactID : int
-
Contact ID.
Return values
string|nullgetVersion()
Get CMS Version.
public
getVersion() : string
Return values
stringhasUsersTable()
Has CMS users table
public
hasUsersTable() : bool
Return values
boolinitialize()
public
initialize() : mixed
invalidateRouteCache()
Invalidates the cache of dynamic routes and forces a rebuild.
public
invalidateRouteCache() : mixed
ipAddress()
Get the client's IP address.
public
ipAddress() : string
Return values
string —IP address
isFrontEndPage()
Is a front end page being accessed.
public
isFrontEndPage() : bool
Generally this would be a contribution form or other public page as opposed to a backoffice page (like contact edit).
Return values
boolisLoaded()
public
isLoaded() : bool
Tags
Return values
boolisPasswordUserGenerated()
Check if user can create passwords or is initially assigned a system-generated one.
public
isPasswordUserGenerated() : bool
Tags
Return values
boolisUserLoggedIn()
Check if user is logged in to the CMS.
public
isUserLoggedIn() : bool
Tags
Return values
boolisUserRegistrationPermitted()
Check if user registration is permitted.
public
isUserRegistrationPermitted() : bool
Tags
Return values
boollanguageNegotiationURL()
Format the url as per language Negotiation.
public
languageNegotiationURL(mixed $url[, mixed $addLanguagePart = TRUE ][, mixed $removeLanguagePart = FALSE ]) : string
Parameters
- $url : mixed
- $addLanguagePart : mixed = TRUE
- $removeLanguagePart : mixed = FALSE
Tags
Return values
string —Formatted url.
loadBootStrap()
Bootstrap Standalone.
public
loadBootStrap([array<string|int, mixed> $params = [] ][, bool $loadUser = TRUE ][, bool $throwError = TRUE ][, bool|string $realPath = NULL ]) : bool
In CRM_Utils_System context, this function is used by cv/civix/? to bootstrap the CMS after CiviCRM is already loaded (as compared to normal web requests, which load the CMS then CiviCRM)
For Standalone there shouldn't be anything additional to load at this stage in terms of system services.
This is used by cv and civix, but not I (artfulrobot) think, in the main http requests. External scripts may assume loading a users requires the CMS bootstrap
- so we keep support for logging in a user now
Parameters
- $params : array<string|int, mixed> = []
-
Either uid, or name & pass.
- $loadUser : bool = TRUE
-
Boolean Require CMS user load.
- $throwError : bool = TRUE
-
If true, print error on failure and exit.
- $realPath : bool|string = NULL
-
Not used in Standalone context
Tags
Return values
boolloadUser()
Load user into session.
public
loadUser(mixed $username) : bool
Parameters
- $username : mixed
Tags
Return values
boollogger()
Log error to CMS.
public
logger(string $message[, string|null $priority = NULL ]) : mixed
Parameters
- $message : string
- $priority : string|null = NULL
logout()
Immediately stop script execution and log out the user
public
logout() : mixed
mailingWorkflowIsEnabled()
Check if mailing workflow is enabled
public
mailingWorkflowIsEnabled() : bool
Return values
boolmapConfigToSSL()
Changes to the base_url should be made in settings.php directly.
public
mapConfigToSSL() : mixed
modifyStandaloneProfile()
Modify standalone profile
public
modifyStandaloneProfile(string $profile, array<string|int, mixed> $params) : string
Parameters
- $profile : string
- $params : array<string|int, mixed>
Return values
stringoutputError()
Output code from error function.
public
outputError(string $content) : mixed
Parameters
- $content : string
permissionDenied()
Respond that permission has been denied.
public
permissionDenied() : mixed
Note that there are a few subtle variations on this:
- For authenticated users with a session/cookie, it uses "statusBounce()" to show popup (on prior page or dashboard page).
- For authenticated users with stateless requests, it shows formatted error page.
- For unauthenticated users, it shows login screen with an error blurb.
postContainerBoot()
Standalone's session cannot be initialized until CiviCRM is booted, since it is defined in an extension,
public
postContainerBoot() : void
This is also when we set timezone
postURL()
Figure out the post url for QuickForm.
public
postURL(string $action) : string
Parameters
- $action : string
-
The default url if one is pre-specified.
Return values
string —The url to post the form.
prePostRedirect()
Perform any necessary actions prior to redirecting via POST.
public
prePostRedirect() : mixed
resetBreadCrumb()
Reset an additional breadcrumb tag to the existing breadcrumb.
public
resetBreadCrumb() : mixed
Tags
sendResponse()
Send an HTTP Response base on PSR HTTP RespnseInterface response.
public
sendResponse(ResponseInterface $response) : mixed
Parameters
- $response : ResponseInterface
sessionStart()
Start a new session.
public
sessionStart() : mixed
Generally this uses the SessionHander provided by Standaloneusers extension - but we fallback to a default PHP session to: a) allow the installer to work (early in the Standalone install, we dont have Standaloneusers yet) b) avoid unhelpfully hard crash if the ExtensionSystem goes down (without the fallback, the crash here swallows whatever error is actually causing the crash)
setHttpHeader()
public
setHttpHeader(string $name, string $value) : mixed
Parameters
- $name : string
- $value : string
setMessage()
Set a message in the CMS to display to a user.
public
setMessage(mixed $message) : mixed
Parameters
- $message : mixed
-
The message to set.
Tags
setMySQLTimeZone()
Set MySQL timezone so that timestamp fields show the correct time.
public
setMySQLTimeZone([string|null $timeZone = NULL ]) : mixed
Parameters
- $timeZone : string|null = NULL
-
Timezone string - if none provided will be fetched from system
setPhpTimeZone()
Set PHP timezone
public
setPhpTimeZone([string|null $timeZone = NULL ]) : mixed
Parameters
- $timeZone : string|null = NULL
-
Timezone string - default value will be fetched using getTimeZoneString if not provided or falsey
setTimeZone()
Set system timezone (both PHP + MySQL)
public
setTimeZone([string|null $timeZone = NULL ]) : mixed
Parameters
- $timeZone : string|null = NULL
setTitle()
Sets the title of the page.
public
setTitle(mixed $title[, mixed $pageTitle = NULL ]) : mixed
Parameters
- $title : mixed
-
Title to set in html header
- $pageTitle : mixed = NULL
-
Title to set in html body (if different)
Tags
setUFLocale()
Set the localisation from the user framework.
public
setUFLocale(string $civicrm_language) : bool
Parameters
- $civicrm_language : string
Return values
boolsetUserSession()
Set a init session with user object.
public
setUserSession(array<string|int, mixed> $data) : mixed
Parameters
- $data : array<string|int, mixed>
-
Array with user specific data
showPasswordFieldWhenAdminCreatesUser()
Should the admin be able to set the password when creating a user or does the CMS want it a different way.
public
showPasswordFieldWhenAdminCreatesUser() : mixed
suppressProfileFormErrors()
Suppress profile form errors
public
suppressProfileFormErrors() : bool
Return values
boolsynchronizeUsers()
Create CRM contacts for all existing CMS users
public
synchronizeUsers() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>synchronizeUsersIfAllowed()
Run CMS user sync if allowed, otherwise just returns empty array
public
synchronizeUsersIfAllowed() : array<string|int, mixed>
Return values
array<string|int, mixed>theme()
If we are using a theming system, invoke theme, else just print the content.
public
theme(mixed &$content[, mixed $print = FALSE ][, mixed $maintenance = FALSE ]) : string|null
Parameters
- $content : mixed
-
The content that will be themed.
- $print : mixed = FALSE
-
Are we displaying to the screen or bypassing theming?.
- $maintenance : mixed = FALSE
-
For maintenance mode.
Tags
Return values
string|null —NULL, If $print is FALSE, and some other criteria match up. The themed string, otherwise.
updateCategories()
Clear CMS caches related to the user registration/profile forms.
public
updateCategories() : mixed
Tags
updateCMSName()
Update a user's email address in the CMS.
public
updateCMSName(mixed $ufID, mixed $email) : mixed
Parameters
- $ufID : mixed
-
User ID in CMS.
- $email : mixed
-
Primary contact email address.
Tags
url()
Generate the url string to a CiviCRM path.
public
url([mixed $path = '' ][, mixed $query = '' ][, mixed $absolute = FALSE ][, mixed $fragment = NULL ][, mixed $frontend = FALSE ][, mixed $forceBackend = FALSE ]) : string
Parameters
- $path : mixed = ''
-
The path being linked to, such as "civicrm/add".
- $query : mixed = ''
-
A query string to append to the link.
- $absolute : mixed = FALSE
-
Whether to force the output to be an absolute link (beginning with http). Useful for links that will be displayed outside the site, such as in an RSS feed.
- $fragment : mixed = NULL
-
A fragment identifier (named anchor) to append to the link.
- $frontend : mixed = FALSE
-
This link should be to the CMS front end (applies to WP & Joomla).
- $forceBackend : mixed = FALSE
-
This link should be to the CMS back end (applies to WP & Joomla).
Tags
Return values
stringuserLoginFinalize()
Perform any post login activities required by the CMS.
public
userLoginFinalize([array<string|int, mixed> $params = [] ]) : mixed
e.g. for drupal: records a watchdog message about the new session, saves the login timestamp, calls hook_user op 'login' and generates a new session.
Parameters
- $params : array<string|int, mixed> = []
-
FIXME: Document values accepted/required by $params
verifyPassword()
Verify password
public
verifyPassword(array<string|int, mixed> $params, array<string|int, mixed> &$errors) : mixed
Parameters
- $params : array<string|int, mixed>
-
Array of name, mail and password values.
- $errors : array<string|int, mixed>
-
Array of errors.
viewsExists()
Determine if the Views module exists.
public
viewsExists() : bool
Return values
boolviewsIntegration()
CiviCRM Table prefixes To display for CMS integration.
public
viewsIntegration() : string
Return values
stringisUserExtensionAvailable()
Standalone uses a CiviCRM Extension, Standaloneusers, to provide user functionality
protected
isUserExtensionAvailable() : bool
This is great for modularity - but does mean that there are points in bootstrap / install / failure where the extension isn't available and we need to provide fallback/failsafe behaviours
This function provides a general check for whether we are in such a scenario
(In the future, alternative user-providing extensions may be available - in which case this check might need generalising. One possibility could be to use the Api4 User interface as a spec for what any extension must provide
Then maybe the check could be if (class_exists(\Civi\Api4\User::class))?
Return values
bool —Whether user extension is available
registerDefaultPaths()
Specify the default computation for various paths/URLs.
protected
registerDefaultPaths() : void