Skip to content

Commit

Permalink
commit v2.3.2
Browse files Browse the repository at this point in the history
* date: November 27, 2023
* last security fix introduced problem where spaces in Title where no longer replaced by hyphens, this version brings back those hyphens ([issue 23](#23) thanks for pointing it out @nhimthaoan)
  • Loading branch information
senlin committed Nov 27, 2023
1 parent 486eb6c commit 1ffa191
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 7 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![plugin version](https://img.shields.io/wordpress/plugin/v/so-pinyin-slugs.svg)](https://wordpress.org/plugins/so-pinyin-slugs) [![WP compatibility](https://plugintests.com/plugins/so-pinyin-slugs/wp-badge.svg)](https://plugintests.com/plugins/so-pinyin-slugs/latest) [![PHP compatibility](https://plugintests.com/plugins/so-pinyin-slugs/php-badge.svg)](https://plugintests.com/plugins/so-pinyin-slugs/latest)

###### Last updated on November 23, 2023
###### Last updated on November 27, 2023
###### tested up to WP 6.4
###### Authors: [Pieter Bos](https://github.com/senlin)
###### [Stable Version](https://wordpress.org/plugins/so-pinyin-slugs) (via WordPress Plugins Repository)
Expand Down Expand Up @@ -75,6 +75,11 @@ This repo is open to _any_ kind of contributions.

## Changelog

### 2.3.2

* date: November 27, 2023
* last security fix introduced problem where spaces in Title where no longer replaced by hyphens, this version brings back those hyphens ([issue 23](https://github.com/senlin/pinyin-slugs/issues/23) thanks for pointing it out @nhimthaoan)

### 2.3.1

* date: November 23, 2023
Expand Down
9 changes: 6 additions & 3 deletions inc/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* and return the slug in Pinyin when true
*
* since version 2.0.0
* @modified 2.3.1
* @modified 2.3.2
*/

function getPinyinSlug( $strTitle ) {
Expand Down Expand Up @@ -58,10 +58,13 @@ function getPinyinSlug( $strTitle ) {
$strRet = $origStrTitle;
}

// Validate the output
// Replace spaces with hyphens
$strRet = str_replace(' ', '-', $strRet);

// Sanitize the slug: allow only alphanumeric, hyphens, and underscores
$strRet = preg_replace('/[^A-Za-z0-9-_]/', '', $strRet);

// Return the sanitized slug
return $strRet;
}

}
7 changes: 6 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Contributors: senlin
Tags: pinyin, permalinks, slugs, Mandarin, Chinese, traditional, simplified
Requires at least: 4.4
Tested up to: 6.4
Stable tag: 2.3.1
Stable tag: 2.3.2
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -79,6 +79,11 @@ Please open an issue over at [Github](https://github.com/senlin/so-pinyin-slugs/

== Changelog ==

= 2.3.2 =

* date: November 27, 2023
* last security fix introduced problem where spaces in Title where no longer replaced by hyphens, this version brings back those hyphens ([issue 23](https://github.com/senlin/pinyin-slugs/issues/23) thanks for pointing it out @nhimthaoan)

= 2.3.1 =

* date: November 23, 2023
Expand Down
4 changes: 2 additions & 2 deletions so-pinyin-slugs.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Plugin URI: https://so-wp.com/plugin/pinyin-slugs
Description: Transforms Simplified or Traditional Chinese character titles into Pinyin to create a permalink friendly slug.
Author: SO WP
Version: 2.3.1
Version: 2.3.2
Author URI: https://so-wp.com
Text Domain: so-pinyin-slugs
*/
Expand Down Expand Up @@ -84,7 +84,7 @@ function init() {
function constants() {

/* Set the version number of the plugin. */
define( 'SOPS_VERSION', '2.3.1' );
define( 'SOPS_VERSION', '2.3.2' );

/* Set constant path to the plugin directory. */
define( 'SOPS_DIR', trailingslashit( plugin_dir_path( __FILE__ ) ) );
Expand Down

0 comments on commit 1ffa191

Please sign in to comment.