construction/src/Install.php

79 lines
1.4 KiB
PHP
Raw Normal View History

2022-12-30 16:52:56 +00:00
<?php
2022-12-31 18:07:05 +00:00
/**
* @brief construction, a plugin for Dotclear 2
*
* @package Dotclear
* @subpackage Plugin
*
* @author Osku 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 null;
}
2022-12-30 16:52:56 +00:00
2022-12-31 18:07:05 +00:00
try {
// Version
if (!dcCore::app()->newVersion(
basename(__DIR__),
dcCore::app()->plugins->moduleInfo(basename(__DIR__), 'version')
)) {
return null;
}
2022-12-30 16:52:56 +00:00
2022-12-31 18:07:05 +00:00
$s = dcCore::app()->blog->settings->get(basename(__DIR__));
2022-12-30 16:52:56 +00:00
2022-12-31 18:07:05 +00:00
$s->put(
'flag',
false,
'boolean',
'Construction blog flag',
false,
true
);
2022-12-30 16:52:56 +00:00
2022-12-31 18:07:05 +00:00
$s->put(
'allowed_ip',
json_encode(['127.0.0.1']),
'string',
'Construction blog allowed ip',
false,
true
);
2022-12-30 16:52:56 +00:00
2022-12-31 18:07:05 +00:00
$s->put(
'title',
__('Work in progress'),
'string',
'Construction blog title',
false,
true
);
2022-12-30 16:52:56 +00:00
2022-12-31 18:07:05 +00:00
$s->put(
'message',
__('<p>The blog is currently under construction.</p>'),
'string',
'Construction blog message',
false,
true
);
2022-12-30 16:52:56 +00:00
2022-12-31 18:07:05 +00:00
$s->put(
'extra_urls',
json_encode([]),
'string',
'Construction blog message',
false,
true
);
2022-12-30 16:52:56 +00:00
2022-12-31 18:07:05 +00:00
return true;
} catch (Exception $e) {
dcCore::app()->error->add($e->getMessage());
}
2022-12-30 16:52:56 +00:00
2022-12-31 18:07:05 +00:00
return false;