| | 2055 | * Retrieve the url to the upload directory. |
| | 2056 | * |
| | 2057 | * @package WordPress |
| | 2058 | * @since 3.3.0 |
| | 2059 | * |
| | 2060 | * @param string $path Optional. Path relative to the upload url. |
| | 2061 | * @return string Upload url link with optional path appended. |
| | 2062 | */ |
| | 2063 | function upload_url($path = '') { |
| | 2064 | $upload_dir = wp_upload_dir(); |
| | 2065 | $url = $upload_dir['baseurl']; |
| | 2066 | if ( 0 === strpos($url, 'http') && is_ssl() ) |
| | 2067 | $url = str_replace( 'http://', 'https://', $url ); |
| | 2068 | |
| | 2069 | if ( !empty($path) && is_string($path) && strpos($path, '..') === false ) |
| | 2070 | $url .= '/' . ltrim($path, '/'); |
| | 2071 | |
| | 2072 | return apply_filters('upload_url', $url, $path); |
| | 2073 | } |
| | 2074 | |
| | 2075 | /** |