TYPO3 CMS  TYPO3_6-2
AbstractFunctionModule.php
Go to the documentation of this file.
1 <?php
3 
19 
128 abstract class AbstractFunctionModule {
129 
138  public $pObj;
139 
146  public $thisPath = '';
147 
154  public $localLangFile = 'locallang.php';
155 
163 
172  public $function_key = '';
173 
185  public function init(&$pObj, $conf) {
186  $this->pObj = $pObj;
187  // Path of this script:
188  $reflector = new \ReflectionObject($this);
189  $this->thisPath = dirname($reflector->getFilename());
190  if (!@is_dir($this->thisPath)) {
191  throw new \RuntimeException('TYPO3 Fatal Error: Could not find path for class ' . get_class($this), 1381164687);
192  }
193  // Local lang:
194  $this->incLocalLang();
195  // Setting MOD_MENU items as we need them for logging:
196  $this->pObj->MOD_MENU = array_merge($this->pObj->MOD_MENU, $this->modMenu());
197  }
198 
207  public function handleExternalFunctionValue() {
208  // Must clean first to make sure the correct key is set...
209  $this->pObj->MOD_SETTINGS = BackendUtility::getModuleData($this->pObj->MOD_MENU, GeneralUtility::_GP('SET'), $this->pObj->MCONF['name']);
210  if ($this->function_key) {
211  $this->extClassConf = $this->pObj->getExternalItemConfig($this->pObj->MCONF['name'], $this->function_key, $this->pObj->MOD_SETTINGS[$this->function_key]);
212  if (is_array($this->extClassConf) && $this->extClassConf['path']) {
213  $this->pObj->include_once[] = $this->extClassConf['path'];
214  }
215  }
216  }
217 
224  public function incLocalLang() {
225  if ($this->localLangFile && (@is_file(($this->thisPath . '/' . $this->localLangFile)) || @is_file(($this->thisPath . '/' . substr($this->localLangFile, 0, -4) . '.xml')) || @is_file(($this->thisPath . '/' . substr($this->localLangFile, 0, -4) . '.xlf')))) {
226  $LOCAL_LANG = $GLOBALS['LANG']->includeLLFile($this->thisPath . '/' . $this->localLangFile, FALSE);
227  if (is_array($LOCAL_LANG)) {
228  $GLOBALS['LOCAL_LANG'] = (array)$GLOBALS['LOCAL_LANG'];
230  }
231  }
232  }
233 
241  public function checkExtObj() {
242  if (is_array($this->extClassConf) && $this->extClassConf['name']) {
243  $this->extObj = GeneralUtility::makeInstance($this->extClassConf['name']);
244  $this->extObj->init($this->pObj, $this->extClassConf);
245  // Re-write:
246  $this->pObj->MOD_SETTINGS = BackendUtility::getModuleData($this->pObj->MOD_MENU, GeneralUtility::_GP('SET'), $this->pObj->MCONF['name']);
247  }
248  }
249 
256  public function extObjContent() {
257  if (is_object($this->extObj)) {
258  return $this->extObj->main();
259  }
260  }
261 
270  public function modMenu() {
271  return array();
272  }
273 
274 }
static mergeRecursiveWithOverrule(array &$original, array $overrule, $addKeys=TRUE, $includeEmptyValues=TRUE, $enableUnsetFeature=TRUE)
static getModuleData($MOD_MENU, $CHANGED_SETTINGS, $modName, $type='', $dontValidateList='', $setDefaultList='')
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]