[wp-trac] [WordPress Trac] #22267: Add optional boolean argument to trailingslashit() and untrailingslashit()

WordPress Trac noreply at wordpress.org
Wed Oct 24 04:28:11 UTC 2012


#22267: Add optional boolean argument to trailingslashit() and untrailingslashit()
-------------------------+------------------------------
 Reporter:  knutsp       |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  Filesystem   |     Version:  2.2
 Severity:  normal       |  Resolution:
 Keywords:  2nd-opinion  |
-------------------------+------------------------------

Comment (by dd32):

 to just pull one example out of the above:
 > ` trailingslashit( 'C://TEMP//',true ) == 'C://TEMP\' // On Windows`
 There's no technical reason why when trailingslashit we need to use
 `DIRECTORY_SEPARATOR `, for most intents, using / will work perfectly fine
 as you've pointed out.

 But, I'd rather we didn't use `DIRECTORY_SEPARATOR` at all and
 standardised on `/` like we already have. In some parts of the code, we
 already do a `str_replace( '\\', '/', $path)` to work around windows paths
 being different.

 There are few times when we need a native "windows style" path, and given
 windows will accept either form (including within the address bar in
 windows explorer) it seems safe to just use *nix paths throughout.

 I think we could potentially also make the assumption that
 untrailingslashit() should always remove trailing `/` and `\` from the
 given string instead of adding complexity to it.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/22267#comment:2>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list