vBulletin v6.0.4

vB_Types
in package
Uses vB_Trait_NoSerialize

vB Types Handler Provides methods to convert id's, class names, packages, class string fragments and friendly titles for the framework object types package and contenttype.

Child classes may add additional types allowing them to be fetched and handled together.

Table of Contents

Methods

__serialize()  : array<string|int, mixed>
__sleep()  : array<string|int, mixed>
__unserialize()  : void
__wakeup()  : void
assertContentType()  : mixed
Checks if a contenttype id is valid and throws an exception if it isn't.
assertPackage()  : mixed
Checks if a package is valid and throws an exception if it isn't.
contentTypeEnabled()  : bool
Checks of a contenttype is enabled.
getAggregatorTypeIds()  : array<string|int, mixed>
This gives up a list of the Aggregator types.
getAttachableContentTypes()  : array<string|int, mixed>
Fetches all attachable content types
getContentClassFromId()  : mixed
Gets the class and package of a contenttypeid.
getContentTypeCacheEvents()  : array<string|int, mixed>
Fetches the cache events that affect contenttypes.
getContentTypeClass()  : string
Gets the class string identifier for a contenttype.
getContentTypeClasses()  : array<string|int, mixed>
Gets the contenttype class strings from a list of content type ids.
getContentTypeID()  : int
Gets a contenttype id from a type key or array(package, class).
getContentTypePackage()  : string
Gets the package class string identifier for a contenttype
getContentTypePackageID()  : int
Gets the package id for a contenttype
getContentTypes()  : array<string|int, mixed>
Fetches all content types
getContentTypeTitle()  : string
Gets the user friendly title of a contenttype.
getForumCommentContentTypeClasses()  : array<string|int, mixed>
Return array of contenttypeid => classname that are allowed to be forum starters.
getForumReplyContentTypeClasses()  : array<string|int, mixed>
Return array of contenttypeid => classname that are allowed to be forum starters.
getForumStarterContentTypeClasses()  : array<string|int, mixed>
Return array of contenttypeid => classname that are allowed to be forum starters.
getNonAggregatorTypeIds()  : array<string|int, mixed>
This gives up a list of the non-Aggregator types.
getPackageClass()  : string
Gets the class string identifier for a package.
getPackageID()  : int
Gets the numeric package id a package class string identifier.
getSearchableContentTypes()  : array<string|int, mixed>
Fetches all searchable content types
getTypeKey()  : string
Gets a unique string key representing a type for the given package and class.
getUntitledContentTypeTitle()  : string
Gets a user friendly phrase for an untitled piece of content.
instance()  : vB_Types
Returns singleton instance of self.
packageEnabled()  : mixed
Checks if a package is enabled.
reloadTypes()  : mixed
This should only be called while in a

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>

assertContentType()

Checks if a contenttype id is valid and throws an exception if it isn't.

public assertContentType(mixed $contenttype[, vB_Exception $e = null ]) : mixed
Parameters
$contenttype : mixed
  • Key, [package, class] or numeric id of the contenttype
$e : vB_Exception = null
  • An alternative exception to throw
Tags
throws
mixed
  • Thrown if the given contenttype is not valid

assertPackage()

Checks if a package is valid and throws an exception if it isn't.

public assertPackage(mixed $package[, vB_Exception $e = null ]) : mixed
Parameters
$package : mixed
  • Class string identifier or numeric id of the package to check
$e : vB_Exception = null
  • An alternative exception to throw
Tags
throws
mixed
  • Thrown if the package was not valid

contentTypeEnabled()

Checks of a contenttype is enabled.

public contentTypeEnabled(mixed $contenttype) : bool

A contenttype is disabled if it's package is disabled.

Parameters
$contenttype : mixed
  • Key, array(package, class) or numeric id of the contenttype
Return values
bool

getAggregatorTypeIds()

This gives up a list of the Aggregator types.

public getAggregatorTypeIds() : array<string|int, mixed>
Return values
array<string|int, mixed>

of ID

getAttachableContentTypes()

Fetches all attachable content types

public getAttachableContentTypes() : array<string|int, mixed>
Return values
array<string|int, mixed>

Content types.

getContentClassFromId()

Gets the class and package of a contenttypeid.

public getContentClassFromId(mixed $contenttypeid) : mixed

Note: The title is not stored as part of the contenttype and is instead a phrase that is evaluated from the contenttype's package and class.

Parameters
$contenttypeid : mixed

getContentTypeCacheEvents()

Fetches the cache events that affect contenttypes.

public getContentTypeCacheEvents() : array<string|int, mixed>
Return values
array<string|int, mixed>

string

getContentTypeClass()

Gets the class string identifier for a contenttype.

public getContentTypeClass(mixed $contenttype) : string
Parameters
$contenttype : mixed
  • Key, array(package, class) or numeric id of the contenttype
Return values
string
  • The class string identifier of the given contenttype

getContentTypeClasses()

Gets the contenttype class strings from a list of content type ids.

public getContentTypeClasses(mixed $contenttypes) : array<string|int, mixed>

Note: This will also accept content type namesso the function can be used for normalisation and validation.

Parameters
$contenttypes : mixed
Return values
array<string|int, mixed>

of conten type classes

getContentTypeID()

Gets a contenttype id from a type key or array(package, class).

public getContentTypeID(mixed $contenttype) : int

Note: This will also return the numeric id if one is given, allowing the function to be used for normalisation and validation.

If the contenttype is given as an array, it must be in the form array('package' => package class string, 'class' => contenttype class string)

Parameters
$contenttype : mixed
  • Key, array(package, class) or numeric id of the contenttype
Return values
int

| false

getContentTypePackage()

Gets the package class string identifier for a contenttype

public getContentTypePackage(mixed $contenttype) : string
Parameters
$contenttype : mixed
  • Key, array(package, class) or numeric id of the contenttype
Return values
string
  • The class string of the package

getContentTypePackageID()

Gets the package id for a contenttype

public getContentTypePackageID(mixed $contenttype) : int
Parameters
$contenttype : mixed
  • Key, array(package, class) or numeric id of the contenttype
Return values
int
  • The integer id of the package that the contenttype belongs to

getContentTypes()

Fetches all content types

public getContentTypes() : array<string|int, mixed>
Return values
array<string|int, mixed>

Content types.

getContentTypeTitle()

Gets the user friendly title of a contenttype.

public getContentTypeTitle(mixed $contenttype) : string

Note: The title is not stored as part of the contenttype and is instead a phrase that is evaluated from the contenttype's package and class.

Parameters
$contenttype : mixed
Return values
string

getForumCommentContentTypeClasses()

Return array of contenttypeid => classname that are allowed to be forum starters.

public getForumCommentContentTypeClasses() : array<string|int, mixed>

Note that array_flip()/isset() etc can be used for contenttypeid checks/operations.

Return values
array<string|int, mixed>

[contenttypeid => classname]

getForumReplyContentTypeClasses()

Return array of contenttypeid => classname that are allowed to be forum starters.

public getForumReplyContentTypeClasses() : array<string|int, mixed>

Note that array_flip()/isset() etc can be used for contenttypeid checks/operations.

Return values
array<string|int, mixed>

[contenttypeid => classname]

getForumStarterContentTypeClasses()

Return array of contenttypeid => classname that are allowed to be forum starters.

public getForumStarterContentTypeClasses() : array<string|int, mixed>

Note that array_flip()/isset() etc can be used for contenttypeid checks/operations.

Return values
array<string|int, mixed>

[contenttypeid => classname]

getNonAggregatorTypeIds()

This gives up a list of the non-Aggregator types.

public getNonAggregatorTypeIds() : array<string|int, mixed>
Return values
array<string|int, mixed>

of ID

getPackageClass()

Gets the class string identifier for a package.

public getPackageClass(mixed $package) : string
Parameters
$package : mixed
  • Class string identifier or numeric id of the package to check
Tags
throws
vB_Exception_Warning
  • Thrown if an invalid package was given
Return values
string

getPackageID()

Gets the numeric package id a package class string identifier.

public getPackageID(mixed $package) : int

Note: This will also return a package id for a given package id after verification so the function can be used for normalisation.

Parameters
$package : mixed
  • Class string identifier or numeric id of the package to check
Return values
int

| false

getSearchableContentTypes()

Fetches all searchable content types

public getSearchableContentTypes() : array<string|int, mixed>
Return values
array<string|int, mixed>

Content types.

getTypeKey()

Gets a unique string key representing a type for the given package and class.

public getTypeKey(string $package, string $class) : string

Note: The key is only unique per type (ie, unique for contenttypes).

Parameters
$package : string
  • The package identifier
$class : string
  • The class identifier
Return values
string
  • The resulting single string unique key identifier

getUntitledContentTypeTitle()

Gets a user friendly phrase for an untitled piece of content.

public getUntitledContentTypeTitle(mixed $contenttype) : string
Parameters
$contenttype : mixed
Return values
string

instance()

Returns singleton instance of self.

public static instance() : vB_Types
Return values
vB_Types
  • Reference to singleton instance of the type handler

packageEnabled()

Checks if a package is enabled.

public packageEnabled(mixed $package) : mixed
Parameters
$package : mixed
  • Class string identifier or numeric id of the package to check

reloadTypes()

This should only be called while in a

public reloadTypes() : mixed

        
On this page

Search results