Make WordPress Core

Opened 11 years ago

Closed 9 years ago

#27801 closed enhancement (wontfix)

`wp_dirname()` to match `wp_basename()`

Reported by: denis-de-bernardy's profile Denis-de-Bernardy Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.9
Component: I18N Keywords: has-patch
Focuses: Cc:

Description

There's an i18n friendly wp_basename() function in core. Perhaps we should also add an i18n friendly version of dirname() to match it?

/**
 * i18n friendly version of dirname()
 *
 * @since 3.9.0
 *
 * @param string $path A path.
 * @return string
 */
function wp_dirname( $path ) {
	return urldecode( dirname( str_replace( array( '%2F', '%5C' ), '/', urlencode( $path ) ) ) );
}

References: #11887, #21217, #23267, etc.

https://core.trac.wordpress.org/search?q=wp_basename

Attachments (1)

27801.diff (661 bytes) - added by voldemortensen 10 years ago.

Download all attachments as: .zip

Change History (6)

#1 @voldemortensen
10 years ago

  • Keywords has-patch added

#2 @voldemortensen
10 years ago

Added patch with i18n friendly version of dirname.

This ticket was mentioned in Slack in #core-i18n by ocean90. View the logs.


9 years ago

This ticket was mentioned in Slack in #core-i18n by ocean90. View the logs.


9 years ago

#5 @SergeyBiryukov
9 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed

wp_dirname() might be handy if we display non-ASCII directory names somewhere, but apparently it doesn't have a particular use case in core right now.

Feel free to reopen if there's a use case.

Note: See TracTickets for help on using tickets.