Server IP : 85.214.239.14 / Your IP : 3.22.68.29 Web Server : Apache/2.4.62 (Debian) System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.18 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_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : OFF | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /var/www/wordpress/phpMyAdmin/vendor/phpmyadmin/shapefile/src/ |
Upload File : |
<?php /** * phpMyAdmin ShapeFile library * <https://github.com/phpmyadmin/shapefile/>. * * Copyright 2006-2007 Ovidio <ovidio AT users.sourceforge.net> * Copyright 2016 - 2017 Michal Čihař <michal@cihar.com> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, you can download one from * https://www.gnu.org/copyleft/gpl.html. */ namespace PhpMyAdmin\ShapeFile; class Util { private static $little_endian = null; private static $shape_names = array( 0 => 'Null Shape', 1 => 'Point', 3 => 'PolyLine', 5 => 'Polygon', 8 => 'MultiPoint', 11 => 'PointZ', 13 => 'PolyLineZ', 15 => 'PolygonZ', 18 => 'MultiPointZ', 21 => 'PointM', 23 => 'PolyLineM', 25 => 'PolygonM', 28 => 'MultiPointM', 31 => 'MultiPatch', ); /** * Reads data. * * @param string $type type for unpack() * @param string $data Data to process * * @return mixed */ public static function loadData($type, $data) { if ($data === false || strlen($data) == 0) { return false; } $tmp = unpack($type, $data); return current($tmp); } /** * Changes endianity. * * @param string $binValue Binary value * * @return string */ public static function swap($binValue) { $result = $binValue[strlen($binValue) - 1]; for ($i = strlen($binValue) - 2; $i >= 0; --$i) { $result .= $binValue[$i]; } return $result; } /** * Encodes double value to correct endianity. * * @param float $value Value to pack * * @return string */ public static function packDouble($value) { $bin = pack('d', (float) $value); if (is_null(self::$little_endian)) { self::$little_endian = (pack('L', 1) == pack('V', 1)); } if (self::$little_endian) { return $bin; } return self::swap($bin); } /** * Returns shape name. * * @param int $type * * @return string */ public static function nameShape($type) { if (isset(self::$shape_names[$type])) { return self::$shape_names[$type]; } return sprintf('Shape %d', $type); } }