* @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ use Joomla\CMS\Factory; use Joomla\CMS\Language\Text; use Joomla\CMS\HTML\HTMLHelper as Html; use Joomla\CMS\Layout\LayoutHelper; use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper; use VDM\Joomla\Utilities\ArrayHelper; use VDM\Joomla\Componentbuilder\Compiler\Factory as CompilerFactory; use Joomla\CMS\Uri\Uri; use Joomla\CMS\Router\Route; use Joomla\CMS\Version; // No direct access to this file defined('JPATH_BASE') or die; function computeZipUrls(object $model): array { $componentUrl = null; $moduleUrls = []; $pluginUrls = []; // Component URL $componentPath = $model->compiler->filepath['component'] ?? ''; if ($componentPath !== '' && ($pos = strpos($componentPath, '/tmp/')) !== false) { $componentUrl = Uri::root() . substr($componentPath, $pos + 1); } // Module URLs if (!empty($model->compiler->filepath['modules']) && is_array($model->compiler->filepath['modules'])) { foreach ($model->compiler->filepath['modules'] as $moduleId => $modulePath) { $path = (string) $modulePath; if ($path !== '' && ($pos = strpos($path, '/tmp/')) !== false) { $moduleUrls[(int) $moduleId] = Uri::root() . substr($path, $pos + 1); } } } // Plugin URLs if (!empty($model->compiler->filepath['plugins']) && is_array($model->compiler->filepath['plugins'])) { foreach ($model->compiler->filepath['plugins'] as $pluginId => $pluginPath) { $path = (string) $pluginPath; if ($path !== '' && ($pos = strpos($path, '/tmp/')) !== false) { $pluginUrls[(int) $pluginId] = Uri::root() . substr($path, $pos + 1); } } } return [ 'componentUrl' => $componentUrl, 'moduleUrls' => $moduleUrls, 'pluginUrls' => $pluginUrls, ]; } $urls = computeZipUrls($displayData); $hasPlugins = ArrayHelper::check($displayData->compiler->filepath['plugins'] ?? [], true); $hasModules = ArrayHelper::check($displayData->compiler->filepath['modules'] ?? [], true); $multi = ($hasPlugins || $hasModules); $componentFolder = $displayData->compiler->filepath['component-folder'] ?? ''; $redirect = Route::_('index.php?option=com_componentbuilder&view=compiler', false); $allowInstall = ((int) (CompilerFactory::_('Config')->joomla_version ?? 0) === (int) Version::MAJOR_VERSION); ?>

$displayData, 'has_modules' => $hasModules, 'has_plugins' => $hasPlugins, 'multi' => $multi]); ?> $displayData, 'urls' => $urls]); ?> $displayData, 'url' => $urls['componentUrl'] ?? null]); ?>

.