summaryrefslogtreecommitdiffstats
path: root/lib/private/Mail
diff options
context:
space:
mode:
authorBrad Rubenstein <brad@wbr.tech>2020-09-02 17:16:24 +0200
committerBrad Rubenstein <brad@wbr.tech>2020-09-02 17:54:36 +0200
commit442af8c5d57797bf255db036c8c04ab48f36c3a1 (patch)
tree579ba91c0f93a21023477d73fdc9a4f887e1ea41 /lib/private/Mail
parentb0687b1182e0c2da8873b2224d299f4c933f29db (diff)
downloadnextcloud-server-442af8c5d57797bf255db036c8c04ab48f36c3a1.tar.gz
nextcloud-server-442af8c5d57797bf255db036c8c04ab48f36c3a1.zip
Minor cleanup: php-cs-fixer, tests, interface consistency
IMipPlugin.php Removed blank lines to make php-cs-fixer happy. Minor cleanup: bugs found by Psalm static checker IEMailTemplate: The public interface to addBodyListItem also needs to include the new plainIndent parameter. IMipPlugin: Fixes an undefined variable for events that do not have DTEND. Also use explicit string conversion for parameters and properties in several places. The new email template adds an additional blank line before "button" links in plain text, so the tests were fixed to include that additional blank line. Signed-off-by: Brad Rubenstein <brad@wbr.tech>
Diffstat (limited to 'lib/private/Mail')
-rw-r--r--lib/private/Mail/EMailTemplate.php12
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/private/Mail/EMailTemplate.php b/lib/private/Mail/EMailTemplate.php
index 054378c2afa..e3768ae6cde 100644
--- a/lib/private/Mail/EMailTemplate.php
+++ b/lib/private/Mail/EMailTemplate.php
@@ -447,21 +447,21 @@ EOF;
* @param string $metaInfo Note: When $plainMetaInfo falls back to this, HTML is automatically escaped in the HTML email
* @param string $icon Absolute path, must be 16*16 pixels
* @param string|bool $plainText Text that is used in the plain text email
- * if empty the $text is used, if false none will be used
+ * if empty or true the $text is used, if false none will be used
* @param string|bool $plainMetaInfo Meta info that is used in the plain text email
- * if empty the $metaInfo is used, if false none will be used
+ * if empty or true the $metaInfo is used, if false none will be used
* @param integer plainIndent If > 0, Indent plainText by this amount.
* @since 12.0.0
*/
public function addBodyListItem(string $text, string $metaInfo = '', string $icon = '', $plainText = '', $plainMetaInfo = '', $plainIndent = 0) {
$this->ensureBodyListOpened();
- if ($plainText === '') {
+ if ($plainText === '' || $plainText === true) {
$plainText = $text;
$text = htmlspecialchars($text);
$text = str_replace("\n", "<br/>", $text); // convert newlines to HTML breaks
}
- if ($plainMetaInfo === '') {
+ if ($plainMetaInfo === '' || $plainMetaInfo === true) {
$plainMetaInfo = $metaInfo;
$metaInfo = htmlspecialchars($metaInfo);
}
@@ -494,8 +494,10 @@ EOF;
* "plainIndent". Multilines after the first are indented plainIndent+1
* (to account for space after label). Fixes: #12391
*/
+ /** @var string $label */
+ $label = ($plainMetaInfo !== false)? $plainMetaInfo : '';
$this->plainBody .= sprintf("%${plainIndent}s %s\n",
- $plainMetaInfo,
+ $label,
str_replace("\n", "\n" . str_repeat(' ', $plainIndent+1), $plainText));
}
}