Class to implement utility methods. More...
Static Public Member Functions | |
| static bool | isLtiMessage () |
| Check whether the request received could be an LTI message. | |
| static array | getRequestParameters () |
| Return GET and POST request parameters (POST parameters take precedence). | |
| static void | logError ($message, $showSource=true) |
| Log an error message. | |
| static void | logInfo ($message, $showSource=false) |
| Log an information message. | |
| static void | logDebug ($message, $showSource=false) |
| Log a debug message. | |
| static void | logRequest ($debugLevel=false) |
| Log a request received. | |
| static void | logForm ($url, $params, $method='POST', $debugLevel=false) |
| Log a form submission. | |
| static void | log ($message, $showSource=false) |
| Log an error message irrespective of the logging level. | |
| static string | sendForm ($url, $params, $target='', $javascript='') |
| Generate a web page containing an auto-submitted form of parameters. | |
| static void | redirect ($url, $params) |
| Redirect to a URL with query parameters. | |
| static void | setTestCookie ($delete=false) |
| Set or delete a test cookie. | |
| static string | getRandomString ($length=8) |
| Generate a random string. | |
| static string | stripHtml ($html) |
| Strip HTML tags from a string. | |
| static object | cloneObject ($obj) |
| Clone an object and any objects it contains. | |
Public Attributes | |
| const | LTI_VERSION1 = 'LTI-1p0' |
| LTI version 1 for messages. | |
| const | LTI_VERSION1P3 = '1.3.0' |
| LTI version 1.3 for messages. | |
| const | LTI_VERSION2 = 'LTI-2p0' |
| LTI version 2 for messages. | |
| const | JWT_CLAIM_PREFIX = 'https://purl.imsglobal.org/spec/lti' |
| Prefix for standard JWT message claims. | |
| const | MESSAGE_TYPE_MAPPING |
| Mapping for standard message types. | |
| const | JWT_CLAIM_MAPPING |
| Mapping for standard message parameters to JWT claim. | |
| const | LOGLEVEL_NONE = 0 |
| No logging. | |
| const | LOGLEVEL_ERROR = 1 |
| Log errors only. | |
| const | LOGLEVEL_INFO = 2 |
| Log error and information messages. | |
| const | LOGLEVEL_DEBUG = 3 |
| Log all messages. | |
| const | TEST_COOKIE_NAME = 'celtic_lti_test_cookie' |
| Name of test cookie. | |
Static Public Attributes | |
| static | $LTI_VERSIONS = array(self::LTI_VERSION1, self::LTI_VERSION1P3, self::LTI_VERSION2) |
| Permitted LTI versions for messages. | |
| static | $METHOD_NAMES |
| List of supported message types and associated class methods. | |
| static | $requestParameters = null |
| GET and POST request parameters. | |
| static int | $logLevel = self::LOGLEVEL_NONE |
| Current logging level. | |
| static int | $formSubmissionTimeout = 2 |
| Delay (in seconds) before a manual button is displayed in case a browser is blocking a form submission. | |
Class to implement utility methods.
|
static |
Clone an object and any objects it contains.
| object | $obj | Object to be cloned |
|
static |
Generate a random string.
The generated string will only comprise letters (upper- and lower-case) and digits.
| int | $length | Length of string to be generated (optional, default is 8 characters) |
|
static |
Return GET and POST request parameters (POST parameters take precedence).
Referenced by Tool\getPlatformToRegister().
|
static |
Check whether the request received could be an LTI message.
|
static |
Log an error message irrespective of the logging level.
| string | $message | Message to be logged |
| bool | $showSource | True if the name and line number of the current file are to be included |
|
static |
Log a debug message.
| string | $message | Message to be logged |
| bool | $showSource | True if the name and line number of the current file are to be included |
Referenced by ApiToolConsumer\__construct(), ConsumerNonce\__construct(), ToolProvider\__construct(), DataConnector_mysql\__construct(), ContentItemPlacement\__construct(), ContentItemImage\__construct(), ToolConsumer\__construct(), CanvasApiToolProvider\__construct(), ApiToolProvider\__construct(), ContentItem\__construct(), HTTPMessage\__construct(), SpomkyLabsClient\__construct(), DataConnector_pdo\executeQuery(), Tool\findService(), ResourceLink\getConsumerId(), HttpMessage\getHttpClient(), ResourceLink\getMembership(), Context\setConsumerId(), and ResourceLink\setConsumerId().
|
static |
Log an error message.
| string | $message | Message to be logged |
| bool | $showSource | True if the name and line number of the current file are to be included |
Referenced by DataConnector_pdo\executeQuery(), and Platform\fromConsumerKey().
|
static |
Log a form submission.
| string | $url | URL to which the form should be submitted |
| array | $params | Array of form parameters |
| string | $method | HTTP Method used to submit form (optional, default is POST) |
| bool | $debugLevel | True if the form details should always be logged (optional, default is false to use current log level) |
|
static |
Log an information message.
| string | $message | Message to be logged |
| bool | $showSource | True if the name and line number of the current file are to be included |
|
static |
Log a request received.
| bool | $debugLevel | True if the request details should be logged at the debug level (optional, default is false for information level) |
|
static |
Redirect to a URL with query parameters.
| string | $url | URL to which the form should be submitted |
| array | $params | Array of form parameters |
|
static |
Generate a web page containing an auto-submitted form of parameters.
| string | $url | URL to which the form should be submitted |
| array | $params | Array of form parameters |
| string | $target | Name of target (optional) |
| string | $javascript | Javascript to be inserted (optional, default is to just auto-submit form) |
|
static |
Set or delete a test cookie.
| bool | $delete | True if the cookie is to be deleted (optional, default is false) |
|
static |
Strip HTML tags from a string.
| string | $html | HTML string to be stripped |
|
static |
Delay (in seconds) before a manual button is displayed in case a browser is blocking a form submission.
$formSubmissionTimeout
|
static |
|
static |
List of supported message types and associated class methods.
| const MESSAGE_TYPE_MAPPING |
Mapping for standard message types.