/**
     * Renders a download link
     *
     * @param \TYPO3\CMS\Extensionmanager\Domain\Model\Extension $extension
     * @return string the rendered a tag
     */
    public function render(\TYPO3\CMS\Extensionmanager\Domain\Model\Extension $extension)
    {
        $installPaths = \TYPO3\CMS\Extensionmanager\Domain\Model\Extension::returnAllowedInstallPaths();
        if (empty($installPaths)) {
            return '';
        }
        $pathSelector = '<ul class="is-hidden">';
        foreach ($installPaths as $installPathType => $installPath) {
            $pathSelector .= '<li>
				<input type="radio" id="' . htmlspecialchars($extension->getExtensionKey()) . '-downloadPath-' . htmlspecialchars($installPathType) . '" name="' . htmlspecialchars($this->getFieldNamePrefix('downloadPath')) . '[downloadPath]" class="downloadPath" value="' . htmlspecialchars($installPathType) . '"' . ($installPathType == 'Local' ? ' checked="checked"' : '') . '/>
				<label for="' . htmlspecialchars($extension->getExtensionKey()) . '-downloadPath-' . htmlspecialchars($installPathType) . '">' . htmlspecialchars($installPathType) . '</label>
			</li>';
        }
        $pathSelector .= '</ul>';
        $uriBuilder = $this->controllerContext->getUriBuilder();
        $action = 'checkDependencies';
        $uriBuilder->reset();
        $uriBuilder->setFormat('json');
        $uri = $uriBuilder->uriFor($action, array('extension' => (int) $extension->getUid()), 'Download');
        $this->tag->addAttribute('data-href', $uri);
        $label = '
			<div class="btn-group">
				<button
					title="' . LocalizationUtility::translate('extensionList.downloadViewHelper.submit', 'extensionmanager') . '"
					type="submit"
					class="btn btn-default"
					value="' . LocalizationUtility::translate('extensionList.downloadViewHelper.submit', 'extensionmanager') . '"
				>
					<span class="t3-icon fa fa-cloud-download"></span>
				</button>
			</div>';
        $this->tag->setContent($label . $pathSelector);
        $this->tag->addAttribute('class', 'download');
        return '<div id="' . htmlspecialchars($extension->getExtensionKey()) . '-downloadFromTer" class="downloadFromTer">' . $this->tag->render() . '</div>';
    }
    /**
     * Renders a download link
     *
     * @param \TYPO3\CMS\Extensionmanager\Domain\Model\Extension $extension
     * @return string the rendered a tag
     */
    public function render(\TYPO3\CMS\Extensionmanager\Domain\Model\Extension $extension)
    {
        $installPaths = \TYPO3\CMS\Extensionmanager\Domain\Model\Extension::returnAllowedInstallPaths();
        $pathSelector = '<ul>';
        foreach ($installPaths as $installPathType => $installPath) {
            $pathSelector .= '<li>
				<input type="radio" id="' . $extension->getExtensionKey() . '-downloadPath-' . $installPathType . '" name="' . $this->getFieldNamePrefix('downloadPath') . '[downloadPath]" class="downloadPath" value="' . $installPathType . '"' . ($installPathType == 'Local' ? 'checked="checked"' : '') . '/>
				<label for="' . $extension->getExtensionKey() . '-downloadPath-' . $installPathType . '">' . $installPathType . '</label>
			</li>';
        }
        $pathSelector .= '</ul>';
        $uriBuilder = $this->controllerContext->getUriBuilder();
        $action = 'checkDependencies';
        $uriBuilder->reset();
        $uriBuilder->setFormat('json');
        $uri = $uriBuilder->uriFor($action, array('extension' => $extension->getUid()), 'Download');
        $this->tag->addAttribute('href', $uri);
        $label = '<input type="submit" value="Import and Install" />';
        $this->tag->setContent($label . $pathSelector);
        $this->tag->addAttribute('class', 'download');
        return '<div id="' . $extension->getExtensionKey() . '-downloadFromTer" class="downloadFromTer">' . $this->tag->render() . '</div>';
    }
예제 #3
0
 /**
  * Is the given path a valid path for extension installation
  *
  * @param string $path the absolute (!) path in question
  * @return bool
  */
 public function isValidExtensionPath($path)
 {
     $allowedPaths = Extension::returnAllowedInstallPaths();
     foreach ($allowedPaths as $allowedPath) {
         if (GeneralUtility::isFirstPartOfStr($path, $allowedPath)) {
             return true;
         }
     }
     return false;
 }
 /**
  * Is the given path a valid path for extension installation
  *
  * @param string $path the absolute (!) path in question
  * @return boolean
  */
 public function isValidExtensionPath($path)
 {
     $allowedPaths = \TYPO3\CMS\Extensionmanager\Domain\Model\Extension::returnAllowedInstallPaths();
     foreach ($allowedPaths as $allowedPath) {
         if (GeneralUtility::isFirstPartOfStr($path, $allowedPath)) {
             return TRUE;
         }
     }
     return FALSE;
 }
 /**
  * Copies locally provided extensions to typo3conf/ext
  *
  * @param array $copyQueue
  * @return void
  */
 protected function copyDependencies(array $copyQueue)
 {
     $installPaths = Extension::returnAllowedInstallPaths();
     foreach ($copyQueue as $extensionKey => $sourceFolder) {
         $destination = $installPaths['Local'] . $extensionKey;
         GeneralUtility::mkdir($destination);
         GeneralUtility::copyDirectory($sourceFolder . $extensionKey, $destination);
         $this->markExtensionForInstallation($extensionKey);
         $this->downloadQueue->removeExtensionFromCopyQueue($extensionKey);
     }
 }