Make WordPress Core

Changeset 8058


Ignore:
Timestamp:
06/06/2008 07:39:11 AM (18 years ago)
Author:
ryan
Message:

More use of site_url(), admin_url(), and site_url(). Force login and admin links to be https if FORCE_SSL_LOGIN. see #7001

Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/admin.php

    r7999 r8058  
    88
    99if ( get_option('db_version') != $wp_db_version ) {
    10         wp_redirect(get_option('siteurl') . '/wp-admin/upgrade.php?_wp_http_referer=' . urlencode(stripslashes($_SERVER['REQUEST_URI'])));
     10        wp_redirect(admin_url('upgrade.php?_wp_http_referer=' . urlencode(stripslashes($_SERVER['REQUEST_URI']))));
    1111        exit;
    1212}
  • trunk/wp-includes/general-template.php

    r7999 r8058  
    3434function wp_loginout() {
    3535        if ( ! is_user_logged_in() )
    36                 $link = '<a href="' . get_option('siteurl') . '/wp-login.php">' . __('Log in') . '</a>';
     36                $link = '<a href="' . site_url('wp-login.php', 'forceable') . '">' . __('Log in') . '</a>';
    3737        else
    38                 $link = '<a href="' . get_option('siteurl') . '/wp-login.php?action=logout">' . __('Log out') . '</a>';
     38                $link = '<a href="' . site_url('wp-login.php?action=logout', 'forceable') . '">' . __('Log out') . '</a>';
    3939
    4040        echo apply_filters('loginout', $link);
    … …  
    4646        if ( ! is_user_logged_in() ) {
    4747                if ( get_option('users_can_register') )
    48                         $link = $before . '<a href="' . get_option('siteurl') . '/wp-login.php?action=register">' . __('Register') . '</a>' . $after;
     48                        $link = $before . '<a href="' . site_url('wp-login.php?action=register', 'forceable') . '">' . __('Register') . '</a>' . $after;
    4949                else
    5050                        $link = '';
    5151        } else {
    52                 $link = $before . '<a href="' . get_option('siteurl') . '/wp-admin/">' . __('Site Admin') . '</a>' . $after;
     52                $link = $before . '<a href="' . admin_url() . '">' . __('Site Admin') . '</a>' . $after;
    5353        }
    5454
  • trunk/wp-includes/link-template.php

    r8000 r8058  
    751751                        var x=d.selection;
    752752                        var s=(e?e():(k)?k():(x?x.createRange().text:0));
    753                         var f='" . get_settings('siteurl') . '/wp-admin/press-this.php' . "';
     753                        var f='" . admin_url('press-this.php') . "';
    754754                        var l=d.location;
    755755                        var e=encodeURIComponent;
    … …  
    780780function site_url($path = '', $scheme = null) {
    781781        // should the list of allowed schemes be maintained elsewhere?
    782         if ( !in_array($scheme, array('http', 'https')) )
    783                 $scheme = ( is_ssl() ? 'https' : 'http' );
     782        if ( !in_array($scheme, array('http', 'https')) ) {
     783                if ( ('forceable' == $scheme) && (defined('FORCE_SSL_LOGIN') && FORCE_SSL_LOGIN) )
     784                        $scheme = 'https';
     785                else
     786                        $scheme = ( is_ssl() ? 'https' : 'http' );
     787        }
    784788
    785789        $url = str_replace( 'http://', "{$scheme}://", get_option('siteurl') );
    … …  
    794798        global $_wp_admin_url;
    795799
    796         $url = site_url() . '/wp-admin/';
     800        $url = site_url('wp-admin/', 'forceable');
    797801
    798802        if ( !empty($path) && is_string($path) && strpos($path, '..') === false )
  • trunk/wp-includes/pluggable.php

    r7998 r8058  
    644644        nocache_headers();
    645645
    646         $login_url = get_option('siteurl') . '/wp-login.php?redirect_to=' . urlencode($_SERVER['REQUEST_URI']);
    647 
    648         //  Redirect to https if connection is secure
    649         if ( $secure )
    650                 $login_url = str_replace('http://', 'https://', $login_url);
     646        $login_url = site_url( 'wp-login.php?redirect_to=' . urlencode($_SERVER['REQUEST_URI']), 'forceable' );
     647
    651648        wp_redirect($login_url);
    652649        exit();
    … …  
    665662 */
    666663function check_admin_referer($action = -1, $query_arg = '_wpnonce') {
    667         $adminurl = strtolower(get_option('siteurl')).'/wp-admin';
     664        $adminurl = strtolower(admin_url());
    668665        $referer = strtolower(wp_get_referer());
    669666        $result = wp_verify_nonce($_REQUEST[$query_arg], $action);
    … …  
    795792
    796793        if ( isset($lp['host']) && ( !in_array($lp['host'], $allowed_hosts) && $lp['host'] != strtolower($wpp['host'])) )
    797                 $location = get_option('siteurl') . '/wp-admin/';
     794                $location = admin_url();
    798795
    799796        wp_redirect($location, $status);
    … …  
    849846        }
    850847        $notify_message .= get_permalink($comment->comment_post_ID) . "#comments\r\n\r\n";
    851         $notify_message .= sprintf( __('Delete it: %s'), get_option('siteurl')."/wp-admin/comment.php?action=cdc&c=$comment_id" ) . "\r\n";
    852         $notify_message .= sprintf( __('Spam it: %s'), get_option('siteurl')."/wp-admin/comment.php?action=cdc&dt=spam&c=$comment_id" ) . "\r\n";
     848        $notify_message .= sprintf( __('Delete it: %s'), admin_url("comment.php?action=cdc&c=$comment_id") ) . "\r\n";
     849        $notify_message .= sprintf( __('Spam it: %s'), admin_url("comment.php?action=cdc&dt=spam&c=$comment_id") ) . "\r\n";
    853850
    854851        $wp_email = 'wordpress@' . preg_replace('#^www\.#', '', strtolower($_SERVER['SERVER_NAME']));
    … …  
    929926        }
    930927
    931         $notify_message .= sprintf( __('Approve it: %s'),  get_option('siteurl')."/wp-admin/comment.php?action=mac&c=$comment_id" ) . "\r\n";
    932         $notify_message .= sprintf( __('Delete it: %s'), get_option('siteurl')."/wp-admin/comment.php?action=cdc&c=$comment_id" ) . "\r\n";
    933         $notify_message .= sprintf( __('Spam it: %s'), get_option('siteurl')."/wp-admin/comment.php?action=cdc&dt=spam&c=$comment_id" ) . "\r\n";
     928        $notify_message .= sprintf( __('Approve it: %s'),  admin_url("comment.php?action=mac&c=$comment_id") ) . "\r\n";
     929        $notify_message .= sprintf( __('Delete it: %s'), admin_url("comment.php?action=cdc&c=$comment_id") ) . "\r\n";
     930        $notify_message .= sprintf( __('Spam it: %s'), admin_url("comment.php?action=cdc&dt=spam&c=$comment_id") ) . "\r\n";
    934931
    935932        $notify_message .= sprintf( __ngettext('Currently %s comment is waiting for approval. Please visit the moderation panel:',
    936933                'Currently %s comments are waiting for approval. Please visit the moderation panel:', $comments_waiting), number_format_i18n($comments_waiting) ) . "\r\n";
    937         $notify_message .= get_option('siteurl') . "/wp-admin/edit-comments.php?comment_status=moderated\r\n";
     934        $notify_message .= admin_url("edit-comments.php?comment_status=moderated") . "\r\n";
    938935
    939936        $subject = sprintf( __('[%1$s] Please moderate: "%2$s"'), get_option('blogname'), $post->post_title );
    … …  
    975972        $message  = sprintf(__('Username: %s'), $user_login) . "\r\n";
    976973        $message .= sprintf(__('Password: %s'), $plaintext_pass) . "\r\n";
    977         $message .= get_option('siteurl') . "/wp-login.php\r\n";
     974        $message .= site_url("wp-login.php", 'forceable') . "\r\n";
    978975
    979976        wp_mail($user_email, sprintf(__('[%s] Your username and password'), get_option('blogname')), $message);
    … …  
    12951292                $default = "http://www.gravatar.com/avatar/ad516503a11cd5ca435acc9bb6523536?s={$size}"; // ad516503a11cd5ca435acc9bb6523536 == md5('unknown@gravatar.com')
    12961293        elseif ( 'blank' == $default )
    1297                 $default = get_option('siteurl') . '/wp-includes/images/blank.gif';
     1294                $default = includes_url('images/blank.gif');
    12981295        elseif ( !empty($email) && 'gravatar_default' == $default )
    12991296                $default = '';
  • trunk/wp-includes/post.php

    r8019 r8058  
    23932393                if ( !is_array($icon_files) ) {
    23942394                        $icon_dir = apply_filters( 'icon_dir', ABSPATH . WPINC . '/images/crystal' );
    2395                         $icon_dir_uri = apply_filters( 'icon_dir_uri', trailingslashit(get_option('siteurl')) . WPINC . '/images/crystal' );
     2395                        $icon_dir_uri = apply_filters( 'icon_dir_uri', includes_url('images/crystal') );
    23962396                        $dirs = apply_filters( 'icon_dirs', array($icon_dir => $icon_dir_uri) );
    23972397                        $icon_files = array();
  • trunk/wp-includes/script-loader.php

    r8047 r8058  
    7272        $scripts->add( 'schedule', '/wp-includes/js/jquery/jquery.schedule.js', array('jquery'), '20');
    7373        $scripts->add( 'thickbox', '/wp-includes/js/thickbox/thickbox.js', array('jquery'), '3.1-20080430');
    74         $scripts->add( 'swfupload', '/wp-includes/js/swfupload/swfupload.js', false, '2.0.2-20080430');
    75         $scripts->add( 'swfupload-degrade', '/wp-includes/js/swfupload/plugins/swfupload.graceful_degradation.js', array('swfupload'), '2.0.2');
     74        $scripts->add( 'swfupload', '/wp-includes/js/swfupload/swfupload.js', false, '2.1.0');
     75        $scripts->add( 'swfupload-degrade', '/wp-includes/js/swfupload/plugins/swfupload.graceful_degradation.js', array('swfupload'), '2.1.0');
    7676        $scripts->localize( 'swfupload-degrade', 'uploadDegradeOptions', array(
    7777                'is_lighttpd_before_150' => is_lighttpd_before_150(),
    7878        ) );
    79         $scripts->add( 'swfupload-queue', '/wp-includes/js/swfupload/plugins/swfupload.queue.js', array('swfupload'), '2.0.2');
    80         $scripts->add( 'swfupload-handlers', '/wp-includes/js/swfupload/handlers.js', array('swfupload'), '2.0.2-20080407');
     79        $scripts->add( 'swfupload-queue', '/wp-includes/js/swfupload/plugins/swfupload.queue.js', array('swfupload'), '2.1.0');
     80        $scripts->add( 'swfupload-handlers', '/wp-includes/js/swfupload/handlers.js', array('swfupload'), '2.1.0');
    8181        // these error messages came from the sample swfupload js, they might need changing.
    8282        $scripts->localize( 'swfupload-handlers', 'swfuploadL10n', array(
  • trunk/wp-includes/widgets.php

    r7968 r8058  
    10741074        $url = clean_url(strip_tags($url));
    10751075        if ( file_exists(dirname(__FILE__) . '/rss.png') )
    1076                 $icon = str_replace(ABSPATH, get_option('siteurl').'/', dirname(__FILE__)) . '/rss.png';
     1076                $icon = str_replace(ABSPATH, site_url() . '/', dirname(__FILE__)) . '/rss.png';
    10771077        else
    1078                 $icon = get_option('siteurl').'/wp-includes/images/rss.png';
     1078                $icon = includes_url('images/rss.png');
    10791079        $title = "<a class='rsswidget' href='$url' title='" . attribute_escape(__('Syndicate this content')) ."'><img style='background:orange;color:white;border:none;' width='14' height='14' src='$icon' alt='RSS' /></a> <a class='rsswidget' href='$link' title='$desc'>$title</a>";
    10801080
  • trunk/wp-login.php

    r7998 r8058  
    381381
    382382<p id="nav">
    383 <a href="<?php bloginfo('wpurl'); ?>/wp-login.php"><?php _e('Log in') ?></a> |
    384 <a href="<?php bloginfo('wpurl'); ?>/wp-login.php?action=lostpassword" title="<?php _e('Password Lost and Found') ?>"><?php _e('Lost your password?') ?></a>
     383<a href="<?php site_url('wp-login.php', 'forceable') ?>"><?php _e('Log in') ?></a> |
     384<a href="<?php site_url('wp-login.php?action=lostpassword') ?>" title="<?php _e('Password Lost and Found') ?>"><?php _e('Lost your password?') ?></a>
    385385</p>
    386386
    … …  
    455455<?php if ( isset($_GET['checkemail']) && in_array( $_GET['checkemail'], array('confirm', 'newpass') ) ) : ?>
    456456<?php elseif (get_option('users_can_register')) : ?>
    457 <a href="<?php bloginfo('wpurl'); ?>/wp-login.php?action=register"><?php _e('Register') ?></a> |
    458 <a href="<?php bloginfo('wpurl'); ?>/wp-login.php?action=lostpassword" title="<?php _e('Password Lost and Found') ?>"><?php _e('Lost your password?') ?></a>
     457<a href="<?php site_url('wp-login.php?action=register') ?>"><?php _e('Register') ?></a> |
     458<a href="<?php site_url('wp-login.php?action=lostpassword') ?>" title="<?php _e('Password Lost and Found') ?>"><?php _e('Lost your password?') ?></a>
    459459<?php else : ?>
    460 <a href="<?php bloginfo('wpurl'); ?>/wp-login.php?action=lostpassword" title="<?php _e('Password Lost and Found') ?>"><?php _e('Lost your password?') ?></a>
     460<a href="<?php site_url('wp-login.php?action=lostpassword') ?>" title="<?php _e('Password Lost and Found') ?>"><?php _e('Lost your password?') ?></a>
    461461<?php endif; ?>
    462462</p>
Note: See TracChangeset for help on using the changeset viewer.