Changeset 1823
- Timestamp:
- 10/20/2004 09:28:37 PM (20 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/options.php
r1818 r1823 66 66 } 67 67 68 $referred = str_replace('?updated=true' , '', $_SERVER['HTTP_REFERER']); 69 $goback = str_replace('?updated=true', '', $_SERVER['HTTP_REFERER']) . '?updated=true'; 68 //$referred = str_replace('?updated=true' , '', $_SERVER['HTTP_REFERER']); 69 $referred = remove_query_arg('updated' , $_SERVER['HTTP_REFERER']); 70 //$goback = str_replace('?updated=true', '', $_SERVER['HTTP_REFERER']) . '?updated=true'; 71 $goback = add_query_arg('updated', 'true', $_SERVER['HTTP_REFERER']); 70 72 $goback = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $goback); 71 73 header('Location: ' . $goback); -
trunk/wp-includes/functions.php
r1820 r1823 2246 2246 } 2247 2247 2248 /* 2249 add_query_arg: Returns a modified querystring by adding 2250 a single key & value or an associative array. 2251 Setting a key value to emptystring removes the key. 2252 Omitting oldquery_or_uri uses the $_SERVER value. 2253 2254 Parameters: 2255 add_query_arg(newkey, newvalue, oldquery_or_uri) or 2256 add_query_arg(associative_array, oldquery_or_uri) 2257 */ 2258 function add_query_arg() { 2259 $ret = ''; 2260 if(is_array(func_get_arg(0))) { 2261 $uri = @func_get_arg(1); 2262 } 2263 else { 2264 $uri = @func_get_arg(2); 2265 } 2266 if ('' == $uri) { 2267 $uri = $_SERVER['REQUEST_URI']; 2268 } 2269 if (strstr($uri, '?')) { 2270 $parts = explode('?', $uri, 2); 2271 if (1 == count($parts)) { 2272 $base = '?'; 2273 $query = $parts[0]; 2274 } 2275 else { 2276 $base = $parts[0] . '?'; 2277 $query = $parts[1]; 2278 } 2279 } 2280 else { 2281 $base = $uri . '?'; 2282 $query = ''; 2283 } 2284 parse_str($query, $qs); 2285 if (is_array(func_get_arg(0))) { 2286 $kayvees = func_get_arg(0); 2287 $qs = array_merge($qs, $kayvees); 2288 } 2289 else 2290 { 2291 $qs[func_get_arg(0)] = func_get_arg(1); 2292 } 2293 2294 foreach($qs as $k => $v) 2295 { 2296 if($v != '') 2297 { 2298 if($ret != '') $ret .= '&'; 2299 $ret .= "$k=$v"; 2300 } 2301 } 2302 $ret = $base . $ret; 2303 return trim($ret, '?'); 2304 } 2305 2306 function remove_query_arg($key, $query) { 2307 add_query_arg($key, '', $query); 2308 } 2248 2309 ?>
Note: See TracChangeset
for help on using the changeset viewer.