2022-08-30 15:28:41 +00:00
|
|
|
<?php
|
2022-09-20 11:06:03 +00:00
|
|
|
/**
|
|
|
|
* @package Joomla.Component.Builder
|
|
|
|
*
|
2022-12-04 09:23:43 +00:00
|
|
|
* @created 4th September, 2022
|
2022-09-20 11:06:03 +00:00
|
|
|
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
|
|
|
* @git Joomla Component Builder <https://git.vdm.dev/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
|
|
|
|
*/
|
2022-08-30 15:28:41 +00:00
|
|
|
|
|
|
|
namespace VDM\Joomla\Componentbuilder\Compiler\Service;
|
|
|
|
|
|
|
|
|
|
|
|
use Joomla\DI\Container;
|
|
|
|
use Joomla\DI\ServiceProviderInterface;
|
2023-02-12 19:15:41 +00:00
|
|
|
use VDM\Joomla\Componentbuilder\Compiler\Component as CompilerComponent;
|
2024-03-02 20:10:30 +00:00
|
|
|
use VDM\Joomla\Componentbuilder\Compiler\Component\JoomlaThree\Settings as J3Settings;
|
|
|
|
use VDM\Joomla\Componentbuilder\Compiler\Component\JoomlaFour\Settings as J4Settings;
|
2024-03-07 19:23:32 +00:00
|
|
|
use VDM\Joomla\Componentbuilder\Compiler\Component\JoomlaFive\Settings as J5Settings;
|
2023-02-12 19:15:41 +00:00
|
|
|
use VDM\Joomla\Componentbuilder\Compiler\Component\Dashboard;
|
|
|
|
use VDM\Joomla\Componentbuilder\Compiler\Component\Placeholder;
|
|
|
|
use VDM\Joomla\Componentbuilder\Compiler\Component\Data;
|
|
|
|
use VDM\Joomla\Componentbuilder\Compiler\Component\Structure;
|
|
|
|
use VDM\Joomla\Componentbuilder\Compiler\Component\Structuresingle;
|
|
|
|
use VDM\Joomla\Componentbuilder\Compiler\Component\Structuremultiple;
|
2024-03-02 20:10:30 +00:00
|
|
|
use VDM\Joomla\Componentbuilder\Compiler\Interfaces\Component\SettingsInterface as Settings;
|
2022-08-30 15:28:41 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Component Service Provider
|
|
|
|
*
|
|
|
|
* @since 3.2.0
|
|
|
|
*/
|
|
|
|
class Component implements ServiceProviderInterface
|
|
|
|
{
|
2024-03-02 20:10:30 +00:00
|
|
|
/**
|
|
|
|
* Current Joomla Version Being Build
|
|
|
|
*
|
|
|
|
* @var int
|
|
|
|
* @since 3.2.0
|
|
|
|
**/
|
|
|
|
protected $targetVersion;
|
|
|
|
|
2022-08-30 15:28:41 +00:00
|
|
|
/**
|
|
|
|
* Registers the service provider with a DI container.
|
|
|
|
*
|
|
|
|
* @param Container $container The DI container.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
* @since 3.2.0
|
|
|
|
*/
|
|
|
|
public function register(Container $container)
|
|
|
|
{
|
2023-02-12 19:15:41 +00:00
|
|
|
$container->alias(CompilerComponent::class, 'Component')
|
2024-03-02 20:10:30 +00:00
|
|
|
->share('Component', [$this, 'getCompilerComponent'], true);
|
2023-01-22 00:38:21 +00:00
|
|
|
|
2024-03-02 20:10:30 +00:00
|
|
|
$container->alias(J3Settings::class, 'Component.J3.Settings')
|
|
|
|
->share('Component.J3.Settings', [$this, 'getJ3Settings'], true);
|
|
|
|
|
|
|
|
$container->alias(J4Settings::class, 'Component.J4.Settings')
|
|
|
|
->share('Component.J4.Settings', [$this, 'getJ4Settings'], true);
|
2023-01-22 00:38:21 +00:00
|
|
|
|
2024-03-07 19:23:32 +00:00
|
|
|
$container->alias(J5Settings::class, 'Component.J5.Settings')
|
|
|
|
->share('Component.J5.Settings', [$this, 'getJ5Settings'], true);
|
|
|
|
|
2023-02-12 19:15:41 +00:00
|
|
|
$container->alias(Dashboard::class, 'Component.Dashboard')
|
|
|
|
->share('Component.Dashboard', [$this, 'getDashboard'], true);
|
|
|
|
|
|
|
|
$container->alias(Placeholder::class, 'Component.Placeholder')
|
|
|
|
->share('Component.Placeholder', [$this, 'getPlaceholder'], true);
|
|
|
|
|
|
|
|
$container->alias(Data::class, 'Component.Data')
|
|
|
|
->share('Component.Data', [$this, 'getData'], true);
|
|
|
|
|
|
|
|
$container->alias(Structure::class, 'Component.Structure')
|
|
|
|
->share('Component.Structure', [$this, 'getStructure'], true);
|
|
|
|
|
|
|
|
$container->alias(Structuresingle::class, 'Component.Structure.Single')
|
|
|
|
->share('Component.Structure.Single', [$this, 'getStructuresingle'], true);
|
|
|
|
|
|
|
|
$container->alias(Structuremultiple::class, 'Component.Structure.Multiple')
|
|
|
|
->share('Component.Structure.Multiple', [$this, 'getStructuremultiple'], true);
|
2024-03-02 20:10:30 +00:00
|
|
|
|
|
|
|
$container->alias(Settings::class, 'Component.Settings')
|
|
|
|
->share('Component.Settings', [$this, 'getSettings'], true);
|
2023-01-22 00:38:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2024-03-02 20:10:30 +00:00
|
|
|
* Get The Component Class.
|
2023-01-22 00:38:21 +00:00
|
|
|
*
|
|
|
|
* @param Container $container The DI container.
|
|
|
|
*
|
2023-02-12 19:15:41 +00:00
|
|
|
* @return CompilerComponent
|
2023-01-22 00:38:21 +00:00
|
|
|
* @since 3.2.0
|
|
|
|
*/
|
2024-03-02 20:10:30 +00:00
|
|
|
public function getCompilerComponent(Container $container): CompilerComponent
|
2023-01-22 00:38:21 +00:00
|
|
|
{
|
2023-02-12 19:15:41 +00:00
|
|
|
return new CompilerComponent(
|
2023-01-22 00:38:21 +00:00
|
|
|
$container->get('Component.Data')
|
|
|
|
);
|
2022-08-30 15:28:41 +00:00
|
|
|
}
|
|
|
|
|
2023-02-12 19:15:41 +00:00
|
|
|
/**
|
2024-03-02 20:10:30 +00:00
|
|
|
* Get The Settings Class.
|
2023-02-12 19:15:41 +00:00
|
|
|
*
|
|
|
|
* @param Container $container The DI container.
|
|
|
|
*
|
2024-03-02 20:10:30 +00:00
|
|
|
* @return J3Settings
|
2023-02-12 19:15:41 +00:00
|
|
|
* @since 3.2.0
|
|
|
|
*/
|
2024-03-02 20:10:30 +00:00
|
|
|
public function getJ3Settings(Container $container): J3Settings
|
2023-02-12 19:15:41 +00:00
|
|
|
{
|
2024-03-02 20:10:30 +00:00
|
|
|
return new J3Settings(
|
2023-02-12 19:15:41 +00:00
|
|
|
$container->get('Config'),
|
|
|
|
$container->get('Registry'),
|
|
|
|
$container->get('Event'),
|
|
|
|
$container->get('Placeholder'),
|
|
|
|
$container->get('Component'),
|
|
|
|
$container->get('Utilities.Paths'),
|
|
|
|
$container->get('Utilities.Dynamicpath'),
|
|
|
|
$container->get('Utilities.Pathfix')
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2024-03-02 20:10:30 +00:00
|
|
|
* Get The Settings Class.
|
|
|
|
*
|
|
|
|
* @param Container $container The DI container.
|
|
|
|
*
|
|
|
|
* @return J4Settings
|
|
|
|
* @since 3.2.0
|
|
|
|
*/
|
|
|
|
public function getJ4Settings(Container $container): J4Settings
|
|
|
|
{
|
|
|
|
return new J4Settings(
|
|
|
|
$container->get('Config'),
|
|
|
|
$container->get('Registry'),
|
|
|
|
$container->get('Event'),
|
|
|
|
$container->get('Placeholder'),
|
|
|
|
$container->get('Component'),
|
|
|
|
$container->get('Utilities.Paths'),
|
|
|
|
$container->get('Utilities.Dynamicpath'),
|
|
|
|
$container->get('Utilities.Pathfix')
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2024-03-07 19:23:32 +00:00
|
|
|
/**
|
|
|
|
* Get The Settings Class.
|
|
|
|
*
|
|
|
|
* @param Container $container The DI container.
|
|
|
|
*
|
|
|
|
* @return J5Settings
|
|
|
|
* @since 3.2.0
|
|
|
|
*/
|
|
|
|
public function getJ5Settings(Container $container): J5Settings
|
|
|
|
{
|
|
|
|
return new J5Settings(
|
|
|
|
$container->get('Config'),
|
|
|
|
$container->get('Registry'),
|
|
|
|
$container->get('Event'),
|
|
|
|
$container->get('Placeholder'),
|
|
|
|
$container->get('Component'),
|
|
|
|
$container->get('Utilities.Paths'),
|
|
|
|
$container->get('Utilities.Dynamicpath'),
|
|
|
|
$container->get('Utilities.Pathfix')
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2024-03-02 20:10:30 +00:00
|
|
|
/**
|
|
|
|
* Get The Dashboard Class.
|
2023-02-12 19:15:41 +00:00
|
|
|
*
|
|
|
|
* @param Container $container The DI container.
|
|
|
|
*
|
|
|
|
* @return Dashboard
|
|
|
|
* @since 3.2.0
|
|
|
|
*/
|
|
|
|
public function getDashboard(Container $container): Dashboard
|
|
|
|
{
|
|
|
|
return new Dashboard(
|
|
|
|
$container->get('Registry'),
|
|
|
|
$container->get('Component')
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2022-08-30 15:28:41 +00:00
|
|
|
/**
|
2024-03-02 20:10:30 +00:00
|
|
|
* Get The Placeholder Class.
|
2022-08-30 15:28:41 +00:00
|
|
|
*
|
|
|
|
* @param Container $container The DI container.
|
|
|
|
*
|
2023-02-12 19:15:41 +00:00
|
|
|
* @return Placeholder
|
2022-08-30 15:28:41 +00:00
|
|
|
* @since 3.2.0
|
|
|
|
*/
|
2023-02-12 19:15:41 +00:00
|
|
|
public function getPlaceholder(Container $container): Placeholder
|
2022-08-30 15:28:41 +00:00
|
|
|
{
|
2023-02-12 19:15:41 +00:00
|
|
|
return new Placeholder(
|
2022-08-30 15:28:41 +00:00
|
|
|
$container->get('Config')
|
|
|
|
);
|
2023-01-22 00:38:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2024-03-02 20:10:30 +00:00
|
|
|
* Get The Data Class.
|
2023-01-22 00:38:21 +00:00
|
|
|
*
|
|
|
|
* @param Container $container The DI container.
|
|
|
|
*
|
2023-02-12 19:15:41 +00:00
|
|
|
* @return Data
|
2023-01-22 00:38:21 +00:00
|
|
|
* @since 3.2.0
|
|
|
|
*/
|
2023-02-12 19:15:41 +00:00
|
|
|
public function getData(Container $container): Data
|
2023-01-22 00:38:21 +00:00
|
|
|
{
|
2023-02-12 19:15:41 +00:00
|
|
|
return new Data(
|
2023-01-22 00:38:21 +00:00
|
|
|
$container->get('Config'),
|
|
|
|
$container->get('Event'),
|
|
|
|
$container->get('Placeholder'),
|
|
|
|
$container->get('Component.Placeholder'),
|
|
|
|
$container->get('Customcode.Dispenser'),
|
|
|
|
$container->get('Customcode'),
|
|
|
|
$container->get('Customcode.Gui'),
|
|
|
|
$container->get('Field'),
|
|
|
|
$container->get('Field.Name'),
|
|
|
|
$container->get('Field.Unique.Name'),
|
|
|
|
$container->get('Model.Filesfolders'),
|
|
|
|
$container->get('Model.Historycomponent'),
|
|
|
|
$container->get('Model.Whmcs'),
|
|
|
|
$container->get('Model.Sqltweaking'),
|
|
|
|
$container->get('Model.Adminviews'),
|
|
|
|
$container->get('Model.Siteviews'),
|
|
|
|
$container->get('Model.Customadminviews'),
|
2023-02-27 12:27:41 +00:00
|
|
|
$container->get('Model.Updateserver'),
|
2023-01-22 00:38:21 +00:00
|
|
|
$container->get('Model.Joomlamodules'),
|
2024-03-02 20:10:30 +00:00
|
|
|
$container->get('Model.Joomlaplugins'),
|
|
|
|
$container->get('Model.Router')
|
2023-01-22 00:38:21 +00:00
|
|
|
);
|
2023-02-12 19:15:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2024-03-02 20:10:30 +00:00
|
|
|
* Get The Structure Class.
|
2023-02-12 19:15:41 +00:00
|
|
|
*
|
|
|
|
* @param Container $container The DI container.
|
|
|
|
*
|
|
|
|
* @return Structure
|
|
|
|
* @since 3.2.0
|
|
|
|
*/
|
|
|
|
public function getStructure(Container $container): Structure
|
|
|
|
{
|
|
|
|
return new Structure(
|
|
|
|
$container->get('Component.Settings'),
|
|
|
|
$container->get('Utilities.Paths'),
|
|
|
|
$container->get('Utilities.Folder')
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2024-03-02 20:10:30 +00:00
|
|
|
* Get The Structuresingle Class.
|
2023-02-12 19:15:41 +00:00
|
|
|
*
|
|
|
|
* @param Container $container The DI container.
|
|
|
|
*
|
|
|
|
* @return Structuresingle
|
|
|
|
* @since 3.2.0
|
|
|
|
*/
|
|
|
|
public function getStructuresingle(Container $container): Structuresingle
|
|
|
|
{
|
|
|
|
return new Structuresingle(
|
|
|
|
$container->get('Config'),
|
|
|
|
$container->get('Registry'),
|
2024-03-02 20:10:30 +00:00
|
|
|
$container->get('Placeholder'),
|
2023-02-12 19:15:41 +00:00
|
|
|
$container->get('Component.Settings'),
|
|
|
|
$container->get('Component'),
|
2023-10-18 07:26:30 +00:00
|
|
|
$container->get('Compiler.Builder.Content.One'),
|
2023-02-12 19:15:41 +00:00
|
|
|
$container->get('Utilities.Counter'),
|
|
|
|
$container->get('Utilities.Paths'),
|
|
|
|
$container->get('Utilities.Files')
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2024-03-02 20:10:30 +00:00
|
|
|
* Get The Structuremultiple Class.
|
2023-02-12 19:15:41 +00:00
|
|
|
*
|
|
|
|
* @param Container $container The DI container.
|
|
|
|
*
|
|
|
|
* @return Structuremultiple
|
|
|
|
* @since 3.2.0
|
|
|
|
*/
|
|
|
|
public function getStructuremultiple(Container $container): Structuremultiple
|
|
|
|
{
|
|
|
|
return new Structuremultiple(
|
|
|
|
$container->get('Config'),
|
|
|
|
$container->get('Registry'),
|
|
|
|
$container->get('Component.Settings'),
|
|
|
|
$container->get('Component'),
|
|
|
|
$container->get('Model.Createdate'),
|
|
|
|
$container->get('Model.Modifieddate'),
|
|
|
|
$container->get('Utilities.Structure')
|
|
|
|
);
|
|
|
|
}
|
2024-03-02 20:10:30 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get The Settings Class.
|
|
|
|
*
|
|
|
|
* @param Container $container The DI container.
|
|
|
|
*
|
|
|
|
* @return Settings
|
|
|
|
* @since 3.2.0
|
|
|
|
*/
|
|
|
|
public function getSettings(Container $container): Settings
|
|
|
|
{
|
|
|
|
if (empty($this->targetVersion))
|
|
|
|
{
|
|
|
|
$this->targetVersion = $container->get('Config')->joomla_version;
|
|
|
|
}
|
|
|
|
|
|
|
|
return $container->get('Component.J' . $this->targetVersion . '.Settings');
|
|
|
|
}
|
2022-08-30 15:28:41 +00:00
|
|
|
}
|
|
|
|
|