本文整理汇总了PHP中TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath方法的典型用法代码示例。如果您正苦于以下问题:PHP ExtensionManagementUtility::extPath方法的具体用法?PHP ExtensionManagementUtility::extPath怎么用?PHP ExtensionManagementUtility::extPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Core\Utility\ExtensionManagementUtility
的用法示例。
在下文中一共展示了ExtensionManagementUtility::extPath方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: reBuild
/**
* Rebuild the class cache
*
* @param array $parameters
*
* @throws \Evoweb\Extender\Exception\FileNotFoundException
* @throws \TYPO3\CMS\Core\Cache\Exception\InvalidDataException
* @return void
*/
public function reBuild(array $parameters = array())
{
if (empty($parameters) || !empty($parameters['cacheCmd']) && GeneralUtility::inList('all,system', $parameters['cacheCmd']) && isset($GLOBALS['BE_USER'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'] as $extensionKey => $extensionConfiguration) {
if (!isset($extensionConfiguration['extender']) || !is_array($extensionConfiguration['extender'])) {
continue;
}
foreach ($extensionConfiguration['extender'] as $entity => $entityConfiguration) {
$key = 'Domain/Model/' . $entity;
// Get the file to extend, this needs to be loaded as first
$path = ExtensionManagementUtility::extPath($extensionKey) . 'Classes/' . $key . '.php';
if (!is_file($path)) {
throw new \Evoweb\Extender\Exception\FileNotFoundException('given file "' . $path . '" does not exist');
}
$code = $this->parseSingleFile($path, false);
// Get the files from all other extensions that are extending this domain model
if (is_array($entityConfiguration)) {
foreach ($entityConfiguration as $extendingExtension => $extendingFilepath) {
$path = GeneralUtility::getFileAbsFileName($extendingFilepath, false);
if (!is_file($path) && !is_numeric($extendingExtension)) {
$path = ExtensionManagementUtility::extPath($extendingExtension) . 'Classes/' . $key . '.php';
}
$code .= $this->parseSingleFile($path);
}
}
// Close the class definition
$code = $this->closeClassDefinition($code);
// Add the new file to the class cache
$cacheEntryIdentifier = GeneralUtility::underscoredToLowerCamelCase($extensionKey) . '_' . str_replace('/', '', $key);
$this->cacheInstance->set($cacheEntryIdentifier, $code);
}
}
}
}
示例2: 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 $loader
* @param int $type
*
* @return array
*/
public function prepareLoader(Loader $loader, $type)
{
$hooks = [];
$folder = ExtensionManagementUtility::extPath($loader->getExtensionKey()) . 'Classes/Hooks/';
$files = FileUtility::getBaseFilesInDir($folder, 'php');
foreach ($files as $hookFile) {
$hookClass = ClassNamingUtility::getFqnByPath($loader->getVendorName(), $loader->getExtensionKey(), 'Hooks/' . $hookFile);
if (!$loader->isInstantiableClass($hookClass)) {
continue;
}
$classReflection = ReflectionUtility::createReflectionClass($hookClass);
// add class hook
$tagConfiguration = ReflectionUtility::getTagConfiguration($classReflection, ['hook']);
if (sizeof($tagConfiguration['hook'])) {
$hooks[] = ['locations' => $tagConfiguration['hook'], 'configuration' => $hookClass];
}
// add method hooks
foreach ($classReflection->getMethods(MethodReflection::IS_PUBLIC) as $methodReflection) {
/** @var $methodReflection \TYPO3\CMS\Extbase\Reflection\MethodReflection */
$tagConfiguration = ReflectionUtility::getTagConfiguration($methodReflection, ['hook']);
if (sizeof($tagConfiguration['hook'])) {
$hooks[] = ['locations' => $tagConfiguration['hook'], 'configuration' => $hookClass . '->' . $methodReflection->getName()];
}
}
}
return $hooks;
}
示例3: initialize_editor
/**
* Initialize editor
*
* Initializes the module.
* Done in this function because we may need to re-initialize if data is submitted!
*
* @param int $pageId
* @param int $template_uid
* @return bool
*/
public function initialize_editor($pageId, $template_uid = 0)
{
$templateService = GeneralUtility::makeInstance(ExtendedTemplateService::class);
$GLOBALS['tmpl'] = $templateService;
// Do not log time-performance information
$templateService->tt_track = false;
$templateService->init();
$templateService->ext_localGfxPrefix = ExtensionManagementUtility::extPath('tstemplate');
$templateService->ext_localWebGfxPrefix = ExtensionManagementUtility::extRelPath('tstemplate') . 'Resources/Public/';
// Get the row of the first VISIBLE template of the page. whereclause like the frontend.
$GLOBALS['tplRow'] = $templateService->ext_getFirstTemplate($pageId, $template_uid);
// IF there was a template...
if (is_array($GLOBALS['tplRow'])) {
// Gets the rootLine
$sys_page = GeneralUtility::makeInstance(PageRepository::class);
$rootLine = $sys_page->getRootLine($pageId);
// This generates the constants/config + hierarchy info for the template.
$templateService->runThroughTemplates($rootLine, $template_uid);
// The editable constants are returned in an array.
$GLOBALS['theConstants'] = $templateService->generateConfig_constants();
// The returned constants are sorted in categories, that goes into the $tmpl->categories array
$templateService->ext_categorizeEditableConstants($GLOBALS['theConstants']);
// This array will contain key=[expanded constant name], value=line number in template. (after edit_divider, if any)
$templateService->ext_regObjectPositions($GLOBALS['tplRow']['constants']);
return true;
}
return false;
}
开发者ID:Audibene-GMBH,项目名称:TYPO3.CMS,代码行数:38,代码来源:TypoScriptTemplateConstantEditorModuleFunctionController.php
示例4: 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);
}
}
示例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 $loader
* @param int $type
*
* @return array
*/
public function prepareLoader(Loader $loader, $type)
{
$icons = [];
if (!class_exists('TYPO3\\CMS\\Core\\Imaging\\IconRegistry')) {
return $icons;
}
$iconFolder = 'Resources/Public/Icon/';
$folder = ExtensionManagementUtility::extPath($loader->getExtensionKey()) . $iconFolder;
$extensionPath = ExtensionManagementUtility::extPath($loader->getExtensionKey());
$files = GeneralUtility::getAllFilesAndFoldersInPath([], $folder, '', false, true);
if (!sizeof($files)) {
return $icons;
}
foreach ($files as $path) {
$provider = 'TYPO3\\CMS\\Core\\Imaging\\IconProvider\\BitmapIconProvider';
if (substr(strtolower($path), -3) === 'svg') {
$provider = 'TYPO3\\CMS\\Core\\Imaging\\IconProvider\\SvgIconProvider';
}
$relativePath = str_replace($extensionPath, '', $path);
$iconPath = str_replace($iconFolder, '', $relativePath);
$pathElements = PathUtility::pathinfo(strtolower(str_replace('/', '-', $iconPath)));
$icons[] = ['provider' => $provider, 'path' => 'EXT:' . $loader->getExtensionKey() . '/' . $relativePath, 'identifier' => str_replace('_', '-', $loader->getExtensionKey()) . '-' . $pathElements['filename']];
}
return $icons;
}
示例6: 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());
}
}
}
}
示例7: getSettings
/**
* Parses the extension settings.
*
* @return \GeorgRinger\News\Domain\Model\Dto\EmConfiguration
* @throws \Exception If the configuration is invalid.
*/
public static function getSettings()
{
$configuration = self::parseSettings();
GeneralUtility::requireOnce(ExtensionManagementUtility::extPath('news') . 'Classes/Domain/Model/Dto/EmConfiguration.php');
$settings = new \GeorgRinger\News\Domain\Model\Dto\EmConfiguration($configuration);
return $settings;
}
示例8: getLanguageFlagIconPath
/**
* Returns the flag icons path depending on the current core version
*
* @return string
*/
public static function getLanguageFlagIconPath()
{
if (TRUE === version_compare(TYPO3_version, '7.1', '<')) {
return ExtensionManagementUtility::extPath('t3skin') . 'images/flags/';
}
return ExtensionManagementUtility::extPath('core') . 'Resources/Public/Icons/Flags/';
}
示例9: listAction
/**
* Outputs a list view of address
*
* @return void
*/
public function listAction()
{
if ($this->request->hasArgument('zip') && $this->request->getArgument('zip') != '') {
$zip = $this->request->getArgument('zip');
$isSearch = TRUE;
}
if ($zip == '' && $this->request->hasArgument('city') && $this->request->getArgument('city') != '') {
$jsonFileName = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('hwt_address') . 'Resources/Private/Data/city-zip.json';
$dataArray = array_change_key_case(json_decode(file_get_contents($jsonFileName), true));
$city = strtolower($this->request->getArgument('city'));
if (!empty($dataArray[$city])) {
$zip = substr($dataArray[$city], 0, 5);
}
$isSearch = TRUE;
}
if ($this->settings['addressStoragePages'] && $this->settings['addressStoragePages'] != '') {
$addressRecords = $this->addressRepository->findInPageIds($this->settings['addressStoragePages'], $this->settings['orderBy'], $this->settings['orderDirection']);
} elseif ($this->settings['list']['displayPageRelated'] == 1) {
$addressRecords = $this->addressRepository->findRelatedToPage($GLOBALS['TSFE']->id);
} elseif ($this->settings['addressCategories'] || $zip) {
$addressRecords = $this->addressRepository->findAllWithoutPidRestriction($this->settings['addressCategories'], $zip, $this->settings['orderBy'], $this->settings['orderDirection']);
}
if (count($addressRecords) == 0 && $this->settings['addressRecords']) {
$addressRecords = $this->addressRepository->findByUidInList($this->settings['addressRecords'], $this->settings['orderBy'], $this->settings['orderDirection']);
}
$this->view->assign('addresses', $addressRecords);
}
示例10: doUpdate
/**
* Do the language pack update
*
* @param string $extensionKey: extension key of the language pack
* @return void
*/
public function doUpdate($extensionKey)
{
$extPath = ExtensionManagementUtility::extPath($extensionKey);
$fileContent = explode(LF, GeneralUtility::getUrl($extPath . 'ext_tables_static+adt.sql'));
// SQL parser was moved from core to dbal in TYPO3 CMS 7.5
if (is_object($GLOBALS['TYPO3_DB']->SQLparser)) {
$sqlParser = $GLOBALS['TYPO3_DB']->SQLparser;
} else {
$sqlParser = $this->objectManager->get('SJBR\\StaticInfoTables\\Database\\SqlParser');
}
foreach ($fileContent as $line) {
$line = trim($line);
if ($line && preg_match('#^UPDATE#i', $line)) {
$parsedResult = $sqlParser->parseSQL($line);
// WHERE clause
$whereClause = $sqlParser->compileWhereClause($parsedResult['WHERE']);
// Fields
$fields = array();
foreach ($parsedResult['FIELDS'] as $fN => $fV) {
$fields[$fN] = $fV[0];
}
$res = $GLOBALS['TYPO3_DB']->exec_UPDATEquery($parsedResult['TABLE'], $whereClause, $fields, TRUE);
}
}
}
示例11: addFields_predefinedJS
/**
* Adds onchange listener on the drop down menu "predefined".
* If the event is fired and old value was ".default", then empty some fields.
*
* @param array $config
* @return string the javascript
* @author Fabien Udriot
*/
function addFields_predefinedJS($config)
{
$newRecord = 'true';
if ($config['row']['pi_flexform'] != '') {
$flexData = \TYPO3\CMS\Core\Utility\GeneralUtility::xml2array($config['row']['pi_flexform']);
if (isset($flexData['data']['sDEF']['lDEF']['predefined'])) {
$newRecord = 'false';
}
}
$uid = NULL;
if (is_array($GLOBALS['SOBE']->editconf['tt_content'])) {
$uid = key($GLOBALS['SOBE']->editconf['tt_content']);
}
if ($uid < 0 || empty($uid) || !strstr($uid, 'NEW')) {
$uid = $GLOBALS['SOBE']->elementsData[0]['uid'];
}
//print_r($GLOBALS['SOBE']->elementsData[0]);
$js = "<script>\n";
$js .= "/*<![CDATA[*/\n";
$divId = $GLOBALS['SOBE']->tceforms->dynNestedStack[0][1];
if (!$divId) {
//$divId = 'DTM-' . $uid;
$divId = "DIV.c-tablayer";
} else {
$divId .= "-DIV";
}
$js .= "var uid = '" . $uid . "'\n";
$js .= "var flexformBoxId = '" . $divId . "'\n";
//$js .= "var flexformBoxId = 'DIV.c-tablayer'\n";
$js .= "var newRecord = " . $newRecord . "\n";
$js .= file_get_contents(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('formhandler') . 'Resources/JS/addFields_predefinedJS.js');
$js .= "/*]]>*/\n";
$js .= "</script>\n";
return $js;
}
示例12: getJavaScript
/**
* Fetch the JavaScript to be rendered and replace the markers with "live" variables.
*
* @return string
*/
protected function getJavaScript()
{
// Get the base prefix.
$basePrefix = $this->getBasePrefix($this->getPrefix());
$filePath = ExtensionManagementUtility::extPath('media') . 'Resources/Private/Backend/Standalone/FileUploadTceForms.js';
return sprintf(file_get_contents($filePath), $basePrefix, $this->elementId, $this->getModuleUrl(), $this->getAllowedExtension(), GeneralUtility::getMaxUploadFileSize() * 1024, $this->getValue());
}
示例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');
$extKey = GeneralUtility::underscoredToUpperCamelCase($autoLoader->getExtensionKey());
foreach ($slotClasses as $slot) {
$slotClass = $autoLoader->getVendorName() . '\\' . $extKey . '\\Slots\\' . $slot;
if (!$autoLoader->isInstantiableClass($slotClass)) {
continue;
}
$methods = ReflectionUtility::getPublicMethods($slotClass);
foreach ($methods as $methodReflection) {
/** @var MethodReflection $methodReflection */
$tagConfiguration = ReflectionUtility::getTagConfiguration($methodReflection, ['signalClass', 'signalName']);
foreach ($tagConfiguration['signalClass'] as $key => $signalClass) {
if (!isset($tagConfiguration['signalName'][$key])) {
continue;
}
$slots[] = ['signalClassName' => trim($signalClass, '\\'), 'signalName' => $tagConfiguration['signalName'][$key], 'slotClassNameOrObject' => $slotClass, 'slotMethodName' => $methodReflection->getName()];
}
}
}
return $slots;
}
示例14: includeLocalLang
/**
* Reads the [extDir]/locallang.xml and returns the \$LOCAL_LANG array found in that file.
*
* @return The array with language labels
*/
public function includeLocalLang()
{
$llFile = ExtensionManagementUtility::extPath('ke_search') . 'pi1/locallang.xml';
$xmlParser = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Localization\\Parser\\LocallangXmlParser');
$LOCAL_LANG = $xmlParser->getParsedData($llFile, $GLOBALS['LANG']->lang);
return $LOCAL_LANG;
}
示例15: includeLocalLang
/**
* Includes the locallang file for the 'formhandler' extension
*
* @return array The LOCAL_LANG array
*/
function includeLocalLang()
{
$llFile = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('formhandler') . 'Resources/Language/locallang_db.xml';
$parser = TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Localization\\Parser\\LocallangXmlParser');
$LOCAL_LANG = $parser->getParsedData($llFile, $GLOBALS['LANG']->lang, 'utf-8');
return $LOCAL_LANG;
}