From 1ee0c849d217165e005eb7acb490aa07495900e1 Mon Sep 17 00:00:00 2001
From: Grzegorz Rola <grola@seostudio.pl>
Date: Fri, 12 Oct 2018 17:41:44 +0200
Subject: [PATCH] Attributes

---
 src/WPDesk/Notice/Notice.php | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/src/WPDesk/Notice/Notice.php b/src/WPDesk/Notice/Notice.php
index 14bdaaa..cefdbf9 100644
--- a/src/WPDesk/Notice/Notice.php
+++ b/src/WPDesk/Notice/Notice.php
@@ -205,12 +205,27 @@ class Notice
         return $attribute_string;
     }
 
+    private function addParagraphToConten()
+    {
+        if (0 === strpos($this->noticeContent, '<p>')) {
+            return false;
+        }
+        if (0 === strpos($this->noticeContent, '<div>') || 0 === strpos($this->noticeContent, '<div ')) {
+            return false;
+        }
+        return true;
+    }
+
     /**
      * Show notice;
      */
     public function showNotice()
     {
-        echo sprintf('<div %1$s>%2$s</div>', $this->getAttributesAsString(), $this->noticeContent);
+        $noticeFormat = '<div %1$s>%2$s</div>';
+        if ($this->addParagraphToConten()) {
+            $noticeFormat = '<div %1$s><p>%2$s</p></div>';
+        }
+        echo sprintf($noticeFormat, $this->getAttributesAsString(), $this->noticeContent);
     }
 
 }
-- 
GitLab