前言介紹
- 這款 WordPress 外掛「Ochre W3C Geolocation Services」是 2012-01-08 上架。
- 目前有 10 個安裝啟用數。
- 上一次更新是 2012-01-09,距離現在已有 4863 天。超過一年沒更新,安裝要確認版本是否可用。以及後續維護問題!
- 外掛最低要求 WordPress 3.0.0 以上版本才可以安裝。
- 尚未有人給過這款外掛評分。
- 還沒有人在論壇上發問,可能目前使用數不多,還沒有什麼大問題。
外掛協作開發者
外掛標籤
w3c | ochre | location | geolocation | geo location |
內容簡介
Ochre’s Geolocation Services plugin for
WordPress 使用 W3C Geolocation API 取得訪客的實際位置,讓 WordPress 網站能夠呈現適當於訪客實際位置的內容,例如當地地圖、活動列表、分店和加盟店位置、社交媒體和其他地理上有趣的資訊。
外掛提供三個後端動作鉤子可用於您或第三方插件或主題動作使用,以及 AJAX 動作用於定製「前端」,例如執行 JavaScript 與解析的位置資訊、重新導向到新頁面或重新整理當前頁面。
設定
WordPress 設定->Ochre Geolocation 頁面提供全域設定和每個頁面/文章的地理位置設定:
全域或每個頁面/文章地理位置設定
每個頁面/文章的設定包括:
執行自訂 JavaScript
重新導向到 URL
重新整理頁面
在前端關閉 ochregeo 動作
完全禁用
動作
當接收到地理位置更新時,do_action() 會啟動以下動作:
ochregeo_received_nosupport:裝置/瀏覽器不支援地理位置
ochregeo_received_unknownpos:無法檢索位置
ochregeo_received_location: 已接收位置,此動作將 OCHRELABS_WP_Geolocation 物件作為唯一參數
AJAX 動作
實作以下 AJAX 動作:
(nopriv) ochregeo_ochregeos:傳送位置資訊並基於每個頁面/文章或全域設定執行動作。
(nopriv) ochregeo_get_coordinates:檢索最近接收到的位置資訊。(我們未測試過這個)
在成功地地理位置更新後執行自訂 JavaScript
在每個頁面/文章或全域執行的 JavaScript 可以存取包含 Geolocation 服務外掛程式的資訊的 res 物件。
此物件的屬性包括:
res.la:緯度
res.ll:經度
res.ev:海拔(不一定可用 - 不要依賴)
res.ac:準確度(不一定可用 - 不要依賴)
如果啟用了反向地理編碼,物件還可以包含:
res.country:國家
res.countryc:國家代碼
res.state:州/省
res.statec:洲/省代碼
res.city:城市
El Quickie API 參考
// 這是外掛程式實例化的 Ochre Geo 物件。
$ochre_geo = new OCHRELABS_WP_Geolocation();
// 取得當前地理位置請求的狀態。$ochre_geo::STATUS_UPDATED 代表您具有「有效」的座標資料。
// 相關常數如下:
$ochre_geo::STATUS_QUERY; // 等待客戶端更新
$ochre_geo::STATUS_UPDATED; // 已從客戶端接收到座標更新
$ochre_geo::STATUS_NOTSUPPORTED; // 設備不支援地理位置
$ochre_geo::STATUS_ERROR; // 客戶端返回了錯誤
$ochre_geo::STATUS_UNKNOWNPOS; // 位置不明
$ochre_geo::STATUS_DISABLED; // 模組已告知不顯示地理位置功能
原文外掛簡介
Ochre’s Geolocation Services plugin for
WordPress utilizes the W3C Geolocation API to retrieve a visitor’s physical location, enabling a
WordPress website to present content relevant to a visitors current physical location such as local maps, event listings, branch and franchise locations, social media and other information that is geographically
interesting.
The plugin provides three “back end” action hooks for use by your or third party plugins or theme actions, and AJAX actions for “front end” customization such as executing javascript with the resolved Location information, redirecting to a new page, or refreshing the current page.
Configuration
Global Configuration is available from the WordPress settings->Ochre Geolocation page:
Global or per-post/per page geolocation behavour
Per-page and per-post configurations include:
Executing custom javascript
Redirecting to a URL
Performing a page refresh
Firing off the ochregeo actions but doing nothing on the front end
Disabling completely
Actions
The following actions for do_action() are fired when a Geolocation update is received:
ochregeo_received_nosupport : No Geolocation support in the device/browser
ochregeo_received_unknownpos : A position could not be retrieved
ochregeo_received_location : Position was received. This action is passed the OCHRELABS_WP_Geolocation object as its only argument
AJAX actions
The following AJAX actions are implemented:
(nopriv) ochregeo_ochregeos : Transmits location information and executes an action based on a per-post/page or global setting.
(nopriv) ochregeo_get_coordinates : Retrieves last received location information. (we haven’t tested this)
Executing custom javascript after a succesful Geolocation update
Javascript executed on a per-page/post or global basis has access to a res object
containing information from the Geolocation Service plugin.
Properties of this object are:
res.la; // latitude
res.ll; // longitude
res.ev; // elevation (not always available - do not rely on)
res.ac // accuracy (not always available - do not rely on)
If reverse geo coding is enabled, the object may also contain:
res.country // country
res.countryc // country code
res.state // state
res.statec // state code
res.city // city
El Quickie API Reference
`
// This is the Ochre Geo object instantiated by the plugin.
$ochre_geo = new OCHRELABS_WP_Geolocation();
// Get status of the current geolocation request. $ochre_geo::STATUS_UPDATED means you have “valid” coordinate data.
// Constants are:
$ochre_geo::STATUS_QUERY; // waiting for update from client
$ochre_geo::STATUS_UPDATED; // received coordinate update from client
$ochre_geo::STATUS_NOTSUPPORTED; // client does not support geo location
$ochre_geo::STATUS_ERROR; // an error was returned from the client
$ochre_geo::STATUS_UNKNOWNPOS; // location was unknown
$ochre_geo::STATUS_DISABLED; // module has been told not to present geolocation query
$ochre_geo->get_status();
// Set the location information manually (not normally needed)
$ochre_geo->set_coordinates($latitude,$longitude,$elevation=0,$accuracy=0);
// get the current resolved location information – check get_status() first before relying on this data!
// the returned array will be something like: array(“latitude”=>49.1234, “longitude”=>”-123.1234″,”elevation”=>0,”accuracy”=>0);
$ochre_geo->get_coordinates();
// geocodes the current resolved location information and returns it as an array like array(“city”=>”Vancouver”,”country”=>”Canada”,”state”=>”British Columbia”,”statec”=>”BC”,”country”=>”Canada”,”countryc”=>”CA”)
$ochre_geo->geocode();
Reverse Geo Coder
We've thrown in Yahoo! place finder Geocoding support. The geocoder()
returns an array consisting of something like:
array(
“city”=>”Vancouver”,”
“country”=>”Canada”,
“state”=>”British Columbia”,
“statec”=>”BC”,
“country”=>”Canada”,
“countryc”=>”CA”
)
`
Geo Coding support is still young and subject to change. It’s not hooked into the Javascript API, and since there are at least a few geo coder javascript api’s already out there we haven’t decided whether to do this or not.
各版本下載點
- 方法一:點下方版本號的連結下載 ZIP 檔案後,登入網站後台左側選單「外掛」的「安裝外掛」,然後選擇上方的「上傳外掛」,把下載回去的 ZIP 外掛打包檔案上傳上去安裝與啟用。
- 方法二:透過「安裝外掛」的畫面右方搜尋功能,搜尋外掛名稱「Ochre W3C Geolocation Services」來進行安裝。
(建議使用方法二,確保安裝的版本符合當前運作的 WordPress 環境。
延伸相關外掛(你可能也想知道)
Who Hit The Page – Hit Counter 》這個外掛可以在您的網站上添加一個隱形的網頁點擊計數器,讓您知道誰瀏覽了您的網頁,您可以知道每個 IP 地址所瀏覽的總頁數以及瀏覽每個頁面的每位使用者所...。
Geo Controller 》你準備好提升你的 WordPress 遊戲了嗎?認識 Geo Controller,前身為 CF Geo Plugin,這是一個最終的地理行銷工具,可讓你完全掌握你的網站地理位置信息。, ...。
Counter – Flag Counter 》這個 WordPress 外掛可以在小工具區內加入一個基於 JavaScript 的國旗計數器。, 你可以調整 JavaScript 程式碼設定。, 可以檢視最近 500 位訪客的城市和國家...。
IP Address Approval 》IP地址批准系统提供了一种简单的方式,让你允许或阻止访问你的网站,以保护你的网站不受不必要的访问者干扰。你可以在公网网站和私人网络网站上都使用IP地址...。
IP Geolocation 》這個外掛程式可用於顯示 IP 資訊和地理位置,並使用了第三方 API 服務。, 你可以使用以下 API 服務:, – ipinfo.io(你必須取得 api 金鑰 – 需要...。
My Geo Posts Free 》我的 Geo Posts Free 外掛使用 IpInfoDb 和/或 geoPlugin 的服務,取得訪問者 IP 位置資料,並將該資料以 cookie 的形式保存在訪問者的瀏覽器中,以減少 API ...。
GEO my WordPress – Current Location Forms 》「Current Location Forms」是針對 WordPress 外掛「GEO my WP」所開發的一個附加元件。它可強化現有的「Current Location」小工具及短代碼,使您得以選擇要...。
WP-Ultimate-Map 》WP Ultimate Map 是一個 WordPress 外掛,可讓您使用獨特的圖示分組地點,也可以對路線進行分組。您可以在地圖上放置多個地點,繪製多條路線,甚至可以繪製路...。
WP Comments Google Map for Posts 》WP Comments Google Map for Posts(WordPress 文章留言 Google 地圖)會在您的文章中加入 Google 地圖,並為該文章中每個留言者的位置標上標記。, , 自訂地...。
VCAT EDULABS Posts at Google Maps 》使用此外掛,您可以將文章和頁面放到 Google 地圖上。Geo-Position(地理位置)將從地址確定。, Google 地圖可以通過兩個短代碼嵌入到文章或頁面中,這兩個短...。
Shift8 GEO IP Location 》這個外掛可以利用 ip-api 得到使用者 IP 位置的地理座標。請閱讀 這篇部落格文章以了解如何與外掛互動。, 想看這個外掛的實際效果嗎?, 您可以查看三個實際運...。
IP2Phrase 》這個外掛可以讓你客製化歡迎訊息或其他想呈現的內容,根據訪客的國家語系做客製化。它會透過IP地址來判斷訪客的位置,並且方便地創建一個簡單的本地化訊息,...。
IHS Geo Location 》此外掛會偵測你的所在地並提供給你可套用在 div 元素上的某些類別,或您可以在主題上使用簡碼來顯示使用者的現在地區、城市、州、國家和地址。, , 使用:, , ...。
GEO-location and directions 》此外掛會在僅限行動裝置使用者的瀏覽裝置中加入一個浮動按鈕。, 使用者按下此按鈕即可顯示其地理位置及前往網站所有者的位置指引。, 此外掛還提供控制面板,...。
Geo-Location 》使用者可以將他們的評論地理標記化,並在 Google Maps 上查看其位置。。