diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dbfc33a..f1adef1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,7 +15,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@master + uses: actions/checkout@v3 - name: Install PHP uses: shivammathur/setup-php@v2 @@ -24,19 +24,8 @@ jobs: env: COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Get Composer cache directory - id: composer-cache - run: echo "::set-output name=dir::$(composer config cache-files-dir)" - - - name: Set up Composer caching - uses: actions/cache@master - env: - cache-name: cache-composer-dependencies - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} - restore-keys: | - ${{ runner.os }}-composer- + - name: Setup Composer caching + uses: ramsey/composer-install@v2 - name: Install dependencies and update PHPUnit run: | diff --git a/.github/workflows/deploy-readme-assets-to-wp-org.yml b/.github/workflows/deploy-readme-assets-to-wp-org.yml index a6cf4fa..b171acb 100644 --- a/.github/workflows/deploy-readme-assets-to-wp-org.yml +++ b/.github/workflows/deploy-readme-assets-to-wp-org.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@master + uses: actions/checkout@v3 - name: WordPress.org plugin asset/readme update uses: 10up/action-wordpress-plugin-asset-update@stable diff --git a/.github/workflows/deploy-to-wp-org.yml b/.github/workflows/deploy-to-wp-org.yml index bf4ae90..3ed3d5e 100644 --- a/.github/workflows/deploy-to-wp-org.yml +++ b/.github/workflows/deploy-to-wp-org.yml @@ -10,21 +10,10 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@master + uses: actions/checkout@v3 - - name: Get Composer cache directory - id: composer-cache - run: echo "::set-output name=dir::$(composer config cache-files-dir)" - - - name: Set up Composer caching - uses: actions/cache@master - env: - cache-name: cache-composer-dependencies - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} - restore-keys: | - ${{ runner.os }}-composer- + - name: Setup Composer caching + uses: ramsey/composer-install@v2 - name: Install dependencies in prod version run: | diff --git a/CHANGELOG.md b/CHANGELOG.md index 51b4c5c..34f2c33 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 6.0.4 (23.09.2023) ## +* Fixed disappeared file descriptions on the Theme File Editor page. + ## 6.0.3 (29.07.2023) ## * Fixed fatal error with Jetpack sync. diff --git a/README.md b/README.md index 16c5e4c..3b625ca 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Converts Cyrillic characters in post, page and term slugs to Latin characters. Useful for creating human-readable URLs. -![](./assets/banner-772x250.png) +![Banner](./.wordpress-org/banner-772x250.png) ## Features diff --git a/composer.json b/composer.json index 9204abd..9f1fadd 100644 --- a/composer.json +++ b/composer.json @@ -36,6 +36,11 @@ }, "minimum-stability": "dev", "prefer-stable": true, + "config": { + "allow-plugins": { + "dealerdirect/phpcodesniffer-composer-installer": true + } + }, "require": { "ext-json": "*" }, @@ -47,7 +52,7 @@ "squizlabs/php_codesniffer": "^3.7.2", "phpcompatibility/php-compatibility": "^9.3.5", "phpcompatibility/phpcompatibility-wp": "^2.1.4", - "wp-coding-standards/wpcs": "^2.3.0", + "wp-coding-standards/wpcs": "^3.0.1", "php-coveralls/php-coveralls": "^v2.6.0" }, "autoload": { @@ -78,8 +83,6 @@ "update-tests": "update-tests", "revert-tests": "update-tests revert", "phpcs": "vendor/bin/phpcs --colors --standard=phpcs.xml", - "acceptance": "codecept run acceptance -c .codeception.yml", - "integration": "codecept run integration -c .codeception.yml", - "unit": "codecept run unit -c .codeception.yml" + "unit": "vendor/bin/phpunit" } } diff --git a/cyr-to-lat.php b/cyr-to-lat.php index d9473d5..a756935 100644 --- a/cyr-to-lat.php +++ b/cyr-to-lat.php @@ -10,7 +10,7 @@ * 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.0.3 + * Version: 6.0.4 * Requires at least: 5.1 * Requires PHP: 7.0.0 * Author: Sergey Biryukov, Mikhail Kobzarev, Igor Gergel @@ -22,7 +22,7 @@ * * * WC requires at least: 3.0 - * WC tested up to: 7.9 + * WC tested up to: 8.1 */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort @@ -43,7 +43,7 @@ /** * Plugin version. */ -define( 'CYR_TO_LAT_VERSION', '6.0.3' ); +define( 'CYR_TO_LAT_VERSION', '6.0.4' ); /** * Path to the plugin dir. diff --git a/phpcs.xml b/phpcs.xml index 0e498d6..ea8ac57 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -22,7 +22,7 @@ - + @@ -30,25 +30,14 @@ - - - - - - 0 - - - - - - 0 - - - - - 0 - - - 0 + + + + + + + + + diff --git a/readme.txt b/readme.txt index 9e05723..bbb68ee 100644 --- a/readme.txt +++ b/readme.txt @@ -3,7 +3,7 @@ Contributors: SergeyBiryukov, mihdan, karevn, webvitaly, kaggdesign Tags: cyrillic, belorussian, ukrainian, bulgarian, macedonian, georgian, kazakh, latin, l10n, russian, cyr-to-lat, cyr2lat, rustolat, slugs, translations, transliteration Requires at least: 5.1 Tested up to: 6.3 -Stable tag: 6.0.3 +Stable tag: 6.0.4 Requires PHP: 7.0.0 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -221,7 +221,10 @@ Yes you can! == Changelog == -= 6.0.3 (29.07.2023) = += 6.0.4 (23.09.2023) = +* Fixed disappeared file descriptions on the Theme File Editor page. + +* = 6.0.3 (29.07.2023) = * Fixed fatal error with Jetpack sync. = 6.0.2 (26.07.2023) = diff --git a/src/php/AdminNotices.php b/src/php/AdminNotices.php index 4843a3f..4f76962 100644 --- a/src/php/AdminNotices.php +++ b/src/php/AdminNotices.php @@ -31,15 +31,15 @@ public function __construct() { /** * Add admin notice. * - * @param string $message Message to show. - * @param string $class Message class: notice notice-success notice-error notice-warning notice-info - * is-dismissible. - * @param array $options Notice options. + * @param string $message Message to show. + * @param string $class_name Message class: notice notice-success notice-error notice-warning notice-info + * is-dismissible. + * @param array $options Notice options. */ - public function add_notice( string $message, string $class = 'notice', array $options = [] ) { + public function add_notice( string $message, string $class_name = 'notice', array $options = [] ) { $this->notices[] = [ 'message' => $message, - 'class' => $class, + 'class' => $class_name, 'options' => $options, ]; } diff --git a/src/php/BackgroundProcesses/PostConversionProcess.php b/src/php/BackgroundProcesses/PostConversionProcess.php index cea7f23..7c2ddfa 100644 --- a/src/php/BackgroundProcesses/PostConversionProcess.php +++ b/src/php/BackgroundProcesses/PostConversionProcess.php @@ -184,6 +184,7 @@ protected function rename_file( string $file, string $new_file ) { $new_filename = $new_path['filename']; if ( $new_filename !== $filename ) { + // phpcs:ignore WordPress.WP.AlternativeFunctions.rename_rename return rename( $file, $new_file ); } diff --git a/src/php/ConversionTables.php b/src/php/ConversionTables.php index bc8d2ea..9e5b956 100644 --- a/src/php/ConversionTables.php +++ b/src/php/ConversionTables.php @@ -694,13 +694,13 @@ public static function get( string $locale = '' ): array { 'ש' => 'sh', 'ת' => 'th', ]; - for ( $code = 0x0590; $code <= 0x05CF; $code ++ ) { + for ( $code = 0x0590; $code <= 0x05CF; $code++ ) { $table[ Mbstring::mb_chr( $code ) ] = ''; } - for ( $code = 0x05F0; $code <= 0x05F5; $code ++ ) { + for ( $code = 0x05F0; $code <= 0x05F5; $code++ ) { $table[ Mbstring::mb_chr( $code ) ] = ''; } - for ( $code = 0xFB1D; $code <= 0xFB4F; $code ++ ) { + for ( $code = 0xFB1D; $code <= 0xFB4F; $code++ ) { $table[ Mbstring::mb_chr( $code ) ] = ''; } break; diff --git a/src/php/Main.php b/src/php/Main.php index e34ec2c..0b2b5df 100644 --- a/src/php/Main.php +++ b/src/php/Main.php @@ -422,12 +422,12 @@ public function min_suffix(): string { /** * Fix string encoding on macOS. * - * @param string $string String. - * @param array $table Conversion table. + * @param string $str String. + * @param array $table Conversion table. * * @return string */ - private function fix_mac_string( string $string, array $table ): string { + private function fix_mac_string( string $str, array $table ): string { $fix_table = ConversionTables::get_fix_table_for_mac(); $fix = []; @@ -437,50 +437,50 @@ private function fix_mac_string( string $string, array $table ): string { } } - return strtr( $string, $fix ); + return strtr( $str, $fix ); } /** * Split Chinese string by hyphens. * - * @param string $string String. - * @param array $table Conversion table. + * @param string $str String. + * @param array $table Conversion table. * * @return string */ - protected function split_chinese_string( string $string, array $table ): string { - if ( ! $this->settings->is_chinese_locale() || mb_strlen( $string ) < 4 ) { - return $string; + protected function split_chinese_string( string $str, array $table ): string { + if ( ! $this->settings->is_chinese_locale() || mb_strlen( $str ) < 4 ) { + return $str; } - $chars = Mbstring::mb_str_split( $string ); - $string = ''; + $chars = Mbstring::mb_str_split( $str ); + $str = ''; foreach ( $chars as $char ) { if ( isset( $table[ $char ] ) ) { - $string .= '-' . $char . '-'; + $str .= '-' . $char . '-'; } else { - $string .= $char; + $str .= $char; } } - return $string; + return $str; } /** * Transliterate string using a table. * - * @param string $string String. + * @param string $str String. * * @return string */ - public function transliterate( string $string ): string { + public function transliterate( string $str ): string { $table = (array) apply_filters( 'ctl_table', $this->settings->get_table() ); - $string = $this->fix_mac_string( $string, $table ); - $string = $this->split_chinese_string( $string, $table ); + $str = $this->fix_mac_string( $str, $table ); + $str = $this->split_chinese_string( $str, $table ); - return strtr( $string, $table ); + return strtr( $str, $table ); } /** diff --git a/src/php/Requirements.php b/src/php/Requirements.php index 2fdc88a..362a08b 100644 --- a/src/php/Requirements.php +++ b/src/php/Requirements.php @@ -53,6 +53,8 @@ class Requirements { * @param Settings $settings Settings. * @param AdminNotices $admin_notices Admin notices. * @param WP_Filesystem_Direct|null $wp_filesystem File system. + * + * @noinspection PhpUnusedLocalVariableInspection */ public function __construct( Settings $settings, AdminNotices $admin_notices, WP_Filesystem_Direct $wp_filesystem = null ) { $this->settings = $settings; @@ -62,6 +64,12 @@ public function __construct( Settings $settings, AdminNotices $admin_notices, WP // @codeCoverageIgnoreStart if ( ! function_exists( 'WP_Filesystem' ) ) { + /** + * Make the scope of $wp_file_descriptions global, + * so that when wp-admin/includes/file.php assigns to it, it is adjusting the global variable as intended. + */ + global $wp_file_descriptions; + require_once ABSPATH . 'wp-admin/includes/file.php'; } // @codeCoverageIgnoreEnd diff --git a/src/php/Settings/Abstracts/SettingsBase.php b/src/php/Settings/Abstracts/SettingsBase.php index 9ccf837..0a11eb5 100644 --- a/src/php/Settings/Abstracts/SettingsBase.php +++ b/src/php/Settings/Abstracts/SettingsBase.php @@ -760,7 +760,7 @@ private function print_checkbox_field( array $arguments ) { } foreach ( $arguments['options'] as $key => $label ) { - $iterator ++; + ++$iterator; $options_markup .= sprintf( '