translater/_install.php

35 lines
861 B
PHP

<?php
/**
* @brief translater, a plugin for Dotclear 2
*
* @package Dotclear
* @subpackage Plugin
*
* @author Jean-Christian Denis & 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;
}
$id = 'translater';
try {
if (version_compare($core->getVersion($id), $core->plugins->moduleInfo($id, 'version'), '>=')) {
return null;
}
$translater = new dcTranslater($core, false);
$settings = $translater->getDefaultSettings();
foreach ($settings as $key => $setting) {
$translater->setSetting($key, $setting['value'], false);
}
$core->setVersion($id, $core->plugins->moduleInfo($id, 'version'));
return true;
} catch (Exception $e) {
$core->error->add($e->getMessage());
}
return false;