Skip to content

Commit

Permalink
Merge branch 'master' into text-based-labels
Browse files Browse the repository at this point in the history
  • Loading branch information
lloc authored Nov 29, 2023
2 parents 9eb2921 + 44d50f4 commit 1f546f0
Show file tree
Hide file tree
Showing 670 changed files with 9,164 additions and 195,568 deletions.
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: [lloc]
8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: 2
updates:
- package-ecosystem: composer
directory: "/"
schedule:
interval: daily
time: "04:00"
open-pull-requests-limit: 10
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
npm install
npm run build
- name: WordPress Plugin Deploy
uses: 10up/action-wordpress-plugin-deploy@master
uses: 10up/action-wordpress-plugin-deploy@stable
env:
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
Expand Down
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
composer.lock
composer.phar
package-lock.json
vendor/
phpunit.xml.bak
.idea/
.phpunit.result.cache
coverage/
node_modules/
docs/.vuepress/dist/
vendor/
84 changes: 84 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,87 @@
## 2.6.0

* WordPress 6.4 tested
* Set PHP 7.4 as minimum requirement
* Set WordPress 5.6 as minimum requirement
* Blavatar fix

## 2.5.11

* CodeSniffer installed for compatibility check with PHP 8.1
* CSS/SVG Flags refreshed

## 2.5.10

* WordPress 6.3 tested
* Compatibility issue with PHP 8.1 regarding FILTER_SANITIZE_STRING

## 2.5.9

* Compatibility issue with E_NOTICE and PHPUnit 10

## 2.5.8

* Avoid notice on Appearance > Widgets admin page
* Language files reviewed
* Legacy tests removed

## 2.5.7

* Fix #192 MslsCustomColumn/MslsAdminIcon fatal error (props @nelgmo)

## 2.5.6

* Fix #184 - use type of post and not only request (props @arnowelzel)
* Adding filters for customizing the "hreflang" output in the page header (props @jacksoggetto)

## 2.5.5

* WordPress 6.0 tested
* Improvements in code quality

## 2.5.4

* Secondary buttons from MetaBoxes removed
* Flags refreshed
* Tested with 5.9
* Bugfix for request

## 2.4.12

* Flags regenerated (CSS and PNG)

## 2.4.11

### Bug fixes

* Content importer
* Flags regenerated (CSS and PNG)

## 2.4.10

### Features

* Filters added to control output of alternate url and blog-permalink url of blog-specific hreflang tags

## 2.4.9

### Bug fix

* Language codes of formal languages map now to the correct flag (de_DE_formal -> de, de_CH_formal -> ch, nl_NL_formal -> nl)

## 2.4.8

### Hotfix

* hotfix call to get_super_admin() is to early

## 2.4.7

### Bug fixes

* docs updated for the possibility to remove action for alternative output in hreflang
* admin bar output is now exclusive for super admins

## 2.4.6

### Bug fix
Expand Down
73 changes: 38 additions & 35 deletions MultisiteLanguageSwitcher.php
Original file line number Diff line number Diff line change
@@ -1,31 +1,34 @@
<?php

/*
Plugin Name: Multisite Language Switcher
Plugin URI: http://msls.co/
Description: A simple but powerful plugin that will help you to manage the relations of your contents in a multilingual multisite-installation.
Version: 2.4.6
Author: Dennis Ploetner
Author URI: http://lloc.de/
Text Domain: multisite-language-switcher
*/

/*
Copyright 2013 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
*/
/**
* Multisite Language Switcher Plugin
*
* @copyright Copyright (C) 2011-2022, 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: Multisite Language Switcher
* Version: 2.6.0
* Plugin URI: http://msls.co/
* Description: A simple but powerful plugin that will help you to manage the relations of your contents in a multilingual multisite-installation.
* Author: Dennis Ploetner
* Author URI: http://lloc.de/
* Text Domain: multisite-language-switcher
* Domain Path: /languages/
* 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
*/

if ( file_exists( __DIR__ . '/vendor/autoload.php' ) ) {
require __DIR__ . '/vendor/autoload.php';
Expand All @@ -37,7 +40,7 @@
* @author Dennis Ploetner <[email protected]>
*/
if ( ! defined( 'MSLS_PLUGIN_VERSION' ) ) {
define( 'MSLS_PLUGIN_VERSION', '2.4.6' );
define( 'MSLS_PLUGIN_VERSION', '2.6.0' );
define( 'MSLS_PLUGIN_PATH', plugin_basename( __FILE__ ) );
define( 'MSLS_PLUGIN__FILE__', __FILE__ );

Expand All @@ -48,11 +51,11 @@
*
* @package Msls
*
* @param array $attr
* @param mixed $attr
*
* @return string
*/
function get_the_msls( $attr ) {
function get_the_msls( $attr ): string {
$arr = is_array( $attr ) ? $attr : [];
$obj = apply_filters( 'msls_get_output', null );

Expand All @@ -74,9 +77,9 @@ function get_the_msls( $attr ) {
* @package Msls
* @uses get_the_msls
*
* @param array $arr
* @param string[] $arr
*/
function the_msls( array $arr = [] ) {
function the_msls( array $arr = [] ): void {
echo get_the_msls( $arr );
}

Expand All @@ -87,7 +90,7 @@ function the_msls( array $arr = [] ) {
*
* @return string
*/
function get_msls_flag_url( $locale ) {
function get_msls_flag_url( string $locale ): string {
return ( new \lloc\Msls\MslsOptions )->get_flag_url( $locale );
}

Expand All @@ -96,9 +99,9 @@ function get_msls_flag_url( $locale ) {
*
* @param string $locale
*
* @return bool|string
* @return string
*/
function get_msls_blog_description( $locale ) {
function get_msls_blog_description( string $locale ): string {
$blog = \lloc\Msls\MslsBlogCollection::instance()->get_blog( $locale );

return $blog->get_description();
Expand Down
117 changes: 60 additions & 57 deletions bin/flags-png.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*
* Prepare with:
*
* `wget http://api.wordpress.org/translations/core/1.0/ -o ./build/translations.json`
* `wget http://api.wordpress.org/translations/core/1.0/ -O ./build/translations.json`
*
* Copyright 2013 Dennis Ploetner (email : [email protected])
*
Expand All @@ -27,61 +27,64 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
$content = file_get_contents( 'build/translations.json' );
$json = json_decode( $content );
$glob = glob( 'flags/*.png' );
$content = file_get_contents( 'build/translations.json' );
$json = json_decode( $content );
$glob = glob( 'flags/*.png' );
$icons = $not_found = [];
$exceptions = [
'ca' => 'catalonia.png',
'eo' => 'europeanunion.png',
'cy' => 'wales.png',
'gd' => 'scotland.png',
'ar' => 'arableague.png',
'af' => 'za.png',
'el' => 'gr.png',
'et' => 'ee.png',
'ja' => 'jp.png',
'uk' => 'ua.png',
'as' => 'in.png',
'az' => 'az.png',
'bo' => 'cn.png',
'eu' => 'es.png',
'fi' => 'fi.png',
'gu' => 'in.png',
'hr' => 'hr.png',
'hy' => 'am.png',
'kk' => 'kz.png',
'km' => 'kh.png',
'lo' => 'la.png',
'lv' => 'lv.png',
'mn' => 'mn.png',
'mr' => 'in.png',
'ps' => 'af.png',
'sq' => 'al.png',
'te' => 'in.png',
'th' => 'th.png',
'tl' => 'ph.png',
'ur' => 'pk.png',
'vi' => 'vn.png',
'ary' => 'ma.png',
'azb' => 'az.png',
'bel' => 'by.png',
'ceb' => 'ph.png',
'dzo' => 'bt.png',
'fur' => 'it.png',
'haz' => 'af.png',
'kab' => 'dz.png',
'ckb' => 'iq.png',
'oci' => 'catalonia.png',
'rhg' => '', // Rohingya
'sah' => 'ru.png',
'skr' => 'pk.png',
'sql' => 'al.png',
'szl' => 'pl.png',
'tah' => 'pf.png',
'ca' => 'catalonia.png',
'eo' => 'europeanunion.png',
'cy' => 'wales.png',
'gd' => 'scotland.png',
'ar' => 'arableague.png',
'af' => 'za.png',
'el' => 'gr.png',
'et' => 'ee.png',
'ja' => 'jp.png',
'uk' => 'ua.png',
'as' => 'in.png',
'az' => 'az.png',
'bo' => 'cn.png',
'eu' => 'es.png',
'fi' => 'fi.png',
'gu' => 'in.png',
'hr' => 'hr.png',
'hy' => 'am.png',
'kk' => 'kz.png',
'km' => 'kh.png',
'lo' => 'la.png',
'lv' => 'lv.png',
'mn' => 'mn.png',
'mr' => 'in.png',
'ps' => 'af.png',
'sq' => 'al.png',
'te' => 'in.png',
'th' => 'th.png',
'tl' => 'ph.png',
'ur' => 'pk.png',
'vi' => 'vn.png',
'ary' => 'ma.png',
'azb' => 'az.png',
'bel' => 'by.png',
'ceb' => 'ph.png',
'dzo' => 'bt.png',
'fur' => 'it.png',
'haz' => 'af.png',
'kab' => 'dz.png',
'ckb' => 'iq.png',
'oci' => 'catalonia.png',
'rhg' => '', // Rohingya
'sah' => 'ru.png',
'skr' => 'pk.png',
'sql' => 'al.png',
'szl' => 'pl.png',
'tah' => 'pf.png',
'es_EC' => 'ec.png',
'de_CH_informal' => 'ch.png',
'de_DE_formal' => 'de.png',
'nl_NL_formal' => 'nl.png',
];

$icons = $not_found = [];

echo '<?php', PHP_EOL, PHP_EOL;

if ( isset( $json->translations ) ) {
Expand All @@ -94,7 +97,7 @@
if ( isset( $exceptions[ $item->language ] ) ) {
$icons[ $item->language ] = $exceptions[ $item->language ];
} elseif ( 5 <= strlen( $item->language ) ) {
$icons[ $item->language ] = strtolower( substr( $item->language, -2 ) ) . '.png';
$icons[ $item->language ] = strtolower( substr( $item->language, - 2 ) ) . '.png';
} else {
printf( "// Unhandled language: %s (%s)\n", $item->language, $item->english_name );
}
Expand All @@ -103,13 +106,13 @@

echo 'return $flags = [', PHP_EOL;

foreach ( array_filter ( $icons ) as $key => $value ) {
foreach ( array_filter( $icons ) as $key => $value ) {
$needle = "flags/{$value}";
$index = array_search( $needle, $glob );
if ( $index !== false ) {
unset( $glob[ $index ] );
}
echo sprintf(" '%s' => '%s',", $key, $value ), PHP_EOL;
echo sprintf( " '%s' => '%s',", $key, $value ), PHP_EOL;
}

echo '];', PHP_EOL, PHP_EOL;
Expand All @@ -118,7 +121,7 @@
if ( $count > 0 ) {
echo '/**', PHP_EOL, " * {$count} unused icons in flags/", PHP_EOL, ' * ', PHP_EOL;

array_walk( $glob, function( &$item ) {
array_walk( $glob, function ( &$item ) {
$item = substr( $item, 6 );
} );

Expand Down
Loading

0 comments on commit 1f546f0

Please sign in to comment.