From 274dbca4da491bb5e987ed600c50752af029760c Mon Sep 17 00:00:00 2001 From: Kevin Date: Mon, 5 Jun 2023 17:26:07 +0200 Subject: [PATCH] v 5.5.0 - Add github actions. - Fix if polylang is not totally configured. --- .github/.htaccess | 1 + .github/workflows/php.yml | 19 +++++++++++++++++++ wpuoptions.php | 14 +++++++++----- 3 files changed, 29 insertions(+), 5 deletions(-) create mode 100644 .github/.htaccess create mode 100644 .github/workflows/php.yml diff --git a/.github/.htaccess b/.github/.htaccess new file mode 100644 index 0000000..8d2f256 --- /dev/null +++ b/.github/.htaccess @@ -0,0 +1 @@ +deny from all diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml new file mode 100644 index 0000000..9ad9df7 --- /dev/null +++ b/.github/workflows/php.yml @@ -0,0 +1,19 @@ +name: PHP Lint + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + phplint: + + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: PHP Lint + uses: michaelw90/PHP-Lint@2.1.0 diff --git a/wpuoptions.php b/wpuoptions.php index cc2635c..4eef13b 100644 --- a/wpuoptions.php +++ b/wpuoptions.php @@ -4,10 +4,14 @@ Plugin Name: WPU Options Plugin URI: https://github.com/WordPressUtilities/wpuoptions Update URI: https://github.com/WordPressUtilities/wpuoptions -Version: 5.4.2 +Version: 5.5.0 Description: Friendly interface for website options Author: Darklg Author URI: http://darklg.me/ +Text Domain: wpuoptions +Domain Path: /lang +Requires at least: 6.0 +Requires PHP: 8.0 License: MIT License License URI: http://opensource.org/licenses/MIT */ @@ -24,7 +28,7 @@ class WPUOptions { private $main_url; private $options = array( 'plugin_name' => 'WPU Options', - 'plugin_version' => '5.4.2', + 'plugin_version' => '5.5.0', 'plugin_userlevel' => 'manage_categories', 'plugin_menutype' => 'admin.php', 'plugin_pageslug' => 'wpuoptions-settings' @@ -390,7 +394,7 @@ public function admin_export_page() { $box['tab'] = 'default'; } if ($box['tab'] == $tab_id && isset($boxes_with_fields[$box_id])) { - echo '

'; + echo '

'; } } echo ''; @@ -554,7 +558,7 @@ private function admin_form() { foreach ($this->boxes as $idbox => $box) { $box_tab = isset($box['tab']) ? $box['tab'] : 'default'; - $box_usercan = isset($box['current_user_can']) ? current_user_can($box['current_user_can']) : true; + $box_usercan = isset($box['current_user_can'])?current_user_can($box['current_user_can']): true; if ($box_tab != $this->current_tab || !$box_usercan) { continue; } @@ -1117,7 +1121,7 @@ public function get_current_admin_language() { $current_language = false; // Obtaining from Polylang - if (function_exists('pll_the_languages') && is_object($polylang)) { + if (function_exists('pll_the_languages') && is_object($polylang) && !is_null($polylang->pref_lang)) { $current_language_tmp = $polylang->pref_lang->slug; if ($current_language_tmp != 'all') { $current_language = $current_language_tmp;