Sh3ll
OdayForums


Server : Apache
System : Linux 145.162.205.92.host.secureserver.net 5.14.0-611.45.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Apr 1 05:56:53 EDT 2026 x86_64
User : tradze ( 1001)
PHP Version : 8.1.34
Disable Function : NONE
Directory :  /home/tradze/public_html/test.tradze.com/vendor/alexpechkarev/google-maps/src/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/tradze/public_html/test.tradze.com/vendor/alexpechkarev/google-maps/src/Parameters.php
<?php namespace GoogleMaps;
/**
 * Description of Parameters
 *
 * @author Alexander Pechkarev <alexpechkarev@gmail.com>
 */

class Parameters{
      
    
    protected static $urlParam;

    /**
     * Generate Service URL parameters string
     * @param array $param
     * @return string
     */
    public static function getQueryString( &$param ){
        
        // Geocoding components parameter
        if( isset($param['components']) && is_array($param['components'])){
           $param['components'] = self::joinParam( $param['components'], ':', '&');
        }   
        ///
        
        // Direction parameters
        if( isset($param['origin']) && is_array($param['origin'])){
           $param['origin'] = self::joinParam( $param['origin'], '', ':', false );
        }   
        
        if( isset($param['destination']) && is_array($param['destination'])){
           $param['destination'] = self::joinParam( $param['destination'], '', ':', false );
        }      
        
        if( isset($param['waypoints']) && is_array($param['waypoints'])){
           $param['waypoints'] = self::joinParam( $param['waypoints'], '', '|', false );
        } 
        
        if( isset($param['avoid']) && is_array($param['avoid'])){
           $param['avoid'] = self::joinParam( $param['avoid'], '', '|', false );
        }     
        ///
        
        // Distance Matrix parameters
        if( isset($param['origins']) && is_array($param['origins'])){
           $param['origins'] = self::joinParam( $param['origins'], '', '|', false );
        }   
        
        if( isset($param['destinations']) && is_array($param['destinations'])){
           $param['destinations'] = self::joinParam( $param['destinations'], '', '|', false );
        }   
        
        if( isset($param['transit_mode']) && is_array($param['transit_mode'])){
           $param['transit_mode'] = self::joinParam( $param['transit_mode'], '', '|', false );
        } 
        ///
        
        // Elevation & Road parameters
        if( isset($param['locations']) && is_array($param['locations'])){
           $param['locations'] = self::joinParam( $param['locations'], '', '|', false );
        }   
        if( isset($param['path']) && is_array($param['path'])){
           $param['path'] = self::joinParam( $param['path'], '', '|', false );
        } 
        ///
        
        // Places & Time Zone parameters
        if( isset($param['location']) && is_array($param['location'])){
           $param['location'] = self::joinParam( $param['location'], '', ',', false );
        } 
        
        if( isset($param['types']) && is_array($param['types'])){
           $param['types'] = self::joinParam( $param['types'], '', '|', false );
        }        
        ///
                
        // reset to empty array 
        self::$urlParam = [];
        
        return  self::joinParam( $param );

    }
    /***/
    
    
    /**
     * Join array pairs into URL encoded string
     * @param array $param - single dimension array
     * @param string $join
     * @param string $glue
     * @param boolean $useKey
     * @return string
     */
    protected static function joinParam( $param = [], $join = '=', $glue = '&', $useKey = true){
        
        
       
        $allParam = [];
        
        foreach($param as $key => $val)
        {  
            if( is_array( $val ) ){
                self::joinParam( $val, $join, $glue, $useKey);
            }            
            // ommit parameters with empty values
            if( !empty( $val )){
                #self::$urlParam[] = $useKey
                $allParam[] = $useKey
                            ? $key . $join .urlencode($val)
                            : $join .urlencode($val);
            }
        } 
        
        return !is_null( $allParam )
                ? implode($glue, str_replace(['%252C'],[','],$allParam) )
                :'';         
        
//        return !is_null( self::$urlParam)
//                ? implode($glue, str_replace(['%252C'],[','],self::$urlParam) )
//                :'';      
    }
    /***/    
    
   
    public static function resetParams()
    {
        self::$urlParam = [];
    }
}

?>

ZeroDay Forums Mini