WordPress.org

Make WordPress Core

Ticket #19200: 19200c.patch

File 19200c.patch, 1.3 KB (added by ramiy, 6 years ago)

upload_url() + themes_url()

  • link-template.php

     
    20522052}
    20532053
    20542054/**
     2055 * Retrieve the url to the themes directory.
     2056 *
     2057 * @package WordPress
     2058 * @since 3.4.0
     2059 *
     2060 * @param string $path Optional. Path relative to the themes url.
     2061 * @return string Themes url link with optional path appended.
     2062*/
     2063function themes_url( $path = '' ) {
     2064        $url = get_theme_root_uri();
     2065
     2066        if ( !empty($path) && is_string($path) && strpos($path, '..') === false )
     2067                $url .= '/' . ltrim($path, '/');
     2068
     2069        return apply_filters( 'themes_url', $url, $path );
     2070}
     2071
     2072 * Retrieve the url to the upload directory.
     2073 *
     2074 * @package WordPress
     2075 * @since 3.4.0
     2076 *
     2077 * @param string $path Optional. Path relative to the upload url.
     2078 * @return string Upload url link with optional path appended.
     2079*/
     2080function upload_url( $path = '' ) {
     2081        $upload_dir = wp_upload_dir();
     2082        $url = $upload_dir['baseurl'];
     2083
     2084        if ( !empty($path) && is_string($path) && strpos($path, '..') === false )
     2085                $url .= '/' . ltrim($path, '/');
     2086
     2087        return apply_filters( 'upload_url', $url, $path );
     2088}
     2089
     2090/**
    20552091 * Retrieve the site url for the current network.
    20562092 *
    20572093 * Returns the site url with the appropriate protocol, 'https' if