mirror of
https://github.com/Mibew/geo-ip-plugin.git
synced 2025-04-07 05:10:12 +03:00
Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
7663f63424 | |||
3b7522be94 | |||
972abbb4b9 | |||
471a312549 | |||
001cb3598f | |||
079b9e8686 | |||
106dd67f26 | |||
|
dc2f6d7bd3 |
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,5 +1,6 @@
|
||||
# Do not index node.js modules that are used for building
|
||||
node_modules
|
||||
package-lock.json
|
||||
|
||||
# Do not index composer components
|
||||
vendor
|
||||
|
27
Plugin.php
27
Plugin.php
@ -103,11 +103,11 @@ class Plugin extends \Mibew\Plugin\AbstractPlugin implements \Mibew\Plugin\Plugi
|
||||
: $record->city->name;
|
||||
|
||||
return array(
|
||||
'country_name' => $country_name,
|
||||
'country_code' => $record->country->isoCode,
|
||||
'city' => $city,
|
||||
'latitude' => $record->location->latitude,
|
||||
'longitude' => $record->location->longitude,
|
||||
'country_name' => $country_name ?: 'Unknown',
|
||||
'country_code' => $record->country->isoCode ?: false,
|
||||
'city' => $city ?: 'Unknown',
|
||||
'latitude' => $record->location->latitude ?: 0,
|
||||
'longitude' => $record->location->longitude ?: 0,
|
||||
);
|
||||
}
|
||||
|
||||
@ -126,7 +126,7 @@ class Plugin extends \Mibew\Plugin\AbstractPlugin implements \Mibew\Plugin\Plugi
|
||||
*/
|
||||
public static function getVersion()
|
||||
{
|
||||
return '1.0.0';
|
||||
return '1.0.2';
|
||||
}
|
||||
|
||||
/**
|
||||
@ -139,6 +139,21 @@ class Plugin extends \Mibew\Plugin\AbstractPlugin implements \Mibew\Plugin\Plugi
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns plugin's system requirements
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public static function getSystemRequirements()
|
||||
{
|
||||
if (extension_loaded('gmp')) {
|
||||
return array('ext-gmp' => '*');
|
||||
}
|
||||
else {
|
||||
return array('ext-bcmath' => '*');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Format locale name using "xx-XX" format.
|
||||
*
|
||||
|
@ -2,10 +2,11 @@
|
||||
|
||||
Provides Geo IP information for other plugins.
|
||||
|
||||
*Requires either [GMP (GNU Multiple Precision)](http://php.net/manual/en/book.gmp.php) or [BC Math (BCMath Arbitrary Precision Mathematics)](http://php.net/manual/en/book.bc.php) PHP extension.*
|
||||
|
||||
## Installation
|
||||
|
||||
1. Get the archive with the plugin sources. At the moment the only option is to build the plugin from sources.
|
||||
1. Get the archive with the plugin sources. You can download it from the [official site](https://mibew.org/plugins#mibew-geoip) or build the plugin from sources.
|
||||
|
||||
2. Untar/unzip the plugin's archive.
|
||||
|
||||
|
23
gulpfile.js
23
gulpfile.js
@ -9,6 +9,11 @@ var fs = require('fs'),
|
||||
gzip = require('gulp-gzip'),
|
||||
rename = require('gulp-rename');
|
||||
|
||||
var config = {
|
||||
getComposerUrl: 'https://getcomposer.org/installer',
|
||||
phpBin: 'php -d "suhosin.executor.include.whitelist = phar" -d "memory_limit=512M"'
|
||||
}
|
||||
|
||||
// Get and install PHP Composer
|
||||
gulp.task('get-composer', function(callback) {
|
||||
// Check if Composer already in place
|
||||
@ -19,9 +24,9 @@ gulp.task('get-composer', function(callback) {
|
||||
}
|
||||
|
||||
// Get installer from the internet
|
||||
https.get('https://getcomposer.org/installer', function(response) {
|
||||
https.get(config.getComposerUrl, function(response) {
|
||||
// Run PHP to install Composer
|
||||
var php = exec('php', function(error, stdout, stderr) {
|
||||
var php = exec(config.phpBin, function(error, stdout, stderr) {
|
||||
callback(error ? stderr : null);
|
||||
});
|
||||
// Pass installer code to PHP via STDIN
|
||||
@ -30,13 +35,13 @@ gulp.task('get-composer', function(callback) {
|
||||
});
|
||||
|
||||
// Install Composer dependencies
|
||||
gulp.task('composer-install', ['get-composer'], function(callback) {
|
||||
exec('php -d "suhosin.executor.include.whitelist = phar" composer.phar install --no-dev', function(error, stdout, stderr) {
|
||||
gulp.task('composer-install', gulp.series('get-composer', function(callback) {
|
||||
exec(config.phpBin + ' composer.phar install --no-dev', function(error, stdout, stderr) {
|
||||
callback(error ? stderr : null);
|
||||
});
|
||||
});
|
||||
}));
|
||||
|
||||
gulp.task('prepare-release', ['composer-install'], function() {
|
||||
gulp.task('prepare-release', gulp.series('composer-install', function() {
|
||||
var version = require('./package.json').version;
|
||||
|
||||
return eventStream.merge(
|
||||
@ -48,12 +53,10 @@ gulp.task('prepare-release', ['composer-install'], function() {
|
||||
)
|
||||
.pipe(chmod(0644))
|
||||
.pipe(gulp.dest('release'));
|
||||
});
|
||||
}));
|
||||
|
||||
// Builds and packs plugins sources
|
||||
gulp.task('default', ['prepare-release'], function() {
|
||||
// The "default" task is just an alias for "prepare-release" task.
|
||||
});
|
||||
gulp.task('default', gulp.series('prepare-release'));
|
||||
|
||||
/**
|
||||
* Returns files stream with the plugin sources.
|
||||
|
10
package.json
10
package.json
@ -1,12 +1,12 @@
|
||||
{
|
||||
"version": "1.0.0",
|
||||
"version": "1.0.2",
|
||||
"devDependencies": {
|
||||
"gulp": "~3.8.10",
|
||||
"gulp": "^4.0.0",
|
||||
"event-stream": "~3.1.7",
|
||||
"gulp-zip": "~2.0.2",
|
||||
"gulp-tar": "~1.3.1",
|
||||
"gulp-tar": "~3.1.0",
|
||||
"gulp-gzip": "~0.0.8",
|
||||
"gulp-chmod": "~1.2.0",
|
||||
"gulp-chmod": "~3.0.0",
|
||||
"gulp-rename": "~1.2.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user