plugins_url()

git-svn-id: https://develop.svn.wordpress.org/trunk@8334 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2008-07-15 00:10:07 +00:00
parent b8824f4057
commit fcd681da15
1 changed files with 25 additions and 0 deletions

View File

@ -871,4 +871,29 @@ function content_url($path = '') {
return $url;
}
/** Return the plugins url
*
*
* @package WordPress
* @since 2.6
*
* Returns the url to the plugins directory
*
* @param string $path Optional path relative to the plugins url
* @return string Plugins url link with optional path appended
*/
function plugins_url($path = '') {
$scheme = ( is_ssl() ? 'https' : 'http' );
$url = WP_PLUGIN_URL;
if ( 0 === strpos($url, 'http') ) {
if ( is_ssl() )
$url = str_replace( 'http://', "{$scheme}://", $url );
}
if ( !empty($path) && is_string($path) && strpos($path, '..') === false )
$url .= '/' . ltrim($path, '/');
return $url;
}
?>