Skip to content

Commit

Permalink
Merge pull request #158 from mihdan/v6.2.0
Browse files Browse the repository at this point in the history
V6.2.0
  • Loading branch information
kagg-design authored Nov 13, 2024
2 parents ed3e0e5 + 6694353 commit 5e922a4
Show file tree
Hide file tree
Showing 47 changed files with 2,335 additions and 2,242 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"es2017": true
},
"extends": [
"plugin:@wordpress/eslint-plugin/recommended"
"plugin:@wordpress/eslint-plugin/recommended-with-formatting"
],
"parserOptions": {
"sourceType": "module"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
strategy:
matrix:
os: [ ubuntu-latest ]
php-version: [ '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3' ]
php-version: [ '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3' ]

runs-on: ${{ matrix.os }}

Expand Down
16 changes: 8 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,22 +46,22 @@
},
"require-dev": {
"roave/security-advisories": "dev-latest",
"10up/wp_mock": "0.3 - 0.5",
"10up/wp_mock": "0.4.2 - 1.0.1",
"lucatume/function-mocker": "dev-master",
"phpunit/phpunit": "6.5 - 9.6",
"squizlabs/php_codesniffer": "^3.9.0",
"phpunit/phpunit": "8.5.40 - 11.4.3",
"squizlabs/php_codesniffer": "^3.11.0",
"phpcompatibility/php-compatibility": "^9.3.5",
"phpcompatibility/phpcompatibility-wp": "^2.1.4",
"wp-coding-standards/wpcs": "^3.0.1",
"phpcompatibility/phpcompatibility-wp": "^2.1.5",
"wp-coding-standards/wpcs": "^3.1.0",
"php-coveralls/php-coveralls": "^v2.7.0"
},
"autoload": {
"classmap": [
"libs"
],
"psr-4": {
"CyrToLat\\": "src/php"
},
"classmap": [
"libs"
],
"files": [
"src/php/includes/deprecated.php"
]
Expand Down
8 changes: 4 additions & 4 deletions cyr-to-lat.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
* Plugin Name: Cyr-To-Lat
* Plugin URI: https://wordpress.org/plugins/cyr2lat/
* Description: Convert Non-Latin characters in post and term slugs to Latin characters. Useful for creating human-readable URLs. Based on the original plugin by Anton Skorobogatov.
* Version: 6.1.0
* Version: 6.2.0
* Requires at least: 5.1
* Requires PHP: 7.0.0
* Requires PHP: 7.2.0
* Author: Sergey Biryukov, Mikhail Kobzarev, Igor Gergel
* Author URI: https://profiles.wordpress.org/sergeybiryukov/
* License: GPL v2 or later
Expand All @@ -22,7 +22,7 @@
*
*
* WC requires at least: 3.0
* WC tested up to: 8.6
* WC tested up to: 9.4
*/

// phpcs:ignore Generic.Commenting.DocComment.MissingShort
Expand All @@ -43,7 +43,7 @@
/**
* Plugin version.
*/
define( 'CYR_TO_LAT_VERSION', '6.1.0' );
define( 'CYR_TO_LAT_VERSION', '6.2.0' );

/**
* Path to the plugin dir.
Expand Down
29 changes: 15 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,29 +48,30 @@
}
},
"engines": {
"node": ">=21.5.0",
"npm": ">=10.3.0"
"node": ">=20.18.0",
"npm": ">=10.9.0"
},
"packageManager": "yarn@4.1.0",
"packageManager": "yarn@4.5.1",
"dependencies": {
"@wordpress/hooks": "^3.53.0"
"@wordpress/hooks": "^4.11.0"
},
"devDependencies": {
"@babel/core": "^7.24.0",
"@babel/preset-env": "^7.24.0",
"@wordpress/eslint-plugin": "^17.10.0",
"babel-loader": "^9.1.3",
"@babel/core": "^7.26.0",
"@babel/preset-env": "^7.26.0",
"@wordpress/eslint-plugin": "^21.4.0",
"babel-loader": "^9.2.1",
"coveralls": "^3.1.1",
"css-loader": "^6.10.0",
"css-minimizer-webpack-plugin": "^6.0.0",
"eslint": "^8.57.0",
"glob": "^10.3.10",
"css-loader": "^7.1.2",
"css-minimizer-webpack-plugin": "^7.0.0",
"eslint": "^8.57.1",
"glob": "^11.0.0",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"jest-fetch-mock": "^3.0.3",
"mini-css-extract-plugin": "^2.8.1",
"mini-css-extract-plugin": "^2.9.2",
"prettier": "^3.3.3",
"terser-webpack-plugin": "^5.3.10",
"webpack": "^5.90.3",
"webpack": "^5.96.1",
"webpack-cli": "^5.1.4",
"webpack-remove-empty-scripts": "^1.0.4"
},
Expand Down
9 changes: 5 additions & 4 deletions phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

<!-- What to scan -->
<file>.</file>
<!-- Exclude all dirs except needed -->
<exclude-pattern>^(?!.*/cyr2lat).*</exclude-pattern>
<exclude-pattern>*/\.codeception/*</exclude-pattern>
<exclude-pattern>*/\.github/*</exclude-pattern>
<exclude-pattern>*/\.make/*</exclude-pattern>
<exclude-pattern>*/\.wordpress-org/*</exclude-pattern>
Expand All @@ -19,18 +22,16 @@
<arg value="sp"/><!-- Show sniff and progress -->
<arg name="basepath" value="./"/><!-- Strip the file paths down to the relevant bit -->
<arg name="extensions" value="php"/>
<arg name="parallel" value="12"/><!-- Enables parallel processing when available for faster results. -->
<arg name="cache" value=".phpcs.cache"/>

<config name="installed_paths" value="vendor/phpcompatibility/php-compatibility,vendor/phpcompatibility/phpcompatibility-paragonie,vendor/phpcompatibility/phpcompatibility-wp,vendor/phpcsstandards/phpcsextra,vendor/phpcsstandards/phpcsutils,vendor/wp-coding-standards/wpcs"/>
<config name="testVersion" value="7.0-"/>
<config name="testVersion" value="7.2-"/>

<!-- Rules: Check PHP version compatibility -->
<rule ref="PHPCompatibility"/>
<rule ref="PHPCompatibilityWP"/>

<!-- Rules: WordPress Coding Standards -->
<config name="minimum_supported_wp_version" value="5.0"/>
<config name="minimum_supported_wp_version" value="5.3"/>
<rule ref="WordPress">
<exclude name="Generic.CodeAnalysis.UnusedFunctionParameter.Found"/>
<exclude name="Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed"/>
Expand Down
15 changes: 11 additions & 4 deletions readme.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
=== Cyr-To-Lat ===
Contributors: SergeyBiryukov, mihdan, kaggdesign, karevn, webvitaly
Tags: cyrillic, slugs, translation, transliteration
Requires at least: 5.1
Tested up to: 6.5
Stable tag: 6.1.0
Requires PHP: 7.0.0
Requires at least: 5.3
Tested up to: 6.7
Stable tag: 6.2.0
Requires PHP: 7.2.0
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -221,6 +221,13 @@ Yes, you can!

== Changelog ==

= 6.2.0 (13.11.2024) =
* Dropped support for PHP 7.0 and 7.1. The minimum required PHP version is now 7.2.
* The minimum required WordPress version is now 5.3.
* Fixed the notice about the _load_textdomain_just_in_time function being called incorrectly.
* Tested with WordPress 6.7.
* Tested with WooCommerce 9.4.

= 6.1.0 (09.03.2024) =
* Tested with WordPress 6.5.
* Tested with WooCommerce 8.6.
Expand Down
4 changes: 2 additions & 2 deletions src/php/ACF.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function __construct( Settings $settings ) {
/**
* Init class hooks.
*/
public function init_hooks() {
public function init_hooks(): void {
add_action( 'acf/field_group/admin_enqueue_scripts', [ $this, 'enqueue_script' ] );
}

Expand All @@ -44,7 +44,7 @@ public function init_hooks() {
*
* @return void
*/
public function enqueue_script() {
public function enqueue_script(): void {
global $cyr_to_lat_plugin;

$min = $cyr_to_lat_plugin->min_suffix();
Expand Down
4 changes: 2 additions & 2 deletions src/php/AdminNotices.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function __construct() {
* is-dismissible.
* @param array $options Notice options.
*/
public function add_notice( string $message, string $class_name = 'notice', array $options = [] ) {
public function add_notice( string $message, string $class_name = 'notice', array $options = [] ): void {
$this->notices[] = [
'message' => $message,
'class' => $class_name,
Expand All @@ -49,7 +49,7 @@ public function add_notice( string $message, string $class_name = 'notice', arra
*
* @return void
*/
public function show_notices() {
public function show_notices(): void {
foreach ( $this->notices as $notice ) {
if ( ! $this->is_screen_allowed( $notice ) ) {
continue;
Expand Down
2 changes: 1 addition & 1 deletion src/php/BackgroundProcesses/ConversionProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public function is_process_completed(): bool {
*
* @noinspection ForgottenDebugOutputInspection
*/
protected function log( string $message ) {
protected function log( string $message ): void {
if ( defined( 'WP_DEBUG_LOG' ) && constant( 'WP_DEBUG_LOG' ) ) {
// @phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log
error_log( 'Cyr To Lat: ' . $message );
Expand Down
10 changes: 6 additions & 4 deletions src/php/BackgroundProcesses/PostConversionProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ protected function task( $post ): bool {
*
* @param int $post_id Post ID.
*/
protected function rename_attachment( int $post_id ) {
protected function rename_attachment( int $post_id ): void {
$file = get_attached_file( $post_id );

if ( $file ) {
Expand All @@ -114,7 +114,7 @@ protected function rename_attachment( int $post_id ) {
*
* @param int $post_id Post ID.
*/
protected function rename_thumbnails( int $post_id ) {
protected function rename_thumbnails( int $post_id ): void {
$sizes = get_intermediate_image_sizes();

foreach ( $sizes as $size ) {
Expand All @@ -137,7 +137,7 @@ protected function rename_thumbnails( int $post_id ) {
*
* @param int $attachment_id Attachment ID.
*/
protected function update_attachment_metadata( int $attachment_id ) {
protected function update_attachment_metadata( int $attachment_id ): void {
$meta = wp_get_attachment_metadata( $attachment_id );

if ( isset( $meta['file'] ) ) {
Expand Down Expand Up @@ -176,7 +176,7 @@ protected function get_transliterated_file( string $file ): string {
*
* @return bool|null
*/
protected function rename_file( string $file, string $new_file ) {
protected function rename_file( string $file, string $new_file ): ?bool {
$path = pathinfo( $file );
$new_path = pathinfo( $new_file );

Expand All @@ -193,6 +193,8 @@ protected function rename_file( string $file, string $new_file ) {

/**
* Complete
*
* @noinspection ReturnTypeCanBeDeclaredInspection
*/
protected function complete() {
parent::complete();
Expand Down
2 changes: 2 additions & 0 deletions src/php/BackgroundProcesses/TermConversionProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ protected function task( $term ) {

/**
* Complete
*
* @noinspection ReturnTypeCanBeDeclaredInspection
*/
protected function complete() {
parent::complete();
Expand Down
3 changes: 3 additions & 0 deletions src/php/ConversionTables.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
* @package cyr-to-lat
*/

// phpcs:ignore Generic.Commenting.DocComment.MissingShort
/** @noinspection PhpInternalEntityUsedInspection */

namespace CyrToLat;

use CyrToLat\Symfony\Polyfill\Mbstring\Mbstring;
Expand Down
20 changes: 10 additions & 10 deletions src/php/Converter.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class Converter {
/**
* Query arg in url to start conversion.
*/
const QUERY_ARG = 'cyr-to-lat-convert';
public const QUERY_ARG = 'cyr-to-lat-convert';

/**
* Regex of allowed chars in lower-cased slugs.
Expand All @@ -31,7 +31,7 @@ class Converter {
*
* @link https://dev.mysql.com/doc/refman/5.6/en/regexp.html
*/
const ALLOWED_CHARS_REGEX = "^([a-z0-9\'-._]|%[2-7][0-F])+$";
public const ALLOWED_CHARS_REGEX = "^([a-z0-9\'-._]|%[2-7][0-F])+$";

/**
* Plugin main class.
Expand Down Expand Up @@ -90,7 +90,7 @@ public function __construct( Main $main, Settings $settings, PostConversionProce
/**
* Init class hooks.
*/
public function init_hooks() {
public function init_hooks(): void {
add_action( 'admin_init', [ $this, 'process_handler' ] );
add_action( 'admin_init', [ $this, 'conversion_notices' ] );
}
Expand All @@ -100,7 +100,7 @@ public function init_hooks() {
*
* @return void
*/
public function conversion_notices() {
public function conversion_notices(): void {
$posts_process_running = $this->process_all_posts->is_processing();
$terms_process_running = $this->process_all_terms->is_processing();

Expand Down Expand Up @@ -142,7 +142,7 @@ public function conversion_notices() {
*
* @return void
*/
public function start_conversion() {
public function start_conversion(): void {
if ( ! isset( $_POST['ctl-convert'] ) ) {
return;
}
Expand All @@ -155,7 +155,7 @@ public function start_conversion() {
*
* @return void
*/
public function process_handler() {
public function process_handler(): void {
if ( ! isset( $_GET[ self::QUERY_ARG ], $_GET['_wpnonce'] ) ) {
return;
}
Expand All @@ -172,7 +172,7 @@ public function process_handler() {
*
* @param array $args Arguments for query.
*/
public function convert_existing_slugs( array $args = [] ) {
public function convert_existing_slugs( array $args = [] ): void {
$this->convert_existing_post_slugs( $args );
$this->convert_existing_term_slugs();
}
Expand All @@ -182,7 +182,7 @@ public function convert_existing_slugs( array $args = [] ) {
*
* @param array $args Arguments for query.
*/
protected function convert_existing_post_slugs( array $args = [] ) {
protected function convert_existing_post_slugs( array $args = [] ): void {
global $wpdb;

$post_types = array_intersect(
Expand Down Expand Up @@ -245,7 +245,7 @@ protected function convert_existing_post_slugs( array $args = [] ) {
/**
* Convert existing term slugs.
*/
protected function convert_existing_term_slugs() {
protected function convert_existing_term_slugs(): void {
global $wpdb;

// phpcs:ignore WordPress.DB.DirectDatabaseQuery
Expand Down Expand Up @@ -286,7 +286,7 @@ protected function convert_existing_term_slugs() {
*
* @noinspection ForgottenDebugOutputInspection
*/
protected function log( string $message ) {
protected function log( string $message ): void {
if ( defined( 'WP_DEBUG_LOG' ) && constant( 'WP_DEBUG_LOG' ) ) {
// @phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log
error_log( 'Cyr To Lat: ' . $message );
Expand Down
Loading

0 comments on commit 5e922a4

Please sign in to comment.