TYPO3 CMS  TYPO3_6-2
MiscUtility.php
Go to the documentation of this file.
1 <?php
3 
18 
24 class MiscUtility {
25 
32  static public function getExtensionMetaData($extensionKey) {
33  $_EXTKEY = $extensionKey;
34  $EM_CONF = array();
35  $extPath = ExtensionManagementUtility::extPath($extensionKey);
36  include($extPath . 'ext_emconf.php');
37 
38  $release = $EM_CONF[$_EXTKEY]['version'];
39  list($major, $minor, $_) = explode('.', $release, 3);
40  if (($pos = strpos($minor, '-')) !== FALSE) {
41  // $minor ~ '2-dev'
42  $minor = substr($minor, 0, $pos);
43  }
44  $EM_CONF[$_EXTKEY]['version'] = $major . '.' . $minor;
45  $EM_CONF[$_EXTKEY]['release'] = $release;
46  $EM_CONF[$_EXTKEY]['extensionKey'] = $extensionKey;
47 
48  return $EM_CONF[$_EXTKEY];
49  }
50 
57  static public function getIcon($documentKey) {
58  $basePath = 'typo3conf/Documentation/';
59  $documentPath = $basePath . $documentKey . '/';
60 
61  // Fallback icon
62  $icon = ExtensionManagementUtility::siteRelPath('documentation') . 'ext_icon.gif';
63 
64  if (\TYPO3\CMS\Core\Utility\GeneralUtility::isFirstPartOfStr($documentKey, 'typo3cms.extensions.')) {
65  // Standard extension icon
66  $extensionKey = substr($documentKey, 20);
67  if (ExtensionManagementUtility::isLoaded($extensionKey)) {
68  $extensionPath = ExtensionManagementUtility::extPath($extensionKey);
69  $siteRelativePath = ExtensionManagementUtility::siteRelPath($extensionKey);
70  $icon = $siteRelativePath . ExtensionManagementUtility::getExtensionIcon($extensionPath);
71  }
72  } elseif (is_file(PATH_site . $documentPath . 'icon.png')) {
73  $icon = $documentPath . 'icon.png';
74  } elseif (is_file(PATH_site . $documentPath . 'icon.gif')) {
75  $icon = $documentPath . 'icon.gif';
76  }
77 
78  return $icon;
79  }
80 
81 }
static getExtensionIcon($extensionPath, $returnFullPath=FALSE)
$EM_CONF[$_EXTKEY]
Definition: ext_emconf.php:2