Make WordPress Core

Opened 10 years ago

Closed 8 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 9 years ago.

Download all attachments as: .zip

Change History (6)

@voldemortensen
9 years ago

#1 @voldemortensen
9 years ago

  • Keywords has-patch added

#2 @voldemortensen
9 years ago

Added patch with i18n friendly version of dirname.

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


8 years ago

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


8 years ago

#5 @SergeyBiryukov
8 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.