Skip to content

Instantly share code, notes, and snippets.

@123andy
Created March 17, 2022 21:38
Show Gist options
  • Save 123andy/f023c6ece3157be9062a674771cbc02d to your computer and use it in GitHub Desktop.
Save 123andy/f023c6ece3157be9062a674771cbc02d to your computer and use it in GitHub Desktop.
Example template for a context token
function getContextToken (
$project_id = null,
$record = null,
$event_id = null,
$module_prefix = self::_PREFIX,
$custom = [],
$duration_valid_in_mins = 5
) {
// refactor to allow passing parameters in an array as a single argument as well
// use database salt to prevent cross-site issues
...
return $context_token;
}
function validateContextToken($context_token,
) {
$project_id = null,
$record = null,
$event_id = null,
$module_prefix = self::_PREFIX,
$custom = [],
...
return true|false
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment