Release of v5.1.2-alpha3

Migrates view HTML classes to use getModel() directly instead of the deprecated magic get() calls to model methods. Refactores event handling (contentPrepare, titlePrepare, contentBeforeDisplay, contentAfterDisplay) to use Joomla 5’s native event dispatcher via the model’s new getDispatcher() method. Updates table classes to properly support NULL values, both in the store() method and in table variable definitions. #1245. Extractes the setAutoCheckIn() and setCheckInCall() logic into a dedicated CheckInNow class for cleaner design. Replace all direct $app->input property calls with the recommended $app->getInput() method across the entire codebase.
This commit is contained in:
2025-09-03 20:34:41 +00:00
parent 129cdfe8da
commit c0aeb798db
381 changed files with 2788 additions and 1601 deletions

View File

@@ -54,7 +54,7 @@ abstract class ComponentConfig extends FunctionRegistry
*/
public function __construct(?Input $input = null, ?JoomlaRegistry $params = null)
{
$this->input = $input ?: Factory::getApplication()->input;
$this->input = $input ?: Factory::getApplication()->getInput();
$this->params = $params ?: Helper::getParams('com_componentbuilder');
}
}

View File

@@ -72,7 +72,7 @@ final class CheckInNow implements CheckInNowInterface
$checkin .= PHP_EOL . Indent::_(3) . "\$query->where($db->quoteName('checked_out') . ' >= 0');";
Indent::_(3) . "//" . Line::_(__Line__, __Class__) . " Query only to see if we have a rows";
$checkin .= PHP_EOL . Indent::_(3) . "//" . Line::_(__Line__, __Class__) . " Query only to see if we have a rows";
$checkin .= PHP_EOL . Indent::_(3) . "\$db->setQuery(\$query, 0, 1);";
$checkin .= PHP_EOL . Indent::_(3) . "\$db->execute();";
$checkin .= PHP_EOL . Indent::_(3) . "if (\$db->getNumRows())";

View File

@@ -72,7 +72,7 @@ final class CheckInNow implements CheckInNowInterface
$checkin .= PHP_EOL . Indent::_(3) . "\$query->where($db->quoteName('checked_out') . ' >= 0');";
Indent::_(3) . "//" . Line::_(__Line__, __Class__) . " Query only to see if we have a rows";
$checkin .= PHP_EOL . Indent::_(3) . "//" . Line::_(__Line__, __Class__) . " Query only to see if we have a rows";
$checkin .= PHP_EOL . Indent::_(3) . "\$db->setQuery(\$query, 0, 1);";
$checkin .= PHP_EOL . Indent::_(3) . "\$db->execute();";
$checkin .= PHP_EOL . Indent::_(3) . "if (\$db->getNumRows())";

View File

@@ -71,7 +71,7 @@ final class CheckInNow implements CheckInNowInterface
$checkin .= PHP_EOL . Indent::_(3) . "\$query->where(\$db->quoteName('checked_out') . ' != 0');";
Indent::_(3) . "//" . Line::_(__Line__, __Class__) . " Query only to see if we have a rows";
$checkin .= PHP_EOL . Indent::_(3) . "//" . Line::_(__Line__, __Class__) . " Query only to see if we have a rows";
$checkin .= PHP_EOL . Indent::_(3) . "\$db->setQuery(\$query, 0, 1);";
$checkin .= PHP_EOL . Indent::_(3) . "\$db->execute();";
$checkin .= PHP_EOL . Indent::_(3) . "if (\$db->getNumRows())";

View File

@@ -121,13 +121,24 @@ final class FieldonContentPrepare
// build decoder string
if (empty($runplugins))
{
$runplugins = PHP_EOL . $tab . Indent::_(1) . "//"
. Line::_(__Line__, __Class__)
. " Load the JEvent Dispatcher";
$runplugins .= PHP_EOL . $tab . Indent::_(1)
. "PluginHelper::importPlugin('content');";
$runplugins .= PHP_EOL . $tab . Indent::_(1)
. '$this->_dispatcher = Joomla__'.'_39403062_84fb_46e0_bac4_0023f766e827___Power::getApplication();';
if ($this->config->get('joomla_version', 3) == 3)
{
$runplugins = PHP_EOL . $tab . Indent::_(1) . "//"
. Line::_(__Line__, __Class__)
. " Load the Event Dispatcher";
$runplugins .= PHP_EOL . $tab . Indent::_(1)
. "Joomla__" . "_7934665b_e432_4ec6_b38d_27bf32730eb9___Power::importPlugin('content');";
$runplugins .= PHP_EOL . $tab . Indent::_(1)
. '$this->_dispatcher = Joomla__'.'_39403062_84fb_46e0_bac4_0023f766e827___Power::getApplication();';
}
else
{
$runplugins = PHP_EOL . $tab . Indent::_(1) . "//"
. Line::_(__Line__, __Class__)
. " Load the Event Dispatcher";
$runplugins .= PHP_EOL . $tab . Indent::_(1)
. "Joomla__" . "_7934665b_e432_4ec6_b38d_27bf32730eb9___Power::importPlugin('content');";
}
}
if (!$params)
@@ -159,10 +170,28 @@ final class FieldonContentPrepare
. "//" . Line::_(__Line__, __Class__)
. " Since all values are now in text (Joomla Limitation), we also add the field name ("
. $field . ") to context";
$fieldPrepare .= PHP_EOL . Indent::_(1) . $tab . Indent::_(1)
. '$this->_dispatcher->triggerEvent("onContentPrepare", array(\''
. $context . '.' . $field . '\', &$_' . $field
. ', &$params, 0));';
if ($this->config->get('joomla_version', 3) == 3)
{
$fieldPrepare .= PHP_EOL . Indent::_(1) . $tab . Indent::_(1)
. '$this->_dispatcher->triggerEvent("onContentPrepare", array(\''
. $context . '.' . $field . '\', &$_' . $field
. ', &$params, 0));';
}
else
{
$fieldPrepare .= PHP_EOL . Indent::_(1) . $tab . Indent::_(1) . "//" . Line::_(__Line__, __Class__) . " onContentPrepare Event Trigger";
$fieldPrepare .= PHP_EOL . Indent::_(1) . $tab . Indent::_(1) . "\$this->getDispatcher()->dispatch('onContentPrepare',";
$fieldPrepare .= PHP_EOL . Indent::_(1) . $tab . Indent::_(2) . "new Joomla__" . "_6ee61914_64ed_4a3a_b156_dfc4891ae00d___Power(";
$fieldPrepare .= PHP_EOL . Indent::_(1) . $tab . Indent::_(3) . "'onContentPrepare',";
$fieldPrepare .= PHP_EOL . Indent::_(1) . $tab . Indent::_(3) . "[";
$fieldPrepare .= PHP_EOL . Indent::_(1) . $tab . Indent::_(4) . "'context' => '{$context}.{$field}',";
$fieldPrepare .= PHP_EOL . Indent::_(1) . $tab . Indent::_(4) . "'subject' => \$_{$field},";
$fieldPrepare .= PHP_EOL . Indent::_(1) . $tab . Indent::_(4) . "'params' => \$params,";
$fieldPrepare .= PHP_EOL . Indent::_(1) . $tab . Indent::_(4) . "'page' => 0";
$fieldPrepare .= PHP_EOL . Indent::_(1) . $tab . Indent::_(3) . "]";
$fieldPrepare .= PHP_EOL . Indent::_(1) . $tab . Indent::_(2) . ")";
$fieldPrepare .= PHP_EOL . Indent::_(1) . $tab . Indent::_(1) . ");";
}
}
}

View File

@@ -155,7 +155,7 @@ final class InputButton implements InputButtonInterface
$addButton[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__)
. " get the input from url";
$addButton[] = Indent::_(3) . "\$app = Joomla__"."_39403062_84fb_46e0_bac4_0023f766e827___Power::getApplication();";
$addButton[] = Indent::_(3) . "\$jinput = \$app->input;";
$addButton[] = Indent::_(3) . "\$jinput = method_exists(\$app, 'getInput') ? \$app->getInput() : \$app->input;";
$addButton[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__)
. " get the view name & id";
$addButton[] = Indent::_(3)

View File

@@ -155,7 +155,7 @@ final class InputButton implements InputButtonInterface
$addButton[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__)
. " get the input from url";
$addButton[] = Indent::_(3) . "\$app = Joomla__"."_39403062_84fb_46e0_bac4_0023f766e827___Power::getApplication();";
$addButton[] = Indent::_(3) . "\$jinput = \$app->input;";
$addButton[] = Indent::_(3) . "\$jinput = method_exists(\$app, 'getInput') ? \$app->getInput() : \$app->input;";
$addButton[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__)
. " get the view name & id";
$addButton[] = Indent::_(3)

View File

@@ -148,14 +148,14 @@ final class InputButton implements InputButtonInterface
. " if true set button";
$addButton[] = Indent::_(2) . "if (\$set_button === 'true')";
$addButton[] = Indent::_(2) . "{";
$addButton[] = Indent::_(3) . "\$button = array();";
$addButton[] = Indent::_(3) . "\$script = array();";
$addButton[] = Indent::_(3) . "\$button = [];";
$addButton[] = Indent::_(3) . "\$script = [];";
$addButton[] = Indent::_(3)
. "\$button_code_name = \$this->getAttribute('name');";
$addButton[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__)
. " get the input from url";
$addButton[] = Indent::_(3) . "\$app = Factory::getApplication();";
$addButton[] = Indent::_(3) . "\$jinput = \$app->input;";
$addButton[] = Indent::_(3) . "\$app = Joomla__" . "_39403062_84fb_46e0_bac4_0023f766e827___Power::getApplication();";
$addButton[] = Indent::_(3) . "\$jinput = method_exists(\$app, 'getInput') ? \$app->getInput() : \$app->input;";
$addButton[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__)
. " get the view name & id";
$addButton[] = Indent::_(3)

View File

@@ -1335,7 +1335,7 @@ class Infusion extends Interpretation
__LINE__,__CLASS__
) . " hide the main menu"
. PHP_EOL . Indent::_(2)
. "\$this->app->input->set('hidemainmenu', true);"
. "\$this->app->getInput()->set('hidemainmenu', true);"
);
}

View File

@@ -2668,12 +2668,16 @@ class Interpretation extends Fields
$view['settings']->main_get->plugin_events
))
{
// load the dispatcher
$method .= PHP_EOL . Indent::_(2) . "//" . Line::_(
__LINE__,__CLASS__
) . " Initialise dispatcher.";
$method .= PHP_EOL . Indent::_(2)
. "\$dispatcher = JEventDispatcher::getInstance();";
if (CFactory::_('Config')->get('joomla_version', 3) == 3)
{
// load the dispatcher
$method .= PHP_EOL . Indent::_(2) . "//" . Line::_(
__LINE__,__CLASS__
) . " Initialise dispatcher.";
$method .= PHP_EOL . Indent::_(2)
. "\$dispatcher = JEventDispatcher::getInstance();";
}
}
if ($view['settings']->main_get->gettype == 1)
{
@@ -2681,8 +2685,16 @@ class Interpretation extends Fields
$method .= PHP_EOL . Indent::_(2) . "//" . Line::_(
__LINE__,__CLASS__
) . " Initialise variables.";
$method .= PHP_EOL . Indent::_(2)
. "\$this->item = \$this->get('Item');";
if (CFactory::_('Config')->get('joomla_version', 3) == 3)
{
$method .= PHP_EOL . Indent::_(2)
. "\$this->item = \$this->get('Item');";
}
else
{
$method .= PHP_EOL . Indent::_(2)
. "\$this->item = \$model->getItem();";
}
}
elseif ($view['settings']->main_get->gettype == 2)
{
@@ -2690,13 +2702,27 @@ class Interpretation extends Fields
$method .= PHP_EOL . Indent::_(2) . "//" . Line::_(
__LINE__,__CLASS__
) . " Initialise variables.";
$method .= PHP_EOL . Indent::_(2)
. "\$this->items = \$this->get('Items');";
// only add if pagination is requered
if ($view['settings']->main_get->pagination == 1)
if (CFactory::_('Config')->get('joomla_version', 3) == 3)
{
$method .= PHP_EOL . Indent::_(2)
. "\$this->pagination = \$this->get('Pagination');";
. "\$this->items = \$this->get('Items');";
// only add if pagination is requered
if ($view['settings']->main_get->pagination == 1)
{
$method .= PHP_EOL . Indent::_(2)
. "\$this->pagination = \$this->get('Pagination');";
}
}
else
{
$method .= PHP_EOL . Indent::_(2)
. "\$this->items = \$model->getItems();";
// only add if pagination is requered
if ($view['settings']->main_get->pagination == 1)
{
$method .= PHP_EOL . Indent::_(2)
. "\$this->pagination = \$model->getPagination();";
}
}
}
// add the custom get methods
@@ -2710,9 +2736,18 @@ class Interpretation extends Fields
$custom_get_name = str_replace(
'get', '', (string) $custom_get->getcustom
);
$method .= PHP_EOL . Indent::_(2) . "\$this->"
. StringHelper::safe($custom_get_name)
. " = \$this->get('" . $custom_get_name . "');";
if (CFactory::_('Config')->get('joomla_version', 3) == 3)
{
$method .= PHP_EOL . Indent::_(2) . "\$this->"
. StringHelper::safe($custom_get_name)
. " = \$this->get('" . $custom_get_name . "');";
}
else
{
$method .= PHP_EOL . Indent::_(2) . "\$this->"
. StringHelper::safe($custom_get_name)
. " = \$model->{$custom_get->getcustom}();";
}
}
}
// add custom script
@@ -2769,8 +2804,16 @@ class Interpretation extends Fields
$method .= PHP_EOL . PHP_EOL . Indent::_(2) . "//" . Line::_(
__LINE__,__CLASS__
) . " Check for errors.";
$method .= PHP_EOL . Indent::_(2)
. "if (count(\$errors = \$this->get('Errors')))";
if (CFactory::_('Config')->get('joomla_version', 3) == 3)
{
$method .= PHP_EOL . Indent::_(2)
. "if (count(\$errors = \$model->get('Errors')))";
}
else
{
$method .= PHP_EOL . Indent::_(2)
. "if (count(\$errors = \$model->getErrors()))";
}
$method .= PHP_EOL . Indent::_(2) . "{";
$method .= PHP_EOL . Indent::_(3)
. "throw new \Exception(implode(PHP_EOL, \$errors), 500);";
@@ -2788,7 +2831,7 @@ class Interpretation extends Fields
. "Super_" . "__91004529_94a9_4590_b842_e7c6b624ecf5___Power::check(\$this->item))";
$method .= PHP_EOL . Indent::_(2) . "{";
$method .= PHP_EOL . Indent::_(3)
. "PluginHelper::importPlugin('content');";
. "Joomla__" . "_7934665b_e432_4ec6_b38d_27bf32730eb9___Power::importPlugin('content');";
$method .= PHP_EOL . Indent::_(3) . "//" . Line::_(
__LINE__,__CLASS__
) . " Setup Event Object.";
@@ -2801,28 +2844,62 @@ class Interpretation extends Fields
. "\$params = (isset(\$this->item->params) && "
. "Super_" . "__4b225c51_d293_48e4_b3f6_5136cf5c3f18___Power::check(\$this->item->params)) ? json_decode(\$this->item->params) : \$this->params;";
// load the defaults
foreach (
$view['settings']->main_get->plugin_events as $plugin_event
)
foreach ($view['settings']->main_get->plugin_events as $plugin_event)
{
// load the events
if ('onContentPrepare' === $plugin_event)
{
// TODO the onContentPrepare already gets triggered on the fields of its relation
// $method .= PHP_EOL . Indent::_(2) . "//" . Line::_(__Line__, __Class__) . " onContentPrepare Event Trigger.";
// $method .= PHP_EOL . Indent::_(2) . "\$dispatcher->trigger('onContentPrepare', array ('com_" . CFactory::_('Config')->component_code_name . ".article', &\$this->item, &\$this->params, 0));";
// if (CFactory::_('Config')->get('joomla_version', 3) == 3)
// {
// $method .= PHP_EOL . Indent::_(2) . "\$dispatcher->trigger('onContentPrepare', ['com_" . CFactory::_('Config')->component_code_name . ".article', &\$this->item, &\$this->params, 0]);";
// }
}
else
{
$method .= PHP_EOL . Indent::_(3) . "//"
. Line::_(__Line__, __Class__) . " " . $plugin_event
. " Event Trigger.";
$method .= PHP_EOL . Indent::_(3)
. "\$results = \$dispatcher->trigger('"
. $plugin_event . "', array('com_"
. CFactory::_('Config')->component_code_name . "."
. $view['settings']->context
. "', &\$this->item, &\$params, 0));";
if (CFactory::_('Config')->get('joomla_version', 3) == 3)
{
$method .= PHP_EOL . Indent::_(3) . "//"
. Line::_(__Line__, __Class__) . " " . $plugin_event . " Event Trigger.";
$method .= PHP_EOL . Indent::_(3)
. "\$results = \$dispatcher->trigger('"
. $plugin_event . "', array('com_"
. CFactory::_('Config')->component_code_name . "."
. $view['settings']->context
. "', &\$this->item, &\$params, 0));";
}
else
{
$joomla_power = 'error';
if ('onContentAfterTitle' === $plugin_event)
{
$joomla_power = "Joomla__" . "_fa9c1320_a115_452a_a0a8_534fcdea490b___Power";
}
elseif ('onContentBeforeDisplay' === $plugin_event)
{
$joomla_power = "Joomla__" . "_fc1ab159_0df1_4be8_babd_0bd18d35f467___Power";
}
elseif ('onContentAfterDisplay' === $plugin_event)
{
$joomla_power = "Joomla__" . "_a42c4e8e_ead1_442d_8b9a_99236a1ee9a9___Power";
}
$method .= PHP_EOL . Indent::_(3) . "//" . Line::_(__Line__, __Class__) . " {$plugin_event} Event Trigger";
$method .= PHP_EOL . Indent::_(3) . "\$results = \$this->getDispatcher()->dispatch('{$plugin_event}',";
$method .= PHP_EOL . Indent::_(4) . "new {$joomla_power}(";
$method .= PHP_EOL . Indent::_(5) . "'{$plugin_event}',";
$method .= PHP_EOL . Indent::_(5) . "[";
$method .= PHP_EOL . Indent::_(6) . "'context' => '" . CFactory::_('Config')->component_code_name . "." . $view['settings']->context . "',";
$method .= PHP_EOL . Indent::_(6) . "'subject' => \$this->item,";
$method .= PHP_EOL . Indent::_(6) . "'params' => \$params,";
$method .= PHP_EOL . Indent::_(6) . "'page' => 0";
$method .= PHP_EOL . Indent::_(5) . "]";
$method .= PHP_EOL . Indent::_(4) . ")";
$method .= PHP_EOL . Indent::_(3) . ")->getArgument('result', []);";
}
$method .= PHP_EOL . Indent::_(3)
. '$this->item->event->' . $plugin_event
. ' = trim(implode("\n", $results));';
@@ -4449,7 +4526,7 @@ class Interpretation extends Fields
&& isset($this->customAdminViewListId[$view]))
{
$input = PHP_EOL . Indent::_(1)
. '<input type="hidden" name="id" value="<?php echo $this->app->input->getInt(\'id\', 0); ?>" />';
. '<input type="hidden" name="id" value="<?php echo $this->app->getInput()->getInt(\'id\', 0); ?>" />';
}
return $input . PHP_EOL
@@ -16750,7 +16827,9 @@ class Interpretation extends Fields
else
{
$getForm[] = PHP_EOL . Indent::_(2)
. "\$jinput = Joomla__"."_39403062_84fb_46e0_bac4_0023f766e827___Power::getApplication()->input;";
. "\$app = Joomla__"."_39403062_84fb_46e0_bac4_0023f766e827___Power::getApplication();";
$getForm[] = PHP_EOL . Indent::_(2)
. "\$jinput = method_exists(\$app, 'getInput') ? \$app->getInput() : \$app->input;";
$getForm[] = PHP_EOL . Indent::_(2) . "//" . Line::_(
__LINE__,__CLASS__
)
@@ -17679,7 +17758,7 @@ class Interpretation extends Fields
// build toolbar
$toolBar
= "Joomla__"."_39403062_84fb_46e0_bac4_0023f766e827___Power::getApplication()->input->set('hidemainmenu', true);";
= "Joomla__"."_39403062_84fb_46e0_bac4_0023f766e827___Power::getApplication()->getInput()->set('hidemainmenu', true);";
$toolBar .= PHP_EOL . Indent::_(2) . "Joomla__"."_0c1a176a_304f_433a_8233_37d01ff87815___Power::title(Text:"
. ":_('" . $viewNameLang_readonly . "'), '" . $nameSingleCode
. "');";
@@ -17708,7 +17787,7 @@ class Interpretation extends Fields
);
// build toolbar
$toolBar
= "Joomla__"."_39403062_84fb_46e0_bac4_0023f766e827___Power::getApplication()->input->set('hidemainmenu', true);";
= "Joomla__"."_39403062_84fb_46e0_bac4_0023f766e827___Power::getApplication()->getInput()->set('hidemainmenu', true);";
if (CFactory::_('Config')->get('joomla_version', 3) == 3)
{
$toolBar .= PHP_EOL . Indent::_(2)
@@ -17925,7 +18004,7 @@ class Interpretation extends Fields
// build toolbar
$toolBar
= "Joomla__"."_39403062_84fb_46e0_bac4_0023f766e827___Power::getApplication()->input->set('hidemainmenu', true);";
= "Joomla__"."_39403062_84fb_46e0_bac4_0023f766e827___Power::getApplication()->getInput()->set('hidemainmenu', true);";
$toolBar .= PHP_EOL . Indent::_(2) . "Joomla__"."_0c1a176a_304f_433a_8233_37d01ff87815___Power::title(Text:"
. ":_('" . $viewNameLang_readonly . "'), '" . $nameSingleCode
. "');";
@@ -17954,7 +18033,7 @@ class Interpretation extends Fields
);
// build toolbar
$toolBar
= "Joomla__"."_39403062_84fb_46e0_bac4_0023f766e827___Power::getApplication()->input->set('hidemainmenu', true);";
= "Joomla__"."_39403062_84fb_46e0_bac4_0023f766e827___Power::getApplication()->getInput()->set('hidemainmenu', true);";
if (CFactory::_('Config')->get('joomla_version', 3) == 3)
{
$toolBar .= PHP_EOL . Indent::_(2)
@@ -18074,7 +18153,7 @@ class Interpretation extends Fields
$state .= PHP_EOL . PHP_EOL . Indent::_(2) . "//"
. Line::_(__Line__, __Class__) . " Check if the form was submitted";
$state .= PHP_EOL . Indent::_(2) . "\$formSubmited"
. " = \$app->input->post->get('form_submited');";
. " = \$input->post->get('form_submited');";
$new_filter = true;
}
// add the default populate states (this must be added first)
@@ -18150,7 +18229,7 @@ class Interpretation extends Fields
. "if (\$formSubmited)";
$state .= PHP_EOL . Indent::_(2) . "{";
$state .= PHP_EOL . Indent::_(3) . "\$" . $filter['code']
. " = \$app->input->post->get('" . $filter['code'] . "');";
. " = \$input->post->get('" . $filter['code'] . "');";
$state .= PHP_EOL . Indent::_(3)
. "\$this->setState('filter." . $filter['code']
. "', \$" . $filter['code'] . ");";