WordPress.org

Make WordPress Core

Ticket #6341: 6341.diff

File 6341.diff, 1018 bytes (added by Denis-de-Bernardy, 9 years ago)

works with dolly and plugins in a subfolder

  • Users/denis/Sites/sem-pro/wp-includes/link-template.php

     
    15211521        return $url;
    15221522}
    15231523
     1524/**
     1525 * Retrieve the url to an individual plugin.
     1526 *
     1527 * @package WordPress
     1528 * @since 2.8.0
     1529 *
     1530 * @param string $plugin. The plugin's file, i.e. __FILE__.
     1531 * @return string the plugin's url link (without a trailing slash).
     1532*/
     1533function plugin_url($plugin) {
     1534        static $plugins_url;
     1535       
     1536        if ( !isset($plugins_url) ) {
     1537                $plugins_url = plugins_url();
     1538        }
     1539       
     1540        $plugin = dirname($plugin);
     1541       
     1542        // special: check if plugin is residing in a folder called plugin
     1543        if ( basename($plugin) == basename($plugins_url) && basename(dirname($plugin)) != basename($plugins_url) ) {
     1544                $url = $plugins_url;
     1545        } else {
     1546                $url = $plugins_url . '/' .  basename($plugin);
     1547        }
     1548
     1549        return $url;
     1550}
     1551
    15241552?>