vB_Api_Stylevar
extends vB_Api
in package
vB_Api_Stylevar
Table of Contents
Methods
- __serialize() : array<string|int, mixed>
- __sleep() : array<string|int, mixed>
- __unserialize() : void
- __wakeup() : void
- callNamed() : The
- Call the given api function by name with a named arguments list.
- canCustomizeProfile() : mixed
- This is just a public method for calling the hasPermissions method
- canSaveDefault() : bool
- Checkes if the current loged user has admin permisions for administration of styles
- checkApiState() : mixed
- This method checks whether the API method is enabled.
- clearCache() : mixed
- Clears all previously loaded API objects.
- delete() : mixed
- Deletes the listed stylevars for the current user Pass false to delete all the stylevars for the current user
- fetch() : array<string|int, mixed>
- Fetches the stylevar values for the user $userid Pass false for $stylevars to get all the stylevars Pass 0 for userid to retrieve the stylevar for the current user Returns an associative array with keys being the list specified in the $stylevar If any of the stylevars is not customized for the specified user, the value from the default stylevar will be returned instead Pass false for $falback to limit the results to the custom stylevars only
- fetch_default_stylevar() : mixed
- fetch_user_stylevars() : array<string|int, mixed>
- Fetches the stylevar values for the user $userid
- fetchCustomizationPermissions() : array<string|int, mixed>
- Returns all the permissions that the currently logged user has for customizing profile
- get() : array<string|int, mixed>
- Fetches the value of the stylevar for the user $userid Pass 0 for userid to retrieve the stylevar for the current user If the stylevar is not customized for the specified user, the value from the default stylevar will be returned Pass false for $falback to limit the results to the custom stylevar only
- getApiClassName() : mixed
- instance() : vB_Api
- Returns an instance of the API object which translates exceptions to an array Use this method for API clients.
- instanceInternal() : vB_Api
- Returns an instance of the API object which doesn't handle exceptions This should only be used in other API objects, not for clients of the API
- isProfileCustomized() : bool
- Check whether the profile page of an user is customized
- map_vb4_input_to_vb5() : string
- Returns vb5 api method name.
- map_vb5_errors_to_vb4() : mixed
- Alters the error array in any way necessary to interface correctly with vb4.
- map_vb5_output_to_vb4() : mixed
- Alters the output array in any way necessary to interface correctly with vb4.
- save() : mixed
- Saves the stylevars specified in the array for the current user
- save_default() : mixed
- Saves the stylevars specified in the array as default style for the whole site
Methods
__serialize()
public
__serialize() : array<string|int, mixed>
Return values
array<string|int, mixed>__sleep()
public
__sleep() : array<string|int, mixed>
Return values
array<string|int, mixed>__unserialize()
public
__unserialize(array<string|int, mixed> $serialized) : void
Parameters
- $serialized : array<string|int, mixed>
__wakeup()
public
__wakeup() : void
callNamed()
Call the given api function by name with a named arguments list.
public
callNamed() : The
Used primarily to translate REST requests into API calls.
Return values
The —return of the method or an error if the method doesn't exist, or is static, a constructor or destructor, or otherwise shouldn't be callable as and API method. It is also an error if the value of a paramater is not provided and that parameter doesn't have a default value.
canCustomizeProfile()
This is just a public method for calling the hasPermissions method
public
canCustomizeProfile() : mixed
canSaveDefault()
Checkes if the current loged user has admin permisions for administration of styles
public
canSaveDefault() : bool
Return values
boolcheckApiState()
This method checks whether the API method is enabled.
public
checkApiState(mixed $method) : mixed
For extensions check make sure $controller property is already set.
Parameters
- $method : mixed
clearCache()
Clears all previously loaded API objects.
public
static clearCache() : mixed
Intended for use in tests where the loading pattern can cause issues with objects that cache thier own data.
delete()
Deletes the listed stylevars for the current user Pass false to delete all the stylevars for the current user
public
delete([array<string|int, mixed>|false $stylevars = [] ]) : mixed
Parameters
- $stylevars : array<string|int, mixed>|false = []
-
- list of stylevar names to delete
fetch()
Fetches the stylevar values for the user $userid Pass false for $stylevars to get all the stylevars Pass 0 for userid to retrieve the stylevar for the current user Returns an associative array with keys being the list specified in the $stylevar If any of the stylevars is not customized for the specified user, the value from the default stylevar will be returned instead Pass false for $falback to limit the results to the custom stylevars only
public
fetch([array<string|int, mixed>|false $stylevars = [] ][, int $userid = 0 ][, bool $fallback = true ]) : array<string|int, mixed>
WARNING: This returns the value as stored in the stylevar. If the stylevar inherits from another stylevar, it WILL NOT return the final, rendered, inherited value that should be used for display. To get the final, inherited value that should be used, use the template runtime fetchStyleVar or fetchCustomStylevar methods, which resolve inheritance.
Parameters
- $stylevars : array<string|int, mixed>|false = []
- $userid : int = 0
- $fallback : bool = true
Return values
array<string|int, mixed>fetch_default_stylevar()
public
fetch_default_stylevar([mixed $stylevars = [] ][, mixed $styleid = false ]) : mixed
Parameters
- $stylevars : mixed = []
- $styleid : mixed = false
fetch_user_stylevars()
Fetches the stylevar values for the user $userid
public
fetch_user_stylevars([int $userid = 0 ]) : array<string|int, mixed>
Parameters
- $userid : int = 0
Return values
array<string|int, mixed>fetchCustomizationPermissions()
Returns all the permissions that the currently logged user has for customizing profile
public
fetchCustomizationPermissions() : array<string|int, mixed>
Return values
array<string|int, mixed>get()
Fetches the value of the stylevar for the user $userid Pass 0 for userid to retrieve the stylevar for the current user If the stylevar is not customized for the specified user, the value from the default stylevar will be returned Pass false for $falback to limit the results to the custom stylevar only
public
get(mixed $stylevarname[, int $userid = 0 ][, bool $fallback = true ][, int $styleid = 0 ]) : array<string|int, mixed>
WARNING: This returns the value as stored in the stylevar. If the stylevar inherits from another stylevar, it WILL NOT return the final, rendered, inherited value that should be used for display. To get the final, inherited value that should be used, use the template runtime fetchStyleVar or fetchCustomStylevar methods, which resolve inheritance.
Parameters
- $stylevarname : mixed
- $userid : int = 0
- $fallback : bool = true
- $styleid : int = 0
Return values
array<string|int, mixed> —valid key should be the value of the $stylevars
getApiClassName()
public
static getApiClassName(mixed $controller) : mixed
Parameters
- $controller : mixed
instance()
Returns an instance of the API object which translates exceptions to an array Use this method for API clients.
public
static instance(string $controller[, bool $refresh_cache = false ]) : vB_Api
Parameters
- $controller : string
-
-- name of the API controller to load
- $refresh_cache : bool = false
-
-- true if we want to force the cache to update with a new api object primarily intended for testing
Return values
vB_ApiinstanceInternal()
Returns an instance of the API object which doesn't handle exceptions This should only be used in other API objects, not for clients of the API
public
static instanceInternal(string $controller[, bool $refresh_cache = false ]) : vB_Api
Parameters
- $controller : string
-
-- name of the API controller to load
- $refresh_cache : bool = false
-
-- true if we want to force the cache to update with a new api object primarily intended for testing
Return values
vB_ApiisProfileCustomized()
Check whether the profile page of an user is customized
public
isProfileCustomized([ $userid = 0 ]) : bool
Parameters
Return values
boolmap_vb4_input_to_vb5()
Returns vb5 api method name.
public
static map_vb4_input_to_vb5(string $method, array<string|int, mixed> &$request) : string
May alter request array.
Parameters
- $method : string
-
-- vb4 method name
- $request : array<string|int, mixed>
-
-- $_REQUEST array for this api request
Return values
stringmap_vb5_errors_to_vb4()
Alters the error array in any way necessary to interface correctly with vb4.
public
static map_vb5_errors_to_vb4(string $method, array<string|int, mixed> &$data) : mixed
Parameters
- $method : string
-
-- vb4 method name
- $data : array<string|int, mixed>
-
-- error array from vb5
map_vb5_output_to_vb4()
Alters the output array in any way necessary to interface correctly with vb4.
public
static map_vb5_output_to_vb4(string $method, array<string|int, mixed> &$data) : mixed
Parameters
- $method : string
-
-- vb4 method name
- $data : array<string|int, mixed>
-
-- output array from vb5
save()
Saves the stylevars specified in the array for the current user
public
save(array<string|int, mixed> $stylevars) : mixed
Parameters
- $stylevars : array<string|int, mixed>
-
- associative array like ['global_avatar_border' => ['color' => '#123456']]
save_default()
Saves the stylevars specified in the array as default style for the whole site
public
save_default(array<string|int, mixed> $stylevars) : mixed
Parameters
- $stylevars : array<string|int, mixed>
-
- associative array