|
TYPO3 API
SVNRelease
|
00001 <?php 00002 00003 /* * 00004 * This script is part of the TYPO3 project - inspiring people to share! * 00005 * * 00006 * TYPO3 is free software; you can redistribute it and/or modify it under * 00007 * the terms of the GNU General Public License version 2 as published by * 00008 * the Free Software Foundation. * 00009 * * 00010 * This script is distributed in the hope that it will be useful, but * 00011 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- * 00012 * TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * 00013 * Public License for more details. * 00014 * */ 00015 00016 /** 00017 */ 00018 /** 00019 * Class extending the docbook generator service for use in typo3 v4. 00020 * 00021 * Usage in TypoScript: 00022 * 00023 * 00024 00025 config.disableAllHeaderCode = 1 00026 page = PAGE 00027 page.10 = USER_INT 00028 page.10.userFunc = Tx_Fluid_Compatibility_DocbookGeneratorService->userFunc 00029 00030 * @internal 00031 */ 00032 class Tx_Fluid_Compatibility_DocbookGeneratorService extends Tx_Fluid_Service_DocbookGenerator { 00033 00034 public function userFunc() { 00035 if (!class_exists('Tx_Extbase_Utility_ClassLoader')) { 00036 require(t3lib_extmgm::extPath('extbase') . 'Classes/Utility/ClassLoader.php'); 00037 } 00038 00039 $classLoader = new Tx_Extbase_Utility_ClassLoader(); 00040 spl_autoload_register(array($classLoader, 'loadClass')); 00041 return $this->generateDocbook('Tx_Fluid_ViewHelpers'); 00042 } 00043 protected function getClassNamesInNamespace($namespace) { 00044 $namespaceParts = explode('_', $namespace); 00045 if ($namespaceParts[count($namespaceParts) -1] == '') { 00046 00047 } 00048 $classFilePathAndName = t3lib_extMgm::extPath(t3lib_div::camelCaseToLowerCaseUnderscored($namespaceParts[1])) . 'Classes/'; 00049 $classFilePathAndName .= implode(array_slice($namespaceParts, 2, -1), '/') . '/'; 00050 $classNames = array(); 00051 $this->recursiveClassNameSearch($namespace, $classFilePathAndName, $classNames); 00052 00053 sort($classNames); 00054 return $classNames; 00055 00056 } 00057 00058 private function recursiveClassNameSearch($namespace, $directory, &$classNames) { 00059 $dh = opendir($directory); 00060 while (($file = readdir($dh)) !== false) { 00061 if ($file == '.' || $file == '..' || $file == '.svn') continue; 00062 00063 if (is_file($directory . $file)) { 00064 if (substr($file, 0, 8) == 'Abstract') continue; 00065 00066 $classNames[] = $namespace . substr($file, 0, -4); 00067 } elseif (is_dir($directory . $file)) { 00068 $this->recursiveClassNameSearch($namespace . $file . '_' , $directory . $file . '/', $classNames); 00069 } 00070 } 00071 closedir($dh); 00072 } 00073 00074 protected function instanciateViewHelper($className) { 00075 $objectFactory = t3lib_div::makeInstance('Tx_Extbase_Object_ObjectManager'); 00076 return $objectFactory->create($className); 00077 } 00078 } 00079 00080 ?>
1.8.0