generated from FriendsOfREDAXO/rex_repo_template
-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathboot.php
25 lines (19 loc) · 816 Bytes
/
boot.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?php
if (rex_addon::get('media_manager')->isAvailable()) {
rex_media_manager::addEffect(rex_effect_negotiator::class);
}
rex_extension::register('MEDIA_MANAGER_INIT', function (rex_extension_point $ep) {
$mediaManager = $ep->getSubject();
$type = $ep->getParam('type');
$effects = $mediaManager->effectsFromType($type);
foreach ($effects as $effect) {
if ($effect['effect'] === 'negotiator') {
// change cache path for negotiator
$possible_types = rex_server('HTTP_ACCEPT', 'string', '');
$types = explode(',', $possible_types);
$possibleFormat = media_negotiator\Helper::getOutputFormat($types);
$mediaManager->setCachePath($mediaManager->getCachePath() . $possibleFormat . '-');
return;
}
}
});