Compare commits

..

No commits in common. "master" and "v1.5" have entirely different histories.
master ... v1.5

7 changed files with 92 additions and 100 deletions

View File

@ -1,15 +1,3 @@
cleanURLs 1.6.1 - 2023.10.15
===========================================================
* Require Dotclear 2.28
* Require PHP 8.1+
* Cosmetic clean
cleanURLs 1.6 - 2023.10.07
===========================================================
* Require Dotclear 2.28
* Require PHP 8.1+
* Upgrade to Dotclear 2.28
cleanURLs 1.5 - 2023.08.06
===========================================================
* Require Dotclear 2.27

View File

@ -1,20 +1,24 @@
# README
[![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.15-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/cleanURLs)
[![License](https://img.shields.io/badge/license-GPL--3.0-ececec.svg)](https://git.dotclear.watch/JcDenis/cleanURLs/src/branch/master/LICENSE)
[![Release](https://img.shields.io/github/v/release/JcDenis/cleanURLs)](https://git.dotclear.watch/JcDenis/cleanURLs/releases)
[![Date](https://img.shields.io/github/release-date/JcDenis/cleanURLs)](https://git.dotclear.watch/JcDenis/cleanURLs/releases)
[![Issues](https://img.shields.io/github/issues/JcDenis/cleanURLs)](https://git.dotclear.watch/JcDenis/cleanURLs/issues)
[![Dotclear](https://img.shields.io/badge/dotclear-v2.27-blue.svg)](https://fr.dotclear.org/download)
[![Dotaddict](https://img.shields.io/badge/dotaddict-official-green.svg)](https://plugins.dotaddict.org/dc2/details/cleanURLs)
[![License](https://img.shields.io/github/license/JcDenis/cleanURLs)](https://git.dotclear.watch/JcDenis/cleanURLs/blob/master/LICENSE)
## ABOUT
## WHAT IS ENHANCEPOSTCONTENT ?
_cleanUrls_ is a plugin for the open-source web publishing software called [Dotclear](https://www.dotclear.org).
"Clean URLs" is a plugin for the open-source
web publishing software called Dotclear.
> It removes diacritics and punctuation from URLs...
It removes diacritics and punctuation from URLs...
## REQUIREMENTS
* Dotclear 2.28
_cleanURLs_ requires:
* Dotclear 2.27
## USAGE
@ -25,14 +29,14 @@ Then when a post is created, it's URL is cleaned automagically.
## LINKS
* [License](https://git.dotclear.watch/JcDenis/cleanURLs/src/branch/master/LICENSE)
* [Packages & details](https://git.dotclear.watch/JcDenis/cleanURLs/releases) (or on [Dotaddict](https://plugins.dotaddict.org/dc2/details/cleanURLs))
* [Sources & contributions](https://git.dotclear.watch/JcDenis/cleanURLs) (or on [GitHub](https://github.com/JcDenis/cleanURLs))
* [Issues & security](https://git.dotclear.watch/JcDenis/cleanURLs/issues) (or on [GitHub](https://github.com/JcDenis/cleanURLs/issues))
* License : [GNU GPL v2](https://www.gnu.org/licenses/old-licenses/lgpl-2.0.html)
* Source & contribution : [Gitea Page](https://git.dotclear.watch/JcDenis/cleanURLs) or [GitHub Page](https://github.com/JcDenis/cleanURLs)
* Packages & details: [Gitea Page](https://git.dotclear.watch/JcDenis/cleanURLs/releases) or [Dotaddict Page](https://plugins.dotaddict.org/dc2/details/cleanURLs)
* Discuss and help : [Dotclear Forum](http://forum.dotclear.org/viewtopic.php?id=40876)
## CONTRIBUTORS
* Pierre Rudloff (author)
* Jean-Christian Denis (latest)
* Pierre Rudloff (author)
* Jean-Christian Denis
You are welcome to contribute to this code.
You are welcome to contribute to this code.

View File

@ -1,30 +1,33 @@
<?php
/**
* @file
* @brief The plugin cleanURLs definition
* @ingroup cleanURLs
* @brief cleanURLs, a plugin for Dotclear 2
*
* @defgroup cleanURLs Plugin cleanURLs.
* @package Dotclear
* @subpackage Plugin
*
* Removes diacritics and punctuation from URLs.
* @author Pierre Rudloff and contributors
*
* @author Pierre Rudloff (author)
* @author Jean-Christian Denis (latest)
* @copyright GPL-3.0 https://www.gnu.org/licenses/gpl-3.0.html
* @copyright Jean-Christian Denis
* @copyright GPL-3.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
declare(strict_types=1);
if (!defined('DC_RC_PATH')) {
return;
}
$this->registerModule(
'Clean URLs',
'Removes diacritics and punctuation from URLs',
'Pierre Rudloff and contributors',
'1.6.1',
'1.5',
[
'requires' => [['core', '2.28']],
'permissions' => 'My',
'type' => 'plugin',
'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',
'requires' => [['core', '2.27']],
'permissions' => dcCore::app()->auth->makePermissions([
dcCore::app()->auth::PERMISSION_USAGE,
dcCore::app()->auth::PERMISSION_CONTENT_ADMIN,
]),
'type' => 'plugin',
'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',
]
);

View File

@ -2,11 +2,11 @@
<modules xmlns:da="http://dotaddict.org/da/">
<module id="cleanURLs">
<name>Clean URLs</name>
<version>1.6.1</version>
<version>1.5</version>
<author>Pierre Rudloff and contributors</author>
<desc>Removes diacritics and punctuation from URLs</desc>
<file>https://git.dotclear.watch/JcDenis/cleanURLs/releases/download/v1.6.1/plugin-cleanURLs.zip</file>
<da:dcmin>2.28</da:dcmin>
<file>https://gitea.dotclear.watch/JcDenis/cleanURLs/releases/download/v1.5/plugin-cleanURLs.zip</file>
<da:dcmin>2.27</da:dcmin>
<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>
</module>

View File

@ -1,48 +1,42 @@
<?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);
namespace Dotclear\Plugin\cleanURLs;
use Dotclear\Interface\Core\BlogInterface;
use dcBlog;
use Dotclear\Database\Cursor;
/**
* @brief cleanURLs main class.
* @ingroup cleanURLs
* Class to remove problematic characters from URLs
*
* @author Pierre Rudloff (author)
* @author Jean-Christian Denis (latest)
* @copyright GPL-3.0 https://www.gnu.org/licenses/gpl-3.0.html
*/
* PHP Version 5
*
* @category Plugin
* @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
{
/**
* Chars to convert from.
*
* @var string CONVERT_FROM_CHARS
*/
public const CONVERT_FROM_CHARS = ',!.?;:@$«»°*';
public const CONVERT_TO_CHAR = '-';
/**
* 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
*/
/** @var string $convert_from_chars List of special chars to convert */
public static string $convert_from_chars = self::CONVERT_FROM_CHARS;
/**
* A char to convert to.
*
* @var string $convert_to_char
*/
/** @var string $convert_to_char A char to convert to */
public static string $convert_to_char = self::CONVERT_TO_CHAR;
/**
@ -275,10 +269,10 @@ class CleanURLs
/**
* Clean post URLs from diacritics and punctuation.
*
* @param Blog $blog The blog instance
* @param dcBlog $blog The blog instance
* @param Cursor $cur The post Cursor
* */
public static function cleanPost(BlogInterface $blog, Cursor $cur): void
public static function cleanPost(dcBlog $blog, Cursor $cur): void
{
$cur->setField('post_url', self::cleanStr($cur->getField('post_url')));
}

View File

@ -1,20 +1,21 @@
<?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);
namespace Dotclear\Plugin\cleanURLs;
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
{
// Use default permissions
}

View File

@ -1,20 +1,22 @@
<?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);
namespace Dotclear\Plugin\cleanURLs;
use Dotclear\App;
use dcCore;
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
{
public static function init(): bool
@ -28,7 +30,7 @@ class Prepend extends Process
return false;
}
App::behavior()->addBehavior('coreBeforePostCreate', CleanURLs::cleanPost(...));
dcCore::app()->addBehavior('coreBeforePostCreate', [CleanURLs::class, 'cleanPost']);
return true;
}