Plugin Directory

Changeset 725018


Ignore:
Timestamp:
06/10/2013 06:10:09 PM (13 years ago)
Author:
Travelgrove
Message:
  • header issues fixed
File:
1 edited

Legend:

Unmodified
Added
Removed
  • travel-search/tags/1.2.5/ajax/functions.php

    r723445 r725018  
    7575        return readRemoteFile($url, $headersString, $data_url);
    7676    }
    77     return array(   'content'   => file_get_contents (
     77    /*  otherwise, if file_get_contents is enabled => use it    */
     78    return array(   'content'   => @file_get_contents (
    7879                    $url,
    7980                    false,
     
    195196if( !function_exists('apache_request_headers') ) {
    196197    function apache_request_headers() {
    197         $arh = array();
    198         $rx_http = '/\AHTTP_/';
     198        $arh        = array();
     199        $rx_http    = '/\AHTTP_/';
    199200        foreach($_SERVER as $key => $val) {
    200             if( preg_match($rx_http, $key) ) {
    201                 $arh_key = preg_replace($rx_http, '', $key);
    202                 $rx_matches = array();
     201            if(preg_match($rx_http, $key)) {
     202                $arh_key    = preg_replace($rx_http, '', $key);
     203                $rx_matches = array();
    203204                // do some nasty string manipulations to restore the original letter case
    204205                // this should work in most cases
    205                 $rx_matches = explode('_', $arh_key);
    206                 if( count($rx_matches) > 0 and strlen($arh_key) > 2 ) {
    207                     foreach($rx_matches as $ak_key => $ak_val) $rx_matches[$ak_key] = ucfirst($ak_val);
    208                         $arh_key = implode('-', $rx_matches);
     206                $rx_matches = explode('_', $arh_key);
     207                if(count($rx_matches) > 0 and strlen($arh_key) > 2 ) {
     208                    foreach($rx_matches as $ak_key => $ak_val)
     209                        $rx_matches[$ak_key]    = ucfirst(strtolower($ak_val));
     210                        $arh_key    = implode('-', $rx_matches);
    209211                }
    210                 $arh[$arh_key] = $val;
     212                $arh[$arh_key]  = $val;
    211213            }
    212214        }
    213     return( $arh );
     215    return($arh);
    214216    }
    215217}
Note: See TracChangeset for help on using the changeset viewer.