Tuskfish API V1.1.2
  • Package
  • Class

Packages

  • content
  • core
  • database
  • installation
  • security
  • user
  • utilities

Classes

  • TfCache
  • TfFileHandler
  • TfLogger
  • TfMetadata
  • TfPaginationControl
  • TfPreference
  • TfPreferenceHandler
  • TfTemplate
  • TfTree

Traits

  • TfLanguage
  • TfMagicMethods
  • TfMimetypes
  • TfRights

Functions

  • checkPasswordStrength
  • hashPassword
  • tf_autoload
  • tfContentModuleAutoload

Class TfPreference

Holds Tuskfish site configuration (preference) data.

A preference object is automatically instantiated on every page via tfHeader.php.

TfPreference uses TfMagicMethods, TfLanguage
Package: core
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 TfMagicMethods Prevents direct setting of properties / unlisted properties.
Uses: trait TfLanguage to obtain a list of available translations.
Located at trust_path/libraries/tuskfish/class/TfPreference.php

Methods summary

public
# __construct( TfValidator $validator, array $preferences )

Constructor.

Constructor.

Parameters

$validator
An instance of the Tuskfish data validator class.
$preferences

An associative array holding Tuskfish preference settings, may be read from the database or passed in via the preference form.

public string
# escapeForXss( string $property )

Escape a property for on-screen display to prevent XSS.

Escape a property for on-screen display to prevent XSS.

Applies htmlspecialchars() to a property destined for display to mitigate XSS attacks. Note that preference values should not be directly assigned to meta tags; they should be assigned to $tfMetadata instead, which will handle any escaping necessary.

Parameters

$property
Name of property.

Returns

string
Value of property escaped for display.
public array
# getPreferencesAsArray( )

Converts the preference object to an array suitable for insert/update calls to the database.

Converts the preference object to an array suitable for insert/update calls to the database.

Returns

array
Array of object property/values.
public
# loadPropertiesFromArray( array $dirtyInput )

Update the preference object from an external data source (eg. form submission).

Update the preference object from an external data source (eg. form submission).

The preference object will conduct its own internal data type validation and range checks.

Parameters

$dirtyInput
Usually $_REQUEST data.
public
# setAdminPagination( integer $value )

Set the number of objects to display in a single admin page view.

Set the number of objects to display in a single admin page view.

Parameters

$value
Number of objects to view on a single page.
public
# setSiteAuthor( string $value )

Set the name of the site author. Used to population page meta author tag.

Set the name of the site author. Used to population page meta author tag.

Parameters

$value
Name of the site author.
public
# setCacheLife( integer $value )

Set life of items in cache (seconds).

Set life of items in cache (seconds).

Items that expire will be rebuilt and re-written to the cache the next time the page is requested.

Parameters

$value
Expiry timer on cached items (seconds).
public
# setCloseSite( integer $value )

Open our close the site.

Open our close the site.

Parameters

$value
Site open (0) or closed (1).
public
# setDateFormat( string $value )

Set the date format, used to convert timestamps to human readable form.

Set the date format, used to convert timestamps to human readable form.

See the PHP manual for date formatting templates: http://php.net/manual/en/function.date.php

Parameters

$value
Template for formatting dates.
public
# setDefaultLanguage( string $value )

Set the default language for this Tuskfish installation.

Set the default language for this Tuskfish installation.

Parameters

$value
ISO 639-1 two-letter language codes.
public
# setSiteDescription( string $value )

Set the site description. Used in meta description tag.

Set the site description. Used in meta description tag.

Parameters

$value
Site description.
public
# setSiteEmail( string $value )

Set the admin email address for the site.

Set the admin email address for the site.

Used in RSS feeds to populate the managingEditor and webmaster tags.

Parameters

$value
Email address.
public
# setEnableCache( integer $value )

Enable or disable the cache.

Enable or disable the cache.

Parameters

$value
Enabled (1) or disabled (0).
public
# setGalleryPagination( integer $value )

Set number of objects to display on the gallery page.

Set number of objects to display on the gallery page.

Parameters

$value
Number of objects to display on a single page view.
public
# setMinSearchLength( integer $value )

Set the minimum length of search terms (characters).

Set the minimum length of search terms (characters).

Search terms less than this number of characters will be discarded. It is usually best to allow a minimum length of 3 characters; this allows searching for common acronyms without returning massive numbers of hits.

Parameters

$value
Minimum number of characters.
public
# setPaginationElements( integer $value )

Set the default number of page slots to display in pagination elements.

Set the default number of page slots to display in pagination elements.

Can be overridden manually in TfishPaginationControl.

Parameters

$value
Number of page slots to display in pagination control.
public
# setRssPosts( integer $value )

Set number of items to display in RSS feeds.

Set number of items to display in RSS feeds.

Parameters

$value
Number of items to include in feed.
public
# setSearchPagination( integer $value )

Set number of results to display on a search page view.

Set number of results to display on a search page view.

Parameters

$value
Number of objects to display in a single page view.
public
# setServerTimezone( string $value )

Set the server timezone.

Set the server timezone.

Parameters

$value
Timezone.
public
# setSessionLife( integer $value )

Set the life of an idle session.

Set the life of an idle session.

User will be logged out after being idle for this many minutes.

Parameters

$value
Session life (minutes).
public
# setSessionName( string $value )

Set the name (prefix) used to identify Tuskfish sessions.

Set the name (prefix) used to identify Tuskfish sessions.

If you change it, use something unpredictable.

Parameters

$value
Session name.
public
# setSiteCopyright( string $value )

Set the site meta copyright.

Set the site meta copyright.

Used to populate the dcterms.rights meta tag in the theme. Can be overriden in the theme.html file.

Parameters

$value
Copyright statement.
public
# setSiteName( string $value )

Set the title of the page.

Set the title of the page.

Used to populate the meta title tag. Usually each page / object will specify a title, but if none is set this value will be used as the default. The title can be manually overriden on each page using the TfishMetadata object (see comments at the bottom of controller scripts).

Parameters

$value
public
# setSiteTimezone( string $value )

Set the site timezone.

Set the site timezone.

This is normally the timezone for your principal target audience.

Parameters

$value
Timezone.
public
# setUserPagination( integer $value )

Set the number of objects to display in a single page view on the public facing side of the site.

Set the number of objects to display in a single page view on the public facing side of the site.

Parameters

$value
Number of objects to display.

Methods used from TfMagicMethods

__get(), __isset(), __set(), __unset()

Methods used from TfLanguage

getListOfLanguages()

Properties summary

protected $validator
#
protected $siteName
#
protected $siteDescription
#
protected $siteAuthor
#
protected $siteEmail
#
protected $siteCopyright
#
protected $closeSite
#
protected $serverTimezone
#
protected $siteTimezone
#
protected $minSearchLength
#
protected $searchPagination
#
protected $userPagination
#
protected $adminPagination
#
protected $galleryPagination
#
protected $rssPosts
#
protected $paginationElements
#
protected $sessionName
#
protected $sessionLife
#
protected $defaultLanguage
#
protected $dateFormat
#
protected $enableCache
#
protected $cacheLife
#

Magic properties

public TfValidator $validator

Instance of the Tuskfish data validator class.

public string $siteName

Name of website.

public string $siteDescription

Meta description of website.

public string $siteAuthor

Author of website.

public string $siteEmail

Administrative contact email for website.

public string $siteCopyright

Copyright notice.

public integer $closeSite

Toggle to close this site.

public string $serverTimezone

Timezone of server location.

public string $siteTimezone

Timezone for main audience location.

public integer $minSearchLength

Minimum length of search terms.

Tuskfish API V1.1.2 API documentation generated by ApiGen