diff --git a/.github/workflows/auto-merge.yml b/.github/workflows/auto-merge.yml index 1f52d7d..5ad2ebb 100644 --- a/.github/workflows/auto-merge.yml +++ b/.github/workflows/auto-merge.yml @@ -17,11 +17,34 @@ jobs: with: github-token: "${{ secrets.GITHUB_TOKEN }}" + - name: Check for major version bumps in PR body + if: steps.metadata.outputs.update-type == '' + id: check-major + env: + PR_BODY: ${{ github.event.pull_request.body }} + run: | + # Parse "from X to Y" version pairs from the PR body and flag major bumps. + HAS_MAJOR=false + while IFS= read -r line; do + from_ver=$(echo "$line" | sed -n 's/.*from \([0-9][0-9.]*\) to \([0-9][0-9.]*\).*/\1/p') + to_ver=$(echo "$line" | sed -n 's/.*from \([0-9][0-9.]*\) to \([0-9][0-9.]*\).*/\2/p') + [ -z "$from_ver" ] && continue + from_major="${from_ver%%.*}" + to_major="${to_ver%%.*}" + if [ "$from_major" != "$to_major" ]; then + echo "Major bump detected: $from_ver -> $to_ver" + HAS_MAJOR=true + fi + done <<< "$PR_BODY" + echo "has_major=$HAS_MAJOR" >> "$GITHUB_OUTPUT" + - name: Approve PR if: >- - (contains(steps.metadata.outputs.update-type, 'version-update:semver-minor') || + ((contains(steps.metadata.outputs.update-type, 'version-update:semver-minor') || contains(steps.metadata.outputs.update-type, 'version-update:semver-patch')) && - !contains(steps.metadata.outputs.update-type, 'version-update:semver-major') + !contains(steps.metadata.outputs.update-type, 'version-update:semver-major')) || + (steps.metadata.outputs.update-type == '' && + steps.check-major.outputs.has_major != 'true') run: gh pr review --approve "$PR_URL" env: PR_URL: ${{ github.event.pull_request.html_url }} @@ -29,9 +52,11 @@ jobs: - name: Enable auto-merge for minor and patch updates if: >- - (contains(steps.metadata.outputs.update-type, 'version-update:semver-minor') || + ((contains(steps.metadata.outputs.update-type, 'version-update:semver-minor') || contains(steps.metadata.outputs.update-type, 'version-update:semver-patch')) && - !contains(steps.metadata.outputs.update-type, 'version-update:semver-major') + !contains(steps.metadata.outputs.update-type, 'version-update:semver-major')) || + (steps.metadata.outputs.update-type == '' && + steps.check-major.outputs.has_major != 'true') run: gh pr merge --auto --squash "$PR_URL" env: PR_URL: ${{ github.event.pull_request.html_url }} diff --git a/includes/pixel.php b/includes/pixel.php index 1b294ed..4081d70 100644 --- a/includes/pixel.php +++ b/includes/pixel.php @@ -74,7 +74,10 @@ function wprtt_extract_cid_from_cookies() { return wprtt_create_cid_cookie_if_not_set(); } -if ( isset( $_GET['post'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended +// Non-ga4 hits (bots, crawlers) skip this block entirely. No counter update, no DB writes. +// The wp-admin referrer bailout below is therefore only needed within this block. +// Only update share tracking when a ga4 param is present (real pixel fires from configured republishers). +if ( isset( $_GET['post'] ) && isset( $_GET['ga4'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended // set up all of our post vars we want to track. $shared_post_id = absint( $_GET['post'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended diff --git a/languages/republication-tracker-tool.pot b/languages/republication-tracker-tool.pot index d6f35f6..2453565 100644 --- a/languages/republication-tracker-tool.pot +++ b/languages/republication-tracker-tool.pot @@ -2,14 +2,14 @@ # This file is distributed under the same license as the Republication Tracker Tool plugin. msgid "" msgstr "" -"Project-Id-Version: Republication Tracker Tool 2.8.0\n" +"Project-Id-Version: Republication Tracker Tool 2.8.1\n" "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/republication-tracker-tool\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"POT-Creation-Date: 2026-02-03T18:46:30+00:00\n" +"POT-Creation-Date: 2026-04-16T14:58:00+00:00\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "X-Generator: WP-CLI 2.12.0\n" "X-Domain: republication-tracker-tool\n" @@ -312,25 +312,25 @@ msgid "Copy to Clipboard" msgstr "" #. translators: %1$s is the site title, %2$s is the license description. -#: republication-tracker-tool.php:343 +#: republication-tracker-tool.php:344 #, php-format msgid "This article first appeared on %1$s and is republished here under a %2$s." msgstr "" #. translators: %1$s is a URL, %2$s is the site home URL, %3$s is the site title. %4$s is the license URL, %5$s is the license description. -#: republication-tracker-tool.php:351 +#: republication-tracker-tool.php:352 #, php-format msgid "This article first appeared on %3$s and is republished here under a %5$s." msgstr "" #. translators: %s is the site title. -#: republication-tracker-tool.php:364 +#: republication-tracker-tool.php:365 #, php-format msgid "This article first appeared on %s." msgstr "" #. translators: %1$s is a URL, %2$s is the site home URL, %3$s is the site title. -#: republication-tracker-tool.php:372 +#: republication-tracker-tool.php:373 #, php-format msgid "This article first appeared on %3$s." msgstr "" diff --git a/package-lock.json b/package-lock.json index df3a173..b81ccd9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10974,15 +10974,25 @@ } }, "node_modules/axios": { - "version": "1.13.1", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.13.1.tgz", - "integrity": "sha512-hU4EGxxt+j7TQijx1oYdAjw4xuIp1wRQSsbMFwSthCWeBQur1eF+qJ5iQ5sN3Tw8YRzQNKb8jszgBdMDVqwJcw==", + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.15.0.tgz", + "integrity": "sha512-wWyJDlAatxk30ZJer+GeCWS209sA42X+N5jU2jy6oHTp7ufw8uzUTVFBX9+wTfAlhiJXGS0Bq7X6efruWjuK9Q==", "dev": true, "license": "MIT", "dependencies": { - "follow-redirects": "^1.15.6", - "form-data": "^4.0.4", - "proxy-from-env": "^1.1.0" + "follow-redirects": "^1.15.11", + "form-data": "^4.0.5", + "proxy-from-env": "^2.1.0" + } + }, + "node_modules/axios/node_modules/proxy-from-env": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-2.1.0.tgz", + "integrity": "sha512-cJ+oHTW1VAEa8cJslgmUZrc+sjRKgAKl3Zyse6+PV38hZe/V6Z14TbCuXcan9F9ghlz4QrFr2c92TNF82UkYHA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" } }, "node_modules/axobject-query": { @@ -11348,9 +11358,9 @@ } }, "node_modules/basic-ftp": { - "version": "5.0.5", - "resolved": "https://registry.npmjs.org/basic-ftp/-/basic-ftp-5.0.5.tgz", - "integrity": "sha512-4Bcg1P8xhUuqcii/S0Z9wiHIrQVPMermM1any+MX5GeGD7faD3/msQUDGLol9wOcz4/jbg/WJnGqoJF6LiBdtg==", + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/basic-ftp/-/basic-ftp-5.2.2.tgz", + "integrity": "sha512-1tDrzKsdCg70WGvbFss/ulVAxupNauGnOlgpyjKzeQxzyllBLS0CGLV7tjIXTK3ZQA9/FBEm9qyFFN1bciA6pw==", "dev": true, "license": "MIT", "engines": { @@ -16318,16 +16328,16 @@ } }, "node_modules/flatted": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.3.tgz", - "integrity": "sha512-GX+ysw4PBCz0PzosHDepZGANEuFCMLrnRTiEy9McGjmkCQYwRq4A/X786G/fjM/+OjsWSU1ZrY5qyARZmO/uwg==", + "version": "3.4.2", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.4.2.tgz", + "integrity": "sha512-PjDse7RzhcPkIJwy5t7KPWQSZ9cAbzQXcafsetQoD7sOJRQlGikNbx7yZp2OotDnJyrDcbyRq3Ttb18iYOqkxA==", "dev": true, "license": "ISC" }, "node_modules/follow-redirects": { - "version": "1.15.11", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.11.tgz", - "integrity": "sha512-deG2P0JfjrTxl50XGCDyfI97ZGVCxIpfKYmfyrQ54n5FO/0gfIES8C/Psl6kWVDolizcaaxZJnTS0QSMxvnsBQ==", + "version": "1.16.0", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.16.0.tgz", + "integrity": "sha512-y5rN/uOsadFT/JfYwhxRS5R7Qce+g3zG97+JrtFZlC9klX/W5hD7iiLzScI4nZqUS7DNUdhPgw4xI8W2LuXlUw==", "dev": true, "funding": [ { @@ -16384,9 +16394,9 @@ } }, "node_modules/form-data": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.4.tgz", - "integrity": "sha512-KrGhL9Q4zjj0kiUt5OO4Mr/A/jlI2jDYs5eHBpYHPcBEVSiipAvn2Ko2HnPe20rmcuuvMHNdZFp+4IlGTMF0Ow==", + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.5.tgz", + "integrity": "sha512-8RipRLol37bNs2bhoV67fiTEvdTrbMUYcFTiy3+wuuOnUog2QBHCZWXDRijWQfAkhBj2Uf5UnVaiWwA5vdd82w==", "dev": true, "license": "MIT", "dependencies": { @@ -17317,9 +17327,9 @@ "license": "MIT" }, "node_modules/handlebars": { - "version": "4.7.8", - "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.8.tgz", - "integrity": "sha512-vafaFqs8MZkRrSX7sFVUdo3ap/eNiLnb4IakshzvP56X5Nr1iGKAIqdX6tMlm6HcNRIkr6AxO5jFEoJzzpT8aQ==", + "version": "4.7.9", + "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.9.tgz", + "integrity": "sha512-4E71E0rpOaQuJR2A3xDZ+GM1HyWYv1clR58tC8emQNeQe3RH7MAzSbat+V0wG78LQBo6m6bzSG/L4pBuCsgnUQ==", "dev": true, "license": "MIT", "dependencies": { @@ -21053,9 +21063,9 @@ "dev": true }, "node_modules/lodash-es": { - "version": "4.17.23", - "resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.23.tgz", - "integrity": "sha512-kVI48u3PZr38HdYz98UmfPnXl2DXrpdctLrFLCd3kOx1xUkOmpFPx7gCWWM5MPkL/fD8zb+Ph0QzjGFs4+hHWg==", + "version": "4.18.1", + "resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.18.1.tgz", + "integrity": "sha512-J8xewKD/Gk22OZbhpOVSwcs60zhd95ESDwezOFuA3/099925PdHJ7OFHNTGtajL3AlZkykD32HykiMo+BIBI8A==", "dev": true, "license": "MIT" }, @@ -23645,9 +23655,9 @@ } }, "node_modules/node-forge": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.3.2.tgz", - "integrity": "sha512-6xKiQ+cph9KImrRh0VsjH2d8/GXA4FIMlgU4B757iI1ApvcyA9VlouP0yZJha01V+huImO+kKMU7ih+2+E14fw==", + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.4.0.tgz", + "integrity": "sha512-LarFH0+6VfriEhqMMcLX2F7SwSXeWwnEAJEsYm5QKWchiVYVvJyV9v7UDvUv+w5HO23ZpQTXDv/GxdDdMyOuoQ==", "dev": true, "license": "(BSD-3-Clause OR GPL-2.0)", "engines": { diff --git a/republication-tracker-tool.php b/republication-tracker-tool.php index 2266dde..94b43df 100644 --- a/republication-tracker-tool.php +++ b/republication-tracker-tool.php @@ -161,8 +161,9 @@ public function init() { 'template_include', function( $template ) { // If the params are set, use our pixel functions. - if ( isset( $_GET['republication-pixel'] ) && isset( $_GET['post'] ) && isset( $_GET['ga4'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended - return include_once plugin_dir_path( __FILE__ ) . 'includes/pixel.php'; + if ( isset( $_GET['republication-pixel'] ) && isset( $_GET['post'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended + include_once plugin_dir_path( __FILE__ ) . 'includes/pixel.php'; + exit; // Else, continue with whatever template was being loaded. } else { return $template;