Exemplo n.º 1
0
 /**
  * Set the download path
  *
  * @param string $downloadPath
  * @throws \TYPO3\CMS\Extensionmanager\Exception\ExtensionManagerException
  * @return void
  */
 public function setDownloadPath($downloadPath)
 {
     if (!in_array($downloadPath, \TYPO3\CMS\Extensionmanager\Domain\Model\Extension::returnAllowedInstallTypes())) {
         throw new \TYPO3\CMS\Extensionmanager\Exception\ExtensionManagerException(htmlspecialchars($downloadPath) . ' not in allowed download paths', 1344766387);
     }
     $this->downloadPath = $downloadPath;
 }
 /**
  * Renders an install link
  *
  * @param string $extension
  * @return string the rendered a tag
  */
 public function render($extension)
 {
     if (!in_array($extension['type'], \TYPO3\CMS\Extensionmanager\Domain\Model\Extension::returnAllowedInstallTypes())) {
         return '';
     }
     $uriBuilder = $this->controllerContext->getUriBuilder();
     $action = 'removeExtension';
     $uriBuilder->reset();
     $uriBuilder->setFormat('json');
     $uri = $uriBuilder->uriFor($action, array('extension' => $extension['key']), 'Action');
     $this->tag->addAttribute('href', $uri);
     $cssClass = 'removeExtension';
     if (\TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded($extension['key'])) {
         $cssClass .= ' isLoadedWarning';
     }
     $this->tag->addAttribute('class', $cssClass);
     $label = 'Remove';
     $this->tag->setContent($label);
     return $this->tag->render();
 }
 /**
  * Renders an install link
  *
  * @param array $extension
  * @return string the rendered a tag
  */
 public function render($extension)
 {
     if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded($extension['key'])) {
         return '<span class="btn btn-default disabled">' . IconUtility::getSpriteIcon('empty-empty') . '</span>';
     }
     if (!in_array($extension['type'], \TYPO3\CMS\Extensionmanager\Domain\Model\Extension::returnAllowedInstallTypes()) || $extension['type'] === 'System') {
         return '<span class="btn btn-default disabled">' . IconUtility::getSpriteIcon('empty-empty') . '</span>';
     }
     $uriBuilder = $this->controllerContext->getUriBuilder();
     $action = 'removeExtension';
     $uriBuilder->reset();
     $uriBuilder->setFormat('json');
     $uri = $uriBuilder->uriFor($action, array('extension' => $extension['key']), 'Action');
     $this->tag->addAttribute('href', $uri);
     $cssClass = 'removeExtension btn btn-default';
     $this->tag->addAttribute('class', $cssClass);
     $this->tag->addAttribute('title', \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('extensionList.remove', 'extensionmanager'));
     $this->tag->setContent(\TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-edit-delete'));
     return $this->tag->render();
 }
Exemplo n.º 4
0
 /**
  * Checks if the extension is able to install at the demanded location
  *
  * @param string $location            The location
  * @param array  $allowedInstallTypes The allowed locations
  *
  * @return boolean
  * @throws \InvalidArgumentException
  */
 protected function checkInstallLocation($location)
 {
     $allowedInstallTypes = Extension::returnAllowedInstallTypes();
     $location = ucfirst(strtolower($location));
     if (!in_array($location, $allowedInstallTypes)) {
         if ($location === 'Global') {
             throw new InvalidArgumentException('Global installation is not allowed!');
         }
         if ($location === 'Local') {
             throw new InvalidArgumentException('Local installation is not allowed!');
         }
         if ($location === 'System') {
             throw new InvalidArgumentException('System installation is not allowed!');
         }
         throw new InvalidArgumentException(sprintf('Unknown location "%s"!', $location));
     }
 }