這個外掛並未在最新的 3 個 WordPress 主要版本上進行測試。開發者可能不再對這個外掛進行維護或提供技術支援,並可能會與更新版本的 WordPress 產生使用上的相容性問題。

DistanceFromMe

外掛說明

Finds the distance between the visitor to your site and your iOS device or a fixed location. Uses Find My Phone and Browser Geolocation to do so. Find my Phone is accessed using the Sosumi library (https://github.com/tylerhall/sosumi/).

The widget either tries to find your location using ‘Find my Phone’ and then works out the distance between you and the location provided by the site visitors browser. Alternatively you can enter the co-ordinates to use instead of using ‘Find my Phone’. For example you could set your location as your place of business to let site visitors know how far away they are from you.

Also includes the shortcode [dfme] that reads the geolocation information from a post and displays the distance from the users location to the post.

螢幕擷圖

  • Distancefromme widget in action
  • Configuration screen

安裝方式

  1. Upload distancefromme to the /wp-content/plugins/ directory
  2. Activate the plugin through the ‘Plugins’ menu in WordPress
  3. Configure the widget through the ‘Widget’ menu in WordPress to display it on your page

If you wish to use the shortcode to display the distance from the post add [dfme] to your post after installing the Goelocation plugin (https://wordpress.org/support/plugin/geolocation). This plugin uses the latitude and longitude values from the Geolocation plugin. The shortcode will only display the distance so you can add your own text around this value.

What do the widget configuration values do ?

  • Title : The title that will appear at the top of the widget
  • Use Find My Phone : If ‘Yes’ then the widget will use Find My Phone to get your current location. If set to ‘No’ then the widget will use the values provided for ‘Home Lat’ and ‘Home Lng’.
  • Show Device Name : If ‘Yes’ then the widget display the name of the device that it has retrieved the location for. If this is set to ‘No’ then the details from ‘Home Name’ will be displayed. If ‘Home Name’ field is empty then the text ‘my current location.’ will be used.
  • Find My Phone Username : You Apple Id username for Find My Phone
  • Find My Phone Password : You Apple Id password for Find My Phone
  • Device No : If you have multiple devices on your Find My Phone account then you can change which one is used by changing this number. Accepts values from 0 to 100. Defaults to 0 if no value is entered.
  • Timeout : How long in seconds the widget should spend looking for the Find My Phone device. Defaults to 300 if no value is entered.
  • Google Maps V2 API: Your Google Maps V2 API Key
  • Home Name: The name of your ‘home’ location. This wil be displayed to the site visitor.
  • Home Lat: The latitude of your ‘home’ location. This will not be displayed to the site visitor.
  • Home Lng: The longitude of your ‘home’ location. This will not be displayed to the site visitor.

常見問題集

Do I need to use Find My Phone ?

No. You can enter a set of co-ordinates and use these instead of our current location. This is useful if you want to let site visitors know how far away they are from a fixed point, your place of business for example.

How does it find my phone ?

Find my Phone is accessed using the Sosumi library (https://github.com/tylerhall/sosumi/) using your Find My Phone username and password.

What do the widget configuration values do ?
  • Title : The title that will appear at the top of the widget
  • Use Find My Phone : If ‘Yes’ then the widget will use Find My Phone to get your current location. If set to ‘No’ then the widget will use the values provided for ‘Home Lat’ and ‘Home Lng’.
  • Show Device Name : If ‘Yes’ then the widget display the name of the device that it has retrieved the location for. If this is set to ‘No’ then the details from ‘Home Name’ will be displayed. If ‘Home Name’ field is empty then the text ‘my current location.’ will be used.
  • Find My Phone Username : You Apple Id username for Find My Phone
  • Find My Phone Password : You Apple Id password for Find My Phone
  • Device No : If you have multiple devices on your Find My Phone account then you can change which one is used by changing this number. Accepts values from 0 to 100. Defaults to 0 if no value is entered.
  • Timeout : How long in seconds the widget should spend looking for the Find My Phone device. Defaults to 300 if no value is entered.
  • Google Maps V2 API: Your Google Maps API
  • Home Name: The name of your ‘home’ location. This wil be displayed to the site visitor.
  • Home Lat: The latitude of your ‘home’ location. This will not be displayed to the site visitor.
  • Home Lng: The longitude of your ‘home’ location. This will not be displayed to the site visitor.
Disclaimer

This was hacked together over a weekend to keep me entertained. It works for me on my site and I have tested it with a couple of installations but your milage may vary.

Potential Enhancements
  • Display iOS last location update accuracy/timestamp
  • Tidy up widget configuration
  • Take a place name and lookup lat/lng instead of manually adding values in configuration
  • Better exception handling and error messages
  • Support for expressing distance in miles or km
  • Update Google API to 3

使用者評論

這個外掛目前沒有任何使用者評論。

參與者及開發者

以下人員參與了開源軟體〈DistanceFromMe〉的開發相關工作。

參與者

將〈DistanceFromMe〉外掛本地化為台灣繁體中文版

對開發相關資訊感興趣?

任何人均可瀏覽程式碼、查看 SVN 存放庫,或透過 RSS 訂閱開發記錄

變更記錄

0.3

  • Added [dfme] tag for posts that displays distance from post.
  • Geolocation Plugin required for [dfme] shortcode functionality (https://wordpress.org/support/plugin/geolocation)

0.2

  • You can now specify the device id to search for if you have multiple devices configured in Find My Phone
  • Added ‘timeout’, ‘device no’ and ‘show device name’ parameters to configuration
  • Slightly better error handling

0.1

  • Initial development