Skip to content

Commit 72e1102

Browse files
authored
[5.4] Merge pull request joomla#45110 from muhme/5.4-upmerge-2025-03-11
[5.4] upmerge 2025-03-11
2 parents d5fd3c1 + 6272c2c commit 72e1102

File tree

46 files changed

+298
-172
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+298
-172
lines changed

administrator/components/com_config/src/Model/ApplicationModel.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -786,8 +786,6 @@ public function save($data)
786786
*/
787787
public function removeroot()
788788
{
789-
$app = Factory::getApplication();
790-
791789
// Get the previous configuration.
792790
$prev = new \JConfig();
793791
$prev = ArrayHelper::fromObject($prev);

administrator/components/com_contact/src/Model/ContactsModel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ protected function getListQuery()
158158
'list.select',
159159
'a.id, a.name, a.alias, a.checked_out, a.checked_out_time, a.catid, a.user_id' .
160160
', a.published, a.access, a.created, a.created_by, a.ordering, a.featured, a.language' .
161-
', a.publish_up, a.publish_down'
161+
', a.publish_up, a.publish_down, a.modified_by'
162162
)
163163
)
164164
)

administrator/components/com_joomlaupdate/src/Model/UpdateModel.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ public function createUpdateFile($basename = null): bool
612612
$data .= '];';
613613

614614
// Remove the old file, if it's there...
615-
$configpath = JPATH_COMPONENT_ADMINISTRATOR . '/update.php';
615+
$configpath = JPATH_ADMINISTRATOR . '/components/com_joomlaupdate/update.php';
616616

617617
if (is_file($configpath)) {
618618
try {
@@ -900,8 +900,8 @@ public function cleanUp()
900900
}
901901

902902
// Remove the update.php file used in Joomla 4.0.3 and later.
903-
if (is_file(JPATH_COMPONENT_ADMINISTRATOR . '/update.php')) {
904-
File::delete(JPATH_COMPONENT_ADMINISTRATOR . '/update.php');
903+
if (is_file(JPATH_ADMINISTRATOR . '/components/com_joomlaupdate/update.php')) {
904+
File::delete(JPATH_ADMINISTRATOR . '/components/com_joomlaupdate/update.php');
905905
}
906906

907907
// Remove joomla.xml from the site's root.

administrator/components/com_media/src/View/Media/HtmlView.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ protected function prepareToolbar()
9999
// Add the upload and create folder buttons
100100
if ($user->authorise('core.create', 'com_media')) {
101101
// Add the upload button
102-
$layout = new FileLayout('toolbar.upload', JPATH_COMPONENT_ADMINISTRATOR . '/layouts');
102+
$layout = new FileLayout('toolbar.upload', JPATH_ADMINISTRATOR . '/components/com_media/layouts');
103103

104104
$toolbar->customButton('upload')
105105
->html($layout->render([]));
@@ -116,7 +116,7 @@ protected function prepareToolbar()
116116
// Add a delete button
117117
if ($user->authorise('core.delete', 'com_media')) {
118118
// Instantiate a new FileLayout instance and render the layout
119-
$layout = new FileLayout('toolbar.delete', JPATH_COMPONENT_ADMINISTRATOR . '/layouts');
119+
$layout = new FileLayout('toolbar.delete', JPATH_ADMINISTRATOR . '/components/com_media/layouts');
120120

121121
$toolbar->customButton('delete')
122122
->html($layout->render([]));

administrator/components/com_messages/src/View/Messages/HtmlView.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ public function display($tpl = null)
117117
*/
118118
protected function addToolbar()
119119
{
120-
$state = $this->state;
121120
$canDo = ContentHelper::getActions('com_messages');
122121
$user = $this->getCurrentUser();
123122

administrator/components/com_newsfeeds/src/Model/NewsfeedsModel.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ protected function getListQuery()
170170
$db->quoteName('a.language'),
171171
$db->quoteName('a.publish_up'),
172172
$db->quoteName('a.publish_down'),
173+
$db->quoteName('a.modified_by'),
173174
]
174175
)
175176
)

administrator/components/com_scheduler/src/Helper/SchedulerHelper.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,13 @@ public static function getTaskOptions(): TaskOptions
6363
PluginHelper::importPlugin('task');
6464
$app->getDispatcher()->dispatch('onTaskOptionsList', $event);
6565

66+
if (isset($options->options) && \is_array($options->options)) {
67+
// Sort the options alphabetically by title
68+
usort($options->options, function ($a, $b) {
69+
return strcmp($a->getTitle(), $b->getTitle());
70+
});
71+
}
72+
6673
self::$taskOptionsCache = $options;
6774

6875
return $options;

administrator/components/com_scheduler/src/Task/TaskOption.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,18 @@ public function __construct(string $type, string $langConstPrefix)
7878
$this->langConstPrefix = $langConstPrefix;
7979
}
8080

81+
/**
82+
* Method to get the type title.
83+
*
84+
* @return string The type title.
85+
*
86+
* @since __DEPLOY_VERSION__
87+
*/
88+
public function getTitle(): string
89+
{
90+
return $this->title;
91+
}
92+
8193
/**
8294
* Magic method to allow read-only access to private properties.
8395
*

administrator/components/com_scheduler/src/View/Logs/HtmlView.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ public function display($tpl = null): void
111111
protected function addToolbar(): void
112112
{
113113
$canDo = ContentHelper::getActions('com_scheduler');
114-
$user = Factory::getApplication()->getIdentity();
115114
$toolbar = Toolbar::getInstance();
116115

117116
ToolbarHelper::title(Text::_('COM_SCHEDULER_FIELDSET_EXEC_HIST'), 'list');

administrator/components/com_templates/src/Model/StyleModel.php

Lines changed: 18 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,16 @@
1111
namespace Joomla\Component\Templates\Administrator\Model;
1212

1313
use Joomla\CMS\Application\ApplicationHelper;
14-
use Joomla\CMS\Component\ComponentHelper;
1514
use Joomla\CMS\Factory;
1615
use Joomla\CMS\Form\Form;
1716
use Joomla\CMS\Language\Multilanguage;
1817
use Joomla\CMS\Language\Text;
1918
use Joomla\CMS\MVC\Factory\MVCFactoryInterface;
2019
use Joomla\CMS\MVC\Model\AdminModel;
21-
use Joomla\CMS\Object\CMSObject;
2220
use Joomla\CMS\Plugin\PluginHelper;
2321
use Joomla\CMS\Table\Table;
2422
use Joomla\Database\ParameterType;
2523
use Joomla\Filesystem\Path;
26-
use Joomla\Registry\Registry;
2724
use Joomla\String\StringHelper;
2825
use Joomla\Utilities\ArrayHelper;
2926

@@ -54,14 +51,6 @@ class StyleModel extends AdminModel
5451
*/
5552
protected $helpURL;
5653

57-
/**
58-
* Item cache.
59-
*
60-
* @var array
61-
* @since 1.6
62-
*/
63-
private $_cache = [];
64-
6554
/**
6655
* Constructor.
6756
*
@@ -87,28 +76,6 @@ public function __construct($config = [], ?MVCFactoryInterface $factory = null)
8776
parent::__construct($config, $factory);
8877
}
8978

90-
/**
91-
* Method to auto-populate the model state.
92-
*
93-
* @note Calling getState in this method will result in recursion.
94-
*
95-
* @return void
96-
*
97-
* @since 1.6
98-
*/
99-
protected function populateState()
100-
{
101-
$app = Factory::getApplication();
102-
103-
// Load the User state.
104-
$pk = $app->getInput()->getInt('id');
105-
$this->setState('style.id', $pk);
106-
107-
// Load the parameters.
108-
$params = ComponentHelper::getParams('com_templates');
109-
$this->setState('params', $params);
110-
}
111-
11279
/**
11380
* Method to delete rows.
11481
*
@@ -284,10 +251,6 @@ public function getForm($data = [], $loadData = true)
284251
// Get the form.
285252
$form = $this->loadForm('com_templates.style', 'style', ['control' => 'jform', 'load_data' => $loadData]);
286253

287-
if (empty($form)) {
288-
return false;
289-
}
290-
291254
// Modify the form based on access controls.
292255
if (!$this->canEditState((object) $data)) {
293256
// Disable fields for display.
@@ -331,42 +294,18 @@ protected function loadFormData()
331294
*/
332295
public function getItem($pk = null)
333296
{
334-
$pk = (!empty($pk)) ? $pk : (int) $this->getState('style.id');
335-
336-
if (!isset($this->_cache[$pk])) {
337-
// Get a row instance.
338-
$table = $this->getTable();
339-
340-
// Attempt to load the row.
341-
$return = $table->load($pk);
342-
343-
// Check for a table object error.
344-
if ($return === false && $table->getError()) {
345-
$this->setError($table->getError());
346-
347-
return false;
348-
}
349-
350-
// Convert to the \Joomla\CMS\Object\CMSObject before adding other data.
351-
$properties = $table->getProperties(1);
352-
$this->_cache[$pk] = ArrayHelper::toObject($properties, CMSObject::class);
353-
354-
// Convert the params field to an array.
355-
$registry = new Registry($table->params);
356-
$this->_cache[$pk]->params = $registry->toArray();
357-
358-
// Get the template XML.
359-
$client = ApplicationHelper::getClientInfo($table->client_id);
360-
$path = Path::clean($client->path . '/templates/' . $table->template . '/templateDetails.xml');
297+
if ($item = parent::getItem($pk)) {
298+
$client = ApplicationHelper::getClientInfo($item->client_id);
299+
$path = Path::clean($client->path . '/templates/' . $item->template . '/templateDetails.xml');
361300

362301
if (file_exists($path)) {
363-
$this->_cache[$pk]->xml = simplexml_load_file($path);
302+
$item->xml = simplexml_load_file($path);
364303
} else {
365-
$this->_cache[$pk]->xml = null;
304+
$item->xml = null;
366305
}
367306
}
368307

369-
return $this->_cache[$pk];
308+
return $item;
370309
}
371310

372311
/**
@@ -385,7 +324,7 @@ protected function preprocessForm(Form $form, $data, $group = 'content')
385324
{
386325
$clientId = $this->getState('item.client_id');
387326
$template = $this->getState('item.template');
388-
$lang = Factory::getLanguage();
327+
$lang = Factory::getApplication()->getLanguage();
389328
$client = ApplicationHelper::getClientInfo($clientId);
390329

391330
if (!$form->loadFile('style_' . $client->name, true)) {
@@ -394,10 +333,18 @@ protected function preprocessForm(Form $form, $data, $group = 'content')
394333

395334
$formFile = Path::clean($client->path . '/templates/' . $template . '/templateDetails.xml');
396335

336+
/**
337+
* $data could be array or object, so we use object casting here to make sure $styleObj
338+
* is an object and access to template style data via the object's properties
339+
*/
340+
$styleObj = (object) $data;
341+
397342
// Load the core and/or local language file(s).
398343
// Default to using parent template language constants
399-
$lang->load('tpl_' . $data->parent, $client->path)
400-
|| $lang->load('tpl_' . $data->parent, $client->path . '/templates/' . $data->parent);
344+
if (!empty($styleObj->parent)) {
345+
$lang->load('tpl_' . $styleObj->parent, $client->path)
346+
|| $lang->load('tpl_' . $styleObj->parent, $client->path . '/templates/' . $styleObj->parent);
347+
}
401348

402349
// Apply any, optional, overrides for child template language constants
403350
$lang->load('tpl_' . $template, $client->path)
@@ -411,11 +358,7 @@ protected function preprocessForm(Form $form, $data, $group = 'content')
411358
}
412359

413360
// Disable home field if it is default style
414-
415-
if (
416-
(\is_array($data) && \array_key_exists('home', $data) && $data['home'] == '1')
417-
|| (\is_object($data) && isset($data->home) && $data->home == '1')
418-
) {
361+
if (isset($styleObj->home) && $styleObj->home == '1') {
419362
$form->setFieldAttribute('home', 'readonly', 'true');
420363
}
421364

0 commit comments

Comments
 (0)