move class to namespace (dc 2.25 src)
This commit is contained in:
parent
2845234c7d
commit
6ea0866697
2 changed files with 123 additions and 99 deletions
|
@ -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
|
||||
*
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue