void
can
( $action, [ $object_type = null], [ $object_id = null])
-
$action
-
$object_type
-
$object_id
If the current user isn't allowed to do an action, redirect and exit the current request
void
cannot_and_redirect
(string $action, [ $object_type = null], [string $object_id = null], [string $url = null])
-
string
$action
-
string
$object_id
-
string
$url: The URL to redirect. Default value: referrer or index page, if referrer is missing
-
$object_type
void
can_or_forbidden
( $action, [ $object_type = null], [ $object_id = null], [ $message = 'You are not allowed to do that!'])
-
$action
-
$object_type
-
$object_id
-
$message
void
die_with_error
( $message, [ $status = 500])
void
exit_
([ $message = 0])
void
headers_for_download
( $filename)
Same as validate(), but redirects to $url if the thing isn't valid.
Note: this method calls $this->exit_() after the redirect and the code after it won't be executed.
bool
invalid_and_redirect
(object $thing, [string $url = null])
-
object
$thing: a GP_Thing instance to validate
-
string
$url: where to redirect if the thing doesn't validate
void
logged_in_or_forbidden
()
void
redirect
([ $url = null])
void
redirect_with_error
( $message, [ $url = null])
void
set_notices_and_errors
()
void
status_header
( $status)
Loads a template.
void
tmpl
(string $template, [array $args = array()], [bool|string $honor_api = true])
-
string
$template: template name to load
-
array
$args: Associative array with arguements, which will be exported in the template PHP file
-
bool|string
$honor_api: If this is true or 'api' and the route is processing an API request the template name will be suffixed with .api. The actual file loaded will be template.api.php
Validates a thing and add its errors to the route's errors.
bool
validate
(object $thing)
-
object
$thing: a GP_Thing instance to validate