WordPress.org

Make WordPress Core

Changeset 11069


Ignore:
Timestamp:
04/23/09 08:16:06 (5 years ago)
Author:
azaozz
Message:

Make plugin_dir() and plugin_basename() work for mu-plugins directory, props Denis-de-Bernardy, fixes #9561

Location:
trunk/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/link-template.php

    r11062 r11069  
    17761776function plugins_url($path = '', $plugin = '') { 
    17771777    $scheme = ( is_ssl() ? 'https' : 'http' ); 
    1778     $url = WP_PLUGIN_URL; 
     1778 
     1779    if ( $plugin !== '' && preg_match('#^' . preg_quote(WPMU_PLUGIN_DIR . DIRECTORY_SEPARATOR, '#') . '#', $plugin) ) { 
     1780        $url = WPMU_PLUGIN_URL; 
     1781    } else { 
     1782        $url = WP_PLUGIN_URL; 
     1783    } 
     1784 
    17791785    if ( 0 === strpos($url, 'http') ) { 
    17801786        if ( is_ssl() ) 
     
    17821788    } 
    17831789 
    1784     if ( !empty($plugin) && is_string($plugin) ) 
    1785     { 
     1790    if ( !empty($plugin) && is_string($plugin) ) { 
    17861791        $folder = dirname(plugin_basename($plugin)); 
    17871792        if ('.' != $folder) 
  • trunk/wp-includes/plugin.php

    r10765 r11069  
    493493    $plugin_dir = str_replace('\\','/',WP_PLUGIN_DIR); // sanitize for Win32 installs 
    494494    $plugin_dir = preg_replace('|/+|','/', $plugin_dir); // remove any duplicate slash 
    495     $file = preg_replace('|^' . preg_quote($plugin_dir, '|') . '/|','',$file); // get relative path from plugins dir 
     495    $mu_plugin_dir = str_replace('\\','/',WPMU_PLUGIN_DIR); // sanitize for Win32 installs 
     496    $mu_plugin_dir = preg_replace('|/+|','/', $mu_plugin_dir); // remove any duplicate slash 
     497    $file = preg_replace('#^' . preg_quote($plugin_dir, '#') . '|^' . preg_quote($mu_plugin_dir, '#') . '/#','',$file); // get relative path from plugins dir 
    496498    return $file; 
    497499} 
Note: See TracChangeset for help on using the changeset viewer.