class vB_Api_Content_Video extends vB_Api_Content_Text

vB_Api_Content_Video

Traits

Constants

THUMBNAIL_TTL

Properties

protected bool $disabled Indicates whether the API was disabled from vB_Api
protected array $disableWhiteList List of methods that which can still be called as normal even when the API is disabled due to forum being closed, password expired, IP ban, etc. from vB_Api_Content
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 vB_UserContext $usercontext from vB_Api_Content
protected vB_dB_Assertor $assertor from vB_Api_Content
protected vB_Api_Node $nodeApi from vB_Api_Content
protected array $options from vB_Api_Content
protected bool $doFloodCheck from vB_Api_Content
protected vB_Library_Content $library from vB_Api_Content
protected $contenttype
protected $tablename
protected $bbcode_parser from vB_Api_Content_Text
protected $textCountChange from vB_Api_Content_Text
protected $showSignature from vB_Api_Content_Text
protected $textRequired

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()

Constructor, no external instantiation

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
int
getTextCountChange()

Returns textCountChange property

integer
add(mixed $data, array $options = array())

Adds a new node.

cleanOptions(array $options)

Clean unallowed options from user request, only cleans 'skipFloodCheck' for now

cleanInput(mixed $data, int|false $nodeid = false)

Cleans the input in the $data array, directly updating $data.

boolean
delete(integer $nodeid)

Permanently deletes a node

static mixed
getContentApi(int $contenttypeid)

Returns a content api of the appropriate type

bool
isPublished(array $data)

Determines if this record is in a published state

bool
update(mixed $nodeid, mixed $data)

Updates a record

getContent($nodeid, $permissions = false)

Alias for @getFullContent

array
getFullContent(integer $nodeid, array $permissions = false)

Returns the node content plus the channel routeid and title, and starter route and title, and permissions and other data

cleanPreviewContent(mixed $record)

Takes a node record and removes the data cannot be viewed based on public_preview.

mixed
getBareContent(int $nodeid, array $permissions = false)

Returns the node content, channel routeid and title, and starter route and title, but no permissions or other subsidiary data

array|false
getConversationParent(int $nodeid)

Gets the conversation starter for a node. If the node is a channel it returns the channel array.

array
getIndexableContent($nodeId, $include_attachments = true)

The classes that inherit this should implement this function It should return the content that should be indexed If there is a title field, the array key for that field should be 'title', the rest of the text can have any key

getBbcodeOptions(int $nodeId)

Returns an array with bbcode options for the node.

int
getTimeNow()

Gives the current board time- needed to set publishdate.

string
getQuoteText(int $nodeid)

This returns the text to quote a node. Used initially for private messaging.

string
createQuoteText($nodeid, $pageText)

This returns the text to quote a node. Used initially for private messaging.

array
fetchTableName()

Returns the tables used by this content type.

bool
isVisitorMessage(int $nodeid)

Determines whether a specific node is a visitor message

mixed
extractMedia(string $rawtext)

Extracts the video and photo content from text.

bool
verify_limits(array $data)

Checks the "limit" permissions for this content item

checkTextLength(int $minChars, int $maxChars, string $text)

Check that the $text length falls in the minChar/maxChar limits Checks some class properties as well as does a transform on the text to normalize things.

void
checkHtmlstateForComments(array $data, int $nodeid = 0)

Checks 'htmlstate' and disables it if this is a comment

string
getQuotes(mixed $nodeids)

Returns a string with quoted strings in bbcode format.

array
getDataForParse(mixed $nodeIds)

Gets the data the presentation layer needs to have to parse the rawtext.

mixed
fixAttachBBCode(mixed $nodeId, array $keysToAttachid = array()) deprecated

DEPRECATED - This is now handled internally by the library, nothing is called from controllers.

autoPopulatePreviewImage(int $nodeId) deprecated

DEPRECATED - This is now handled internally by the library, nothing is called from controllers.

checkAttachmentPermissions($data, $nodeid = false)

Checks createpermissions.vbforum_attach and forumpermissions.maxattachments to see that user can add attachments under $data['parentid'] and that attachment limit is not exceeded. Throws exceptions meant to prevent node addition/update, so this function should be called before calling Library's add() or update()

array|bool
getVideoFromUrl(string $url)

Get information from video's URL.

mixed
getVideoThumbnail(string $url, int $nodeid = false)

Extracts the thumbnail from og:image meta data

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

at line 38
protected __construct()

Constructor, no external instantiation

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()

in vB_Api_Content at line 79
int getTextCountChange()

Returns textCountChange property

Return Value

int

at line 56
integer add(mixed $data, array $options = array())

Adds a new node.

Parameters

mixed $data Array of field => value pairs which define the record.
array $options Array of options for the content being created. Understands skipTransaction, skipFloodCheck, floodchecktime, many subclasses have skipNotification. See subclasses for more info.

Return Value

integer the new nodeid

in vB_Api_Content at line 124
protected cleanOptions(array $options)

Clean unallowed options from user request, only cleans 'skipFloodCheck' for now

Parameters

array $options Array of options, may be passed in from client

in vB_Api_Content_Text at line 624
cleanInput(mixed $data, int|false $nodeid = false)

Cleans the input in the $data array, directly updating $data.

Parameters

mixed $data Array of fieldname => data pairs, passed by reference.
int|false $nodeid Nodeid of the node being edited, false if creating new

in vB_Api_Content_Text at line 58
boolean delete(integer $nodeid)

Permanently deletes a node

Parameters

integer $nodeid The nodeid of the record to be deleted

Return Value

boolean

in vB_Api_Content at line 356
static mixed getContentApi(int $contenttypeid)

Returns a content api of the appropriate type

Parameters

int $contenttypeid The content type id

Return Value

mixed Content api object

in vB_Api_Content at line 368
bool isPublished(array $data)

Determines if this record is in a published state

Parameters

array $data The standard array of data sent to the add() method

Return Value

bool

in vB_Api_Content_Text at line 193
bool update(mixed $nodeid, mixed $data)

Updates a record

Parameters

mixed $nodeid array of nodeids
mixed $data array of permissions that should be checked.

Return Value

bool

in vB_Api_Content at line 428
getContent($nodeid, $permissions = false)

Alias for @getFullContent

Parameters

$nodeid
$permissions

in vB_Api_Content at line 441
array getFullContent(integer $nodeid, array $permissions = false)

Returns the node content plus the channel routeid and title, and starter route and title, and permissions and other data

Parameters

integer $nodeid The node id
array $permissions Permissions

Return Value

array The standard array of node data

in vB_Api_Content at line 468
cleanPreviewContent(mixed $record)

Takes a node record and removes the data cannot be viewed based on public_preview.

It's called from the search Api, which avoids using the content APIs

Parameters

mixed $record The node record, normally from getNodeFullContent, by reference

in vB_Api_Content at line 541
mixed getBareContent(int $nodeid, array $permissions = false)

Returns the node content, channel routeid and title, and starter route and title, but no permissions or other subsidiary data

Parameters

int $nodeid The Node ID
array $permissions Permissions

Return Value

mixed

in vB_Api_Content at line 581
array|false getConversationParent(int $nodeid)

Gets the conversation starter for a node. If the node is a channel it returns the channel array.

Parameters

int $nodeid

Return Value

array|false The starter node array. False when the node lookup fails

Exceptions

vB_Exception_Api('no_permission')

in vB_Api_Content at line 612
array getIndexableContent($nodeId, $include_attachments = true)

The classes that inherit this should implement this function It should return the content that should be indexed If there is a title field, the array key for that field should be 'title', the rest of the text can have any key

Parameters

$nodeId
$include_attachments

Return Value

array $indexableContent

in vB_Api_Content at line 622
getBbcodeOptions(int $nodeId)

Returns an array with bbcode options for the node.

Parameters

int $nodeId

in vB_Api_Content at line 633
int getTimeNow()

Gives the current board time- needed to set publishdate.

Return Value

int

in vB_Api_Content at line 645
string getQuoteText(int $nodeid)

This returns the text to quote a node. Used initially for private messaging.

Parameters

int $nodeid The nodeid of the quoted item

Return Value

string Quote text

in vB_Api_Content at line 659
string createQuoteText($nodeid, $pageText)

This returns the text to quote a node. Used initially for private messaging.

Parameters

$nodeid
$pageText

Return Value

string Quote text.

in vB_Api_Content at line 671
array fetchTableName()

Returns the tables used by this content type.

Return Value

array Array of table names

in vB_Api_Content at line 684
bool isVisitorMessage(int $nodeid)

Determines whether a specific node is a visitor message

Parameters

int $nodeid NodeID

Return Value

bool

in vB_Api_Content at line 696
mixed extractMedia(string $rawtext)

Extracts the video and photo content from text.

Parameters

string $rawtext

Return Value

mixed Array of "photo", "video". Each is an array of images.

in vB_Api_Content at line 713
protected bool verify_limits(array $data)

Checks the "limit" permissions for this content item

Parameters

array $data Info about the content that needs to be added

Return Value

bool Either true if all the tests passed or thrown exception

in vB_Api_Content_Text at line 308
protected checkTextLength(int $minChars, int $maxChars, string $text)

Check that the $text length falls in the minChar/maxChar limits Checks some class properties as well as does a transform on the text to normalize things.

Throws an exception if validation fails.

Parameters

int $minChars -- check if $this->textRequired is true
int $maxChars -- unlimited if 0
string $text

in vB_Api_Content_Text at line 332
protected void checkHtmlstateForComments(array $data, int $nodeid = 0)

Checks 'htmlstate' and disables it if this is a comment

Parameters

array $data (reference) The node data array
int $nodeid (optional) The node ID. This should be used when updating and the parent ID is not passed in the data array

Return Value

void This function modifies the passed $data array.

in vB_Api_Content_Text at line 402
string getQuotes(mixed $nodeids)

Returns a string with quoted strings in bbcode format.

Parameters

mixed $nodeids array of integers

Return Value

string

in vB_Api_Content_Text at line 427
array getDataForParse(mixed $nodeIds)

Gets the data the presentation layer needs to have to parse the rawtext.

Parameters

mixed $nodeIds nodeId or array of nodeIds

Return Value

array Array of node information for parsing the content. Each item indexed by the nodeid and contains: 'bbcodeoptions', 'rawtext', 'previewtext', 'attachments', 'title' 'channelid', 'htmlstate', 'disable_bbcode', 'avatar_userids'

in vB_Api_Content_Text at line 735
mixed fixAttachBBCode(mixed $nodeId, array $keysToAttachid = array()) deprecated

deprecated Superceded by replaceAttachBbcodeTempids in the text library.

DEPRECATED - This is now handled internally by the library, nothing is called from controllers.

This was used by the createcontent controller's handleAttachmentUploads() to fix temporary id references in the specified node's rawtext to nodeids

Parameters

mixed $nodeId nodeid or array of nodeids
array $keysToAttachid (optional) array({tempid of attachment} => {attachment's nodeid}) maps temporary-ids (array key) of newly added attachments and corresponding nodeids (array value) of said attachments. While this is optional for historical reasons, it must be provided if any temporary id references in the rawtext need to be replaced.

Return Value

mixed array includes bbcodeoptions, attachments, and rawtext

in vB_Api_Content_Text at line 759
autoPopulatePreviewImage(int $nodeId) deprecated

deprecated Superceded by getPreviewImage in the text library.

DEPRECATED - This is now handled internally by the library, nothing is called from controllers.

NOTE: This is still used by some upgrade steps, so we can't remove it completely at this time.

Populates the previewimage field for this node. To be called after the node is saved and the attachments added.

Finds the first image in the post text that can be used as a previewimage (uploaded here), or uses the first image attachment.

Parameters

int $nodeId Nodeid

in vB_Api_Content_Text at line 793
protected checkAttachmentPermissions($data, $nodeid = false)

Checks createpermissions.vbforum_attach and forumpermissions.maxattachments to see that user can add attachments under $data['parentid'] and that attachment limit is not exceeded. Throws exceptions meant to prevent node addition/update, so this function should be called before calling Library's add() or update()

The createpermissions.vbforum_attach will be checked if there is any change in attachments. However, the attachment limit forumpermissions.maxattachments will only be checked if there is a net gain of attachments. If there is absolutely no change to attachments (signified by an empty $data['attachments'] and empty $data['removeattachments']), no permission will be checked as we do not want to prevent a recent change in attachment-related channel permissions (e.g. attachment limit being decreased or the createpermission being unset since post creation) to prevent a text-only update.

Parameters

$data
$nodeid

Exceptions

vB_Exception_Api('invalid_parentid') if required 'parentid' is not found in $data
vB_Exception_Api('no_create_permissions_attach') if user lacks createpermissions.vbforum_attach channel permission.
vB_Exception_Api('max_attachments_exceeded_x') if attachment limit check failed per above notes.

at line 77
array|bool getVideoFromUrl(string $url)

Get information from video's URL.

This method makes use of bbcode_video table to get provider information

Parameters

string $url

Return Value

array|bool Video data. False if the url is not supported or invalid

at line 90
mixed getVideoThumbnail(string $url, int $nodeid = false)

Extracts the thumbnail from og:image meta data

Parameters

string $url url of video
int $nodeid optional nodeid of video node

Return Value

mixed url string or false