Skip to content

Commit

Permalink
Merge pull request #117 from mihdan/v5.2.7
Browse files Browse the repository at this point in the history
V5.2.7
  • Loading branch information
kagg-design committed Feb 14, 2022
2 parents 0cddcb5 + ee05ece commit 8df4ebd
Show file tree
Hide file tree
Showing 13 changed files with 28 additions and 21 deletions.
1 change: 1 addition & 0 deletions .distignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
/Makefile
/README.md
/Thumbs.db
/auth.json
/composer.json
/composer.lock
/package.json
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
strategy:
matrix:
os: [ ubuntu-latest ]
php-version: [ '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0' ]
php-version: [ '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1' ]

name: PHP ${{ matrix.php-version }} on ${{ matrix.os }}

Expand Down
2 changes: 1 addition & 1 deletion .make/update-phpunit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ if [[ $PHP_VERSION == '7.2' ]]; then
PHP_UNIT='8.5'
fi

if [[ $PHP_VERSION == '7.3' || $PHP_VERSION == '7.4' || $PHP_VERSION == '8.0' ]]; then
if [[ $PHP_VERSION == '7.3' || $PHP_VERSION == '7.4' || $PHP_VERSION == '8.0' || $PHP_VERSION == '8.1' ]]; then
PHP_UNIT='9.5'
fi

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"phpcompatibility/php-compatibility": "^9.3",
"phpcompatibility/phpcompatibility-wp": "^2.1",
"wp-coding-standards/wpcs": "^2.3",
"php-coveralls/php-coveralls": "^v2.4"
"php-coveralls/php-coveralls": "^v2.5"
},
"autoload": {
"classmap": [
Expand Down
6 changes: 3 additions & 3 deletions cyr-to-lat.php
Original file line number Diff line number Diff line change
Expand Up @@ -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: 5.2.6
* Version: 5.2.7
* Requires at least: 5.1
* Requires PHP: 5.6.20
* Author: Sergey Biryukov, Mikhail Kobzarev, Igor Gergel
Expand All @@ -22,7 +22,7 @@
*
*
* WC requires at least: 3.0
* WC tested up to: 6.0
* WC tested up to: 6.2
*/

namespace Cyr_To_Lat;
Expand All @@ -40,7 +40,7 @@
/**
* Plugin version.
*/
define( 'CYR_TO_LAT_VERSION', '5.2.6' );
define( 'CYR_TO_LAT_VERSION', '5.2.7' );

/**
* Path to the plugin dir.
Expand Down
8 changes: 7 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ 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: 5.9
Stable tag: 5.2.6
Stable tag: 5.2.7
Requires PHP: 5.6.20
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Convert Non-Latin characters in post, page and term slugs to Latin characters.

Expand Down Expand Up @@ -188,6 +190,10 @@ Yes you can!

== Changelog ==

= 5.2.7 (14.02.2022) =
* Tested with WooCommerce 6.2.
* Added PHP 8.1 support.

= 5.2.6 (25.12.2021) =
* Revert fix made in 5.2.5 for 404 with WPML, as it created several issues on the frontend.
* Fix again 404 on archives created with WPML before activation of cyr2lat.
Expand Down
2 changes: 1 addition & 1 deletion src/php/Settings/Abstracts/SettingsBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ private function tab_link( $tab ) {
* @return bool
*/
protected function is_tab_active( $tab ) {
$current_tab_name = filter_input( INPUT_GET, 'tab', FILTER_SANITIZE_STRING );
$current_tab_name = filter_input( INPUT_GET, 'tab', FILTER_SANITIZE_FULL_SPECIAL_CHARS );

if ( null === $current_tab_name && ! $tab->is_tab() ) {
return true;
Expand Down
8 changes: 4 additions & 4 deletions src/php/class-main.php
Original file line number Diff line number Diff line change
Expand Up @@ -575,19 +575,19 @@ private function pll_locale_filter_with_classic_editor() {
// phpcs:disable WordPress.Security.NonceVerification.Recommended
if ( isset( $_POST['post_ID'] ) ) {
$pll_get_post_language = pll_get_post_language(
(int) filter_input( INPUT_POST, 'post_ID', FILTER_SANITIZE_STRING ),
(int) filter_input( INPUT_POST, 'post_ID', FILTER_SANITIZE_FULL_SPECIAL_CHARS ),
'locale'
);
}
if ( isset( $_POST['pll_post_id'] ) ) {
$pll_get_post_language = pll_get_post_language(
(int) filter_input( INPUT_POST, 'pll_post_id', FILTER_SANITIZE_STRING ),
(int) filter_input( INPUT_POST, 'pll_post_id', FILTER_SANITIZE_FULL_SPECIAL_CHARS ),
'locale'
);
}
if ( isset( $_GET['post'] ) ) {
$pll_get_post_language = pll_get_post_language(
(int) filter_input( INPUT_GET, 'post', FILTER_SANITIZE_STRING ),
(int) filter_input( INPUT_GET, 'post', FILTER_SANITIZE_FULL_SPECIAL_CHARS ),
'locale'
);
}
Expand All @@ -612,7 +612,7 @@ private function pll_locale_filter_with_term() {
// phpcs:disable WordPress.Security.NonceVerification.Missing
if ( isset( $_POST['term_lang_choice'] ) ) {
$pll_get_language = PLL()->model->get_language(
filter_input( INPUT_POST, 'term_lang_choice', FILTER_SANITIZE_STRING )
filter_input( INPUT_POST, 'term_lang_choice', FILTER_SANITIZE_FULL_SPECIAL_CHARS )
);

if ( $pll_get_language ) {
Expand Down
4 changes: 2 additions & 2 deletions src/php/class-request.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function is_rest() {
}

// Case #2.
if ( filter_input( INPUT_GET, 'rest_route', FILTER_SANITIZE_STRING ) ) {
if ( filter_input( INPUT_GET, 'rest_route', FILTER_SANITIZE_FULL_SPECIAL_CHARS ) ) {
return true;
}

Expand Down Expand Up @@ -97,7 +97,7 @@ protected function get_rest_route() {
public function is_post() {
$request_method = filter_var(
isset( $_SERVER['REQUEST_METHOD'] ) ? wp_unslash( $_SERVER['REQUEST_METHOD'] ) : '',
FILTER_SANITIZE_STRING
FILTER_SANITIZE_FULL_SPECIAL_CHARS
);

return 'POST' === $request_method;
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/Settings/Abstracts/SettingsBaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ function ( $type, $name, $filter ) use ( $input ) {
if (
INPUT_GET === $type &&
'tab' === $name &&
FILTER_SANITIZE_STRING === $filter
FILTER_SANITIZE_FULL_SPECIAL_CHARS === $filter
) {
return $input;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
/**
* Plugin version.
*/
const CYR_TO_LAT_TEST_VERSION = '5.2.6';
const CYR_TO_LAT_TEST_VERSION = '5.2.7';

/**
* Path to the plugin dir.
Expand Down
8 changes: 4 additions & 4 deletions tests/phpunit/tests/class-test-main.php
Original file line number Diff line number Diff line change
Expand Up @@ -1041,7 +1041,7 @@ public function test_pll_locale_filter_with_classic_editor_and_post_id() {
FunctionMocker::replace(
'filter_input',
static function ( $type, $var_name, $filter ) use ( $post_id ) {
if ( INPUT_POST === $type && 'post_ID' === $var_name && FILTER_SANITIZE_STRING === $filter ) {
if ( INPUT_POST === $type && 'post_ID' === $var_name && FILTER_SANITIZE_FULL_SPECIAL_CHARS === $filter ) {
return $post_id;
}

Expand Down Expand Up @@ -1085,7 +1085,7 @@ public function test_pll_locale_filter_with_classic_editor_and_pll_post_id() {
FunctionMocker::replace(
'filter_input',
static function ( $type, $var_name, $filter ) use ( $post_id ) {
if ( INPUT_POST === $type && 'pll_post_id' === $var_name && FILTER_SANITIZE_STRING === $filter ) {
if ( INPUT_POST === $type && 'pll_post_id' === $var_name && FILTER_SANITIZE_FULL_SPECIAL_CHARS === $filter ) {
return $post_id;
}

Expand Down Expand Up @@ -1129,7 +1129,7 @@ public function test_pll_locale_filter_with_classic_editor_and_post() {
FunctionMocker::replace(
'filter_input',
static function ( $type, $var_name, $filter ) use ( $post_id ) {
if ( INPUT_GET === $type && 'post' === $var_name && FILTER_SANITIZE_STRING === $filter ) {
if ( INPUT_GET === $type && 'post' === $var_name && FILTER_SANITIZE_FULL_SPECIAL_CHARS === $filter ) {
return $post_id;
}

Expand Down Expand Up @@ -1183,7 +1183,7 @@ public function test_pll_locale_filter_with_term() {
FunctionMocker::replace(
'filter_input',
static function ( $type, $var_name, $filter ) use ( $term_lang_choice ) {
if ( INPUT_POST === $type && 'term_lang_choice' === $var_name && FILTER_SANITIZE_STRING === $filter ) {
if ( INPUT_POST === $type && 'term_lang_choice' === $var_name && FILTER_SANITIZE_FULL_SPECIAL_CHARS === $filter ) {
return $term_lang_choice;
}

Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/tests/class-test-request.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ function ( $type, $var_name, $filter ) {
return (
INPUT_GET === $type &&
'rest_route' === $var_name &&
FILTER_SANITIZE_STRING === $filter
FILTER_SANITIZE_FULL_SPECIAL_CHARS === $filter
);
}
);
Expand Down

0 comments on commit 8df4ebd

Please sign in to comment.