Пример #1
0
 /**
  * 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;
 }
Пример #2
0
 /**
  * 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
0
 /**
  * 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;
 }
Пример #4
0
 /**
  * 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)
 {
     $scripts = [];
     $folder = ExtensionManagementUtility::extPath($loader->getExtensionKey()) . 'Resources/Private/Php/eID/';
     $files = FileUtility::getBaseFilesInDir($folder, 'php');
     foreach ($files as $eIdFile) {
         $scripts[] = ['name' => $eIdFile, 'path' => 'EXT:' . $loader->getExtensionKey() . '/Resources/Private/Php/eID/' . $eIdFile . '.php'];
     }
     return $scripts;
 }
 /**
  * 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)
 {
     $classNames = [];
     $alternativeImpPath = ExtensionManagementUtility::extPath($loader->getExtensionKey()) . 'Classes/AlternativeImplementations/';
     $alternativeClasses = FileUtility::getBaseFilesInDir($alternativeImpPath, 'php');
     foreach ($alternativeClasses as $aic) {
         $aicClass = ClassNamingUtility::getFqnByPath($loader->getVendorName(), $loader->getExtensionKey(), 'AlternativeImplementations/' . $aic);
         if (!$loader->isInstantiableClass($aicClass)) {
             continue;
         }
         $classNames[] = ['originalName' => ReflectionUtility::getParentClassName($aicClass), 'alternativeClassName' => $aicClass];
     }
     return $classNames;
 }
 /**
  * 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)
 {
     $classNames = [];
     $alternativeImpPath = ExtensionManagementUtility::extPath($loader->getExtensionKey()) . 'Classes/AlternativeImplementations/';
     $alternativeClasses = FileUtility::getBaseFilesInDir($alternativeImpPath, 'php');
     $extKey = GeneralUtility::underscoredToUpperCamelCase($loader->getExtensionKey());
     foreach ($alternativeClasses as $aic) {
         $aicClass = $loader->getVendorName() . '\\' . $extKey . '\\AlternativeImplementations\\' . $aic;
         if (!$loader->isInstantiableClass($aicClass)) {
             continue;
         }
         $classNames[] = ['originalName' => ReflectionUtility::getParentClassName($aicClass), 'alternativeClassName' => $aicClass];
     }
     return $classNames;
 }
Пример #7
0
 /**
  * Prepare the content object loader
  *
  * @param Loader $loader
  * @param int    $type
  *
  * @return array
  */
 public function prepareLoader(Loader $loader, $type)
 {
     $loaderInformation = [];
     $modelPath = ExtensionManagementUtility::extPath($loader->getExtensionKey()) . 'Classes/Domain/Model/Content/';
     $models = FileUtility::getBaseFilesInDir($modelPath, 'php');
     if ($models) {
         TranslateUtility::assureLabel('tt_content.' . $loader->getExtensionKey() . '.header', $loader->getExtensionKey(), $loader->getExtensionKey() . ' (Header)');
     }
     foreach ($models as $model) {
         $key = GeneralUtility::camelCaseToLowerCaseUnderscored($model);
         $className = ClassNamingUtility::getFqnByPath($loader->getVendorName(), $loader->getExtensionKey(), 'Domain/Model/Content/' . $model);
         if (!$loader->isInstantiableClass($className)) {
             continue;
         }
         $fieldConfiguration = [];
         $richTextFields = [];
         $noHeader = $this->isTaggedWithNoHeader($className);
         // create labels in the ext_tables run, to have a valid DatabaseConnection
         if ($type === LoaderInterface::EXT_TABLES) {
             TranslateUtility::assureLabel('wizard.' . $key, $loader->getExtensionKey(), $key . ' (Title)');
             TranslateUtility::assureLabel('wizard.' . $key . '.description', $loader->getExtensionKey(), $key . ' (Description)');
             $fieldConfiguration = $this->getClassPropertiesInLowerCaseUnderscored($className);
             $defaultFields = $this->getDefaultTcaFields(null, $noHeader);
             $fieldConfiguration = array_diff($fieldConfiguration, $defaultFields);
             // RTE manipulation
             $classReflection = ReflectionUtility::createReflectionClass($className);
             foreach ($classReflection->getProperties() as $property) {
                 /** @var $property PropertyReflection */
                 if ($property->isTaggedWith('enableRichText')) {
                     $search = array_search(GeneralUtility::camelCaseToLowerCaseUnderscored($property->getName()), $fieldConfiguration);
                     if ($search !== false) {
                         if (GeneralUtility::compat_version('7.0')) {
                             $richTextFields[] = $fieldConfiguration[$search];
                         } else {
                             $fieldConfiguration[$search] .= ';;;richtext:rte_transform[flag=rte_enabled|mode=ts_css]';
                         }
                     }
                 }
             }
         }
         $entry = ['fieldConfiguration' => implode(',', $fieldConfiguration), 'richTextFields' => $richTextFields, 'modelClass' => $className, 'model' => $model, 'icon' => IconUtility::getByModelName($className), 'iconExt' => IconUtility::getByModelName($className, true), 'noHeader' => $noHeader, 'tabInformation' => ReflectionUtility::getFirstTagValue($className, 'wizardTab')];
         SmartObjectRegister::register($entry['modelClass']);
         $loaderInformation[$key] = $entry;
     }
     $this->checkAndCreateDummyTemplates($loaderInformation, $loader);
     return $loaderInformation;
 }
Пример #8
0
 /**
  * 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)
 {
     $classNames = [];
     $commandPath = ExtensionManagementUtility::extPath($loader->getExtensionKey()) . 'Classes/Command/';
     $controllers = FileUtility::getBaseFilesInDir($commandPath, 'php');
     foreach ($controllers as $controller) {
         if ($controller === 'AbstractCommandController') {
             continue;
         }
         $className = $loader->getVendorName() . '\\' . ucfirst(GeneralUtility::underscoredToUpperCamelCase($loader->getExtensionKey())) . '\\Command\\' . $controller;
         if (!$loader->isInstantiableClass($className)) {
             continue;
         }
         $classNames[] = $className;
     }
     return $classNames;
 }
Пример #9
0
 /**
  * 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)
 {
     $classNames = [];
     $commandPath = ExtensionManagementUtility::extPath($loader->getExtensionKey()) . 'Classes/Command/';
     $controllers = FileUtility::getBaseFilesInDir($commandPath, 'php');
     foreach ($controllers as $controller) {
         if ($controller === 'AbstractCommandController') {
             continue;
         }
         $className = ClassNamingUtility::getFqnByPath($loader->getVendorName(), $loader->getExtensionKey(), 'Command/' . $controller);
         if (!$loader->isInstantiableClass($className)) {
             continue;
         }
         $classNames[] = $className;
     }
     return $classNames;
 }
Пример #10
0
 /**
  * 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)
 {
     $configuration = [];
     $modelPath = ExtensionManagementUtility::extPath($loader->getExtensionKey()) . 'Classes/Domain/Model/';
     if (!is_dir($modelPath)) {
         return $configuration;
     }
     $models = FileUtility::getBaseFilesInDir($modelPath, 'php');
     foreach ($models as $model) {
         $className = $loader->getVendorName() . '\\' . ucfirst(GeneralUtility::underscoredToUpperCamelCase($loader->getExtensionKey())) . '\\Domain\\Model\\' . $model;
         if (SmartObjectManager::isSmartObjectClass($className)) {
             $configuration[] = $className;
         }
     }
     // already add for the following processes
     $this->addClassesToSmartRegister($configuration);
     return $configuration;
 }
Пример #11
0
 /**
  * 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)
 {
     $flexForms = [];
     $flexFormPath = ExtensionManagementUtility::extPath($loader->getExtensionKey()) . 'Configuration/FlexForms/';
     // Plugins
     $extensionName = GeneralUtility::underscoredToUpperCamelCase($loader->getExtensionKey());
     $flexFormsFiles = FileUtility::getBaseFilesInDir($flexFormPath, 'xml');
     foreach ($flexFormsFiles as $fileKey) {
         $pluginSignature = strtolower($extensionName . '_' . $fileKey);
         $flexForms[] = ['pluginSignature' => $pluginSignature, 'path' => 'FILE:EXT:' . $loader->getExtensionKey() . '/Configuration/FlexForms/' . $fileKey . '.xml'];
     }
     // Content
     $flexFormsFiles = FileUtility::getBaseFilesInDir($flexFormPath . 'Content/', 'xml');
     foreach ($flexFormsFiles as $fileKey) {
         $contentSignature = strtolower($loader->getExtensionKey() . '_' . GeneralUtility::camelCaseToLowerCaseUnderscored($fileKey));
         $flexForms[] = ['contentSignature' => $contentSignature, 'path' => 'FILE:EXT:' . $loader->getExtensionKey() . '/Configuration/FlexForms/Content/' . $fileKey . '.xml'];
     }
     return $flexForms;
 }
Пример #12
0
 /**
  * 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 $loaderInformation
  */
 public function prepareLoader(Loader $loader, $type)
 {
     $aspects = [];
     $aspectPath = ExtensionManagementUtility::extPath($loader->getExtensionKey()) . 'Classes/Aspect/';
     $aspectClasses = FileUtility::getBaseFilesInDir($aspectPath, 'php');
     $extKey = GeneralUtility::underscoredToUpperCamelCase($loader->getExtensionKey());
     foreach ($aspectClasses as $aspect) {
         $aspectClass = ClassNamingUtility::getFqnByPath($loader->getVendorName(), $loader->getExtensionKey(), 'Aspect/' . $aspect);
         if (!$loader->isInstantiableClass($aspectClass)) {
             continue;
         }
         try {
             $methods = ReflectionUtility::getPublicMethods($aspectClass);
             foreach ($methods as $methodReflection) {
                 /** @var $methodReflection \TYPO3\CMS\Extbase\Reflection\MethodReflection */
                 $tagConfiguration = ReflectionUtility::getTagConfiguration($methodReflection, ['aspectClass', 'aspectJoinPoint', 'aspectAdvice']);
                 foreach ($tagConfiguration['aspectClass'] as $key => $aspectClass) {
                     if (!isset($tagConfiguration['aspectJoinPoint'][$key]) || !isset($tagConfiguration['aspectAdvice'][$key])) {
                         continue;
                     }
                     $aspectClassName = trim($aspectClass, '\\');
                     $aspectJoinPoint = trim($tagConfiguration['aspectJoinPoint'][$key]);
                     // check only if class exists
                     if (!$loader->isInstantiableClass($aspectClassName)) {
                         continue;
                     }
                     $aspectJpArguments = $this->getMethodArgumentsFromClassMethod($aspectClassName, $aspectJoinPoint);
                     $aspects[] = ['aspectClassName' => $aspectClassName, 'aspectJoinPoint' => $aspectJoinPoint, 'aspectJoinPointArguments' => $aspectJpArguments, 'aspectAdvice' => trim($tagConfiguration['aspectAdvice'][$key]), 'originClassName' => $aspectClass, 'originMethodName' => $methodReflection->getName()];
                 }
             }
         } catch (\Exception $e) {
             // Class or file is not available for Aspects $aspectClassName
             continue;
         }
     }
     return $aspects;
 }