code review

This commit is contained in:
Jean-Christian Denis 2023-10-24 11:43:11 +02:00
parent de46d49d77
commit 35b0d4a0bc
Signed by: JcDenis
GPG key ID: 1B5B8C5B90B6C951
8 changed files with 19 additions and 13 deletions

View file

@ -1,5 +1,12 @@
alias 1.10 - 2023.10.15
===========================================================
* Require Dotclear 2.28
* Require PHP 8.1
* Use class for alias row
* Code review
alias 1.11 - 2023.10.23
===========================================================
* require Dotclear 2.28
* require PHP 8.1
* Upgrade to Dotclear 2.28

View file

@ -1,7 +1,7 @@
# README
[![Release](https://img.shields.io/badge/release-1.10-a2cbe9.svg)](https://git.dotclear.watch/JcDenis/alias/releases)
![Date](https://img.shields.io/badge/date-2023.10.15-c44d58.svg)
[![Release](https://img.shields.io/badge/release-1.11-a2cbe9.svg)](https://git.dotclear.watch/JcDenis/alias/releases)
![Date](https://img.shields.io/badge/date-2023.10.23-c44d58.svg)
[![Dotclear](https://img.shields.io/badge/dotclear-v2.28-137bbb.svg)](https://fr.dotclear.org/download)
[![Dotaddict](https://img.shields.io/badge/dotaddict-official-9ac123.svg)](https://plugins.dotaddict.org/dc2/details/alias)
[![License](https://img.shields.io/badge/license-GPL--2.0-ececec.svg)](https://git.dotclear.watch/JcDenis/alias/src/branch/master/LICENSE)

View file

@ -18,7 +18,7 @@ $this->registerModule(
'alias',
"Create aliases of your blog's URLs",
'Olivier Meunier and contributors',
'1.10',
'1.11',
[
'requires' => [['core', '2.28']],
'permissions' => 'My',

View file

@ -2,10 +2,10 @@
<modules xmlns:da="http://dotaddict.org/da/">
<module id="alias">
<name>alias</name>
<version>1.10</version>
<version>1.11</version>
<author>Olivier Meunier and contributors</author>
<desc>Create aliases of your blog's URLs</desc>
<file>https://git.dotclear.watch/JcDenis/alias/releases/download/v1.10/plugin-alias.zip</file>
<file>https://git.dotclear.watch/JcDenis/alias/releases/download/v1.11/plugin-alias.zip</file>
<da:dcmin>2.28</da:dcmin>
<da:details>https://git.dotclear.watch/JcDenis/alias/src/branch/master/README.md</da:details>
<da:support>https://git.dotclear.watch/JcDenis/alias/issues</da:support>

View file

@ -104,7 +104,7 @@ class Alias
*
* @param AliasRow $alias The new Alias descriptor
*/
public function createAlias(AliasRow $alias):void
public function createAlias(AliasRow $alias): void
{
if (!App::blog()->isDefined()) {
return;
@ -123,7 +123,7 @@ class Alias
$cur = App::con()->openCursor(App::con()->prefix() . Alias::ALIAS_TABLE_NAME);
$cur->setField('blog_id', App::blog()->id());
$cur->setField('alias_url', $url);
$cur->setField('alias_destination',$destination);
$cur->setField('alias_destination', $destination);
$cur->setField('alias_position', $alias->position);
$cur->setField('alias_redirect', (int) $alias->redirect);
$cur->insert();

View file

@ -4,7 +4,6 @@ declare(strict_types=1);
namespace Dotclear\Plugin\alias;
use Dotclear\App;
use Dotclear\Database\MetaRecord;
/**

View file

@ -58,9 +58,9 @@ class Manage extends Process
if (isset($_POST['a']) && is_array($_POST['a'])) {
try {
$stack = [];
foreach($_POST['a'] as $alias) {
foreach ($_POST['a'] as $alias) {
$stack[] = new AliasRow(
$alias['alias_url'] ?? '',
$alias['alias_url'] ?? '',
$alias['alias_destination'] ?? '',
(int) ($alias['alias_position'] ?? 0),
!empty($alias['alias_redirect']),