function tokenauth_text_load in Token authentication 6
Same name and namespace in other branches
- 6.2 tokenauth.inc \tokenauth_text_load()
- 7 tokenauth.inc \tokenauth_text_load()
Helper function to pull tokenauth UI text from the variables table, and optionally render.
Parameters
$account: User object for which the text will be pulled. Only useful in render mode.
$render: Whether to pass along the raw text or render using specific input format. (And token replacement, if enabled.)
2 calls to tokenauth_text_load()
- tokenauth_admin_settings in ./
tokenauth.pages.inc - Menu callback for Tokenauth administration interface.
- tokenauth_user_profile_form in ./
tokenauth.pages.inc - Menu callback. Prints the token and instructions.
File
- ./
tokenauth.inc, line 171 - Provides tokenauth API for Token Authentication module.
Code
function tokenauth_text_load($account = NULL, $render = FALSE) {
$tokenauth_text = variable_get('tokenauth_text', array());
if (empty($tokenauth_text)) {
$tokenauth_text['body'] = <<<EOT
You may use an alphanumeric token to see restricted content using RSS Feed Readers or other simple content viewers. This token authenticates your user account, and as unique to you. If you have reason to believe someone else is misusing your token, please press the <em>Reset token</em> button to get a new one, and update your RSS readers.
Append the string below to the end of URLs approved for use with Token Authentication for temporary authentication.
EOT;
if (module_exists('token')) {
$key = tokenauth_get_token_key();
$tokenauth_text['body'] .= "\n\n<strong>Your token:</strong> ?{$key}=<code>[tokenauth-token]</code>";
}
$tokenauth_text['format'] = FILTER_FORMAT_DEFAULT;
}
if (!$render) {
return $tokenauth_text;
}
if (module_exists('token')) {
if (empty($account)) {
$account = $GLOBALS['user'];
}
$tokenauth_text['body'] = token_replace($tokenauth_text['body'], 'user', $account);
}
return check_markup($tokenauth_text['body'], $tokenauth_text['format']);
}