diff --git a/.github/workflows/composer-diff.yml b/.github/workflows/composer-diff.yml
index 295b538..439fd2f 100644
--- a/.github/workflows/composer-diff.yml
+++ b/.github/workflows/composer-diff.yml
@@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
- uses: actions/checkout
+ uses: actions/checkout@v4
with:
fetch-depth: 0 # Required to make it possible to compare with PR base branch
diff --git a/composer.json b/composer.json
index fc2ccfd..a9c02bf 100644
--- a/composer.json
+++ b/composer.json
@@ -9,6 +9,7 @@
"email": "joost@joost.blog"
}
],
+ "minimum-stability": "dev",
"require-dev": {
"wp-coding-standards/wpcs": "^3.0",
"phpcompatibility/phpcompatibility-wp": "*",
@@ -16,7 +17,8 @@
"yoast/wp-test-utils": "^1.2",
"phpstan/phpstan": "^1.10",
"szepeviktor/phpstan-wordpress": "^1.3",
- "phpstan/extension-installer": "^1.3"
+ "phpstan/extension-installer": "^1.3",
+ "phpcompatibility/php-compatibility": "dev-develop as 9.99.99"
},
"scripts": {
"check-cs": [
diff --git a/composer.lock b/composer.lock
index 80d24e7..d145e72 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "83dd704a45546944c17b923f0fc59fea",
+ "content-hash": "005df9e8bb8ad210ae6ac2a8a7304864",
"packages": [],
"packages-dev": [
{
@@ -752,33 +752,45 @@
},
{
"name": "phpcompatibility/php-compatibility",
- "version": "9.3.5",
+ "version": "dev-develop",
"source": {
"type": "git",
"url": "https://github.com/PHPCompatibility/PHPCompatibility.git",
- "reference": "9fb324479acf6f39452e0655d2429cc0d3914243"
+ "reference": "40ae925146dfb8e0b9aa04b0d979e64c369fe9f4"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibility/zipball/9fb324479acf6f39452e0655d2429cc0d3914243",
- "reference": "9fb324479acf6f39452e0655d2429cc0d3914243",
+ "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibility/zipball/40ae925146dfb8e0b9aa04b0d979e64c369fe9f4",
+ "reference": "40ae925146dfb8e0b9aa04b0d979e64c369fe9f4",
"shasum": ""
},
"require": {
- "php": ">=5.3",
- "squizlabs/php_codesniffer": "^2.3 || ^3.0.2"
+ "php": ">=5.4",
+ "phpcsstandards/phpcsutils": "^1.0.9",
+ "squizlabs/php_codesniffer": "^3.9.0"
},
- "conflict": {
- "squizlabs/php_codesniffer": "2.6.2"
+ "replace": {
+ "wimg/php-compatibility": "*"
},
"require-dev": {
- "phpunit/phpunit": "~4.5 || ^5.0 || ^6.0 || ^7.0"
+ "php-parallel-lint/php-console-highlighter": "^1.0.0",
+ "php-parallel-lint/php-parallel-lint": "^1.3.2",
+ "phpcsstandards/phpcsdevcs": "^1.1.3",
+ "phpcsstandards/phpcsdevtools": "^1.2.0",
+ "phpunit/phpunit": "^4.8.36 || ^5.7.21 || ^6.0 || ^7.0 || ^8.0 || ^9.3.4 || ^10.1.0",
+ "yoast/phpunit-polyfills": "^1.0.5 || ^2.0.0"
},
"suggest": {
- "dealerdirect/phpcodesniffer-composer-installer": "^0.5 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically.",
"roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues."
},
+ "default-branch": true,
"type": "phpcodesniffer-standard",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "9.x-dev",
+ "dev-develop": "10.x-dev"
+ }
+ },
"notification-url": "https://packagist.org/downloads/",
"license": [
"LGPL-3.0-or-later"
@@ -804,13 +816,29 @@
"keywords": [
"compatibility",
"phpcs",
- "standards"
+ "standards",
+ "static analysis"
],
"support": {
"issues": "https://github.com/PHPCompatibility/PHPCompatibility/issues",
+ "security": "https://github.com/PHPCompatibility/PHPCompatibility/security/policy",
"source": "https://github.com/PHPCompatibility/PHPCompatibility"
},
- "time": "2019-12-27T09:44:58+00:00"
+ "funding": [
+ {
+ "url": "https://github.com/PHPCompatibility",
+ "type": "github"
+ },
+ {
+ "url": "https://github.com/jrfnl",
+ "type": "github"
+ },
+ {
+ "url": "https://opencollective.com/php_codesniffer",
+ "type": "open_collective"
+ }
+ ],
+ "time": "2024-04-21T00:45:58+00:00"
},
{
"name": "phpcompatibility/phpcompatibility-paragonie",
@@ -3045,9 +3073,18 @@
"time": "2023-09-27T10:25:08+00:00"
}
],
- "aliases": [],
- "minimum-stability": "stable",
- "stability-flags": [],
+ "aliases": [
+ {
+ "package": "phpcompatibility/php-compatibility",
+ "version": "dev-develop",
+ "alias": "9.99.99",
+ "alias_normalized": "9.99.99.0"
+ }
+ ],
+ "minimum-stability": "dev",
+ "stability-flags": {
+ "phpcompatibility/php-compatibility": 20
+ },
"prefer-stable": false,
"prefer-lowest": false,
"platform": [],
diff --git a/src/class-admin.php b/src/class-admin.php
index 6833464..a6c7474 100644
--- a/src/class-admin.php
+++ b/src/class-admin.php
@@ -20,10 +20,10 @@ class Admin {
* @return void
*/
public function register_hooks() {
- add_action( 'admin_init', [ $this, 'register_settings' ] );
- add_filter( 'manage_edit-post_tag_columns', [ $this, 'add_tag_columns' ] );
- add_filter( 'manage_post_tag_custom_column', [ $this, 'manage_tag_columns' ], 10, 3 );
- add_filter( 'tag_row_actions', [ $this, 'remove_view_action' ], 10, 2 );
+ \add_action( 'admin_init', [ $this, 'register_settings' ] );
+ \add_filter( 'manage_edit-post_tag_columns', [ $this, 'add_tag_columns' ] );
+ \add_filter( 'manage_post_tag_custom_column', [ $this, 'manage_tag_columns' ], 10, 3 );
+ \add_filter( 'tag_row_actions', [ $this, 'remove_view_action' ], 10, 2 );
}
/**
@@ -32,14 +32,14 @@ public function register_hooks() {
* @return void
*/
public function register_settings() {
- add_settings_section(
+ \add_settings_section(
'fewer_tags_section',
__( 'Fewer Tags settings', 'fewer-tags' ),
[ $this, 'display_section' ],
'reading'
);
- add_settings_field(
+ \add_settings_field(
Plugin::$option_name,
__( 'Tags need to have', 'fewer-tags' ),
[ $this, 'display_setting' ],
@@ -47,7 +47,7 @@ public function register_settings() {
'fewer_tags_section'
);
- register_setting( 'reading', Plugin::$option_name );
+ \register_setting( 'reading', Plugin::$option_name );
}
/**
@@ -56,7 +56,7 @@ public function register_settings() {
* @return void
*/
public function display_section() {
- esc_html_e( 'Set the minimum number of posts a tag should have to become live on the site and not be redirected to the homepage.', 'fewer-tags' );
+ \esc_html_e( 'Set the minimum number of posts a tag should have to become live on the site and not be redirected to the homepage.', 'fewer-tags' );
}
/**
@@ -67,14 +67,14 @@ public function display_section() {
public function display_setting() {
?>
-
+
count < \FewerTags\Plugin::$min_posts_count ) {
- $out = '' . esc_html__( 'Not live', 'fewer-tags' ) . '';
+ $out = '' . \esc_html__( 'Not live', 'fewer-tags' ) . '';
}
}
diff --git a/src/class-frontend.php b/src/class-frontend.php
index 0f55495..0a73c3e 100644
--- a/src/class-frontend.php
+++ b/src/class-frontend.php
@@ -18,11 +18,11 @@ class Frontend {
* @return void
*/
public function register_hooks() {
- add_action( 'template_redirect', [ $this, 'redirect_tag_pages' ] );
- add_filter( 'get_the_tags', [ $this, 'filter_get_the_tags' ] );
- add_filter( 'get_the_terms', [ $this, 'filter_get_the_terms' ], 10, 3 );
- add_filter( 'wpseo_exclude_from_sitemap_by_term_ids', [ $this, 'exclude_tags_from_yoast_sitemap' ] );
- add_filter( 'wp_sitemaps_taxonomies_query_args', [ $this, 'exclude_tags_from_core_sitemap' ], 10, 2 );
+ \add_action( 'template_redirect', [ $this, 'redirect_tag_pages' ] );
+ \add_filter( 'get_the_tags', [ $this, 'filter_get_the_tags' ] );
+ \add_filter( 'get_the_terms', [ $this, 'filter_get_the_terms' ], 10, 3 );
+ \add_filter( 'wpseo_exclude_from_sitemap_by_term_ids', [ $this, 'exclude_tags_from_yoast_sitemap' ] );
+ \add_filter( 'wp_sitemaps_taxonomies_query_args', [ $this, 'exclude_tags_from_core_sitemap' ], 10, 2 );
}
/**
@@ -31,10 +31,10 @@ public function register_hooks() {
* @return void
*/
public function redirect_tag_pages() {
- if ( is_tag() ) {
- $tag = get_queried_object();
+ if ( \is_tag() ) {
+ $tag = \get_queried_object();
if ( $tag && $tag->count < \FewerTags\Plugin::$min_posts_count ) {
- wp_safe_redirect( home_url(), 301 );
+ \wp_safe_redirect( \home_url(), 301 );
// @codeCoverageIgnoreStart
exit;
// @codeCoverageIgnoreEnd
@@ -58,7 +58,7 @@ public function filter_get_the_terms( $terms, $post_id, $taxonomy ) {
return $terms;
}
- if ( is_array( $terms ) ) {
+ if ( \is_array( $terms ) ) {
foreach ( $terms as $key => $tag ) {
if ( $tag->count < \FewerTags\Plugin::$min_posts_count ) {
unset( $terms[ $key ] );
@@ -77,7 +77,7 @@ public function filter_get_the_terms( $terms, $post_id, $taxonomy ) {
* @return array The filtered array of tag objects.
*/
public function filter_get_the_tags( $tags ) {
- if ( is_array( $tags ) ) {
+ if ( \is_array( $tags ) ) {
foreach ( $tags as $key => $tag ) {
if ( $tag->count < \FewerTags\Plugin::$min_posts_count ) {
unset( $tags[ $key ] );
@@ -106,7 +106,7 @@ public function exclude_tags_from_core_sitemap( $args, $taxonomy ) {
}
// exclude terms with too few posts.
- $args['exclude'] = array_merge( $args['exclude'], $this->get_tag_ids_with_fewer_than_min_posts() );
+ $args['exclude'] = \array_merge( $args['exclude'], $this->get_tag_ids_with_fewer_than_min_posts() );
return $args;
}