Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
6d48c16
Merge branch 'main' into develop
aristath Aug 4, 2025
404904d
GH Actions: Bump actions/checkout from 4 to 5
dependabot[bot] Aug 12, 2025
321a4a2
compatibility with PP v1.8
ilicfilip Sep 11, 2025
3ffac32
changelog
ilicfilip Sep 11, 2025
0bce958
update text domain
ilicfilip Sep 11, 2025
2a4b773
CS
aristath Sep 11, 2025
da207e8
Workflows change to attempt fixing CS reports
aristath Sep 11, 2025
40a4361
Update composer.json
aristath Sep 11, 2025
9194ae5
Update composer.lock
aristath Sep 11, 2025
4ed3dc2
Exclude a rule
aristath Sep 11, 2025
c1d36a4
Another rule exclusion
aristath Sep 11, 2025
216acbb
Merge remote-tracking branch 'origin/filip/pp-18-compat' into filip/p…
ilicfilip Sep 11, 2025
d431176
try to avoid mixed
ilicfilip Sep 11, 2025
111abc5
phpcs
ilicfilip Sep 11, 2025
097902a
composer updates
aristath Sep 11, 2025
bab6326
tweak phpstan config
aristath Sep 11, 2025
d03dfa1
PHPStan fixes
aristath Sep 11, 2025
41c8fd2
Run `composer fix-cs`
aristath Sep 11, 2025
ea96782
More CS fixes
aristath Sep 11, 2025
f38dcf4
What about this?
aristath Sep 11, 2025
9b563a6
Revert "Run `composer fix-cs`"
aristath Sep 11, 2025
a67957d
tests tweak
aristath Sep 11, 2025
9b39021
Change phpcs-fixer config
aristath Sep 11, 2025
998c3ac
Merge pull request #155 from ProgressPlanner/filip/pp-18-compat
aristath Sep 11, 2025
11f8eba
Merge pull request #154 from ProgressPlanner/dependabot/github_action…
aristath Sep 11, 2025
99c847f
pp compat
ilicfilip Sep 15, 2025
a533c55
$this->get_parent()
ilicfilip Sep 15, 2025
204861f
docblock update
ilicfilip Sep 15, 2025
6c11a49
Playground improvement
jdevalk Sep 16, 2025
509e4f8
change default branch logic
jdevalk Sep 16, 2025
9a95a65
Change slug to an environment variable
jdevalk Sep 16, 2025
4dc8220
Merge pull request #157 from ProgressPlanner/jdv/playground-blueprint
jdevalk Sep 16, 2025
70d560d
Merge pull request #156 from ProgressPlanner/filip/pp-compat
aristath Sep 17, 2025
cecc076
Change version to 2.1.5
aristath Sep 17, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/composer-diff.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
fetch-depth: 0 # Required to make it possible to compare with PR base branch

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/cs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v5

- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
php-version: '8.2'
coverage: none
tools: cs2pr

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
steps:
# Checkout the code
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v5
# Optional: if we add a build step to the plugin, we can run it here.
# Deploy the plugin to WordPress.org
- name: WordPress plugin deploy
Expand All @@ -20,7 +20,7 @@ jobs:
with:
generate-zip: true
env:
SLUG: yoast-comment-hacks
SLUG: ${{ secrets.DOT_ORG_SLUG }}
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
# After the deploy, we also want to create a zip and upload it to the release on Github. We don't want
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ jobs:
matrix:
# Lint against the highest/lowest supported versions of each PHP major.
# And also do a run against "nightly" (the current dev version of PHP).
php_version: ['7.4', '8.0', '8.1', '8.2']
php_version: ['8.2', '8.3', '8.4']

name: "Lint: PHP ${{ matrix.php_version }}"

steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v5

- name: Install PHP
uses: shivammathur/setup-php@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand Down
44 changes: 44 additions & 0 deletions .github/workflows/playground-merged.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Playground Comment

on:
pull_request:
types:
- closed

jobs:
if_merged:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
actions: read
steps:
- name: Prepare blueprint with artifact link
id: blueprint
run: |
set -euxo pipefail
ARTIFACT_URL="${{ github.server_url }}/${{ github.repository }}/archive/refs/heads/${{ github.event.repository.default_branch }}.zip"

# Use Node.js to parse, modify, and stringify the JSON
BLUEPRINT=$(node -e "
const fs = require('fs');
const blueprint = JSON.parse(fs.readFileSync('.wordpress-org/blueprints/playground.json', 'utf8'));
blueprint.plugins = blueprint.plugins.map(plugin =>
plugin === '${{ github.event.repository.name }}' ? '$ARTIFACT_URL' : plugin
);
console.log(JSON.stringify(blueprint));
")

# Base64 encode the blueprint
ENCODED_BLUEPRINT=$(echo -n "$BLUEPRINT" | base64 -w 0)

echo "blueprint=$ENCODED_BLUEPRINT" >> "$GITHUB_OUTPUT"

# Comment with a Playground link that installs from the artifact ZIP
- uses: mshick/add-pr-comment@v2
with:
message: |
**Test merged PR on Playground**
[Test this pull request on the Playground](https://playground.wordpress.net/#${{ steps.blueprint.outputs.blueprint }})
or [download the zip](${{ github.server_url }}/${{ github.repository }}/archive/refs/heads/${{ github.event.repository.default_branch }}.zip)
82 changes: 79 additions & 3 deletions .github/workflows/playground.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,89 @@ on:
pull_request:

jobs:
test:
playground:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
actions: read

steps:
- uses: actions/checkout@v4

# Prepare a folder named exactly like the repo as the plugin root.
# If the repo already has such a folder (common for WP plugins), use it.
# Otherwise, stage one and copy root files into it (excluding CI junk).
- name: Prepare plugin folder
id: prep
run: |
set -euxo pipefail
REPO="${{ github.event.repository.name }}"
if [ -d "$REPO" ]; then
# Plugin already lives in a subfolder named like the repo
echo "PKG_DIR=$REPO" >> "$GITHUB_OUTPUT"
else
# Create a clean staging dir to avoid copying into itself
STAGE="${REPO}-pkg"
mkdir -p "$STAGE/$REPO"
rsync -a \
--exclude='.git' \
--exclude='.github' \
--exclude='node_modules' \
--exclude="${STAGE}" \
./ "$STAGE/$REPO/"
echo "PKG_DIR=$STAGE/$REPO" >> "$GITHUB_OUTPUT"

fi

- name: Update plugin version with PR number
run: |
set -euxo pipefail
PLUGIN_FILE="${{ steps.prep.outputs.PKG_DIR }}/${{ github.event.repository.name }}.php"
PR_NUMBER="${{ github.event.number }}"

# Extract current version and add PR number
CURRENT_VERSION=$(grep -o "Version:[[:space:]]*[0-9.]*" "$PLUGIN_FILE" | sed 's/Version:[[:space:]]*//')
NEW_VERSION="${CURRENT_VERSION} - PR ${PR_NUMBER}"

# Replace the version line
sed -i "s/Version:[[:space:]]*[0-9.]*/Version: ${NEW_VERSION}/" "$PLUGIN_FILE"

- name: Prepare blueprint with artifact link
id: blueprint
run: |
set -euxo pipefail
ARTIFACT_URL="https://nightly.link/${{ github.repository }}/actions/runs/${{ github.run_id }}/${{ secrets.DOT_ORG_SLUG }}.zip"

# Use Node.js to parse, modify, and stringify the JSON
BLUEPRINT=$(node -e "
const fs = require('fs');
const blueprint = JSON.parse(fs.readFileSync('.wordpress-org/blueprints/playground.json', 'utf8'));
blueprint.plugins = blueprint.plugins.map(plugin =>
plugin === '${{ secrets.DOT_ORG_SLUG }}' ? '$ARTIFACT_URL' : plugin
);
console.log(JSON.stringify(blueprint));
")

# Base64 encode the blueprint
ENCODED_BLUEPRINT=$(echo -n "$BLUEPRINT" | base64 -w 0)

echo "blueprint=$ENCODED_BLUEPRINT" >> "$GITHUB_OUTPUT"

# Upload the FOLDER (not a .zip). The artifact service zips it for us,
# keeping the top-level folder name inside the archive.
- name: Upload plugin artifact
uses: actions/upload-artifact@v4
with:
name: ${{ secrets.DOT_ORG_SLUG }}
path: ${{ steps.prep.outputs.PKG_DIR }}
# Optional: faster uploads for already-compressed assets
compression-level: 0

# Comment with a Playground link that installs from the artifact ZIP
- uses: mshick/add-pr-comment@v2
with:
message: |
## WordPress Playground
You can easily [test this pull request on the WordPress Playground](https://playground.wordpress.net/#{"landingPage":"/wp-admin/","features":{"networking":true},"steps":[{"step":"defineWpConfigConsts","consts":{"IS_PLAYGROUND_PREVIEW":true}},{"step":"login","username":"admin","password":"password"},{"step":"installPlugin","pluginZipFile":{"resource":"url","url":"https://bypass-cors.altha.workers.dev/${{ github.server_url }}/${{ github.repository }}/archive/${{ github.sha }}.zip"},"options":{"activate":true}}]}), or [download the zip file](${{ github.server_url }}/${{ github.repository }}/archive/${{ github.sha }}.zip).
**Test on Playground**
[Test this pull request on the Playground](https://playground.wordpress.net/#${{ steps.blueprint.outputs.blueprint }})
or [download the zip](https://nightly.link/${{ github.repository }}/actions/runs/${{ github.run_id }}/${{ secrets.DOT_ORG_SLUG }}.zip)
2 changes: 1 addition & 1 deletion .github/workflows/security.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v5

# This action checks the `composer.lock` file against known security vulnerabilities in the dependencies.
# https://github.com/marketplace/actions/the-php-security-checker
Expand Down
20 changes: 8 additions & 12 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,18 @@ jobs:
strategy:
matrix:
include:
- php_version: '7.4'
wp_version: '6.2'
multisite: false

- php_version: '8.0'
wp_version: '6.2'
- php_version: '8.2'
wp_version: '6.6'
multisite: false

- php_version: '8.1'
wp_version: 'latest'
multisite: true

- php_version: '8.2'
wp_version: '6.4'
wp_version: '6.6'
multisite: true

- php_version: '8.4'
wp_version: 'latest'
multisite: false

name: "Integration Test: PHP ${{ matrix.php_version }} | WP ${{ matrix.wp_version }}${{ matrix.multisite == true && ' (+ ms)' || '' }}"

# Allow builds to fail on as-of-yet unreleased WordPress versions.
Expand All @@ -57,7 +53,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v5

- name: Install PHP
uses: shivammathur/setup-php@v2
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ phpcs.xml
.cache/phpcs.cache
phpunit.xml
.phpunit.result.cache

.php-cs-fixer.cache
16 changes: 16 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

$finder = ( new PhpCsFixer\Finder() )
->in( __DIR__ )
->exclude(
[
'tests/',
'vendor/',
'node_modules/',
]
);

$config = new PhpCsFixer\Config();
$config->setUnsupportedPhpVersionAllowed( true );

return $config->setRules( [] )->setFinder( $finder );
14 changes: 14 additions & 0 deletions .wordpress-org/blueprints/blueprint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"landingPage": "wp-admin/options-general.php?page=comment-experience",
"features": {
"networking": true
},
"plugins": [
"yoast-comment-hacks"
],
"steps": [
{
"step": "login"
}
]
}
14 changes: 14 additions & 0 deletions .wordpress-org/blueprints/playground.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"landingPage": "wp-admin/options-general.php?page=comment-experience",
"features": {
"networking": true
},
"plugins": [
"yoast-comment-hacks"
],
"steps": [
{
"step": "login"
}
]
}
2 changes: 1 addition & 1 deletion admin/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public function show_forward_status( $comment_text, $comment ): string {
return $comment_text;
}

$ch_forwarded = \get_comment_meta( (int) $comment->comment_ID, 'ch_forwarded' );
$ch_forwarded = \get_comment_meta( (int) $comment->comment_ID, 'ch_forwarded', false );
if ( $ch_forwarded ) {
/* translators: %s is replaced by the name you're forwarding to. */
$pre = '<div style="background: #fff;border: 1px solid #46b450;border-left-width: 4px;box-shadow: 0 1px 1px rgba(0,0,0,.04);margin: 5px 15px 2px 0;padding: 1px 12px 1px;"><p><strong>' . \sprintf( \esc_html__( 'This comment was forwarded to %s.', 'comment-hacks' ), \esc_html( $this->options['forward_name'] ) ) . '</strong></p></div>';
Expand Down
4 changes: 2 additions & 2 deletions admin/comment-parent.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ public function update_comment_parent() {
return; // There might be another reason for a comment to be updated.
}

if ( \defined( 'DOING_AJAX' ) && \DOING_AJAX === true ) {
if ( \function_exists( 'wp_doing_ajax' ) && \wp_doing_ajax() ) {
\check_ajax_referer( 'replyto-comment', '_ajax_nonce-replyto-comment' );
}

if ( ! \defined( 'DOING_AJAX' ) || \DOING_AJAX !== true ) {
if ( ! \function_exists( 'wp_doing_ajax' ) || ! \wp_doing_ajax() ) {
\check_admin_referer( 'update-comment_' . $comment_id );
}

Expand Down
2 changes: 1 addition & 1 deletion comment-hacks.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* @wordpress-plugin
* Plugin Name: Comment Experience
* Version: 2.1.4
* Version: 2.1.5
* Plugin URI: https://progressplanner.com/plugins/comment-experience/
* Description: Improve the comment experience on your site. Adds lots of features to make commenting easier and more engaging.
* Requires PHP: 7.4
Expand Down
Loading
Loading