Stable release of v5.0.0-alpha1

First alpha release of Component Builder towards Joomla 5 (very unstable...).
This commit is contained in:
2024-03-09 21:52:51 +02:00
parent 3c91a5cdbb
commit 87cd4305bb
3040 changed files with 296309 additions and 269802 deletions

View File

@@ -196,9 +196,7 @@ class Dispenser implements DispenserInterface
$script .= $note;
}
// load the actual script
$script .= $prefix . str_replace(
array_keys($this->placeholder->active),
array_values($this->placeholder->active),
$script .= $prefix . $this->placeholder->update_(
(string) $this->hub[$first][$second]
) . $suffix;
// clear some memory

View File

@@ -60,45 +60,38 @@ class External implements ExternalInterface
/**
* Database object to query local DB
*
* @var \JDatabaseDriver
* @since 3.2.0
**/
protected \JDatabaseDriver $db;
protected $db;
/**
* User object
*
* @var User
* @since 3.2.0
**/
protected User $user;
protected $user;
/**
* Database object to query local DB
*
* @var CMSApplication
* @since 3.2.0
**/
protected CMSApplication $app;
protected $app;
/**
* Constructor.
*
* @param Placeholder|null $placeholder The compiler placeholder object.
* @param \JDatabaseDriver|null $db The Database Driver object.
* @param User|null $user The User object.
* @param CMSApplication|null $app The CMS Application object.
*
* @throws \Exception
* @since 3.2.0
*/
public function __construct(?Placeholder $placeholder = null,
?\JDatabaseDriver $db = null, ?User $user = null, ?CMSApplication $app = null)
public function __construct(?Placeholder $placeholder = null)
{
$this->placeholder = $placeholder ?: Compiler::_('Placeholder');
$this->db = $db ?: Factory::getDbo();
$this->user = $user ?: Factory::getUser();
$this->app = $app ?: Factory::getApplication();
$this->db = Factory::getDbo();
$this->user = Factory::getUser();
$this->app = Factory::getApplication();
}
/**

View File

@@ -16,7 +16,8 @@ use Joomla\CMS\Factory;
use Joomla\CMS\User\User;
use Joomla\CMS\Filesystem\Folder;
use Joomla\CMS\Application\CMSApplication;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Version;
use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Utilities\StringHelper;
use VDM\Joomla\Componentbuilder\Compiler\Factory as Compiler;
@@ -83,6 +84,14 @@ class Extractor implements ExtractorInterface
4 => 'INSERTED<>$$$$]'
];
/**
* Current Joomla Version We are IN
*
* @var int
* @since 3.2.0
**/
protected int $currentVersion;
/**
* The custom code in local files that already exist in system
*
@@ -190,26 +199,23 @@ class Extractor implements ExtractorInterface
/**
* Current User Object
*
* @var User
* @since 3.2.0
**/
protected User $user;
protected $user;
/**
* Database object to query local DB
*
* @var \JDatabaseDriver
* @since 3.2.0
**/
protected \JDatabaseDriver $db;
protected $db;
/**
* Database object to query local DB
*
* @var CMSApplication
* @since 3.2.0
**/
protected CMSApplication $app;
protected $app;
/**
* Constructor.
@@ -220,16 +226,12 @@ class Extractor implements ExtractorInterface
* @param Reverse|null $reverse The compiler placeholder reverse object.
* @param Placeholder|null $placeholder The compiler component placeholder object.
* @param Pathfix|null $pathfix The compiler path fixing object.
* @param User|null $user The current User object.
* @param \JDatabaseDriver|null $db The Database Driver object.
* @param CMSApplication|null $app The CMS Application object.
*
* @throws \Exception
* @since 3.2.0
*/
public function __construct(?Config $config = null, ?Gui $gui = null, ?Paths $paths = null,
?Reverse $reverse = null, ?Placeholder $placeholder = null, ?Pathfix $pathfix = null,
?User $user = null, ?\JDatabaseDriver $db = null, ?CMSApplication $app = null)
?Reverse $reverse = null, ?Placeholder $placeholder = null, ?Pathfix $pathfix = null)
{
$this->config = $config ?: Compiler::_('Config');
$this->gui = $gui ?: Compiler::_('Customcode.Gui');
@@ -237,9 +239,9 @@ class Extractor implements ExtractorInterface
$this->reverse = $reverse ?: Compiler::_('Placeholder.Reverse');
$this->componentPlaceholder = $placeholder ?: Compiler::_('Component.Placeholder');
$this->pathfix = $pathfix ?: Compiler::_('Utilities.Pathfix');
$this->user = $user ?: Factory::getUser();
$this->db = $db ?: Factory::getDbo();
$this->app = $app ?: Factory::getApplication();
$this->user = Factory::getUser();
$this->db = Factory::getDbo();
$this->app = Factory::getApplication();
// set today's date
$this->today = Factory::getDate()->toSql();
@@ -261,6 +263,9 @@ class Extractor implements ExtractorInterface
// set the local placeholders
$this->placeholders = array_reverse($placeholders, true);
// set the current version
$this->currentVersion = (int) Version::MAJOR_VERSION;
}
/**
@@ -613,6 +618,11 @@ class Extractor implements ExtractorInterface
1
); // 'target'
$this->new[$pointer[$targetKey]][]
= $this->db->quote(
$this->currentVersion
); // 'joomla_version'
$this->new[$pointer[$targetKey]][]
= $this->db->quote(
$commentType
@@ -766,7 +776,7 @@ class Extractor implements ExtractorInterface
$query = $this->db->getQuery(true);
$continue = false;
// Insert columns.
$columns = array('path', 'type', 'target', 'comment_type',
$columns = array('path', 'type', 'target', 'joomla_version', 'comment_type',
'component', 'published', 'created', 'created_by',
'version', 'access', 'hashtarget', 'from_line',
'to_line', 'code', 'hashendtarget');

View File

@@ -84,10 +84,9 @@ class Paths
/**
* Database object to query local DB
*
* @var \JDatabaseDriver
* @since 3.2.0
**/
protected \JDatabaseDriver $db;
protected $db;
/**
* Constructor.
@@ -97,14 +96,13 @@ class Paths
* @param ComponentPlaceholder|null $componentPlaceholder The compiler component placeholder object.
* @param Customcode|null $customcode The compiler customcode object.
* @param Extractor|null $extractor The compiler language extractor object.
* @param \JDatabaseDriver|null $db The Database Driver object.
*
* @throws \Exception
* @since 3.2.0
*/
public function __construct(?Config $config = null, ?Placeholder $placeholder = null,
?ComponentPlaceholder $componentPlaceholder = null, ?Customcode $customcode = null,
?Extractor $extractor = null, ?\JDatabaseDriver $db = null)
?Extractor $extractor = null)
{
$this->config = $config ?: Compiler::_('Config');
$this->placeholder = $placeholder ?: Compiler::_('Placeholder');
@@ -112,7 +110,7 @@ class Paths
$componentPlaceholder = $componentPlaceholder ?: Compiler::_('Component.Placeholder');
$this->customcode = $customcode ?: Compiler::_('Customcode');
$this->extractor = $extractor ?: Compiler::_('Language.Extractor');
$this->db = $db ?: Factory::getDbo();
$this->db = Factory::getDbo();
// load the placeholders to local array
$this->componentPlaceholder = $componentPlaceholder->get();

View File

@@ -61,18 +61,16 @@ class Gui implements GuiInterface
/**
* Database object to query local DB
*
* @var \JDatabaseDriver
* @since 3.2.0
**/
protected \JDatabaseDriver $db;
protected $db;
/**
* Database object to query local DB
*
* @var CMSApplication
* @since 3.2.0
**/
protected CMSApplication $app;
protected $app;
/**
* Constructor.
@@ -80,20 +78,17 @@ class Gui implements GuiInterface
* @param Config|null $config The compiler config object.
* @param Reverse|null $reverse The compiler placeholder reverse object.
* @param Parser|null $parser The powers parser object.
* @param \JDatabaseDriver|null $db The Database Driver object.
* @param CMSApplication|null $app The CMS Application object.
*
* @throws \Exception
* @since 3.2.0
*/
public function __construct(?Config $config = null, ?Reverse $reverse = null, ?Parser $parser = null,
?\JDatabaseDriver $db = null, ?CMSApplication $app = null)
public function __construct(?Config $config = null, ?Reverse $reverse = null, ?Parser $parser = null)
{
$this->config = $config ?: Compiler::_('Config');
$this->reverse = $reverse ?: Compiler::_('Placeholder.Reverse');
$this->parser = $parser ?: Compiler::_('Power.Parser');
$this->db = $db ?: Factory::getDbo();
$this->app = $app ?: Factory::getApplication();
$this->db = Factory::getDbo();
$this->app = Factory::getApplication();
}
/**