move class to namespace (dc 2.25 src)

This commit is contained in:
Jean-Christian Denis 2023-03-10 21:20:17 +01:00
parent 2845234c7d
commit 6ea0866697
Signed by: JcDenis
GPG key ID: 1B5B8C5B90B6C951
2 changed files with 123 additions and 99 deletions

View file

@ -10,6 +10,10 @@
* @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;
/**
* Class to remove problematic characters from URLs
*

View file

@ -10,10 +10,30 @@
* @copyright Jean-Christian Denis
* @copyright GPL-3.0 https://www.gnu.org/licenses/gpl-3.0.html
*/
if (!defined('DC_RC_PATH')) {
return;
declare(strict_types=1);
namespace Dotclear\Plugin\cleanURLs;
use dcCore;
use dcNsProcess;
class Prepend extends dcNsProcess
{
public static function init(): bool
{
self::$init = true;
return self::$init;
}
Clearbricks::lib()->autoload(['CleanURLs' => __DIR__ . '/inc/class.cleanurls.php']);
public static function process(): bool
{
if (!self::$init) {
return false;
}
dcCore::app()->addBehavior('coreBeforePostCreate', ['CleanURLs', 'clean']);
dcCore::app()->addBehavior('coreBeforePostCreate', [CleanURLs::class, 'clean']);
return true;
}
}