Make WordPress Core


Ignore:
Timestamp:
05/27/2008 05:55:24 PM (14 years ago)
Author:
ryan
Message:

Allow wp-content to exist outside of webroot. Props sambauers. see #6938

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/plugin.php

    r6726 r7999  
    435435 * plugin_basename() - Gets the basename of a plugin.
    436436 *
    437  * This method extract the name of a plugin from its filename.
     437 * This method extracts the name of a plugin from its filename.
    438438 *
    439439 * @package WordPress
     
    445445 * @param string $file The filename of plugin.
    446446 * @return string The name of a plugin.
     447 * @uses WP_PLUGIN_DIR
    447448 */
    448449function plugin_basename($file) {
    449450    $file = str_replace('\\','/',$file); // sanitize for Win32 installs
    450451    $file = preg_replace('|/+|','/', $file); // remove any duplicate slash
    451     $file = preg_replace('|^.*/' . PLUGINDIR . '/|','',$file); // get relative path from plugins dir
     452    $plugin_dir = str_replace('\\','/',WP_PLUGIN_DIR); // sanitize for Win32 installs
     453    $plugin_dir = preg_replace('|/+|','/', $plugin_dir); // remove any duplicate slash
     454    $file = preg_replace('|^' . preg_quote($plugin_dir, '|') . '/|','',$file); // get relative path from plugins dir
    452455    return $file;
    453456}
Note: See TracChangeset for help on using the changeset viewer.