Make WordPress Core

Changeset 8334


Ignore:
Timestamp:
07/15/2008 12:10:07 AM (16 years ago)
Author:
ryan
Message:

plugins_url()

File:
1 edited

Legend:

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

    r8333 r8334  
    872872}
    873873
     874/** Return the plugins url
     875 *
     876 *
     877 * @package WordPress
     878 * @since 2.6
     879 *
     880 * Returns the url to the plugins directory
     881 *
     882 * @param string $path Optional path relative to the plugins url
     883 * @return string Plugins url link with optional path appended
     884*/
     885function plugins_url($path = '') {
     886    $scheme = ( is_ssl() ? 'https' : 'http' );
     887    $url = WP_PLUGIN_URL;
     888    if ( 0 === strpos($url, 'http') ) {
     889        if ( is_ssl() )
     890            $url = str_replace( 'http://', "{$scheme}://", $url );
     891    }
     892
     893    if ( !empty($path) && is_string($path) && strpos($path, '..') === false )
     894        $url .= '/' . ltrim($path, '/');
     895
     896    return $url;
     897}
     898
    874899?>
Note: See TracChangeset for help on using the changeset viewer.