示例#1
0
文件: Template.php 项目: punktDe/solr
 protected function loadViewHelper($helperKey)
 {
     if (isset($this->loadedHelperFiles[strtolower($helperKey)])) {
         return $this->loadedHelperFiles[strtolower($helperKey)]['class'];
     }
     foreach ($this->viewHelperIncludePath as $extensionKey => $viewHelperPath) {
         $viewHelperRealPath = $viewHelperPath;
         if (\TYPO3\CMS\Core\Utility\GeneralUtility::isFirstPartOfStr($viewHelperPath, 'Classes/')) {
             $viewHelperRealPath = substr($viewHelperPath, 8);
         }
         if (substr($viewHelperRealPath, -1) == '/') {
             $viewHelperRealPath = substr($viewHelperRealPath, 0, -1);
         }
         $classNamePrefix = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getCN($extensionKey);
         $possibleFilename = Tx_Solr_Util::underscoredToUpperCamelCase($helperKey) . '.php';
         $possibleClassName = $classNamePrefix . '_' . str_replace('/', '_', $viewHelperRealPath) . '_' . Tx_Solr_Util::underscoredToUpperCamelCase($helperKey);
         $viewHelperIncludePath = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($extensionKey) . $viewHelperPath . $possibleFilename;
         if (file_exists($viewHelperIncludePath)) {
             include_once $viewHelperIncludePath;
             $this->loadedHelperFiles[strtolower($helperKey)] = array('file' => $viewHelperIncludePath, 'class' => $possibleClassName);
             return $possibleClassName;
         }
     }
     // viewhelper could not be found
     return FALSE;
 }