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:
@@ -62,7 +62,7 @@ class ###Component###Model###SView### extends ItemModel
|
||||
protected function populateState()
|
||||
{
|
||||
$this->app = Factory::getApplication();
|
||||
$this->input = $this->app->input;
|
||||
$this->input = method_exists($this->app, 'getInput') ? $this->app->getInput() : $this->app->input;
|
||||
// Get the item main id
|
||||
$id = $this->input->getInt('id', null);
|
||||
$this->setState('###sview###.id', $id);
|
||||
|
@@ -62,7 +62,7 @@ class ###Component###Model###SView### extends ItemModel
|
||||
protected function populateState()
|
||||
{
|
||||
$this->app = Factory::getApplication();
|
||||
$this->input = $this->app->input;
|
||||
$this->input = method_exists($this->app, 'getInput') ? $this->app->getInput() : $this->app->input;
|
||||
// Get the itme main id
|
||||
$id = $this->input->getInt('id', null);
|
||||
$this->setState('###sview###.id', $id);
|
||||
|
@@ -50,9 +50,10 @@ class ###Component###Model###Views### extends ListModel
|
||||
protected function populateState($ordering = null, $direction = null)
|
||||
{
|
||||
$app = Factory::getApplication();
|
||||
$input = method_exists($app, 'getInput') ? $app->getInput() : $app->input;
|
||||
|
||||
// Adjust the context to support modal layouts.
|
||||
if ($layout = $app->input->get('layout'))
|
||||
if ($layout = $input->get('layout'))
|
||||
{
|
||||
$this->context .= '.' . $layout;
|
||||
}###POPULATESTATE###
|
||||
|
@@ -66,7 +66,7 @@ class AjaxController extends BaseController
|
||||
// get the user for later use
|
||||
$user = $this->app->getIdentity();
|
||||
// get the input values
|
||||
$jinput = $this->input ?? $this->app->input;
|
||||
$jinput = $this->input ?? (method_exists($this->app, 'getInput') ? $this->app->getInput() : $this->app->input);
|
||||
// check if we should return raw (DEFAULT TRUE SINCE J4)
|
||||
$returnRaw = $jinput->get('raw', true, 'BOOLEAN');
|
||||
// return to a callback function
|
||||
|
@@ -41,8 +41,9 @@ class HelpController extends BaseController
|
||||
|
||||
public function help()
|
||||
{
|
||||
$user = Joomla___39403062_84fb_46e0_bac4_0023f766e827___Power::getApplication()->getIdentity();
|
||||
$jinput = Joomla___39403062_84fb_46e0_bac4_0023f766e827___Power::getApplication()->input;
|
||||
$app = Joomla___39403062_84fb_46e0_bac4_0023f766e827___Power::getApplication();
|
||||
$user = $app->getIdentity();
|
||||
$jinput = method_exists($app, 'getInput') ? $app->getInput() : $app->input;
|
||||
// Check Token!
|
||||
$token = Joomla___5ba38513_5c4f_4b0d_935e_49e986a6bce8___Power::getFormToken();
|
||||
$call_token = $jinput->get('token', 0, 'ALNUM');
|
||||
|
@@ -90,7 +90,8 @@ class ImportModel extends BaseDatabaseModel
|
||||
$package = null;
|
||||
$continue = false;
|
||||
// get import type
|
||||
$this->getType = $app->input->getString('gettype', NULL);
|
||||
$input = method_exists($app, 'getInput') ? $app->getInput() : $app->input;
|
||||
$this->getType = $input->getString('gettype', NULL);
|
||||
// get import type
|
||||
$this->dataType = $session->get('dataType_VDM_IMPORTINTO', NULL);
|
||||
|
||||
@@ -196,7 +197,7 @@ class ImportModel extends BaseDatabaseModel
|
||||
{
|
||||
// Get the uploaded file information
|
||||
$app = Joomla___39403062_84fb_46e0_bac4_0023f766e827___Power::getApplication();
|
||||
$input = $app->input;
|
||||
$input = method_exists($app, 'getInput') ? $app->getInput() : $app->input;
|
||||
|
||||
// Do not change the filter type 'raw'. We need this to let files containing PHP code to upload. See JInputFiles::get.
|
||||
$userfile = $input->files->get('import_package', null, 'raw');
|
||||
@@ -256,7 +257,7 @@ class ImportModel extends BaseDatabaseModel
|
||||
protected function _getPackageFromFolder()
|
||||
{
|
||||
$app = Joomla___39403062_84fb_46e0_bac4_0023f766e827___Power::getApplication();
|
||||
$input = $app->input;
|
||||
$input = method_exists($app, 'getInput') ? $app->getInput() : $app->input;
|
||||
|
||||
// Get the path to the package to import
|
||||
$p_dir = $input->getString('import_directory');
|
||||
@@ -301,7 +302,7 @@ class ImportModel extends BaseDatabaseModel
|
||||
protected function _getPackageFromUrl()
|
||||
{
|
||||
$app = Joomla___39403062_84fb_46e0_bac4_0023f766e827___Power::getApplication();
|
||||
$input = $app->input;
|
||||
$input = method_exists($app, 'getInput') ? $app->getInput() : $app->input;
|
||||
|
||||
// Get the URL of the package to import
|
||||
$url = $input->getString('import_url');
|
||||
|
@@ -86,7 +86,7 @@ class ###View###importModel extends BaseDatabaseModel
|
||||
{
|
||||
// Get the uploaded file information
|
||||
$app = Joomla___39403062_84fb_46e0_bac4_0023f766e827___Power::getApplication();
|
||||
$input = $app->input;
|
||||
$input = method_exists($app, 'getInput') ? $app->getInput() : $app->input;
|
||||
|
||||
// Do not change the filter type 'raw'. We need this to let files containing PHP code to upload. See JInputFiles::get.
|
||||
$userfile = $input->files->get('import_package', null, 'raw');
|
||||
@@ -146,7 +146,7 @@ class ###View###importModel extends BaseDatabaseModel
|
||||
protected function _getPackageFromFolder()
|
||||
{
|
||||
$app = Joomla___39403062_84fb_46e0_bac4_0023f766e827___Power::getApplication();
|
||||
$input = $app->input;
|
||||
$input = method_exists($app, 'getInput') ? $app->getInput() : $app->input;
|
||||
|
||||
// Get the path to the package to import
|
||||
$p_dir = $input->getString('import_directory');
|
||||
@@ -191,7 +191,7 @@ class ###View###importModel extends BaseDatabaseModel
|
||||
protected function _getPackageFromUrl()
|
||||
{
|
||||
$app = Joomla___39403062_84fb_46e0_bac4_0023f766e827___Power::getApplication();
|
||||
$input = $app->input;
|
||||
$input = method_exists($app, 'getInput') ? $app->getInput() : $app->input;
|
||||
|
||||
// Get the URL of the package to import
|
||||
$url = $input->getString('import_url');
|
||||
|
@@ -111,12 +111,13 @@ class HtmlView extends BaseHtmlView
|
||||
*/
|
||||
public function display($tpl = null): void
|
||||
{
|
||||
// Assign data to the view
|
||||
$this->items = $this->get('Items');
|
||||
$this->pagination = $this->get('Pagination');
|
||||
$this->state = $this->get('State');
|
||||
$this->styles = $this->get('Styles');
|
||||
$this->scripts = $this->get('Scripts');
|
||||
// Load module values
|
||||
$model = $this->getModel();
|
||||
$this->items = $model->getItems();
|
||||
$this->pagination = $model->getPagination();
|
||||
$this->state = $model->getState();
|
||||
$this->styles = $model->getStyles();
|
||||
$this->scripts = $model->getScripts();
|
||||
$this->user ??= $this->getCurrentUser();###ADMIN_DIPLAY_METHOD###
|
||||
$this->saveOrder = $this->listOrder == 'a.ordering';
|
||||
// set the return here value
|
||||
|
@@ -23,12 +23,14 @@ defined('_JEXEC') or die;###LICENSE_LOCKED_DEFINED###
|
||||
|
||||
$app = Joomla___39403062_84fb_46e0_bac4_0023f766e827___Power::getApplication();
|
||||
|
||||
if ($app->isClient('site')) {
|
||||
if ($app->isClient('site'))
|
||||
{
|
||||
Joomla___5ba38513_5c4f_4b0d_935e_49e986a6bce8___Power::checkToken('get') or die(Joomla___ba6326ef_cb79_4348_80f4_ab086082e3c5___Power::_('JINVALID_TOKEN'));
|
||||
}
|
||||
|
||||
// dynamic selection of title key (link in modal)
|
||||
$this->modalTitleKey = $app->input->get('titleKey', 'id', 'word');
|
||||
$input = method_exists($app, 'getInput') ? $app->getInput() : $app->input;
|
||||
$this->modalTitleKey = $input->get('titleKey', 'id', 'word');
|
||||
|
||||
/** @var Joomla\CMS\WebAsset\WebAssetManager $wa */
|
||||
$wa = $this->getDocument()->getWebAssetManager();
|
||||
|
@@ -93,9 +93,10 @@ class ###Views###Model extends ListModel
|
||||
protected function populateState($ordering = null, $direction = null)
|
||||
{
|
||||
$app = $this->app;
|
||||
$input = $this->app->getInput();
|
||||
|
||||
// Adjust the context to support modal layouts.
|
||||
if ($layout = $app->input->get('layout'))
|
||||
if ($layout = $input->get('layout'))
|
||||
{
|
||||
$this->context .= '.' . $layout;
|
||||
}###POPULATESTATE###
|
||||
|
@@ -36,6 +36,14 @@ class HtmlView extends BaseHtmlView
|
||||
*/
|
||||
public mixed $item;
|
||||
|
||||
/**
|
||||
* The app class
|
||||
*
|
||||
* @var Joomla___a6ee04f5_33c7_4a9b_aa6d_6a03f3715a88___Power
|
||||
* @since 5.2.1
|
||||
*/
|
||||
public Joomla___a6ee04f5_33c7_4a9b_aa6d_6a03f3715a88___Power $app;
|
||||
|
||||
/**
|
||||
* The input class
|
||||
*
|
||||
@@ -138,16 +146,19 @@ class HtmlView extends BaseHtmlView
|
||||
// set params
|
||||
$this->params = Joomla___aeb8e463_291f_4445_9ac4_34b637c12dbd___Power::getParams('com_###component###');
|
||||
$this->useCoreUI = true;
|
||||
// Assign the variables
|
||||
$this->form ??= $this->get('Form');
|
||||
$this->item = $this->get('Item');
|
||||
$this->styles = $this->get('Styles');
|
||||
$this->scripts = $this->get('Scripts');
|
||||
$this->state = $this->get('State');
|
||||
// Load module values
|
||||
$model = $this->getModel();
|
||||
$this->form ??= $model->getForm();
|
||||
$this->item = $model->getItem();
|
||||
$this->styles = $model->getStyles();
|
||||
$this->scripts = $model->getScripts();
|
||||
$this->state = $model->getState();
|
||||
// get action permissions
|
||||
$this->canDo = ###Component###Helper::getActions('###view###', $this->item);
|
||||
// get application
|
||||
$this->app ??= Joomla___39403062_84fb_46e0_bac4_0023f766e827___Power::getApplication();
|
||||
// get input
|
||||
$this->input ??= Joomla___39403062_84fb_46e0_bac4_0023f766e827___Power::getApplication()->input;
|
||||
$this->input ??= method_exists($this->app, 'getInput') ? $this->app->getInput() : $this->app->input;
|
||||
$this->ref = $this->input->get('ref', 0, 'word');
|
||||
$this->refid = $this->input->get('refid', 0, 'int');
|
||||
$return = $this->input->get('return', null, 'base64');
|
||||
|
@@ -67,7 +67,7 @@ class ###View###Table extends Table implements VersionableTableInterface, Taggab
|
||||
$this->_jsonEncode = ['params', 'metadata'];
|
||||
|
||||
// Indicates that columns fully support the NULL value in the database
|
||||
// $this->_supportNullValue = true; // hmmm will keep an eye on this ;)
|
||||
$this->_supportNullValue = true;
|
||||
|
||||
parent::__construct('#__###component###_###view###', 'id', $db, $dispatcher);###LICENSE_LOCKED_CHECK###
|
||||
}
|
||||
@@ -105,7 +105,7 @@ class ###View###Table extends Table implements VersionableTableInterface, Taggab
|
||||
* @return boolean True on success, false on failure.
|
||||
* @since 1.6
|
||||
*/
|
||||
public function store($updateNulls = false)
|
||||
public function store($updateNulls = true)
|
||||
{
|
||||
$date = Joomla___39403062_84fb_46e0_bac4_0023f766e827___Power::getDate()->toSql();
|
||||
$userId = $this->getCurrentUser()->id;
|
||||
|
@@ -79,8 +79,10 @@ class HtmlView extends BaseHtmlView
|
||||
$this->user ??= $this->getCurrentUser();
|
||||
// get global action permissions
|
||||
$this->canDo = ###Component###Helper::getActions('###sview###');
|
||||
$this->styles = $this->get('Styles') ?? [];
|
||||
$this->scripts = $this->get('Scripts') ?? [];###CUSTOM_ADMIN_DIPLAY_METHOD###
|
||||
// Load module values
|
||||
$model = $this->getModel();
|
||||
$this->styles = $model->getStyles() ?? [];
|
||||
$this->scripts = $model->getScripts() ?? [];###CUSTOM_ADMIN_DIPLAY_METHOD###
|
||||
|
||||
// Set the html view document stuff
|
||||
$this->_prepareDocument();
|
||||
|
@@ -47,8 +47,10 @@ class HtmlView extends BaseHtmlView
|
||||
$this->user ??= Joomla___39403062_84fb_46e0_bac4_0023f766e827___Power::getApplication()->getIdentity();
|
||||
// get global action permissions
|
||||
$this->canDo = ###Component###Helper::getActions('###sview###');
|
||||
$this->styles = $this->get('Styles');
|
||||
$this->scripts = $this->get('Scripts');###CUSTOM_ADMIN_DIPLAY_METHOD###
|
||||
// Load module values
|
||||
$model = $this->getModel();
|
||||
$this->styles = $model->getStyles();
|
||||
$this->scripts = $model->getScripts();###CUSTOM_ADMIN_DIPLAY_METHOD###
|
||||
|
||||
// Set the html view document stuff
|
||||
$this->_prepareDocument();
|
||||
|
@@ -120,16 +120,17 @@ class HtmlView extends BaseHtmlView
|
||||
// set params
|
||||
$this->params = Joomla___aeb8e463_291f_4445_9ac4_34b637c12dbd___Power::getParams('com_###component###');
|
||||
$this->useCoreUI = true;
|
||||
// Assign the variables
|
||||
$this->form ??= $this->get('Form');
|
||||
$this->item = $this->get('Item');
|
||||
$this->state = $this->get('State');
|
||||
$this->styles = $this->get('Styles') ?? [];
|
||||
$this->scripts = $this->get('Scripts') ?? [];
|
||||
// Load module values
|
||||
$model = $this->getModel();
|
||||
$this->form ??= $model->getForm();
|
||||
$this->item = $model->getItem();
|
||||
$this->state = $model->getState();
|
||||
$this->styles = $model->getStyles() ?? [];
|
||||
$this->scripts = $model->getScripts() ?? [];
|
||||
// get action permissions
|
||||
$this->canDo = ###Component###Helper::getActions('###view###', $this->item);
|
||||
// get input
|
||||
$jinput = Joomla___39403062_84fb_46e0_bac4_0023f766e827___Power::getApplication()->input;
|
||||
$jinput = Joomla___39403062_84fb_46e0_bac4_0023f766e827___Power::getApplication()->getInput();
|
||||
$this->ref = $jinput->get('ref', 0, 'word');
|
||||
$this->refid = $jinput->get('refid', 0, 'int');
|
||||
$return = $jinput->get('return', null, 'base64');
|
||||
|
@@ -449,8 +449,9 @@ class ###View###Model extends AdminModel
|
||||
*/
|
||||
public function save($data)
|
||||
{
|
||||
$input = Joomla___39403062_84fb_46e0_bac4_0023f766e827___Power::getApplication()->input;
|
||||
$filter = InputFilter::getInstance();
|
||||
$app = Joomla___39403062_84fb_46e0_bac4_0023f766e827___Power::getApplication();
|
||||
$input = method_exists($app, 'getInput') ? $app->getInput() : $app->input;
|
||||
$filter = Joomla___193deb3e_0c3e_4610_8e55_450e463095b4___Power::getInstance();
|
||||
|
||||
// set the metadata to the Item Data
|
||||
if (isset($data['metadata']) && isset($data['metadata']['author']))
|
||||
|
@@ -61,7 +61,7 @@ class AjaxController extends BaseController
|
||||
// get the user for later use
|
||||
$user = $this->app->getIdentity();
|
||||
// get the input values
|
||||
$jinput = $this->input ?? $this->app->input;
|
||||
$jinput = $this->input ?? (method_exists($this->app, 'getInput') ? $this->app->getInput() : $this->app->input);
|
||||
// check if we should return raw (DEFAULT TRUE SINCE J4)
|
||||
$returnRaw = $jinput->get('raw', true, 'BOOLEAN');
|
||||
// return to a callback function
|
||||
|
@@ -41,8 +41,9 @@ class HelpController extends BaseController
|
||||
|
||||
public function help()
|
||||
{
|
||||
$user = Joomla___39403062_84fb_46e0_bac4_0023f766e827___Power::getApplication()->getIdentity();
|
||||
$jinput = Joomla___39403062_84fb_46e0_bac4_0023f766e827___Power::getApplication()->input;
|
||||
$app = Joomla___39403062_84fb_46e0_bac4_0023f766e827___Power::getApplication();
|
||||
$user = $app->getIdentity();
|
||||
$jinput = method_exists($app, 'getInput') ? $app->getInput() : $app->input;
|
||||
// Check Token!
|
||||
$token = Joomla___5ba38513_5c4f_4b0d_935e_49e986a6bce8___Power::getFormToken();
|
||||
$call_token = $jinput->get('token', 0, 'ALNUM');
|
||||
|
@@ -90,8 +90,10 @@ class HtmlView extends BaseHtmlView
|
||||
$this->app ??= Joomla___39403062_84fb_46e0_bac4_0023f766e827___Power::getApplication();
|
||||
$this->params = $this->app->getParams();
|
||||
$this->menu = $this->app->getMenu()->getActive();
|
||||
$this->styles = $this->get('Styles');
|
||||
$this->scripts = $this->get('Scripts');
|
||||
// Load module values
|
||||
$model = $this->getModel();
|
||||
$this->styles = $model->getStyles() ?? [];
|
||||
$this->scripts = $model->getScripts() ?? [];
|
||||
// get the user object
|
||||
$this->user ??= $this->app->getIdentity();###SITE_DIPLAY_METHOD###
|
||||
|
||||
|
@@ -74,8 +74,10 @@ class HtmlView extends BaseHtmlView
|
||||
$this->app ??= Joomla___39403062_84fb_46e0_bac4_0023f766e827___Power::getApplication();
|
||||
$this->params = $this->app->getParams();
|
||||
$this->menu = $this->app->getMenu()->getActive();
|
||||
$this->styles = $this->get('Styles') ?? [];
|
||||
$this->scripts = $this->get('Scripts') ?? [];
|
||||
// Load module values
|
||||
$model = $this->getModel();
|
||||
$this->styles = $model->getStyles() ?? [];
|
||||
$this->scripts = $model->getScripts() ?? [];
|
||||
// get the user object
|
||||
$this->user ??= $this->getCurrentUser();###SITE_DIPLAY_METHOD###
|
||||
|
||||
|
Reference in New Issue
Block a user