Joomla CMS
4.2.2
Documentation des API du CMS Joomla en version 4.2.2
|
Fonctions membres publiques | |
onContentPrepareData (string $context, &$data) | |
onContentPrepareForm (Form $form, $data) | |
onUserAfterSave ($data, bool $isNew, bool $result, ?string $error) | |
onUserAfterDelete (array $user, bool $success, string $msg) | |
Fonctions membres publiques hérités de CMSPlugin | |
__construct (&$subject, $config=array()) | |
loadLanguage ($extension='', $basePath=JPATH_ADMINISTRATOR) | |
setApplication (CMSApplicationInterface $application) | |
Fonctions membres publiques hérités de DispatcherAwareInterface | |
setDispatcher (DispatcherInterface $dispatcher) | |
Fonctions membres publiques hérités de PluginInterface | |
registerListeners () | |
Attributs protégés | |
$autoloadLanguage = true | |
$app | |
$db | |
Attributs protégés hérités de CMSPlugin | |
$_name = null | |
$_type = null | |
$autoloadLanguage = false | |
$allowLegacyListeners = true | |
Fonctions membres privées | |
getDefaultProfileFieldValues () | |
getTokenSeedForUser (int $userId) | |
getAllowedUserGroups () | |
isInAllowedUserGroup ($userId) | |
getTokenForDisplay (int $userId, string $tokenSeed, string $algorithm='sha256') | |
getAlgorithmFromFormFile () | |
hasTokenProfileFields (?int $userId) | |
Attributs privés | |
$allowedContexts | |
$profileKeyPrefix = 'joomlatoken' | |
$tokenLength = 32 | |
Membres hérités additionnels | |
Champs de données hérités de CMSPlugin | |
$params = null | |
Fonctions membres protégées hérités de CMSPlugin | |
registerLegacyListener (string $methodName) | |
registerListener (string $methodName) | |
getApplication () | |
An example custom terms and conditions plugin.
|
private |
Get the token algorithm as defined in the form file
We use a simple RegEx match instead of loading the form for better performance.
Références __DIR__.
|
private |
Get the configured user groups which are allowed to have access to tokens.
|
private |
Returns an array with the default profile field values.
This is used when saving the form data of a user (new or existing) without a token already set.
Références Crypt\genRandomBytes().
|
private |
Returns the token formatted suitably for the user to copy.
integer | $userId | The user id for token |
string | $tokenSeed | The token seed data stored in the database |
string | $algorithm | The hashing algorithm to use for the token (default: sha256) |
|
private |
Retrieve the token seed string for the given user ID.
int | $userId | The numeric user ID to return the token seed string for. |
Références $db, $query, $userId, ParameterType\INTEGER, null, et ParameterType\STRING.
|
private |
|
private |
onContentPrepareData | ( | string | $context, |
& | $data | ||
) |
Inject the Joomla token management panel's data into the User Profile.
This method is called whenever Joomla is preparing the data for an XML form for display.
string | $context | Form context, passed by Joomla |
mixed | $data | Form data |
Modify the data for display in the user profile view page in the frontend.
It's important to note that we deliberately not register HTMLHelper methods to do the same (unlike e.g. the actionlogs system plugin) because the names of our fields are too generic and we run the risk of creating naming clashes. Instead, we manipulate the data directly.
onContentPrepareForm | ( | Form | $form, |
$data | |||
) |
onUserAfterDelete | ( | array | $user, |
bool | $success, | ||
string | $msg | ||
) |
Remove the Joomla token when the user account is deleted from the database.
This event is called after the user data is deleted from the database.
array | $user | Holds the user data |
boolean | $success | True if user was successfully stored in the database |
string | $msg | Message |
Exception |
Références $db, $query, $user, $userId, ParameterType\INTEGER, et ParameterType\STRING.
onUserAfterSave | ( | $data, | |
bool | $isNew, | ||
bool | $result, | ||
?string | $error | ||
) |
Save the Joomla token in the user profile field
mixed | $data | The incoming form data |
bool | $isNew | Is this a new user? |
bool | $result | Has Joomla successfully saved the user? |
string | $error | Error string |
Is the user being saved programmatically, without passing the user profile information? In this case I do not want to accidentally try to generate a new token!
We determine that by examining whether the Joomla token field exists. If it does but it wasn't passed when saving the user I know it's a programmatic user save and I have to ignore it.
Références $data, $db, $default, $query, $result, $this, $userId, ParameterType\INTEGER, et ParameterType\STRING.
|
private |
|
protected |
|
protected |
|
protected |
|
private |
|
private |