diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 78e5c8f..9ff0f4b 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -2,11 +2,21 @@ name: Unit Tests on: [push] jobs: unit-tests: + name: Unit Tests (PHP ${{ matrix.php-version }}) runs-on: ubuntu-latest + strategy: + matrix: + php-version: ['7.4', '8.3', '8.4'] steps: - name: Checkout uses: actions/checkout@v4 + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-version }} + tools: composer + coverage: none - name: Composer dependencies - run: composer install + run: composer install --no-interaction --no-progress --prefer-dist - name: PHPUnit Tests run: vendor/bin/phpunit diff --git a/.phpcs.xml.dist b/.phpcs.xml.dist index 94d0411..c0809bc 100644 --- a/.phpcs.xml.dist +++ b/.phpcs.xml.dist @@ -2,6 +2,7 @@ PHPCS example + node_modules/* vendor/* diff --git a/composer.json b/composer.json index 6f90d52..f20924b 100644 --- a/composer.json +++ b/composer.json @@ -42,7 +42,6 @@ "wp-coding-standards/wpcs": "^3.0", "szepeviktor/phpstan-wordpress": "^2.0", "phpstan/extension-installer": "^1.4", - "yoast/phpunit-polyfills": "^3.1", "phpunit/phpunit": "^9.6", "brain/monkey": "^2.0@dev", "phpstan/phpstan-mockery": "^2.0" diff --git a/modules/README.md b/modules/README.md index 79f20e7..8bb2642 100644 --- a/modules/README.md +++ b/modules/README.md @@ -14,5 +14,6 @@ This plugin provides various improvements for WordPress multisite installations. | [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) | | [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) | | [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) | +| [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) | _Made with ❤️ by [Syde](https://syde.com)._ diff --git a/multisyde.php b/multisyde.php index caeb1f4..a443085 100644 --- a/multisyde.php +++ b/multisyde.php @@ -3,7 +3,7 @@ * Plugin Name: MultiSyde * Plugin URI: https://github.com/inpsyde/multisyde * Description: A WordPress plugin that explores potential improvements for WordPress Multisite. - * Version: 1.1.1 + * Version: 1.2.0 * Requires at least: 6.8 * Requires PHP: 7.4 * Author: Syde diff --git a/readme.txt b/readme.txt index 0fa26d3..5dd08b9 100644 --- a/readme.txt +++ b/readme.txt @@ -5,7 +5,7 @@ Tags: multisite, network admin, enhancements, usability, admin tools Requires at least: 6.8 Tested up to: 6.8 Requires PHP: 7.4 -Stable tag: 1.1.1 +Stable tag: 1.2.0 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -29,6 +29,8 @@ MultiSyde follows a modular architecture where each feature addresses specific p **Site Active Theme** - Displays the active theme for each site in the Network Admin dashboard, making it easier to manage themes across the network (addresses Trac [#56458](https://core.trac.wordpress.org/ticket/56458/ "WordPress Trac Ticket #56458")) +**Permalink Cleanup** - Automatically removes the `/blog` prefix from the main site's permalink structure in multisite networks for cleaner URLs (addresses GitHub issue [#24](https://github.com/inpsyde/multisyde/issues/24 "MultiSyde GitHub Issue #24")) + The feature set continues to expand based on community contributions and real-world needs. == Installation == @@ -136,6 +138,9 @@ Update for the latest enhancements and improvements. MultiSyde evolves continuou == Changelog == += 1.2.0 = +* Enhancement: Added [Permalink Cleanup](https://github.com/inpsyde/multisyde/blob/main/modules/PermalinkCleanup/README.md "MultiSyde Permalink Cleanup Module") to automatically remove the `/blog` prefix from the main site's permalink structure in multisite networks. + = 1.1.1 = * MultiSyde is now network-wide activatable only. diff --git a/tests/php/unit/bootstrap.php b/tests/php/unit/bootstrap.php index 5880663..6ce1957 100644 --- a/tests/php/unit/bootstrap.php +++ b/tests/php/unit/bootstrap.php @@ -6,3 +6,25 @@ * * @package multisyde-unit-tests */ + +if ( ! function_exists( 'str_starts_with' ) ) { + /** + * Polyfill for `str_starts_with()` function added in PHP 8.0. + * + * Performs a case-sensitive check indicating if + * the haystack begins with needle. + * + * @since 5.9.0 + * + * @param string $haystack The string to search in. + * @param string $needle The substring to search for in the `$haystack`. + * @return bool True if `$haystack` starts with `$needle`, otherwise false. + */ + function str_starts_with( $haystack, $needle ) { + if ( '' === $needle ) { + return true; + } + + return 0 === strpos( $haystack, $needle ); + } +}