Changeset 3857 for trunk/wp-includes/functions.php
- Timestamp:
- 06/08/2006 06:36:05 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/functions.php
r3855 r3857 810 810 $ret = ''; 811 811 if ( is_array(func_get_arg(0)) ) { 812 if ( @func_num_args() < 2 )812 if ( @func_num_args() < 2 || '' == @func_get_arg(1) ) 813 813 $uri = $_SERVER['REQUEST_URI']; 814 814 else 815 815 $uri = @func_get_arg(1); 816 816 } else { 817 if ( @func_num_args() < 3 )817 if ( @func_num_args() < 3 || '' == @func_get_arg(2) ) 818 818 $uri = $_SERVER['REQUEST_URI']; 819 819 else 820 820 $uri = @func_get_arg(2); 821 } 822 823 if ( preg_match('|^https?://|i', $uri, $matches) ) { 824 $protocol = $matches[0]; 825 $uri = substr($uri, strlen($protocol)); 826 } else { 827 $protocol = ''; 821 828 } 822 829 … … 830 837 $query = $parts[1]; 831 838 } 832 } 833 else if ( strstr($uri, '/') ) { 839 } else if ( strstr($uri, '/') ) { 834 840 $base = $uri . '?'; 835 841 $query = ''; … … 854 860 } 855 861 } 856 $ret = $base . $ret; 862 $ret = $protocol . $base . $ret; 863 if ( get_magic_quotes_gpc() ) 864 $ret = stripslashes($ret); // parse_str() adds slashes if magicquotes is on. See: http://php.net/parse_str 857 865 return trim($ret, '?'); 858 866 } 859 867 860 function remove_query_arg($key, $query) { 868 /* 869 remove_query_arg: Returns a modified querystring by removing 870 a single key or an array of keys. 871 Omitting oldquery_or_uri uses the $_SERVER value. 872 873 Parameters: 874 remove_query_arg(removekey, [oldquery_or_uri]) or 875 remove_query_arg(removekeyarray, [oldquery_or_uri]) 876 */ 877 878 function remove_query_arg($key, $query='') { 879 if ( is_array($key) ) { // removing multiple keys 880 foreach ( (array) $key as $k ) 881 $query = add_query_arg($k, '', $query); 882 return $query; 883 } 861 884 return add_query_arg($key, '', $query); 862 885 }
Note: See TracChangeset
for help on using the changeset viewer.