Skip to content

Commit 8081015

Browse files
committed
Base:6.0-dev upmerges from 5.4-dev
1 parent 683b4b9 commit 8081015

File tree

46 files changed

+299
-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

+299
-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: 19 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
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;
@@ -22,7 +21,6 @@
2221
use Joomla\CMS\Table\Extension;
2322
use Joomla\Database\ParameterType;
2423
use Joomla\Filesystem\Path;
25-
use Joomla\Registry\Registry;
2624
use Joomla\String\StringHelper;
2725
use Joomla\Utilities\ArrayHelper;
2826

@@ -53,14 +51,6 @@ class StyleModel extends AdminModel
5351
*/
5452
protected $helpURL;
5553

56-
/**
57-
* Item cache.
58-
*
59-
* @var array
60-
* @since 1.6
61-
*/
62-
private $_cache = [];
63-
6454
/**
6555
* Constructor.
6656
*
@@ -86,28 +76,6 @@ public function __construct($config = [], ?MVCFactoryInterface $factory = null)
8676
parent::__construct($config, $factory);
8777
}
8878

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

286-
if (empty($form)) {
287-
return false;
288-
}
289-
290254
// Modify the form based on access controls.
291255
if (!$this->canEditState((object) $data)) {
292256
// Disable fields for display.
@@ -326,46 +290,22 @@ protected function loadFormData()
326290
*
327291
* @param integer $pk The id of the primary key.
328292
*
329-
* @return \stdClass|false Object on success, false on failure.
293+
* @return mixed Object on success, false on failure.
330294
*/
331295
public function getItem($pk = null)
332296
{
333-
$pk = (!empty($pk)) ? $pk : (int) $this->getState('style.id');
334-
335-
if (!isset($this->_cache[$pk])) {
336-
// Get a row instance.
337-
$table = $this->getTable();
338-
339-
// Attempt to load the row.
340-
$return = $table->load($pk);
341-
342-
// Check for a table object error.
343-
if ($return === false && $table->getError()) {
344-
$this->setError($table->getError());
345-
346-
return false;
347-
}
348-
349-
// Convert to an object before adding other data.
350-
$properties = $table->getProperties(1);
351-
$this->_cache[$pk] = ArrayHelper::toObject($properties);
352-
353-
// Convert the params field to an array.
354-
$registry = new Registry($table->params);
355-
$this->_cache[$pk]->params = $registry->toArray();
356-
357-
// Get the template XML.
358-
$client = ApplicationHelper::getClientInfo($table->client_id);
359-
$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');
360300

361301
if (file_exists($path)) {
362-
$this->_cache[$pk]->xml = simplexml_load_file($path);
302+
$item->xml = simplexml_load_file($path);
363303
} else {
364-
$this->_cache[$pk]->xml = null;
304+
$item->xml = null;
365305
}
366306
}
367307

368-
return $this->_cache[$pk];
308+
return $item;
369309
}
370310

371311
/**
@@ -384,7 +324,7 @@ protected function preprocessForm(Form $form, $data, $group = 'content')
384324
{
385325
$clientId = $this->getState('item.client_id');
386326
$template = $this->getState('item.template');
387-
$lang = Factory::getLanguage();
327+
$lang = Factory::getApplication()->getLanguage();
388328
$client = ApplicationHelper::getClientInfo($clientId);
389329

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

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

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+
396342
// Load the core and/or local language file(s).
397343
// Default to using parent template language constants
398-
$lang->load('tpl_' . $data->parent, $client->path)
399-
|| $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+
}
400348

401349
// Apply any, optional, overrides for child template language constants
402350
$lang->load('tpl_' . $template, $client->path)
@@ -410,11 +358,7 @@ protected function preprocessForm(Form $form, $data, $group = 'content')
410358
}
411359

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

0 commit comments

Comments
 (0)