2017 © Pedro Peláez
 

library geolocalizer

Geo provider for WP Bones

image

wpbones/geolocalizer

Geo provider for WP Bones

  • Saturday, May 27, 2017
  • by gfazioli
  • Repository
  • 1 Watchers
  • 0 Stars
  • 10 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

Geo Localizer packager for WP Bones

[![Latest Stable Version](https://poser.pugx.org/wpbones/geolocalizer/v/stable?style=for-the-badge)](https://packagist.org/packages/wpbones/geolocalizer)   [![Latest Unstable Version](https://poser.pugx.org/wpbones/geolocalizer/v/unstable?style=for-the-badge)](https://packagist.org/packages/wpbones/geolocalizer)   [![Total Downloads](https://poser.pugx.org/wpbones/geolocalizer/downloads?style=for-the-badge)](https://packagist.org/packages/wpbones/geolocalizer)   [![License](https://poser.pugx.org/wpbones/geolocalizer/license?style=for-the-badge)](https://packagist.org/packages/wpbones/geolocalizer)   [![Monthly Downloads](https://poser.pugx.org/wpbones/geolocalizer/d/monthly?style=for-the-badge)](https://packagist.org/packages/wpbones/geolocalizer)

Geo Localizer provides a set of utilities to manage geolocation for WordPress/WP Bones, (*1)

Requirements

This package works with a WordPress plugin written with WP Bones framework library., (*2)

Installation

You can install third party packages by using:, (*3)

```sh copy php bones require wpbones/geolocalizer, (*4)


I advise to use this command instead of `composer require` because doing this an automatic renaming will done. You can use composer to install this package: ```sh copy composer require wpbones/geolocalizer

You may also to add "wpbones/geolocalizer": "^1.0" in the composer.json file of your plugin:, (*5)

```json copy filename="composer.json" {4} "require": { "php": ">=7.4", "wpbones/wpbones": "~0.8", "wpbones/geolocalizer": "~1.0" },, (*6)


and run ```sh copy composer install

Alternatively, you can get the single files src/resources/assets/js/actions-and-filters.js in your WP Bones plugin and compile it with gulp. Also, you can get pre-compiled minified version src/public/js/actions-and-filters.min.js., (*7)

Migration

In the database/migrations you'll find the default migration database table used for the countries. Also. in the database/seeders you'll find the data for countries database table., (*8)

Anyway, you just copy these folders in your plugin database/ folder., (*9)

Geo services

This version is using the IPStack service to get the country code and the rest of the data. You have to create an account in IPStack and get your API key. In your plugin you may use the API key b yusing the filter:, (*10)

```php copy add_filter('wpbones_geolocalizer_ipstack_api_key', function () { // get your api key rom your settings // for example, MyPlugin::$plugin->options->get('General/ipstack_api_key'); return $your_api_key; });, (*11)


## Testing In order to check if your API key is valid you can use the following command: ```php copy $info = MyPlugin\GeoLocalizer\GeoLocalizerProvider::geoIP();

You should receive all information starting from your IP address. Otherwise, you'll receive an error from IPStack service., (*12)

Shortcode

Geolocalizer provides a shortcode method. You can define you own shortcode in the your shortcode provider class:, (*13)

```php copy use WPMyPlugin\WPBones\Foundation\WordPressShortcodesServiceProvider as ServiceProvider; use WPMyPlugin\GeoLocalizer\GeoLocalizerProvider;, (*14)

class WPMyPluginShortcode extends ServiceProvider {, (*15)

/** * List of registred shortcodes. {shortcode}/method * * @var array */ protected $shortcodes = [ 'my_shortocde_geo' => 'my_shortocde_geo', ];, (*16)

public function my_shortocde_geo( $atts = [], $content = null ) { return GeoLocalizerProvider::shortcode( $atts, $content ); }, (*17)


The you can use: ```txt copy [my_shortocde_geo city="Rome"] Only for Rome [/my_shortocde_geo]

```txt copy [my_shortocde_geo city="rome"] Only for Rome [/my_shortocde_geo], (*18)


```txt copy [my_shortocde_geo city="rome,london"] Only for Rome and Landon [/my_shortocde_geo]

```txt copy [my_shortocde_geo region_name="lazio"] Only for region (Italy) Lazio [/my_shortocde_geo], (*19)


```txt copy [my_shortocde_geo country_code="IT"] Italian only [/my_shortocde_geo]

```txt copy [my_shortocde_geo country_name="italy"] Italian only [/my_shortocde_geo], (*20)


```txt copy [my_shortocde_geo zip_code="00137"] Wow [/my_shortocde_geo]

```txt copy [my_shortocde_geo ip="80.182.82.82"] Only for me [/my_shortocde_geo], (*21)


```txt copy [my_shortocde_geo time_zone="europe\rome"] Rome/Berlin time zone [/my_shortocde_geo]

The Versions

27/05 2017

dev-master

9999999-dev https://github.com/wpbones/geolocalizer

Geo provider for WP Bones

  Sources   Download

MIT

geo localization countries wp bones

27/05 2017

0.5.3

0.5.3.0 https://github.com/wpbones/geolocalizer

Geo provider for WP Bones

  Sources   Download

MIT

geo localization countries wp bones

04/02 2017

0.5.2

0.5.2.0 https://github.com/wpbones/geolocalizer

Geo provider for WP Bones

  Sources   Download

MIT

geo localization countries wp bones

03/02 2017

0.5.1

0.5.1.0 https://github.com/wpbones/geolocalizer

Geo provider for WP Bones

  Sources   Download

MIT

geo localization countries wp bones

03/02 2017

0.5.0

0.5.0.0 https://github.com/wpbones/geolocalizer

Geo provider for WP Bones

  Sources   Download

MIT

css less wp bones