mirror of
https://github.com/Mibew/google-maps-plugin.git
synced 2025-04-20 17:57:23 +03:00
Compare commits
No commits in common. "master" and "v1.0.1" have entirely different histories.
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,6 +1,5 @@
|
|||||||
# Do not index node.js modules that are used for building
|
# Do not index node.js modules that are used for building
|
||||||
node_modules
|
node_modules
|
||||||
package-lock.json
|
|
||||||
|
|
||||||
# Do not index bower components
|
# Do not index bower components
|
||||||
vendor
|
vendor
|
||||||
|
30
Plugin.php
30
Plugin.php
@ -75,13 +75,16 @@ class Plugin extends \Mibew\Plugin\AbstractPlugin implements \Mibew\Plugin\Plugi
|
|||||||
public function usersFunctionCallHandler(&$function)
|
public function usersFunctionCallHandler(&$function)
|
||||||
{
|
{
|
||||||
if ($function['function'] == 'googleMapsGetInfo') {
|
if ($function['function'] == 'googleMapsGetInfo') {
|
||||||
// An IP string can contain more than one IP address. For example it
|
// An IP string can contain more than one IP adress. For example it
|
||||||
// can be something like this: "x.x.x.x (x.x.x.x)". We need to
|
// can be something like this: "x.x.x.x (x.x.x.x)". Thus we need to
|
||||||
// use only first one.
|
// extract all IPS from the string and use the last one.
|
||||||
$ips = explode(' ', $function['arguments']['ip'], 2);
|
$count = preg_match_all(
|
||||||
$ip = filter_var($ips[0], FILTER_VALIDATE_IP);
|
"/(?:(?:[0-9]{1,3}\.){3}[0-9]{1,3})/",
|
||||||
if (!$ip) {
|
$function['arguments']['ip'],
|
||||||
// There is no valid IP in the string. An error should be returned.
|
$matches
|
||||||
|
);
|
||||||
|
if (!$count) {
|
||||||
|
// There is no IP in the string. An error should be returned.
|
||||||
$function['results'] = array(
|
$function['results'] = array(
|
||||||
'errorCode' => 1,
|
'errorCode' => 1,
|
||||||
'errorMessage' => 'The specified IP is invalid!',
|
'errorMessage' => 'The specified IP is invalid!',
|
||||||
@ -89,6 +92,7 @@ class Plugin extends \Mibew\Plugin\AbstractPlugin implements \Mibew\Plugin\Plugi
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
$ip = end($matches[0]);
|
||||||
$info = PluginManager::getInstance()
|
$info = PluginManager::getInstance()
|
||||||
->getPlugin('Mibew:GeoIp')
|
->getPlugin('Mibew:GeoIp')
|
||||||
->getGeoInfo($ip, get_current_locale());
|
->getGeoInfo($ip, get_current_locale());
|
||||||
@ -110,13 +114,12 @@ class Plugin extends \Mibew\Plugin\AbstractPlugin implements \Mibew\Plugin\Plugi
|
|||||||
public function pageAddJsHandler(&$args)
|
public function pageAddJsHandler(&$args)
|
||||||
{
|
{
|
||||||
if ($args['request']->attributes->get('_route') == 'users') {
|
if ($args['request']->attributes->get('_route') == 'users') {
|
||||||
$filepath = str_replace(DIRECTORY_SEPARATOR, '/', $this->getFilesPath());
|
$args['js'][] = $this->getFilesPath() . '/vendor/jquery-colorbox/jquery.colorbox-min.js';
|
||||||
$args['js'][] = $filepath . '/vendor/jquery-colorbox/jquery.colorbox-min.js';
|
|
||||||
$args['js'][] = array(
|
$args['js'][] = array(
|
||||||
'content' => $this->getApiUrl(),
|
'content' => $this->getApiUrl(),
|
||||||
'type' => AssetManagerInterface::ABSOLUTE_URL,
|
'type' => AssetManagerInterface::ABSOLUTE_URL,
|
||||||
);
|
);
|
||||||
$args['js'][] = $filepath . '/js/plugin.js';
|
$args['js'][] = $this->getFilesPath() . '/js/plugin.js';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,9 +131,8 @@ class Plugin extends \Mibew\Plugin\AbstractPlugin implements \Mibew\Plugin\Plugi
|
|||||||
public function pageAddCssHandler(&$args)
|
public function pageAddCssHandler(&$args)
|
||||||
{
|
{
|
||||||
if ($args['request']->attributes->get('_route') == 'users') {
|
if ($args['request']->attributes->get('_route') == 'users') {
|
||||||
$filepath = str_replace(DIRECTORY_SEPARATOR, '/', $this->getFilesPath());
|
$args['css'][] = $this->getFilesPath() . '/vendor/jquery-colorbox/example3/colorbox.css';
|
||||||
$args['css'][] = $filepath . '/vendor/jquery-colorbox/example3/colorbox.css';
|
$args['css'][] = $this->getFilesPath() . '/css/styles.css';
|
||||||
$args['css'][] = $filepath . '/css/styles.css';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,7 +141,7 @@ class Plugin extends \Mibew\Plugin\AbstractPlugin implements \Mibew\Plugin\Plugi
|
|||||||
*/
|
*/
|
||||||
public static function getVersion()
|
public static function getVersion()
|
||||||
{
|
{
|
||||||
return '1.1.1';
|
return '1.0.1';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -5,7 +5,7 @@ It shows your clients' location at Google maps!
|
|||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
1. Get the archive with the plugin sources. You can download it from the [official site](https://mibew.org/plugins#mibew-google-maps) or build the plugin from sources.
|
1. Get the archive with the plugin sources. At the moment the only option is to build the plugin from sources.
|
||||||
|
|
||||||
2. Untar/unzip the plugin's archive.
|
2. Untar/unzip the plugin's archive.
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ gulp.task('bower', function(callback) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('prepare-release', gulp.series('bower', function() {
|
gulp.task('prepare-release', ['bower'], function() {
|
||||||
var version = require('./package.json').version;
|
var version = require('./package.json').version;
|
||||||
|
|
||||||
return eventStream.merge(
|
return eventStream.merge(
|
||||||
@ -30,10 +30,12 @@ gulp.task('prepare-release', gulp.series('bower', function() {
|
|||||||
)
|
)
|
||||||
.pipe(chmod(0644))
|
.pipe(chmod(0644))
|
||||||
.pipe(gulp.dest('release'));
|
.pipe(gulp.dest('release'));
|
||||||
}));
|
});
|
||||||
|
|
||||||
// Builds and packs plugins sources
|
// Builds and packs plugins sources
|
||||||
gulp.task('default', gulp.series('prepare-release'));
|
gulp.task('default', ['prepare-release'], function() {
|
||||||
|
// The "default" task is just an alias for "prepare-release" task.
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns files stream with the plugin sources.
|
* Returns files stream with the plugin sources.
|
||||||
|
10
package.json
10
package.json
@ -1,13 +1,13 @@
|
|||||||
{
|
{
|
||||||
"version": "1.1.1",
|
"version": "1.0.1",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"bower": "~1.8.8",
|
"bower": "~1.3.12",
|
||||||
"gulp": "~4.0.0",
|
"gulp": "~3.8.10",
|
||||||
"event-stream": "~3.1.7",
|
"event-stream": "~3.1.7",
|
||||||
"gulp-zip": "~2.0.2",
|
"gulp-zip": "~2.0.2",
|
||||||
"gulp-tar": "~3.1.0",
|
"gulp-tar": "~1.3.1",
|
||||||
"gulp-gzip": "~0.0.8",
|
"gulp-gzip": "~0.0.8",
|
||||||
"gulp-chmod": "~3.0.0",
|
"gulp-chmod": "~1.2.0",
|
||||||
"gulp-rename": "~1.2.0"
|
"gulp-rename": "~1.2.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user