Elgg
Version 2.3
|
Go to the source code of this file.
Namespaces | |
Elgg\Core | |
Activate a plugin or plugins. | |
Functions | |
elgg_register_page_handler ($identifier, $function) | |
Registers a page handler for a particular identifier. More... | |
elgg_unregister_page_handler ($identifier) | |
Unregister a page handler for an identifier. More... | |
elgg_gatekeeper () | |
Used at the top of a page to mark it as logged in users only. More... | |
gatekeeper () | |
Alias of elgg_gatekeeper() More... | |
elgg_admin_gatekeeper () | |
Used at the top of a page to mark it as admin only. More... | |
admin_gatekeeper () | |
Alias of elgg_admin_gatekeeper() More... | |
elgg_group_gatekeeper ($forward=true, $group_guid=null) | |
May the current user access item(s) on this page? If the page owner is a group, membership, visibility, and logged in status are taken into account. More... | |
group_gatekeeper ($forward=true, $page_owner_guid=null) | |
May the current user access item(s) on this page? If the page owner is a group, membership, visibility, and logged in status are taken into account. More... | |
elgg_entity_gatekeeper ($guid, $type=null, $subtype=null, $forward=true) | |
Can the viewer see this entity? More... | |
elgg_ajax_gatekeeper () | |
Require that the current request be an XHR. More... | |
elgg_front_page_handler () | |
Front page handler. More... | |
elgg_error_page_handler ($hook, $type, $result, $params) | |
Serve an error page. More... | |
elgg_ok_response ($content= '', $message= '', $forward_url=null, $status_code=ELGG_HTTP_OK) | |
Prepares a successful response to be returned by a page or an action handler. More... | |
elgg_error_response ($error= '', $forward_url=REFERRER, $status_code=ELGG_HTTP_OK) | |
Prepare an error response to be returned by a page or an action handler. More... | |
elgg_redirect_response ($forward_url=REFERRER, $status_code=ELGG_HTTP_FOUND) | |
Prepare a silent redirect response to be returned by a page or an action handler. More... | |
_elgg_page_handler_init () | |
Initializes the page handler/routing system. More... | |
Variables | |
return | function (\Elgg\EventsService $events,\Elgg\HooksRegistrationService $hooks) |
_elgg_page_handler_init | ( | ) |
Initializes the page handler/routing system.
Definition at line 363 of file pagehandler.php.
admin_gatekeeper | ( | ) |
Alias of elgg_admin_gatekeeper()
Used at the top of a page to mark it as logged in admin or siteadmin only.
Definition at line 100 of file pagehandler.php.
elgg_admin_gatekeeper | ( | ) |
Used at the top of a page to mark it as admin only.
Definition at line 83 of file pagehandler.php.
elgg_ajax_gatekeeper | ( | ) |
Require that the current request be an XHR.
If not, execution of the current function will end and a 400 response page will be sent.
Definition at line 237 of file pagehandler.php.
elgg_entity_gatekeeper | ( | $guid, | |
$type = null , |
|||
$subtype = null , |
|||
$forward = true |
|||
) |
Can the viewer see this entity?
Tests if the entity exists and whether the viewer has access to the entity if it does. If the viewer cannot view this entity, it forwards to an appropriate page.
int | $guid | Entity GUID |
string | $type | Optional required entity type |
string | $subtype | Optional required entity subtype |
bool | $forward | If set to true (default), will forward the page; if set to false, will return true or false. |
Definition at line 187 of file pagehandler.php.
elgg_error_page_handler | ( | $hook, | |
$type, | |||
$result, | |||
$params | |||
) |
Serve an error page.
This is registered by Elgg for the 'forward', '404' plugin hook. It can registered for other hooks by plugins or called directly to display an error page.
string | $hook | The name of the hook |
string | $type | Http error code |
bool | $result | The current value of the hook |
array | $params | Parameters related to the hook |
Definition at line 267 of file pagehandler.php.
elgg_error_response | ( | $error = '' , |
|
$forward_url = REFERRER , |
|||
$status_code = ELGG_HTTP_OK |
|||
) |
Prepare an error response to be returned by a page or an action handler.
string | $error | Error message Can be used by handlers to display an error message For certain requests this error message will also be used as the response body |
string | $forward_url | URL to redirect the client to Can be used by handlers to redirect the client on non-ajax requests |
int | $status_code | HTTP status code Status code of the HTTP response For BC reasons and due to the logic in the client-side AJAX API, this defaults to 200. Note that the Router and AJAX API will treat these responses as error in spite of the HTTP code assigned |
Definition at line 333 of file pagehandler.php.
elgg_front_page_handler | ( | ) |
elgg_gatekeeper | ( | ) |
Used at the top of a page to mark it as logged in users only.
Definition at line 58 of file pagehandler.php.
elgg_group_gatekeeper | ( | $forward = true , |
|
$group_guid = null |
|||
) |
May the current user access item(s) on this page? If the page owner is a group, membership, visibility, and logged in status are taken into account.
bool | $forward | If set to true (default), will forward the page; if set to false, will return true or false. |
int | $group_guid | The group that owns the page. If not set, this will be pulled from elgg_get_page_owner_guid(). |
Definition at line 117 of file pagehandler.php.
elgg_ok_response | ( | $content = '' , |
|
$message = '' , |
|||
$forward_url = null , |
|||
$status_code = ELGG_HTTP_OK |
|||
) |
Prepares a successful response to be returned by a page or an action handler.
mixed | $content | Response content In page handlers, response content should contain an HTML string In action handlers, response content can contain either a JSON string or an array of data |
string | $message | System message visible to the client Can be used by handlers to display a system message |
string | $forward_url | Forward URL Can be used by handlers to redirect the client on non-ajax requests |
int | $status_code | HTTP status code Status code of the HTTP response (defaults to 200) |
Definition at line 310 of file pagehandler.php.
elgg_redirect_response | ( | $forward_url = REFERRER , |
|
$status_code = ELGG_HTTP_FOUND |
|||
) |
Prepare a silent redirect response to be returned by a page or an action handler.
string | $forward_url | Redirection URL Relative or absolute URL to redirect the client to |
int | $status_code | HTTP status code Status code of the HTTP response Note that the Router and AJAX API will treat these responses as redirection in spite of the HTTP code assigned Note that non-redirection HTTP codes will throw an exception |
Definition at line 353 of file pagehandler.php.
elgg_register_page_handler | ( | $identifier, | |
$function | |||
) |
Registers a page handler for a particular identifier.
For example, you can register a function called 'blog_page_handler' for the identifier 'blog' For all URLs http://yoururl/blog/*, the blog_page_handler() function will be called. The part of the URL marked with * above will be exploded on '/' characters and passed as an array to that function. For example, the URL http://yoururl/blog/username/friends/ would result in the call: blog_page_handler(array('username','friends'), blog);
A request to register a page handler with the same identifier as previously registered handler will replace the previous one.
The context is set to the identifier before the registered page handler function is called. For the above example, the context is set to 'blog'.
Page handlers should return true to indicate that they handled the request. Requests not handled are forwarded to the front page with a reason of 404. Plugins can register for the 'forward', '404' plugin hook.
string | $identifier | The page type identifier |
string | $function | Your function name |
Definition at line 34 of file pagehandler.php.
elgg_unregister_page_handler | ( | $identifier | ) |
Unregister a page handler for an identifier.
Note: to replace a page handler, call elgg_register_page_handler()
string | $identifier | The page type identifier |
Definition at line 48 of file pagehandler.php.
gatekeeper | ( | ) |
Alias of elgg_gatekeeper()
Used at the top of a page to mark it as logged in users only.
Definition at line 73 of file pagehandler.php.
group_gatekeeper | ( | $forward = true , |
|
$page_owner_guid = null |
|||
) |
May the current user access item(s) on this page? If the page owner is a group, membership, visibility, and logged in status are taken into account.
bool | $forward | If set to true (default), will forward the page; if set to false, will return true or false. |
int | $page_owner_guid | The current page owner guid. If not set, this will be pulled from elgg_get_page_owner_guid(). |
Definition at line 168 of file pagehandler.php.
return function(\Elgg\EventsService $events,\Elgg\HooksRegistrationService $hooks) |
Definition at line 367 of file pagehandler.php.