[wp-trac] [WordPress Trac] #29726: Mixed Backward and Forward Slashes
WordPress Trac
noreply at wordpress.org
Mon Sep 22 11:43:36 UTC 2014
#29726: Mixed Backward and Forward Slashes
--------------------------+-----------------------------
Reporter: cyberwani | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: trunk
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
Some functions used to get the directory path giving result with mixed
backward and forward slashes in Windows. List given here below:
{{{#!php
get_template_directory():
D:\wamp\www\wp4/wp-content/themes/potenzabase
}}}
{{{#!php
get_stylesheet_directory():
D:\wamp\www\wp4/wp-content/themes/potenzabase
}}}
{{{#!php
get_theme_root():
D:\wamp\www\wp4/wp-content/themes
}}}
{{{#!php
plugin_dir_path():
D:\wamp\www\wp4\wp-content\themes\potenzabase\includes\cpt/
}}}
{{{#!php
wp_upload_dir():
Array
(
[path] => D:\wamp\www\wp4/wp-content/uploads/2014/09
[url] => http://192.168.22.201/wp4/wp-content/uploads/2014/09
[subdir] => /2014/09
[basedir] => D:\wamp\www\wp4/wp-content/uploads
[baseurl] => http://192.168.22.201/wp4/wp-content/uploads
[error] =>
)
}}}
This function can fix the slashes.
{{{#!php
function fixslash($path){
$sep = DIRECTORY_SEPARATOR;
if( $ds == '/' ){
$fix_sep = '\\';
}elseif( $ds == '\\' ){
$fix_sep = '/';
}
$path = str_replace($fix_sep,$sep,$path);
return $path;
}
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/29726>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list