Ticket #17048: patch17048_draft.diff
| File patch17048_draft.diff, 20.7 KB (added by edwardw, 21 months ago) |
|---|
-
wp-login.php
216 216 $message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n"; 217 217 $message .= __('If this was a mistake, just ignore this email and nothing will happen.') . "\r\n\r\n"; 218 218 $message .= __('To reset your password, visit the following address:') . "\r\n\r\n"; 219 $message .= '<' . network_site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user_login), 'login' ) . ">\r\n";219 $message .= '<' . network_site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user_login), 'login', 'absolute') . ">\r\n"; 220 220 221 221 if ( is_multisite() ) 222 222 $blogname = $GLOBALS['current_site']->site_name; -
wp-includes/feed-rss2.php
50 50 <content:encoded><![CDATA[<?php the_excerpt_rss() ?>]]></content:encoded> 51 51 <?php endif; ?> 52 52 <?php endif; ?> 53 <wfw:commentRss><?php echo esc_url( get_post_comments_feed_link(null, 'rss2' ) ); ?></wfw:commentRss>53 <wfw:commentRss><?php echo esc_url( get_post_comments_feed_link(null, 'rss2', 'absolute') ); ?></wfw:commentRss> 54 54 <slash:comments><?php echo get_comments_number(); ?></slash:comments> 55 55 <?php rss_enclosure(); ?> 56 56 <?php do_action('rss2_item'); ?> -
wp-includes/default-constants.php
80 80 */ 81 81 function wp_plugin_directory_constants( ) { 82 82 if ( !defined('WP_CONTENT_URL') ) 83 define( 'WP_CONTENT_URL', get_ option('siteurl') . '/wp-content'); // full url - WP_CONTENT_DIR is defined further up83 define( 'WP_CONTENT_URL', get_site_url(null, '', null, 'root_relative') . '/wp-content'); // full url - WP_CONTENT_DIR is defined further up 84 84 85 85 /** 86 86 * Allows for the plugins directory to be moved from the default location. -
wp-includes/comment-template.php
467 467 * 468 468 * @param object|string|int $comment Comment to retrieve. 469 469 * @param array $args Optional args. 470 * @param string $type Type of link - either 'absolute' or 'root_relative' (default). 470 471 * @return string The permalink to the given comment. 471 472 */ 472 function get_comment_link( $comment = null, $args = array() ) {473 function get_comment_link( $comment = null, $args = array(), $type = 'root_relative' ) { 473 474 global $wp_rewrite, $in_comment_loop; 474 475 475 476 $comment = get_comment($comment); … … 497 498 $args['page'] = ( !empty($in_comment_loop) ) ? get_query_var('cpage') : get_page_of_comment( $comment->comment_ID, $args ); 498 499 499 500 if ( $wp_rewrite->using_permalinks() ) 500 $link = user_trailingslashit( trailingslashit( get_permalink( $comment->comment_post_ID ) ) . 'comment-page-' . $args['page'], 'comment' );501 $link = user_trailingslashit( trailingslashit( get_permalink( $comment->comment_post_ID, false, $type ) ) . 'comment-page-' . $args['page'], 'comment' ); 501 502 else 502 $link = add_query_arg( 'cpage', $args['page'], get_permalink( $comment->comment_post_ID ) );503 $link = add_query_arg( 'cpage', $args['page'], get_permalink( $comment->comment_post_ID, false, $type ) ); 503 504 } else { 504 $link = get_permalink( $comment->comment_post_ID );505 $link = get_permalink( $comment->comment_post_ID, false, $type ); 505 506 } 506 507 507 508 return apply_filters( 'get_comment_link', $link . '#comment-' . $comment->comment_ID, $comment, $args ); … … 513 514 * @since 1.5.0 514 515 * 515 516 * @param int $post_id Optional post id 517 * @param string $type Type of link - 'absolute' or 'root_relative' (default) 516 518 * @return string The link to the comments 517 519 */ 518 function get_comments_link($post_id = 0 ) {519 return get_permalink($post_id ) . '#comments';520 function get_comments_link($post_id = 0, $type = 'root_relative') { 521 return get_permalink($post_id, false, $type) . '#comments'; 520 522 } 521 523 522 524 /** -
wp-includes/link-template.php
75 75 * 76 76 * @param int $id Optional. Post ID. 77 77 * @param bool $leavename Optional, defaults to false. Whether to keep post name or page name. 78 * @param string $type Optional. Either 'absolute' or 'root_relative'. Defaults to 'root_relative'. 78 79 * @return string 79 80 */ 80 function get_permalink($id = 0, $leavename = false ) {81 function get_permalink($id = 0, $leavename = false, $type = 'root_relative') { 81 82 $rewritecode = array( 82 83 '%year%', 83 84 '%monthnum%', … … 155 156 $author, 156 157 $post->post_name, 157 158 ); 158 $permalink = home_url( str_replace($rewritecode, $rewritereplace, $permalink) );159 $permalink = home_url( str_replace($rewritecode, $rewritereplace, $permalink), null, $type ); 159 160 $permalink = user_trailingslashit($permalink, 'single'); 160 161 } else { // if they're not using the fancy permalink option 161 $permalink = home_url('?p=' . $post->ID );162 $permalink = home_url('?p=' . $post->ID, null, $type); 162 163 } 163 164 return apply_filters('post_link', $permalink, $post, $leavename); 164 165 } … … 463 464 * 464 465 * @param int $post_id Optional. Post ID. 465 466 * @param string $feed Optional. Feed type. 467 * @param string $type Optional. Either 'absolute' or 'root_relative'. Defaults to root_relative. 466 468 * @return string 467 469 */ 468 function get_post_comments_feed_link($post_id = 0, $feed = '' ) {470 function get_post_comments_feed_link($post_id = 0, $feed = '', $type = 'root_relative') { 469 471 $post_id = absint( $post_id ); 470 472 471 473 if ( ! $post_id ) … … 485 487 $url .= "/$feed"; 486 488 $url = user_trailingslashit($url, 'single_feed'); 487 489 } else { 488 $ type = get_post_field('post_type', $post_id);489 if ( 'page' == $ type )490 $url = home_url("?feed=$feed&page_id=$post_id" );490 $post_type = get_post_field('post_type', $post_id); 491 if ( 'page' == $post_type ) 492 $url = home_url("?feed=$feed&page_id=$post_id", null, $type); 491 493 else 492 $url = home_url("?feed=$feed&p=$post_id" );494 $url = home_url("?feed=$feed&p=$post_id", null, $type); 493 495 } 494 496 495 497 return apply_filters('post_comments_feed_link', $url); … … 1944 1946 * 1945 1947 * @uses get_home_url() 1946 1948 * 1947 * @param string $path (optional) Path relative to the home url. 1948 * @param string $scheme (optional) Scheme to give the home url context. Currently 'http','https' 1949 * @param string $path (optional) Path relative to the home url. 1950 * @param string $scheme (optional) Scheme to give the home url context. Currently 'http','https' 1951 * @param string $type Optional. Type of link - either 'absolute' or 'root_relative'. Defaults to root_relative. 1949 1952 * @return string Home url link with optional path appended. 1950 1953 */ 1951 function home_url( $path = '', $scheme = null ) {1952 return get_home_url(null, $path, $scheme );1954 function home_url( $path = '', $scheme = null, $type = 'root_relative' ) { 1955 return get_home_url(null, $path, $scheme, $type); 1953 1956 } 1954 1957 1955 1958 /** … … 1967 1970 * @param string $scheme (optional) Scheme to give the home url context. Currently 'http','https' 1968 1971 * @return string Home url link with optional path appended. 1969 1972 */ 1970 function get_home_url( $blog_id = null, $path = '', $scheme = null ) {1973 function get_home_url( $blog_id = null, $path = '', $scheme = null, $type = 'root_relative' ) { 1971 1974 $orig_scheme = $scheme; 1972 1975 1973 1976 if ( !in_array( $scheme, array( 'http', 'https' ) ) ) … … 1980 1983 1981 1984 if ( 'http' != $scheme ) 1982 1985 $url = str_replace( 'http://', "$scheme://", $url ); 1986 1987 if ( $type == 'root_relative' ) { 1988 $url_parts = parse_url($url); 1989 $url = $url_parts['path'] . (array_key_exists('query',$url_parts) ? '?'.$url_parts['query'] : ''); 1990 } 1983 1991 1984 1992 if ( !empty( $path ) && is_string( $path ) && strpos( $path, '..' ) === false ) 1985 1993 $url .= '/' . ltrim( $path, '/' ); … … 2001 2009 * 2002 2010 * @param string $path Optional. Path relative to the site url. 2003 2011 * @param string $scheme Optional. Scheme to give the site url context. Currently 'http','https', 'login', 'login_post', or 'admin'. 2012 * @param string $type Optional. Type of link - either 'absolute' or 'root_relative'. Defaults to root_relative. 2004 2013 * @return string Site url link with optional path appended. 2005 2014 */ 2006 function site_url( $path = '', $scheme = null ) {2007 return get_site_url(null, $path, $scheme );2015 function site_url( $path = '', $scheme = null, $type = 'root_relative' ) { 2016 return get_site_url(null, $path, $scheme, $type); 2008 2017 } 2009 2018 2010 2019 /** … … 2020 2029 * @param int $blog_id (optional) Blog ID. Defaults to current blog. 2021 2030 * @param string $path Optional. Path relative to the site url. 2022 2031 * @param string $scheme Optional. Scheme to give the site url context. Currently 'http','https', 'login', 'login_post', or 'admin'. 2032 * @param string $type Optional. Type of link - either 'absolute' or 'root_relative'. Defaults to root_relative. 2023 2033 * @return string Site url link with optional path appended. 2024 2034 */ 2025 function get_site_url( $blog_id = null, $path = '', $scheme = null ) {2035 function get_site_url( $blog_id = null, $path = '', $scheme = null, $type = 'root_relative' ) { 2026 2036 // should the list of allowed schemes be maintained elsewhere? 2027 2037 $orig_scheme = $scheme; 2028 2038 if ( !in_array( $scheme, array( 'http', 'https' ) ) ) { … … 2044 2054 if ( 'http' != $scheme ) 2045 2055 $url = str_replace( 'http://', "{$scheme}://", $url ); 2046 2056 2057 if ( $type == 'root_relative' ) { 2058 $url_parts = parse_url($url); 2059 $url = $url_parts['path'] . (array_key_exists('query',$url_parts) ? '?'.$url_parts['query'] : ''); 2060 } 2061 2047 2062 if ( !empty( $path ) && is_string( $path ) && strpos( $path, '..' ) === false ) 2048 2063 $url .= '/' . ltrim( $path, '/' ); 2049 2064 … … 2118 2133 2119 2134 if ( !empty($path) && is_string($path) && strpos($path, '..') === false ) 2120 2135 $url .= '/' . ltrim($path, '/'); 2121 2136 2122 2137 return apply_filters('content_url', $url, $path); 2123 2138 } 2124 2139 … … 2173 2188 * 2174 2189 * @param string $path Optional. Path relative to the site url. 2175 2190 * @param string $scheme Optional. Scheme to give the site url context. Currently 'http','https', 'login', 'login_post', or 'admin'. 2191 * @param string $type Optional. Either 'absolute' or 'root_relative'. Defaults to 'root_relative'. 2176 2192 * @return string Site url link with optional path appended. 2177 2193 */ 2178 function network_site_url( $path = '', $scheme = null ) {2194 function network_site_url( $path = '', $scheme = null, $type = 'root_relative' ) { 2179 2195 global $current_site; 2180 2196 2181 2197 if ( !is_multisite() ) 2182 return site_url($path, $scheme );2198 return site_url($path, $scheme, $type); 2183 2199 2184 2200 $orig_scheme = $scheme; 2185 2201 if ( !in_array($scheme, array('http', 'https')) ) { … … 2198 2214 if ( !empty($path) && is_string($path) && strpos($path, '..') === false ) 2199 2215 $url .= ltrim($path, '/'); 2200 2216 2217 if ( $type == 'root_relative' ) { 2218 $url_parts = parse_url($url); 2219 $url = $url_parts['path'] . (array_key_exists('query',$url_parts) ? '?'.$url_parts['query'] : ''); 2220 } 2221 2201 2222 return apply_filters('network_site_url', $url, $path, $orig_scheme); 2202 2223 } 2203 2224 … … 2213 2234 * 2214 2235 * @param string $path (optional) Path relative to the home url. 2215 2236 * @param string $scheme (optional) Scheme to give the home url context. Currently 'http','https' 2237 * @param string $type (optional) Type of URL. Either 'absolute' or (default)'root_relative' 2216 2238 * @return string Home url link with optional path appended. 2217 2239 */ 2218 function network_home_url( $path = '', $scheme = null ) {2240 function network_home_url( $path = '', $scheme = null, $type = 'root_relative' ) { 2219 2241 global $current_site; 2220 2242 2221 2243 if ( !is_multisite() ) 2222 return home_url($path, $scheme );2244 return home_url($path, $scheme, $type); 2223 2245 2224 2246 $orig_scheme = $scheme; 2225 2247 … … 2231 2253 if ( !empty( $path ) && is_string( $path ) && strpos( $path, '..' ) === false ) 2232 2254 $url .= ltrim( $path, '/' ); 2233 2255 2256 if ( $type == 'root_relative' ) { 2257 $url_parts = parse_url($url); 2258 $url = $url_parts['path'] . (array_key_exists('query',$url_parts) ? '?'.$url_parts['query'] : ''); 2259 } 2260 2234 2261 return apply_filters( 'network_home_url', $url, $path, $orig_scheme); 2235 2262 } 2236 2263 -
wp-includes/feed-rss2-comments.php
26 26 printf(ent2ncr(__('Comments for %s')), get_bloginfo_rss( 'name' ) . get_wp_title_rss()); 27 27 ?></title> 28 28 <atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" /> 29 <link><?php (is_single()) ? the_permalink_rss() : bloginfo_rss("url")?></link>29 <link><?php if(is_single()) { the_permalink_rss(); } else { echo home_url('',null,'absolute'); } ?></link> 30 30 <description><?php bloginfo_rss("description") ?></description> 31 31 <lastBuildDate><?php echo mysql2date('r', get_lastcommentmodified('GMT')); ?></lastBuildDate> 32 32 <sy:updatePeriod><?php echo apply_filters( 'rss_update_period', 'hourly' ); ?></sy:updatePeriod> … … 47 47 printf(ent2ncr(__('By: %s')), get_comment_author_rss()); 48 48 } 49 49 ?></title> 50 <link><?php comment_link( ) ?></link>50 <link><?php comment_link('absolute') ?></link> 51 51 <dc:creator><?php echo get_comment_author_rss() ?></dc:creator> 52 52 <pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_comment_time('Y-m-d H:i:s', true, false), false); ?></pubDate> 53 53 <guid isPermaLink="false"><?php comment_guid() ?></guid> -
wp-includes/general-template.php
229 229 * 230 230 * @param string $redirect Path to redirect to on login. 231 231 * @param bool $force_reauth Whether to force reauthorization, even if a cookie is present. Default is false. 232 * @param string $type Absolute or relative url - 'absolute' or 'root_relative' (default). 232 233 * @return string A log in url 233 234 */ 234 function wp_login_url($redirect = '', $force_reauth = false ) {235 $login_url = site_url('wp-login.php', 'login' );235 function wp_login_url($redirect = '', $force_reauth = false, $type = 'root_relative') { 236 $login_url = site_url('wp-login.php', 'login', $type); 236 237 237 238 if ( !empty($redirect) ) 238 239 $login_url = add_query_arg('redirect_to', urlencode($redirect), $login_url); -
wp-includes/canonical.php
287 287 $redirect = @parse_url($redirect_url); 288 288 289 289 // www.example.com vs example.com 290 $user_home = @parse_url(home_url( ));290 $user_home = @parse_url(home_url('',null,'absolute')); 291 291 if ( !empty($user_home['host']) ) 292 292 $redirect['host'] = $user_home['host']; 293 293 if ( empty($user_home['path']) ) -
wp-includes/pluggable.php
1240 1240 1241 1241 $message = sprintf(__('Username: %s'), $user_login) . "\r\n"; 1242 1242 $message .= sprintf(__('Password: %s'), $plaintext_pass) . "\r\n"; 1243 $message .= wp_login_url( ) . "\r\n";1243 $message .= wp_login_url('',false,'absolute') . "\r\n"; 1244 1244 1245 1245 wp_mail($user_email, sprintf(__('[%s] Your username and password'), $blogname), $message); 1246 1246 -
wp-includes/feed.php
187 187 * @uses apply_filters() Call 'the_permalink_rss' on the post permalink 188 188 */ 189 189 function the_permalink_rss() { 190 echo esc_url( apply_filters('the_permalink_rss', get_permalink( ) ));190 echo esc_url( apply_filters('the_permalink_rss', get_permalink(0,false,'absolute') )); 191 191 } 192 192 193 193 /** … … 197 197 * @return none 198 198 */ 199 199 function comments_link_feed() { 200 echo esc_url( get_comments_link( ) );200 echo esc_url( get_comments_link(0,'absolute') ); 201 201 } 202 202 203 203 /** … … 236 236 * Display the link to the comments. 237 237 * 238 238 * @since 1.5.0 239 * @param $type Optional. Type of link - either 'absolute' or 'root_relative' (default) 239 240 */ 240 function comment_link( ) {241 echo esc_url( get_comment_link( ) );241 function comment_link($type = 'root_relative') { 242 echo esc_url( get_comment_link(null, Array(), $type) ); 242 243 } 243 244 244 245 /** … … 486 487 * @since 2.5 487 488 */ 488 489 function self_link() { 489 $host = @parse_url(home_url());490 $host = $host ['host'];490 $host_array = @parse_url(home_url('',null,'absolute')); 491 $host = $host_array['host']; 491 492 echo esc_url( 492 493 'http' 493 494 . ( (isset($_SERVER['https']) && $_SERVER['https'] == 'on') ? 's' : '' ) . '://' 494 495 . $host 496 . ( (array_key_exists('port',$host_array)) ? ':'.strval($host_array['port']) : '') 495 497 . stripslashes($_SERVER['REQUEST_URI']) 496 498 ); 497 499 } -
xmlrpc.php
38 38 <engineLink>http://wordpress.org/</engineLink> 39 39 <homePageLink><?php bloginfo_rss('url') ?></homePageLink> 40 40 <apis> 41 <api name="WordPress" blogID="1" preferred="true" apiLink="<?php echo site_url('xmlrpc.php', 'rpc' ) ?>" />42 <api name="Movable Type" blogID="1" preferred="false" apiLink="<?php echo site_url('xmlrpc.php', 'rpc' ) ?>" />43 <api name="MetaWeblog" blogID="1" preferred="false" apiLink="<?php echo site_url('xmlrpc.php', 'rpc' ) ?>" />44 <api name="Blogger" blogID="1" preferred="false" apiLink="<?php echo site_url('xmlrpc.php', 'rpc' ) ?>" />45 <api name="Atom" blogID="" preferred="false" apiLink="<?php echo site_url('wp-app.php/service', 'rpc' ) ?>" />41 <api name="WordPress" blogID="1" preferred="true" apiLink="<?php echo site_url('xmlrpc.php', 'rpc', 'absolute') ?>" /> 42 <api name="Movable Type" blogID="1" preferred="false" apiLink="<?php echo site_url('xmlrpc.php', 'rpc', 'absolute') ?>" /> 43 <api name="MetaWeblog" blogID="1" preferred="false" apiLink="<?php echo site_url('xmlrpc.php', 'rpc', 'absolute') ?>" /> 44 <api name="Blogger" blogID="1" preferred="false" apiLink="<?php echo site_url('xmlrpc.php', 'rpc', 'absolute') ?>" /> 45 <api name="Atom" blogID="" preferred="false" apiLink="<?php echo site_url('wp-app.php/service', 'rpc', 'absolute') ?>" /> 46 46 </apis> 47 47 </service> 48 48 </rsd> -
wp-admin/includes/ms.php
237 237 $content = str_replace( '###ADMIN_URL###', esc_url( admin_url( 'options.php?adminhash='.$hash ) ), $content ); 238 238 $content = str_replace( '###EMAIL###', $value, $content ); 239 239 $content = str_replace( '###SITENAME###', get_site_option( 'site_name' ), $content ); 240 $content = str_replace( '###SITEURL###', network_home_url( ), $content );240 $content = str_replace( '###SITEURL###', network_home_url('',null,'absolute'), $content ); 241 241 242 242 wp_mail( $value, sprintf( __( '[%s] New Admin Email Address' ), get_option( 'blogname' ) ), $content ); 243 243 } … … 290 290 $content = str_replace( '###ADMIN_URL###', esc_url( admin_url( 'profile.php?newuseremail='.$hash ) ), $content ); 291 291 $content = str_replace( '###EMAIL###', $_POST['email'], $content); 292 292 $content = str_replace( '###SITENAME###', get_site_option( 'site_name' ), $content ); 293 $content = str_replace( '###SITEURL###', network_home_url( ), $content );293 $content = str_replace( '###SITEURL###', network_home_url('',null,'absolute'), $content ); 294 294 295 295 wp_mail( $_POST['email'], sprintf( __( '[%s] New Email Address' ), get_option( 'blogname' ) ), $content ); 296 296 $_POST['email'] = $current_user->user_email; -
wp-admin/user-new.php
73 73 $newuser_key = substr( md5( $user_id ), 0, 5 ); 74 74 add_option( 'new_user_' . $newuser_key, array( 'user_id' => $user_id, 'email' => $user_details->user_email, 'role' => $_REQUEST[ 'role' ] ) ); 75 75 $message = __("Hi,\n\nYou have been invited to join '%s' at\n%s with the role of %s.\nPlease click the following link to confirm the invite:\n%s\n"); 76 wp_mail( $new_user_email, sprintf( __( '[%s] Joining confirmation' ), get_option( 'blogname' ) ), sprintf($message, get_option('blogname'), site_url( ), $_REQUEST[ 'role' ], site_url("/newbloguser/$newuser_key/")));76 wp_mail( $new_user_email, sprintf( __( '[%s] Joining confirmation' ), get_option( 'blogname' ) ), sprintf($message, get_option('blogname'), site_url('',null,'absolute'), $_REQUEST[ 'role' ], site_url("/newbloguser/$newuser_key/",null,'absolute'))); 77 77 $redirect = add_query_arg( array('update' => 'add'), 'user-new.php' ); 78 78 } 79 79 }
