Core class used to implement the profile 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.die_with_404($args = array())
die_with_error($message, $status = 500)
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()
profile_get()
profile_view(string $user = '')
stringA user nicename.
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.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 |
|---|
falsestringFalse on failure. Referer URL on success.get_recent_translation_sets(\WP_User $user, integer $amount = 5) : array
\WP_UserA user object.
integerNumber of recent translations to return.
array$translation_sets An array of translation set objectsget_translation_set(\GP_Translation_set $set) : object
\GP_Translation_setA translation set object.
objectlocales_known(\WP_User $user) : array
\WP_UserA user object.
array$locales An array of locale objects$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$projects
array()