class vB_Api_Page extends vB_Api

vB_Api_Page

Traits

Properties

protected bool $disabled Indicates whether the API was disabled from vB_Api
protected $disableWhiteList
protected array $disableFalseReturnOnly Contains white listed methods which return a false response when API is disabled in special scenarios like forum closed, password expiry, ip ban and others. from vB_Api
protected string $controller API Controller from vB_Api
protected vB_Database $db Database object. from vB_Api

Methods

__sleep()

No description

__wakeup()

No description

static 
getApiClassName($controller)

No description

from vB_Api
static 
getApiClassNameInternal($controller)

No description

from vB_Api
static 
getApiClass($controller, $errorCheck = true)

No description

from vB_Api
static vB_Api
instanceInternal(string $controller, bool $refresh_cache = false)

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

from vB_Api
static vB_Api
instance(string $controller, bool $refresh_cache = false)

Returns an instance of the API object which translates exceptions to an array Use this method for API clients.

from vB_Api
static 
clearCache()

Clears all previously loaded API objects.

from vB_Api
The
callNamed()

Call the given api function by name with a named arguments list.

from vB_Api
static string
map_vb4_input_to_vb5(string $method, array $request)

Returns vb5 api method name.

from vB_Api
static 
map_vb5_output_to_vb4(string $method, array $data)

Alters the output array in any way necessary to interface correctly with vb4.

from vB_Api
static 
map_vb5_errors_to_vb4(string $method, array $data)

Alters the error array in any way necessary to interface correctly with vb4.

from vB_Api
__construct()

No description

from vB_Api
checkApiState($method)

This method checks whether the API method is enabled.

from vB_Api
bool
isWhiteListed(string $method)

Checks if method is white listed when API is disabled.

from vB_Api
bool
isDisableFalseReturnOnly(string $method)

Checks if method returns false response only when API is disabled.

from vB_Api
toSeoFriendly(string $str)

Replaces special characters in a given string with dashes to make the string SEO friendly

from vB_Api
none
checkHasAdminPermission(string $adminPermission)

Determines if the calling user has the given admin permission, and if not throws an exception

from vB_Api
boolean
hasAdminPermission(string $adminPermission)

Determines if the calling user has the given admin permission

from vB_Api
checkIsLoggedIn()

Determines if the calling user has the given admin permission, and if not throws an exception

from vB_Api
setController(string $controller)

Set controller

from vB_Api
inDebugMode()

No description

from vB_Api
array
fetchPageById(int $pageid, array $routeData = array())

Get information for a page

mixed
delete(int $pageid)

Deletes a page

getPageNav($currentpage = 1, $totalpages = 1)

No description

array
getPagingInfo(int $pageNum = 1, int $totalCount = 0, int $perPage = 0, array $routeInfo, String $baseUrl, int $maxpage = 0)

Get pagination information for frontend use

getURLs($params = array())

No description

getOrphanedPagetemplates($params = array())

No description

deleteOrphanedPagetemplates($pagetemplateids)

No description

array
pageSave(array $input)

Saves a page based on page editor info

updateNewPageRoute(int $pageId, int $routeId)

Sets the route for the specified page to the specified routeid. Also appears to update the route records for channels associated with this page.

getAllCurrentModuleInstances($modules)

No description

getAllTabbedContainerSubModulesInstances($pagetemplateid, $subModulesArray)

No description

getAllSubModulesInstances($subModules)

No description

saveTabbedContainerSubModules($pagetemplateid, $containerinstanceid, $tabbedContainerSubModules, $newTemplate)

No description

saveSubModules($pageTemplateId, $widgetInstanceId, $subModules, $displaySubModules, $forceNewPage)

No description

array
getQryCount()

This returns the number and type of database asserts. This is similar to but a bit smaller than the number of queries executed.

preload(string $pageKey)

This preloads information for the current page.

savePreCacheInfo(string $pageKey)

This saves preload information for the current page.

boolean
checkCustomUrl(string $prefixCandidate)

This is used for setting a custom url to make sure that the new url is valid as a prefix

mixed
fetchRouteClass(int $pageid)

Returns the pagetemplate record given a pageid

Details

in vB_Trait_NoSerialize at line 15
__sleep()

in vB_Trait_NoSerialize at line 20
__wakeup()

in vB_Api at line 63
static getApiClassName($controller)

Parameters

$controller

in vB_Api at line 69
static protected getApiClassNameInternal($controller)

Parameters

$controller

in vB_Api at line 97
static protected getApiClass($controller, $errorCheck = true)

Parameters

$controller
$errorCheck

in vB_Api at line 177
static vB_Api instanceInternal(string $controller, bool $refresh_cache = false)

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

Parameters

string $controller -- name of the API controller to load
bool $refresh_cache -- true if we want to force the cache to update with a new api object primarily intended for testing

Return Value

vB_Api

in vB_Api at line 203
static vB_Api instance(string $controller, bool $refresh_cache = false)

Returns an instance of the API object which translates exceptions to an array Use this method for API clients.

Parameters

string $controller -- name of the API controller to load
bool $refresh_cache -- true if we want to force the cache to update with a new api object primarily intended for testing

Return Value

vB_Api

in vB_Api at line 237
static clearCache()

Clears all previously loaded API objects.

Intended for use in tests where the loading pattern can cause issues with objects that cache thier own data.

in vB_Api at line 259
The callNamed()

Call the given api function by name with a named arguments list.

Used primarily to translate REST requests into API calls.

Return Value

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.

in vB_Api at line 313
static string map_vb4_input_to_vb5(string $method, array $request)

Returns vb5 api method name.

May alter request array.

Parameters

string $method -- vb4 method name
array $request -- $_REQUEST array for this api request

Return Value

string

in vB_Api at line 497
static map_vb5_output_to_vb4(string $method, array $data)

Alters the output array in any way necessary to interface correctly with vb4.

Parameters

string $method -- vb4 method name
array $data -- output array from vb5

in vB_Api at line 545
static map_vb5_errors_to_vb4(string $method, array $data)

Alters the error array in any way necessary to interface correctly with vb4.

Parameters

string $method -- vb4 method name
array $data -- error array from vb5

in vB_Api at line 609
protected __construct()

in vB_Api at line 631
checkApiState($method)

This method checks whether the API method is enabled.

For extensions check make sure $controller property is already set.

Parameters

$method

in vB_Api at line 657
protected bool isWhiteListed(string $method)

Checks if method is white listed when API is disabled.

Parameters

string $method API method to check.

Return Value

bool Indicates whether method is or is not a white list.

in vB_Api at line 685
protected bool isDisableFalseReturnOnly(string $method)

Checks if method returns false response only when API is disabled.

Parameters

string $method API method to check.

Return Value

bool Indicates whether method returns false response only.

in vB_Api at line 712
protected toSeoFriendly(string $str)

Replaces special characters in a given string with dashes to make the string SEO friendly

Parameters

string $str The string to be converted

in vB_Api at line 734
protected none checkHasAdminPermission(string $adminPermission)

Determines if the calling user has the given admin permission, and if not throws an exception

Checks for: * A valid CP Session * The passed adminpermission.

Parameters

string $adminPermission The admin permission to check

Return Value

none

Exceptions

inlinemodauth_required -- The current session is not a mod/admin session
nopermission_loggedin -- The user does not have the given permission
no_permission -- The user is not logged in at all.

in vB_Api at line 753
protected boolean hasAdminPermission(string $adminPermission)

Determines if the calling user has the given admin permission

Useful if you need to know if the calling user but do not care why they do not have that permission. Generally useful if there is a behavior difference between admins and non admins, but the call can be processed for either.

Parameters

string $adminPermission The admin permission to check

Return Value

boolean true if checks pass, false otherwise

in vB_Api at line 807
protected checkIsLoggedIn()

Determines if the calling user has the given admin permission, and if not throws an exception

in vB_Api at line 821
protected setController(string $controller)

Set controller

Parameters

string $controller Controller name

in vB_Api at line 831
protected inDebugMode()

at line 51
array fetchPageById(int $pageid, array $routeData = array())

Get information for a page

Parameters

int $pageid
array $routeData -- The needed to render this pages route. Will vary by page

Return Value

array pageid int parentid int -- the parent page (currently unused) pagetemplateid int title string metadescription string -- the metadescription to display when page is rendered as html routeid int -- route associated with this page moderatorid int -- need to determine displayorder int -- the order to display page when displaying lists of pages pagetype string -- default or custom depending of if this is a page we install with the system product string -- product the page belongs to 'vbulletin' for pages created by the system and via the admincp guid string -- globally unique identifier screenlayoutid int -- layout for the page screenlayouttemplate string -- name of the layout template templatetitle string -- need to determine isgeneric boolean -- DEPRECATED true if this is of type default urlprefix string -- prefix for the route url string -- url generated from the route -- will be relative to the frontend base urlscheme string -- DEPRECATED -- will be blank urlhostname string -- DEPRECATED -- will be blank noindex boolean -- should this page be indexed. nofollow boolean -- should this page be followed.

at line 182
mixed delete(int $pageid)

Deletes a page

Parameters

int $pageid id of the page to be deleted

Return Value

mixed either success=>true or success=>false and an error array

at line 235
getPageNav($currentpage = 1, $totalpages = 1)

Parameters

$currentpage
$totalpages

at line 300
array getPagingInfo(int $pageNum = 1, int $totalCount = 0, int $perPage = 0, array $routeInfo, String $baseUrl, int $maxpage = 0)

Get pagination information for frontend use

Parameters

int $pageNum Current page number
int $totalCount Total items number
int $perPage Number of items per page
array $routeInfo Route info data
String $baseUrl forum base url
int $maxpage Maximum pages allowed

Return Value

array Number of pages, start/end count, next/previous URLs

at line 377
getURLs($params = array())

Parameters

$params

at line 386
getOrphanedPagetemplates($params = array())

Parameters

$params

at line 394
deleteOrphanedPagetemplates($pagetemplateids)

Parameters

$pagetemplateids

at line 474
array pageSave(array $input)

Saves a page based on page editor info

Parameters

array $input

Return Value

array success boolean url string -- DEPRECATED this will not always be correct due to the lack of complete route data. See the action savePage in the front end controller for a way to generate the correct url for the updated page pageid int -- the pageid for the update or created page

at line 1085
protected updateNewPageRoute(int $pageId, int $routeId)

Sets the route for the specified page to the specified routeid. Also appears to update the route records for channels associated with this page.

Note: Moved from the Route API and changed visibility to protected, see VBV-15361.

Parameters

int $pageId Page ID
int $routeId New Route ID

at line 1145
protected getAllCurrentModuleInstances($modules)

Parameters

$modules

at line 1168
protected getAllTabbedContainerSubModulesInstances($pagetemplateid, $subModulesArray)

Parameters

$pagetemplateid
$subModulesArray

at line 1227
protected getAllSubModulesInstances($subModules)

Parameters

$subModules

at line 1253
protected saveTabbedContainerSubModules($pagetemplateid, $containerinstanceid, $tabbedContainerSubModules, $newTemplate)

Parameters

$pagetemplateid
$containerinstanceid
$tabbedContainerSubModules
$newTemplate

at line 1334
protected saveSubModules($pageTemplateId, $widgetInstanceId, $subModules, $displaySubModules, $forceNewPage)

Parameters

$pageTemplateId
$widgetInstanceId
$subModules
$displaySubModules
$forceNewPage

at line 1393
array getQryCount()

This returns the number and type of database asserts. This is similar to but a bit smaller than the number of queries executed.

Return Value

array queryCount int queries array -- query strings

at line 1414
preload(string $pageKey)

This preloads information for the current page.

Parameters

string $pageKey the identifier for this page, which comes from the route class.

at line 1423
savePreCacheInfo(string $pageKey)

This saves preload information for the current page.

Parameters

string $pageKey -- the identifier for this page, which comes from the route class.

at line 1434
boolean checkCustomUrl(string $prefixCandidate)

This is used for setting a custom url to make sure that the new url is valid as a prefix

Parameters

string $prefixCandidate -- the 'resturl' to be checked

Return Value

boolean -- true if no reserved characters are used in the url AND it is unique

at line 1460
mixed fetchRouteClass(int $pageid)

Returns the pagetemplate record given a pageid

Parameters

int $pageid

Return Value

mixed array with success=>true/false and usually an error array or a route class.