Go to the source code of this file.
Namespaces | |
| namespace | Elgg::Core |
Activate a plugin or plugins. | |
Functions | |
| action ($action, $forwarder="") | |
| Perform an action. | |
| elgg_register_action ($action, $filename="", $access= 'logged_in') | |
| Registers an action. | |
| elgg_unregister_action ($action) | |
| Unregisters an action. | |
| _elgg_validate_token_timestamp ($ts) | |
| Is the token timestamp within acceptable range? | |
| validate_action_token ($visibleerrors=TRUE, $token=NULL, $ts=NULL) | |
| Validate an action token. | |
| action_gatekeeper ($action) | |
| Validates the presence of action tokens. | |
| generate_action_token ($timestamp) | |
| init_site_secret () | |
| Initialise the site secret hash. | |
| get_site_secret () | |
| Returns the site secret. | |
| elgg_action_exists ($action) | |
| Check if an action is registered and its script exists. | |
| elgg_is_xhr () | |
| Checks whether the request was requested via ajax. | |
| ajax_forward_hook ($hook, $type, $reason, $params) | |
| Catch calls to forward() in ajax request and force an exit. | |
| ajax_action_hook () | |
| Buffer all output echo'd directly in the action for inclusion in the returned JSON. | |
| actions_init () | |
| Initialize some ajaxy actions features private. | |
| _elgg_validate_token_timestamp | ( | $ | ts | ) |
Is the token timestamp within acceptable range?
| int | $ts timestamp from the CSRF token |
Definition at line 196 of file actions.php.
| action | ( | $ | action, | |
| $ | forwarder = "" | |||
| ) |
Perform an action.
This function executes the action with name $action as registered by elgg_register_action().
The plugin hook 'action', $action_name will be triggered before the action is executed. If a handler returns false, it will prevent the action script from being called.
| string | $action The requested action | |
| string | $forwarder Optionally, the location to forward to |
elgg_register_action() void private
Definition at line 60 of file actions.php.
| action_gatekeeper | ( | $ | action | ) |
Validates the presence of action tokens.
This function is called for all actions. If action tokens are missing, the user will be forwarded to the site front page and an error emitted.
This function verifies form input for security features (like a generated token), and forwards if they are invalid.
| string | $action The action being performed |
Definition at line 307 of file actions.php.
| actions_init | ( | ) |
Initialize some ajaxy actions features private.
Definition at line 517 of file actions.php.
| ajax_action_hook | ( | ) |
Buffer all output echo'd directly in the action for inclusion in the returned JSON.
Definition at line 507 of file actions.php.
| ajax_forward_hook | ( | $ | hook, | |
| $ | type, | |||
| $ | reason, | |||
| $ | params | |||
| ) |
Catch calls to forward() in ajax request and force an exit.
Forces response is json of the following form:
{
"current_url": "the.url.we/were/coming/from",
"forward_url": "the.url.we/were/going/to",
"system_messages": {
"messages": ["msg1", "msg2", ...],
"errors": ["err1", "err2", ...]
},
"status": -1 //or 0 for success if there are no error messages present
}
where "system_messages" is all message registers at the point of forwarding
| string | $hook | |
| string | $type | |
| string | $reason | |
| array | $params |
Definition at line 452 of file actions.php.
| elgg_action_exists | ( | $ | action | ) |
Check if an action is registered and its script exists.
| string | $action Action name |
Definition at line 410 of file actions.php.
| elgg_is_xhr | ( | ) |
Checks whether the request was requested via ajax.
Definition at line 422 of file actions.php.
| elgg_register_action | ( | $ | action, | |
| $ | filename = "", |
|||
| $ | access = 'logged_in' | |||
| ) |
Registers an action.
Actions are registered to a script in the system and are executed either by the URL http://elggsite.org/action/action_name/.
$filename must be the full path of the file to register, or a path relative to the core actions/ dir.
Actions should be namedspaced for your plugin. Example: elgg_register_action('myplugin/save_settings', ...);
Put action files under the actions/<plugin_name> directory of your plugin.
You don't need to include engine/start.php in your action files.
Definition at line 144 of file actions.php.
| elgg_unregister_action | ( | $ | action | ) |
Unregisters an action.
| string | $action Action name |
Definition at line 178 of file actions.php.
| generate_action_token | ( | $ | timestamp | ) |
Definition at line 353 of file actions.php.
| get_site_secret | ( | ) |
Returns the site secret.
Used to generate difficult to guess hashes for sessions and action tokens.
Definition at line 393 of file actions.php.
| init_site_secret | ( | ) |
Initialise the site secret hash.
Used during installation and saves as a datalist.
Definition at line 375 of file actions.php.
| validate_action_token | ( | $ | visibleerrors = TRUE, |
|
| $ | token = NULL, |
|||
| $ | ts = NULL | |||
| ) |
Validate an action token.
Calls to actions will automatically validate tokens. If tokens are not present or invalid, the action will be denied and the user will be redirected.
Plugin authors should never have to manually validate action tokens.
| bool | $visibleerrors Emit register_error() errors on failure? | |
| mixed | $token The token to test against. Default: $_REQUEST['__elgg_token'] | |
| mixed | $ts The time stamp to test against. Default: $_REQUEST['__elgg_ts'] |
Definition at line 226 of file actions.php.
1.6.3