index-main/site/config/config.php
2026-02-14 17:29:27 +01:00

74 lines
No EOL
2 KiB
PHP

<?php
return [
'debug' => true,
'languages' => true,
'date.handler' => 'intl',
'thumbs' => [
'quality' => 80,
'presets' => [
'grid' => 400,
'default' => [
'width' => 1024, 'format' => 'webp'
],
'full' => 2048,
'format' => 'webp'
],
'srcsets' => [
'default' => [200, 400, 600, 800, 1024, 1440, 2048],
'webp' => [
'300w' => ['width' => 300 * 1.2, 'format' => 'webp'],
'600w' => ['width' => 600 * 1.2, 'format' => 'webp'],
'900w' => ['width' => 900 * 1.2, 'format' => 'webp'],
'1200w' => ['width' => 1200 * 1.2, 'format' => 'webp'],
],
],
],
'panel' => [
'menu' => require_once __DIR__ . '/menu.php'
],
'donorbox' => [
'api_key' => '', // À remplir avec la clé API Donorbox
'campaign_slug' => 'soutenir-index-en-2024',
'campaign_url' => 'https://donorbox.org/soutenir-index-en-2024',
'api_base_url' => 'https://donorbox.org/api/v1'
],
'tobimori.seo.canonicalBase' => 'https://www.index.ngo',
'hooks' => [
'page.update:after' => function ($newPage) {
if ($newPage->intendedTemplate()->name() !== 'investigation') {
return;
}
$database = page('database');
if (!$database) {
return;
}
$fields = [
'keywords' => 'keywords',
'incidentCountry' => 'countries',
];
$updated = false;
$data = [];
foreach ($fields as $investigationField => $dbField) {
$newValues = $newPage->content()->get($investigationField)->split();
$existingValues = $database->content()->get($dbField)->split();
$merged = array_unique(array_merge($existingValues, $newValues));
if (count($merged) > count($existingValues)) {
$data[$dbField] = implode(', ', $merged);
$updated = true;
}
}
if ($updated) {
kirby()->impersonate('kirby');
$database->update($data);
}
}
]
];