Skip to content

Commit

Permalink
Merge pull request #136 from mihdan/v6.0.2
Browse files Browse the repository at this point in the history
V6.0.2
  • Loading branch information
kagg-design committed Jul 26, 2023
2 parents 64cbabd + 7f19c86 commit 630d4d0
Show file tree
Hide file tree
Showing 9 changed files with 61 additions and 43 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 6.0.2 (26.07.2023) ##
* Fixed fatal error in admin_footer_text().

## 6.0.1 (26.07.2023) ##
* Fixed fatal error on System Info page with empty options.

Expand Down
4 changes: 2 additions & 2 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: 6.0.1
* Version: 6.0.2
* Requires at least: 5.1
* Requires PHP: 7.0.0
* Author: Sergey Biryukov, Mikhail Kobzarev, Igor Gergel
Expand Down Expand Up @@ -43,7 +43,7 @@
/**
* Plugin version.
*/
define( 'CYR_TO_LAT_VERSION', '6.0.1' );
define( 'CYR_TO_LAT_VERSION', '6.0.2' );

/**
* Path to the plugin dir.
Expand Down
5 changes: 4 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.1
Stable tag: 6.0.2
Requires PHP: 7.0.0
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Expand Down Expand Up @@ -221,6 +221,9 @@ Yes you can!

== Changelog ==

= 6.0.2 (26.07.2023) =
* Fixed fatal error in admin_footer_text().

= 6.0.1 (26.07.2023) =
* Fixed fatal error on System Info page with empty options.

Expand Down
4 changes: 2 additions & 2 deletions src/php/BackgroundProcesses/PostConversionProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,9 @@ protected function complete() {
/**
* Filter post locale
*
* @return string
* @return string|mixed
*/
public function filter_post_locale(): string {
public function filter_post_locale() {
// This is common filter for WPML and Polylang, since Polylang supports wpml_post_language_details filter.
$wpml_post_language_details = apply_filters( 'wpml_post_language_details', false, $this->post->ID );

Expand Down
5 changes: 3 additions & 2 deletions src/php/BackgroundProcesses/TermConversionProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,14 @@ protected function complete() {
/**
* Filter term locale
*
* @return string
* @return string|mixed
* @noinspection PhpUndefinedFunctionInspection
*/
public function filter_term_locale(): string {
public function filter_term_locale() {
// Polylang filter.
if ( class_exists( 'Polylang' ) ) {
$pll_pll_get_term_language = pll_get_term_language( $this->term->term_taxonomy_id );

if ( false !== $pll_pll_get_term_language ) {
return $pll_pll_get_term_language;
}
Expand Down
55 changes: 32 additions & 23 deletions src/php/Main.php
Original file line number Diff line number Diff line change
Expand Up @@ -272,14 +272,16 @@ public function settings(): Settings {
/**
* Sanitize title.
*
* @param string $title Sanitized title.
* @param string $raw_title The title prior to sanitization.
* @param string $context The context for which the title is being sanitized.
* @param string|mixed $title Sanitized title.
* @param string|mixed $raw_title The title prior to sanitization.
* @param string|mixed $context The context for which the title is being sanitized.
*
* @return string
* @return string|mixed
* @noinspection PhpUnusedParameterInspection
* @noinspection PhpMissingReturnTypeInspection
* @noinspection ReturnTypeCanBeDeclaredInspection
*/
public function sanitize_title( string $title, string $raw_title = '', string $context = '' ): string {
public function sanitize_title( $title, $raw_title = '', $context = '' ) {
global $wpdb;

if (
Expand All @@ -295,7 +297,7 @@ public function sanitize_title( string $title, string $raw_title = '', string $c
return $title;
}

$title = urldecode( $title );
$title = urldecode( (string) $title );
$pre = apply_filters( 'ctl_pre_sanitize_title', false, $title );

if ( false !== $pre ) {
Expand Down Expand Up @@ -384,19 +386,23 @@ protected function is_wc_attribute_taxonomy( string $title ): bool {
/**
* Sanitize filename.
*
* @param string $filename Sanitized filename.
* @param string $filename_raw The filename prior to sanitization.
* @param string|mixed $filename Sanitized filename.
* @param string|mixed $filename_raw The filename prior to sanitization.
*
* @return string
* @noinspection PhpUnusedParameterInspection
* @noinspection PhpMissingReturnTypeInspection
* @noinspection ReturnTypeCanBeDeclaredInspection
*/
public function sanitize_filename( string $filename, string $filename_raw ): string {
public function sanitize_filename( $filename, $filename_raw ) {
$pre = apply_filters( 'ctl_pre_sanitize_filename', false, $filename );

if ( false !== $pre ) {
return $pre;
}

$filename = (string) $filename;

if ( seems_utf8( $filename ) ) {
$filename = (string) Mbstring::mb_strtolower( $filename );
}
Expand Down Expand Up @@ -528,13 +534,13 @@ private function is_gutenberg_editor_active(): bool {
/**
* Gutenberg support
*
* @param array $data An array of slashed post data.
* @param array $postarr An array of sanitized, but otherwise unmodified post data.
* @param array|mixed $data An array of slashed post data.
* @param array|mixed $postarr An array of sanitized, but otherwise unmodified post data.
*
* @return array
* @return array|mixed
* @noinspection PhpUnusedParameterInspection
*/
public function sanitize_post_name( array $data, array $postarr = [] ): array {
public function sanitize_post_name( $data, $postarr = [] ) {
global $current_screen;

if ( ! $this->is_gutenberg_editor_active() ) {
Expand Down Expand Up @@ -562,7 +568,7 @@ public function sanitize_post_name( array $data, array $postarr = [] ): array {
* @param string|int|WP_Error $term The term name to add, or a WP_Error object if there's an error.
* @param string $taxonomy Taxonomy slug.
*
* @return string|int
* @return string|int|WP_Error
*/
public function pre_insert_term_filter( $term, string $taxonomy ) {
if (
Expand All @@ -582,10 +588,12 @@ public function pre_insert_term_filter( $term, string $taxonomy ) {
/**
* Filters the terms query arguments.
*
* @param array $args An array of get_terms() arguments.
* @param string[] $taxonomies An array of taxonomy names.
* @param array|mixed $args An array of get_terms() arguments.
* @param string[] $taxonomies An array of taxonomy names.
*
* @return array|mixed
*/
public function get_terms_args_filter( array $args, array $taxonomies ): array {
public function get_terms_args_filter( $args, array $taxonomies ) {
$this->is_term = true;
$this->taxonomies = $taxonomies;

Expand All @@ -595,16 +603,17 @@ public function get_terms_args_filter( array $args, array $taxonomies ): array {
/**
* Locale filter for Polylang.
*
* @param string $locale Locale.
* @param string|mixed $locale Locale.
*
* @return string
* @return string|mixed
*/
public function pll_locale_filter( string $locale ) {
public function pll_locale_filter( $locale ) {
if ( $this->pll_locale ) {
return $this->pll_locale;
}

$rest_locale = $this->pll_locale_filter_with_rest();

if ( false === $rest_locale ) {
return $locale;
}
Expand Down Expand Up @@ -732,11 +741,11 @@ private function pll_locale_filter_with_term() {
/**
* Locale filter for WPML.
*
* @param string $locale Locale.
* @param string|mixed $locale Locale.
*
* @return string
* @return string|mixed
*/
public function wpml_locale_filter( string $locale ): string {
public function wpml_locale_filter( $locale ) {
if ( $this->wpml_locale ) {
return $this->wpml_locale;
}
Expand Down
14 changes: 8 additions & 6 deletions src/php/Settings/Abstracts/SettingsBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -270,21 +270,22 @@ protected function is_tab(): bool {
/**
* Add link to plugin setting page on plugins page.
*
* @param array $actions An array of plugin action links.
* By default, this can include 'activate', 'deactivate', and 'delete'.
* With Multisite active this can also include 'network_active' and 'network_only' items.
* @param array|mixed $actions An array of plugin action links.
* By default, this can include 'activate', 'deactivate', and 'delete'.
* With Multisite active this can also include 'network_active' and 'network_only'
* items.
*
* @return array|string[] Plugin links
*/
public function add_settings_link( array $actions ): array {
public function add_settings_link( $actions ): array {
$new_actions = [
'settings' =>
'<a href="' . admin_url( $this->parent_slug() . '?page=' . $this->option_page() ) .
'" aria-label="' . esc_attr( $this->settings_link_label() ) . '">' .
esc_html( $this->settings_link_text() ) . '</a>',
];

return array_merge( $new_actions, $actions );
return array_merge( $new_actions, (array) $actions );
}

/**
Expand All @@ -306,7 +307,7 @@ protected function init_settings() {
$settings_exist = is_array( $this->settings );
$this->settings = (array) $this->settings;
$form_fields = $this->form_fields();
$network_wide_setting = array_key_exists( self::NETWORK_WIDE, (array) $this->settings ) ?
$network_wide_setting = array_key_exists( self::NETWORK_WIDE, $this->settings ) ?
$this->settings[ self::NETWORK_WIDE ] :
$network_wide;
$this->settings[ self::NETWORK_WIDE ] = $network_wide_setting;
Expand Down Expand Up @@ -600,6 +601,7 @@ protected function wp_parse_str( string $input_string ): array {
* Get tabs.
*
* @return array
* @noinspection PhpUnused
*/
public function get_tabs(): array {
return $this->tabs;
Expand Down
12 changes: 6 additions & 6 deletions src/php/Settings/PluginSettingsBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,11 @@ class="ctl-<?php echo esc_attr( $this->section_title() ); ?>"
/**
* When user is on the plugin admin page, display footer text that graciously asks them to rate us.
*
* @param string $text Footer text.
* @param string|mixed $text Footer text.
*
* @return string
* @return string|mixed
*/
public function admin_footer_text( string $text ): string {
public function admin_footer_text( $text ) {
if ( ! $this->is_options_screen() ) {
return $text;
}
Expand Down Expand Up @@ -217,11 +217,11 @@ public function admin_footer_text( string $text ): string {
/**
* Show plugin version in the update footer.
*
* @param string $content The content that will be printed.
* @param string|mixed $content The content that will be printed.
*
* @return string
* @return string|mixed
*/
public function update_footer( string $content ): string {
public function update_footer( $content ) {
if ( ! $this->is_options_screen() ) {
return $content;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
/**
* Plugin version.
*/
const CYR_TO_LAT_TEST_VERSION = '6.0.1';
const CYR_TO_LAT_TEST_VERSION = '6.0.2';

/**
* Path to the plugin dir.
Expand Down

0 comments on commit 630d4d0

Please sign in to comment.