Example #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 $loader
  * @param int    $type
  *
  * @return array
  */
 public function prepareLoader(Loader $loader, $type)
 {
     $pluginInformation = [];
     $controllerPath = ExtensionManagementUtility::extPath($loader->getExtensionKey()) . 'Classes/Controller/';
     $controllers = FileUtility::getBaseFilesRecursivelyInDir($controllerPath, 'php');
     foreach ($controllers as $controller) {
         $controllerName = ClassNamingUtility::getFqnByPath($loader->getVendorName(), $loader->getExtensionKey(), 'Controller/' . $controller);
         if (!$loader->isInstantiableClass($controllerName)) {
             continue;
         }
         $controllerKey = str_replace('/', '\\', $controller);
         $controllerKey = str_replace('Controller', '', $controllerKey);
         $methods = ReflectionUtility::getPublicMethods($controllerName);
         foreach ($methods as $method) {
             /** @var $method \TYPO3\CMS\Extbase\Reflection\MethodReflection */
             if ($method->isTaggedWith('plugin')) {
                 $pluginKeys = GeneralUtility::trimExplode(' ', implode(' ', $method->getTagValues('plugin')), true);
                 $actionName = str_replace('Action', '', $method->getName());
                 foreach ($pluginKeys as $pluginKey) {
                     $pluginInformation = $this->addPluginInformation($pluginInformation, $pluginKey, $controllerKey, $actionName, $method->isTaggedWith('noCache'));
                 }
             }
         }
     }
     return $pluginInformation;
 }
Example #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 $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;
 }
Example #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');
     $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;
 }
Example #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 $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;
 }