code review
This commit is contained in:
parent
de46d49d77
commit
35b0d4a0bc
8 changed files with 19 additions and 13 deletions
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -4,7 +4,6 @@ declare(strict_types=1);
|
|||
|
||||
namespace Dotclear\Plugin\alias;
|
||||
|
||||
use Dotclear\App;
|
||||
use Dotclear\Database\MetaRecord;
|
||||
|
||||
/**
|
||||
|
@ -39,4 +38,4 @@ class AliasRow
|
|||
!empty($rs->field('alias_redirect'))
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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']),
|
||||
|
|
|
@ -56,7 +56,7 @@ class PluginImportExportBehaviors
|
|||
$bk->__get('cur_alias')->insert();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static function importSingleV2(bool|FlatBackupItem $line, FlatImportV2 $bk): void
|
||||
{
|
||||
if (!is_bool($line) && $line->__name == Alias::ALIAS_TABLE_NAME) {
|
||||
|
@ -72,4 +72,4 @@ class PluginImportExportBehaviors
|
|||
$bk->__get('alias')->createAlias(new AliasRow($line->f('alias_url'), $line->f('alias_destination'), $line->f('alias_position'), $line->f('alias_redirect')));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue