diff --git a/README.md b/README.md
index a850b36..ad556bb 100644
--- a/README.md
+++ b/README.md
@@ -44,6 +44,11 @@ protected $middleware = [
Description |
Available |
+
+ remove_quotes |
+ Removes unnecessary quotes in HTML tags |
+ YES |
+
trim_urls |
Removes unnecessary prefixes from URLs |
@@ -194,11 +199,6 @@ protected $middleware = [
Instruments the page, inlines its critical CSS at the top, and lazily loads the rest |
NO |
-
- remove_quotes |
- Removes unnecessary quotes in HTML tags |
- NO |
-
resize_mobile_images |
Just like inline_preview_images, but uses smaller placeholder images for mobile browsers |
diff --git a/src/Middleware/RemoveQuotes.php b/src/Middleware/RemoveQuotes.php
index f22de34..6b52bd7 100644
--- a/src/Middleware/RemoveQuotes.php
+++ b/src/Middleware/RemoveQuotes.php
@@ -2,20 +2,23 @@
namespace RenatoMarinho\LaravelPageSpeed\Middleware;
-use Closure;
-
-class RemoveQuotes
+class RemoveQuotes extends PageSpeed
{
- /**
- * Handle an incoming request.
- *
- * @param \Illuminate\Http\Request $request
- * @param \Closure $next
- * @return mixed
- */
-
- public function handle($request, Closure $next)
+ public function apply($buffer)
{
- }
+ $replace = [
+ '/src="(.*?)"/' => 'src=$1',
+ '/width="(.*?)"/' => 'width=$1',
+ '/height="(.*?)"/' => 'height=$1',
+ '/name="(.*?)"/' => 'name=$1',
+ '/charset="(.*?)"/' => 'charset=$1',
+ '/href="(.*?)"/' => 'href=$1',
+ '/align="(.*?)"/' => 'align=$1',
+ '/border="(.*?)"/' => 'border=$1',
+ '/crossorigin="(.*?)"/' => 'crossorigin=$1',
+ '/rel="(.*?)"/' => 'rel=$1',
+ ];
+ return $this->replace($replace, $buffer);
+ }
}
\ No newline at end of file
diff --git a/tests/Middleware/RemoveCommentsTest.php b/tests/Middleware/RemoveCommentsTest.php
index a80dc3b..95d07aa 100644
--- a/tests/Middleware/RemoveCommentsTest.php
+++ b/tests/Middleware/RemoveCommentsTest.php
@@ -5,7 +5,7 @@
use RenatoMarinho\LaravelPageSpeed\Middleware\RemoveComments;
use RenatoMarinho\LaravelPageSpeed\Test\TestCase;
-class CollapseWhitespaceTest extends TestCase
+class RemoveCommentsTest extends TestCase
{
public $middleware;
diff --git a/tests/Middleware/RemoveQuotes.php b/tests/Middleware/RemoveQuotes.php
index 713aeb0..85caef1 100644
--- a/tests/Middleware/RemoveQuotes.php
+++ b/tests/Middleware/RemoveQuotes.php
@@ -2,24 +2,24 @@
namespace RenatoMarinho\LaravelPageSpeed\Test\Middleware;
-use RenatoMarinho\LaravelPageSpeed\Middleware\TrimUrls;
+use RenatoMarinho\LaravelPageSpeed\Middleware\RemoveQuotes;
use RenatoMarinho\LaravelPageSpeed\Test\TestCase;
-class TrimUrlsTest extends TestCase
+class RemoveQuotesTest extends TestCase
{
public $middleware;
public function getMiddleware()
{
- $this->middleware = new TrimUrls();
+ $this->middleware = new RemoveQuotes();
}
public function testApply()
{
$html = $this->middleware->apply($this->html);
- $this->assertNotContains("https://", $html);
- $this->assertNotContains("http://", $html);
- $this->assertContains("//code.jquery.com/jquery-3.2.1.min.js", $html);
+ $this->assertContains('', $html);
+ $this->assertContains('', $html);
+ $this->assertContains('', $html);
}
}
\ No newline at end of file