move class to namespace (dc 2.25 src)

This commit is contained in:
Jean-Christian Paul 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 Jean-Christian Denis
* @copyright GPL-3.0 https://www.gnu.org/licenses/gpl-3.0.html * @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 * Class to remove problematic characters from URLs
* *

View File

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