[wp-trac] [WordPress Trac] #19388: plugin_basename returns full directory in URL

WordPress Trac wp-trac at lists.automattic.com
Tue Nov 29 00:36:37 UTC 2011


#19388: plugin_basename returns full directory in URL
---------------------------+-----------------------------
 Reporter:  damianzaremba  |      Owner:
     Type:  enhancement    |     Status:  new
 Priority:  normal         |  Milestone:  Awaiting Review
Component:  Plugins        |    Version:  3.3
 Severity:  minor          |   Keywords:  has-patch
---------------------------+-----------------------------
 If a trailing slash is specified on either then WP_PLUGIN_DIR or
 WPMU_PLUGIN_DIR settings, the plugin_basename function returns the whole
 directory path in the URL.

 The documentation does state not to use a trailing slash, however I think
 this function could be improved.

 By removing the explicit / in the preg_replace the correct plugin name
 will be returned even if a trailing slash is specified on the
 WP_PLUGIN_DIR or WPMU_PLUGIN_DIR constants.

 This should not affect the relative path as the trim before the return
 takes care of stripping off the first slash if it exists (effectively
 duplicating the remove in this case).

 While this is a very trivial change that won't affect most people (who
 read the docs properly) it was quite annoying to track down.

 Please see the attached diff.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/19388>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list