uawdijnntqw1x1x1
IP : 216.73.216.163
Hostname : yjpwxulqtt
Kernel : Linux yjpwxulqtt 5.15.0-126-generic #136-Ubuntu SMP Wed Nov 6 10:38:22 UTC 2024 x86_64
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,exec,system,passthru,shell_exec,proc_open,popen
OS : Linux
PATH:
/
home
/
user
/
web
/
pansionat-v-yaroslavle.ru
/
public_html
/
bitrix
/
modules
/
main
/
lib
/
text
/
geohash.php
/
/
<?php namespace Bitrix\Main\Text; use Bitrix\Main\SystemException; class GeoHash { const MAX_LENGTH = 15; protected static $latitudeInterval = array(-90.0, 90.0); protected static $longitudeInterval = array(-180.0, 180.0); protected static $bits = array(16, 8, 4, 2, 1); protected static $base32Chars = array( '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'j', 'k', 'm', 'n', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' ); public static function encode(array $coordinate, $length = self::MAX_LENGTH) { $latitudeInterval = static::$latitudeInterval; $longitudeInterval = static::$longitudeInterval; $isEven = true; $bit = 0; $charIndex = 0; $geohash = ''; while(strlen($geohash) < $length) { if($isEven) { $middle = ($longitudeInterval[0] + $longitudeInterval[1]) / 2; if($coordinate[1] > $middle) { $charIndex |= static::$bits[$bit]; $longitudeInterval[0] = $middle; } else { $longitudeInterval[1] = $middle; } } else { $middle = ($latitudeInterval[0] + $latitudeInterval[1]) / 2; if($coordinate[0] > $middle) { $charIndex |= static::$bits[$bit]; $latitudeInterval[0] = $middle; } else { $latitudeInterval[1] = $middle; } } if($bit < 4) { $bit++; } else { $geohash .= static::$base32Chars[$charIndex]; $bit = 0; $charIndex = 0; } $isEven = $isEven ? false : true; } return $geohash; } public static function decode($geohash) { $base32DecodeMap = array_flip(static::$base32Chars); $latitudeInterval = static::$latitudeInterval; $longitudeInterval = static::$longitudeInterval; $isEven = true; $geohashLength = strlen($geohash); for($i = 0; $i < $geohashLength; $i++) { if(!isset($base32DecodeMap[$geohash[$i]])) { throw new SystemException('This geo hash is invalid.'); } $currentChar = $base32DecodeMap[$geohash[$i]]; $bitsTotal = count(static::$bits); for($j = 0; $j < $bitsTotal; $j++) { $mask = static::$bits[$j]; if($isEven) { if(($currentChar & $mask) !== 0) { $longitudeInterval[0] = ($longitudeInterval[0] + $longitudeInterval[1]) / 2; } else { $longitudeInterval[1] = ($longitudeInterval[0] + $longitudeInterval[1]) / 2; } } else { if(($currentChar & $mask) !== 0) { $latitudeInterval[0] = ($latitudeInterval[0] + $latitudeInterval[1]) / 2; } else { $latitudeInterval[1] = ($latitudeInterval[0] + $latitudeInterval[1]) / 2; } } $isEven = $isEven ? false : true; } } return array( ($latitudeInterval[0] + $latitudeInterval[1]) / 2, ($longitudeInterval[0] + $longitudeInterval[1]) / 2 ); } }
/home/user/web/pansionat-v-yaroslavle.ru/public_html/bitrix/modules/main/lib/text/geohash.php