Ejemplo n.º 1
0
 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 (GeneralUtility::isFirstPartOfStr($viewHelperPath, 'Classes/')) {
             $viewHelperRealPath = substr($viewHelperPath, 8);
         }
         if (substr($viewHelperRealPath, -1) == '/') {
             $viewHelperRealPath = substr($viewHelperRealPath, 0, -1);
         }
         $classNamePrefix = ExtensionManagementUtility::getCN($extensionKey);
         //FIXME for PHP 5.4.32, 5.5.16: $classNamePrefix = ucwords($classNamePrefix, '_');
         $classNamePrefix = explode('_', $classNamePrefix);
         $classNamePrefix = array_map('ucfirst', $classNamePrefix);
         $classNamePrefix = implode('_', $classNamePrefix);
         $possibleFilename = Util::underscoredToUpperCamelCase($helperKey) . '.php';
         $possibleClassName = $classNamePrefix . '_' . str_replace('/', '_', $viewHelperRealPath) . '_' . Util::underscoredToUpperCamelCase($helperKey);
         $viewHelperIncludePath = ExtensionManagementUtility::extPath($extensionKey) . $viewHelperPath . $possibleFilename;
         if (file_exists($viewHelperIncludePath)) {
             include_once $viewHelperIncludePath;
             $this->loadedHelperFiles[strtolower($helperKey)] = array('file' => $viewHelperIncludePath, 'class' => $possibleClassName);
             return $possibleClassName;
         }
     }
     // view helper could not be found
     return FALSE;
 }
Ejemplo n.º 2
0
 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 (GeneralUtility::isFirstPartOfStr($viewHelperPath, 'Classes/')) {
             $viewHelperRealPath = substr($viewHelperPath, 8);
         }
         if (substr($viewHelperRealPath, -1) == '/') {
             $viewHelperRealPath = substr($viewHelperRealPath, 0, -1);
         }
         $ucHelperKey = Util::underscoredToUpperCamelCase($helperKey);
         $vendorNameSpace = 'ApacheSolrForTypo3\\Solr\\';
         $possibleFilename = $ucHelperKey . '.php';
         $possibleClassName = $vendorNameSpace . str_replace('/', '\\', $viewHelperRealPath) . '\\' . $ucHelperKey;
         $viewHelperIncludePath = ExtensionManagementUtility::extPath($extensionKey) . $viewHelperPath . $possibleFilename;
         if (file_exists($viewHelperIncludePath)) {
             include_once $viewHelperIncludePath;
             $this->loadedHelperFiles[strtolower($helperKey)] = array('file' => $viewHelperIncludePath, 'class' => $possibleClassName);
             return $possibleClassName;
         }
     }
     // view helper could not be found
     return false;
 }