diff --git a/README.md b/README.md
index d344c44..3adc720 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,46 @@
-# myUrlHandlers
+# README
-Version actualisée de l’extension [myUrlHandlers](https://lab.dotclear.org/wiki/plugin/myUrlHandlers) pour Dotclear afin d’assurer son fonctionnement avec les nouvelles versions de Dotclear et de PHP.
+[![Release](https://img.shields.io/github/v/release/JcDenis/myUrlHandlers)](https://github.com/JcDenis/myUrlHandlers/releases)
+[![Date](https://img.shields.io/github/release-date/JcDenis/myUrlHandlers)](https://github.com/JcDenis/myUrlHandlers/releases)
+[![Issues](https://img.shields.io/github/issues/JcDenis/myUrlHandlers)](https://github.com/JcDenis/myUrlHandlers/issues)
+[![Dotclear](https://img.shields.io/badge/dotclear-v2.24-blue.svg)](https://fr.dotclear.org/download)
+[![Dotaddict](https://img.shields.io/badge/dotaddict-official-green.svg)](https://plugins.dotaddict.org/dc2/details/myUrlHandlers)
+[![License](https://img.shields.io/github/license/JcDenis/myUrlHandlers)](https://github.com/JcDenis/myUrlHandlers/blob/master/LICENSE)
+
+## WHAT IS MYURLHANLDERS ?
+
+_myUrlHandlers_ is a plugin for the open-source
+web publishing software called Dotclear.
+
+You can change public URL of each Dotclear parts,
+like post, category, etc and some plugins having public parts.
+
+## REQUIREMENTS
+
+ _myUrlHandlers_ requires:
+
+ * contentadmin permissions for management
+ * Dotclear 2.24
+
+## USAGE
+
+First install _myUrlHandlers_, manualy from a zip package or from
+Dotaddict repository. (See Dotclear's documentation to know how do this)
+
+You can manage your URLs from menu ''URL handlers'' on sidebar
+or you can add dashboard icon.
+
+## LINKS
+
+ * License : [GNU GPL v2](https://www.gnu.org/licenses/old-licenses/lgpl-2.0.html)
+ * Source & contribution : [GitHub Page](https://github.com/JcDenis/myUrlHandlers)
+ * Packages & details: [Dotaddict Page](https://plugins.dotaddict.org/dc2/details/myUrlHandlers)
+ * Discuss and help : [Dotclear Forum](https://forum.dotclear.org/viewtopic.php?id=40893)
+
+## CONTRIBUTORS
+
+ * Alex pirine (First author)
+ * te2dy
+ * Jean-Christian Denis
+
+ You are welcome to contribute to this code.
\ No newline at end of file
diff --git a/_admin.php b/_admin.php
index 7b4fc93..f6710b3 100644
--- a/_admin.php
+++ b/_admin.php
@@ -1,31 +1,33 @@
-#
-# Licensed under the GPL version 2.0 license.
-# A copy is available in LICENSE file or at
-# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# -- END LICENSE BLOCK ------------------------------------
-
-if (!defined('DC_CONTEXT_ADMIN')) { return; }
-
-$_menu['Blog']->addItem(__('URL handlers'),'plugin.php?p=myUrlHandlers',
- 'index.php?pf=myUrlHandlers/icon.png',
- preg_match('/plugin.php\?p=myUrlHandlers$/',$_SERVER['REQUEST_URI']),
- dcCore::app()->auth->check('contentadmin',dcCore::app()->blog->id));
-
-dcCore::app()->addBehavior('adminDashboardFavorites','myUrlHandlersDashboardFavorites');
-
-function myUrlHandlersDashboardFavorites($core,$favs)
-{
- $favs->register('myUrlHandlers', array(
- 'title' => __('URL handlers'),
- 'url' => 'plugin.php?p=myUrlHandlers',
- 'small-icon' => 'index.php?pf=myUrlHandlers/icon.png',
- 'large-icon' => 'index.php?pf=myUrlHandlers/icon-big.png',
- 'permissions' => 'contentadmin'
- ));
+/**
+ * @brief myUrlHandlers, a plugin for Dotclear 2
+ *
+ * @package Dotclear
+ * @subpackage Plugin
+ *
+ * @author Alex Pirine and contributors
+ *
+ * @copyright Jean-Christian Denis
+ * @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
+ */
+if (!defined('DC_CONTEXT_ADMIN')) {
+ return;
}
+
+dcCore::app()->menu[dcAdmin::MENU_PLUGINS]->addItem(
+ __('URL handlers'),
+ dcCore::app()->adminurl->get('admin.plugin.myUrlHandlers'),
+ dcPage::getPF('myUrlHandlers/icon.png'),
+ preg_match('/' . preg_quote(dcCore::app()->adminurl->get('admin.plugin.myUrlHandlers')) . '(&.*)?$/', $_SERVER['REQUEST_URI']),
+ dcCore::app()->auth->check(dcAuth::PERMISSION_CONTENT_ADMIN, dcCore::app()->blog->id)
+);
+
+dcCore::app()->addBehavior('adminDashboardFavoritesV2', function ($favs) {
+ $favs->register('myUrlHandlers', [
+ 'title' => __('URL handlers'),
+ 'url' => dcCore::app()->adminurl->get('admin.plugin.myUrlHandlers'),
+ 'small-icon' => dcPage::getPF('myUrlHandlers/icon.png'),
+ 'large-icon' => dcPage::getPF('myUrlHandlers/icon-big.png'),
+ 'permissions' => dcAuth::PERMISSION_CONTENT_ADMIN,
+ ]);
+});
diff --git a/_define.php b/_define.php
index a1687e3..ac35550 100644
--- a/_define.php
+++ b/_define.php
@@ -1,28 +1,31 @@
-#
-# Licensed under the GPL version 2.0 license.
-# A copy is available in LICENSE file or at
-# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# -- END LICENSE BLOCK ------------------------------------
-
-if (!defined('DC_RC_PATH')) { return; }
+/**
+ * @brief myUrlHandlers, a plugin for Dotclear 2
+ *
+ * @package Dotclear
+ * @subpackage Plugin
+ *
+ * @author Alex Pirine and contributors
+ *
+ * @copyright Jean-Christian Denis
+ * @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
+ */
+if (!defined('DC_RC_PATH')) {
+ return null;
+}
$this->registerModule(
- 'My URL handlers', // Name
- 'Change Dotclear URL handlers', // Description
- 'Alex Pirine and contributors', // Author
- '2022.08', // Version
+ 'My URL handlers',
+ 'Change Dotclear URL handlers',
+ 'Alex Pirine and contributors',
+ '2022.11.26',
[
- 'permissions' => 'contentadmin',
+ 'requires' => [['core', '2.24']],
+ 'permissions' => dcAuth::PERMISSION_CONTENT_ADMIN,
'priority' => 150000,
'type' => 'plugin',
- 'dc_min' => '2.7',
'support' => 'http://forum.dotclear.org/viewforum.php?id=16',
- 'details' => 'http://plugins.dotaddict.org/dc2/details/myUrlHandlers'
+ 'details' => 'http://plugins.dotaddict.org/dc2/details/myUrlHandlers',
+ 'repository' => 'https://raw.githubusercontent.com/JcDenis/myUrlHandlers/master/dcstore.xml',
]
);
diff --git a/_install.php b/_install.php
index 4fb68dc..a9a0280 100644
--- a/_install.php
+++ b/_install.php
@@ -1,28 +1,40 @@
-#
-# Licensed under the GPL version 2.0 license.
-# A copy is available in LICENSE file or at
-# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# -- END LICENSE BLOCK ------------------------------------
+/**
+ * @brief myUrlHandlers, a plugin for Dotclear 2
+ *
+ * @package Dotclear
+ * @subpackage Plugin
+ *
+ * @author Alex Pirine and contributors
+ *
+ * @copyright Jean-Christian Denis
+ * @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
+ */
+if (!defined('DC_RC_PATH')) {
+ return null;
+}
-if (!defined('DC_CONTEXT_ADMIN')) { return; }
+$label = basename(__DIR__);
+$new_version = dcCore::app()->plugins->moduleInfo($label, 'version');
-$label = basename(dirname(__FILE__));
-$m_version = dcCore::app()->plugins->moduleInfo($label,'version');
-$i_version = dcCore::app()->getVersion($label);
-
-if (version_compare($i_version,$m_version,'>=')) {
+if (version_compare(dcCore::app()->getVersion($label), $new_version, '>=')) {
return;
}
-dcCore::app()->blog->settings->addNamespace('myurlhandlers');
-$s = &dcCore::app()->blog->settings->myurlhandlers;
-$s->put('url_handlers','','string','Personalized URL handlers',false);
+try {
+ dcCore::app()->blog->settings->addNamespace('myurlhandlers');
+ dcCore::app()->blog->settings->myurlhandlers->put(
+ 'url_handlers',
+ '',
+ 'string',
+ 'Personalized URL handlers',
+ false
+ );
+ dcCore::app()->setVersion($label, $new_version);
-dcCore::app()->setVersion($label,$m_version);
-return true;
+ return true;
+} catch (Exception $e) {
+ dcCore::app()->error->add($e->getMessage());
+}
+
+return false;
diff --git a/_prepend.php b/_prepend.php
index f032896..9baf09d 100644
--- a/_prepend.php
+++ b/_prepend.php
@@ -1,17 +1,19 @@
-#
-# Licensed under the GPL version 2.0 license.
-# A copy is available in LICENSE file or at
-# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
-# -- END LICENSE BLOCK ------------------------------------
+/**
+ * @brief myUrlHandlers, a plugin for Dotclear 2
+ *
+ * @package Dotclear
+ * @subpackage Plugin
+ *
+ * @author Alex Pirine and contributors
+ *
+ * @copyright Jean-Christian Denis
+ * @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
+ */
+if (!defined('DC_RC_PATH')) {
+ return null;
+}
-if (!defined('DC_RC_PATH')) { return; }
+Clearbricks::lib()->autoload(['myUrlHandlers' => __DIR__ . '/inc/class.myurlhandlers.php']);
-$__autoload['myUrlHandlers'] = dirname(__FILE__).'/class.myurlhandlers.php';
-
-myUrlHandlers::init(dcCore::app());
+myUrlHandlers::init();
diff --git a/dcstore.xml b/dcstore.xml
new file mode 100644
index 0000000..22fa6d7
--- /dev/null
+++ b/dcstore.xml
@@ -0,0 +1,13 @@
+
+