From 147b5050bbd6a299f237d1a09455723fa2f95ce1 Mon Sep 17 00:00:00 2001 From: Kevin Date: Tue, 5 Dec 2023 13:33:34 +0100 Subject: [PATCH] v 2.23.0 - Fix for invalid taxo meta. - https for schema.org. - Add eslint github action. - Update base update dependency. --- .eslintrc.json | 23 +++++++++++++++++++++++ .github/workflows/js.yml | 17 +++++++++++++++++ README.md | 2 ++ assets/cookies.js | 2 +- inc/WPUBaseUpdate/WPUBaseUpdate.php | 5 ++++- wpuseo.php | 17 ++++++++++------- 6 files changed, 57 insertions(+), 9 deletions(-) create mode 100644 .eslintrc.json create mode 100644 .github/workflows/js.yml diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000..3a8ab97 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,23 @@ +{ + "env": { + "browser": true, + "es2021": true + }, + "extends": "eslint:recommended", + "parserOptions": { + "ecmaVersion": "latest" + }, + "rules": { + "no-prototype-builtins": 0 + }, + "globals": { + "wpuseo_options": true, + "wp": true, + "jQuery": true, + "wpuseo_getcookie": true, + "wpuseo_obj": true, + "wpuseo_init_analytics": true, + "wpuseo_init_fbpixel": true, + "wpuseo_init_custom_tracking": true + } +} diff --git a/.github/workflows/js.yml b/.github/workflows/js.yml new file mode 100644 index 0000000..03f7180 --- /dev/null +++ b/.github/workflows/js.yml @@ -0,0 +1,17 @@ +name: ESLint + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Install modules + run: npm install -g eslint + - name: Run ESLint + run: eslint assets/ --ext .js diff --git a/README.md b/README.md index 27a8664..9da0820 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,6 @@ WPU SEO ======= +[![JS workflow](https://github.com/WordPressUtilities/wpuseo/actions/workflows/js.yml/badge.svg 'JS workflow')](https://github.com/WordPressUtilities/wpuseo/actions) [![PHP workflow](https://github.com/WordPressUtilities/wpuseo}/actions/workflows/php.yml/badge.svg 'PHP workflow')](https://github.com/WordPressUtilities/wpuseo/actions) + Enhance SEO : Clean title, nice metas. diff --git a/assets/cookies.js b/assets/cookies.js index 016b9ad..9477181 100644 --- a/assets/cookies.js +++ b/assets/cookies.js @@ -14,7 +14,7 @@ function wpuseo_setcookie(cname, cvalue, exdays) { Display Cookie notice ---------------------------------------------------------- */ -jQuery(document).ready(function wpuseo_cookienotice($) { +jQuery(document).ready(function wpuseo_cookienotice() { /* Cookies are not needed */ if (typeof wpuseo_getcookie == 'undefined') { return; diff --git a/inc/WPUBaseUpdate/WPUBaseUpdate.php b/inc/WPUBaseUpdate/WPUBaseUpdate.php index 712aba9..078f104 100644 --- a/inc/WPUBaseUpdate/WPUBaseUpdate.php +++ b/inc/WPUBaseUpdate/WPUBaseUpdate.php @@ -4,7 +4,7 @@ /* Class Name: WPU Base Update Description: A class to handle plugin update from github -Version: 0.4.3 +Version: 0.4.4 Class URI: https://github.com/WordPressUtilities/wpubaseplugin Author: Darklg Author URI: https://darklg.me/ @@ -126,6 +126,9 @@ public function get_new_plugin_info() { /* Fetch plugin data */ $plugin_data = array(); if (file_exists($this->plugin_dir)) { + if (!function_exists('get_plugin_data')) { + require_once ABSPATH . 'wp-admin/includes/plugin.php'; + } $plugin_data = get_plugin_data($this->plugin_dir); } diff --git a/wpuseo.php b/wpuseo.php index 4a147e9..90b057f 100644 --- a/wpuseo.php +++ b/wpuseo.php @@ -5,12 +5,12 @@ Plugin URI: https://github.com/WordPressUtilities/wpuseo Update URI: https://github.com/WordPressUtilities/wpuseo Description: Enhance SEO : Clean title, Nice metas, GDPR friendly Analytics. -Version: 2.22.0 +Version: 2.23.0 Author: Darklg Author URI: https://darklg.me/ Text Domain: wpuseo Domain Path: /lang -Requires at least: 6.0 +Requires at least: 6.2 Requires PHP: 8.0 License: MIT License License URI: https://opensource.org/licenses/MIT @@ -19,7 +19,7 @@ class WPUSEO { - public $plugin_version = '2.22.0'; + public $plugin_version = '2.23.0'; private $active_wp_title = true; private $active_metas = true; private $fake_txt_files = array('ads', 'robots'); @@ -886,6 +886,9 @@ public function add_user_fields($fields) { public function get_taxo_meta($type) { global $q_config; $queried_object = $this->get_queried_object(); + if (!$queried_object || !is_object($queried_object)) { + return ''; + } $term_id = $queried_object->term_id; $metas = array(); @@ -1715,7 +1718,7 @@ public function add_metas() { public function set_metas_ld_json($metas, $metas_json) { - $metas_json = array_merge(array("@context" => "http://schema.org"), $metas_json); + $metas_json = array_merge(array("@context" => "https://schema.org"), $metas_json); if (!empty($metas['description'])) { $metas_json['description'] = $metas['description']['content']; @@ -1817,13 +1820,13 @@ function cookie_notice_flag_deprecated_alert() { error_log('The “WPUSEO - Cookie Notice” feature, the Google Analytics, FB Pixel codes and custom JS code will be totally removed in a future version.'); } - if(get_option('wputh_ua_analytics')){ + if (get_option('wputh_ua_analytics')) { _deprecated_function('wputh_ua_analytics', '2.22.0', $replace_by); } - if(get_option('wputh_fb_pixel')){ + if (get_option('wputh_fb_pixel')) { _deprecated_function('wputh_fb_pixel', '2.22.0', $replace_by); } - if(get_option('wputh_custom_tracking_code')){ + if (get_option('wputh_custom_tracking_code')) { _deprecated_function('wputh_custom_tracking_code', '2.22.0', $replace_by); } }