Skip to content

Commit a1d8870

Browse files
authored
Merge branch 'main' into chore/assets-update-workflow
Signed-off-by: Dennis Ploetner <[email protected]>
2 parents 9495f92 + 54b2e7c commit a1d8870

File tree

13 files changed

+236
-172
lines changed

13 files changed

+236
-172
lines changed

.github/workflows/code-style.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ jobs:
99
- name: Composer dependencies
1010
run: composer install
1111
- name: Run Testsuite
12-
run: composer run-script cs
12+
run: composer run-script phpcs

.github/workflows/plugin-check.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@ jobs:
1717
- name: Run plugin check
1818
uses: wordpress/plugin-check-action@v1
1919
with:
20-
build-dir: './multisyde'
20+
build-dir: './multisyde'
21+
exclude-files: 'modules/**/patches/*.php'

.github/workflows/unit-tests.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,21 @@ name: Unit Tests
22
on: [push]
33
jobs:
44
unit-tests:
5+
name: Unit Tests (PHP ${{ matrix.php-version }})
56
runs-on: ubuntu-latest
7+
strategy:
8+
matrix:
9+
php-version: ['7.4', '8.3', '8.4']
610
steps:
711
- name: Checkout
812
uses: actions/checkout@v4
13+
- name: Setup PHP
14+
uses: shivammathur/setup-php@v2
15+
with:
16+
php-version: ${{ matrix.php-version }}
17+
tools: composer
18+
coverage: none
919
- name: Composer dependencies
10-
run: composer install
20+
run: composer install --no-interaction --no-progress --prefer-dist
1121
- name: PHPUnit Tests
1222
run: vendor/bin/phpunit

.phpcs.xml.dist

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<ruleset name="CS">
33
<description>PHPCS example</description>
44
<config name="testVersion" value="7.4-"/>
5+
<exclude-pattern>node_modules/*</exclude-pattern>
56
<exclude-pattern>vendor/*</exclude-pattern>
67

78
<arg value="ps"/>
@@ -10,10 +11,15 @@
1011
<arg name="extensions" value="php"/>
1112
<arg name="cache" value=".phpcs.cache"/>
1213

14+
<rule ref="PHPCompatibilityWP" />
15+
1316
<rule ref="WordPress">
1417
<!-- PSR4 -->
1518
<exclude name="WordPress.Files.FileName" />
1619
</rule>
1720
<rule ref="WordPress-Extra"/>
1821
<rule ref="WordPress-Docs"/>
22+
23+
<exclude-pattern>*/node_modules/*</exclude-pattern>
24+
<exclude-pattern>*/vendor/*</exclude-pattern>
1925
</ruleset>

composer.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,29 +35,30 @@
3535
"config": {
3636
"allow-plugins": {
3737
"dealerdirect/phpcodesniffer-composer-installer": true,
38-
"phpstan/extension-installer": true
38+
"phpstan/extension-installer": true,
39+
"lloc/composer-i18n-scripts": true
3940
}
4041
},
4142
"require-dev": {
4243
"wp-coding-standards/wpcs": "^3.0",
4344
"szepeviktor/phpstan-wordpress": "^2.0",
4445
"phpstan/extension-installer": "^1.4",
45-
"yoast/phpunit-polyfills": "^3.1",
4646
"phpunit/phpunit": "^9.6",
4747
"brain/monkey": "^2.0@dev",
48-
"phpstan/phpstan-mockery": "^2.0"
48+
"phpstan/phpstan-mockery": "^2.0",
49+
"lloc/composer-i18n-scripts": "^1.0",
50+
"phpcompatibility/phpcompatibility-wp": "^2.1"
4951
},
5052
"scripts": {
5153
"tests": "./vendor/bin/phpunit -c ./phpunit.xml.dist",
5254
"tests:coverage": "XDEBUG_MODE=coverage ./vendor/bin/phpunit -c ./phpunit.xml.dist --coverage-html ./tests/coverage",
53-
"cs": "./vendor/bin/phpcs .",
54-
"cs:fix": "./vendor/bin/phpcbf .",
55+
"phpcs": "vendor/bin/phpcs .",
56+
"phpcbf": "./vendor/bin/phpcbf .",
5557
"phpstan": "./vendor/bin/phpstan analyse --memory-limit=1G",
5658
"qa": [
5759
"@cs",
5860
"@phpstan"
5961
],
60-
"i18n:pot": "wp i18n make-pot . languages/multisyde.pot",
6162
"git-release": "bin/git-release.sh",
6263
"build": [
6364
"@composer install --no-dev",

modules/GetSiteBy/patches/40180.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ function get_site_by( $field, $value, $network_id = null ) {
5353
}
5454
break;
5555
case 'url':
56-
if ( 0 !== strpos( $value, 'http://' ) && 0 !== strpos( $value, 'https://' ) ) {
56+
if ( ! str_starts_with( $value, 'http://' ) && ! str_starts_with( $value, 'https://' ) ) {
5757
$value = 'http://' . $value;
5858
}
5959

@@ -90,7 +90,7 @@ function get_site_by( $field, $value, $network_id = null ) {
9090

9191
$args['number'] = 1;
9292

93-
if ( isset( $args['domain'] ) && substr( $args['domain'], 0, 4 ) === 'www.' ) {
93+
if ( isset( $args['domain'] ) && str_starts_with( $args['domain'], 'www.' ) ) {
9494
$bare = substr( $args['domain'], 4 );
9595

9696
$args['domain__in'] = array( $bare, $args['domain'] );

modules/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@ This plugin provides various improvements for WordPress multisite installations.
1414
| [Introduce `get_site_by()` function for multisite](./GetSiteBy/README.md) | Provides a utility function to retrieve a site object from the multisite network using a specific field such as ID, slug, domain, path, or full URL. This makes it easier to locate subsites without relying on raw SQL or manual loops. | [#40180](https://core.trac.wordpress.org/ticket/40180) |
1515
| [Last User login](./LastUserLogin/README.md) | This module enhances the Network Admin Users screen in WordPress Multisite by adding a “Last Login” column. It automatically records the timestamp each time a user logs in and displays it in a readable, timezone-aware format. | [#11](https://github.com/inpsyde/multisyde/issues/11) |
1616
| [Site Active Theme](./SiteActiveTheme/README.md) | Displays the active theme (and its version) for each site in the Network Admin > Sites dashboard. This makes it easy for network administrators to quickly audit which themes are used across the network. | [#56458](https://core.trac.wordpress.org/ticket/56458) |
17+
| [Permalink Cleanup](./PermalinkCleanup/README.md) | Automatically removes the `/blog` prefix from the main site's permalink structure in multisite installations to deliver cleaner primary site URLs. | [#24](https://github.com/inpsyde/multisyde/issues/24) |
1718

1819
_Made with ❤️ by [Syde](https://syde.com)._

modules/SiteActivePlugins/Feature.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ final class Feature implements LoadableFeature {
1818
const NOTICE_DEACTIVATION = 'bulk_deactivated';
1919

2020
const DEFAULT_MAX_SITES = 100;
21+
const FILTER_MAX_SITES = 'multisyde_site_active_plugins_max_sites';
2122

2223
/**
2324
* The active plugins in the sites in the network.
@@ -161,7 +162,7 @@ public function populate_active_plugins(): void {
161162
*
162163
* @param int $max_sites The maximum number of sites to show for each plugin.
163164
*/
164-
$max_sites = apply_filters( 'site_active_plugins_max_sites', self::DEFAULT_MAX_SITES );
165+
$max_sites = apply_filters( self::FILTER_MAX_SITES, self::DEFAULT_MAX_SITES );
165166
$site_ids = get_sites(
166167
array(
167168
'fields' => 'ids',

modules/SiteActivePlugins/tests/unit/TestFeature.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ public function test_populate_active_plugins_network_active(): void {
202202
public function test_populate_active_plugins_max_sites(): void {
203203
$max_sites = 5;
204204

205-
Filters\expectApplied( 'site_active_plugins_max_sites' )->once()->with( 100 )->andReturn( $max_sites );
205+
Filters\expectApplied( Feature::FILTER_MAX_SITES )->once()->with( 100 )->andReturn( $max_sites );
206206

207207
$args = array(
208208
'fields' => 'ids',

multisyde.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Plugin Name: MultiSyde
44
* Plugin URI: https://github.com/inpsyde/multisyde
55
* Description: A WordPress plugin that explores potential improvements for WordPress Multisite.
6-
* Version: 1.1.1
6+
* Version: 1.2.0
77
* Requires at least: 6.8
88
* Requires PHP: 7.4
99
* Author: Syde

0 commit comments

Comments
 (0)