mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-03 06:57:35 +01:00
new function: untrailingslashit(). fixes #3899
git-svn-id: http://svn.automattic.com/wordpress/trunk@5020 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
05486cce3d
commit
de23b425c3
@ -563,12 +563,15 @@ function backslashit($string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function trailingslashit($string) {
|
function trailingslashit($string) {
|
||||||
if ( '/' != substr($string, -1)) {
|
if ( '/' != substr($string, -1))
|
||||||
$string .= '/';
|
$string .= '/';
|
||||||
}
|
|
||||||
return $string;
|
return $string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function untrailingslashit($string) {
|
||||||
|
return preg_replace('|/+$|', '', $string);
|
||||||
|
}
|
||||||
|
|
||||||
function addslashes_gpc($gpc) {
|
function addslashes_gpc($gpc) {
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ function user_trailingslashit($string, $type_of_url = '') {
|
|||||||
if ( $wp_rewrite->use_trailing_slashes )
|
if ( $wp_rewrite->use_trailing_slashes )
|
||||||
$string = trailingslashit($string);
|
$string = trailingslashit($string);
|
||||||
else
|
else
|
||||||
$string = preg_replace('|/+$|', '', $string); // untrailing slash
|
$string = untrailingslashit($string);
|
||||||
|
|
||||||
// Note that $type_of_url can be one of following:
|
// Note that $type_of_url can be one of following:
|
||||||
// single, single_trackback, single_feed, single_paged, feed, category, page, year, month, day, paged
|
// single, single_trackback, single_feed, single_paged, feed, category, page, year, month, day, paged
|
||||||
|
Loading…
Reference in New Issue
Block a user