release 1.3.1

This commit is contained in:
Jean-Christian Denis 2023-03-12 10:50:27 +01:00
parent f3b278db52
commit f5d57cf0ee
Signed by: JcDenis
GPG key ID: 1B5B8C5B90B6C951
5 changed files with 23 additions and 8 deletions

View file

@ -1,3 +1,7 @@
1.3.1 - 2023.03.12
* fix previously introduced bug
* add method to clean a string
1.3 - 2023.03.10
* update to dotclear 2.25
* use namespace

View file

@ -18,7 +18,7 @@ $this->registerModule(
'Clean URLs',
'Removes diacritics and punctuation from URLs',
'Pierre Rudloff and contributors',
'1.3',
'1.3.1',
[
'requires' => [['core', '2.25']],
'permissions' => dcCore::app()->auth->makePermissions([

View file

@ -2,10 +2,10 @@
<modules xmlns:da="http://dotaddict.org/da/">
<module id="cleanURLs">
<name>Clean URLs</name>
<version>1.3</version>
<version>1.3.1</version>
<author>Pierre Rudloff and contributors</author>
<desc>Removes diacritics and punctuation from URLs</desc>
<file>https://github.com/JcDenis/cleanURLs/releases/download/v1.3/plugin-cleanURLs.zip</file>
<file>https://github.com/JcDenis/cleanURLs/releases/download/v1.3.1/plugin-cleanURLs.zip</file>
<da:dcmin>2.25</da:dcmin>
<da:details>https://github.com/JcDenis/cleanURLs</da:details>
<da:support>https://github.com/JcDenis/cleanURLs</da:support>

View file

@ -222,16 +222,27 @@ class CleanURLs
}
/**
* Clean URLs from diacritics and punctuation
* Clean string from diacritics and punctuation
*
* @param null|string $str The string
*
* @return null|string The cleaned string
* */
public static function cleanStr(?string $str): ?string
{
return is_string($str) ? strtr(self::removeAccents($str), ',!.?;', '-----') : $str;
}
/**
* Clean post URLs from diacritics and punctuation
*
* @param object $blog Current blog
* @param object $cur Cursor
*
* @return void
* */
public static function clean($blog, $cur)
public static function cleanPost($blog, $cur)
{
$cur->post_url = self::removeAccents($cur->post_url);
$cur->post_url = strtr($cur->post_url, ',!.?;', '-----');
$cur->post_url = self::cleanStr($cur->post_url);
}
}

View file

@ -32,7 +32,7 @@ class Prepend extends dcNsProcess
return false;
}
dcCore::app()->addBehavior('coreBeforePostCreate', [CleanURLs::class, 'clean']);
dcCore::app()->addBehavior('coreBeforePostCreate', [CleanURLs::class, 'cleanPost']);
return true;
}