Skip to content

Commit

Permalink
Merge pull request #86 from contao-themes-net/support-contao-5.3
Browse files Browse the repository at this point in the history
Support contao 5.3
  • Loading branch information
MDevster authored Feb 26, 2024
2 parents 16a9ef9 + 4989b3d commit 5dad4b9
Show file tree
Hide file tree
Showing 26 changed files with 1,701 additions and 3,579 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ Types of changes
Security in case of vulnerabilities.
)

## [2.3.1](https://github.com/contao-themes-net/nature-theme-bundle/tree/2.3.1) – 2024-02-21

- [Changed] Change templates to support CSP on WYSIWYG editors like TinyMCE
- [Changed] Now require contao version ^5.3
- [Changed] Update sql files

## [2.3.0](https://github.com/contao-themes-net/nature-theme-bundle/tree/2.3.0) – 2024-08-02

- [Added] Add quote element
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
},
"require": {
"php": "^8.0",
"contao/core-bundle": "^5.0",
"contao/core-bundle": "^5.3",
"terminal42/contao-folderpage": "^3.0",
"pdir/contao-theme-helper-bundle": "^1.5",
"contao-themes-net/theme-components-bundle": "^1.4",
Expand Down
978 changes: 0 additions & 978 deletions contao/sql/contao50/full.sql

This file was deleted.

862 changes: 0 additions & 862 deletions contao/sql/contao50/minimal.sql

This file was deleted.

981 changes: 0 additions & 981 deletions contao/sql/contao51/full.sql

This file was deleted.

981 changes: 981 additions & 0 deletions contao/sql/contao53/full.sql

Large diffs are not rendered by default.

1,322 changes: 633 additions & 689 deletions contao/sql/contao51/minimal.sql → contao/sql/contao53/minimal.sql

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<?= $this->headline ?>
<?php if($this->iconLink != ""): ?></a><?php endif; ?>
</div>
<div class="text"><?= $this->text ?></div>
<div class="text"><?= $this->cspInlineStyles($this->text) ?></div>
</div>
</div>
</div>
28 changes: 14 additions & 14 deletions contao/templates/elements/ce_cthemes_teaserbox_fullheight.html5
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,27 @@
<?php $this->block('content'); ?>

<?php if ($this->addImage): ?>
<figure class="image_container float_above" style="background-image:url('<?= $this->picture['img']['src'] ?>')"></figure>
<figure class="image_container float_above" style="background-image:url('<?= $this->picture['img']['src'] ?>')"></figure>
<?php endif; ?>

<div class="content">
<?php if ($this->headline): ?>
<<?= $this->hl ?>>
<?php if($this->page != ""): ?><a href="<?= $this->page ?>"<?= $this->target ?><?= $this->rel ?><?= $this->pageTitle ?>><?php endif; ?>
<?= $this->headline ?>
<?php if($this->page != ""): ?></a><?php endif; ?>
</<?= $this->hl ?>>
<?php endif; ?>
<<?= $this->hl ?>>
<?php if($this->page != ""): ?><a href="<?= $this->page ?>"<?= $this->target ?><?= $this->rel ?><?= $this->pageTitle ?>><?php endif; ?>
<?= $this->headline ?>
<?php if($this->page != ""): ?></a><?php endif; ?>
</<?= $this->hl ?>>
<?php endif; ?>

<?= $this->text ?>
<?= $this->cspInlineStyles($this->text) ?>

<?php if($this->page != ""): ?>
<div class="pageLink">
<a href="<?= $this->page ?>"<?= $this->target ?><?= $this->rel ?><?= $this->pageTitle ?>><?= $this->pageText ?></a>
<?php if($this->page != ""): ?>
<div class="pageLink">
<a href="<?= $this->page ?>"<?= $this->target ?><?= $this->rel ?><?= $this->pageTitle ?>><?= $this->pageText ?></a>
</div>
<?php endif; ?>
</div>
<?php endif; ?>
</div>

<?php $this->endblock(); ?>
<?php $this->endblock(); ?>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
</<?= $this->hl ?>>
<?php endif; ?>

<?= $this->text ?>
<?= $this->cspInlineStyles($this->text) ?>

<?php if($this->page != ""): ?>
<div class="pageLink">
Expand Down
2 changes: 1 addition & 1 deletion contao/templates/elements/ce_slider_element_nature.html5
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
</<?= $this->hl ?>>
<?php endif; ?>

<?= $this->text ?>
<?= $this->cspInlineStyles($this->text) ?>

<?php if($this->page): ?>
<a href="<?= $this->page ?>" class="readmore"<?= $this->target ?><?= $this->rel ?>><?= $this->linkText ?></a>
Expand Down
4 changes: 2 additions & 2 deletions contao/templates/elements/ce_text_modal_nature.html5
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<div class="teaser">
<div>
<?= $this->text ?>
<?= $this->cspInlineStyles($this->text) ?>
</div>
</div>

Expand All @@ -29,6 +29,6 @@
<div class="modal-background"></div>
<div class="modal-content">
<button class="delete float_right" aria-label="close"></button>
<?= $this->modalContent ?>
<?= $this->cspInlineStyles($this->modalContent) ?>
</div>
</div>
4 changes: 2 additions & 2 deletions contao/templates/events/event_full_nature.html5
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@
<?php else: ?>
<div class="ce_text block">
<?php if (!$this->addBefore): ?>
<?= $this->teaser ?>
<?= $this->cspInlineStyles($this->teaser) ?>
<?php endif; ?>

<?php if ($this->addImage): ?>
<?php $this->insert('image', $this->arrData); ?>
<?php endif; ?>

<?php if ($this->addBefore): ?>
<?= $this->teaser ?>
<?= $this->cspInlineStyles($this->teaser) ?>
<?php endif; ?>
</div>
<?php endif; ?>
Expand Down
2 changes: 1 addition & 1 deletion contao/templates/events/event_list_nature.html5
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<?php endif; ?>

<div class="ce_text block" itemprop="description">
<?= $this->teaser ?>
<?= $this->cspInlineStyles($this->teaser) ?>
</div>

<p class="time"><i class="far fa-calendar-alt"></i><time datetime="<?= $this->datetime ?>" itemprop="startDate"><?= $this->date ?><?php if ($this->time):?> <?= $this->time ?><?php endif; ?></time></p>
Expand Down
2 changes: 1 addition & 1 deletion contao/templates/events/event_teaser_nature.html5
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<?php endif; ?>

<div class="ce_text block" itemprop="description">
<?= $this->teaser ?>
<?= $this->cspInlineStyles($this->teaser) ?>
</div>

<p class="time"><i class="far fa-calendar-alt"></i><time datetime="<?= $this->datetime ?>" itemprop="startDate"><?= $this->date ?><?php if ($this->time):?> <?= $this->time ?><?php endif; ?></time></p>
Expand Down
75 changes: 43 additions & 32 deletions contao/templates/forms/form_captcha.html5
Original file line number Diff line number Diff line change
@@ -1,37 +1,48 @@
<?php $this->extend('form_row'); ?>

<?php $this->block('label'); ?>
<?php if ($this->label): ?>
<label for="ctrl_<?= $this->id ?>"<?php if ($this->class): ?> class="<?= $this->class ?>"<?php endif; ?>>
<span class="invisible"><?= $this->mandatoryField ?> </span><?= $this->label ?><span class="mandatory">*</span>
</label>
<?php endif; ?>
<?php $this->endblock(); ?>

<?php $this->block('field'); ?>
<?php if ($this->hasErrors()): ?>
<p class="error"><?= $this->getErrorAsString() ?></p>
<?php endif; ?>

<div class="control">
<?php if ($this->label): ?>
<label for="ctrl_<?= $this->id ?>" class="label<?php if ($this->class): ?> <?= $this->class ?><?php endif; ?>">
<span class="invisible"><?= $this->mandatoryField ?> </span><?= $this->label ?><span class="mandatory">*</span>
</label>
<?php endif; ?>

<input type="text" name="<?= $this->name ?>" id="ctrl_<?= $this->id ?>" class="captcha mandatory input<?php if ($this->class): ?> <?= $this->class ?><?php endif; ?>" value="" aria-describedby="captcha_text_<?= $this->id ?>"<?= $this->getAttributes() ?>>
<span id="captcha_text_<?= $this->id ?>" class="captcha_text<?php if ($this->class): ?> <?= $this->class ?><?php endif; ?>"><?= $this->getQuestion() ?></span>
<input type="hidden" name="<?= $this->name ?>_hash" value="<?= $this->getHash() ?>">
</div>
<?php if ($this->hasErrors()): ?>
<p class="help is-danger"><?= $this->getErrorAsString() ?></p>
<?php endif; ?>
<?php if (!$this->hasErrors()): ?>
<div style="display:none">
<label for="ctrl_<?= $this->id ?>_hp">Do not fill in this field</label>
<input type="text" name="<?= $this->name ?>_name" id="ctrl_<?= $this->id ?>_hp" value="">
</div>
<script>
var e = document.getElementById('ctrl_<?= $this->id ?>'),
p = e.parentNode, f = p.parentNode;

if ('fieldset' === f.nodeName.toLowerCase() && 1 === f.children.length) {
p = f;
}

p.style.display = 'none';
e.value = '<?= $this->getSum() ?>';
</script>
<?php endif ?>
<input type="text" name="<?= $this->name ?>" id="ctrl_<?= $this->id ?>" class="captcha mandatory<?php if ($this->class): ?> <?= $this->class ?><?php endif; ?>" value="" aria-describedby="captcha_text_<?= $this->id ?>"<?= $this->getAttributes() ?>>
<span id="captcha_text_<?= $this->id ?>" class="captcha_text<?php if ($this->class): ?> <?= $this->class ?><?php endif; ?>"><?= $this->getQuestion() ?></span>
<input type="hidden" name="<?= $this->name ?>_hash" value="<?= $this->hasErrors() ? $this->getHash() : '' ?>">

<?php $this->endblock(); ?>
<?php if (!$this->hasErrors()): ?>
<div style="<?= $this->cspInlineStyle('display:none') ?>">
<label for="ctrl_<?= $this->id ?>_hp">Do not fill in this field</label>
<input type="text" name="<?= $this->name ?>_name" id="ctrl_<?= $this->id ?>_hp" value="">
</div>
<script<?= $this->attr()->setIfExists('nonce', $this->nonce('script-src')) ?>>
(function() {
var e = document.getElementById('ctrl_<?= $this->id ?>'),
p = e.parentNode, f = p.parentNode;

if (f.classList.contains('widget-captcha') || 'fieldset' === f.nodeName.toLowerCase() && 1 === f.children.length) {
p = f;
}

e.required = false;
p.style.display = 'none';

setTimeout(() => {
fetch(<?= json_encode($this->getAjaxUrl()) ?>).then(r => r.json()).then(d => {
e.value = d.sum;
e.form.elements[<?= json_encode($this->name.'_hash') ?>].value = d.hash;
document.getElementById('captcha_text_<?= $this->id ?>').textContent = d.question;
});
}, 5000);
})();
</script>
<?php endif ?>

<?php $this->endblock(); ?>
2 changes: 1 addition & 1 deletion contao/templates/news/news_full_nature.html5
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<?= $this->text ?>
<?php else: ?>
<div class="content-text block">
<?= $this->teaser ?>
<?= $this->cspInlineStyles($this->teaser) ?>
</div>
<?php endif; ?>

Expand Down
2 changes: 1 addition & 1 deletion contao/templates/news/news_latest_nature_col2.html5
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<h2><?= $this->linkHeadline ?></h2>

<div class="ce_text block" itemprop="description">
<?= $this->teaser ?>
<?= $this->cspInlineStyles($this->teaser) ?>
</div>

<?php if ($this->hasMetaFields): ?>
Expand Down
2 changes: 1 addition & 1 deletion contao/templates/news/news_latest_nature_col3.html5
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<h2><?= $this->linkHeadline ?></h2>

<div class="ce_text block" itemprop="description">
<?= $this->teaser ?>
<?= $this->cspInlineStyles($this->teaser) ?>
</div>

<?php if ($this->hasMetaFields): ?>
Expand Down
2 changes: 1 addition & 1 deletion contao/templates/news/news_short_nature.html5
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<h2><?= $this->headline ?></h2>

<div class="ce_text block" itemprop="description">
<?= $this->teaser ?>
<?= $this->cspInlineStyles($this->teaser) ?>
</div>

<?php if ($this->hasMetaFields): ?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<?php endif; ?>

<div class="ce_text block" itemprop="description">
<p><?= preg_replace('#(?:<br\s*/?>\s*?){2,}#', '</p><p>', $this->teaser) ?></p>
<p><?= preg_replace('#(?:<br\s*/?>\s*?){2,}#', '</p><p>', $this->cspInlineStyles($this->teaser)) ?></p>
</div>

<a href="<?= $this->url ?>" target="_blank" class="more" rel="noreferrer noopener">
Expand Down
2 changes: 1 addition & 1 deletion contao/templates/news/news_social_feed_nature.html5
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

<a href="<?= $this->url ?>" target="_blank">
<div class="ce_text block" itemprop="description">
<p><?= preg_replace('#(?:<br\s*/?>\s*?){2,}#', '</p><p>', $this->teaser) ?></p>
<p><?= preg_replace('#(?:<br\s*/?>\s*?){2,}#', '</p><p>', $this->cspInlineStyles($this->teaser)) ?></p>
</div>
</a>

Expand Down
6 changes: 6 additions & 0 deletions public/scss/parts/elements.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1382,6 +1382,12 @@ pre {
height: 100vh;
z-index: 10;

img {
width: 100%;
height: 100%;
object-fit: cover;
}

@for $i from 1 through 20 {
&:nth-of-type(#{$i}) {
z-index: #{$i};
Expand Down
5 changes: 0 additions & 5 deletions src/Migration/InitialDemoDataMigration.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,6 @@ public function shouldRun(): bool
$this->sqlFile = str_replace('minimal', 'full', $this->sqlFile);
}

// Contao 5.1
if (isset($schemaManager->listTableColumns('tl_form')['ajax'])) {
$this->sqlFile = str_replace('50', '51', $this->sqlFile);
}

// check some tables for content
$count = $this->connection->fetchOne('SELECT COUNT(*) FROM `tl_article`');
$count += $this->connection->fetchOne('SELECT COUNT(*) FROM `tl_content`');
Expand Down
2 changes: 1 addition & 1 deletion src/Migration/MigrationHelperTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ trait MigrationHelperTrait

private string $contaoFolder = 'vendor/contao-themes-net/nature-theme-bundle/contao';
private string $themeFolder = 'naturetheme';
private string $sqlFile = 'sql/contao50/minimal.sql';
private string $sqlFile = 'sql/contao53/minimal.sql';

private array $minTables = [ // @phpstan-ignore-line
'tl_article', 'tl_content', 'tl_css_style_selector', 'tl_files', 'tl_form', 'tl_form_field', 'tl_image_size',
Expand Down
2 changes: 1 addition & 1 deletion src/Module/NatureThemeSetup.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

class NatureThemeSetup extends BackendModule
{
public const VERSION = '2.3.0';
public const VERSION = '2.3.1';

protected $strTemplate = 'be_naturetheme_setup';

Expand Down

0 comments on commit 5dad4b9

Please sign in to comment.