Class BackendBindings.
This class abstracts the Contao backend methods used within DcGeneral over
all Contao versions.
This is needed to limit the amount of version_compare() calls to an absolute
minimum.
Methods summary
protected static
|
|
public static
|
#
log( string $strText, string $strFunction, string $strCategory )
Log a message to the contao system log.
Log a message to the contao system log.
Parameters
- $strText
string $strText The message text to add to the log.
- $strFunction
string $strFunction The method/function the message originates from.
- $strCategory
string $strCategory The category under which the message shall be logged.
|
public static
|
#
redirect( string $strLocation, integer $intStatus = 303 )
Redirect the browser to a new location.
Redirect the browser to a new location.
NOTE: This method exits the script.
Parameters
- $strLocation
string $strLocation The new URI to which the browser shall get redirected to.
- $intStatus
integer $intStatus The HTTP status code to use. 301, 302, 303, 307. Defaults to 303.
|
public static
|
#
reload( )
Reload the current page.
NOTE: This method exits the script.
|
public static
string
|
#
addToUrl( string $strRequest )
Add a request string to the current URI string.
Add a request string to the current URI string.
Parameters
- $strRequest
string $strRequest The parameters to add to the current URL separated by &.
Returns
string
|
public static
|
#
loadLanguageFile( string $strName, boolean $strLanguage = null, boolean $blnNoCache = false )
Load a set of language files.
Load a set of language files.
Parameters
- $strName
string $strName The table name.
- $strLanguage
boolean $strLanguage An optional language code.
- $blnNoCache
boolean $blnNoCache If true, the cache will be bypassed.
Throws
Exception In case a language does not exist.
|
public static
string|null
|
#
getImage( string $image, integer $width, integer $height, string $mode = '', string $target = null, boolean $force = false )
Resize an image and store the resized version in the assets/images
folder.
Resize an image and store the resized version in the assets/images
folder.
Parameters
- $image
string $image The image path.
- $width
integer $width The target width.
- $height
integer $height The target height.
- $mode
string $mode The resize mode.
- $target
string $target An optional target path.
- $force
boolean $force Override existing target images.
Returns
string|null The path of the resized image or null.
|
public static
string
|
#
generateImage( string $src, string $alt = '', string $attributes = '' )
Generate an image tag and return it as string.
Generate an image tag and return it as string.
Parameters
- $src
string $src The image path.
- $alt
string $alt An optional alt attribute.
- $attributes
string $attributes A string of other attributes.
Returns
string The image HTML tag.
|
public static
string
|
#
getReferer( boolean $blnEncodeAmpersands = false, string $strTable = null )
Return the current referer URL and optionally encode ampersands.
Return the current referer URL and optionally encode ampersands.
Parameters
- $blnEncodeAmpersands
boolean $blnEncodeAmpersands If true, ampersands will be encoded.
- $strTable
string $strTable An optional table name.
Returns
string The referer URL
|
public static
|
#
loadDataContainer( string $strTable, boolean $blnNoCache = false )
Load a set of DCA files.
Parameters
- $strTable
string $strTable The table name.
- $blnNoCache
boolean $blnNoCache If true, the cache will be bypassed.
|
public static
string
|
#
parseDate( string $strFormat, integer $intTimestamp = null )
Parse a date format string and translate textual representations.
Parse a date format string and translate textual representations.
Parameters
- $strFormat
string $strFormat The date format string.
- $intTimestamp
integer $intTimestamp An optional timestamp.
Returns
string The textual representation of the date.
|
public static
string
|
#
substrHtml( string $strString, integer $intNumberOfChars )
Shorten a HTML string to a certain number of characters.
Shorten a HTML string to a certain number of characters.
Shortens a string to a given number of characters preserving words (therefore
it might be a bit shorter or longer than the number of characters specified).
Preserves allowed tags.
Parameters
- $strString
string $strString The Html string to cut.
- $intNumberOfChars
integer $intNumberOfChars The amount of chars to preserve.
Returns
string
|