Compare commits

...

9 Commits

5 changed files with 25 additions and 28 deletions

1
.gitignore vendored
View File

@ -1,5 +1,6 @@
# 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

View File

@ -75,16 +75,13 @@ 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 adress. For example it // An IP string can contain more than one IP address. For example it
// can be something like this: "x.x.x.x (x.x.x.x)". Thus we need to // can be something like this: "x.x.x.x (x.x.x.x)". We need to
// extract all IPS from the string and use the last one. // use only first one.
$count = preg_match_all( $ips = explode(' ', $function['arguments']['ip'], 2);
"/(?:(?:[0-9]{1,3}\.){3}[0-9]{1,3})/", $ip = filter_var($ips[0], FILTER_VALIDATE_IP);
$function['arguments']['ip'], if (!$ip) {
$matches // There is no valid IP in the string. An error should be returned.
);
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!',
@ -92,7 +89,6 @@ 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());
@ -114,12 +110,13 @@ 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') {
$args['js'][] = $this->getFilesPath() . '/vendor/jquery-colorbox/jquery.colorbox-min.js'; $filepath = str_replace(DIRECTORY_SEPARATOR, '/', $this->getFilesPath());
$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'][] = $this->getFilesPath() . '/js/plugin.js'; $args['js'][] = $filepath . '/js/plugin.js';
} }
} }
@ -131,8 +128,9 @@ 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') {
$args['css'][] = $this->getFilesPath() . '/vendor/jquery-colorbox/example3/colorbox.css'; $filepath = str_replace(DIRECTORY_SEPARATOR, '/', $this->getFilesPath());
$args['css'][] = $this->getFilesPath() . '/css/styles.css'; $args['css'][] = $filepath . '/vendor/jquery-colorbox/example3/colorbox.css';
$args['css'][] = $filepath . '/css/styles.css';
} }
} }
@ -141,7 +139,7 @@ class Plugin extends \Mibew\Plugin\AbstractPlugin implements \Mibew\Plugin\Plugi
*/ */
public static function getVersion() public static function getVersion()
{ {
return '1.0.1'; return '1.1.1';
} }
/** /**

View File

@ -5,7 +5,7 @@ It shows your clients' location at Google maps!
## Installation ## 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-google-maps) or build the plugin from sources.
2. Untar/unzip the plugin's archive. 2. Untar/unzip the plugin's archive.

View File

@ -18,7 +18,7 @@ gulp.task('bower', function(callback) {
}); });
}); });
gulp.task('prepare-release', ['bower'], function() { gulp.task('prepare-release', gulp.series('bower', function() {
var version = require('./package.json').version; var version = require('./package.json').version;
return eventStream.merge( return eventStream.merge(
@ -30,12 +30,10 @@ gulp.task('prepare-release', ['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', ['prepare-release'], function() { gulp.task('default', gulp.series('prepare-release'));
// 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.

View File

@ -1,13 +1,13 @@
{ {
"version": "1.0.1", "version": "1.1.1",
"devDependencies": { "devDependencies": {
"bower": "~1.3.12", "bower": "~1.8.8",
"gulp": "~3.8.10", "gulp": "~4.0.0",
"event-stream": "~3.1.7", "event-stream": "~3.1.7",
"gulp-zip": "~2.0.2", "gulp-zip": "~2.0.2",
"gulp-tar": "~1.3.1", "gulp-tar": "~3.1.0",
"gulp-gzip": "~0.0.8", "gulp-gzip": "~0.0.8",
"gulp-chmod": "~1.2.0", "gulp-chmod": "~3.0.0",
"gulp-rename": "~1.2.0" "gulp-rename": "~1.2.0"
} }
} }