Skip to content

Commit c9fb1ca

Browse files
Fix #116
1 parent bee6e7b commit c9fb1ca

File tree

13 files changed

+33
-25
lines changed

13 files changed

+33
-25
lines changed

com_swjprojects/admin/src/Model/ProjectModel.php

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class ProjectModel extends AdminModel
5353
public function getForm($data = [], $loadData = true)
5454
{
5555
$app = Factory::getApplication();
56-
$form = $this->loadForm('com_swjprojects.project', 'project', array('control' => 'jform', 'load_data' => $loadData));
56+
$form = $this->loadForm('com_swjprojects.project', 'project', ['control' => 'jform', 'load_data' => $loadData]);
5757
if (empty($form))
5858
{
5959
return false;
@@ -87,7 +87,7 @@ public function getForm($data = [], $loadData = true)
8787
*/
8888
public function validate($form, $data, $group = null)
8989
{
90-
$translates = (!empty($data['translates'])) ? $data['translates'] : array();
90+
$translates = (!empty($data['translates'])) ? $data['translates'] : [];
9191

9292
// Main validate
9393
if (!$data = parent::validate($form, $data, $group))
@@ -101,7 +101,7 @@ public function validate($form, $data, $group = null)
101101
$data['translates'] = [];
102102
foreach ($forms as $code => $form)
103103
{
104-
$translate = (!empty($translates[$code])) ? $translates[$code] : array();
104+
$translate = (!empty($translates[$code])) ? $translates[$code] : [];
105105

106106
if (!$validate = parent::validate($form, $translate, $group))
107107
{
@@ -327,6 +327,14 @@ public function save($data)
327327

328328
// Check element is already exist
329329
$element = $data['element'];
330+
if (Factory::getContainer()->get('config')->get('unicodeslugs') == 1)
331+
{
332+
$element = OutputFilter::stringURLUnicodeSlug($element);
333+
}
334+
else
335+
{
336+
$element = OutputFilter::stringURLSafe($element);
337+
}
330338
$checkElement = $this->getTable();
331339
$checkElement->load(array('element' => $element));
332340
if (!empty($checkElement->id) && ($checkElement->id != $pk || $isNew))
@@ -350,7 +358,7 @@ public function save($data)
350358

351359
// Check alias is already exist
352360
$checkAlias = $this->getTable();
353-
$checkAlias->load(array('alias' => $alias));
361+
$checkAlias->load(['alias' => $alias]);
354362
if (!empty($checkAlias->id) && ($checkAlias->id != $pk || $isNew))
355363
{
356364
$alias = $this->generateNewAlias($alias);
@@ -381,7 +389,7 @@ public function save($data)
381389
}
382390

383391
$registry = new Registry($data['joomla']);
384-
$data['joomla'] = $registry->toString('json', array('bitmask' => JSON_UNESCAPED_UNICODE));
392+
$data['joomla'] = $registry->toString('json', ['bitmask' => JSON_UNESCAPED_UNICODE]);
385393
}
386394
else
387395
{
@@ -396,7 +404,7 @@ public function save($data)
396404
return !empty($element);
397405
});
398406
$registry = new Registry($data['urls']);
399-
$data['urls'] = $registry->toString('json', array('bitmask' => JSON_UNESCAPED_UNICODE));
407+
$data['urls'] = $registry->toString('json', ['bitmask' => JSON_UNESCAPED_UNICODE]);
400408
}
401409

402410
// Prepare relations field data
@@ -411,14 +419,14 @@ public function save($data)
411419
}
412420

413421
$registry = new Registry($data['relations']);
414-
$data['relations'] = $registry->toString('json', array('bitmask' => JSON_UNESCAPED_UNICODE));
422+
$data['relations'] = $registry->toString('json', ['bitmask' => JSON_UNESCAPED_UNICODE]);
415423
}
416424

417425
// Prepare params field data
418426
if (isset($data['params']))
419427
{
420428
$registry = new Registry($data['params']);
421-
$data['params'] = $registry->toString('json', array('bitmask' => JSON_UNESCAPED_UNICODE));
429+
$data['params'] = $registry->toString('json', ['bitmask' => JSON_UNESCAPED_UNICODE]);
422430
}
423431

424432
if (parent::save($data))
@@ -444,21 +452,21 @@ public function save($data)
444452
if (isset($translate['gallery']))
445453
{
446454
$registry = new Registry($translate['gallery']);
447-
$translate['gallery'] = $registry->toString('json', array('bitmask' => JSON_UNESCAPED_UNICODE));
455+
$translate['gallery'] = $registry->toString('json', ['bitmask' => JSON_UNESCAPED_UNICODE]);
448456
}
449457

450458
// Prepare payment field data
451459
if (isset($translate['payment']))
452460
{
453461
$registry = new Registry($translate['payment']);
454-
$translate['payment'] = $registry->toString('json', array('bitmask' => JSON_UNESCAPED_UNICODE));
462+
$translate['payment'] = $registry->toString('json', ['bitmask' => JSON_UNESCAPED_UNICODE]);
455463
}
456464

457465
// Prepare metadata field data
458466
if (isset($translate['metadata']))
459467
{
460468
$registry = new Registry($translate['metadata']);
461-
$translate['metadata'] = $registry->toString('json', array('bitmask' => JSON_UNESCAPED_UNICODE));
469+
$translate['metadata'] = $registry->toString('json', ['bitmask' => JSON_UNESCAPED_UNICODE]);
462470
}
463471

464472
$translate = (object) $translate;
@@ -522,7 +530,7 @@ public function getTable($name = 'Projects', $prefix = 'Administrator', $options
522530
protected function generateNewElement($element)
523531
{
524532
$table = $this->getTable();
525-
while ($table->load(array('element' => $element)))
533+
while ($table->load(['element' => $element]))
526534
{
527535
$element = StringHelper::increment($element, 'dash');
528536
}
@@ -544,7 +552,7 @@ protected function generateNewElement($element)
544552
protected function generateNewAlias($alias)
545553
{
546554
$table = $this->getTable();
547-
while ($table->load(array('alias' => $alias)))
555+
while ($table->load(['alias' => $alias]))
548556
{
549557
$alias = StringHelper::increment($alias, 'dash');
550558
}

com_swjprojects/swjprojects.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<extension version="4.0" type="component" method="upgrade">
33
<name>COM_SWJPROJECTS</name>
44
<author>Sergey Tolkachyov</author>
5-
<creationDate>18.11.2025</creationDate>
5+
<creationDate>19.11.2025</creationDate>
66
<copyright>Copyright (c) 2018 - 2025 Sergey Tolkachyov. All rights reserved.</copyright>
77
<license>https://www.gnu.org/copyleft/gpl.html GNU/GPL</license>
88
<authorEmail>[email protected]</authorEmail>

mod_swjprojects_categories/mod_swjprojects_categories.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<extension type="module" client="site" method="upgrade">
33
<name>mod_swjprojects_categories</name>
44
<author>Sergey Tolkachyov</author>
5-
<creationDate>18.11.2025</creationDate>
5+
<creationDate>19.11.2025</creationDate>
66
<copyright>Copyright (c) 2018 - 2025 Sergey Tolkachyov. All rights reserved.</copyright>
77
<license>https://www.gnu.org/copyleft/gpl.html GNU/GPL</license>
88
<authorEmail>[email protected]</authorEmail>

mod_swjprojects_projects/mod_swjprojects_projects.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<extension type="module" client="site" method="upgrade">
33
<name>MOD_SWJPROJECTS_PROJECTS</name>
44
<author>Sergey Tolkachyov</author>
5-
<creationDate>18.11.2025</creationDate>
5+
<creationDate>19.11.2025</creationDate>
66
<copyright>Copyright (c) 2018 - 2025 Sergey Tolkachyov. All rights reserved.</copyright>
77
<license>https://www.gnu.org/copyleft/gpl.html GNU/GPL</license>
88
<authorEmail>[email protected]</authorEmail>

mod_swjprojects_versions/mod_swjprojects_versions.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<extension type="module" client="site" method="upgrade">
33
<name>MOD_SWJPROJECTS_VERSIONS</name>
44
<author>Sergey Tolkachyov</author>
5-
<creationDate>18.11.2025</creationDate>
5+
<creationDate>19.11.2025</creationDate>
66
<copyright>Copyright (c) 2018 - 2025 Sergey Tolkachyov. All rights reserved.</copyright>
77
<license>https://www.gnu.org/copyleft/gpl.html GNU/GPL</license>
88
<authorEmail>[email protected]</authorEmail>

pkg_swjprojects.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<name>PKG_SWJPROJECTS</name>
44
<packagename>swjprojects</packagename>
55
<author>Sergey Tolkachyov</author>
6-
<creationDate>18.11.2025</creationDate>
6+
<creationDate>19.11.2025</creationDate>
77
<copyright>Copyright (c) 2018 - 2025 Sergey Tolkachyov. All rights reserved.</copyright>
88
<license>https://www.gnu.org/copyleft/gpl.html GNU/GPL</license>
99
<authorUrl>https://web-tolk.ru</authorUrl>

plg_actionlog_swjprojects/swjprojects.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<extension type="plugin" group="actionlog" method="upgrade">
33
<name>PLG_ACTIONLOG_SWJPROJECTS</name>
44
<author>Sergey Tolkachyov</author>
5-
<creationDate>18.11.2025</creationDate>
5+
<creationDate>19.11.2025</creationDate>
66
<copyright>Copyright (c) 2018 - 2025 Sergey Tolkachyov. All rights reserved.</copyright>
77
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
88
<authorEmail>[email protected]</authorEmail>

plg_content_swjprojects/swjprojects.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<extension type="plugin" group="content" method="upgrade">
33
<name>PLG_SWJPROJECTS</name>
44
<author>Sergey Tolkachyov</author>
5-
<creationDate>18.11.2025</creationDate>
5+
<creationDate>19.11.2025</creationDate>
66
<copyright>Copyright (c) 2018 - 2025 Sergey Tolkachyov. All rights reserved.</copyright>
77
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
88
<authorEmail>[email protected]</authorEmail>

plg_editors-xtd_swjprojectseditorxtd/swjprojectseditorxtd.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<extension type="plugin" group="editors-xtd" method="upgrade">
33
<name>PLG_SWJPROJECTSEDITORXTD</name>
44
<author>Sergey Tolkachyov</author>
5-
<creationDate>18.11.2025</creationDate>
5+
<creationDate>19.11.2025</creationDate>
66
<copyright>Copyright (c) 2018 - 2025 Sergey Tolkachyov. All rights reserved.</copyright>
77
<license>GNU General Public License version 3</license>
88
<authorEmail>[email protected]</authorEmail>

plg_finder_swjprojects_documentation/swjprojectsdocumentation.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<extension type="plugin" group="finder" method="upgrade">
33
<name>plg_finder_swjprojectsdocumentation</name>
44
<author>Sergey Tolkachyov</author>
5-
<creationDate>18.11.2025</creationDate>
5+
<creationDate>19.11.2025</creationDate>
66
<copyright>Copyright (c) 2018 - 2025 Sergey Tolkachyov. All rights reserved.</copyright>
77
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
88
<authorEmail>[email protected]</authorEmail>

0 commit comments

Comments
 (0)