mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 14:20:15 +00:00
Strip backslashes, not just forward slashes, from untrailingslashit().
trailingslashit() will now remove any forward or backslashes from the end of a string before appending a forward slash. props knutsp, willmot. fixes #22267. git-svn-id: https://develop.svn.wordpress.org/trunk@27344 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -1482,35 +1482,34 @@ function backslashit($string) {
|
||||
/**
|
||||
* Appends a trailing slash.
|
||||
*
|
||||
* Will remove trailing slash if it exists already before adding a trailing
|
||||
* slash. This prevents double slashing a string or path.
|
||||
* Will remove trailing forward and backslashes if it exists already before adding
|
||||
* a trailing forward slash. This prevents double slashing a string or path.
|
||||
*
|
||||
* The primary use of this is for paths and thus should be used for paths. It is
|
||||
* not restricted to paths and offers no specific path support.
|
||||
*
|
||||
* @since 1.2.0
|
||||
* @uses untrailingslashit() Unslashes string if it was slashed already.
|
||||
*
|
||||
* @param string $string What to add the trailing slash to.
|
||||
* @return string String with trailing slash added.
|
||||
*/
|
||||
function trailingslashit($string) {
|
||||
return untrailingslashit($string) . '/';
|
||||
function trailingslashit( $string ) {
|
||||
return untrailingslashit( $string ) . '/';
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes trailing slash if it exists.
|
||||
* Removes trailing forward slashes and backslashes if they exist.
|
||||
*
|
||||
* The primary use of this is for paths and thus should be used for paths. It is
|
||||
* not restricted to paths and offers no specific path support.
|
||||
*
|
||||
* @since 2.2.0
|
||||
*
|
||||
* @param string $string What to remove the trailing slash from.
|
||||
* @return string String without the trailing slash.
|
||||
* @param string $string What to remove the trailing slashes from.
|
||||
* @return string String without the trailing slashes.
|
||||
*/
|
||||
function untrailingslashit($string) {
|
||||
return rtrim($string, '/');
|
||||
function untrailingslashit( $string ) {
|
||||
return rtrim( $string, '/\\' );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user