Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
32 changes: 14 additions & 18 deletions .distignore
Original file line number Diff line number Diff line change
@@ -1,27 +1,23 @@
/.wordpress-org
/.git
/.github
/.idea
/mslsmenu
/bin
/reports
/tests
coverage.xml
.distignore
.gitattributes
.gitignore
.phpcs.cache
.phpcs.xml.dist
.phpstan.neon.dist
.phpunit.result.cache
.scrutinizer.yml
Changelog.md
/.git
/.github
/.idea
/.wordpress-org
/bin
/mslsmenu
/reports
/tests
/vendor
AGENTS.md
README.md
composer.lock
coverage.xml
mslsmenu.zip
package.json
package-lock.json
phpdoc.xml
.phpstan.neon.dist
.phpcs.cache
.phpcs.xml.dist
phpunit.xml
README.md
AGENTS.md
41 changes: 39 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,49 @@ jobs:
tag:
name: New tag
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
attestations: write
timeout-minutes: 70
steps:
- name: Checkout project
uses: actions/checkout@v1
uses: actions/checkout@v7
- name: Composer dependencies
run: composer install --no-dev --no-interaction --optimize-autoloader
- name: Composer build
run: composer run-script build
# "composer build" leaves the ready-to-ship distribution in ./mslsmenu
# (bin/git-release.sh rsyncs the repository through .distignore). This is the very
# same directory that plugin-check.yml validates, so what WordPress.org receives is
# what Plugin Check has seen.
- name: Verify the build directory
run: |
BUILD_DIR=mslsmenu
test -d "$BUILD_DIR" || { echo "::error::$BUILD_DIR was not created by composer build"; exit 1; }
for required in MslsMenu.php readme.txt LICENSE languages/default.pot; do
test -e "$BUILD_DIR/$required" || { echo "::error::$BUILD_DIR/$required is missing"; exit 1; }
done
# vendor/ only ever held composer/installers, a build-time composer plugin.
# MslsMenu.php never loads vendor/autoload.php, so nothing of it may be shipped.
for forbidden in vendor .git .github bin tests composer.lock phpunit.xml README.md AGENTS.md mslsmenu mslsmenu.zip; do
test ! -e "$BUILD_DIR/$forbidden" || { echo "::error::$BUILD_DIR/$forbidden must not be shipped"; exit 1; }
done
echo "Build directory holds $(find "$BUILD_DIR" -type f | wc -l) files."
- name: WordPress Plugin Deploy
uses: 10up/action-wordpress-plugin-deploy@master
uses: 10up/action-wordpress-plugin-deploy@stable
id: deploy
env:
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
SLUG: mslsmenu
# Deploy only the built distribution. Without this the action falls back to
# rsyncing the whole workspace through .distignore - a different artifact than
# the one Plugin Check verifies, and the reason the MSLS 3.0.0 release broke.
BUILD_DIR: mslsmenu
with:
generate-zip: true
- name: Attest build provenance
uses: johnbillion/action-wordpress-plugin-attestation@0.7.3
with:
zip-path: ${{ steps.deploy.outputs.zip-path }}
2 changes: 1 addition & 1 deletion .github/workflows/plugin-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v7
- name: Composer dependencies
run: composer install --no-dev --no-interaction --optimize-autoloader
- name: Build
Expand Down
15 changes: 0 additions & 15 deletions .scrutinizer.yml

This file was deleted.

13 changes: 7 additions & 6 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Repository Guidelines

## Project Structure & Module Organization
- `MslsMenu.php` is the WordPress bootstrap; add hooks here or split helpers into new subdirectories under `mslsmenu/` as needed.
- `mslsmenu/` mirrors the shipping bundle; keep source and bundle in sync before release.
- `languages/` stores translation assets; regenerate via `wp i18n make-pot` when strings move.
- `MslsMenu.php` is the whole plugin: bootstrap, hooks and the `MslsMenu` class. Add new code here; if it ever needs splitting, create a real source directory (for example `src/`) and register it in `.phpstan.neon.dist` — never under `mslsmenu/`.
- `mslsmenu/` and `mslsmenu.zip` are build output: generated by `bin/git-release.sh` and gitignored. Never edit or commit them; every `composer build` deletes the directory and recreates it from the repository root through `.distignore`.
- `languages/` stores translation assets; regenerate via `composer i18n:make-pot` (provided by `lloc/composer-i18n-scripts`) when strings move.
- `tests/` houses Pest specs with Brain Monkey shims in `tests/Pest.php`; colocate fixtures with their specs.
- `bin/` contains release tooling (`bin/git-release.sh`); prefer extending scripts over one-off commands.

Expand All @@ -14,7 +14,7 @@
- `composer phpcs` checks the WordPress coding standards and PHP 7.4 compatibility via `.phpcs.xml.dist`; `composer phpcbf` fixes what can be fixed automatically.
- `composer analyze` runs PHPStan (level 5) against `MslsMenu.php`; keep it passing before pushing.
- `composer pest:coverage` enables Xdebug coverage for pull request evidence.
- `composer build` triggers `bin/git-release.sh`, refreshing `mslsmenu/` and `mslsmenu.zip` for distribution.
- `composer build` runs `composer update --no-dev` and then `bin/git-release.sh`, recreating `mslsmenu/` and `mslsmenu.zip`. It strips your local dev dependencies — run `composer install` afterwards to get the tooling back.

## Coding Style & Naming Conventions
- Follow WordPress PHP standards: tabs for indentation, braces on new lines, no trailing commas.
Expand All @@ -33,5 +33,6 @@
- PRs should explain the problem, outline the fix, attach UI evidence when relevant, and confirm `composer qa` passes.

## Release Packaging Tips
- Bump the plugin header version in `MslsMenu.php` and sync the same value into `readme.txt` before building.
- Run `composer build`, inspect the refreshed `mslsmenu/` contents, and spot-check the generated `mslsmenu.zip` before tagging.
- Bump the plugin header version in `MslsMenu.php` and the `Stable tag` in `readme.txt` to the same value, and add the matching `= x.y.z =` entry to the `readme.txt` changelog. WordPress.org rejects the release if header and stable tag disagree.
- Run `composer build` locally only to inspect the result. The shipped artifact is built in CI: `.github/workflows/deploy.yml` runs the same `composer build`, verifies the contents and deploys them through `BUILD_DIR: mslsmenu`.
- Tag without a `v` prefix (`3.0.0`) and push the tag — that push is what triggers the deploy workflow.
2 changes: 1 addition & 1 deletion MslsMenu.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*
* Plugin Name: MslsMenu
* Requires Plugins: multisite-language-switcher
* Version: 2.5.1
* Version: 3.0.0
* Plugin URI: https://wordpress.org/plugins/mslsmenu/
* Description: Adds the Multisite Language Switcher to the primary-nav-menu
* Author: Dennis Ploetner
Expand Down
19 changes: 14 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,27 @@
MslsMenu
========

[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/lloc/MslsMenu/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/lloc/MslsMenu/?branch=master)
[![codecov](https://codecov.io/gh/lloc/MslsMenu/graph/badge.svg?token=902NM9H2BW)](https://codecov.io/gh/lloc/MslsMenu)

MslsMenu extends the Multisite Language Switcher by injecting a language picker into any registered WordPress navigation menu. Install it when you want users to toggle sites and languages without custom walkers.
MslsMenu extends the Multisite Language Switcher by appending its language links to the navigation menus of your choice. Use it when you want the switcher inside a nav menu without editing your theme or writing a custom walker.

Multisite Language Switcher has to be installed and active first — MslsMenu is an add-on and declares that through its `Requires Plugins` header.

## Install
- From WordPress: search for “MslsMenu” under Plugins → Add New and activate it.
- Manual: copy the `mslsmenu/` directory to `wp-content/plugins/` and activate the plugin.
- With Composer: `composer require wpackagist-plugin/mslsmenu`, with the [wpackagist](https://wpackagist.org) repository configured in your `composer.json`.
- Manual: unpack the release archive and copy the resulting `mslsmenu/` folder to `wp-content/plugins/`, then activate the plugin.

## Usage
- Head to Appearance → Menus, add the “MslsMenu” item to your chosen menu, and arrange it like any other menu entry.
- Configure Multisite Language Switcher as usual; MslsMenu reuses its site mappings automatically.
MslsMenu contributes no menu item, so there is nothing to place under Appearance → Menus. It hooks into `wp_nav_menu_items` and appends the switcher to whichever menus you point it at.

Open Settings → Multisite Language Switcher in the site you want to configure; MslsMenu adds its own “Menu Settings” section to that page.

- **Theme Location** — pick one or more registered theme locations. Every menu rendered at one of them receives the language links.
- **Display** — the link style: flag, description, or both.
- **Text/HTML before/after the list** and **before/after each item** — markup wrapped around the output, for example `<li class="msls-menu">` … `</li>` per item.

Everything else follows your Multisite Language Switcher configuration, including its “only with translation” setting.

## Develop
- `composer install` pulls dev tools (Pest, PHPStan, PHP_CodeSniffer, Brain Monkey).
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"homepage": "https://it.wordpress.org/plugins/mslsmenu/",
"require": {
"php": ">=7.4",
"composer/installers": "~1.9.0"
"composer/installers": "^2.3"
},
"require-dev": {
"pestphp/pest": "^1.22",
Expand Down
54 changes: 0 additions & 54 deletions languages/default.pot

This file was deleted.

7 changes: 6 additions & 1 deletion languages/index.php
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
<?php header( 'location: http://' . filter_input( INPUT_SERVER, 'HTTP_HOST', FILTER_SANITIZE_URL ) );
<?php
/**
* Silence is golden.
*
* @package mslsmenu
*/
19 changes: 19 additions & 0 deletions languages/mslsmenu-de_DE.l10n.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php
return array(
'domain' => null,
'plural-forms' => 'nplurals=2; plural=(n != 1);',
'language' => 'German (de_DE)',
'project-id-version' => 'MslsMenu 1.0',
'pot-creation-date' => '2015-05-04 17:04+0100',
'po-revision-date' => '2015-05-04 17:06+0100',
'x-generator' => 'Poedit 1.5.4',
'messages' => array(
'Menu Settings' => 'Menü-Einstellungen',
'Display' => 'Anzeige',
'Text/HTML before the list' => 'Text/HTML vor der Liste',
'Text/HTML after the list' => 'Text/HTML nach der Liste',
'Text/HTML before each item' => 'Text/HTML vor jedem Element',
'Text/HTML after each item' => 'Text/HTML nach jedem Element',
'-- empty --' => '-- leer --',
),
);
Binary file modified languages/mslsmenu-de_DE.mo
Binary file not shown.
65 changes: 45 additions & 20 deletions languages/mslsmenu-de_DE.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,58 +2,83 @@ msgid ""
msgstr ""
"Project-Id-Version: MslsMenu 1.0\n"
"Report-Msgid-Bugs-To: http://wordpress.org/tag/multisite-language-switcher\n"
"POT-Creation-Date: 2015-05-04 17:04+0100\n"
"PO-Revision-Date: 2015-05-04 17:06+0100\n"
"Last-Translator: Dennis Ploetner <dennis.ploetner@drivek.it>\n"
"Language-Team: Dennis Ploetner <re@lloc.de>\n"
"Language: German (de_DE)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"POT-Creation-Date: 2015-05-04 17:04+0100\n"
"PO-Revision-Date: 2015-05-04 17:06+0100\n"
"Language: German (de_DE)\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Poedit-SourceCharset: UTF-8\n"
"X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;"
"_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;_ex:1,2c;"
"esc_attr__;esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c\n"
"X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;_ex:1,2c;esc_attr__;esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c\n"
"X-Poedit-Basepath: .\n"
"X-Generator: Poedit 1.5.4\n"
"X-Poedit-SearchPath-0: .\n"
"X-Poedit-SearchPath-1: ..\n"

# @ msls
#: ../MslsMenu.php:90
#: MslsMenu.php:121
#: mslsmenu/MslsMenu.php:121
msgid "Menu Settings"
msgstr "Menü-Einstellungen"

#: ../MslsMenu.php:95
#: MslsMenu.php:134
#: mslsmenu/MslsMenu.php:134
msgid "Theme Location"
msgstr ""

# @ msls
#: ../MslsMenu.php:98
#: MslsMenu.php:138
#: mslsmenu/MslsMenu.php:138
msgid "Display"
msgstr "Anzeige"

# @ msls
#: ../MslsMenu.php:102
#: MslsMenu.php:143
#: mslsmenu/MslsMenu.php:143
msgid "Text/HTML before the list"
msgstr "Text/HTML vor der Liste"

# @ msls
#: ../MslsMenu.php:103
#: MslsMenu.php:144
#: mslsmenu/MslsMenu.php:144
msgid "Text/HTML after the list"
msgstr "Text/HTML nach der Liste"

# @ msls
#: ../MslsMenu.php:104
#: MslsMenu.php:145
#: mslsmenu/MslsMenu.php:145
msgid "Text/HTML before each item"
msgstr "Text/HTML vor jedem Element"

# @ msls
#: ../MslsMenu.php:105
#: MslsMenu.php:146
#: mslsmenu/MslsMenu.php:146
msgid "Text/HTML after each item"
msgstr "Text/HTML nach jedem Element"

#: ../MslsMenu.php:131
#: MslsMenu.php:165
#: mslsmenu/MslsMenu.php:165
msgid "-- empty --"
msgstr "-- leer --"

#. Plugin Name of the plugin
#: MslsMenu.php
msgid "MslsMenu"
msgstr ""

#. Plugin URI of the plugin
#: MslsMenu.php
msgid "https://wordpress.org/plugins/mslsmenu/"
msgstr ""

#. Description of the plugin
#: MslsMenu.php
msgid "Adds the Multisite Language Switcher to the primary-nav-menu"
msgstr ""

#. Author of the plugin
#: MslsMenu.php
msgid "Dennis Ploetner"
msgstr ""

#. Author URI of the plugin
#: MslsMenu.php
msgid "http://lloc.de/"
msgstr ""
Loading
Loading