Core class used to implement the glossary 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. |
|---|
stringThe action.
stringnullOptional. Type of an object. Default null.
integernullOptional. ID of an object. Default null.
arraynullOptional. Extra information for deciding the outcome.
booleanThe 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 |
|---|
stringThe action.
stringnullOptional. Type of an object. Default null.
integernullOptional. ID of an object. Default null.
stringnullError message in case of a failure. Default: 'You are not allowed to do that!'.
arraynullPass-through parameter to can().
falsecannot_and_redirect(string $action, string|null $object_type= null, integer|null $object_id= null, string|null $url= null) : boolean
| since | 1.0.0 |
|---|
stringThe action.
stringnullOptional. Type of an object. Default null.
integernullOptional. ID of an object. Default null.
stringnullOptional. URL to redirect to. Default: referrer or index page, if referrer is missing.
booleanWhether a redirect happened.delete_get(integer $glossary_id)
| since | 2.0.0 |
|---|
integerThe id of the glossary to delete.
delete_post(integer $glossary_id)
| since | 2.0.0 |
|---|
integerThe id of the glossary to delete.
die_with_404($args = array())
die_with_error($message, $status = 500)
edit_get($glossary_id)
edit_post($glossary_id)
exit_($message = 0)
header($string)
headers_for_download(string $filename, string $last_modified = '')
stringThe name of the file.
stringOptional. 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.
objecta GP_Thing instance to validate
stringwhere to redirect if the thing doesn't validate
booleanwhether the thing is validinvalid_nonce_and_redirect(string $action, string|null $url = null) : boolean
| since | 2.0.0 |
|---|
stringContext for the created nonce.
stringnullThe URL to redirect. Default: 'null', the referrer.
booleanFalse if the nonce is valid, true if the redirect has happened.logged_in_or_forbidden()
new_get()
new_post()
redirect($url = null)
redirect_with_error($message, $url = null)
set_notices_and_errors()
status_header($status)
tmpl(string $template, array $args= array(), boolean|string $honor_api= true)
stringTemplate name to load.
arrayAssociative array with arguements, which will be exported in the template PHP file.
booleanstringIf 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
objecta GP_Thing instance to validate
booleanwhether the thing is validverify_nonce(string $action) : boolean
| since | 2.0.0 |
|---|
stringContext for the created nonce.
booleanFalse if the nonce is invalid, true if valid.cannot_delete_glossary_and_redirect(\GP_Glossary $glossary) : boolean
| since | 2.0.0 |
|---|
\GP_GlossaryThe glossary object to check.
booleancannot_edit_glossary_and_redirect(\GP_Glossary $glossary) : boolean
| since | 1.0.0 |
|---|
\GP_GlossaryThe glossary object to check.
booleanget_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 |
|---|
falsestringFalse on failure. Referer URL on success.$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