diff --git a/.github/workflows/code-quality.yml b/.github/workflows/code-quality.yml index 9f6dcaa..c277787 100644 --- a/.github/workflows/code-quality.yml +++ b/.github/workflows/code-quality.yml @@ -17,7 +17,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Setup PHP uses: shivammathur/setup-php@v2 diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 382ff9a..64fbdf3 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -18,7 +18,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v5 with: fetch-depth: 0 @@ -34,7 +34,7 @@ jobs: - name: Cache Composer packages id: composer-cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: vendor key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} @@ -66,7 +66,7 @@ jobs: echo "✅ Coverage is acceptable ($COVERAGE%)" - name: Comment PR with results - uses: actions/github-script@v7 + uses: actions/github-script@v8 if: always() with: script: | diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index bb74326..f07d357 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -31,7 +31,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Setup PHP uses: shivammathur/setup-php@v2 diff --git a/composer.json b/composer.json index efcb811..abbb1db 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,7 @@ }, "require-dev": { "phpunit/phpunit": "^10.5 || ^11.0", - "orchestra/testbench": "^8.0 || ^9.0 || ^10.0", + "orchestra/testbench": "^10.6.0", "squizlabs/php_codesniffer": "^3.6", "mockery/mockery": "^1.6" }, diff --git a/src/Middleware/InsertDNSPrefetch.php b/src/Middleware/InsertDNSPrefetch.php index abc9a70..8ab920f 100644 --- a/src/Middleware/InsertDNSPrefetch.php +++ b/src/Middleware/InsertDNSPrefetch.php @@ -6,16 +6,76 @@ class InsertDNSPrefetch extends PageSpeed { public function apply($buffer) { + // Extract URLs only from HTML attributes, not from script/style content + $urls = []; + + // Step 1: Extract URLs from script src/href attributes preg_match_all( - '#\bhttps?://[^\s()<>]+(?:\([\w\d]+\)|([^[:punct:]\s]|/))#', + '# + +
+ Real Link + +