class vB_Api_Search extends vB_Api

vB_Api_Search

Traits

Constants

FILTER_STARTER_ONLY

FILTER_LASTVISIT

FILTER_TOPICAGE

FILTER_CHANNELAGE

FILTER_LASTDAY

FILTER_LASTWEEK

FILTER_LASTMONTH

FILTER_LASTYEAR

FILTER_DATEALL

FILTER_VIEW_ACTIVITY

FILTER_VIEW_TOPIC

FILTER_VIEW_CONVERSATION_THREAD

FILTER_VIEW_CONVERSATION_THREAD_SEARCH

FILTER_VIEW_CONVERSATION_STREAM

FILTER_FOLLOWING_USERS

FILTER_FOLLOWING_CHANNEL

FILTER_FOLLOWING_ALL

FILTER_FOLLOWING_BOTH

FILTER_FOLLOWING_CONTENT

FILTER_FOLLOW

FILTER_MARKED_READ

FILTER_MARKED_UNREAD

FILTER_SHOW_TEXT

FILTER_SHOW_GALLERY

FILTER_SHOW_VIDEO

FILTER_SHOW_LINK

FILTER_SHOW_POLL

FILTER_SHOW_EVENT

SEARCH_TYPE_SYSTEM

SEARCH_TYPE_USER

IGNORE_CACHE

Properties

protected bool $disabled Indicates whether the API was disabled from vB_Api
protected array $disableWhiteList Contains white listed methods which act as normal when API is disabled no matter of special scenarios like forum closed, password expiry, ip ban and others. from vB_Api
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
protected $search_json
protected $criteria
protected $channelCache
static protected $cache_ttl_sec
static protected $showFilterList

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
static int
getCacheTTL()

Returns the cache ttl in seconds

getSearchResult($search_json, $searchType = 0)

No description

int
getSearchResultsCriteria(vB_Search_Criteria $criteria, $searchType)

Search for nodes

array
getInitialNodes($search_json, $perpage = false, $pagenumber = false, $getStarterInfo = false)

Search for nodeids and returns the resultid as well as the page value

array
getInitialResults(string|array|object $search_json, int $perpage = false, int $pagenumber = false, bool $getStarterInfo = false, int $searchType = 0)

Search for nodes and returns the resultid as well as the page value

array
getMoreNodes(int $resultId, int $perpage = false, int $pagenumber = false)

Get the node_ids from a search resultId

array
getMoreResults($resultId, $perpage = false, $pagenumber = false, $getStarterInfo = false)

Get the nodes from a search resultId

getInfo($resultId)

No description

int
getPageNumber(int $nodeid, array $starter, int $perpage = 20, int $depth = 0, string $sort = 'asc', bool $include_starter = true, string $type = '')

Get the page number where the specified node is at on the node list.

array
getChannels(bool $flat = false, array $queryOptions = array('exclude_categories' => false, 'include_protected' => false, 'exclude_subtrees' => array()), bool $skipcache = false, int $topLevelChannel = 0)

Returns the Channel structure

getChannelFromTree($resultsTree, $topLevelChannel)

This takes the channel tree produced by getChannels, finds the specified channel recursively, then returns that channel's sub tree. Used internally by getChannels.

getForumChannels($flat = false, $queryOptions = array('exclude_categories' => false), $skipcache = false)

No description

getSearchableContentTypes()

No description

static 
is_index_word($word, $isLower = false)

No description

static 
get_good_words()

No description

static 
get_all_bad_words()

No description

static 
get_bad_words()

No description

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 79
static int getCacheTTL()

Returns the cache ttl in seconds

Return Value

int time in seconds

at line 95
getSearchResult($search_json, $searchType = 0)

Parameters

$search_json
$searchType

at line 137
protected int getSearchResultsCriteria(vB_Search_Criteria $criteria, $searchType)

Search for nodes

Parameters

vB_Search_Criteria $criteria
$searchType

Return Value

int result_id

at line 193
array getInitialNodes($search_json, $perpage = false, $pagenumber = false, $getStarterInfo = false)

Search for nodeids and returns the resultid as well as the page value

(avoids having to make a call for the resultid and immediately make another to fetch the page value)

Parameters

$search_json
$perpage
$pagenumber
$getStarterInfo

Return Value

array node_ids

at line 217
array getInitialResults(string|array|object $search_json, int $perpage = false, int $pagenumber = false, bool $getStarterInfo = false, int $searchType = 0)

Search for nodes and returns the resultid as well as the page value

(avoids having to make a call for the resultid and immediately make another to fetch the page value)

Parameters

string|array|object $search_json list of parameters that can be encoded in a json string
int $perpage pagination - the number of results per page
int $pagenumber pagination - the page number
bool $getStarterInfo
int $searchType

Return Value

array search_result_structure

at line 269
array getMoreNodes(int $resultId, int $perpage = false, int $pagenumber = false)

Get the node_ids from a search resultId

Parameters

int $resultId id of the search result
int $perpage pagination - the number of results per page
int $pagenumber pagination - the page number

Return Value

array result structure without node content (only nodeids)

at line 399
array getMoreResults($resultId, $perpage = false, $pagenumber = false, $getStarterInfo = false)

Get the nodes from a search resultId

Parameters

$resultId
$perpage
$pagenumber
$getStarterInfo

Return Value

array List of nodes in the resultId

at line 414
getInfo($resultId)

Parameters

$resultId

at line 459
int getPageNumber(int $nodeid, array $starter, int $perpage = 20, int $depth = 0, string $sort = 'asc', bool $include_starter = true, string $type = '')

Get the page number where the specified node is at on the node list.

Parameters

int $nodeid The node id
array $starter The starter array
int $perpage The number of nodes per page the node list is using
int $depth The depth - 0 means no stopping, otherwise 1= direct child, 2= grandchild, etc
string $sort The sort order of the node list, 'asc' or 'desc'
bool $include_starter The flag to indicate if the starter node should be included in the node list or not
string $type The content type filter to use. Must be one of the strings defined in self::$showFilterList

Return Value

int The page number of the specified node. 0 means the node was not found.

at line 564
array getChannels(bool $flat = false, array $queryOptions = array('exclude_categories' => false, 'include_protected' => false, 'exclude_subtrees' => array()), bool $skipcache = false, int $topLevelChannel = 0)

Returns the Channel structure

Parameters

bool $flat flat (optional) If supplied, the return structure will be flattened
array $queryOptions queryOptions (optional) filters for query. Available values: - exclude_categories bool - include_protected bool - exclude_subtrees int|array -- exclude any subtrees rooted at the channel given by the id. Allows either a single channel or an array list.
bool $skipcache skipcache (optional) If supplied will skip cache & query the DB
int $topLevelChannel topLevelChannel (optional) If supplied will return the structure for the specified top level channel only.

Return Value

array channel structure

at line 817
protected getChannelFromTree($resultsTree, $topLevelChannel)

This takes the channel tree produced by getChannels, finds the specified channel recursively, then returns that channel's sub tree. Used internally by getChannels.

Parameters

$resultsTree
$topLevelChannel

at line 861
getForumChannels($flat = false, $queryOptions = array('exclude_categories' => false), $skipcache = false)

Parameters

$flat
$queryOptions
$skipcache

at line 867
getSearchableContentTypes()

at line 1912
static is_index_word($word, $isLower = false)

Parameters

$word
$isLower

at line 1948
static get_good_words()

at line 1966
static get_all_bad_words()

at line 1976
static get_bad_words()