plugins_url()

git-svn-id: http://svn.automattic.com/wordpress/trunk@8334 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2008-07-15 00:10:07 +00:00
parent 4460d7efc9
commit 9ce9fec7c4
1 changed files with 25 additions and 0 deletions

View File

@ -871,4 +871,29 @@ function content_url($path = '') {
return $url; 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;
}
?> ?>