cosmetic clean
This commit is contained in:
parent
5d5ccaf9b0
commit
5883ca1af2
@ -1,3 +1,9 @@
|
|||||||
|
cleanURLs 1.6.1 - 2023.10.15
|
||||||
|
===========================================================
|
||||||
|
* Require Dotclear 2.28
|
||||||
|
* Require PHP 8.1+
|
||||||
|
* Cosmetic clean
|
||||||
|
|
||||||
cleanURLs 1.6 - 2023.10.07
|
cleanURLs 1.6 - 2023.10.07
|
||||||
===========================================================
|
===========================================================
|
||||||
* Require Dotclear 2.28
|
* Require Dotclear 2.28
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
# README
|
# README
|
||||||
|
|
||||||
[![Release](https://img.shields.io/badge/release-1.6-a2cbe9.svg)](https://git.dotclear.watch/JcDenis/cleanURLs/releases)
|
[![Release](https://img.shields.io/badge/release-1.6.1-a2cbe9.svg)](https://git.dotclear.watch/JcDenis/cleanURLs/releases)
|
||||||
![Date](https://img.shields.io/badge/date-2023.10.07-c44d58.svg)
|
![Date](https://img.shields.io/badge/date-2023.10.15-c44d58.svg)
|
||||||
[![Dotclear](https://img.shields.io/badge/dotclear-v2.28-137bbb.svg)](https://fr.dotclear.org/download)
|
[![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/cleanURLs)
|
[![Dotaddict](https://img.shields.io/badge/dotaddict-official-9ac123.svg)](https://plugins.dotaddict.org/dc2/details/cleanURLs)
|
||||||
[![License](https://img.shields.io/badge/license-GPL--2.0-ececec.svg)](https://git.dotclear.watch/JcDenis/cleanURLs/src/branch/master/LICENSE)
|
[![License](https://img.shields.io/badge/license-GPL--3.0-ececec.svg)](https://git.dotclear.watch/JcDenis/cleanURLs/src/branch/master/LICENSE)
|
||||||
|
|
||||||
## ABOUT
|
## ABOUT
|
||||||
|
|
||||||
@ -33,6 +33,6 @@ Then when a post is created, it's URL is cleaned automagically.
|
|||||||
## CONTRIBUTORS
|
## CONTRIBUTORS
|
||||||
|
|
||||||
* Pierre Rudloff (author)
|
* Pierre Rudloff (author)
|
||||||
* Jean-Christian Denis
|
* Jean-Christian Denis (latest)
|
||||||
|
|
||||||
You are welcome to contribute to this code.
|
You are welcome to contribute to this code.
|
||||||
|
35
_define.php
35
_define.php
@ -1,35 +1,30 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @brief cleanURLs, a plugin for Dotclear 2
|
* @file
|
||||||
|
* @brief The plugin cleanURLs definition
|
||||||
|
* @ingroup cleanURLs
|
||||||
*
|
*
|
||||||
* @package Dotclear
|
* @defgroup cleanURLs Plugin cleanURLs.
|
||||||
* @subpackage Plugin
|
|
||||||
*
|
*
|
||||||
* @author Pierre Rudloff and contributors
|
* Removes diacritics and punctuation from URLs.
|
||||||
*
|
*
|
||||||
* @copyright Jean-Christian Denis
|
* @author Pierre Rudloff (author)
|
||||||
* @copyright GPL-3.0 https://www.gnu.org/licenses/gpl-2.0.html
|
* @author Jean-Christian Denis (latest)
|
||||||
|
* @copyright GPL-3.0 https://www.gnu.org/licenses/gpl-3.0.html
|
||||||
*/
|
*/
|
||||||
if (!defined('DC_RC_PATH')) {
|
declare(strict_types=1);
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
use Dotclear\App;
|
|
||||||
|
|
||||||
$this->registerModule(
|
$this->registerModule(
|
||||||
'Clean URLs',
|
'Clean URLs',
|
||||||
'Removes diacritics and punctuation from URLs',
|
'Removes diacritics and punctuation from URLs',
|
||||||
'Pierre Rudloff and contributors',
|
'Pierre Rudloff and contributors',
|
||||||
'1.6',
|
'1.6.1',
|
||||||
[
|
[
|
||||||
'requires' => [['core', '2.28']],
|
'requires' => [['core', '2.28']],
|
||||||
'permissions' => App::auth()->makePermissions([
|
'permissions' => 'My',
|
||||||
App::auth()::PERMISSION_USAGE,
|
'type' => 'plugin',
|
||||||
App::auth()::PERMISSION_CONTENT_ADMIN,
|
'support' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/issues',
|
||||||
]),
|
'details' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/src/branch/master/README.md',
|
||||||
'type' => 'plugin',
|
'repository' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/raw/branch/master/dcstore.xml',
|
||||||
'support' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/issues',
|
|
||||||
'details' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/src/branch/master/README.md',
|
|
||||||
'repository' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/raw/branch/master/dcstore.xml',
|
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
@ -2,10 +2,10 @@
|
|||||||
<modules xmlns:da="http://dotaddict.org/da/">
|
<modules xmlns:da="http://dotaddict.org/da/">
|
||||||
<module id="cleanURLs">
|
<module id="cleanURLs">
|
||||||
<name>Clean URLs</name>
|
<name>Clean URLs</name>
|
||||||
<version>1.6</version>
|
<version>1.6.1</version>
|
||||||
<author>Pierre Rudloff and contributors</author>
|
<author>Pierre Rudloff and contributors</author>
|
||||||
<desc>Removes diacritics and punctuation from URLs</desc>
|
<desc>Removes diacritics and punctuation from URLs</desc>
|
||||||
<file>https://git.dotclear.watch/JcDenis/cleanURLs/releases/download/v1.6/plugin-cleanURLs.zip</file>
|
<file>https://git.dotclear.watch/JcDenis/cleanURLs/releases/download/v1.6.1/plugin-cleanURLs.zip</file>
|
||||||
<da:dcmin>2.28</da:dcmin>
|
<da:dcmin>2.28</da:dcmin>
|
||||||
<da:details>https://git.dotclear.watch/JcDenis/cleanURLs/src/branch/master/README.md</da:details>
|
<da:details>https://git.dotclear.watch/JcDenis/cleanURLs/src/branch/master/README.md</da:details>
|
||||||
<da:support>https://git.dotclear.watch/JcDenis/cleanURLs/issues</da:support>
|
<da:support>https://git.dotclear.watch/JcDenis/cleanURLs/issues</da:support>
|
||||||
|
@ -1,42 +1,48 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* @brief cleanURLs, a plugin for Dotclear 2
|
|
||||||
*
|
|
||||||
* @package Dotclear
|
|
||||||
* @subpackage Plugin
|
|
||||||
*
|
|
||||||
* @author Pierre Rudloff and contributors
|
|
||||||
*
|
|
||||||
* @copyright Jean-Christian Denis
|
|
||||||
* @copyright GPL-3.0 https://www.gnu.org/licenses/gpl-3.0.html
|
|
||||||
*/
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\cleanURLs;
|
namespace Dotclear\Plugin\cleanURLs;
|
||||||
|
|
||||||
use Dotclear\Core\Blog;
|
use Dotclear\Interface\Core\BlogInterface;
|
||||||
use Dotclear\Database\Cursor;
|
use Dotclear\Database\Cursor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class to remove problematic characters from URLs
|
* @brief cleanURLs main class.
|
||||||
|
* @ingroup cleanURLs
|
||||||
*
|
*
|
||||||
* PHP Version 5
|
* @author Pierre Rudloff (author)
|
||||||
*
|
* @author Jean-Christian Denis (latest)
|
||||||
* @category Plugin
|
* @copyright GPL-3.0 https://www.gnu.org/licenses/gpl-3.0.html
|
||||||
* @package CleanURLs
|
*/
|
||||||
* @author Pierre Rudloff <contact@rudloff.pro>
|
|
||||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License
|
|
||||||
* @link http://rudloff.pro
|
|
||||||
* */
|
|
||||||
class CleanURLs
|
class CleanURLs
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Chars to convert from.
|
||||||
|
*
|
||||||
|
* @var string CONVERT_FROM_CHARS
|
||||||
|
*/
|
||||||
public const CONVERT_FROM_CHARS = ',!.?;:@$«»°*';
|
public const CONVERT_FROM_CHARS = ',!.?;:@$«»°*';
|
||||||
public const CONVERT_TO_CHAR = '-';
|
|
||||||
|
|
||||||
/** @var string $convert_from_chars List of special chars to convert */
|
/**
|
||||||
|
* Chars to convert to.
|
||||||
|
*
|
||||||
|
* @var string CONVERT_TO_CHAR
|
||||||
|
*/
|
||||||
|
public const CONVERT_TO_CHAR = '-';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of special chars to convert.
|
||||||
|
*
|
||||||
|
* @var string $convert_from_chars
|
||||||
|
*/
|
||||||
public static string $convert_from_chars = self::CONVERT_FROM_CHARS;
|
public static string $convert_from_chars = self::CONVERT_FROM_CHARS;
|
||||||
|
|
||||||
/** @var string $convert_to_char A char to convert to */
|
/**
|
||||||
|
* A char to convert to.
|
||||||
|
*
|
||||||
|
* @var string $convert_to_char
|
||||||
|
*/
|
||||||
public static string $convert_to_char = self::CONVERT_TO_CHAR;
|
public static string $convert_to_char = self::CONVERT_TO_CHAR;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -272,7 +278,7 @@ class CleanURLs
|
|||||||
* @param Blog $blog The blog instance
|
* @param Blog $blog The blog instance
|
||||||
* @param Cursor $cur The post Cursor
|
* @param Cursor $cur The post Cursor
|
||||||
* */
|
* */
|
||||||
public static function cleanPost(Blog $blog, Cursor $cur): void
|
public static function cleanPost(BlogInterface $blog, Cursor $cur): void
|
||||||
{
|
{
|
||||||
$cur->setField('post_url', self::cleanStr($cur->getField('post_url')));
|
$cur->setField('post_url', self::cleanStr($cur->getField('post_url')));
|
||||||
}
|
}
|
||||||
|
21
src/My.php
21
src/My.php
@ -1,21 +1,20 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* @brief cleanURLs, a plugin for Dotclear 2
|
|
||||||
*
|
|
||||||
* @package Dotclear
|
|
||||||
* @subpackage Plugin
|
|
||||||
*
|
|
||||||
* @author Pierre Rudloff and contributors
|
|
||||||
*
|
|
||||||
* @copyright Jean-Christian Denis
|
|
||||||
* @copyright GPL-3.0 https://www.gnu.org/licenses/gpl-3.0.html
|
|
||||||
*/
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\cleanURLs;
|
namespace Dotclear\Plugin\cleanURLs;
|
||||||
|
|
||||||
use Dotclear\Module\MyPlugin;
|
use Dotclear\Module\MyPlugin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief cleanURLs My helper.
|
||||||
|
* @ingroup cleanURLs
|
||||||
|
*
|
||||||
|
* @author Pierre Rudloff (author)
|
||||||
|
* @author Jean-Christian Denis (latest)
|
||||||
|
* @copyright GPL-3.0 https://www.gnu.org/licenses/gpl-3.0.html
|
||||||
|
*/
|
||||||
class My extends MyPlugin
|
class My extends MyPlugin
|
||||||
{
|
{
|
||||||
|
// Use default permissions
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* @brief cleanURLs, a plugin for Dotclear 2
|
|
||||||
*
|
|
||||||
* @package Dotclear
|
|
||||||
* @subpackage Plugin
|
|
||||||
*
|
|
||||||
* @author Pierre Rudloff and contributors
|
|
||||||
*
|
|
||||||
* @copyright Jean-Christian Denis
|
|
||||||
* @copyright GPL-3.0 https://www.gnu.org/licenses/gpl-3.0.html
|
|
||||||
*/
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\cleanURLs;
|
namespace Dotclear\Plugin\cleanURLs;
|
||||||
@ -17,6 +7,14 @@ namespace Dotclear\Plugin\cleanURLs;
|
|||||||
use Dotclear\App;
|
use Dotclear\App;
|
||||||
use Dotclear\Core\Process;
|
use Dotclear\Core\Process;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief cleanURLs prepend class.
|
||||||
|
* @ingroup cleanURLs
|
||||||
|
*
|
||||||
|
* @author Pierre Rudloff (author)
|
||||||
|
* @author Jean-Christian Denis (latest)
|
||||||
|
* @copyright GPL-3.0 https://www.gnu.org/licenses/gpl-3.0.html
|
||||||
|
*/
|
||||||
class Prepend extends Process
|
class Prepend extends Process
|
||||||
{
|
{
|
||||||
public static function init(): bool
|
public static function init(): bool
|
||||||
|
Loading…
Reference in New Issue
Block a user