Skip to content

Commit

Permalink
Merge pull request #4 from lloc/adds-plugin-check
Browse files Browse the repository at this point in the history
This adds the plugin check action to the plugin
  • Loading branch information
lloc authored Oct 8, 2024
2 parents 9c36d1a + 866b3da commit 3c10974
Show file tree
Hide file tree
Showing 7 changed files with 89 additions and 33 deletions.
1 change: 1 addition & 0 deletions .distignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/.wordpress-org
/.git
/.github
/bin
/reports
/tests
.distignore
Expand Down
22 changes: 22 additions & 0 deletions .github/workflows/plugin-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Plugin Check
on: # rebuild any PRs and main branch changes
pull_request:
push:
branches:
- master
- 'releases/*'

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Composer dependencies
run: composer install --no-dev --no-interaction --optimize-autoloader
- name: Build
run: composer run-script build
- name: Run plugin check
uses: wordpress/plugin-check-action@v1
with:
build-dir: './mslsselect'
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ phpunit.xml.bak
.idea/
vendor/
coverage/
mslsselect/
mslsselect.zip
69 changes: 40 additions & 29 deletions MslsSelect.php
Original file line number Diff line number Diff line change
@@ -1,31 +1,33 @@
<?php

/*
Plugin Name: MslsSelect
Requires Plugins: multisite-language-switcher
Plugin URI: https://github.com/lloc/MslsSelect
Description: Transforms the output of the Multisite Language Switcher to an HTML select
Version: 2.3.1
Author: Dennis Ploetner
Author URI: http://lloc.de/
*/

/*
Copyright 2014 Dennis Ploetner (email : [email protected])
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* MslsSelect
*
* @copyright Copyright (C) 2011-2024, Dennis Ploetner, [email protected]
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2 or later
* @wordpress-plugin
*
* Plugin Name: MslsSelect
* Requires Plugins: multisite-language-switcher
* Version: 2.3.2
* Plugin URI: https://wordpress.org/plugins/mslsselect/
* Description: Transforms the output of the Multisite Language Switcher to an HTML select
* Author: Dennis Ploetner
* Author URI: http://lloc.de/
* License: GPLv2 or later
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License, version 2, as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/

declare( strict_types=1 );

Expand All @@ -36,7 +38,7 @@
*/
class MslsSelect {

const VERSION = '2.3.1';
const VERSION = '2.3.2';

public function __construct() {
$options = get_option( 'msls' );
Expand Down Expand Up @@ -72,7 +74,16 @@ public static function init(): self {
* @return void
*/
public static function enqueue_scripts(): void {
wp_enqueue_script( 'mslsselect', plugins_url( '/js/mslsselect.min.js', __FILE__ ), [], self::VERSION, true );
wp_enqueue_script(
'mslsselect',
plugins_url( '/js/mslsselect.min.js', __FILE__ ),
array(),
self::VERSION,
array(
'in_footer' => true,
'strategy' => 'defer',
)
);
}

/**
Expand Down
12 changes: 12 additions & 0 deletions bin/git-release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash

PROJECT_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )"
PLUGIN_NAME="mslsselect"
BUILD_PATH="$PROJECT_ROOT/$PLUGIN_NAME"
ZIP_ARCHIVE="$PROJECT_ROOT/$PLUGIN_NAME.zip"

rm -f $ZIP_ARCHIVE
rm -rf $BUILD_PATH && mkdir $BUILD_PATH

rsync -arvp --exclude-from=$PROJECT_ROOT/.distignore $PROJECT_ROOT/ $BUILD_PATH/
cd $PROJECT_ROOT && zip -r $ZIP_ARCHIVE $PLUGIN_NAME
6 changes: 5 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@
"scripts": {
"test": "vendor/bin/phpunit",
"coverage": "php -d xdebug.mode=coverage vendor/bin/phpunit --coverage-html coverage",
"analyze": "vendor/bin/phpstan analyze"
"analyze": "vendor/bin/phpstan analyze",
"git-release": "bin/git-release.sh",
"build": [
"@git-release"
]
},
"config": {
"allow-plugins": {
Expand Down
10 changes: 7 additions & 3 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

Contributors: realloc
Donate link: http://www.greenpeace.org/international/
Tags: multilingual, multisite, language, switcher, international, localization, i18n, menu, select-box, html select
Tags: multilingual, multisite, language, switcher, select
Requires at least: 5.6
Tested up to: 6.5
Tested up to: 6.6
Requires PHP: 7.4
Stable tag: 2.3.1
Stable tag: 2.3.2
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand All @@ -26,6 +26,10 @@ But if you look for an **easy way** to change the output of the _Multisite Langu

== Changelog ==

= 2.3.2 =
* Plugin check action added
* Resulting errors addressed

= 2.3.1 =
* WordPress 6.5 tested
* "Requires Plugins" added
Expand Down

0 comments on commit 3c10974

Please sign in to comment.