Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
ed55b23
refurbish
pfefferle Oct 7, 2022
0b492e9
update composer settings
pfefferle Oct 10, 2022
56ac9fa
fix docker for M1 Processors
pfefferle Oct 10, 2022
c4f16d4
rename resource identifier
pfefferle Oct 10, 2022
5bf1388
Merge branch 'main' into refurbish
pfefferle May 1, 2023
6b139ea
fix PHPCS issue
pfefferle May 4, 2023
d87b8de
Merge branch 'main' into refurbish
pfefferle Nov 12, 2023
87e4c0b
Merge branch 'main' into refurbish
pfefferle May 21, 2024
de3cde4
Merge branch 'main' into refurbish
pfefferle Dec 20, 2024
fc2efb6
class-admin.php aktualisieren
pfefferle Aug 3, 2025
2e1df81
profile-settings.php aktualisieren
pfefferle Aug 3, 2025
aa4ac43
profile-settings.php aktualisieren
pfefferle Aug 3, 2025
30fa6c9
class-admin.php aktualisieren
pfefferle Aug 3, 2025
152a5f0
class-admin.php aktualisieren
pfefferle Aug 3, 2025
8aa56c9
profile-settings.php aktualisieren
pfefferle Aug 3, 2025
2f072db
class-admin.php aktualisieren
pfefferle Aug 3, 2025
db6bc4d
class-admin.php aktualisieren
pfefferle Aug 3, 2025
c3f5915
Improve user profile handling and WebFinger resource lookup
pfefferle Dec 7, 2025
b10617e
Merge branch 'main' into refurbish
pfefferle Dec 7, 2025
7f3356c
Migrate local dev to wp-env and remove Grunt/Docker
pfefferle Dec 7, 2025
2be56df
Merge branch 'refurbish' of https://github.com/pfefferle/wordpress-we…
pfefferle Dec 7, 2025
2162573
Refactor plugin path usage to use constants
pfefferle Dec 7, 2025
513af58
Move is_same_host function to global scope
pfefferle Dec 7, 2025
28c1f58
Update includes/class-user.php
pfefferle Dec 7, 2025
e25193e
Update includes/class-admin.php
pfefferle Dec 7, 2025
c89e131
Update includes/class-admin.php
pfefferle Dec 7, 2025
b5d943a
Improve input sanitization and deprecation notices
pfefferle Dec 7, 2025
7188a4b
Modernize testing infrastructure and fix coding standards
pfefferle Dec 8, 2025
78059f5
Add GitHub Actions for PHPCS and PHPUnit
pfefferle Dec 8, 2025
5402df0
Refactor and modernize codebase for PHP 7.2+
pfefferle Dec 8, 2025
2fb32cc
Fix PHPUnit 10 compatibility for tests
pfefferle Dec 8, 2025
2c92790
Remove composer.lock file
pfefferle Dec 8, 2025
a61255d
Add composer.lock to .gitignore
pfefferle Dec 8, 2025
bb69176
Pin PHPUnit to version 9.6 for WordPress test compatibility
pfefferle Dec 8, 2025
bd7a7ac
Pin PHPUnit to version 9.6 for WordPress test compatibility
pfefferle Dec 8, 2025
3ef1855
Merge branch 'refurbish' of https://github.com/pfefferle/wordpress-we…
pfefferle Dec 8, 2025
5bf08be
Add input hardening for URI parsing
pfefferle Dec 8, 2025
7691e58
Add security tests for URI input hardening
pfefferle Dec 8, 2025
e4abfc5
Add Site Health checks for WebFinger
pfefferle Dec 8, 2025
f93749e
Remove pot file
pfefferle Dec 8, 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
4 changes: 2 additions & 2 deletions .distignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
/vendor
/tests
/config
.wp-env.json
package.json
package-lock.json
composer.json
composer.lock
Gruntfile.js
push.sh
phpunit.xml
phpunit.xml.dist
phpcs.xml
readme.txt
.travis.yml
.distignore
.gitignore
Expand Down
36 changes: 36 additions & 0 deletions .github/workflows/phpcs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: PHP_CodeSniffer
on:
push:
branches:
- main
paths:
- '**/*.php'
- 'composer.json'
- 'composer.lock'
- 'phpunit.xml'
- 'phpcs.xml'
- '.github/workflows/phpcs.yml'
pull_request:
paths:
- '**/*.php'
- 'composer.json'
- 'composer.lock'
- 'phpunit.xml'
- 'phpcs.xml'
- '.github/workflows/phpcs.yml'
jobs:
phpcs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
coverage: none
tools: composer, cs2pr
- name: Install Composer dependencies for PHP
uses: ramsey/composer-install@v3
- name: Detect coding standard violations
run: ./vendor/bin/phpcs
67 changes: 67 additions & 0 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Unit Testing
on:
push:
branches:
- main
paths:
- '**/*.php'
- 'composer.json'
- 'composer.lock'
- 'phpunit.xml'
- 'phpcs.xml'
- '.github/workflows/phpunit.yml'
pull_request:
paths:
- '**/*.php'
- 'composer.json'
- 'composer.lock'
- 'phpunit.xml'
- 'phpcs.xml'
- '.github/workflows/phpunit.yml'
jobs:
phpunit:
runs-on: ubuntu-latest
services:
mysql:
image: mariadb:10.4
env:
MYSQL_ROOT_PASSWORD: root
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=10s --health-retries=10
strategy:
matrix:
php-versions: ['7.2', '8.3', '8.4']
include:
- wp-version: latest
- wp-version: '6.5'
php-versions: '7.2'
- wp-version: trunk
php-versions: '8.4'
steps:
- name: Install svn
run: |
sudo apt-get update
sudo apt-get install subversion
- name: Checkout
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
coverage: none
tools: composer, phpunit-polyfills
extensions: mysql

- name: Install Composer dependencies for PHP
uses: ramsey/composer-install@v3

- name: Setup Test Environment
run: bash bin/install-wp-tests.sh wordpress_test root root 127.0.0.1 ${{ matrix.wp-version }}

- name: Unit Testing
run: ./vendor/bin/phpunit
env:
PHP_VERSION: ${{ matrix.php-versions }}
WP_ENVIRONMENT_TYPE: production
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/node_modules/
/vendor/
composer.lock
package-lock.json
.DS_Store
.phpunit.result.cache
18 changes: 18 additions & 0 deletions .wp-env.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"core": null,
"plugins": [
"."
],
"port": 8686,
"testsPort": 8687,
"config": {
"WP_DEBUG": true,
"WP_DEBUG_LOG": true,
"WP_DEBUG_DISPLAY": true
},
"env": {
"tests": {
"port": 8687
}
}
}
28 changes: 0 additions & 28 deletions Gruntfile.js

This file was deleted.

98 changes: 79 additions & 19 deletions bin/install-wp-tests.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash

if [ $# -lt 3 ]; then
echo "usage: $0 <db-name> <db-user> <db-pass> [db-host] [wp-version]"
echo "usage: $0 <db-name> <db-user> <db-pass> [db-host] [wp-version] [skip-database-creation]"
exit 1
fi

Expand All @@ -10,9 +10,12 @@ DB_USER=$2
DB_PASS=$3
DB_HOST=${4-localhost}
WP_VERSION=${5-latest}
SKIP_DB_CREATE=${6-false}

WP_TESTS_DIR=${WP_TESTS_DIR-/tmp/wordpress-tests-lib}
WP_CORE_DIR=${WP_CORE_DIR-/tmp/wordpress/}
TMPDIR=${TMPDIR-/tmp}
TMPDIR=$(echo $TMPDIR | sed -e "s/\/$//")
WP_TESTS_DIR=${WP_TESTS_DIR-$TMPDIR/wordpress-tests-lib}
WP_CORE_DIR=${WP_CORE_DIR-$TMPDIR/wordpress/}

download() {
if [ `which curl` ]; then
Expand All @@ -22,8 +25,19 @@ download() {
fi
}

if [[ $WP_VERSION =~ [0-9]+\.[0-9]+(\.[0-9]+)? ]]; then
WP_TESTS_TAG="tags/$WP_VERSION"
if [[ $WP_VERSION =~ ^[0-9]+\.[0-9]+\-(beta|RC)[0-9]+$ ]]; then
WP_BRANCH=${WP_VERSION%\-*}
WP_TESTS_TAG="branches/$WP_BRANCH"

elif [[ $WP_VERSION =~ ^[0-9]+\.[0-9]+$ ]]; then
WP_TESTS_TAG="branches/$WP_VERSION"
elif [[ $WP_VERSION =~ [0-9]+\.[0-9]+\.[0-9]+ ]]; then
if [[ $WP_VERSION =~ [0-9]+\.[0-9]+\.[0] ]]; then
# version x.x.0 means the first release of the major version, so strip off the .0 and download version x.x
WP_TESTS_TAG="tags/${WP_VERSION%??}"
else
WP_TESTS_TAG="tags/$WP_VERSION"
fi
elif [[ $WP_VERSION == 'nightly' || $WP_VERSION == 'trunk' ]]; then
WP_TESTS_TAG="trunk"
else
Expand All @@ -37,7 +51,6 @@ else
fi
WP_TESTS_TAG="tags/$LATEST_VERSION"
fi

set -ex

install_wp() {
Expand All @@ -49,18 +62,34 @@ install_wp() {
mkdir -p $WP_CORE_DIR

if [[ $WP_VERSION == 'nightly' || $WP_VERSION == 'trunk' ]]; then
mkdir -p /tmp/wordpress-nightly
download https://wordpress.org/nightly-builds/wordpress-latest.zip /tmp/wordpress-nightly/wordpress-nightly.zip
unzip -q /tmp/wordpress-nightly/wordpress-nightly.zip -d /tmp/wordpress-nightly/
mv /tmp/wordpress-nightly/wordpress/* $WP_CORE_DIR
mkdir -p $TMPDIR/wordpress-nightly
download https://wordpress.org/nightly-builds/wordpress-latest.zip $TMPDIR/wordpress-nightly/wordpress-nightly.zip
unzip -q $TMPDIR/wordpress-nightly/wordpress-nightly.zip -d $TMPDIR/wordpress-nightly/
mv $TMPDIR/wordpress-nightly/wordpress/* $WP_CORE_DIR
else
if [ $WP_VERSION == 'latest' ]; then
local ARCHIVE_NAME='latest'
elif [[ $WP_VERSION =~ [0-9]+\.[0-9]+ ]]; then
# https serves multiple offers, whereas http serves single.
download https://api.wordpress.org/core/version-check/1.7/ $TMPDIR/wp-latest.json
if [[ $WP_VERSION =~ [0-9]+\.[0-9]+\.[0] ]]; then
# version x.x.0 means the first release of the major version, so strip off the .0 and download version x.x
LATEST_VERSION=${WP_VERSION%??}
else
# otherwise, scan the releases and get the most up to date minor version of the major release
local VERSION_ESCAPED=`echo $WP_VERSION | sed 's/\./\\\\./g'`
LATEST_VERSION=$(grep -o '"version":"'$VERSION_ESCAPED'[^"]*' $TMPDIR/wp-latest.json | sed 's/"version":"//' | head -1)
fi
if [[ -z "$LATEST_VERSION" ]]; then
local ARCHIVE_NAME="wordpress-$WP_VERSION"
else
local ARCHIVE_NAME="wordpress-$LATEST_VERSION"
fi
else
local ARCHIVE_NAME="wordpress-$WP_VERSION"
fi
download https://wordpress.org/${ARCHIVE_NAME}.tar.gz /tmp/wordpress.tar.gz
tar --strip-components=1 -zxmf /tmp/wordpress.tar.gz -C $WP_CORE_DIR
download https://wordpress.org/${ARCHIVE_NAME}.tar.gz $TMPDIR/wordpress.tar.gz
tar --strip-components=1 -zxmf $TMPDIR/wordpress.tar.gz -C $WP_CORE_DIR
fi

download https://raw.github.com/markoheijnen/wp-mysqli/master/db.php $WP_CORE_DIR/wp-content/db.php
Expand All @@ -69,7 +98,7 @@ install_wp() {
install_test_suite() {
# portable in-place argument for both GNU sed and Mac OSX sed
if [[ $(uname -s) == 'Darwin' ]]; then
local ioption='-i .bak'
local ioption='-i.bak'
else
local ioption='-i'
fi
Expand All @@ -78,14 +107,16 @@ install_test_suite() {
if [ ! -d $WP_TESTS_DIR ]; then
# set up testing suite
mkdir -p $WP_TESTS_DIR
svn co --quiet https://develop.svn.wordpress.org/${WP_TESTS_TAG}/tests/phpunit/includes/ $WP_TESTS_DIR/includes
svn co --quiet --ignore-externals https://develop.svn.wordpress.org/${WP_TESTS_TAG}/tests/phpunit/includes/ $WP_TESTS_DIR/includes
svn co --quiet --ignore-externals https://develop.svn.wordpress.org/${WP_TESTS_TAG}/tests/phpunit/data/ $WP_TESTS_DIR/data
fi

cd $WP_TESTS_DIR

if [ ! -f wp-tests-config.php ]; then
if [ ! -f "$WP_TESTS_DIR"/wp-tests-config.php ]; then
download https://develop.svn.wordpress.org/${WP_TESTS_TAG}/wp-tests-config-sample.php "$WP_TESTS_DIR"/wp-tests-config.php
sed $ioption "s:dirname( __FILE__ ) . '/src/':'$WP_CORE_DIR':" "$WP_TESTS_DIR"/wp-tests-config.php
# remove all forward slashes in the end
WP_CORE_DIR=$(echo $WP_CORE_DIR | sed "s:/\+$::")
sed $ioption "s:dirname( __FILE__ ) . '/src/':'$WP_CORE_DIR/':" "$WP_TESTS_DIR"/wp-tests-config.php
sed $ioption "s:__DIR__ . '/src/':'$WP_CORE_DIR/':" "$WP_TESTS_DIR"/wp-tests-config.php
sed $ioption "s/youremptytestdbnamehere/$DB_NAME/" "$WP_TESTS_DIR"/wp-tests-config.php
sed $ioption "s/yourusernamehere/$DB_USER/" "$WP_TESTS_DIR"/wp-tests-config.php
sed $ioption "s/yourpasswordhere/$DB_PASS/" "$WP_TESTS_DIR"/wp-tests-config.php
Expand All @@ -94,7 +125,29 @@ install_test_suite() {

}

recreate_db() {
shopt -s nocasematch
if [[ $1 =~ ^(y|yes)$ ]]
then
mysqladmin drop $DB_NAME -f --user="$DB_USER" --password="$DB_PASS"$EXTRA
create_db
echo "Recreated the database ($DB_NAME)."
else
echo "Leaving the existing database ($DB_NAME) in place."
fi
shopt -u nocasematch
}

create_db() {
mysqladmin create $DB_NAME --user="$DB_USER" --password="$DB_PASS"$EXTRA
}

install_db() {

if [ ${SKIP_DB_CREATE} = "true" ]; then
return 0
fi

# parse DB_HOST for port or socket references
local PARTS=(${DB_HOST//\:/ })
local DB_HOSTNAME=${PARTS[0]};
Expand All @@ -112,7 +165,14 @@ install_db() {
fi

# create database
mysqladmin create $DB_NAME --user="$DB_USER" --password="$DB_PASS"$EXTRA
if [ $(mysql --user="$DB_USER" --password="$DB_PASS" --execute='show databases;' | grep ^$DB_NAME$) ]
then
echo "Reinstalling will delete the existing test database ($DB_NAME)"
read -p 'Are you sure you want to proceed? [y/N]: ' DELETE_EXISTING_DB
recreate_db $DELETE_EXISTING_DB
else
create_db
fi
}

install_wp
Expand Down
15 changes: 11 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,17 @@
"homepage": "https://notiz.blog/"
}],
"require": {
"php": ">=5.6.0",
"php": ">=7.2",
"composer/installers": "~2.2"
},
"require-dev": {
"phpcompatibility/php-compatibility": "*",
"phpcompatibility/phpcompatibility-wp": "*",
"squizlabs/php_codesniffer": "3.*",
"wp-coding-standards/wpcs": "*",
"dealerdirect/phpcodesniffer-composer-installer": "^1.0.0"
"squizlabs/php_codesniffer": "^3.7",
"wp-coding-standards/wpcs": "^3.0",
"dealerdirect/phpcodesniffer-composer-installer": "^1.0.0",
"yoast/phpunit-polyfills": "^2.0",
"phpunit/phpunit": "^8.5 || ^9.6"
},
"extra": {
"installer-name": "webfinger"
Expand All @@ -26,5 +28,10 @@
"composer/installers": true,
"dealerdirect/phpcodesniffer-composer-installer": true
}
},
"scripts": {
"lint": "phpcs",
"lint:fix": "phpcbf",
"test": "phpunit"
}
}
Loading