Changeset 25615


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

move get_query_string_diff and url_is_remote to functions_url.inc.php

Location:
trunk/include
Files:
2 edited

Legend:

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

    r25550 r25615  
    833833
    834834/**
    835  * returns $_SERVER['QUERY_STRING'] whithout keys given in parameters
    836  *
    837  * @param string[] $rejects
    838  * @param boolean $escape escape *&* to *&*
    839  * @returns string
    840  */
    841 function get_query_string_diff($rejects=array(), $escape=true)
    842 {
    843   if (empty($_SERVER['QUERY_STRING']))
    844   {
    845     return '';
    846   }
    847 
    848   parse_str($_SERVER['QUERY_STRING'], $vars);
    849 
    850   $vars = array_diff_key($vars, array_flip($rejects));
    851  
    852   return '?' . http_build_query($vars, '', $escape ? '&' : '&');
    853 }
    854 
    855 /**
    856  * returns true if the url is absolute (begins with http)
    857  *
    858  * @param string $url
    859  * @returns boolean
    860  */
    861 function url_is_remote($url)
    862 {
    863   if ( strncmp($url, 'http://', 7)==0
    864     or strncmp($url, 'https://', 8)==0 )
    865   {
    866     return true;
    867   }
    868   return false;
    869 }
    870 
    871 /**
    872835 * returns available themes
    873836 *
  • 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.