WordPress.org

Make WordPress Core

Ticket #19200: 19200.patch

File 19200.patch, 938 bytes (added by ramiy, 7 years ago)

upload_url()

  • link-template.php

     
    20522052}
    20532053
    20542054/**
     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*/
     2063function 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/**
    20552076 * Retrieve the site url for the current network.
    20562077 *
    20572078 * Returns the site url with the appropriate protocol, 'https' if