本文整理汇总了PHP中TYPO3\CMS\Core\Utility\ExtensionManagementUtility类的典型用法代码示例。如果您正苦于以下问题:PHP ExtensionManagementUtility类的具体用法?PHP ExtensionManagementUtility怎么用?PHP ExtensionManagementUtility使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ExtensionManagementUtility类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
/**
* Initialize, setting what is necessary for browsing pages.
* Using the current user.
*
* @param string $clause Additional clause for selecting pages.
* @param string $orderByFields record ORDER BY field
* @return void
* @todo Define visibility
*/
public function init($clause = '', $orderByFields = '')
{
// This will hide records from display - it has nothing todo with user rights!!
$clauseExcludePidList = '';
if ($pidList = $GLOBALS['BE_USER']->getTSConfigVal('options.hideRecords.pages')) {
if ($pidList = $GLOBALS['TYPO3_DB']->cleanIntList($pidList)) {
$clauseExcludePidList = ' AND pages.uid NOT IN (' . $pidList . ')';
}
}
// This is very important for making trees of pages: Filtering out deleted pages, pages with no access to and sorting them correctly:
parent::init(' AND ' . $GLOBALS['BE_USER']->getPagePermsClause(1) . ' ' . $clause . $clauseExcludePidList, 'sorting');
$this->table = 'pages';
$this->setTreeName('browsePages');
$this->domIdPrefix = 'pages';
$this->iconName = '';
$this->title = $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'];
$this->MOUNTS = $GLOBALS['WEBMOUNTS'];
if ($pidList) {
// Remove mountpoint if explicitly set in options.hideRecords.pages (see above)
$hideList = explode(',', $pidList);
$this->MOUNTS = array_diff($this->MOUNTS, $hideList);
}
$this->fieldArray = array_merge($this->fieldArray, array('doktype', 'php_tree_stop', 't3ver_id', 't3ver_state', 't3ver_wsid', 't3ver_state', 't3ver_move_id'));
if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('cms')) {
$this->fieldArray = array_merge($this->fieldArray, array('hidden', 'starttime', 'endtime', 'fe_group', 'module', 'extendToSubpages', 'is_siteroot', 'nav_hide'));
}
}
示例2: render
/**
* Render the captcha image html
*
* @param string suffix to be appended to the extenstion key when forming css class names
* @return string The html used to render the captcha image
*/
public function render($suffix = '')
{
$value = '';
// Include the required JavaScript
$GLOBALS['TSFE']->additionalHeaderData[$this->extensionKey . '_freeCap'] = '<script type="text/javascript" src="' . GeneralUtility::createVersionNumberedFilename(ExtensionManagementUtility::siteRelPath($this->extensionKey) . 'Resources/Public/JavaScript/freeCap.js') . '"></script>';
// Disable caching
$GLOBALS['TSFE']->no_cache = 1;
// Get the plugin configuration
$settings = $this->configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_SETTINGS, $this->extensionName);
// Get the translation view helper
$objectManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
$translator = $objectManager->get('SJBR\\SrFreecap\\ViewHelpers\\TranslateViewHelper');
$translator->injectConfigurationManager($this->configurationManager);
// Generate the image url
$fakeId = GeneralUtility::shortMD5(uniqid(rand()), 5);
$siteURL = GeneralUtility::getIndpEnv('TYPO3_SITE_URL');
$L = GeneralUtility::_GP('L');
$urlParams = array('eID' => 'sr_freecap_EidDispatcher', 'id' => $GLOBALS['TSFE']->id, 'vendorName' => 'SJBR', 'extensionName' => 'SrFreecap', 'pluginName' => 'ImageGenerator', 'controllerName' => 'ImageGenerator', 'actionName' => 'show', 'formatName' => 'png', 'L' => $GLOBALS['TSFE']->sys_language_uid);
if ($GLOBALS['TSFE']->MP) {
$urlParams['MP'] = $GLOBALS['TSFE']->MP;
}
$urlParams['set'] = $fakeId;
$imageUrl = $siteURL . 'index.php?' . ltrim(GeneralUtility::implodeArrayForUrl('', $urlParams), '&');
// Generate the html text
$value = '<img' . $this->getClassAttribute('image', $suffix) . ' id="tx_srfreecap_captcha_image_' . $fakeId . '"' . ' src="' . htmlspecialchars($imageUrl) . '"' . ' alt="' . $translator->render('altText') . ' "/>' . '<span' . $this->getClassAttribute('cant-read', $suffix) . '>' . $translator->render('cant_read1') . ' <a href="#" onclick="this.blur();' . $this->extensionName . '.newImage(\'' . $fakeId . '\', \'' . $translator->render('noImageMessage') . '\');return false;">' . $translator->render('click_here') . '</a>' . $translator->render('cant_read2') . '</span>';
return $value;
}
示例3: getExtensionSummary
/**
* Returns information about this extension plugin
*
* @param array $params Parameters to the hook
*
* @return string Information about pi1 plugin
* @hook TYPO3_CONF_VARS|SC_OPTIONS|cms/layout/class.tx_cms_layout.php|list_type_Info|calendarize_calendar
*/
public function getExtensionSummary(array $params)
{
$relIconPath = GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . ExtensionManagementUtility::siteRelPath('calendarize') . 'ext_icon.png';
$this->flexFormService = GeneralUtility::makeInstance('HDNET\\Calendarize\\Service\\FlexFormService');
$this->layoutService = GeneralUtility::makeInstance('HDNET\\Calendarize\\Service\\ContentElementLayoutService');
$this->layoutService->setTitle('<img src="' . $relIconPath . '" /> Calendarize');
if ($params['row']['list_type'] != 'calendarize_calendar') {
return '';
}
$this->flexFormService->load($params['row']['pi_flexform']);
if (!$this->flexFormService->isValid()) {
return '';
}
$actions = $this->flexFormService->get('switchableControllerActions', 'main');
$parts = GeneralUtility::trimExplode(';', $actions, true);
$parts = array_map(function ($element) {
$split = explode('->', $element);
return ucfirst($split[1]);
}, $parts);
$actionKey = lcfirst(implode('', $parts));
$this->layoutService->addRow(LocalizationUtility::translate('mode', 'calendarize'), LocalizationUtility::translate('mode.' . $actionKey, 'calendarize'));
$this->layoutService->addRow(LocalizationUtility::translate('configuration', 'calendarize'), $this->flexFormService->get('settings.configuration', 'main'));
if ((bool) $this->flexFormService->get('settings.hidePagination', 'main')) {
$this->layoutService->addRow(LocalizationUtility::translate('hide.pagination.teaser', 'calendarize'), '!!!');
}
$this->addPageIdsToTable();
return $this->layoutService->render();
}
示例4: getSettings
/**
* Parses the extension settings.
*
* @return Tx_MooxNews_Domain_Model_Dto_EmConfiguration
* @throws Exception If the configuration is invalid.
*/
public static function getSettings()
{
$configuration = self::parseSettings();
\TYPO3\CMS\Core\Utility\GeneralUtility::requireOnce(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('moox_news') . 'Classes/Domain/Model/Dto/EmConfiguration.php');
$settings = new Tx_MooxNews_Domain_Model_Dto_EmConfiguration($configuration);
return $settings;
}
示例5: prepareLoader
/**
* Get all the complex data for the loader.
* This return value will be cached and stored in the database
* There is no file monitoring for this cache
*
* @param Loader $autoLoader
* @param int $type
*
* @return array
*/
public function prepareLoader(Loader $autoLoader, $type)
{
$languageOverride = [];
if ($type === LoaderInterface::EXT_TABLES) {
return $languageOverride;
}
$languageOverridePath = ExtensionManagementUtility::extPath($autoLoader->getExtensionKey()) . 'Resources/Private/Language/Overrides/';
if (!is_dir($languageOverridePath)) {
return $languageOverride;
}
$files = GeneralUtility::getAllFilesAndFoldersInPath([], $languageOverridePath, 'xlf,php,xml', false, 99);
foreach ($files as $file) {
$file = str_replace($languageOverridePath, '', $file);
$parts = GeneralUtility::trimExplode('/', $file, true);
$extension = GeneralUtility::camelCaseToLowerCaseUnderscored($parts[0]);
unset($parts[0]);
$parts = array_values($parts);
// language
$language = 'default';
$fileParts = GeneralUtility::trimExplode('.', PathUtility::basename($file), true);
if (strlen($fileParts[0]) === 2) {
$language = $fileParts[0];
unset($fileParts[0]);
$parts[sizeof($parts) - 1] = implode('.', $fileParts);
}
$languageOverride[] = ['language' => $language, 'original' => 'EXT:' . $extension . '/' . implode('/', $parts), 'override' => 'EXT:' . $autoLoader->getExtensionKey() . '/Resources/Private/Language/Overrides/' . $file];
}
return $languageOverride;
}
示例6: flexFormAutoLoader
/**
* Call this function at the end of your ext_tables.php to autoregister the flexforms
* of the extension to the given plugins.
*
* @return void
*/
public static function flexFormAutoLoader()
{
global $TCA, $_EXTKEY;
$_extConfig = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['nn_address']);
$FlexFormPath = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY) . 'Configuration/FlexForms/';
$extensionName = \TYPO3\CMS\Core\Utility\GeneralUtility::underscoredToUpperCamelCase($_EXTKEY);
$FlexForms = \TYPO3\CMS\Core\Utility\GeneralUtility::getFilesInDir($FlexFormPath, 'xml');
foreach ($FlexForms as $FlexForm) {
if (preg_match("/^Model_(.*)\$/", $FlexForm)) {
continue;
}
$fileKey = str_replace('.xml', '', $FlexForm);
$pluginSignature = strtolower($extensionName . '_' . $fileKey);
#$TCA['tt_content']['types']['list']['subtypes_excludelist'][$pluginSignature] = 'layout,select_key,recursive';
$TCA['tt_content']['types']['list']['subtypes_excludelist'][$pluginSignature] = 'select_key,recursive';
$TCA['tt_content']['types']['list']['subtypes_addlist'][$pluginSignature] = 'pi_flexform';
$fileFlexForm = 'FILE:EXT:' . $_EXTKEY . '/Configuration/FlexForms/' . $fileKey . '.xml';
// Any flexform dir in extension config set?
if ($_extConfig['flexFormPlugin'] != '') {
if (is_dir(\TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($_extConfig['flexFormPlugin']))) {
// modify the relative path
$path = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($_extConfig['flexFormPlugin']);
$path = preg_match('/^(.*)\\/$/', $path) ? $path : $path . '/';
$fileFlexForm = 'FILE:' . $path . $fileKey . '.xml';
}
}
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue($pluginSignature, $fileFlexForm);
}
}
示例7: isDbalEnabled
/**
* Return TRUE if dbal and adodb extension is loaded
*
* @return bool TRUE if dbal and adodb is loaded
*/
protected function isDbalEnabled()
{
if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('adodb') && \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('dbal')) {
return true;
}
return false;
}
示例8: initializeAction
public function initializeAction()
{
//parent::initializeAction(); // TODO: Change the autogenerated stub
$css = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath($this->request->getControllerExtensionKey()) . 'Resources/Public/Css/bjrfreizeitfeadmin.css';
/** */
$GLOBALS['TSFE']->getPageRenderer()->addCssFile($css);
}
示例9: getLoginScripts
/**
* Provides form code and javascript for the user setup.
*
* @param array $parameters Parameters to the script
* @param \TYPO3\CMS\Setup\Controller\SetupModuleController $userSetupObject Calling object: user setup module
* @return string The code for the user setup
*/
public function getLoginScripts(array $parameters, \TYPO3\CMS\Setup\Controller\SetupModuleController $userSetupObject)
{
$content = '';
if ($this->isRsaAvailable()) {
// If we can get the backend, we can proceed
$backend = \TYPO3\CMS\Rsaauth\Backend\BackendFactory::getBackend();
$javascriptPath = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath('rsaauth') . 'resources/';
$files = array('jsbn/jsbn.js', 'jsbn/prng4.js', 'jsbn/rng.js', 'jsbn/rsa.js', 'jsbn/base64.js', 'rsaauth_min.js');
$content = '';
foreach ($files as $file) {
$content .= '<script type="text/javascript" src="' . \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . $javascriptPath . $file . '"></script>';
}
// Generate a new key pair
$keyPair = $backend->createNewKeyPair();
// Save private key
$storage = \TYPO3\CMS\Rsaauth\Storage\StorageFactory::getStorage();
/** @var $storage \TYPO3\CMS\Rsaauth\Storage\AbstractStorage */
$storage->put($keyPair->getPrivateKey());
// Add form tag
$form = '<form action="' . \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('user_setup') . '" method="post" name="usersetup" enctype="application/x-www-form-urlencoded" onsubmit="tx_rsaauth_encryptUserSetup();">';
// Add RSA hidden fields
$form .= '<input type="hidden" id="rsa_n" name="n" value="' . htmlspecialchars($keyPair->getPublicKeyModulus()) . '" />';
$form .= '<input type="hidden" id="rsa_e" name="e" value="' . sprintf('%x', $keyPair->getExponent()) . '" />';
$userSetupObject->doc->form = $form;
}
return $content;
}
示例10: main
/**
* Main function, adding the item to input menuItems array
*
* @param ClickMenu $backRef References to parent clickmenu objects.
* @param array $menuItems Array of existing menu items accumulated. New element added to this.
* @param string $table Table name of the element
* @param int $uid Record UID of the element
* @return array Modified menuItems array
*/
public function main(&$backRef, $menuItems, $table, $uid)
{
$localItems = array();
if (!$backRef->cmLevel && $uid > 0 && $GLOBALS['BE_USER']->check('modules', 'web_txversionM1')) {
// Returns directly, because the clicked item was not from the pages table
if (in_array('versioning', $backRef->disabledItems) || !$GLOBALS['TCA'][$table] || !$GLOBALS['TCA'][$table]['ctrl']['versioningWS']) {
return $menuItems;
}
// Adds the regular item
$LL = $this->includeLL();
// "Versioning" element added:
$url = \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('web_txversionM1', array('table' => $table, 'uid' => $uid));
$localItems[] = $backRef->linkItem($GLOBALS['LANG']->getLLL('title', $LL), $backRef->excludeIcon('<img src="' . $backRef->backPath . \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('version') . 'Resources/Public/Icons/module-version.png" width="15" height="12" border="0" align="top" alt="" />'), $backRef->urlRefForCM($url), TRUE);
// Find position of "delete" element:
$c = 0;
foreach ($menuItems as $k => $value) {
$c++;
if ($k === 'delete') {
break;
}
}
// .. subtract two (delete item + divider line)
$c -= 2;
// ... and insert the items just before the delete element.
array_splice($menuItems, $c, 0, $localItems);
}
return $menuItems;
}
示例11: reBuild
public function reBuild()
{
$classPath = 'Classes/';
foreach ($GLOBALS['TYPO3_CONF_VARS']['EXT']['news']['classes'] as $key => $extensionsWithThisClass) {
$extendingClassFound = false;
$path = ExtensionManagementUtility::extPath('news') . $classPath . $key . '.php';
if (!is_file($path)) {
throw new \Exception('Given file "' . $path . '" does not exist');
}
$code = $this->parseSingleFile($path, true);
// Get the files from all other extensions
foreach ($extensionsWithThisClass as $extensionKey) {
$path = ExtensionManagementUtility::extPath($extensionKey) . $classPath . $key . '.php';
if (is_file($path)) {
$extendingClassFound = true;
$code .= $this->parseSingleFile($path, false);
}
}
$code = $this->closeClassDefinition($code);
// If an extending class is found, the file is written and
// added to the autoloader info
if ($extendingClassFound) {
$cacheEntryIdentifier = 'tx_news_' . strtolower(str_replace('/', '_', $key));
try {
$this->cacheInstance->set($cacheEntryIdentifier, $code);
} catch (\Exception $e) {
throw new \Exception($e->getMessage());
}
}
}
}
示例12: while
/**
* Get the localization of the select field items (right-hand part of form)
* Referenced by TCA
*
* @param array $params Array of searched translation
*
* @return void
*/
function get_localized_categories(array $params)
{
global $LANG;
/*
$params['items'] = &$items;
$params['config'] = $config;
$params['TSconfig'] = $iArray;
$params['table'] = $table;
$params['row'] = $row;
$params['field'] = $field;
*/
$config = $params['config'];
$table = $config['itemsProcFunc_config']['table'];
// initialize backend user language
if ($LANG->lang && ExtensionManagementUtility::isLoaded('static_info_tables')) {
$sysPage = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Page\\PageRepository');
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('sys_language.uid', 'sys_language LEFT JOIN static_languages ON sys_language.static_lang_isocode = static_languages.uid', 'static_languages.lg_typo3 = ' . $GLOBALS['TYPO3_DB']->fullQuoteStr($LANG->lang, 'static_languages') . $sysPage->enableFields('sys_language') . $sysPage->enableFields('static_languages'));
while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
$this->sys_language_uid = $row['uid'];
$this->collate_locale = $row['lg_collate_locale'];
}
$GLOBALS['TYPO3_DB']->sql_free_result($res);
}
if (is_array($params['items']) && !empty($params['items'])) {
foreach ($params['items'] as $k => $item) {
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', $table, 'uid=' . intval($item[1]));
while ($rowCat = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
if ($localizedRowCat = DirectMailUtility::getRecordOverlay($table, $rowCat, $this->sys_language_uid, '')) {
$params['items'][$k][0] = $localizedRowCat['category'];
}
}
$GLOBALS['TYPO3_DB']->sql_free_result($res);
}
}
}
示例13: prepareLoader
/**
* Get all the complex data for the loader.
* This return value will be cached and stored in the database
* There is no file monitoring for this cache
*
* @param Loader $autoLoader
* @param int $type
*
* @return array
*/
public function prepareLoader(Loader $autoLoader, $type)
{
$slots = [];
$slotPath = ExtensionManagementUtility::extPath($autoLoader->getExtensionKey()) . 'Classes/Slots/';
$slotClasses = FileUtility::getBaseFilesInDir($slotPath, 'php');
foreach ($slotClasses as $slot) {
$slotClass = ClassNamingUtility::getFqnByPath($autoLoader->getVendorName(), $autoLoader->getExtensionKey(), 'Slots/' . $slot);
if (!$autoLoader->isInstantiableClass($slotClass)) {
continue;
}
$methods = ReflectionUtility::getPublicMethods($slotClass);
foreach ($methods as $methodReflection) {
/** @var MethodReflection $methodReflection */
$tagConfiguration = ReflectionUtility::getTagConfiguration($methodReflection, ['signalClass', 'signalName', 'signalPriority']);
foreach ($tagConfiguration['signalClass'] as $key => $signalClass) {
if (!isset($tagConfiguration['signalName'][$key])) {
continue;
}
$priority = isset($tagConfiguration['signalPriority'][$key]) ? $tagConfiguration['signalPriority'][$key] : 0;
$priority = MathUtility::forceIntegerInRange($priority, 0, 100);
$slots[$priority][] = ['signalClassName' => trim($signalClass, '\\'), 'signalName' => $tagConfiguration['signalName'][$key], 'slotClassNameOrObject' => $slotClass, 'slotMethodName' => $methodReflection->getName()];
}
}
}
$slots = $this->flattenSlotsByPriority($slots);
return $slots;
}
示例14: getDefaultMarkers
/**
* Returns the default markers for the template, with some additional parameters for the error page.
*
* @return array
*/
protected function getDefaultMarkers()
{
$defaultMarkers = parent::getDefaultMarkers();
$defaultMarkers['###EXTPATH_CORE###'] = ExtensionManagementUtility::siteRelPath('core');
$defaultMarkers['###EXTPATH_BACKEND###'] = ExtensionManagementUtility::siteRelPath('backend');
return $defaultMarkers;
}
示例15: render
/**
* Calls addJsFile for each file in the given folder on the Instance of TYPO3\CMS\Core\Page\PageRenderer.
*
* @param string $name the file to include
* @param string $extKey the extension, where the file is located
* @param string $pathInsideExt the path to the file relative to the ext-folder
* @param bool $recursive
*/
public function render($name = null, $extKey = null, $pathInsideExt = 'Resources/Public/JavaScript/', $recursive = false)
{
if ($extKey == null) {
$extKey = $this->controllerContext->getRequest()->getControllerExtensionKey();
}
$extPath = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($extKey);
if (TYPO3_MODE === 'FE') {
$extRelPath = substr($extPath, strlen(PATH_site));
} else {
$extRelPath = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath($extKey);
}
$absFolderPath = $extPath . $pathInsideExt . $name;
// $files will include all files relative to $pathInsideExt
if ($recursive === false) {
$files = \TYPO3\CMS\Core\Utility\GeneralUtility::getFilesInDir($absFolderPath);
foreach ($files as $hash => $filename) {
$files[$hash] = $name . $filename;
}
} else {
$files = \TYPO3\CMS\Core\Utility\GeneralUtility::getAllFilesAndFoldersInPath([], $absFolderPath, '', 0, 99, '\\.svn');
foreach ($files as $hash => $absPath) {
$files[$hash] = str_replace($extPath . $pathInsideExt, '', $absPath);
}
}
foreach ($files as $name) {
$this->pageRenderer->addJsFile($extRelPath . $pathInsideExt . $name);
}
}