/** * Returns the list of local extensions. * * @return array */ public function getLocalExtensions() { $documents = array(); foreach ($GLOBALS['TYPO3_LOADED_EXT'] as $extensionKey => $extensionData) { $absoluteExtensionPath = GeneralUtility::getFileAbsFileName($extensionData['siteRelPath']); if (is_file($absoluteExtensionPath . 'README.rst') || is_file($absoluteExtensionPath . 'Documentation' . DIRECTORY_SEPARATOR . 'Index.rst')) { $metadata = \TYPO3\CMS\Documentation\Utility\MiscUtility::getExtensionMetaData($extensionKey); if ($extensionData['type'] === 'S') { $version = TYPO3_branch; } else { $version = substr($metadata['release'], -4) === '-dev' ? 'latest' : $metadata['release']; } $documentKey = 'typo3cms.extensions.' . $extensionKey; $documents[] = array('title' => $metadata['title'], 'icon' => \TYPO3\CMS\Documentation\Utility\MiscUtility::getIcon($documentKey), 'type' => 'Extension', 'key' => $documentKey, 'shortcut' => $extensionKey, 'url' => 'http://docs.typo3.org/typo3cms/extensions/' . $extensionKey . '/', 'version' => $version); } } return $documents; }
/** * Returns metadata associated to a given document key. * * @param string $documentKey * @param string $language * @return array */ protected function getMetadata($documentKey, $language) { $documentPath = PATH_site . 'typo3conf/Documentation/' . $documentKey . '/' . $language . '/'; $metadata = array( 'title' => $documentKey, 'description' => '', ); if (GeneralUtility::isFirstPartOfStr($documentKey, 'typo3cms.extensions.')) { $extensionKey = substr($documentKey, 20); if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded($extensionKey)) { $metadata = \TYPO3\CMS\Documentation\Utility\MiscUtility::getExtensionMetaData($extensionKey); } } elseif (is_file($documentPath . 'composer.json')) { $info = json_decode(file_get_contents($documentPath . 'composer.json'), TRUE); if (is_array($info)) { $metadata['title'] = $info['name']; $metadata['description'] = $info['description']; } } return $metadata; }