124 lines
3.9 KiB
PHP
124 lines
3.9 KiB
PHP
<?php
|
||
|
||
return [
|
||
'debug' => true,
|
||
'languages' => true,
|
||
'date.handler' => 'intl',
|
||
// 'auth' => [
|
||
// 'methods' => [
|
||
// 'password' => ['2fa' => true]
|
||
// ]
|
||
// ],
|
||
'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, 'format' => 'webp'],
|
||
'600w' => ['width' => 600, 'format' => 'webp'],
|
||
'900w' => ['width' => 900, 'format' => 'webp'],
|
||
'1200w' => ['width' => 1200, 'format' => 'webp'],
|
||
],
|
||
// Cover cards investigations : 465px fixe ≥1000px, 50vw 728–1000px, 100vw <728px
|
||
// Widths couvrent 1x et 2x (retina) pour chaque breakpoint
|
||
'cover-card' => [465, 728, 930, 1000, 1456],
|
||
'cover-card-webp' => [
|
||
'465w' => ['width' => 465, 'format' => 'webp'],
|
||
'728w' => ['width' => 728, 'format' => 'webp'],
|
||
'930w' => ['width' => 930, 'format' => 'webp'],
|
||
'1000w' => ['width' => 1000, 'format' => 'webp'],
|
||
'1456w' => ['width' => 1456, 'format' => 'webp'],
|
||
],
|
||
// Hero cover investigation : 940px fixe ≥1000px, 90vw en dessous
|
||
'cover-hero' => [680, 940, 1200, 1880],
|
||
'cover-hero-webp' => [
|
||
'680w' => ['width' => 680, 'format' => 'webp'],
|
||
'940w' => ['width' => 940, 'format' => 'webp'],
|
||
'1200w' => ['width' => 1200, 'format' => 'webp'],
|
||
'1880w' => ['width' => 1880, 'format' => 'webp'],
|
||
],
|
||
// Body 1 colonne : 100vw
|
||
'body-full' => [750, 1000, 1440, 1880],
|
||
'body-full-webp' => [
|
||
'750w' => ['width' => 750, 'format' => 'webp'],
|
||
'1000w' => ['width' => 1000, 'format' => 'webp'],
|
||
'1440w' => ['width' => 1440, 'format' => 'webp'],
|
||
'1880w' => ['width' => 1880, 'format' => 'webp'],
|
||
],
|
||
// Body 2 colonnes : 50vw ≥768px, 90vw en dessous
|
||
'body-half' => [680, 720, 1000, 1380, 1440],
|
||
'body-half-webp' => [
|
||
'680w' => ['width' => 680, 'format' => 'webp'],
|
||
'720w' => ['width' => 720, 'format' => 'webp'],
|
||
'1000w' => ['width' => 1000, 'format' => 'webp'],
|
||
'1380w' => ['width' => 1380, 'format' => 'webp'],
|
||
'1440w' => ['width' => 1440, 'format' => 'webp'],
|
||
],
|
||
],
|
||
],
|
||
'panel' => [
|
||
'menu' => require_once __DIR__ . '/menu.php',
|
||
'css' => '/assets/css/panel.css',
|
||
'home' => 'pages/home',
|
||
],
|
||
'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',
|
||
|
||
'cache' => [
|
||
'og' => true,
|
||
],
|
||
|
||
'routes' => [
|
||
require(__DIR__ . '/routes/newsletter.php'),
|
||
],
|
||
|
||
'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);
|
||
}
|
||
}
|
||
]
|
||
];
|