Class TfContentObject
Base class for content objects. Represents a single content object.
There is only one 'archtype' of content object in Tuskfish; it uses a subset of standard Dublin Core metadata fields plus a few more that are common to most content objects. Why? If you look at most common content types - articles, photos, downloads etc. - you will see that for the most part they all use the same fields (title, teaser, description, etc).
By using a single table for content objects with common field names our queries become very simple and much redundancy is avoided. Content subclasses that don't need particular properties unset() them in their constructor.
- TfContentObject uses TfLanguage, TfMagicMethods, TfMimetypes, TfRights
Direct known subclasses
TfArticle
,
TfAudio
,
TfBlock
,
TfCollection
,
TfDownload
,
TfImage
,
TfStatic
,
TfTag
,
TfVideo
Copyright: Simon Wilkinson 2013+ (https://tuskfish.biz)
License: GNU General Public License (GPL) V2
Author: Simon Wilkinson simon@isengard.biz
Version: Release: 1.0
Since: 1.0
Uses: trait TfLanguage to obtain a list of available translations.
Uses: trait TfMagicMethods Prevents direct setting of properties / unlisted properties.
Uses: trait TfMimetypes Access a list of known / acceptable file mimetypes.
Properties: TfValidator $validator Instance of the Tuskfish data validator class.
Properties: int $id Auto-increment, set by database.
Properties: string $type Content object type eg. TfArticle etc. [ALPHA]
Properties: string $title The name of this content.
Properties: string $teaser A short (one paragraph) summary or abstract for this content. [HTML]
Properties: string $description The full article or description of the content. [HTML]
Properties: string $media An associated download/audio/video file. [FILEPATH OR URL]
Properties: string $format Mimetype
Properties: string $fileSize Specify in bytes.
Properties: string $creator Author.
Properties: string image An associated image file, eg. a screenshot a good way to handle it. [FILEPATH OR URL]
Properties: string $caption Caption of the image file.
Properties: string $date Date of publication expressed as a string.
Properties: int $parent A source work or collection of which this content is part.
Properties: string $language Future proofing.
Properties: int $rights Intellectual property rights scheme or license under which the work is distributed.
Properties: string $publisher The entity responsible for distributing this work.
Properties: array $tags Tag IDs associated with this object; not persistent (stored as taglinks in taglinks table).
Properties: int $online Toggle object on or offline.
Properties: int $submissionTime Timestamp representing submission time.
Properties: int $lastUpdated Timestamp representing last time this object was updated.
Properties: int $expiresOn Timestamp indicating the expiry date for this object.
Properties: int $counter Number of times this content was viewed or downloaded.
Properties: string $metaTitle Set a custom page title for this content.
Properties: string $metaDescription Set a custom page meta description for this content.
Properties: string $seo SEO-friendly string; it will be appended to the URL for this content.
Properties: string $handler Handler for this object (not persistent).
Properties: string $template The template that should be used to display this object (not persistent).
Properties: string $module The module that handles this content type (not persistent).
Properties: string $icon The vector icon that represents this object type (not persistent).
Located at trust_path/modules/content/class/TfContentObject.php
Methods summary
public
|
|
public
array
|
#
convertObjectToArray( )
Converts a content object to an array suitable for insert/update calls to the database. |
public
string|null
|
#
escapeForXss( string $property, boolean $escapeHtml = false )
Escapes object properties for output to browser. |
public
string
|
#
getCachedImage( integer $width = 0, integer $height = 0 )
Resizes and caches an associated image and returns a URL to the cached copy. |
public
array
|
#
getListOfAllowedAudioMimetypes( )
Returns an array of audio mimetypes that are permitted for content objects. |
public
array
|
#
getListOfAllowedImageMimetypes( )
Returns an array of image mimetypes that are permitted for content objects. |
public
array
|
#
getListOfAllowedVideoMimetypes( )
Returns an array of video mimetypes that are permitted for upload. |
public
array
|
#
getListOfZeroedProperties( )
Returns an array of base object properties that are not used by this subclass. |
public
array
|
|
public
string
|
|
public
boolean
|
|
public
|
#
loadPropertiesFromArray( array $dirtyInput, boolean $liveUrls = true )
Populates the properties of the object from external (untrusted) data source. |
protected
string
|
#
makeDataHumanReadable( string $cleanProperty )
Converts properties to human readable form in preparation for output. |
public
string
|
#
convertBytesToHumanReadable( integer $bytes )
Converts bytes to a human readable units (KB, MB, GB etc). |
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
#
setLastUpdated( integer $lastUpdated )
Set the last updated time for this content object (timestamp). |
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
#
setSubmissionTime( integer $submissionTime )
Set the submission time for this content object (timestamp). |
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
Methods used from TfLanguage
Methods used from TfMagicMethods
Methods used from TfMimetypes
Methods used from TfRights
Properties summary
protected
|
$validator
|
|
protected
string
|
$id
|
#
''
|
protected
string
|
$type
|
#
''
|
protected
string
|
$title
|
#
''
|
protected
string
|
$teaser
|
#
''
|
protected
string
|
$description
|
#
''
|
protected
string
|
$media
|
#
''
|
protected
string
|
$format
|
#
''
|
protected
string
|
$fileSize
|
#
''
|
protected
string
|
$creator
|
#
''
|
protected
string
|
$image
|
#
''
|
protected
string
|
$caption
|
#
''
|
protected
string
|
$date
|
#
''
|
protected
string
|
$parent
|
#
''
|
protected
string
|
$language
|
#
''
|
protected
string
|
$rights
|
#
''
|
protected
string
|
$publisher
|
#
''
|
protected
string
|
$tags
|
#
''
|
protected
string
|
$online
|
#
''
|
protected
string
|
$submissionTime
|
#
''
|
protected
string
|
$lastUpdated
|
#
''
|
protected
string
|
$expiresOn
|
#
''
|
protected
string
|
$counter
|
#
''
|
protected
string
|
$metaTitle
|
#
''
|
protected
string
|
$metaDescription
|
#
''
|
protected
string
|
$seo
|
#
''
|
protected
string
|
$handler
|
#
''
|
protected
string
|
$template
|
#
''
|
protected
string
|
$module
|
#
''
|
protected
string
|
$icon
|
#
''
|