CmsAdminUtils
in package
A set of static utilities for assisting with admin requests
Tags
Table of Contents
Constants
- ITEMNAME_REGEX = '<^[a-zA-Z0-9_\x7f-\xff][a-zA-Z0-9_\ \/\+\-\,\.\x7f-\xff]*$>'
- A regular expression to use when testing if an item has a valid name.
Methods
- fetch_latest_cmsms_ver() : string
- Get the latest available CMSMS version.
- get_generic_url() : string
- Convert an admin request URL to a generic form that is suitable for saving to a database.
- get_session_url() : string
- Convert a generic URL into something that is suitable for this users session.
- is_valid_itemname() : bool|string
- Test if a string is suitable for use as a name of an item in CMSMS.
- site_needs_updating() : bool
- Test if the current site is in need of upgrading (a new version of CMSMS is available)
Constants
ITEMNAME_REGEX
A regular expression to use when testing if an item has a valid name.
public
mixed
ITEMNAME_REGEX
= '<^[a-zA-Z0-9_\x7f-\xff][a-zA-Z0-9_\ \/\+\-\,\.\x7f-\xff]*$>'
Methods
fetch_latest_cmsms_ver()
Get the latest available CMSMS version.
public
static fetch_latest_cmsms_ver() : string
This method does a remote request to the version check URL at most once per day.
Return values
stringget_generic_url()
Convert an admin request URL to a generic form that is suitable for saving to a database.
public
static get_generic_url(string $in_url) : string
This is useful for things like bookmarks and homepages. Note it only works for admin urls with user key of the current admin user
Parameters
- $in_url : string
-
The input URL that has the session key in it.
Return values
string —A URL that is converted to a generic form.
get_session_url()
Convert a generic URL into something that is suitable for this users session.
public
static get_session_url(string $in_url) : string
Parameters
- $in_url : string
-
The generic url. usually retrieved from a preference or from the database
Return values
string —A URL that has a session key in it.
is_valid_itemname()
Test if a string is suitable for use as a name of an item in CMSMS.
public
static is_valid_itemname(string $str) : bool|string
For use by various modules and the core. The name must begin with an alphanumeric character (but some extended characters are allowed). And must be followed by the same alphanumeric characters note the name is not necessarily guaranteed to be usable in smarty without backticks.
Parameters
- $str : string
-
The string to test
Return values
bool|string —FALSE on error or the validated string.
site_needs_updating()
Test if the current site is in need of upgrading (a new version of CMSMS is available)
public
static site_needs_updating() : bool