Repository: artesaos/seotools (language: php)

Issue:
Problem with "" in Title.
### What steps will reproduce the problem?
When I have a title that has quotes around it, the title cuts off in the meta title.
        SEOMeta::setTitle($post->title);


### What is the expected result?
The title not cutting off after the after the quotes! 

### What do you get instead?
The title cuts off after the quotes!

### Additional info

| Q                         | A
| ------------------------- | ---
| This Package Version      | 1.?.?
| Laravel Framework Version | 5.7.0
| PHP version               | 7.1.2
| Operating system          | Mac OS

The actual title: First Look: Show TV's "Ramo"
How it shows up in the meta: https://imgur.com/jMTQWWG




Discussion / hints:
I noticed the same problem.
I fixed this on my system by using the htmlentities() function in the getTitle() functions of these files:
src/SEOTools/SEOMeta.php
src/SEOTools/OpenGraph.php
src/SEOTools/TwitterCards.php



Fix patch:
diff --git a/src/SEOTools/OpenGraph.php b/src/SEOTools/OpenGraph.php
index 41995fb..25dc745 100644
--- a/src/SEOTools/OpenGraph.php
+++ b/src/SEOTools/OpenGraph.php
@@ -263,16 +263,36 @@ protected function eachProperties(
      */
     protected function makeTag($key = null, $value = null, $ogPrefix = false)
     {
-        $value = str_replace(['http-equiv=', 'url='], '', $value);
         return sprintf(
             '<meta property="%s%s" content="%s" />%s',
             $ogPrefix ? $this->og_prefix : '',
             strip_tags($key),
-            strip_tags($value),
+            $this->cleanTagValue($value),
             PHP_EOL
         );
     }
 
+    /**
+     * Clean og tag value
+     *
+     * @param string $value    meta property value
+     *
+     * @return string
+     */
+    protected function cleanTagValue($value)
+    {
+        // Safety
+        $value = str_replace(['http-equiv=', 'url='], '', $value);
+
+        // Escape double quotes
+        $value = htmlspecialchars($value, ENT_QUOTES, null, false);
+
+        // Clean
+        $value = strip_tags($value);
+
+        return $value;
+    }
+
     /**
      * Add or update property.
      *
diff --git a/src/SEOTools/TwitterCards.php b/src/SEOTools/TwitterCards.php
index 0550509..8eac452 100644
--- a/src/SEOTools/TwitterCards.php
+++ b/src/SEOTools/TwitterCards.php
@@ -83,8 +83,32 @@ protected function eachValue(array $values, $prefix = null)
      */
     private function makeTag($key, $value)
     {
+        return sprintf(
+            '<meta name="%s" content="%s" />',
+            $this->prefix.strip_tags($key),
+            $this->cleanTagValue($value)
+        );
+    }
+
+    /**
+     * Clean tag value
+     *
+     * @param string $value    meta content value
+     *
+     * @return string
+     */
+    protected function cleanTagValue($value)
+    {
+        // Safety
         $value = str_replace(['http-equiv=', 'url='], '', $value);
-        return '<meta name="'.$this->prefix.strip_tags($key).'" content="'.strip_tags($value).'" />';
+
+        // Escape double quotes
+        $value = htmlspecialchars($value, ENT_QUOTES, null, false);
+
+        // Clean
+        $value = strip_tags($value);
+
+        return $value;
     }
 
     /**


Test patch: