Skip to content

Commit

Permalink
Fix PHP 8.0 undefined key warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
ausi committed Mar 29, 2021
1 parent b866156 commit 58d8445
Show file tree
Hide file tree
Showing 8 changed files with 87 additions and 79 deletions.
26 changes: 13 additions & 13 deletions src/Module/Slider.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,10 @@ protected function compile()
'uuid' => isset($files->uuid) ? $files->uuid : null,
'name' => $file->basename,
'singleSRC' => $files->path,
'alt' => $arrMeta['alt'],
'title' => $arrMeta['title'],
'imageUrl' => $arrMeta['link'],
'caption' => $arrMeta['caption'],
'alt' => $arrMeta['alt'] ?? null,
'title' => $arrMeta['title'] ?? null,
'imageUrl' => $arrMeta['link'] ?? null,
'caption' => $arrMeta['caption'] ?? null,
'fullsize' => $this->fullsize,
);

Expand Down Expand Up @@ -447,10 +447,10 @@ protected function parseSlides($objSlides)
'id' => $file->id,
'name' => $fileObject->basename,
'singleSRC' => $file->path,
'alt' => $meta['alt'],
'title' => $meta['title'],
'imageUrl' => $meta['link'],
'caption' => $meta['caption'],
'alt' => $meta['alt'] ?? null,
'title' => $meta['title'] ?? null,
'imageUrl' => $meta['link'] ?? null,
'caption' => $meta['caption'] ?? null,
'size' => isset($this->imgSize) ? $this->imgSize : $this->size,
'fullsize' => $this->fullsize,
), null, substr(md5('mod_rocksolid_slider_' . $this->id), 0, 6), $file);
Expand Down Expand Up @@ -515,11 +515,11 @@ protected function parseSlides($objSlides)
'id' => $file->id,
'name' => $fileObject->basename,
'singleSRC' => $file->path,
'alt' => $meta['alt'],
'title' => $meta['title'],
'imageUrl' => $meta['link'],
'caption' => $meta['caption'],
'size' => $slide['backgroundImageSize'],
'alt' => $meta['alt'] ?? null,
'title' => $meta['title'] ?? null,
'imageUrl' => $meta['link'] ?? null,
'caption' => $meta['caption'] ?? null,
'size' => $slide['backgroundImageSize'] ?? null,
));
}
else {
Expand Down
34 changes: 19 additions & 15 deletions src/Resources/contao/dca/tl_content.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,10 @@
'exclude' => true,
'inputType' => 'select',
'options' => array(
'x' => $GLOBALS['TL_LANG']['tl_module']['rsts_direction_x'],
'y' => $GLOBALS['TL_LANG']['tl_module']['rsts_direction_y'],
'x',
'y',
),
'reference' => &$GLOBALS['TL_LANG']['tl_module']['rsts_direction_options'],
'eval' => array('tl_class' => 'w50'),
'sql' => "varchar(64) NOT NULL default ''",
);
Expand Down Expand Up @@ -269,12 +270,13 @@
'exclude' => true,
'inputType' => 'select',
'options' => array(
'bullets' => $GLOBALS['TL_LANG']['tl_module']['rsts_navType_bullets'],
'numbers' => $GLOBALS['TL_LANG']['tl_module']['rsts_navType_numbers'],
'tabs' => $GLOBALS['TL_LANG']['tl_module']['rsts_navType_tabs'],
'thumbs' => $GLOBALS['TL_LANG']['tl_module']['rsts_navType_thumbs'],
'none' => $GLOBALS['TL_LANG']['tl_module']['rsts_navType_none'],
'bullets',
'numbers',
'tabs',
'thumbs',
'none',
),
'reference' => &$GLOBALS['TL_LANG']['tl_module']['rsts_navType_options'],
'eval' => array('tl_class' => 'w50'),
'sql' => "varchar(64) NOT NULL default ''",
);
Expand Down Expand Up @@ -309,11 +311,12 @@
'exclude' => true,
'inputType' => 'select',
'options' => array(
'fit' => $GLOBALS['TL_LANG']['tl_module']['rsts_scaleMode_fit'],
'crop' => $GLOBALS['TL_LANG']['tl_module']['rsts_scaleMode_crop'],
'scale' => $GLOBALS['TL_LANG']['tl_module']['rsts_scaleMode_scale'],
'none' => $GLOBALS['TL_LANG']['tl_module']['rsts_scaleMode_none'],
'fit',
'crop',
'scale',
'none',
),
'reference' => &$GLOBALS['TL_LANG']['tl_module']['rsts_scaleMode_options'],
'eval' => array('tl_class' => 'w50 clr'),
'sql' => "varchar(64) NOT NULL default ''",
);
Expand Down Expand Up @@ -401,11 +404,12 @@
'exclude' => true,
'inputType' => 'select',
'options' => array(
'fit' => $GLOBALS['TL_LANG']['tl_module']['rsts_scaleMode_fit'],
'crop' => $GLOBALS['TL_LANG']['tl_module']['rsts_scaleMode_crop'],
'scale' => $GLOBALS['TL_LANG']['tl_module']['rsts_scaleMode_scale'],
'none' => $GLOBALS['TL_LANG']['tl_module']['rsts_scaleMode_none'],
'fit',
'crop',
'scale',
'none',
),
'reference' => &$GLOBALS['TL_LANG']['tl_module']['rsts_scaleMode_options'],
'eval' => array(
'tl_class' => 'w50 clr',
'includeBlankOption' => true,
Expand Down
34 changes: 19 additions & 15 deletions src/Resources/contao/dca/tl_module.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,10 @@
'exclude' => true,
'inputType' => 'select',
'options' => array(
'x' => $GLOBALS['TL_LANG']['tl_module']['rsts_direction_x'],
'y' => $GLOBALS['TL_LANG']['tl_module']['rsts_direction_y'],
'x',
'y',
),
'reference' => &$GLOBALS['TL_LANG']['tl_module']['rsts_direction_options'],
'eval' => array('tl_class' => 'w50'),
'sql' => "varchar(64) NOT NULL default ''",
);
Expand Down Expand Up @@ -271,12 +272,13 @@
'exclude' => true,
'inputType' => 'select',
'options' => array(
'bullets' => $GLOBALS['TL_LANG']['tl_module']['rsts_navType_bullets'],
'numbers' => $GLOBALS['TL_LANG']['tl_module']['rsts_navType_numbers'],
'tabs' => $GLOBALS['TL_LANG']['tl_module']['rsts_navType_tabs'],
'thumbs' => $GLOBALS['TL_LANG']['tl_module']['rsts_navType_thumbs'],
'none' => $GLOBALS['TL_LANG']['tl_module']['rsts_navType_none'],
'bullets',
'numbers',
'tabs',
'thumbs',
'none',
),
'reference' => &$GLOBALS['TL_LANG']['tl_module']['rsts_navType_options'],
'eval' => array('tl_class' => 'w50'),
'sql' => "varchar(64) NOT NULL default ''",
);
Expand Down Expand Up @@ -311,11 +313,12 @@
'exclude' => true,
'inputType' => 'select',
'options' => array(
'fit' => $GLOBALS['TL_LANG']['tl_module']['rsts_scaleMode_fit'],
'crop' => $GLOBALS['TL_LANG']['tl_module']['rsts_scaleMode_crop'],
'scale' => $GLOBALS['TL_LANG']['tl_module']['rsts_scaleMode_scale'],
'none' => $GLOBALS['TL_LANG']['tl_module']['rsts_scaleMode_none'],
'fit',
'crop',
'scale',
'none',
),
'reference' => &$GLOBALS['TL_LANG']['tl_module']['rsts_scaleMode_options'],
'eval' => array('tl_class' => 'w50 clr'),
'sql' => "varchar(64) NOT NULL default ''",
);
Expand Down Expand Up @@ -403,11 +406,12 @@
'exclude' => true,
'inputType' => 'select',
'options' => array(
'fit' => $GLOBALS['TL_LANG']['tl_module']['rsts_scaleMode_fit'],
'crop' => $GLOBALS['TL_LANG']['tl_module']['rsts_scaleMode_crop'],
'scale' => $GLOBALS['TL_LANG']['tl_module']['rsts_scaleMode_scale'],
'none' => $GLOBALS['TL_LANG']['tl_module']['rsts_scaleMode_none'],
'fit',
'crop',
'scale',
'none',
),
'reference' => &$GLOBALS['TL_LANG']['tl_module']['rsts_scaleMode_options'],
'eval' => array(
'tl_class' => 'w50 clr',
'includeBlankOption' => true,
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/contao/dca/tl_rocksolid_slide.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
'label' => &$GLOBALS['TL_LANG']['tl_rocksolid_slide']['delete'],
'href' => 'act=delete',
'icon' => 'delete.gif',
'attributes' => 'onclick="if(!confirm(\'' . $GLOBALS['TL_LANG']['MSC']['deleteConfirm'] . '\'))return false;Backend.getScrollOffset()"',
'attributes' => 'onclick="if(!confirm(\'' . ($GLOBALS['TL_LANG']['MSC']['deleteConfirm'] ?? '') . '\'))return false;Backend.getScrollOffset()"',
),
'toggle' => array(
'label' => &$GLOBALS['TL_LANG']['tl_rocksolid_slide']['toggle'],
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/contao/dca/tl_rocksolid_slider.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
'label' => &$GLOBALS['TL_LANG']['tl_rocksolid_slider']['delete'],
'href' => 'act=delete',
'icon' => 'delete.gif',
'attributes' => 'onclick="if(!confirm(\'' . $GLOBALS['TL_LANG']['MSC']['deleteConfirm'] . '\'))return false;Backend.getScrollOffset()"',
'attributes' => 'onclick="if(!confirm(\'' . ($GLOBALS['TL_LANG']['MSC']['deleteConfirm'] ?? '') . '\'))return false;Backend.getScrollOffset()"',
),
'show' => array(
'label' => &$GLOBALS['TL_LANG']['tl_rocksolid_slider']['show'],
Expand Down
22 changes: 11 additions & 11 deletions src/Resources/contao/languages/de/tl_module.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
$GLOBALS['TL_LANG']['tl_module']['rsts_type'][1] = 'Bei "slide" bewegen sich die Elemente horizontal oder vertikal. Bei "fade" werden die Elemente überblendet.';
$GLOBALS['TL_LANG']['tl_module']['rsts_direction'][0] = 'Ausrichtung';
$GLOBALS['TL_LANG']['tl_module']['rsts_direction'][1] = 'Ausrichtung der Slide-Bewegung (nur für Animationstyp "slide").';
$GLOBALS['TL_LANG']['tl_module']['rsts_direction_x'] = 'Horizontal';
$GLOBALS['TL_LANG']['tl_module']['rsts_direction_y'] = 'Vertikal';
$GLOBALS['TL_LANG']['tl_module']['rsts_direction_options']['x'] = 'Horizontal';
$GLOBALS['TL_LANG']['tl_module']['rsts_direction_options']['y'] = 'Vertikal';
$GLOBALS['TL_LANG']['tl_module']['rsts_random'][0] = 'Zufällige Sortierung';
$GLOBALS['TL_LANG']['tl_module']['rsts_random'][1] = 'Wenn aktiviert werden die einzelnen Slides beim Start zufällig sortiert.';
$GLOBALS['TL_LANG']['tl_module']['rsts_loop'][0] = 'Endlosschleife';
Expand Down Expand Up @@ -78,11 +78,11 @@
$GLOBALS['TL_LANG']['tl_module']['rsts_pauseAutoplayOnHover'][1] = 'Autoplay pausieren sobald man die Maus über den Slider bewegt.';
$GLOBALS['TL_LANG']['tl_module']['rsts_navType'][0] = 'Navigationstyp';
$GLOBALS['TL_LANG']['tl_module']['rsts_navType'][1] = 'Wählen Sie den gewünschten Navigations-Typ.';
$GLOBALS['TL_LANG']['tl_module']['rsts_navType_bullets'] = 'Punkte';
$GLOBALS['TL_LANG']['tl_module']['rsts_navType_numbers'] = 'Nummeriert';
$GLOBALS['TL_LANG']['tl_module']['rsts_navType_tabs'] = 'Tabs';
$GLOBALS['TL_LANG']['tl_module']['rsts_navType_thumbs'] = 'Thumbnails';
$GLOBALS['TL_LANG']['tl_module']['rsts_navType_none'] = 'Navigation ausblenden';
$GLOBALS['TL_LANG']['tl_module']['rsts_navType_options']['bullets'] = 'Punkte';
$GLOBALS['TL_LANG']['tl_module']['rsts_navType_options']['numbers'] = 'Nummeriert';
$GLOBALS['TL_LANG']['tl_module']['rsts_navType_options']['tabs'] = 'Tabs';
$GLOBALS['TL_LANG']['tl_module']['rsts_navType_options']['thumbs'] = 'Thumbnails';
$GLOBALS['TL_LANG']['tl_module']['rsts_navType_options']['none'] = 'Navigation ausblenden';
$GLOBALS['TL_LANG']['tl_module']['rsts_controls'][0] = 'Weiter und Zurück anzeigen';
$GLOBALS['TL_LANG']['tl_module']['rsts_controls'][1] = 'Aktiviert die Navigationspfeile.';
$GLOBALS['TL_LANG']['tl_module']['rsts_thumbControls'][0] = 'Thumbnails in Weiter und Zurück anzeigen';
Expand All @@ -93,10 +93,10 @@
$GLOBALS['TL_LANG']['tl_module']['rsts_thumbs'][1] = 'Aktiviert die Einstellungen der Thumbnails-Navigation.';
$GLOBALS['TL_LANG']['tl_module']['rsts_scaleMode'][0] = 'Skalierungsmodus';
$GLOBALS['TL_LANG']['tl_module']['rsts_scaleMode'][1] = 'Achtung: Hat keine Auswirkung wenn Höhe oder Breite auf "auto" gesetzt ist.';
$GLOBALS['TL_LANG']['tl_module']['rsts_scaleMode_fit'] = 'Proportional';
$GLOBALS['TL_LANG']['tl_module']['rsts_scaleMode_crop'] = 'Beschneiden';
$GLOBALS['TL_LANG']['tl_module']['rsts_scaleMode_scale'] = 'Verzerren';
$GLOBALS['TL_LANG']['tl_module']['rsts_scaleMode_none'] = 'Nicht skalieren';
$GLOBALS['TL_LANG']['tl_module']['rsts_scaleMode_options']['fit'] = 'Proportional';
$GLOBALS['TL_LANG']['tl_module']['rsts_scaleMode_options']['crop'] = 'Beschneiden';
$GLOBALS['TL_LANG']['tl_module']['rsts_scaleMode_options']['scale'] = 'Verzerren';
$GLOBALS['TL_LANG']['tl_module']['rsts_scaleMode_options']['none'] = 'Nicht skalieren';
$GLOBALS['TL_LANG']['tl_module']['rsts_imagePosition'][0] = 'Bildpositionierung';
$GLOBALS['TL_LANG']['tl_module']['rsts_imagePosition'][1] = 'Position der Bilder und Hintergrundbilder.';
$GLOBALS['TL_LANG']['tl_module']['rsts_imagePositions']['center'] = 'Zentriert';
Expand Down
22 changes: 11 additions & 11 deletions src/Resources/contao/languages/en/tl_module.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
$GLOBALS['TL_LANG']['tl_module']['rsts_type'][1] = '"Slide" moves the elements vertically and horizontally. "Fade" uses a change-over effect.';
$GLOBALS['TL_LANG']['tl_module']['rsts_direction'][0] = 'Direction';
$GLOBALS['TL_LANG']['tl_module']['rsts_direction'][1] = 'Direction of the slide animation (only for animation type "slide").';
$GLOBALS['TL_LANG']['tl_module']['rsts_direction_x'] = 'Horizontal';
$GLOBALS['TL_LANG']['tl_module']['rsts_direction_y'] = 'Vertical';
$GLOBALS['TL_LANG']['tl_module']['rsts_direction_options']['x'] = 'Horizontal';
$GLOBALS['TL_LANG']['tl_module']['rsts_direction_options']['y'] = 'Vertical';
$GLOBALS['TL_LANG']['tl_module']['rsts_random'][0] = 'Randomize elements';
$GLOBALS['TL_LANG']['tl_module']['rsts_random'][1] = 'If activated slider elements are randomized at the start.';
$GLOBALS['TL_LANG']['tl_module']['rsts_loop'][0] = 'Loop';
Expand Down Expand Up @@ -78,11 +78,11 @@
$GLOBALS['TL_LANG']['tl_module']['rsts_pauseAutoplayOnHover'][1] = 'Pauses the autoplay if the mouse is placed over the slider.';
$GLOBALS['TL_LANG']['tl_module']['rsts_navType'][0] = 'Navigation type';
$GLOBALS['TL_LANG']['tl_module']['rsts_navType'][1] = 'Choose the navigation type.';
$GLOBALS['TL_LANG']['tl_module']['rsts_navType_bullets'] = 'Bullets';
$GLOBALS['TL_LANG']['tl_module']['rsts_navType_numbers'] = 'Numbers';
$GLOBALS['TL_LANG']['tl_module']['rsts_navType_tabs'] = 'Tabs';
$GLOBALS['TL_LANG']['tl_module']['rsts_navType_thumbs'] = 'Thumbnails';
$GLOBALS['TL_LANG']['tl_module']['rsts_navType_none'] = 'Hide navigation';
$GLOBALS['TL_LANG']['tl_module']['rsts_navType_options']['bullets'] = 'Bullets';
$GLOBALS['TL_LANG']['tl_module']['rsts_navType_options']['numbers'] = 'Numbers';
$GLOBALS['TL_LANG']['tl_module']['rsts_navType_options']['tabs'] = 'Tabs';
$GLOBALS['TL_LANG']['tl_module']['rsts_navType_options']['thumbs'] = 'Thumbnails';
$GLOBALS['TL_LANG']['tl_module']['rsts_navType_options']['none'] = 'Hide navigation';
$GLOBALS['TL_LANG']['tl_module']['rsts_controls'][0] = 'Show next and previous arrows';
$GLOBALS['TL_LANG']['tl_module']['rsts_controls'][1] = 'Activates the next and previous controls.';
$GLOBALS['TL_LANG']['tl_module']['rsts_thumbControls'][0] = 'Show thumbnails in next and previous arrows';
Expand All @@ -93,10 +93,10 @@
$GLOBALS['TL_LANG']['tl_module']['rsts_thumbs'][1] = 'Activate the settings for the thumbnail navigation.';
$GLOBALS['TL_LANG']['tl_module']['rsts_scaleMode'][0] = 'Scale mode';
$GLOBALS['TL_LANG']['tl_module']['rsts_scaleMode'][1] = 'Note: Has no effect if either width or height are set to "auto".';
$GLOBALS['TL_LANG']['tl_module']['rsts_scaleMode_fit'] = 'Proportional';
$GLOBALS['TL_LANG']['tl_module']['rsts_scaleMode_crop'] = 'Cut';
$GLOBALS['TL_LANG']['tl_module']['rsts_scaleMode_scale'] = 'Distort';
$GLOBALS['TL_LANG']['tl_module']['rsts_scaleMode_none'] = 'None';
$GLOBALS['TL_LANG']['tl_module']['rsts_scaleMode_options']['fit'] = 'Proportional';
$GLOBALS['TL_LANG']['tl_module']['rsts_scaleMode_options']['crop'] = 'Cut';
$GLOBALS['TL_LANG']['tl_module']['rsts_scaleMode_options']['scale'] = 'Distort';
$GLOBALS['TL_LANG']['tl_module']['rsts_scaleMode_options']['none'] = 'None';
$GLOBALS['TL_LANG']['tl_module']['rsts_imagePosition'][0] = 'Image positioning';
$GLOBALS['TL_LANG']['tl_module']['rsts_imagePosition'][1] = 'Position of images and background images.';
$GLOBALS['TL_LANG']['tl_module']['rsts_imagePositions']['center'] = 'Centered';
Expand Down
24 changes: 12 additions & 12 deletions src/Resources/contao/templates/rsts_default.html5
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,28 @@
?>

<?php if ($loadLazy): ?>
<script type="text/html"<?php if ($image->linkTitle || $image->picture['alt']): ?> data-rsts-name="<?= $image->linkTitle ?: $image->picture['alt'] ?>"<?php endif ?><?php if (!empty($image->thumb->src)): ?> data-rsts-thumb="<?= $image->thumb->src ?>"<?php endif ?>>
<script type="text/html"<?php if (!empty($image->linkTitle) || !empty($image->picture['alt'])): ?> data-rsts-name="<?= ($image->linkTitle ?? null) ?: $image->picture['alt'] ?>"<?php endif ?><?php if (!empty($image->thumb->src)): ?> data-rsts-thumb="<?= $image->thumb->src ?>"<?php endif ?>>
<?php ob_start() ?>
<?php endif ?>

<?php if (strpos($image->attributes, 'data-lightbox') !== false) {
$lightboxUrls[] = array($image->href, $image->linkTitle ?: $image->picture['alt']);
<?php if (strpos($image->attributes ?? '', 'data-lightbox') !== false) {
$lightboxUrls[] = array($image->href, ($image->linkTitle ?? null) ?: ($image->picture['alt'] ?? null));
} ?>

<?php
$tagName = 'div';
$attributes = array(
'data-rsts-type="image"',
);
if ($image->href) {
if (!empty($image->href)) {
$tagName = 'a';
}
if ($image->href || $image->linkTitle) {
$attributes[] = 'title="' . ($image->linkTitle ?: $image->picture['alt']) . '"';
if (!empty($image->href) || !empty($image->linkTitle)) {
$attributes[] = 'title="' . (($image->linkTitle ?? null) ?: ($image->picture['alt'] ?? '')) . '"';
}
if ($image->href) {
if (!empty($image->href)) {
$attributes[] = 'href="' . $image->href . '"';
$attributes[] = $image->attributes;
$attributes[] = $image->attributes ?? '';
}
if (!empty($this->rsts_invertControls)) {
$attributes[] = 'data-rsts-class="' . (empty($this->options['cssPrefix']) ? 'rsts-' : $this->options['cssPrefix']) . 'invert-controls"';
Expand Down Expand Up @@ -148,7 +148,7 @@
<?php if (! empty($slide['videoURL'])): ?>

<<?= $tagName ?> data-rsts-type="video" data-rsts-video="<?= $slide['videoURL'] ?>" <?= $attributes ?>>
<?php $this->insert('picture_default', array_merge($slide['image']->picture, ['attributes' => $slide['image']->picture['attributes'] . ' ' . $imageAttributes])) ?>
<?php $this->insert('picture_default', array_merge($slide['image']->picture, ['attributes' => ($slide['image']->picture['attributes'] ?? '') . ' ' . $imageAttributes])) ?>

<?php elseif (!empty($slide['videos'])): ?>
<<?= $tagName ?> data-rsts-type="video" <?= $attributes ?>>
Expand All @@ -166,8 +166,8 @@
if ($slide['image']->linkTitle) {
$attributes .= ' title="' . $slide['image']->linkTitle . '"';
}
$attributes .= ' '.$slide['image']->attributes;
if (strpos($slide['image']->attributes, 'data-lightbox') !== false) {
$attributes .= ' '.($slide['image']->attributes ?? '');
if (strpos($slide['image']->attributes ?? '', 'data-lightbox') !== false) {
$lightboxUrls[] = array($slide['image']->href, $slide['title']);
}
} ?>
Expand Down Expand Up @@ -196,7 +196,7 @@
<?php endforeach ?>
</video>
<?php elseif (!empty($slide['backgroundImage'])): ?>
<?php $this->insert('picture_default', array_merge($slide['backgroundImage']->picture, ['attributes' => $slide['backgroundImage']->picture['attributes'] . ' ' . $backgroundAttributes])) ?>
<?php $this->insert('picture_default', array_merge($slide['backgroundImage']->picture, ['attributes' => ($slide['backgroundImage']->picture['attributes'] ?? '') . ' ' . $backgroundAttributes])) ?>
<?php endif ?>

</<?= $tagName ?>>
Expand Down

0 comments on commit 58d8445

Please sign in to comment.