Generate location auth hash

@param string $authTicket
@param float $latitude
@param float $longitude
@param float $altitude

@return number
421509
protected function generateLocationAuth(string $authTicket, float $latitude, float $longitude, float $altitude = 0.0)
    {
        $seed = hexdec(xxhash32($authTicket, 0x1B845238));
        return (int)hexdec(xxhash32($this->getLocationBytes($latitude, $longitude, $altitude), (int)$seed));
    }
755386
public function marker($latitude, $longitude, array $options = [])
	{
		$parameters = [
			'latitude' => $latitude,
			'longitude' => $longitude,
		];

		$parameters = array_replace_recursive(
			$this->options,
			$parameters,
			$options
		);

		$this->markers[] = new Marker($parameters);
	}
814710
public function getForecast($latitude, $longitude, \DateTime $time = null, array $parameters = null)
    {
        $this->requestedUrl = $this->buildRequestURL($latitude, $longitude, $time, $parameters);

        $this->response = json_decode(file_get_contents($this->requestedUrl), true);
        $this->responseHeaders = $this->parseForecastResponseHeaders($http_response_header);

        return $this->response;
    }
1301414
public function encode($lat, $long)
        {
            //how many bits does latitude need?
            $plat = $this->precision($lat);
            $latbits = 1;
            $err = 45;

            while($err > $plat) {
                $latbits++;
                $err /= 2;
            }

            //how many bits does longitude need?
            $plong = $this->precision($long);
            $longbits = 1;
            $err = 90;

            while($err > $plong) {
                $longbits++;
                $err/=2;
            }

            //bit counts need to be equal
            $bits = max($latbits, $longbits);

            //as the hash create bits in groups of 5, lets not
            //waste any bits - lets bulk it up to a multiple of 5
            //and favour the longitude for any odd bits
            $longbits = $bits;
            $latbits  = $bits;
            $addlong  = 1;

            while (($longbits + $latbits) % 5 != 0) {
                $longbits += $addlong;
                $latbits += !$addlong;
                $addlong = !$addlong;
            }


            //encode each as binary string
            $blat = $this->binEncode($lat, -90, 90, $latbits);
            $blong = $this->binEncode($long, -180, 180, $longbits);

            //merge lat and long together
            $binary = "";
            $uselong = 1;

            while (strlen($blat) + strlen($blong)) {
                if ($uselong) {
                    $binary = $binary . substr($blong, 0, 1);
                    $blong = substr($blong, 1);
                } else {
                    $binary = $binary.substr($blat, 0, 1);
                    $blat = substr($blat, 1);
                }

                $uselong = !$uselong;
            }

            //convert binary string to hash
            $hash="";

            for ($i = 0; $i < strlen($binary); $i+=5) {
                $n = bindec(substr($binary, $i, 5));
                $hash = $hash . $this->coding[$n];
            }


            return $hash;
        }
705453
function weather($latitude,$longitude) {
		$fw=Base::instance();
		$web=Web::instance();
		$query=array(
			'lat'=>$latitude,
			'lon'=>$longitude
		);
		$req=$web->request(
			'http://api.openweathermap.org/data/2.5/weather?'.
				http_build_query($query));
		return ($req=$web->request(
			'http://api.openweathermap.org/data/2.5/weather?'.
				http_build_query($query)))?
			json_decode($req['body'],TRUE):
			FALSE;
	}
96779
public function getForecast($latitude, $longitude, \DateTime $time = null, array $parameters = null)
    {
        $this->requestedUrl = $this->buildRequestURL($latitude, $longitude, $time, $parameters);

        $response = $this->guzzleClient->get($this->requestedUrl);

        $cacheDirectives = $this->buildCacheDirectives($response);

        $this->responseHeaders = [
            'cache' => $cacheDirectives,
            'responseTime' => (int)$response->getHeader('x-response-time'),
            'apiCalls' => (int)$response->getHeader('x-forecast-api-calls')
        ];
        return json_decode($response->getBody(), true);
    }
848990
function (auth, done) {
        !auth.get('nonce') && auth.set('nonce', randomString(6));
        !_.parseInt(auth.get('timestamp')) && auth.set('timestamp', Math.floor(Date.now() / 1e3));
        done(null, true);
    }
635333
function _doAuth($oID, $amt, $currency = 'USD') {
    global $db, $doPayPal, $messageStack;
    $doPayPal = $this->paypal_init();
    $authAmt = $amt;
    $new_order_status = (int)MODULE_PAYMENT_PAYPALWPP_ORDER_PENDING_STATUS_ID;

    if (isset($_POST['orderauth']) && $_POST['orderauth'] == MODULE_PAYMENT_PAYPAL_ENTRY_AUTH_BUTTON_TEXT_PARTIAL) {
      $authAmt = (float)$_POST['authamt'];
      $new_order_status = MODULE_PAYMENT_PAYPALWPP_ORDER_STATUS_ID;
      if (isset($_POST['authconfirm']) && $_POST['authconfirm'] == 'on') {
        $proceedToAuth = true;
      } else {
        $messageStack->add_session(MODULE_PAYMENT_PAYPALWPP_TEXT_AUTH_CONFIRM_ERROR, 'error');
        $proceedToAuth = false;
      }
      if ($authAmt == 0) {
        $messageStack->add_session(MODULE_PAYMENT_PAYPALWPP_TEXT_INVALID_AUTH_AMOUNT, 'error');
        $proceedToAuth = false;
      }
    }
    // look up history on this order from PayPal table
    $sql = "select * from " . TABLE_PAYPAL . " where order_id = :orderID  AND parent_txn_id = '' ";
    $sql = $db->bindVars($sql, ':orderID', $oID, 'integer');
    $zc_ppHist = $db->Execute($sql);
    if ($zc_ppHist->RecordCount() == 0) return false;
    $txnID = $zc_ppHist->fields['txn_id'];
    /**
     * Submit auth request to PayPal
     */
    if ($proceedToAuth) {
      $response = $doPayPal->DoAuthorization($txnID, $authAmt, $currency);
      $error = $this->_errorHandler($response, 'DoAuthorization');
      $new_order_status = ($new_order_status > 0 ? $new_order_status : 1);
      if (!$error) {
        // Success, so save the results
        $sql_data_array = array('orders_id' => (int)$oID,
                                'orders_status_id' => (int)$new_order_status,
                                'date_added' => 'now()',
                                'comments' => 'AUTHORIZATION ADDED. Trans ID: ' . urldecode($response['TRANSACTIONID']) . "\n" . ' Amount:' . urldecode($response['AMT']) . ' ' . $currency,
                                'customer_notified' => -1
                               );
        zen_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array);
        $db->Execute("update " . TABLE_ORDERS  . "
                      set orders_status = '" . (int)$new_order_status . "'
                      where orders_id = '" . (int)$oID . "'");
        $messageStack->add_session(sprintf(MODULE_PAYMENT_PAYPALWPP_TEXT_AUTH_INITIATED, urldecode($response['AMT'])), 'success');
        return true;
      }
    }
  }
681350
public function getForecast($latitude, $longitude, \DateTime $time = null, array $parameters = null)
    {
        try {
            $response = $this->adapter->getForecast($latitude, $longitude, $time, $parameters);
            $responseHeaders = $this->adapter->getHeaders();

            if (NULL !== $responseHeaders['apiCalls']) {
                $this->apiCalls = $responseHeaders['apiCalls'];
            }

            $cacheAge = 0;
            if (NULL !== $responseHeaders['cache']['maxAge']) {
                $cacheAge = $responseHeaders['cache']['maxAge'];
            } elseif (NULL !== $responseHeaders['cache']['expires']) {
                $cacheAge = (new \DateTime())->getTimestamp() - (new \DateTime($responseHeaders['cache']['expires']))->getTimestamp();
            }

            return new Forecast($response, $cacheAge, $responseHeaders['responseTime']);
        } catch (\Exception $e) {
            return null;
        }
    }
938217
public function whereLocation($lat, $long, $distance_in_meters = 10000)
	{
		return $this->query()->whereLocation($lat, $long, $distance_in_meters);
	}
1012457
public function getTicketSignature($ticket, $nonce, $timestamp, $url): string
    {
        return sha1(sprintf('jsapi_ticket=%s&noncestr=%s&timestamp=%s&url=%s', $ticket, $nonce, $timestamp, $url));
    }
477843
public function store($code, $label, $latitude, $longitude, $campus_id = null, $campus_code = null)
    {
        $fields = [];

        //@todo validate params, throw exception when they are missing
        $fields['code'] = $code;
        $fields['label'] = $label;
        $fields['latitude'] = $latitude;
        $fields['longitude'] = $longitude;
        if (!is_null($campus_id)) $fields['campus_id'] = $campus_id;
        if (!is_null($campus_code)) $fields['campus_code'] = $campus_code;

        return $this->_post($fields);
    }
1272607
private function getLocationCounter($location)
    {
        $locationHash = md5(implode(',', $location));
        if (!isset($this->seenCounter[$locationHash])) {
            $this->seenCounter[$locationHash] = 0;
        } else {
            $this->seenCounter[$locationHash]++;
        }
        return $this->seenCounter[$locationHash];
    }
9253
public static PendingResult<ElevationResult> getByPoint(GeoApiContext context, LatLng location) {
    return context.get(API_CONFIG, SingularResponse.class, "locations", location.toString());
  }
195973
public static function addressFromLatLng ($lat, $lng)
	{
		/** @var Settings $settings */
		$settings = SimpleMap::getInstance()->getSettings();
		$token    =
			static::getToken($settings->geoToken, $settings->geoService);

		switch ($settings->geoService)
		{
			case GeoEnum::Here:
				return static::_addressFromLatLng_Here(
					$token,
					$lat, $lng
				);
			case GeoEnum::GoogleMaps:
				return static::_addressFromLatLng_Google(
					$token,
					$lat, $lng
				);
			case GeoEnum::Mapbox:
				return static::_addressFromLatLng_Mapbox(
					$token,
					$lat, $lng
				);
			case GeoEnum::Nominatim:
				return static::_addressFromLatLng_Nominatim(
					$lat, $lng
				);
			default:
				throw new Exception(
					'Unknown geo-coding service: ' . $settings->geoService
				);
		}
	}
474852
def set_location(self, latitude, longitude, altitude=10):
        
        driver = self._current_application()
        driver.set_location(latitude,longitude,altitude)
288658
public function reverse($latitude, $longitude)
    {
        if (!$this->isLatitude($latitude)) {
            throw new \InvalidArgumentException(
                'Wrong value for latitude.'
            );
        }

        if (!$this->isLongitude($longitude)) {
            throw new \InvalidArgumentException(
                'Wrong value for longitude.'
            );
        }

        $response = $this->guzzleClient->get(
            'reverse',
            [
                'query' => [
                    'format' => $this->guzzleClient->getConfig('format'),
                    'lat'    => $latitude,
                    'lon'    => $longitude,
                    'addressdetails' => $this->guzzleClient->getConfig('addressdetails')
                ],
            ]
        );

        return $response;
    }