Opened 8 years ago
Closed 8 years ago
#37357 closed defect (bug) (fixed)
PHPDoc for wp_register_plugin_realpath is wrong
Reported by: | Zuige | Owned by: | DrewAPicture |
---|---|---|---|
Milestone: | 4.6 | Priority: | normal |
Severity: | normal | Version: | 3.9 |
Component: | Plugins | Keywords: | |
Focuses: | docs | Cc: |
Description
/** * Register a plugin's real path. * * This is used in plugin_basename() to resolve symlinked paths. * * @since 3.9.0 * * @see plugin_basename() * * @global array $wp_plugin_paths * * @staticvar string $wp_plugin_path * @staticvar string $wpmu_plugin_path * * @param string $file Known path to the file. * @return bool Whether the path was able to be registered. */
But plugin_basename()
doesn't use the method at all
function plugin_basename( $file ) { global $wp_plugin_paths; // $wp_plugin_paths contains normalized paths. $file = wp_normalize_path( $file ); arsort( $wp_plugin_paths ); foreach ( $wp_plugin_paths as $dir => $realdir ) { if ( strpos( $file, $realdir ) === 0 ) { $file = $dir . substr( $file, strlen( $realdir ) ); } } $plugin_dir = wp_normalize_path( WP_PLUGIN_DIR ); $mu_plugin_dir = wp_normalize_path( WPMU_PLUGIN_DIR ); $file = preg_replace('#^' . preg_quote($plugin_dir, '#') . '/|^' . preg_quote($mu_plugin_dir, '#') . '/#','',$file); / $file = trim($file, '/'); return $file; }
Change History (2)
Note: See
TracTickets for help on using
tickets.
In 38061: