Ticket #22267: 22267.b.patch
File 22267.b.patch, 1.4 KB (added by , 11 years ago) |
---|
-
formatting.php
1360 1360 * @uses untrailingslashit() Unslashes string if it was slashed already. 1361 1361 * 1362 1362 * @param string $string What to add the trailing slash to. 1363 * @param bool $is_path Optional. Is $string to be considered to be a file path? When true will first remove both / and \ on Windows, but / is always added. Default is false. 1363 1364 * @return string String with trailing slash added. 1364 1365 */ 1365 function trailingslashit($string) { 1366 return untrailingslashit($string) . '/'; 1366 function trailingslashit( $string, $is_path = false ) { 1367 if ( $is_path ) 1368 return untrailingslashit( $string, $is_path ) . '/'; 1369 else 1370 return untrailingslashit( $string ) . '/'; 1367 1371 } 1368 1372 1369 1373 /** … … 1375 1379 * @since 2.2.0 1376 1380 * 1377 1381 * @param string $string What to remove the trailing slash from. 1382 * @param bool $is_path Optional. Is $string to be considered to be a file path? When true, will remove both slashes and backslashes on Windows. Default is false. 1378 1383 * @return string String without the trailing slash. 1379 1384 */ 1380 function untrailingslashit($string) { 1381 return rtrim($string, '/'); 1385 function untrailingslashit( $string, $is_path = false ) { 1386 if ( $is_path ) 1387 return rtrim( $string, DIRECTORY_SEPARATOR . '/' ); 1388 else 1389 return rtrim( $string, '/'); 1382 1390 } 1383 1391 1384 1392 /**