From 1a1dc2de857eff0287dab23cc5c25f1ce5c53b6c Mon Sep 17 00:00:00 2001 From: Felipe Date: Tue, 14 May 2019 10:29:45 +0200 Subject: [PATCH 1/5] Adapt languages command to latest Polylang plugin --- PolylangHelperFunctions.php | 13 ++++--------- Polylang_Command.php | 2 +- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/PolylangHelperFunctions.php b/PolylangHelperFunctions.php index 37a7573..41a733d 100644 --- a/PolylangHelperFunctions.php +++ b/PolylangHelperFunctions.php @@ -34,16 +34,11 @@ function pll_get_languages_list () { */ function pll_get_default_language_information($language_code) { global $polylang; - require(PLL_ADMIN_INC.'/languages.php'); + require(PLL_SETTINGS_INC.'/languages.php'); foreach ($languages as $language) { - if ($language[0] == $language_code || $language[1] == $language_code) { - $rtl = (count($language) > 3) && ($language[3] == 'rtl'); - return array( - 'code' => $language[0], - 'locale' => $language[1], - 'name' => $language[2], - 'rtl' => $rtl - ); + if ( isset($language['code']) && $language['code'] == $language_code + || isset($language['locale']) && $language['locale'] == $language_code) { + return $language; } } return null; diff --git a/Polylang_Command.php b/Polylang_Command.php index 12ab4d0..468f477 100644 --- a/Polylang_Command.php +++ b/Polylang_Command.php @@ -150,7 +150,7 @@ function language ($args, $assocArgs) { WP_CLI::line('Code: ' . $language_info['code']); WP_CLI::line('Locale ' . $language_info['locale']); WP_CLI::line('Name: ' . $language_info['name']); - WP_CLI::line('RTL: ' . ($language_info['rtl'] ? 'yes' : 'no')); + WP_CLI::line('Dir: ' . $language_info['dir']); WP_CLI::line('Installed: ' . ($language_installed ? 'yes' : 'no')); break; From 3908755dcc18618992f2a9cd6410dd40e9447b08 Mon Sep 17 00:00:00 2001 From: Felipe Date: Tue, 14 May 2019 10:37:12 +0200 Subject: [PATCH 2/5] Remove empty @synopsis causing warnings --- Polylang_Command.php | 1 - 1 file changed, 1 deletion(-) diff --git a/Polylang_Command.php b/Polylang_Command.php index 468f477..6666cd8 100644 --- a/Polylang_Command.php +++ b/Polylang_Command.php @@ -30,7 +30,6 @@ class Polylang_Command extends WP_CLI_Command { * * wp polylang languages * - * @synopsis * @alias langs */ function languages ($args, $assocArgs) { From c03e09b4b3224fdc6e927f3d7f2dc1e4c1771d5e Mon Sep 17 00:00:00 2001 From: Felipe Date: Tue, 14 May 2019 11:11:14 +0200 Subject: [PATCH 3/5] Fix Add command causing PHP warnings --- PolylangHelperFunctions.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/PolylangHelperFunctions.php b/PolylangHelperFunctions.php index 41a733d..31c9aea 100644 --- a/PolylangHelperFunctions.php +++ b/PolylangHelperFunctions.php @@ -70,11 +70,11 @@ function pll_add_language($language_code, $language_order = 0, &$error_code = 0) $info = pll_get_default_language_information($language_code); $args = array( - name => $info['name'], - slug => $info['code'], - locale => $info['locale'], - rtl => $info['rtl'] ? 1 : 0, - term_group => $language_order + 'name' => $info['name'], + 'slug' => $info['code'], + 'locale' => $info['locale'], + 'rtl' => ($info['dir'] == 'rtl' ? 1 : 0), + 'term_group' => $language_order ); $error_code = $adminModel->add_language($args); return $error_code !== 0; From 42f9f5132015d82119abbbb95e9506cb27135c61 Mon Sep 17 00:00:00 2001 From: Felipe Date: Tue, 14 May 2019 11:16:16 +0200 Subject: [PATCH 4/5] Add Superhuit as author to plugin --- composer.json | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 7eff6d7..7f454c4 100644 --- a/composer.json +++ b/composer.json @@ -9,12 +9,20 @@ ], "homepage": "https://github.com/dereckson/wp-cli-polylang", "license": "GPLv2", - "authors": [{ + "authors": [ + { "name": "Sébastien Santoro aka Dereckson", "email": "dereckson@espace-win.org", "homepage": "http://www.dereckson.be", "role": "Developer" - }], + }, + { + "name": "Superhuit", + "email": "tech@superhuit.ch", + "homepage": "https://superhuit.ch", + "role": "Developer" + } + ], "require": { "php": ">=5.3.0" }, From bd15657c2d6880e609f00078b26715998c910373 Mon Sep 17 00:00:00 2001 From: Felipe Date: Tue, 14 May 2019 11:34:58 +0200 Subject: [PATCH 5/5] set composer name to superhuit --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 7f454c4..18c9b69 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "dereckson/wp-cli-polylang", + "name": "superhuit-ch/wp-cli-polylang", "type": "wp-cli-package", "description": "Add a `wp polylang` command to support the Polylang plug-in", "keywords": [