-
-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into text-based-labels
- Loading branch information
Showing
670 changed files
with
9,164 additions
and
195,568 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
github: [lloc] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'; | ||
|
@@ -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__ ); | ||
|
||
|
@@ -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 ); | ||
|
||
|
@@ -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 ); | ||
} | ||
|
||
|
@@ -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 ); | ||
} | ||
|
||
|
@@ -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(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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]) | ||
* | ||
|
@@ -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 ) ) { | ||
|
@@ -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 ); | ||
} | ||
|
@@ -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; | ||
|
@@ -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 ); | ||
} ); | ||
|
||
|
Oops, something went wrong.