class.t3lib_extmgm.php

Extension Management functions

This class is never instantiated, rather the methods inside is called as functions like
t3lib_extMgm::isLoaded('my_extension');

 

Files: 1
Total filesizes: 41 Kbytes
Functions and classes: 33

class.t3lib_extmgm.php

Extension Management functions

This class is never instantiated, rather the methods inside is called as functions like
t3lib_extMgm::isLoaded('my_extension');

class t3lib_extMgm

@package: TYPO3

@subpackage: t3lib

PATHS and other evaluation

function isLoaded($key,$exitOnError=0)

function extPath($key,$script='')

function extRelPath($key)

function siteRelPath($key)

function getCN($key)

Adding BACKEND features
(related to core features)

function addTCAcolumns($table,$columnArray,$addTofeInterface=0)

function addToAllTCAtypes($table,$str,$specificTypesList='',$position='')

function allowTableOnStandardPages($table)

function addModule($main,$sub='',$position='',$path='')

function insertModuleFunction($modname,$className,$classPath,$title,$MM_key='function',$WS='')

function addPageTSConfig($content)

function addUserTSConfig($content)

function addLLrefForTCAdescr($tca_descr_key,$file_ref)

Adding SERVICES features

function addService($extKey, $serviceType, $serviceKey, $info)

function findService($serviceType, $serviceSubType='', $excludeServiceKeys=array())

function deactivateService($serviceType, $serviceKey)

Adding FRONTEND features
(related specifically to "cms" extension)

function addPlugin($itemArray,$type='list_type')

function addPiFlexFormValue($piKeyToMatch,$value)

function addToInsertRecords($table,$content_table='tt_content',$content_field='records')

function addPItoST43($key,$classFile='',$prefix='',$type='list_type',$cached=0)

function addStaticFile($extKey,$path,$title)

function addTypoScriptSetup($content)

function addTypoScriptConstants($content)

function addTypoScript($key,$type,$content,$afterStaticUid=0)

INTERNAL EXTENSION MANAGEMENT:

function typo3_loadExtensions()

function _makeIncludeHeader($key,$file)

function isCacheFilesAvailable($cacheFilePrefix)

function isLocalconfWritable()

function cannotCacheFilesWritable($cacheFilePrefix)

function currentCacheFiles()

function writeCacheFiles($extensions,$cacheFilePrefix)

function removeCacheFiles()

Detailed descriptions:

class.t3lib_extmgm.php

Extension Management functions

This class is never instantiated, rather the methods inside is called as functions like
t3lib_extMgm::isLoaded('my_extension');

Filesize: 41 K
Func/Classes: 33
Tags: @author Kasper Skaarhoj <kasperYYYY@typo3.com>
@package TYPO3
@subpackage t3lib

class t3lib_extMgm

Extension Management functions

This class is never instantiated, rather the methods inside is called as functions like
t3lib_extMgm::isLoaded('my_extension');

Returns: [type] ...
  @author Kasper Skaarhoj <kasperYYYY@typo3.com>
  @package TYPO3
  @subpackage t3lib

function isLoaded($key,$exitOnError=0)

Returns true if the extension with extension key $key is loaded.
Usage: 109

$key string Extension key to test
$exitOnError=0 boolean If $exitOnError is true and the extension is not loaded the function will die with an error message
Returns: boolean

function extPath($key,$script='')

Returns the absolute path to the extension with extension key $key
If the extension is not loaded the function will die with an error message
Useful for internal fileoperations
Usage: 136

$key string Extension key
$script='' string $script is appended to the output if set.
Returns: string

function extRelPath($key)

Returns the relative path to the extension as measured from from the TYPO3_mainDir
If the extension is not loaded the function will die with an error message
Useful for images and links from backend
Usage: 54

$key string Extension key
Returns: string

function siteRelPath($key)

Returns the relative path to the extension as measured from the PATH_site (frontend)
If the extension is not loaded the function will die with an error message
Useful for images and links from the frontend
Usage: 6

$key string Extension key
Returns: string

function getCN($key)

Returns the correct class name prefix for the extension key $key
Usage: 3

$key string Extension key
Returns: string
  @internal

function addTCAcolumns($table,$columnArray,$addTofeInterface=0)

Adding fields to an existing table definition in $TCA
Adds an array with $TCA column-configuration to the $TCA-entry for that table.
This function adds the configuration needed for rendering of the field in TCEFORMS - but it does NOT add the field names to the types lists!
So to have the fields displayed you must also call fx. addToAllTCAtypes or manually add the fields to the types list.
FOR USE IN ext_tables.php FILES
Usage: 4

$table string $table is the table name of a table already present in $TCA with a columns section
$columnArray array $columnArray is the array with the additional columns (typical some fields an extension wants to add)
$addTofeInterface=0 boolean If $addTofeInterface is true the list of fields are also added to the fe_admin_fieldList.
Returns: void

function addToAllTCAtypes($table,$str,$specificTypesList='',$position='')

Makes fields visible in the TCEforms, adding them to the end of (all) "types"-configurations

Adds a string $str (comma list of field names) to all ["types"][xxx]["showitem"] entries for table $table (unless limited by $specificTypesList)
This is needed to have new fields shown automatically in the TCEFORMS of a record from $table.
Typically this function is called after having added new columns (database fields) with the addTCAcolumns function
FOR USE IN ext_tables.php FILES
Usage: 1

$table string Table name
$str string Field list to add.
$specificTypesList='' string List of specific types to add the field list to. (If empty, all type entries are affected)
$position='' string Insert fields before (default) or after one of this fields (commalist with "before:" or "after:" commands). Example: "before:keywords,--palette--;;4,after:description". Palettes must be passed like in the example no matter how the palette definition looks like in TCA.
Returns: void

function allowTableOnStandardPages($table)

Add tablename to default list of allowed tables on pages (in $PAGES_TYPES)
Will add the $table to the list of tables allowed by default on pages as setup by $PAGES_TYPES['default']['allowedTables']
FOR USE IN ext_tables.php FILES
Usage: 11

$table string Table name
Returns: void

function addModule($main,$sub='',$position='',$path='')

Adds a module (main or sub) to the backend interface
FOR USE IN ext_tables.php FILES
Usage: 18

$main string $main is the main module key, $sub is the submodule key. So $main would be an index in the $TBE_MODULES array and $sub could be an element in the lists there.
$sub='' string $sub is the submodule key. If $sub is not set a blank $main module is created.
$position='' string $position can be used to set the position of the $sub module within the list of existing submodules for the main module. $position has this syntax: [cmd]:[submodule-key]. cmd can be "after", "before" or "top" (or blank which is default). If "after"/"before" then submodule will be inserted after/before the existing submodule with [submodule-key] if found. If not found, the bottom of list. If "top" the module is inserted in the top of the submodule list.
$path='' string $path is the absolute path to the module. If this value is defined the path is added as an entry in $TBE_MODULES['_PATHS'][ main_sub ]=$path; and thereby tells the backend where the newly added modules is found in the system.
Returns: void

function insertModuleFunction($modname,$className,$classPath,$title,$MM_key='function',$WS='')

Adds a "Function menu module" ('third level module') to an existing function menu for some other backend module
The arguments values are generally determined by which function menu this is supposed to interact with
See Inside TYPO3 for information on how to use this function.
FOR USE IN ext_tables.php FILES
Usage: 26

$modname string Module name
$className string Class name
$classPath string Class path
$title string Title of module
$MM_key='function' string Menu array key - default is "function"
$WS='' string Workspace conditions. Blank means all workspaces, any other string can be a comma list of "online", "offline" and "custom"
Returns: void
  @see t3lib_SCbase::mergeExternalItems()

function addPageTSConfig($content)

Adds $content to the default Page TSconfig as set in $TYPO3_CONF_VARS[BE]['defaultPageTSconfig']
Prefixed with a [GLOBAL] line
FOR USE IN ext_tables.php/ext_locallang.php FILES
Usage: 5

$content string Page TSconfig content
Returns: void

function addUserTSConfig($content)

Adds $content to the default User TSconfig as set in $TYPO3_CONF_VARS[BE]['defaultUserTSconfig']
Prefixed with a [GLOBAL] line
FOR USE IN ext_tables.php/ext_locallang.php FILES
Usage: 3

$content string User TSconfig content
Returns: void

function addLLrefForTCAdescr($tca_descr_key,$file_ref)

Adds a reference to a locallang file with TCA_DESCR labels
FOR USE IN ext_tables.php FILES
eg. t3lib_extMgm::addLLrefForTCAdescr('pages','EXT:lang/locallang_csh_pages.xml'); for the pages table or t3lib_extMgm::addLLrefForTCAdescr('_MOD_web_layout','EXT:cms/locallang_csh_weblayout.php'); for the Web > Page module.
Usage: 31

$tca_descr_key string Description key. Typically a database table (like "pages") but for applications can be other strings, but prefixed with "_MOD_")
$file_ref string File reference to locallang file, eg. "EXT:lang/locallang_csh_pages.php" (or ".xml")
Returns: void

function addService($extKey, $serviceType, $serviceKey, $info)

Adds a service to the global services array

$extKey string Extension key
$serviceType string Service type, cannot be prefixed "tx_"
$serviceKey string Service key, must be prefixed "tx_" or "user_"
$info array Service description array
Returns: void
  @author René Fritz <r.fritz@colorcube.de>

function findService($serviceType, $serviceSubType='', $excludeServiceKeys=array())

Find the available service with highest priority

$serviceType string Service type
$serviceSubType='' string Service sub type
$excludeServiceKeys=array() mixed Service keys that should be excluded in the search for a service. Array or comma list.
Returns: mixed Service info array if a service was found, FLASE otherwise
  @author René Fritz <r.fritz@colorcube.de>

function deactivateService($serviceType, $serviceKey)

Deactivate a service

$serviceType string Service type
$serviceKey string Service key
Returns: void
  @author René Fritz <r.fritz@colorcube.de>

function addPlugin($itemArray,$type='list_type')

Adds an entry to the list of plugins in content elements of type "Insert plugin"
Takes the $itemArray (label,value[,icon]) and adds to the items-array of $TCA[tt_content] elements with CType "listtype" (or another field if $type points to another fieldname)
If the value (array pos. 1) is already found in that items-array, the entry is substituted, otherwise the input array is added to the bottom.
Use this function to add a frontend plugin to this list of plugin-types - or more generally use this function to add an entry to any selectorbox/radio-button set in the TCEFORMS
FOR USE IN ext_tables.php FILES
Usage: 13

$itemArray array Item Array
$type='list_type' string Type (eg. "list_type") - basically a field from "tt_content" table
Returns: void

function addPiFlexFormValue($piKeyToMatch,$value)

Adds an entry to the "ds" array of the tt_content field "pi_flexform".
This is used by plugins to add a flexform XML reference / content for use when they are selected as plugin.
Usage: 0

$piKeyToMatch string The same value as the key for the plugin
$value string Either a reference to a flex-form XML file (eg. "FILE:EXT:newloginbox/flexform_ds.xml") or the XML directly.
Returns: void
  @see addPlugin()

function addToInsertRecords($table,$content_table='tt_content',$content_field='records')

Adds the $table tablename to the list of tables allowed to be includes by content element type "Insert records"
By using $content_table and $content_field you can also use the function for other tables.
FOR USE IN ext_tables.php FILES
Usage: 9

$table string Table name to allow for "insert record"
$content_table='tt_content' string Table name TO WHICH the $table name is applied. See $content_field as well.
$content_field='records' string Field name in the database $content_table in which $table is allowed to be added as a reference ("Insert Record")
Returns: void

function addPItoST43($key,$classFile='',$prefix='',$type='list_type',$cached=0)

Add PlugIn to Static Template #43

When adding a frontend plugin you will have to add both an entry to the TCA definition of tt_content table AND to the TypoScript template which must initiate the rendering.
Since the static template with uid 43 is the "content.default" and practically always used for rendering the content elements it's very useful to have this function automatically adding the necessary TypoScript for calling your plugin. It will also work for the extension "css_styled_content"
$type determines the type of frontend plugin:
"list_type" (default) - the good old "Insert plugin" entry
"menu_type" - a "Menu/Sitemap" entry
"splash_layout" - a "Textbox" entry
"CType" - a new content element type
"header_layout" - an additional header type (added to the selection of layout1-5)
"includeLib" - just includes the library for manual use somewhere in TypoScript.
(Remember that your $type definition should correspond to the column/items array in $TCA[tt_content] where you added the selector item for the element! See addPlugin() function)
FOR USE IN ext_locallang.php FILES
Usage: 2

$key string $key is the extension key
$classFile='' string $classFile is the PHP-class filename relative to the extension root directory. If set to blank a default value is chosen according to convensions.
$prefix='' string $prefix is used as a - yes, suffix - of the class name (fx. "_pi1")
$type='list_type' string $type, see description above
$cached=0 boolean If $cached is set as USER content object (cObject) is created - otherwise a USER_INT object is created.
Returns: void

function addStaticFile($extKey,$path,$title)

Call this method to add an entry in the static template list found in sys_templates
"static template files" are the modern equalent (provided from extensions) to the traditional records in "static_templates"
FOR USE IN ext_locallang.php FILES
Usage: 3

$extKey string $extKey is of course the extension key
$path string $path is the path where the template files (fixed names) include_static.txt (integer list of uids from the table "static_templates"), constants.txt, setup.txt, editorcfg.txt, and include_static_file.txt is found (relative to extPath, eg. 'static/'). The file include_static_file.txt, allows you to include other static templates defined in files, from your static template, and thus corresponds to the field 'include_static_file' in the sys_template table. The syntax for this is a commaseperated list of static templates to include, like: EXT:css_styled_content/static/,EXT:da_newsletter_subscription/static/,EXT:cc_random_image/pi2/static/
$title string $title is the title in the selector box.
Returns: void
  @see addTypoScript()

function addTypoScriptSetup($content)

Adds $content to the default TypoScript setup code as set in $TYPO3_CONF_VARS[FE]['defaultTypoScript_setup']
Prefixed with a [GLOBAL] line
FOR USE IN ext_locallang.php FILES
Usage: 6

$content string TypoScript Setup string
Returns: void

function addTypoScriptConstants($content)

Adds $content to the default TypoScript constants code as set in $TYPO3_CONF_VARS[FE]['defaultTypoScript_constants']
Prefixed with a [GLOBAL] line
FOR USE IN ext_locallang.php FILES
Usage: 0

$content string TypoScript Constants string
Returns: void

function addTypoScript($key,$type,$content,$afterStaticUid=0)

Adds $content to the default TypoScript code for either setup, constants or editorcfg as set in $TYPO3_CONF_VARS[FE]['defaultTypoScript_*']
(Basically this function can do the same as addTypoScriptSetup and addTypoScriptConstants - just with a little more hazzle, but also with some more options!)
FOR USE IN ext_locallang.php FILES
Usage: 7

$key string $key is the extension key (informative only).
$type string $type is either "setup", "constants" or "editorcfg" and obviously determines which kind of TypoScript code we are adding.
$content string $content is the TS content, prefixed with a [GLOBAL] line and a comment-header.
$afterStaticUid=0 string $afterStaticUid is either an integer pointing to a uid of a static_template or a string pointing to the "key" of a static_file template ([reduced extension_key]/[local path]). The points is that the TypoScript you add is included only IF that static template is included (and in that case, right after). So effectively the TypoScript you set can specifically overrule settings from those static templates.
Returns: void

function typo3_loadExtensions()

Loading extensions configured in $TYPO3_CONF_VARS['EXT']['extList']

CACHING ON: ($TYPO3_CONF_VARS['EXT']['extCache'] = 1 or 2)
If caching is enabled (and possible), the output will be $extensions['_CACHEFILE'] set to the cacheFilePrefix. Subsequently the cache files must be included then since those will eventually set up the extensions.
If cachefiles are not found they will be generated
CACHING OFF: ($TYPO3_CONF_VARS['EXT']['extCache'] = 0)
The returned value will be an array where each key is an extension key and the value is an array with filepaths for the extension.
This array will later be set in the global var $TYPO3_LOADED_EXT

Usages of this function can be seen in config_default.php
Extensions are always detected in the order local - global - system.
Usage: 1

Returns: array Extension Array
  @internal

function _makeIncludeHeader($key,$file)

Returns the section headers for the compiled cache-files.

$key string $key is the extension key
$file string $file is the filename (only informative for comment)
Returns: string
  @internal

function isCacheFilesAvailable($cacheFilePrefix)

Returns true if both the localconf and tables cache file exists (with $cacheFilePrefix)
Usage: 2

$cacheFilePrefix string Prefix of the cache file to check
Returns: boolean
  @internal

function isLocalconfWritable()

Returns true if the "localconf.php" file in "typo3conf/" is writable
Usage: 1

Returns: boolean
  @internal

function cannotCacheFilesWritable($cacheFilePrefix)

Returns an error string if typo3conf/ or cache-files with $cacheFilePrefix are NOT writable
Returns false if no problem.
Usage: 1

$cacheFilePrefix string Prefix of the cache file to check
Returns: string
  @internal

function currentCacheFiles()

Returns an array with the two cache-files (0=>localconf, 1=>tables) from typo3conf/ if they (both) exist. Otherwise false.
Evaluation relies on $TYPO3_LOADED_EXT['_CACHEFILE']
Usage: 2

Returns: array
  @internal

function writeCacheFiles($extensions,$cacheFilePrefix)

Compiles/Creates the two cache-files in typo3conf/ based on $cacheFilePrefix
Returns a array with the key "_CACHEFILE" set to the $cacheFilePrefix value
Usage: 1

$extensions array Extension information array
$cacheFilePrefix string Prefix for the cache files
Returns: array
  @internal

function removeCacheFiles()

Unlink (delete) cache files

Returns: integer Number of deleted files.