noodles/_install.php

71 lines
1.4 KiB
PHP
Raw Normal View History

2021-09-08 22:53:13 +00:00
<?php
/**
2021-09-08 23:05:05 +00:00
* @brief noodles, a plugin for Dotclear 2
2022-11-17 20:00:42 +00:00
*
* @package Dotclear
2021-09-08 23:05:05 +00:00
* @subpackage Plugin
2022-11-17 20:00:42 +00:00
*
2021-09-08 23:05:05 +00:00
* @author Jean-Christian Denis and contributors
2022-11-17 20:00:42 +00:00
*
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
2021-09-09 07:12:31 +00:00
if (!defined('DC_CONTEXT_ADMIN')) {
return null;
}
2021-09-08 22:53:13 +00:00
$mod_conf = [
[
2021-11-01 09:28:22 +00:00
'noodles_active',
false,
'boolean',
'Enable extension',
],
[
2021-11-01 09:28:22 +00:00
'noodles_api',
'http://www.gravatar.com/',
'string',
'external API to use',
],
[
2021-11-01 09:28:22 +00:00
'noodles_image',
'',
'string',
'Image filename',
],
[
2021-11-01 09:28:22 +00:00
'noodles_object',
'',
'string',
'Noodles behaviors',
],
];
# -- Nothing to change below --
try {
# Check module version
if (!dcCore::app()->newVersion(
basename(__DIR__),
dcCore::app()->plugins->moduleInfo(basename(__DIR__), 'version')
)) {
return null;
}
# Set module settings
dcCore::app()->blog->settings->addNamespace(basename(__DIR__));
foreach ($mod_conf as $v) {
dcCore::app()->blog->settings->__get(basename(__DIR__))->put(
$v[0],
$v[1],
$v[2],
$v[3],
false,
true
);
}
2021-11-01 09:28:22 +00:00
return true;
2021-09-09 07:12:31 +00:00
} catch (Exception $e) {
2022-11-17 20:00:42 +00:00
dcCore::app()->error->add($e->getMessage());
2021-11-01 09:28:22 +00:00
return false;
}