Ticket #3048: 3048.01.patch
File 3048.01.patch, 3.1 KB (added by , 8 years ago) |
---|
-
src/includes/core/template-functions.php
158 158 159 159 // Enqueue if located 160 160 if ( ! empty( $located ) ) { 161 // Calculate canonical plugins directory. 162 // Why doesn't WP have a plugins_dir() function? 163 $plugins_dir = realpath( bbpress()->plugin_dir . '../' ); 161 164 162 $content_dir = constant( 'WP_CONTENT_DIR' ); 163 164 // IIS (Windows) here 165 // Replace back slashes with forward slash 166 if ( strpos( $located, '\\' ) !== false ) { 167 $located = str_replace( '\\', '/', $located ); 168 $content_dir = str_replace( '\\', '/', $content_dir ); 165 // Hello bbPress developer! 166 if ( false !== strpos( wp_normalize_path( bbpress()->file ), '/src/' ) || false !== strpos( wp_normalize_path( bbpress()->file ), '/build/' ) ) { 167 $plugins_dir = realpath( $plugins_dir . '/../' ); 169 168 } 170 169 170 // Be nice to Windows devs. 171 $located = wp_normalize_path( $located ); 172 $plugins_dir = wp_normalize_path( $plugins_dir ); 173 $stylesheet_dir = wp_normalize_path( get_stylesheet_directory() ); 174 $template_dir = wp_normalize_path( get_template_directory() ); 175 171 176 // Make path to file relative to site URL 172 $located = str_replace( $content_dir, content_url(), $located ); 177 $located = str_replace( $plugins_dir, plugin_dir_url( '' ), $located ); 178 $located = str_replace( $stylesheet_dir, get_stylesheet_directory_uri(), $located ); 179 $located = str_replace( $template_dir, get_template_directory_uri(), $located ); 173 180 174 181 // Enqueue the style 175 182 wp_enqueue_style( $handle, $located, $deps, $ver, $media ); … … 226 233 227 234 // Enqueue if located 228 235 if ( ! empty( $located ) ) { 236 // Calculate canonical plugins directory. 237 // Why doesn't WP have a plugins_dir() function? 238 $plugins_dir = realpath( bbpress()->plugin_dir . '../' ); 229 239 230 $content_dir = constant( 'WP_CONTENT_DIR' ); 231 232 // IIS (Windows) here 233 // Replace back slashes with forward slash 234 if ( strpos( $located, '\\' ) !== false ) { 235 $located = str_replace( '\\', '/', $located ); 236 $content_dir = str_replace( '\\', '/', $content_dir ); 240 // Hello bbPress developer! 241 if ( false !== strpos( wp_normalize_path( bbpress()->file ), '/src/' ) || false !== strpos( wp_normalize_path( bbpress()->file ), '/build/' ) ) { 242 $plugins_dir = realpath( $plugins_dir . '/../' ); 237 243 } 238 244 245 // Be nice to Windows devs. 246 $located = wp_normalize_path( $located ); 247 $plugins_dir = wp_normalize_path( $plugins_dir ); 248 $stylesheet_dir = wp_normalize_path( get_stylesheet_directory() ); 249 $template_dir = wp_normalize_path( get_template_directory() ); 250 239 251 // Make path to file relative to site URL 240 $located = str_replace( $content_dir, content_url(), $located ); 252 $located = str_replace( $plugins_dir, plugin_dir_url( '' ), $located ); 253 $located = str_replace( $stylesheet_dir, get_stylesheet_directory_uri(), $located ); 254 $located = str_replace( $template_dir, get_template_directory_uri(), $located ); 241 255 242 256 // Enqueue the style 243 257 wp_enqueue_script( $handle, $located, $deps, $ver, $in_footer );