From 588590bd2c0346e2465ff8f1930580d76a3bf068 Mon Sep 17 00:00:00 2001 From: Yassine Doghri Date: Sun, 23 Jan 2022 16:53:23 +0000 Subject: [PATCH] fix(xml-editor): escape xml editor's content + restyle form sections to prevent overflowing --- app/Views/Components/Forms/Section.php | 6 +++--- app/Views/Components/Forms/XMLEditor.php | 10 ++++++++-- themes/cp_admin/_partials/_user_info.php | 2 +- themes/cp_admin/episode/create.php | 6 +++--- themes/cp_admin/episode/delete.php | 2 +- themes/cp_admin/episode/edit.php | 8 ++++---- themes/cp_admin/episode/embed.php | 2 +- themes/cp_admin/episode/publish.php | 2 +- themes/cp_admin/episode/publish_edit.php | 2 +- themes/cp_admin/episode/unpublish.php | 2 +- themes/cp_admin/podcast/create.php | 2 +- themes/cp_admin/podcast/edit.php | 6 +++--- themes/cp_admin/podcast/import.php | 2 +- themes/cp_admin/settings/general.php | 4 ++-- themes/cp_admin/settings/theme.php | 2 +- 15 files changed, 32 insertions(+), 26 deletions(-) diff --git a/app/Views/Components/Forms/Section.php b/app/Views/Components/Forms/Section.php index cf736744..eedd05a5 100644 --- a/app/Views/Components/Forms/Section.php +++ b/app/Views/Components/Forms/Section.php @@ -16,13 +16,13 @@ class Section extends Component public function render(): string { - $subtitle = $this->subtitle === null ? '' : '

' . $this->subtitle . '

'; + $subtitle = $this->subtitle === null ? '' : '

' . $this->subtitle . '

'; return << +
{$this->title} {$subtitle} -
{$this->slot}
+
{$this->slot}
HTML; } diff --git a/app/Views/Components/Forms/XMLEditor.php b/app/Views/Components/Forms/XMLEditor.php index c3ec19ba..fded2001 100644 --- a/app/Views/Components/Forms/XMLEditor.php +++ b/app/Views/Components/Forms/XMLEditor.php @@ -14,11 +14,17 @@ class XMLEditor extends FormComponent 'class' => 'textarea', ]; + protected string $content = ''; + + public function setContent(string $value): void + { + $this->content = htmlspecialchars_decode($value); + } + public function render(): string { - $content = $this->slot; $this->attributes['slot'] = 'textarea'; - $textarea = form_textarea($this->attributes, $content); + $textarea = form_textarea($this->attributes, $this->content); return <<{$textarea} diff --git a/themes/cp_admin/_partials/_user_info.php b/themes/cp_admin/_partials/_user_info.php index eafb73b4..613aea14 100644 --- a/themes/cp_admin/_partials/_user_info.php +++ b/themes/cp_admin/_partials/_user_info.php @@ -26,7 +26,7 @@
-
+
permissions) ?>
diff --git a/themes/cp_admin/episode/create.php b/themes/cp_admin/episode/create.php index 90eb4b7f..bfc2d611 100644 --- a/themes/cp_admin/episode/create.php +++ b/themes/cp_admin/episode/create.php @@ -11,7 +11,7 @@ section('content') ?> -
+ @@ -53,14 +53,14 @@
section('content') ?> - + diff --git a/themes/cp_admin/episode/edit.php b/themes/cp_admin/episode/edit.php index 86a5bc98..8f2cbb19 100644 --- a/themes/cp_admin/episode/edit.php +++ b/themes/cp_admin/episode/edit.php @@ -15,7 +15,7 @@ section('content') ?> - + @@ -57,14 +57,14 @@
diff --git a/themes/cp_admin/episode/embed.php b/themes/cp_admin/episode/embed.php index 099b40b8..16057d97 100644 --- a/themes/cp_admin/episode/embed.php +++ b/themes/cp_admin/episode/embed.php @@ -24,7 +24,7 @@
- +
embed_url}\">") ?>" /> diff --git a/themes/cp_admin/episode/publish.php b/themes/cp_admin/episode/publish.php index 26d22f6a..09c3212d 100644 --- a/themes/cp_admin/episode/publish.php +++ b/themes/cp_admin/episode/publish.php @@ -18,7 +18,7 @@ ], ) ?> - + diff --git a/themes/cp_admin/episode/publish_edit.php b/themes/cp_admin/episode/publish_edit.php index 0e63bc71..efe4d586 100644 --- a/themes/cp_admin/episode/publish_edit.php +++ b/themes/cp_admin/episode/publish_edit.php @@ -18,7 +18,7 @@ ], ) ?> - + diff --git a/themes/cp_admin/episode/unpublish.php b/themes/cp_admin/episode/unpublish.php index a6d42082..e0fb7aa8 100644 --- a/themes/cp_admin/episode/unpublish.php +++ b/themes/cp_admin/episode/unpublish.php @@ -10,7 +10,7 @@ section('content') ?> - + diff --git a/themes/cp_admin/podcast/create.php b/themes/cp_admin/podcast/create.php index 938121c1..f42576cb 100644 --- a/themes/cp_admin/podcast/create.php +++ b/themes/cp_admin/podcast/create.php @@ -14,7 +14,7 @@ section('content') ?> - +
-
+
+ hint="" + content="custom_rss_string) ?>" /> diff --git a/themes/cp_admin/podcast/import.php b/themes/cp_admin/podcast/import.php index e7abcf46..bd2ee775 100644 --- a/themes/cp_admin/podcast/import.php +++ b/themes/cp_admin/podcast/import.php @@ -12,7 +12,7 @@ - + - + - + section('content') ?> - +