/** * This object is created very early and is part of the blacklisted "TYPO3\Flow\Aop" namespace so we can't rely on AOP for the property injection. * * @param ObjectManagerInterface $objectManager * @return void */ public function injectObjectManager(ObjectManagerInterface $objectManager) { if ($this->objectManager === null) { $this->objectManager = $objectManager; /** @var CacheManager $cacheManager */ $cacheManager = $this->objectManager->get(\TYPO3\Flow\Cache\CacheManager::class); $this->runtimeExpressionsCache = $cacheManager->getCache('Flow_Aop_RuntimeExpressions'); $this->runtimeExpressions = $this->runtimeExpressionsCache->requireOnce('Flow_Aop_RuntimeExpressions'); } }
/** * @param string $identifier * @return \TYPO3\Fluid\Core\Parser\ParsedTemplateInterface */ public function get($identifier) { $identifier = $this->sanitizeIdentifier($identifier); if (!isset($this->syntaxTreeInstanceCache[$identifier])) { $this->templateCache->requireOnce($identifier); $templateClassName = 'FluidCache_' . $identifier; $this->syntaxTreeInstanceCache[$identifier] = new $templateClassName(); } return $this->syntaxTreeInstanceCache[$identifier]; }
/** * Loads php files containing classes or interfaces found in the classes directory of * a package and specifically registered classes. * * @param string $className Name of the class/interface to load * @return boolean */ public function loadClass($className) { if ($className[0] === '\\') { $className = substr($className, 1); } // Loads any known proxied class: if ($this->classesCache !== NULL && $this->classesCache->requireOnce(str_replace('\\', '_', $className)) !== FALSE) { return TRUE; } // Workaround for Doctrine's annotation parser which does a class_exists() for annotations like "@param" and so on: if (isset($this->ignoredClassNames[$className]) || isset($this->ignoredClassNames[substr($className, strrpos($className, '\\') + 1)])) { return FALSE; } // Load classes from the Flow package at a very early stage where // no packages have been registered yet: if ($this->packages === array() && substr($className, 0, 10) === 'TYPO3\\Flow') { require FLOW_PATH_FLOW . 'Classes/TYPO3/Flow/' . str_replace('\\', '/', substr($className, 11)) . '.php'; return TRUE; } // Loads any non-proxied class of registered packages: foreach ($this->packageNamespaces as $packageNamespace => $packageData) { // replace underscores in classname with \ to match for packagenamespace if (substr(str_replace('_', '\\', $className), 0, $packageData['namespaceLength']) === $packageNamespace) { if ($this->considerTestsNamespace === TRUE && substr($className, $packageData['namespaceLength'] + 1, 16) === 'Tests\\Functional') { $classPathAndFilename = $this->packages[str_replace('\\', '.', $packageNamespace)]->getPackagePath() . str_replace('\\', '/', substr($className, $packageData['namespaceLength'] + 1)) . '.php'; } else { // make the classname PSR-0 compliant by replacing underscores only in the classname not in the namespace $fileName = ''; $lastNamespacePosition = strrpos($className, '\\'); if ($lastNamespacePosition !== FALSE) { $namespace = substr($className, 0, $lastNamespacePosition); $className = substr($className, $lastNamespacePosition + 1); $fileName = str_replace('\\', '/', $namespace) . '/'; } $fileName .= str_replace('_', '/', $className) . '.php'; $classPathAndFilename = $packageData['classesPath'] . $fileName; } try { $result = (include $classPathAndFilename); if ($result !== FALSE) { return TRUE; } } catch (\Exception $e) { } } } return FALSE; }
/** * Loads php files containing classes or interfaces found in the classes directory of * a package and specifically registered classes. * * @param string $className Name of the class/interface to load * @return boolean */ public function loadClass($className) { if ($className[0] === '\\') { $className = ltrim($className, '\\'); } $namespaceParts = explode('\\', $className); // Workaround for Doctrine's annotation parser which does a class_exists() for annotations like "@param" and so on: if (isset($this->ignoredClassNames[$className]) || isset($this->ignoredClassNames[end($namespaceParts)]) || isset($this->nonExistentClasses[$className])) { return false; } // Loads any known proxied class: if ($this->classesCache !== null && ($this->availableProxyClasses === null || isset($this->availableProxyClasses[implode('_', $namespaceParts)])) && $this->classesCache->requireOnce(implode('_', $namespaceParts)) !== false) { return true; } if (isset($this->classMap[$className])) { include $this->classMap[$className]; return true; } $classNamePart = array_pop($namespaceParts); $classNameParts = explode('_', $classNamePart); $namespaceParts = array_merge($namespaceParts, $classNameParts); $namespacePartCount = count($namespaceParts); // Load classes from the Flow package at a very early stage where no packages have been registered yet: if ($this->packageNamespaces === array()) { if ($namespaceParts[0] === 'TYPO3' && $namespaceParts[1] === 'Flow') { require FLOW_PATH_FLOW . 'Classes/TYPO3/Flow/' . implode('/', array_slice($namespaceParts, 2)) . '.php'; return true; } else { return false; } } $currentPackageArray = $this->packageNamespaces; $packagenamespacePartCount = 0; // This will contain all possible class mappings for the given class name. We start with the fallback paths and prepend mappings with growing specificy. $collectedPossibleNamespaceMappings = array(array('p' => $this->fallbackClassPaths, 'c' => 0)); if ($namespacePartCount > 1) { while ($packagenamespacePartCount + 1 < $namespacePartCount) { $possiblePackageNamespacePart = $namespaceParts[$packagenamespacePartCount]; if (!isset($currentPackageArray[$possiblePackageNamespacePart])) { break; } $packagenamespacePartCount++; $currentPackageArray = $currentPackageArray[$possiblePackageNamespacePart]; if (isset($currentPackageArray['_pathData'])) { array_unshift($collectedPossibleNamespaceMappings, array('p' => $currentPackageArray['_pathData'], 'c' => $packagenamespacePartCount)); } } } foreach ($collectedPossibleNamespaceMappings as $nameSpaceMapping) { if ($this->loadClassFromPossiblePaths($nameSpaceMapping['p'], $namespaceParts, $nameSpaceMapping['c'])) { return true; } } $this->nonExistentClasses[$className] = true; return false; }
/** * Initialize the Evaluator */ public function initializeObject() { $this->expressionCache->requireOnce('cachedExpressionClosures'); }
/** * Loads php files containing classes or interfaces found in the classes directory of * a package and specifically registered classes. * * @param string $className Name of the class/interface to load * @return boolean */ public function loadClass($className) { if ($className[0] === '\\') { $className = ltrim($className, '\\'); } $namespaceParts = explode('\\', $className); // Workaround for Doctrine's annotation parser which does a class_exists() for annotations like "@param" and so on: if (isset($this->ignoredClassNames[$className]) || isset($this->ignoredClassNames[end($namespaceParts)]) || isset($this->nonExistentClasses[$className])) { return FALSE; } // Loads any known proxied class: if ($this->classesCache !== NULL && ($this->availableProxyClasses === NULL || isset($this->availableProxyClasses[implode('_', $namespaceParts)])) && $this->classesCache->requireOnce(implode('_', $namespaceParts)) !== FALSE) { return TRUE; } if (isset($this->classMap[$className])) { include $this->classMap[$className]; return TRUE; } $classNamePart = array_pop($namespaceParts); $classNameParts = explode('_', $classNamePart); $namespaceParts = array_merge($namespaceParts, $classNameParts); $namespacePartCount = count($namespaceParts); // Load classes from the Flow package at a very early stage where // no packages have been registered yet: if ($this->packageNamespaces === array()) { if ($namespaceParts[0] === 'TYPO3' && $namespaceParts[1] === 'Flow') { require FLOW_PATH_FLOW . 'Classes/TYPO3/Flow/' . implode('/', array_slice($namespaceParts, 2)) . '.php'; return TRUE; } else { return FALSE; } } $currentPackageArray = $this->packageNamespaces; $packagenamespacePartCount = 0; if ($namespacePartCount === 1 && isset($currentPackageArray[$namespaceParts[0]])) { $currentPackageArray = $currentPackageArray[$namespaceParts[0]]; } else { while ($packagenamespacePartCount + 1 < $namespacePartCount) { $possiblePackageNamespacePart = $namespaceParts[$packagenamespacePartCount]; if (!isset($currentPackageArray[$possiblePackageNamespacePart])) { break; } $packagenamespacePartCount++; $currentPackageArray = $currentPackageArray[$possiblePackageNamespacePart]; } } if (isset($currentPackageArray['_pathData'])) { $possiblePaths = $currentPackageArray['_pathData']; } else { $packagenamespacePartCount = 0; $possiblePaths = $this->fallbackClassPaths; } foreach ($possiblePaths as $possiblePathData) { $pathConstructor = 'buildClassPathWith' . $possiblePathData['mappingType']; $possibleFilePath = $this->{$pathConstructor}($namespaceParts, $possiblePathData['path'], $packagenamespacePartCount); if (file_exists($possibleFilePath)) { $result = (include $possibleFilePath); if ($result !== FALSE) { return TRUE; } } } $this->nonExistentClasses[$className] = TRUE; return FALSE; }