Core class used to implement the locale route.
since | 1.0.0 |
---|---|
package | GlotPress |
inherited_from | \GP_Route_Main |
__construct()
after_request()
before_request()
can(string $action, string|null $object_type= null
, integer|null $object_id= null
, array|null $extra= null
) : boolean
since | 2.3.0 Added the `$extra` parameter. |
---|
string
The action.
string
null
Optional. Type of an object. Default null.
integer
null
Optional. ID of an object. Default null.
array
null
Optional. Extra information for deciding the outcome.
boolean
The verdict.can_or_forbidden(string $action, string|null $object_type= null
, integer|null $object_id= null
, string|null $message= null
, array|null $extra= null
) : false
since | 1.0.0 |
---|
string
The action.
string
null
Optional. Type of an object. Default null.
integer
null
Optional. ID of an object. Default null.
string
null
Error message in case of a failure. Default: 'You are not allowed to do that!'.
array
null
Pass-through parameter to can().
false
cannot_and_redirect(string $action, string|null $object_type= null
, integer|null $object_id= null
, string|null $url= null
) : boolean
since | 1.0.0 |
---|
string
The action.
string
null
Optional. Type of an object. Default null.
integer
null
Optional. ID of an object. Default null.
string
null
Optional. URL to redirect to. Default: referrer or index page, if referrer is missing.
boolean
Whether a redirect happened.die_with_404($args = array()
)
die_with_error($message, $status = 500
)
exit_($message = 0
)
header($string)
headers_for_download(string $filename, string $last_modified = ''
)
string
The name of the file.
string
Optional. Date when the file was last modified. Default: ''.
invalid_and_redirect(object $thing, string $url = null
) : boolean
Note: this method calls $this->exit_() after the redirect and the code after it won't be executed.
object
a GP_Thing instance to validate
string
where to redirect if the thing doesn't validate
boolean
whether the thing is validinvalid_nonce_and_redirect(string $action, string|null $url = null
) : boolean
since | 2.0.0 |
---|
string
Context for the created nonce.
string
null
The URL to redirect. Default: 'null', the referrer.
boolean
False if the nonce is valid, true if the redirect has happened.locales_get()
logged_in_or_forbidden()
redirect($url = null
)
redirect_with_error($message, $url = null
)
set_notices_and_errors()
single($locale_slug, $current_set_slug = 'default'
)
status_header($status)
tmpl(string $template, array $args= array()
, boolean|string $honor_api= true
)
string
Template name to load.
array
Associative array with arguements, which will be exported in the template PHP file.
boolean
string
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.
validate(object $thing) : boolean
object
a GP_Thing instance to validate
boolean
whether the thing is validverify_nonce(string $action) : boolean
since | 2.0.0 |
---|
string
Context for the created nonce.
boolean
False if the nonce is invalid, true if valid.get_http_referer() : false | string
Unlike wp_get_referer()
, it doesn't check if the referer is
the same as the current request URL.
since | 2.0.0 |
---|
false
string
False on failure. Referer URL on success.set_data($set, $project, $set_data = null
)
sort_locales($a, $b)
sort_sets_by_project_id($a, $b)
$api
false
$class_name
$errors
array()
$exited
false
$fake_request
false
$headers
array()
$http_status
$last_method_called
$loaded_template
null
$notices
array()
$redirected
false
$redirected_to
null
$rendered_template
false
$request_running
false
$template_output
null
$template_path
null