diff --git a/app/helpers.php b/app/helpers.php index 8d0649ac..bbdcdf7f 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -631,3 +631,18 @@ if (! function_exists('is_request_secure')) { return false; } } + +if (! function_exists('nl2p')) { + /** + * Wrap blocks of text (delimited by \n) in p tags (similar to nl2br). + * + * @param string $text + * @return string + */ + function nl2p($text) { + $parts = explode("\n", $text); + $result = '

'.implode('

', $parts).'

'; + // Remove empty paragraphs + return str_replace('

', '', $result); + } +} diff --git a/resources/views/admin/update.blade.php b/resources/views/admin/update.blade.php index caf2121f..aae1975c 100644 --- a/resources/views/admin/update.blade.php +++ b/resources/views/admin/update.blade.php @@ -47,7 +47,7 @@ {{ trans('admin.update.info.change-log.text') }} - {!! nl2br($info['release_note']) ?: trans('admin.update.info.change-log.empty') !!} + {!! nl2p($info['release_note']) ?: trans('admin.update.info.change-log.empty') !!} @@ -104,7 +104,7 @@

{{ trans('admin.update.cautions.title') }}

-

{!! nl2br(trans('admin.update.cautions.text')) !!}

+ {!! nl2p(trans('admin.update.cautions.text')) !!}
diff --git a/resources/views/errors/exception.blade.php b/resources/views/errors/exception.blade.php index 0a0aede4..7cf38f6d 100644 --- a/resources/views/errors/exception.blade.php +++ b/resources/views/errors/exception.blade.php @@ -9,6 +9,6 @@

{{ $message }}

-

{!! nl2br(trans('errors.exception.message')) !!}

+{!! nl2p(trans('errors.exception.message')) !!} @endsection diff --git a/resources/views/setup/updates/welcome.blade.php b/resources/views/setup/updates/welcome.blade.php index 4c9a8b13..db5ab1ed 100644 --- a/resources/views/setup/updates/welcome.blade.php +++ b/resources/views/setup/updates/welcome.blade.php @@ -6,7 +6,7 @@ @include('setup.wizard.language') -

{!! nl2br(trans('setup.updates.welcome.text', ['version' => config('app.version')])) !!}

+{!! nl2p(trans('setup.updates.welcome.text', ['version' => config('app.version')])) !!}

diff --git a/resources/views/user/index.blade.php b/resources/views/user/index.blade.php index ea79d57d..ba05f8da 100644 --- a/resources/views/user/index.blade.php +++ b/resources/views/user/index.blade.php @@ -113,7 +113,7 @@