Skip to content

Commit

Permalink
Update use of Str::template that works with Kirby <=3.5 and >3.5
Browse files Browse the repository at this point in the history
  • Loading branch information
mzur committed Oct 10, 2021
1 parent 535d5ad commit c909962
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/Actions/EmailAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,15 @@ protected function getSubject()
return is_scalar($item);
});

$subject = Str::template($this->option('subject', I18n::translate('uniform-email-subject')), $templatableItems, ['fallback' => '']);
$minorVersion = intval(explode('.', App::version())[1]);
$fallback = ['fallback' => ''];

// The arguments to Str::template changed in Kirby 3.6.
if ($minorVersion <= 5) {
$fallback = '';
}

$subject = Str::template($this->option('subject', I18n::translate('uniform-email-subject')), $templatableItems, $fallback);

// Remove newlines to prevent malicious modifications of the email header.
return str_replace("\n", '', $subject);
Expand Down

0 comments on commit c909962

Please sign in to comment.