PHP 클래스 Contao\System

The class provides miscellaneous methods that are used all throughout the application. It is the base class of the Contao library which provides the central "import" method to load other library classes. Usage: class MyClass extends \System { public function __construct() { $this->import('Database'); } }
파일 보기 프로젝트 열기: contao/core-bundle 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$arrCache array Cache
$arrImageSizes array Available image sizes
$arrLanguageFiles array Loaded language files
$arrLanguages array Available languages
$arrObjects array Default libraries
$arrStaticObjects array Static objects
$objContainer Symfony\Component\DependencyInjection\ContainerInterface Container

공개 메소드들

메소드 설명
__get ( string $strKey ) : mixed | null Get an object property
addToUrl ( string $strRequest ) : string Add a request string to the current URL
anonymizeIp ( string $strIp ) : string Anonymize an IP address by overriding the last chunk
convertXlfToPhp ( string $strName, string $strLanguage, boolean $blnLoad = false ) : string Convert an .xlf file into a PHP language file
disableModule ( ) : boolean Disable a back end module
enableModule ( ) : boolean Enable a back end module
getContainer ( ) : Symfony\Component\DependencyInjection\ContainerInterface Return the container object
getCountries ( ) : array Return the countries as array
getFormattedNumber ( mixed $varNumber, integer $intDecimals = 2 ) : mixed Format a number
getImageSizes ( ) : array Return all image sizes as array
getIndexFreeRequest ( boolean $blnAmpersand = true ) : string Return the request string without the script name
getLanguages ( boolean $blnInstalledOnly = false ) : array Return the available languages as array
getModelClassFromTable ( string $strTable ) : string Compile a Model class name from a table name (e.g. tl_form_field becomes FormFieldModel)
getReadableSize ( integer $intSize, integer $intDecimals = 1 ) : string Convert a byte value into a human readable format
getReferer ( boolean $blnEncodeAmpersands = false, string $strTable = null ) : string Return the referer URL and optionally encode ampersands
getSessionHash ( string $strCookie ) : string Return the session hash
getTimeZones ( ) : array Return the timezones as array
importStatic ( string $strClass, string $strKey = null, boolean $blnForce = false ) : object Import a library in non-object context
isInstalledLanguage ( boolean $strLanguage ) : boolean Check whether a language is installed
loadLanguageFile ( string $strName, boolean $strLanguage = null, boolean $blnNoCache = false ) Load a set of language files
log ( string $strText, string $strFunction, string $strCategory ) Add a log entry to the database
parseDate ( string $strFormat, integer $intTstamp = null ) : string Parse a date format string and translate textual representations
redirect ( string $strLocation, integer $intStatus = 303 ) Redirect to another page
reload ( ) Reload the current page
setContainer ( Symfony\Component\DependencyInjection\ContainerInterface $container ) Set the container object
setCookie ( string $strName, mixed $varValue, integer $intExpires, string $strPath = null, string $strDomain = null, boolean $blnSecure = false, boolean $blnHttpOnly = false ) Set a cookie
splitFriendlyName ( string $strEmail ) : array Split a friendly-name e-address and return name and e-mail as array
urlEncode ( string $strPath ) : string Urlencode a file path preserving slashes

보호된 메소드들

메소드 설명
__construct ( ) Import the Config and Session instances
addConfirmationMessage ( string $strMessage ) Add a confirmation message
addErrorMessage ( string $strMessage ) Add an error message
addInfoMessage ( string $strMessage ) Add an info message
addMessage ( string $strMessage, string $strType ) Add a message
addNewMessage ( string $strMessage ) Add a new message
addRawMessage ( string $strMessage ) Add an unformatted message
getMessageTypes ( ) : array Return all available message types
getMessages ( string $strScope = TL_MODE ) : string Return all messages as HTML
idnaDecode ( string $strDomain ) : string Decode an internationalized domain name
idnaEncode ( string $strDomain ) : string Encode an internationalized domain name
idnaEncodeEmail ( string $strEmail ) : string Encode the domain in an e-mail address
idnaEncodeUrl ( string $strUrl ) : string Encode the domain in an URL
import ( string $strClass, string $strKey = null, boolean $blnForce = false ) Import a library and make it accessible by its name or an optional key
isValidEmailAddress ( string $strEmail ) : boolean Validate an e-mail address
readPhpFileWithoutTags ( string $strName ) : string Read the contents of a PHP file, stripping the opening and closing PHP tags
resetMessages ( ) Reset the message system

메소드 상세

__construct() 보호된 메소드

Import the Config and Session instances
protected __construct ( )

__get() 공개 메소드

Lazy load the Input and Environment libraries (which are now static) and only include them as object property if an old module requires it
public __get ( string $strKey ) : mixed | null
$strKey string The property name
리턴 mixed | null The property value or null

addConfirmationMessage() 보호된 메소드

Add a confirmation message
사용 중단: Deprecated since Contao 4.0, to be removed in Contao 5.0. Use Message::addConfirmation() instead.
protected addConfirmationMessage ( string $strMessage )
$strMessage string The confirmation

addErrorMessage() 보호된 메소드

Add an error message
사용 중단: Deprecated since Contao 4.0, to be removed in Contao 5.0. Use Message::addError() instead.
protected addErrorMessage ( string $strMessage )
$strMessage string The error message

addInfoMessage() 보호된 메소드

Add an info message
사용 중단: Deprecated since Contao 4.0, to be removed in Contao 5.0. Use Message::addInfo() instead.
protected addInfoMessage ( string $strMessage )
$strMessage string The info message

addMessage() 보호된 메소드

Add a message
사용 중단: Deprecated since Contao 4.0, to be removed in Contao 5.0. Use Message::add() instead.
protected addMessage ( string $strMessage, string $strType )
$strMessage string The message
$strType string The message type

addNewMessage() 보호된 메소드

Add a new message
사용 중단: Deprecated since Contao 4.0, to be removed in Contao 5.0. Use Message::addNew() instead.
protected addNewMessage ( string $strMessage )
$strMessage string The new message

addRawMessage() 보호된 메소드

Add an unformatted message
사용 중단: Deprecated since Contao 4.0, to be removed in Contao 5.0. Use Message::addRaw() instead.
protected addRawMessage ( string $strMessage )
$strMessage string The unformatted message

addToUrl() 공개 정적인 메소드

Add a request string to the current URL
사용 중단: Deprecated since Contao 4.0, to be removed in Contao 5.0. Use Controller::addToUrl() instead.
public static addToUrl ( string $strRequest ) : string
$strRequest string The string to be added
리턴 string The new URL

anonymizeIp() 공개 정적인 메소드

Anonymize an IP address by overriding the last chunk
public static anonymizeIp ( string $strIp ) : string
$strIp string The IP address
리턴 string The encoded IP address

convertXlfToPhp() 공개 정적인 메소드

Convert an .xlf file into a PHP language file
사용 중단: Deprecated since Contao 4.0, to be removed in Contao 5.0. Use the Contao\CoreBundle\Config\Loader\XliffFileLoader instead.
public static convertXlfToPhp ( string $strName, string $strLanguage, boolean $blnLoad = false ) : string
$strName string The name of the .xlf file
$strLanguage string The language code
$blnLoad boolean Add the labels to the global language array
리턴 string The PHP code

disableModule() 공개 정적인 메소드

Disable a back end module
사용 중단: Deprecated since Contao 4.0, to be removed in Contao 5.0. Use Composer to add or remove modules.
public static disableModule ( ) : boolean
리턴 boolean True if the module was disabled

enableModule() 공개 정적인 메소드

Enable a back end module
사용 중단: Deprecated since Contao 4.0, to be removed in Contao 5.0. Use Composer to add or remove modules.
public static enableModule ( ) : boolean
리턴 boolean True if the module was enabled

getContainer() 공개 정적인 메소드

Return the container object
public static getContainer ( ) : Symfony\Component\DependencyInjection\ContainerInterface
리턴 Symfony\Component\DependencyInjection\ContainerInterface The container object

getCountries() 공개 정적인 메소드

Return the countries as array
public static getCountries ( ) : array
리턴 array An array of country names

getFormattedNumber() 공개 정적인 메소드

Format a number
public static getFormattedNumber ( mixed $varNumber, integer $intDecimals = 2 ) : mixed
$varNumber mixed An integer or float number
$intDecimals integer The number of decimals to show
리턴 mixed The formatted number

getImageSizes() 공개 정적인 메소드

Return all image sizes as array
사용 중단: Deprecated since Contao 4.1, to be removed in Contao 5. Use the contao.image.image_sizes service instead.
public static getImageSizes ( ) : array
리턴 array The available image sizes

getIndexFreeRequest() 공개 정적인 메소드

Return the request string without the script name
사용 중단: Deprecated since Contao 4.0, to be removed in Contao 5.0. Use Environment::get("indexFreeRequest") instead.
public static getIndexFreeRequest ( boolean $blnAmpersand = true ) : string
$blnAmpersand boolean If true, ampersands will be encoded
리턴 string The request string

getLanguages() 공개 정적인 메소드

Return the available languages as array
public static getLanguages ( boolean $blnInstalledOnly = false ) : array
$blnInstalledOnly boolean If true, return only installed languages
리턴 array An array of languages

getMessageTypes() 보호된 메소드

Return all available message types
사용 중단: Deprecated since Contao 4.0, to be removed in Contao 5.0. Use Message::getTypes() instead.
protected getMessageTypes ( ) : array
리턴 array An array of message types

getMessages() 보호된 메소드

Return all messages as HTML
사용 중단: Deprecated since Contao 4.0, to be removed in Contao 5.0. Use Message::generate() instead.
protected getMessages ( string $strScope = TL_MODE ) : string
$strScope string An optional message scope
리턴 string The messages HTML markup

getModelClassFromTable() 공개 정적인 메소드

Compile a Model class name from a table name (e.g. tl_form_field becomes FormFieldModel)
사용 중단: Deprecated since Contao 4.0, to be removed in Contao 5.0. Use Model::getClassFromTable() instead.
public static getModelClassFromTable ( string $strTable ) : string
$strTable string The table name
리턴 string The model class name

getReadableSize() 공개 정적인 메소드

Convert a byte value into a human readable format
public static getReadableSize ( integer $intSize, integer $intDecimals = 1 ) : string
$intSize integer The size in bytes
$intDecimals integer The number of decimals to show
리턴 string The human readable size

getReferer() 공개 정적인 메소드

Return the referer URL and optionally encode ampersands
public static getReferer ( boolean $blnEncodeAmpersands = false, string $strTable = null ) : string
$blnEncodeAmpersands boolean If true, ampersands will be encoded
$strTable string An optional table name
리턴 string The referer URL

getSessionHash() 공개 정적인 메소드

Return the session hash
public static getSessionHash ( string $strCookie ) : string
$strCookie string The cookie name
리턴 string The session hash

getTimeZones() 공개 정적인 메소드

Return the timezones as array
public static getTimeZones ( ) : array
리턴 array An array of timezones

idnaDecode() 보호된 메소드

Decode an internationalized domain name
사용 중단: Deprecated since Contao 4.0, to be removed in Contao 5.0. Use Idna::decode() instead.
protected idnaDecode ( string $strDomain ) : string
$strDomain string The domain name
리턴 string The decoded domain name

idnaEncode() 보호된 메소드

Encode an internationalized domain name
사용 중단: Deprecated since Contao 4.0, to be removed in Contao 5.0. Use Idna::encode() instead.
protected idnaEncode ( string $strDomain ) : string
$strDomain string The domain name
리턴 string The encoded domain name

idnaEncodeEmail() 보호된 메소드

Encode the domain in an e-mail address
사용 중단: Deprecated since Contao 4.0, to be removed in Contao 5.0. Use Idna::encodeEmail() instead.
protected idnaEncodeEmail ( string $strEmail ) : string
$strEmail string The e-mail address
리턴 string The encoded e-mail address

idnaEncodeUrl() 보호된 메소드

Encode the domain in an URL
사용 중단: Deprecated since Contao 4.0, to be removed in Contao 5.0. Use Idna::encodeUrl() instead.
protected idnaEncodeUrl ( string $strUrl ) : string
$strUrl string The URL
리턴 string The encoded URL

import() 보호된 메소드

Import a library and make it accessible by its name or an optional key
protected import ( string $strClass, string $strKey = null, boolean $blnForce = false )
$strClass string The class name
$strKey string An optional key to store the object under
$blnForce boolean If true, existing objects will be overridden

importStatic() 공개 정적인 메소드

Import a library in non-object context
public static importStatic ( string $strClass, string $strKey = null, boolean $blnForce = false ) : object
$strClass string The class name
$strKey string An optional key to store the object under
$blnForce boolean If true, existing objects will be overridden
리턴 object The imported object

isInstalledLanguage() 공개 정적인 메소드

Check whether a language is installed
public static isInstalledLanguage ( boolean $strLanguage ) : boolean
$strLanguage boolean The language code
리턴 boolean True if the language is installed

isValidEmailAddress() 보호된 메소드

Validate an e-mail address
사용 중단: Deprecated since Contao 4.0, to be removed in Contao 5.0. Use Validator::isEmail() instead.
protected isValidEmailAddress ( string $strEmail ) : boolean
$strEmail string The e-mail address
리턴 boolean True if it is a valid e-mail address

loadLanguageFile() 공개 정적인 메소드

Load a set of language files
public static loadLanguageFile ( string $strName, boolean $strLanguage = null, boolean $blnNoCache = false )
$strName string The table name
$strLanguage boolean An optional language code
$blnNoCache boolean If true, the cache will be bypassed

log() 공개 정적인 메소드

Add a log entry to the database
사용 중단: Deprecated since Contao 4.2, to be removed in Contao 5. Use the logger service instead.
public static log ( string $strText, string $strFunction, string $strCategory )
$strText string The log message
$strFunction string The function name
$strCategory string The category name

parseDate() 공개 정적인 메소드

Parse a date format string and translate textual representations
사용 중단: Deprecated since Contao 4.0, to be removed in Contao 5.0. Use Date::parse() instead.
public static parseDate ( string $strFormat, integer $intTstamp = null ) : string
$strFormat string The date format string
$intTstamp integer An optional timestamp
리턴 string The textual representation of the date

readPhpFileWithoutTags() 보호된 정적인 메소드

Read the contents of a PHP file, stripping the opening and closing PHP tags
사용 중단: Deprecated since Contao 4.0, to be removed in Contao 5.0. Use the Contao\CoreBundle\Config\Loader\PhpFileLoader instead.
protected static readPhpFileWithoutTags ( string $strName ) : string
$strName string The name of the PHP file
리턴 string The PHP code without the PHP tags

redirect() 공개 정적인 메소드

Redirect to another page
사용 중단: Deprecated since Contao 4.0, to be removed in Contao 5.0. Use Controller::redirect() instead.
public static redirect ( string $strLocation, integer $intStatus = 303 )
$strLocation string The target URL
$intStatus integer The HTTP status code (defaults to 303)

reload() 공개 정적인 메소드

Reload the current page
사용 중단: Deprecated since Contao 4.0, to be removed in Contao 5.0. Use Controller::reload() instead.
public static reload ( )

resetMessages() 보호된 메소드

Reset the message system
사용 중단: Deprecated since Contao 4.0, to be removed in Contao 5.0. Use Message::reset() instead.
protected resetMessages ( )

setContainer() 공개 정적인 메소드

Set the container object
public static setContainer ( Symfony\Component\DependencyInjection\ContainerInterface $container )
$container Symfony\Component\DependencyInjection\ContainerInterface The container object

setCookie() 공개 정적인 메소드

Set a cookie
public static setCookie ( string $strName, mixed $varValue, integer $intExpires, string $strPath = null, string $strDomain = null, boolean $blnSecure = false, boolean $blnHttpOnly = false )
$strName string The cookie name
$varValue mixed The cookie value
$intExpires integer The expiration date
$strPath string An optional path
$strDomain string An optional domain name
$blnSecure boolean If true, the secure flag will be set
$blnHttpOnly boolean If true, the http-only flag will be set

splitFriendlyName() 공개 정적인 메소드

Split a friendly-name e-address and return name and e-mail as array
사용 중단: Deprecated since Contao 4.0, to be removed in Contao 5.0. Use StringUtil::splitFriendlyEmail() instead.
public static splitFriendlyName ( string $strEmail ) : array
$strEmail string A friendly-name e-mail address
리턴 array An array with name and e-mail address

urlEncode() 공개 정적인 메소드

Urlencode a file path preserving slashes
public static urlEncode ( string $strPath ) : string
$strPath string The file path
리턴 string The encoded file path

프로퍼티 상세

$arrCache 보호되어 있는 프로퍼티

Cache
사용 중단: Deprecated since Contao 4.0, to be removed in Contao 5.0.
protected array $arrCache
리턴 array

$arrImageSizes 보호되어 있는 정적으로 프로퍼티

Available image sizes
protected static array $arrImageSizes
리턴 array

$arrLanguageFiles 보호되어 있는 정적으로 프로퍼티

Loaded language files
protected static array $arrLanguageFiles
리턴 array

$arrLanguages 보호되어 있는 정적으로 프로퍼티

Available languages
protected static array $arrLanguages
리턴 array

$arrObjects 보호되어 있는 프로퍼티

Default libraries
protected array $arrObjects
리턴 array

$arrStaticObjects 보호되어 있는 정적으로 프로퍼티

Static objects
protected static array $arrStaticObjects
리턴 array

$objContainer 보호되어 있는 정적으로 프로퍼티

Container
protected static ContainerInterface,Symfony\Component\DependencyInjection $objContainer
리턴 Symfony\Component\DependencyInjection\ContainerInterface