[TASK][WIP] Move classes to new locations
[Packages/TYPO3.CMS.git] / typo3 / sysext / extbase / Classes / Utility / ExtensionUtility.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 2009 Jochen Rau <jochen.rau@typoplanet.de>
6 * All rights reserved
7 *
8 * This script is part of the TYPO3 project. The TYPO3 project is
9 * free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * The GNU General Public License can be found at
15 * http://www.gnu.org/copyleft/gpl.html.
16 *
17 * This script is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * This copyright notice MUST APPEAR in all copies of the script!
23 ***************************************************************/
24
25 /**
26 * Utilities to manage plugins and modules of an extension. Also useful to auto-generate the autoloader registry
27 * file ext_autoload.php.
28 *
29 * @package Extbase
30 * @subpackage Utility
31 */
32 class Tx_Extbase_Utility_Extension {
33
34 const PLUGIN_TYPE_PLUGIN = 'list_type';
35 const PLUGIN_TYPE_CONTENT_ELEMENT = 'CType';
36
37 /**
38 * @var Tx_Extbase_Service_ExtensionService
39 */
40 protected static $extensionService = NULL;
41
42 /**
43 * @return string
44 */
45 static protected function getExtensionService() {
46 if (self::$extensionService === NULL) {
47 require_once t3lib_extMgm::extPath('extbase', 'Classes/Service/ExtensionService.php');
48 $objectManager = t3lib_div::makeInstance('Tx_Extbase_Object_ObjectManager');
49 self::$extensionService = $objectManager->get('Tx_Extbase_Service_ExtensionService');
50 }
51 return self::$extensionService;
52 }
53
54 /**
55 * Add auto-generated TypoScript to configure the Extbase Dispatcher.
56 *
57 * When adding a frontend plugin you will have to add both an entry to the TCA definition
58 * of tt_content table AND to the TypoScript template which must initiate the rendering.
59 * Since the static template with uid 43 is the "content.default" and practically always
60 * used for rendering the content elements it's very useful to have this function automatically
61 * adding the necessary TypoScript for calling the appropriate controller and action of your plugin.
62 * It will also work for the extension "css_styled_content"
63 * FOR USE IN ext_localconf.php FILES
64 * Usage: 2
65 *
66 * @param string $extensionName The extension name (in UpperCamelCase) or the extension key (in lower_underscore)
67 * @param string $pluginName must be a unique id for your plugin in UpperCamelCase (the string length of the extension key added to the length of the plugin name should be less than 32!)
68 * @param array $controllerActions is an array of allowed combinations of controller and action stored in an array (controller name as key and a comma separated list of action names as value, the first controller and its first action is chosen as default)
69 * @param array $nonCacheableControllerActions is an optional array of controller name and action names which should not be cached (array as defined in $controllerActions)
70 * @param string $pluginType either Tx_Extbase_Utility_Extension::TYPE_PLUGIN (default) or Tx_Extbase_Utility_Extension::TYPE_CONTENT_ELEMENT
71 * @return void
72 */
73 static public function configurePlugin($extensionName, $pluginName, array $controllerActions, array $nonCacheableControllerActions = array(), $pluginType = self::PLUGIN_TYPE_PLUGIN) {
74 if (empty($pluginName)) {
75 throw new InvalidArgumentException('The plugin name must not be empty', 1239891987);
76 }
77 if (empty($extensionName)) {
78 throw new InvalidArgumentException('The extension name was invalid (must not be empty and must match /[A-Za-z][_A-Za-z0-9]/)', 1239891989);
79 }
80 $extensionName = str_replace(' ', '', ucwords(str_replace('_', ' ', $extensionName)));
81 $pluginSignature = strtolower($extensionName) . '_' . strtolower($pluginName);
82 if (!is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['extbase']['extensions'][$extensionName]['plugins'][$pluginName])) {
83 $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['extbase']['extensions'][$extensionName]['plugins'][$pluginName] = array();
84 }
85
86 foreach ($controllerActions as $controllerName => $actionsList) {
87 $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['extbase']['extensions'][$extensionName]['plugins'][$pluginName]['controllers'][$controllerName] = array('actions' => t3lib_div::trimExplode(',', $actionsList));
88 if (!empty($nonCacheableControllerActions[$controllerName])) {
89 $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['extbase']['extensions'][$extensionName]['plugins'][$pluginName]['controllers'][$controllerName]['nonCacheableActions'] = t3lib_div::trimExplode(',', $nonCacheableControllerActions[$controllerName]);
90 }
91 }
92
93 $pluginTemplate = 'plugin.tx_' . strtolower($extensionName) . ' {
94 settings {
95 }
96 persistence {
97 storagePid =
98 classes {
99 }
100 }
101 view {
102 templateRootPath =
103 layoutRootPath =
104 partialRootPath =
105 # with defaultPid you can specify the default page uid of this plugin. If you set this to the string "auto" the target page will be determined automatically. Defaults to an empty string that expects the target page to be the current page.
106 defaultPid =
107 }
108 }';
109 t3lib_extMgm::addTypoScript($extensionName, 'setup', '
110 # Setting ' . $extensionName . ' plugin TypoScript
111 ' . $pluginTemplate);
112
113 switch ($pluginType) {
114 case self::PLUGIN_TYPE_PLUGIN:
115 $pluginContent = trim('
116 tt_content.list.20.' . $pluginSignature . ' = USER
117 tt_content.list.20.' . $pluginSignature . ' {
118 userFunc = Tx_Extbase_Core_Bootstrap->run
119 extensionName = ' . $extensionName . '
120 pluginName = ' . $pluginName . '
121 }');
122 break;
123 case self::PLUGIN_TYPE_CONTENT_ELEMENT:
124 $pluginContent = trim('
125 tt_content.' . $pluginSignature . ' = COA
126 tt_content.' . $pluginSignature . ' {
127 10 = < lib.stdheader
128 20 = USER
129 20 {
130 userFunc = Tx_Extbase_Core_Bootstrap->run
131 extensionName = ' . $extensionName . '
132 pluginName = ' . $pluginName . '
133 }
134 }');
135 break;
136 default:
137 throw new InvalidArgumentException('The pluginType "' . $pluginType .'" is not suported', 1289858856);
138 }
139 $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['extbase']['extensions'][$extensionName]['plugins'][$pluginName]['pluginType'] = $pluginType;
140
141 t3lib_extMgm::addTypoScript($extensionName, 'setup', '
142 # Setting ' . $extensionName . ' plugin TypoScript
143 ' . $pluginContent, 43);
144 }
145
146 /**
147 * Register an Extbase PlugIn into backend's list of plugins
148 * FOR USE IN ext_tables.php FILES
149 *
150 * @param string $extensionName The extension name (in UpperCamelCase) or the extension key (in lower_underscore)
151 * @param string $pluginName must be a unique id for your plugin in UpperCamelCase (the string length of the extension key added to the length of the plugin name should be less than 32!)
152 * @param string $pluginTitle is a speaking title of the plugin that will be displayed in the drop down menu in the backend
153 * @param string $pluginIconPathAndFilename is a path to an icon file (relative to TYPO3_mainDir), that will be displayed in the drop down menu in the backend (optional)
154 * @return void
155 */
156 static public function registerPlugin($extensionName, $pluginName, $pluginTitle, $pluginIconPathAndFilename = NULL) {
157 if (empty($pluginName)) {
158 throw new InvalidArgumentException('The plugin name must not be empty', 1239891987);
159 }
160 if (empty($extensionName)) {
161 throw new InvalidArgumentException('The extension name was invalid (must not be empty and must match /[A-Za-z][_A-Za-z0-9]/)', 1239891989);
162 }
163 $extensionName = str_replace(' ', '', ucwords(str_replace('_', ' ', $extensionName)));
164 $pluginSignature = strtolower($extensionName) . '_' . strtolower($pluginName);
165
166 t3lib_extMgm::addPlugin(array($pluginTitle, $pluginSignature, $pluginIconPathAndFilename), $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['extbase']['extensions'][$extensionName]['plugins'][$pluginName]['pluginType']);
167 }
168
169 /**
170 * This method is called from t3lib_loadModules::checkMod and it replaces old conf.php.
171 *
172 * @param string $moduleSignature The module name
173 * @param string $modulePath Absolute path to module (not used by Extbase currently)
174 * @return array Configuration of the module
175 */
176 static public function configureModule($moduleSignature, $modulePath) {
177 $moduleConfiguration = $GLOBALS['TBE_MODULES']['_configuration'][$moduleSignature];
178 $iconPathAndFilename = $moduleConfiguration['icon'];
179 if (substr($iconPathAndFilename, 0, 4) === 'EXT:') {
180 list($extensionKey, $relativePath) = explode('/', substr($iconPathAndFilename, 4), 2);
181 $iconPathAndFilename = t3lib_extMgm::extPath($extensionKey) . $relativePath;
182 }
183 // TODO: skin support
184
185 $moduleLabels = array(
186 'tabs_images' => array(
187 'tab' => $iconPathAndFilename,
188 ),
189 'labels' => array(
190 'tablabel' => $GLOBALS['LANG']->sL($moduleConfiguration['labels'] . ':mlang_labels_tablabel'),
191 'tabdescr' => $GLOBALS['LANG']->sL($moduleConfiguration['labels'] . ':mlang_labels_tabdescr'),
192 ),
193 'tabs' => array(
194 'tab' => $GLOBALS['LANG']->sL($moduleConfiguration['labels'] . ':mlang_tabs_tab')
195 )
196 );
197 $GLOBALS['LANG']->addModuleLabels($moduleLabels, $moduleSignature . '_');
198
199 return $moduleConfiguration;
200 }
201
202 /**
203 * Registers an Extbase module (main or sub) to the backend interface.
204 * FOR USE IN ext_tables.php FILES
205 *
206 * @param string $extensionName The extension name (in UpperCamelCase) or the extension key (in lower_underscore)
207 * @param string $mainModuleName 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. If $main is not set a blank $extensionName module is created
208 * @param string $subModuleName The submodule key. If $sub is not set a blank $main module is created
209 * @param string $position This 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.
210 * @param array $controllerActions is an array of allowed combinations of controller and action stored in an array (controller name as key and a comma separated list of action names as value, the first controller and its first action is chosen as default)
211 * @param array $moduleConfiguration The configuration options of the module (icon, locallang.xml file)
212 * @return void
213 */
214 static public function registerModule($extensionName, $mainModuleName = '', $subModuleName = '', $position = '', array $controllerActions, array $moduleConfiguration = array()) {
215 if (empty($extensionName)) {
216 throw new InvalidArgumentException('The extension name must not be empty', 1239891989);
217 }
218 $extensionKey = t3lib_div::camelCaseToLowerCaseUnderscored($extensionName);
219 $extensionName = str_replace(' ', '', ucwords(str_replace('_', ' ', $extensionName)));
220
221 $defaultModuleConfiguration = array(
222 'access' => 'admin',
223 'icon' => 'EXT:extbase/ext_icon.gif',
224 'labels' => '',
225 'extRelPath' => t3lib_extMgm::extRelPath($extensionKey) . 'Classes/'
226 );
227
228 if ((strlen($mainModuleName) > 0) && !array_key_exists($mainModuleName, $GLOBALS['TBE_MODULES'])) {
229 $mainModuleName = $extensionName . t3lib_div::underscoredToUpperCamelCase($mainModuleName);
230 } else {
231 $mainModuleName = (strlen($mainModuleName) > 0) ? $mainModuleName : 'web';
232 }
233
234 // add mandatory parameter to use new pagetree
235 if ($mainModuleName === 'web') {
236 $defaultModuleConfiguration['navigationComponentId'] = 'typo3-pagetree';
237 }
238
239 $moduleConfiguration = t3lib_div::array_merge_recursive_overrule($defaultModuleConfiguration, $moduleConfiguration);
240
241 $moduleSignature = $mainModuleName;
242
243 if ((strlen($subModuleName) > 0)) {
244 $subModuleName = $extensionName . t3lib_div::underscoredToUpperCamelCase($subModuleName);
245 $moduleSignature .= '_' . $subModuleName;
246 }
247
248 $moduleConfiguration['name'] = $moduleSignature;
249 $moduleConfiguration['script'] = 'mod.php?M=' . rawurlencode($moduleSignature);
250 $moduleConfiguration['extensionName'] = $extensionName;
251 $moduleConfiguration['configureModuleFunction'] = array('Tx_Extbase_Utility_Extension', 'configureModule');
252
253 $GLOBALS['TBE_MODULES']['_configuration'][$moduleSignature] = $moduleConfiguration;
254
255 if (!is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['extbase']['extensions'][$extensionName]['modules'][$moduleSignature])) {
256 $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['extbase']['extensions'][$extensionName]['modules'][$moduleSignature] = array();
257 }
258 foreach($controllerActions as $controllerName => $actions) {
259 $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['extbase']['extensions'][$extensionName]['modules'][$moduleSignature]['controllers'][$controllerName] = array(
260 'actions' => t3lib_div::trimExplode(',' , $actions)
261 );
262 }
263
264 t3lib_extMgm::addModule($mainModuleName, $subModuleName, $position);
265 }
266
267 /**
268 * Register a type converter by class name.
269 *
270 * @param string $typeConverterClassName
271 * @return void
272 * @api
273 */
274 static public function registerTypeConverter($typeConverterClassName) {
275 if (!is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['extbase']['typeConverters'])) {
276 $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['extbase']['typeConverters'] = array();
277 }
278 $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['extbase']['typeConverters'][] = $typeConverterClassName;
279 }
280
281 /**
282 * Build the autoload registry for a given extension and place it ext_autoload.php.
283 *
284 * @param string $extensionKey Key of the extension
285 * @param string $extensionPath full path of the extension
286 * @param array $additionalAutoloadClasses additional classes to be added to the autoloader. The key must be the classname all-lowercase, the value must be the entry to be inserted
287 * @return string HTML string which should be outputted
288 * @deprecated since Extbase 1.4.0; will be removed in Extbase 6.0
289 */
290 static public function createAutoloadRegistryForExtension($extensionKey, $extensionPath, $additionalAutoloadClasses = array()) {
291 t3lib_div::logDeprecatedFunction();
292 $classNameToFileMapping = array();
293 $extensionName = str_replace(' ', '', ucwords(str_replace('_', ' ', $extensionKey)));
294 $errors = self::buildAutoloadRegistryForSinglePath($classNameToFileMapping, $extensionPath . 'Classes/', '.*tslib.*', '$extensionClassesPath . \'|\'');
295 if ($errors) {
296 return $errors;
297 }
298 $globalPrefix = '$extensionClassesPath = t3lib_extMgm::extPath(\'' . $extensionKey . '\') . \'Classes/\';';
299
300 $errors = array();
301 foreach ($classNameToFileMapping as $className => $fileName) {
302 if (!(strpos($className, 'tx_' . strtolower($extensionName)) === 0)) {
303 $errors[] = $className . ' does not start with Tx_' . $extensionName . ' and was not added to the autoloader registry.';
304 unset($classNameToFileMapping[$className]);
305 }
306 }
307 $classNameToFileMapping = array_merge($classNameToFileMapping, $additionalAutoloadClasses);
308 $autoloadFileString = self::generateAutoloadPhpFileData($classNameToFileMapping, $globalPrefix);
309 if (!@file_put_contents($extensionPath . 'ext_autoload.php', $autoloadFileString)) {
310 $errors[] = '<b>' . $extensionPath . 'ext_autoload.php could not be written!</b>';
311 }
312 $errors[] = 'Wrote the following data: <pre>' . htmlspecialchars($autoloadFileString) . '</pre>';
313 return implode('<br />', $errors);
314 }
315
316 /**
317 * Generate autoload PHP file data. Takes an associative array with class name to file mapping, and outputs it as PHP.
318 * Does NOT escape the values in the associative array. Includes the <?php ... ?> syntax and an optional global prefix.
319 *
320 * @param array $classNameToFileMapping class name to file mapping
321 * @param string $globalPrefix Global prefix which is prepended to all code.
322 * @return string The full PHP string
323 * @deprecated since Extbase 1.4.0; will be removed in Extbase 6.0
324 */
325 protected function generateAutoloadPhpFileData($classNameToFileMapping, $globalPrefix = '') {
326 $output = '<?php' . PHP_EOL;
327 $output .= '// DO NOT CHANGE THIS FILE! It is automatically generated by Tx_Extbase_Utility_Extension::createAutoloadRegistryForExtension.' . PHP_EOL;
328 $output .= '// This file was generated on ' . date('Y-m-d H:i') . PHP_EOL;
329 $output .= PHP_EOL;
330 $output .= $globalPrefix . PHP_EOL;
331 $output .= 'return array(' . PHP_EOL;
332 foreach ($classNameToFileMapping as $className => $quotedFileName) {
333 $output .= ' \'' . $className . '\' => ' . $quotedFileName . ',' . PHP_EOL;
334 }
335 $output .= ');' . PHP_EOL;
336 $output .= '?>';
337 return $output;
338 }
339
340 /**
341 * Generate the $classNameToFileMapping for a given filePath.
342 *
343 * @param array $classNameToFileMapping (Reference to array) All values are appended to this array.
344 * @param string $path Path which should be crawled
345 * @param string $excludeRegularExpression Exclude regular expression, to exclude certain files from being processed
346 * @param string $valueWrap Wrap for the file name
347 * @return void
348 * @deprecated since Extbase 1.4.0; will be removed in Extbase 6.0
349 */
350 static protected function buildAutoloadRegistryForSinglePath(&$classNameToFileMapping, $path, $excludeRegularExpression = '', $valueWrap = '\'|\'') {
351 $extensionFileNames = t3lib_div::removePrefixPathFromList(t3lib_div::getAllFilesAndFoldersInPath(array(), $path, 'php', FALSE, 99, $excludeRegularExpression), $path);
352
353 foreach ($extensionFileNames as $extensionFileName) {
354 $classNamesInFile = self::extractClassNames($path . $extensionFileName);
355 if (!count($classNamesInFile)) continue;
356 foreach ($classNamesInFile as $className) {
357 $classNameToFileMapping[strtolower($className)] = str_replace('|', $extensionFileName, $valueWrap);
358 }
359 }
360 }
361
362 /**
363 * Extracts class names from the given file.
364 *
365 * @param string $filePath file path (absolute)
366 * @return array class names
367 * @deprecated since Extbase 1.4.0; will be removed in Extbase 6.0
368 */
369 static protected function extractClassNames($filePath) {
370 $fileContent = php_strip_whitespace($filePath);
371 $classNames = array();
372 if (FALSE) {
373 $tokens = token_get_all($fileContent);
374 while(1) {
375 // look for "class" or "interface"
376 $token = self::findToken($tokens, array(T_ABSTRACT, T_CLASS, T_INTERFACE));
377 // fetch "class" token if "abstract" was found
378 if ($token === 'abstract') {
379 $token = self::findToken($tokens, array(T_CLASS));
380 }
381 if ($token === false) {
382 // end of file
383 break;
384 }
385 // look for the name (a string) skipping only whitespace and comments
386 $token = self::findToken($tokens, array(T_STRING), array(T_WHITESPACE, T_COMMENT, T_DOC_COMMENT));
387 if ($token === false) {
388 // unexpected end of file or token: remove found names because of parse error
389 t3lib_div::sysLog('Parse error in "' . $filePath. '".', 'Core', 2);
390 $classNames = array();
391 break;
392 }
393 $token = t3lib_div::strtolower($token);
394 // exclude XLASS classes
395 if (strncmp($token, 'ux_', 3)) {
396 $classNames[] = $token;
397 }
398 }
399 } else {
400 // TODO: parse PHP - skip coments and strings, apply regexp only on the remaining PHP code
401 $matches = array();
402 preg_match_all('/^[ \t]*(?:(?:abstract|final)?[ \t]*(?:class|interface))[ \t\n\r]+([a-zA-Z][a-zA-Z_0-9]*)/mS', $fileContent, $matches);
403 $classNames = array_map('t3lib_div::strtolower', $matches[1]);
404 }
405 return $classNames;
406 }
407
408 /**
409 * Find tokens in the tokenList
410 *
411 * @param array &$tokenList list of tokens as returned by token_get_all()
412 * @param array $wantedTokens
413 * @param array $intermediateTokens optional: list of tokens that are allowed to skip when looking for the wanted token
414 * @return mixed
415 * @deprecated since Extbase 1.4.0; will be removed in Extbase 6.0
416 */
417 static protected function findToken(array &$tokenList, array $wantedTokens, array $intermediateTokens = array()) {
418 $skipAllTokens = count($intermediateTokens) ? false : true;
419
420 $returnValue = false;
421 // Iterate with while since we need the current array position:
422 foreach ($tokenList as $token) {
423 // parse token (see http://www.php.net/manual/en/function.token-get-all.php for format of token list)
424 if (is_array($token)) {
425 list($id, $text) = $token;
426 } else {
427 $id = $text = $token;
428 }
429 if (in_array($id, $wantedTokens)) {
430 $returnValue = $text;
431 break;
432 }
433 // look for another token
434 if ($skipAllTokens || in_array($id, $intermediateTokens)) {
435 continue;
436 }
437 break;
438 }
439 return $returnValue;
440 }
441
442 /**
443 * Determines the plugin namespace of the specified plugin (defaults to "tx_[extensionname]_[pluginname]")
444 * If plugin.tx_$pluginSignature.view.pluginNamespace is set, this value is returned
445 * If pluginNamespace is not specified "tx_[extensionname]_[pluginname]" is returned.
446 *
447 * @param string $extensionName name of the extension to retrieve the namespace for
448 * @param string $pluginName name of the plugin to retrieve the namespace for
449 * @return string plugin namespace
450 * @deprecated since Extbase 1.4.0; will be removed in Extbase 6.0 - Use Tx_Extbase_Service_ExtensionService instead
451 */
452 static public function getPluginNamespace($extensionName, $pluginName) {
453 t3lib_div::logDeprecatedFunction();
454 $extensionService = self::getExtensionService();
455 return $extensionService->getPluginNamespace($extensionName, $pluginName);
456 }
457
458 /**
459 * Iterates through the global TypoScript configuration and returns the name of the plugin
460 * that matches specified extensionName, controllerName and actionName.
461 * If no matching plugin was found, NULL is returned.
462 * If more than one plugin matches and the current plugin is not configured to handle the action,
463 * an Exception will be thrown
464 *
465 * @param string $extensionName name of the target extension (UpperCamelCase)
466 * @param string $controllerName name of the target controller (UpperCamelCase)
467 * @param string $actionName name of the target action (lowerCamelCase)
468 * @return string name of the target plugin (UpperCamelCase) or NULL if no matching plugin configuration was found
469 * @deprecated since Extbase 1.4.0; will be removed in Extbase 6.0 - Use Tx_Extbase_Service_ExtensionService instead
470 */
471 static public function getPluginNameByAction($extensionName, $controllerName, $actionName) {
472 t3lib_div::logDeprecatedFunction();
473 $extensionService = self::getExtensionService();
474 return $extensionService->getPluginNameByAction($extensionName, $controllerName, $actionName);
475 }
476
477 /**
478 * Checks if the given action is cacheable or not.
479 *
480 * @param string $extensionName Name of the target extension, without underscores
481 * @param string $pluginName Name of the target plugin
482 * @param string $controllerName Name of the target controller
483 * @param string $actionName Name of the action to be called
484 * @return boolean TRUE if the specified plugin action is cacheable, otherwise FALSE
485 * @deprecated since Extbase 1.4.0; will be removed in Extbase 6.0 - Use Tx_Extbase_Service_ExtensionService instead
486 */
487 static public function isActionCacheable($extensionName, $pluginName, $controllerName, $actionName) {
488 t3lib_div::logDeprecatedFunction();
489 $extensionService = self::getExtensionService();
490 return $extensionService->isActionCacheable($extensionName, $pluginName, $controllerName, $actionName);
491 }
492
493 /**
494 * Determines the target page of the specified plugin.
495 * If plugin.tx_$pluginSignature.view.defaultPid is set, this value is used as target page id
496 * If defaultPid is set to "auto", a the target pid is determined by loading the tt_content record that contains this plugin
497 * If the page could not be determined, NULL is returned
498 * If defaultPid is "auto" and more than one page contains the specified plugin, an Exception is thrown
499 *
500 * @param string $extensionName name of the extension to retrieve the target PID for
501 * @param string $pluginName name of the plugin to retrieve the target PID for
502 * @return integer uid of the target page or NULL if target page could not be determined
503 * @deprecated since Extbase 1.4.0; will be removed in Extbase 6.0 - Use Tx_Extbase_Service_ExtensionService instead
504 */
505 static public function getTargetPidByPlugin($extensionName, $pluginName) {
506 t3lib_div::logDeprecatedFunction();
507 $extensionService = self::getExtensionService();
508 return $extensionService->getTargetPidByPlugin($extensionName, $pluginName);
509 }
510 }
511
512 ?>