Ignore:
Timestamp:
Nov 21, 2013, 12:22:42 PM (10 years ago)
Author:
mistic100
Message:

move get_query_string_diff and url_is_remote to functions_url.inc.php

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/functions_url.inc.php

    r25018 r25615  
    795795  }
    796796}
     797
     798/**
     799 * returns $_SERVER['QUERY_STRING'] whithout keys given in parameters
     800 *
     801 * @param string[] $rejects
     802 * @param boolean $escape escape *&* to *&*
     803 * @returns string
     804 */
     805function get_query_string_diff($rejects=array(), $escape=true)
     806{
     807  if (empty($_SERVER['QUERY_STRING']))
     808  {
     809    return '';
     810  }
     811
     812  parse_str($_SERVER['QUERY_STRING'], $vars);
     813
     814  $vars = array_diff_key($vars, array_flip($rejects));
     815 
     816  return '?' . http_build_query($vars, '', $escape ? '&' : '&');
     817}
     818
     819/**
     820 * returns true if the url is absolute (begins with http)
     821 *
     822 * @param string $url
     823 * @returns boolean
     824 */
     825function url_is_remote($url)
     826{
     827  if ( strncmp($url, 'http://', 7)==0
     828    or strncmp($url, 'https://', 8)==0 )
     829  {
     830    return true;
     831  }
     832  return false;
     833}
     834
    797835?>
Note: See TracChangeset for help on using the changeset viewer.