[BUGFIX] Autoloader Cache is not updated
[Packages/TYPO3.CMS.git] / t3lib / class.t3lib_scbase.php
index d16f83e..5b5cc28 100644 (file)
@@ -1,72 +1,38 @@
 <?php
 /***************************************************************
-*  Copyright notice
-*
-*  (c) 1999-2005 Kasper Skaarhoj (kasperYYYY@typo3.com)
-*  All rights reserved
-*
-*  This script is part of the TYPO3 project. The TYPO3 project is
-*  free software; you can redistribute it and/or modify
-*  it under the terms of the GNU General Public License as published by
-*  the Free Software Foundation; either version 2 of the License, or
-*  (at your option) any later version.
-*
-*  The GNU General Public License can be found at
-*  http://www.gnu.org/copyleft/gpl.html.
-*  A copy is found in the textfile GPL.txt and important notices to the license
-*  from the author is found in LICENSE.txt distributed with these scripts.
-*
-*
-*  This script is distributed in the hope that it will be useful,
-*  but WITHOUT ANY WARRANTY; without even the implied warranty of
-*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*  GNU General Public License for more details.
-*
-*  This copyright notice MUST APPEAR in all copies of the script!
-***************************************************************/
-/**
- * Contains the parent class for 'ScriptClasses' in backend modules.
+ *  Copyright notice
  *
- * $Id$
- * Revised for TYPO3 3.6 July/2003 by Kasper Skaarhoj
+ *  (c) 1999-2011 Kasper Skårhøj (kasperYYYY@typo3.com)
+ *  All rights reserved
  *
- * @author     Kasper Skaarhoj <kasperYYYY@typo3.com>
- */
-/**
- * [CLASS/FUNCTION INDEX of SCRIPT]
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
  *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *  A copy is found in the textfile GPL.txt and important notices to the license
+ *  from the author is found in LICENSE.txt distributed with these scripts.
  *
  *
- *  133: class t3lib_SCbase
- *  249:     function init()
- *  269:     function menuConfig()
- *  292:     function mergeExternalItems($modName,$menuKey,$menuArr)
- *  312:     function handleExternalFunctionValue($MM_key='function', $MS_value=NULL)
- *  330:     function getExternalItemConfig($modName,$menuKey,$value='')
- *  344:     function checkExtObj()
- *  358:     function checkSubExtObj()
- *  370:     function extObjHeader()
- *  379:     function extObjContent()
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
  *
- * TOTAL FUNCTIONS: 9
- * (This index is automatically created/updated by the extension "extdeveval")
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+/**
+ * Contains the parent class for 'ScriptClasses' in backend modules.
+ *
+ * Revised for TYPO3 3.6 July/2003 by Kasper Skårhøj
  *
+ * @author     Kasper Skårhøj <kasperYYYY@typo3.com>
  */
 
 
-
-
-
-
-
-
-
-
-
-
-
-
-
 /**
  * EXAMPLE PROTOTYPE
  *
  * However you can see a prototype example of how a module might use this class in an index.php file typically hosting a backend module.
  * NOTICE: This example only outlines the basic structure of how this class is used. You should consult the documentation and other real-world examples for some actual things to do when building modules.
  *
- *               // TYPICAL 'HEADER' OF A BACKEND MODULE:
- *             unset($MCONF);
- *             require ('conf.php');
- *             require ($BACK_PATH.'init.php');
- *             require ($BACK_PATH.'template.php');
- *             $LANG->includeLLFile('EXT:prototype/locallang.php');
- *             require_once(PATH_t3lib.'class.t3lib_scbase.php');              // NOTICE THE INCLUSION OF t3lib_SCbase
- *             $BE_USER->modAccess($MCONF,1);
+ *                // TYPICAL 'HEADER' OF A BACKEND MODULE:
+ *              unset($MCONF);
+ *              require ('conf.php');
+ *              require ($BACK_PATH.'init.php');
+ *              require ($BACK_PATH.'template.php');
+ *              $GLOBALS['LANG']->includeLLFile('EXT:prototype/locallang.php');
+ *              $GLOBALS['BE_USER']->modAccess($MCONF,1);
  *
- *                     // SC_mod_prototype EXTENDS THE CLASS t3lib_SCbase with a main() and printContent() function:
- *             class SC_mod_prototype extends t3lib_SCbase {
- *                             // MAIN FUNCTION - HERE YOU CREATE THE MODULE CONTENT IN $this->content
- *                     function main() {
- *                                     // TYPICALLY THE INTERNAL VAR, $this->doc is instantiated like this:
- *                             $this->doc = t3lib_div::makeInstance('mediumDoc');
- *                                     // TYPICALLY THE INTERNAL VAR, $this->backPath is set like this:
- *                             $this->backPath = $this->doc->backPath = $GLOBALS['BACK_PATH'];
- *                                     // ... AND OF COURSE A LOT OF OTHER THINGS GOES ON - LIKE PUTTING CONTENT INTO $this->content
- *                             $this->content='';
- *                     }
- *                             // PRINT CONTENT - DONE AS THE LAST THING
- *                     function printContent() {
- *                             echo $this->content;
- *                     }
- *             }
+ *                      // SC_mod_prototype EXTENDS THE CLASS t3lib_SCbase with a main() and printContent() function:
+ *              class SC_mod_prototype extends t3lib_SCbase {
+ *                              // MAIN FUNCTION - HERE YOU CREATE THE MODULE CONTENT IN $this->content
+ *                      function main()        {
+ *                                      // TYPICALLY THE INTERNAL VAR, $this->doc is instantiated like this:
+ *                              $this->doc = t3lib_div::makeInstance('mediumDoc');
+ *                                      // TYPICALLY THE INTERNAL VAR, $this->backPath is set like this:
+ *                              $this->backPath = $this->doc->backPath = $GLOBALS['BACK_PATH'];
+ *                                      // ... AND OF COURSE A LOT OF OTHER THINGS GOES ON - LIKE PUTTING CONTENT INTO $this->content
+ *                              $this->content='';
+ *                      }
+ *                              // PRINT CONTENT - DONE AS THE LAST THING
+ *                      function printContent()        {
+ *                              echo $this->content;
+ *                      }
+ *              }
  *
- *                     // CHECKING IF THERE ARE AN EXTENSION CLASS CONFIGURED FOR THIS CLASS:
- *             if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/prototype/index.php']) {
- *                     include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/prototype/index.php']);
- *             }
+ *                      // CHECKING IF THERE ARE AN EXTENSION CLASS CONFIGURED FOR THIS CLASS:
+ *              if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/prototype/index.php'])) {
+ *                      include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/prototype/index.php']);
+ *              }
  *
- *               // MAKE INSTANCE OF THE SCRIPT CLASS AND CALL init()
- *             $SOBE = t3lib_div::makeInstance('SC_mod_prototype');
- *             $SOBE->init();
+ *                // MAKE INSTANCE OF THE SCRIPT CLASS AND CALL init()
+ *              $SOBE = t3lib_div::makeInstance('SC_mod_prototype');
+ *              $SOBE->init();
  *
- *               // AFTER INIT THE INTERNAL ARRAY ->include_once MAY HOLD FILENAMES TO INCLUDE
- *             foreach($SOBE->include_once as $INC_FILE)       include_once($INC_FILE);
+ *                // AFTER INIT THE INTERNAL ARRAY ->include_once MAY HOLD FILENAMES TO INCLUDE
+ *              foreach($SOBE->include_once as $INC_FILE)      include_once($INC_FILE);
  *
- *               // THEN WE WILL CHECK IF THERE IS A 'SUBMODULE' REGISTERED TO BE INITIALIZED AS WELL:
- *             $SOBE->checkExtObj();
+ *                // THEN WE WILL CHECK IF THERE IS A 'SUBMODULE' REGISTERED TO BE INITIALIZED AS WELL:
+ *              $SOBE->checkExtObj();
  *
- *               // THEN WE CALL THE main() METHOD AND THIS SHOULD SPARK THE CREATION OF THE MODULE OUTPUT.
- *             $SOBE->main();
- *               // FINALLY THE printContent() FUNCTION WILL OUTPUT THE ACCUMULATED CONTENT
- *             $SOBE->printContent();
+ *                // THEN WE CALL THE main() METHOD AND THIS SHOULD SPARK THE CREATION OF THE MODULE OUTPUT.
+ *              $SOBE->main();
+ *                // FINALLY THE printContent() FUNCTION WILL OUTPUT THE ACCUMULATED CONTENT
+ *              $SOBE->printContent();
  */
 
 /**
  * Parent class for 'ScriptClasses' in backend modules.
  * See example comment above.
  *
- * @author     Kasper Skaarhoj <kasperYYYY@typo3.com>
+ * @author     Kasper Skårhøj <kasperYYYY@typo3.com>
  * @package TYPO3
  * @subpackage t3lib
  * @see t3lib_extobjbase
@@ -157,14 +122,13 @@ class t3lib_SCbase {
        var $perms_clause;
 
 
-
        /**
         * The module menu items array. Each key represents a key for which values can range between the items in the array of that key.
         * @see init()
         */
-       var $MOD_MENU = Array (
-                       'function' => array()
-               );
+       var $MOD_MENU = array(
+               'function' => array()
+       );
 
        /**
         * Current settings for the keys of the MOD_MENU array
@@ -223,6 +187,8 @@ class t3lib_SCbase {
 
        /**
         * Generally used to hold an instance of the 'template' class from typo3/template.php
+        *
+        * @var template
         */
        var $doc;
 
@@ -234,19 +200,13 @@ class t3lib_SCbase {
        var $extObj;
 
 
-
-
-
-
-
-
        /**
         * Initializes the backend module by setting internal variables, initializing the menu.
         *
         * @return      void
         * @see menuConfig()
         */
-       function init() {
+       function init() {
                        // name might be set from outside
                if (!$this->MCONF['name']) {
                        $this->MCONF = $GLOBALS['MCONF'];
@@ -266,17 +226,23 @@ class t3lib_SCbase {
         * @return      void
         * @see init(), $MOD_MENU, $MOD_SETTINGS, t3lib_BEfunc::getModuleData(), mergeExternalItems()
         */
-       function menuConfig()   {
+       function menuConfig() {
                        // page/be_user TSconfig settings and blinding of menu-items
-               $this->modTSconfig = t3lib_BEfunc::getModTSconfig($this->id,'mod.'.$this->MCONF['name']);
-               $this->MOD_MENU['function'] = $this->mergeExternalItems($this->MCONF['name'],'function',$this->MOD_MENU['function']);
-               $this->MOD_MENU['function'] = t3lib_BEfunc::unsetMenuItems($this->modTSconfig['properties'],$this->MOD_MENU['function'],'menu.function');
+               $this->modTSconfig = t3lib_BEfunc::getModTSconfig($this->id, 'mod.' . $this->MCONF['name']);
+               $this->MOD_MENU['function'] = $this->mergeExternalItems($this->MCONF['name'], 'function', $this->MOD_MENU['function']);
+               $this->MOD_MENU['function'] = t3lib_BEfunc::unsetMenuItems($this->modTSconfig['properties'], $this->MOD_MENU['function'], 'menu.function');
 
                #debug($this->MOD_MENU['function'],$this->MCONF['name']);
                #debug($this->modTSconfig['properties']);
 
-                       // CLEANSE 'function' SETTINGS
-               $this->MOD_SETTINGS = t3lib_BEfunc::getModuleData($this->MOD_MENU, t3lib_div::_GP('SET'), $this->MCONF['name'], $this->modMenu_type, $this->modMenu_dontValidateList, $this->modMenu_setDefaultList);
+               $this->MOD_SETTINGS = t3lib_BEfunc::getModuleData(
+                       $this->MOD_MENU,
+                       t3lib_div::_GP('SET'),
+                       $this->MCONF['name'],
+                       $this->modMenu_type,
+                       $this->modMenu_dontValidateList,
+                       $this->modMenu_setDefaultList
+               );
        }
 
        /**
@@ -289,16 +255,15 @@ class t3lib_SCbase {
         * @access private
         * @see t3lib_extMgm::insertModuleFunction(), menuConfig()
         */
-       function mergeExternalItems($modName,$menuKey,$menuArr) {
+       function mergeExternalItems($modName, $menuKey, $menuArr) {
                $mergeArray = $GLOBALS['TBE_MODULES_EXT'][$modName]['MOD_MENU'][$menuKey];
-               if (is_array($mergeArray))      {
-                       reset($mergeArray);
-                       while(list($k,$v)=each($mergeArray))    {
-                               if ((string)$v['ws']==='' ||
-                                       ($GLOBALS['BE_USER']->workspace===0 && t3lib_div::inList($v['ws'],'online')) ||
-                                       ($GLOBALS['BE_USER']->workspace===-1 && t3lib_div::inList($v['ws'],'offline')) ||
-                                       ($GLOBALS['BE_USER']->workspace>0 && t3lib_div::inList($v['ws'],'custom')))     {
-                                               $menuArr[$k]=$GLOBALS['LANG']->sL($v['title']);
+               if (is_array($mergeArray)) {
+                       foreach ($mergeArray as $k => $v) {
+                               if ((string) $v['ws'] === '' ||
+                                       ($GLOBALS['BE_USER']->workspace === 0 && t3lib_div::inList($v['ws'], 'online')) ||
+                                       ($GLOBALS['BE_USER']->workspace === -1 && t3lib_div::inList($v['ws'], 'offline')) ||
+                                       ($GLOBALS['BE_USER']->workspace > 0 && t3lib_div::inList($v['ws'], 'custom'))) {
+                                       $menuArr[$k] = $GLOBALS['LANG']->sL($v['title']);
                                }
                        }
                }
@@ -314,11 +279,11 @@ class t3lib_SCbase {
         * @return      void
         * @see getExternalItemConfig(), $include_once, init()
         */
-       function handleExternalFunctionValue($MM_key='function', $MS_value=NULL)        {
+       function handleExternalFunctionValue($MM_key = 'function', $MS_value = NULL) {
                $MS_value = is_null($MS_value) ? $this->MOD_SETTINGS[$MM_key] : $MS_value;
-               $this->extClassConf = $this->getExternalItemConfig($this->MCONF['name'],$MM_key,$MS_value);
-               if (is_array($this->extClassConf) && $this->extClassConf['path'])       {
-                       $this->include_once[]=$this->extClassConf['path'];
+               $this->extClassConf = $this->getExternalItemConfig($this->MCONF['name'], $MM_key, $MS_value);
+               if (is_array($this->extClassConf) && $this->extClassConf['path']) {
+                       $this->include_once[] = $this->extClassConf['path'];
                }
        }
 
@@ -332,8 +297,8 @@ class t3lib_SCbase {
         * @return      mixed           The value from the TBE_MODULES_EXT array.
         * @see handleExternalFunctionValue()
         */
-       function getExternalItemConfig($modName,$menuKey,$value='')     {
-               return strcmp($value,'')?$GLOBALS['TBE_MODULES_EXT'][$modName]['MOD_MENU'][$menuKey][$value]:$GLOBALS['TBE_MODULES_EXT'][$modName]['MOD_MENU'][$menuKey];
+       function getExternalItemConfig($modName, $menuKey, $value = '') {
+               return strcmp($value, '') ? $GLOBALS['TBE_MODULES_EXT'][$modName]['MOD_MENU'][$menuKey][$value] : $GLOBALS['TBE_MODULES_EXT'][$modName]['MOD_MENU'][$menuKey];
        }
 
        /**
@@ -346,12 +311,19 @@ class t3lib_SCbase {
         * @return      void
         * @see handleExternalFunctionValue(), t3lib_extMgm::insertModuleFunction(), $extObj
         */
-       function checkExtObj()  {
-               if (is_array($this->extClassConf) && $this->extClassConf['name'])       {
+       function checkExtObj() {
+               if (is_array($this->extClassConf) && $this->extClassConf['name']) {
                        $this->extObj = t3lib_div::makeInstance($this->extClassConf['name']);
-                       $this->extObj->init($this,$this->extClassConf);
+                       $this->extObj->init($this, $this->extClassConf);
                                // Re-write:
-                       $this->MOD_SETTINGS = t3lib_BEfunc::getModuleData($this->MOD_MENU, t3lib_div::_GP('SET'), $this->MCONF['name']);
+                       $this->MOD_SETTINGS = t3lib_BEfunc::getModuleData(
+                               $this->MOD_MENU,
+                               t3lib_div::_GP('SET'),
+                               $this->MCONF['name'],
+                               $this->modMenu_type,
+                               $this->modMenu_dontValidateList,
+                               $this->modMenu_setDefaultList
+                       );
                }
        }
 
@@ -360,8 +332,10 @@ class t3lib_SCbase {
         *
         * @return      void
         */
-       function checkSubExtObj()       {
-               if (is_object($this->extObj))   $this->extObj->checkExtObj();
+       function checkSubExtObj() {
+               if (is_object($this->extObj)) {
+                       $this->extObj->checkExtObj();
+               }
        }
 
        /**
@@ -372,8 +346,10 @@ class t3lib_SCbase {
         *
         * @return      void
         */
-       function extObjHeader() {
-               if (is_callable(array($this->extObj,'head')))   $this->extObj->head();
+       function extObjHeader() {
+               if (is_callable(array($this->extObj, 'head'))) {
+                       $this->extObj->head();
+               }
        }
 
        /**
@@ -381,9 +357,13 @@ class t3lib_SCbase {
         *
         * @return      void
         */
-       function extObjContent()        {
-               $this->extObj->pObj = &$this;
-               if (is_callable(array($this->extObj, 'main')))  $this->content.=$this->extObj->main();
+       function extObjContent() {
+               $this->extObj->pObj = $this;
+
+               if (is_callable(array($this->extObj, 'main'))) {
+                       $this->content .= $this->extObj->main();
+               }
        }
 }
-?>
+
+?>
\ No newline at end of file