[ Index ]
 

Code source de Typo3 4.1.3

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/t3lib/ -> class.t3lib_extmgm.php (sommaire)

Contains a class with Extension Management functions $Id: class.t3lib_extmgm.php 1994 2007-02-04 23:00:08Z mundaun $ Revised for TYPO3 3.6 July/2003 by Kasper Skaarhoj

Author: Kasper Skaarhoj <kasperYYYY@typo3.com>
Poids: 1180 lignes (44 kb)
Inclus ou requis:0 fois
Référencé: 0 fois
Nécessite: 0 fichiers

Définit 1 class

t3lib_extMgm:: (34 méthodes):
  isLoaded()
  extPath()
  extRelPath()
  siteRelPath()
  getCN()
  addTCAcolumns()
  addToAllTCAtypes()
  allowTableOnStandardPages()
  addModule()
  addModulePath()
  addTopApp()
  insertModuleFunction()
  addPageTSConfig()
  addUserTSConfig()
  addLLrefForTCAdescr()
  addService()
  findService()
  deactivateService()
  addPlugin()
  addPiFlexFormValue()
  addToInsertRecords()
  addPItoST43()
  addStaticFile()
  addTypoScriptSetup()
  addTypoScriptConstants()
  addTypoScript()
  typo3_loadExtensions()
  _makeIncludeHeader()
  isCacheFilesAvailable()
  isLocalconfWritable()
  cannotCacheFilesWritable()
  currentCacheFiles()
  writeCacheFiles()
  removeCacheFiles()


Classe: t3lib_extMgm  - X-Ref

Extension Management functions

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

isLoaded($key,$exitOnError=0)   X-Ref
Returns true if the extension with extension key $key is loaded.
Usage: 109

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

extPath($key,$script='')   X-Ref
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

param: string        Extension key
param: string        $script is appended to the output if set.
return: string

extRelPath($key)   X-Ref
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

param: string        Extension key
return: string

siteRelPath($key)   X-Ref
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

param: string        Extension key
return: string

getCN($key)   X-Ref
Returns the correct class name prefix for the extension key $key
Usage: 3

param: string        Extension key
return: string

addTCAcolumns($table,$columnArray,$addTofeInterface=0)   X-Ref
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

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

addToAllTCAtypes($table,$str,$specificTypesList='',$position='')   X-Ref
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

param: string        Table name
param: string        Field list to add.
param: string        List of specific types to add the field list to. (If empty, all type entries are affected)
param: 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.
return: void

allowTableOnStandardPages($table)   X-Ref
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

param: string        Table name
return: void

addModule($main,$sub='',$position='',$path='')   X-Ref
Adds a module (main or sub) to the backend interface
FOR USE IN ext_tables.php FILES
Usage: 18

param: 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.
param: string        $sub is the submodule key. If $sub is not set a blank $main module is created.
param: 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.
param: 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.
return: void

addModulePath($name,$path)   X-Ref
Adds a module path to TBE_MODULES for used with the module dispatcher, mod.php
Used only for modules that are not placed in the main/sub menu hierarchy by the traditional mechanism of addModule()
Examples for this is context menu functionality (like import/export) which runs as an independent module through mod.php
FOR USE IN ext_tables.php FILES
Example:  t3lib_extMgm::addModulePath('xMOD_tximpexp',t3lib_extMgm::extPath($_EXTKEY).'app/');

param: string        $name is the name of the module, refer to conf.php of the module.
param: string        $path is the absolute path to the module directory inside of which "index.php" and "conf.php" is found.
return: void

addTopApp($name,$path,$iconPane=FALSE,$options=array()   X-Ref
Adding an application for the top menu. These are regular modules but is required to respond with Ajax content in case of certain parameters sent to them.

param: string        $name is the name of the module, refer to conf.php of the module.
param: string        $path is the absolute path to the module directory inside of which "index.php" and "conf.php" is found.
param: boolean        If set, the application is placed in the shortcut bar below the menu bar.
param: array        Options
return: void

insertModuleFunction($modname,$className,$classPath,$title,$MM_key='function',$WS='')   X-Ref
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

param: string        Module name
param: string        Class name
param: string        Class path
param: string        Title of module
param: string        Menu array key - default is "function"
param: string        Workspace conditions. Blank means all workspaces, any other string can be a comma list of "online", "offline" and "custom"
return: void

addPageTSConfig($content)   X-Ref
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

param: string        Page TSconfig content
return: void

addUserTSConfig($content)   X-Ref
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

param: string        User TSconfig content
return: void

addLLrefForTCAdescr($tca_descr_key,$file_ref)   X-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

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

addService($extKey, $serviceType, $serviceKey, $info)   X-Ref
Adds a service to the global services array

author: René Fritz <r.fritz@colorcube.de>
param: string        Extension key
param: string        Service type, cannot be prefixed "tx_"
param: string        Service key, must be prefixed "tx_" or "user_"
param: array        Service description array
return: void

findService($serviceType, $serviceSubType='', $excludeServiceKeys=array()   X-Ref
Find the available service with highest priority

author: René Fritz <r.fritz@colorcube.de>
param: string        Service type
param: string        Service sub type
param: mixed        Service keys that should be excluded in the search for a service. Array or comma list.
return: mixed        Service info array if a service was found, FLASE otherwise

deactivateService($serviceType, $serviceKey)   X-Ref
Deactivate a service

author: René Fritz <r.fritz@colorcube.de>
param: string        Service type
param: string        Service key
return: void

addPlugin($itemArray,$type='list_type')   X-Ref
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

param: array        Item Array
param: string        Type (eg. "list_type") - basically a field from "tt_content" table
return: void

addPiFlexFormValue($piKeyToMatch,$value)   X-Ref
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

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

addToInsertRecords($table,$content_table='tt_content',$content_field='records')   X-Ref
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

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

addPItoST43($key,$classFile='',$prefix='',$type='list_type',$cached=0)   X-Ref
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

param: string        $key is the extension key
param: 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.
param: string        $prefix is used as a - yes, suffix - of the class name (fx. "_pi1")
param: string        $type, see description above
param: boolean        If $cached is set as USER content object (cObject) is created - otherwise a USER_INT object is created.
return: void

addStaticFile($extKey,$path,$title)   X-Ref
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

param: string        $extKey is of course the extension key
param: 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/
param: string        $title is the title in the selector box.
return: void

addTypoScriptSetup($content)   X-Ref
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

param: string        TypoScript Setup string
return: void

addTypoScriptConstants($content)   X-Ref
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

param: string        TypoScript Constants string
return: void

addTypoScript($key,$type,$content,$afterStaticUid=0)   X-Ref
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

param: string        $key is the extension key (informative only).
param: string        $type is either "setup", "constants" or "editorcfg" and obviously determines which kind of TypoScript code we are adding.
param: string        $content is the TS content, prefixed with a [GLOBAL] line and a comment-header.
param: 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.
return: void

typo3_loadExtensions()   X-Ref
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

return: array        Extension Array

_makeIncludeHeader($key,$file)   X-Ref
Returns the section headers for the compiled cache-files.

param: string        $key is the extension key
param: string        $file is the filename (only informative for comment)
return: string

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

param: string        Prefix of the cache file to check
return: boolean

isLocalconfWritable()   X-Ref
Returns true if the "localconf.php" file in "typo3conf/" is writable
Usage: 1

return: boolean

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

param: string        Prefix of the cache file to check
return: string

currentCacheFiles()   X-Ref
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

return: array

writeCacheFiles($extensions,$cacheFilePrefix)   X-Ref
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

param: array        Extension information array
param: string        Prefix for the cache files
return: array

removeCacheFiles()   X-Ref
Unlink (delete) cache files

return: integer        Number of deleted files.



Généré le : Sun Nov 25 17:13:16 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics