Skip to content
This repository has been archived by the owner on Apr 26, 2021. It is now read-only.

Commit

Permalink
Add PHP 7.4 support, fix deprecated syntax.
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMY3 committed Feb 3, 2020
1 parent 42161e3 commit 83bb880
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 13 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.idea
nbproject
vendor
composer.phar
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
SypexGeo
==========
This is working copy [igi/sypexgeo](https://github.com/iginikolaev/sypexgeo) with PHP 7.4 support.

Sypex Geo - product for location by IP address.
Obtaining the IP address, Sypex Geo outputs information about the location of the visitor - country, region, city,
Expand All @@ -15,7 +16,7 @@ The preferred way to install this extension is through [composer](http://getcomp
Add

```
"igi/sypexgeo": "*"
"freelancehunt/sypexgeo": "^1.0.0"
```

to the require section of your `composer.json` file.
Expand All @@ -27,7 +28,7 @@ Put "post-install-cmd" event to composer.json
```json
"scripts": {
"post-install-cmd": [
"IgI\\SypexGeo\\Composer::installDatabases"
"Freelancehunt\\SypexGeo\\Composer::installDatabases"
]
}
```
Expand Down
24 changes: 19 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,27 @@
{
"name": "igi/sypexgeo",
"name": "freelancehunt/sypexgeo",
"type": "library",
"description": "PHP library Sypex Geo API (http://sypexgeo.net)",
"keywords": ["sxgeo", "sypex", "geoip"],
"license": "MIT",
"authors": [{
"name": "Eugene Bazilenko",
"homepage": "https://github.com/iginikolaev"
}],
"authors": [
{
"name": "Oleg Topchiy",
"email": "edge@freelancehunt.com"
},
{
"name": "Vitaliy Misko",
"email": "vitaliy@freelancehunt.com"
},
{
"name": "Yaroslav Molchan",
"email": "yaroslav@freelancehunt.com"
},
{
"name": "Eugene Bazilenko",
"homepage": "https://github.com/iginikolaev"
}
],
"require": {
"php": ">=5.3.0"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace IgI\SypexGeo;
namespace Freelancehunt\SypexGeo;

use Composer\Script\Event;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace IgI\SypexGeo;
namespace Freelancehunt\SypexGeo;

/***************************************************************************\
| Sypex Geo version 2.2.3 |
Expand Down Expand Up @@ -216,7 +216,7 @@ protected function unpack($pack, $item = ''){
$pos = 0;
foreach($pack AS $p){
list($type, $name) = explode(':', $p);
$type0 = $type{0};
$type0 = substr($type, 0 , 1);
if($empty) {
$unpacked[$name] = $type0 == 'b' || $type0 == 'c' ? '' : 0;
continue;
Expand All @@ -240,15 +240,15 @@ protected function unpack($pack, $item = ''){
case 'T': $v = unpack('C', $val); break;
case 's': $v = unpack('s', $val); break;
case 'S': $v = unpack('S', $val); break;
case 'm': $v = unpack('l', $val . (ord($val{2}) >> 7 ? "\xff" : "\0")); break;
case 'm': $v = unpack('l', $val . (ord(substr($val, 2, 1)) >> 7 ? "\xff" : "\0")); break;
case 'M': $v = unpack('L', $val . "\0"); break;
case 'i': $v = unpack('l', $val); break;
case 'I': $v = unpack('L', $val); break;
case 'f': $v = unpack('f', $val); break;
case 'd': $v = unpack('d', $val); break;

case 'n': $v = current(unpack('s', $val)) / pow(10, $type{1}); break;
case 'N': $v = current(unpack('l', $val)) / pow(10, $type{1}); break;
case 'n': $v = current(unpack('s', $val)) / pow(10, substr($type, 1, 1)); break;
case 'N': $v = current(unpack('l', $val)) / pow(10, substr($type, 1, 1)); break;

case 'c': $v = rtrim($val, ' '); break;
case 'b': $v = $val; $l++; break;
Expand Down

0 comments on commit 83bb880

Please sign in to comment.