WordPress.org

Make WordPress Core


Ignore:
Timestamp:
05/27/2008 05:46:01 PM (14 years ago)
Author:
ryan
Message:

First cut and better admin SSL support. see #7001

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/link-template.php

    r7955 r7998  
    775775    return apply_filters('shortcut_link', $link);
    776776}
     777
     778// return the site_url option, using https if is_ssl() is true
     779// if $scheme is 'http' or 'https' it will override is_ssl()
     780function site_url($path = '', $scheme = null) {
     781    // should the list of allowed schemes be maintained elsewhere?
     782    if ( !in_array($scheme, array('http', 'https')) )
     783        $scheme = ( is_ssl() ? 'https' : 'http' );
     784
     785    $url = str_replace( 'http://', "{$scheme}://", get_option('siteurl') );
     786
     787    if ( !empty($path) && is_string($path) && strpos($path, '..') === false )
     788        $url .= '/' . ltrim($path, '/');
     789
     790    return $url;
     791}
     792
     793function admin_url($path = '') {
     794    global $_wp_admin_url;
     795
     796    $url = site_url() . '/wp-admin/';
     797
     798    if ( !empty($path) && is_string($path) && strpos($path, '..') === false )
     799        $url .= ltrim($path, '/');
     800
     801    return $url;
     802}
     803
     804function includes_url($path = '') {
     805    global $_wp_includes_url;
     806
     807    $url = site_url() . '/' . WPINC . '/';
     808
     809    if ( !empty($path) && is_string($path) && strpos($path, '..') === false )
     810        $url .= ltrim($path, '/');
     811
     812    return $url;
     813}
     814
    777815?>
Note: See TracChangeset for help on using the changeset viewer.