Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class DisplayController extends BaseController
*
* @since 4.0.0
*/
public function __construct($config = array(), MVCFactoryInterface $factory = null, ?CMSApplication $app = null, ?Input $input = null)
public function __construct($config = array(), ?MVCFactoryInterface $factory = null, ?CMSApplication $app = null, ?Input $input = null)
{
parent::__construct($config, $factory, $app, $input);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class ImagesController extends JoomAdminController
*
* @since 4.0.0
*/
public function __construct($config = array(), MVCFactoryInterface $factory = null, ?CMSApplication $app = null, ?Input $input = null)
public function __construct($config = array(), ?MVCFactoryInterface $factory = null, ?CMSApplication $app = null, ?Input $input = null)
{
parent::__construct($config, $factory, $app, $input);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class JoomAdminController extends BaseAdminController
*
* @since 4.0.0
*/
public function __construct($config = array(), MVCFactoryInterface $factory = null, ?CMSApplication $app = null, ?Input $input = null)
public function __construct($config = array(), ?MVCFactoryInterface $factory = null, ?CMSApplication $app = null, ?Input $input = null)
{
parent::__construct($config, $factory, $app, $input);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use \Joomla\Input\Input;
use \Joomla\CMS\User\CurrentUserInterface;
use \Joomla\CMS\Application\CMSApplication;
use \Joomla\CMS\Form\FormFactoryInterface;
use \Joomla\CMS\MVC\Factory\MVCFactoryInterface;
use \Joomla\CMS\MVC\Controller\FormController as BaseFormController;
use \Joomgallery\Component\Joomgallery\Administrator\Helper\JoomHelper;
Expand Down Expand Up @@ -68,7 +69,7 @@ class JoomFormController extends BaseFormController
*
* @since 4.0.0
*/
public function __construct($config = [], MVCFactoryInterface $factory = null, ?CMSApplication $app = null, ?Input $input = null, FormFactoryInterface $formFactory = null)
public function __construct($config = [], ?MVCFactoryInterface $factory = null, ?CMSApplication $app = null, ?Input $input = null, ?FormFactoryInterface $formFactory = null)
{
parent::__construct($config, $factory, $app, $input, $formFactory);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class MigrationController extends BaseController implements FormFactoryAwareInte
*
* @since 4.0.0
*/
public function __construct($config = [], MVCFactoryInterface $factory = null, ?CMSApplication $app = null, ?Input $input = null, FormFactoryInterface $formFactory = null)
public function __construct($config = [], ?MVCFactoryInterface $factory = null, ?CMSApplication $app = null, ?Input $input = null, ?FormFactoryInterface $formFactory = null)
{
parent::__construct($config, $factory, $app, $input);

Expand Down
8 changes: 4 additions & 4 deletions administrator/com_joomgallery/src/Extension/MessageTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public function msgFromSession()
*
* @since 4.0.0
*/
protected function addLogger(string $name = null)
protected function addLogger(?string $name = null)
{
if(!$this->log)
{
Expand All @@ -166,7 +166,7 @@ protected function addLogger(string $name = null)
*
* @since 4.0.0
*/
public function setLogger(string $name = null)
public function setLogger(?string $name = null)
{
$this->addLogger($name);
$this->logName = $name;
Expand All @@ -182,7 +182,7 @@ public function setLogger(string $name = null)
*
* @since 4.0.0
*/
public function addLog(string $txt, $priority = 8, string $name = null)
public function addLog(string $txt, $priority = 8, ?string $name = null)
{
$this->addLogger($name);

Expand Down Expand Up @@ -218,7 +218,7 @@ public function addLog(string $txt, $priority = 8, string $name = null)
*
* @since 4.0.0
*/
public function setLog(string $txt, $priority = 8, string $name = null)
public function setLog(string $txt, $priority = 8, ?string $name = null)
{
return $this->addLog($txt, $priority, $name);
}
Expand Down
2 changes: 1 addition & 1 deletion administrator/com_joomgallery/src/MVC/MVCFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function getIdentity()
*
* @since 4.0.0
*/
public function loadIdentity(User $identity = null)
public function loadIdentity(?User $identity = null)
{
if(\is_null($identity))
{
Expand Down
15 changes: 14 additions & 1 deletion administrator/com_joomgallery/src/Model/CategoryModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -606,8 +606,21 @@ public function save($data)
// Get path back from old location temporarily
$table->setPathWithLocation(true);

// Get new folder name
$folder_name = $table->alias;
if($this->component->getConfig()->get('jg_compatibility_mode', 0))
{
$static_name = \basename($table->static_path);
if(\preg_match('/_([0-9]+)$/', $static_name))
{
// We found a numeric value at the end of the folder name: e.g alias_6
// Therefore we use the static folder name instead
$folder_name = $static_name;
}
}

// Rename folder
if(!$manager->renameCategory($old_table, $table->alias))
if(!$manager->renameCategory($old_table, $folder_name))
{
$this->component->addDebug(Text::sprintf('COM_JOOMGALLERY_ERROR_RENAME_CATEGORY', $manager->paths['src'], $manager->paths['dest']));
$this->component->addLog(Text::sprintf('COM_JOOMGALLERY_ERROR_RENAME_CATEGORY', $manager->paths['src'], $manager->paths['dest']), 'error', 'jerror');
Expand Down
2 changes: 1 addition & 1 deletion administrator/com_joomgallery/src/Model/ImageModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class ImageModel extends JoomAdminModel
* @since 4.0.0
* @throws \Exception
*/
public function __construct($config = [], MVCFactoryInterface $factory = null, FormFactoryInterface $formFactory = null)
public function __construct($config = [], ?MVCFactoryInterface $factory = null, ?FormFactoryInterface $formFactory = null)
{
parent::__construct($config, $factory, $formFactory);

Expand Down
2 changes: 1 addition & 1 deletion administrator/com_joomgallery/src/Model/JoomAdminModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ abstract class JoomAdminModel extends AdminModel
* @since 4.0.0
* @throws \Exception
*/
public function __construct($config = [], MVCFactoryInterface $factory = null, FormFactoryInterface $formFactory = null)
public function __construct($config = [], ?MVCFactoryInterface $factory = null, ?FormFactoryInterface $formFactory = null)
{
parent::__construct($config, $factory, $formFactory);

Expand Down
2 changes: 1 addition & 1 deletion administrator/com_joomgallery/src/Router/RouterFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class RouterFactory extends RouterFactoryBase implements RouterFactoryInterface
*
* @since 4.0.0
*/
public function __construct($namespace, CategoryFactoryInterface $categoryFactory = null, DatabaseInterface $db = null)
public function __construct($namespace, ?CategoryFactoryInterface $categoryFactory = null, ?DatabaseInterface $db = null)
{
$this->namespace = $namespace;
$this->categoryFactory = $categoryFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1116,6 +1116,12 @@ public function renameCategory($cat, $foldername, $logfile='jerror'): bool
// Create renamed category foldername
$folder_new = \substr($folder_orig, 0, strrpos($folder_orig, \basename($folder_orig))) . $foldername;

if($folder_new == $folder_orig)
{
// No renaming of folders needed
continue;
}

// Rename folder
try
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*/
class FileNotFoundException extends IOException
{
public function __construct($message = null, $code = 0, \Exception $previous = null, $path = null)
public function __construct($message = null, $code = 0, ?\Exception $previous = null, $path = null)
{
if (null === $message) {
if (null === $path) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class IOException extends \RuntimeException implements IOExceptionInterface
{
private $path;

public function __construct($message, $code = 0, \Exception $previous = null, $path = null)
public function __construct($message, $code = 0, ?\Exception $previous = null, $path = null)
{
$this->path = $path;

Expand Down
4 changes: 2 additions & 2 deletions joomgallery.xml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="4.0" method="upgrade">
<name>com_joomgallery</name>
<creationDate>2025-03-12</creationDate>
<creationDate>2025-04-03</creationDate>
<copyright>2008 - 2025 JoomGallery::ProjectTeam</copyright>
<license>GNU General Public License version 3 or later</license>
<author>JoomGallery::ProjectTeam</author>
<authorEmail>team@joomgalleryfriends.net</authorEmail>
<authorUrl>https://www.joomgalleryfriends.net/</authorUrl>
<version>4.0.0</version>
<version>4.0.1</version>
<description>JoomGallery 4, a native gallery component for Joomla! 4.x and 5.x</description>
<namespace path="src">Joomgallery\Component\Joomgallery</namespace>

Expand Down
4 changes: 0 additions & 4 deletions media/com_joomgallery/css/site.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
:root {
--jg-color-link: #000000;
--jg-color-hover: #000000;
--jg-gray-100: #f9fafb;
--jg-gray-200: #eaedf0;
--jg-gray-300: #dfe3e7;
Expand Down Expand Up @@ -224,12 +222,10 @@ table.itemList th.sort-cell .form-check-input {
font-family: revert;
}
a.jg-link:not(.btn) {
color: var(--jg-color-link);
text-decoration: none;
word-break: break-all;
}
a.jg-link:not(.btn):hover, a.jg-link:not(.btn):focus {
color: var(--jg-color-hover);
text-decoration: underline 2px;
}
.load-more-container {
Expand Down
2 changes: 1 addition & 1 deletion media/com_joomgallery/joomla.asset.json
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
{
"name": "com_joomgallery.justified",
"type": "script",
"uri": "com_joomgallery/imgjust.min.js",
"uri": "com_joomgallery/imgjust/imgjust.min.js",
"attributes": {
"defer": true
}
Expand Down
Binary file modified media/com_joomgallery/js/.DS_Store
Binary file not shown.
1 change: 0 additions & 1 deletion media/com_joomgallery/js/imgjust.min.js

This file was deleted.

97 changes: 97 additions & 0 deletions media/com_joomgallery/js/imgjust/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# ImgJust
## Credits
Thanks to the original repository of this library:
https://github.com/hikir1/ImgJust

## Justified Image Wall Generator
Use ImgJust to create a wall of images on your website.
It's based on the LaTex paragraph justifying algorithm.
Images are scaled while maintaing their aspect ratios.
The source code is simple: it fits on 2 pages and uses
VanillaJS, so you don't have to worry about dependencies,
efficiency, or page load times.

## Algorithm

Given an ideal height, images are carefully put in rows
so that the width of each row is as close to the width of their
container as possible. Then the rows are scaled to fit their
container perfectly.

## Usage

Include the source code in your web page:
```html
<script src="path/to/imgjust.js"></script>
```

Once the page has loaded, use the ImgJust constructor,
passing in the container for the wall, an array
of HTMLImageElement objects, and an optional options object:
```js
addEventListener("load", _ => {
const container = document.querySelector(".imgjust");
const imgs = document.querySelectorAll(".imgjust img");
const options = {
idealHeight: 150,
};
const imgjust = new ImgJust(container, imgs, options);
});
```

## Options & Defaults

- idealHeight: 150
- rowGap = 0
- columnGap = 0
- paddingLeft = 0
- paddingRight = 0
- paddingTop = 0
- paddingBottom = 0

## ImgJust Public Methods

- `constructor(container, imgs=[], options={})`
- `reload()`
- `addImages(imgs)`

## Styling

Style the components normally using CSS.

*Note: if adding space, make sure to account for
it by changing the above mentioned padding and gap options.*

*Another Note: You may want to set the root `overflow-y`
property to `scroll` so that the width of the ImgJust
container doesn't change after being rendered.*

```css
:root {
overflow-y: scroll;
}
.imgjust {
background: red;
}
.imgjust img {
border: 1px solid black;
}
```

## Nested Elements

The DOM is not altered in any way,
so images can safely be placed in other
elements.

```html
<div class="imgjust">
<a href="larger-img-1.jpg">
<img src="icon-1.jpg">
</a>
<a href="larger-img-2.jpg">
<img src="icon-2.jpg">
</a>
...
</div>
```
Loading