Title: Quick Flag
Author: Marko-M
Published: <strong>2012 年 3 月 6 日</strong>
Last modified: 2019 年 8 月 2 日

---

搜尋外掛

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

![](https://s.w.org/plugins/geopattern-icon/quick-flag.svg)

# Quick Flag

 由 [Marko-M](https://profiles.wordpress.org/marko-m/) 開發

[下載](https://downloads.wordpress.org/plugin/quick-flag.zip)

 * [詳細資料](https://tw.wordpress.org/plugins/quick-flag/#description)
 * [使用者評論](https://tw.wordpress.org/plugins/quick-flag/#reviews)
 *  [安裝方式](https://tw.wordpress.org/plugins/quick-flag/#installation)
 * [開發資訊](https://tw.wordpress.org/plugins/quick-flag/#developers)

 [技術支援](https://wordpress.org/support/plugin/quick-flag/)

## 外掛說明

Quick Flag resolves IP address to [ISO 3166-1 alpha-2](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)
two-letter country code and name using [ip-countryside](http://code.google.com/p/ip-countryside/)
generated database and displays country flag if required. In contrast to other IP
to country solutions this one allows you to create and update database your self
using 5 Regional Internet Registrars (RIR) databases: AFRINIC, APNIC, ARIN, LACNIC
and RIPE and ip-countryside open source application that does the work of generating
database for you. You can also update IP to country database automatically with 
single click or schedule weekly automatic updates.

**Big thanks to [Markus Goldstein](http://madm.dfki.de/goldstein/) for ip-countryside
project, weekly database updates and automatic update server used in the past. To
offload Markus server, database updates are currently generated by me and stored
inside [GitHub repository](https://github.com/Marko-M/ip-countryside-db).**

#### Quick Flag feature highlights

 * **New in v2.10**: Country names can be translated using Poedit
 * Quick Flag database can be updated using single click without updating Quick 
   Flag plugin.
 * Quick Flag database can be auto updated weekly without updating Quick Flag plugin.
 * Because of the way Quick Flag database is created it has probably the most accurate
   IP to country database you can find.
 * Database updates are generated using open source [ip-countryside](http://code.google.com/p/ip-countryside/)
   application.
 * Quick Flag provides PHP function to retrieve country code and country name for
   given IP address (see FAQ for more)
 * Quick Flag provides PHP function to retrieve country flag image for given country,
   248 flag images provided by [Mark James](http://www.famfamfam.com)

#### Other WordPress plugins supporting Quick Flag

 * Voting polls plugin [Quick Poll](http://www.techytalk.info/wordpress-plugins/quick-poll/)
 * Who is online plugin [Quick Count](http://www.techytalk.info/wordpress-plugins/quick-count/)
 * Chat plugin [Quick Chat](http://www.techytalk.info/wordpress-plugins/quick-chat/)

For more information and demo please visit [Quick Flag demo](http://www.techytalk.info/wordpress-plugins/quick-flag/)
page at [TechyTalk.info](http://www.techytalk.info/).

## 螢幕擷圖

 * [[
 * Quick Flag inside who is online plugin [Quick Count](http://www.techytalk.info/wordpress-plugins/quick-count/)

## 安裝方式

Quick Flag can be installed using integrated WordPress plugin installer or manually.

#### Integrated WordPress plugin installer method:

 1. Go to Plugins > Add New.
 2. Under Search, type in ’Quick Flag’.
 3. Click Install Now to install the WordPress Plugin.
 4. A popup window will ask you to confirm your wish to install the Plugin.
 5. If this is the first time you’ve installed a WordPress Plugin, enter the FTP login
    credential information. If you’ve installed a Plugin before, it will still have
    the login information.
 6. Click Proceed to continue with the installation. The resulting installation screen
    will list the installation as successful or note any problems during the install.
 7. If successful, click Activate Plugin to activate it, or Return to Plugin Installer
    for further actions.
 8. Have fun using geolocation trough your own plugin.

#### Manual method:

 1. Upload ’quick-flag’ folder from quick-flag.zip file downloaded from [Quick Flag WordPress plugin directory page](https://wordpress.org/extend/plugins/quick-flag/)
    to the ’/wp-content/plugins/’ directory.
 2. Activate ’Quick Flag’ plugin through the ’Plugins’ menu in WordPress.
 3. Have fun using geolocation trough your own plugin code.

## 常見問題集

  How do I test is Quick Flag installed properly?

You can place `[quick-flag]` shortcode to add current IP address country name and
flag image to your page or post. To display country name and flag image of IP address
other than current you can use this shortcode like `[quick-flag ip="some_ip_address"]`.

  Can you provide example for fetching country info and flag for imaginary `123.123.123.123`
IP address from country Croatia?

You can use something like this:

    ```
    // Query database with following IP address
    $ip_address = '123.123.123.123';

    global $quick_flag;
    if(isset($quick_flag) && is_object($quick_flag)){
        if(($info = $quick_flag->get_info($ip_address)) != false){
            $version = $info->version;      // Quick Flag version (float): 2.00
            $ip = $info->ip;                // IP address (string): 123.123.123.123
            $code = $info->code;            // Country code (string): HR
            $name = $info->name;            // Country name (string): Croatia
            $latitude = $info->latitude;    // Country latitude (float): 45.1667
            $longitude = $info->longitude;  // Country longitude (float): 15.5
            $flag = $quick_flag->get_flag($info, 'my-own-css-class'); // CSS class is optional, 'quick-flag' by default
        }
    }
    ```

$flag variable will contain following string:

    ```
    <img
        class="my-own-css-class"
        title="Croatia"
        src="http://www.yoursite.com/wp-content/plugins/quick-flag/img/flags/HR.gif"
    />
    ```

  How do I translate country names to my own language?

Like most WordPress plugins Quick Flag can be translated using gettext. You can 
use Poedit application to open translation template from ‘languages’ directory or
you can use [Quick Flag online translation interface](http://www.techytalk.info/wordpress-plugins/quick-flag/#translations).
Please keep in mind that after you change your blog language or update language 
files you must trigger database update to update country names inside database. 
Currently the easiest way to do this is to delete ip2country.db and ip2country.version
files from ‘database’ directory and click ‘Update’ button in Quick Flag settings.

## 使用者評論

![](https://secure.gravatar.com/avatar/d8a3a7bdeaab19b55d4755b1ac878c7b342fb321f4e50b76d5d1b7402339a2d3?
s=60&d=retro&r=g)

### 󠀁[Quick Flag](https://wordpress.org/support/topic/quick-flag/)󠁿

 [KathleenH](https://profiles.wordpress.org/kathleenh/) 2016 年 10 月 27 日

We installed this ages ago and it is still working well as we have updated our WP.
Thanks!

![](https://secure.gravatar.com/avatar/12c3894e87084de2a5b01d14a337695336739ce5900a9c415114ee60e8533f5e?
s=60&d=retro&r=g)

### 󠀁[Good job!](https://wordpress.org/support/topic/good-job-593/)󠁿

 [WaKeMaTTa](https://profiles.wordpress.org/wakematta/) 2017 年 2 月 7 日

good job

 [ 閱讀全部 3 則使用者評論 ](https://wordpress.org/support/plugin/quick-flag/reviews/)

## 參與者及開發者

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

參與者

 *   [ Marko-M ](https://profiles.wordpress.org/marko-m/)

[將〈Quick Flag〉外掛本地化為台灣繁體中文版](https://translate.wordpress.org/projects/wp-plugins/quick-flag)

### 對開發相關資訊感興趣？

任何人均可[瀏覽程式碼](https://plugins.trac.wordpress.org/browser/quick-flag/)、
查看 [SVN 存放庫](https://plugins.svn.wordpress.org/quick-flag/)，或透過 [RSS](https://plugins.trac.wordpress.org/log/quick-flag/?limit=100&mode=stop_on_copy&format=rss)
訂閱[開發記錄](https://plugins.trac.wordpress.org/log/quick-flag/)。

## 變更記錄

#### 2.12 (02.08.2019.)

 * Switch ip2country database source to one kindly provided by Markus Goldstein

#### 2.11 (25.11.2012.)

 * Fix for ip2long returning signed integer on 32-bit systems

#### 2.10 (12.09.2012.)

 * Add ability to translate country names using Poedit
 * Update ISO 3166-2 country names and codes
 * Change database update URLs to GitHub repository
 * Database updated to 11.09.2012. version

#### 2.02 (23.07.2012.)

 * Code refactoring and minor cleanup
 * Fix another bug where Quick Flag fails to operate on PHP versions older than 
   5.3.0

#### 2.01 (22.07.2012.)

 * Fix bug where Quick Flag fails to operate on PHP versions older than 5.3.0

#### 2.00 (22.07.2012.)

 * Add admin settings page
 * Add single click database update feature and admin settings button
 * Add auto database update feature and admin settings toggle checkbox
 * quick_flag_get_info() deprecated. Use $quick_flag->get_info() instead.
 * quick_flag_get_flag() deprecated. Use $quick_flag->get_flag() instead.
 * Database updated to 17.07.2012. version

#### 1.14 (07.07.2012.)

 * Database updated to 03.07.2012. version

#### 1.13 (23.04.2012.)

 * Database updated to 17.04.2012. version

#### 1.12 (27.03.2012.)

 * Database updated to 27.03.2012. version

#### 1.11 (17.03.2012.)

 * Fix bug where all users were resolved to country Croatia

#### 1.10 (16.03.2012.)

 * Database updated to 13.03.2012. version
 * Place latitude and longitude data inside
 * Add new global variable $quick_flag_version
 * Place Quick Flag version inside data returned by `quick_flag_get_info()`. If 
   you are using cookies to store users geolocation data you can easily check cookie
   for Quick Flag version that created this data. If data is not up to date you 
   can fetch new data and update cookie.
 * Split country and ip ranges data into separate tables, join them when necessary.
   This gives us around 40% database size reduction.

#### 1.00 (06.03.2012.)

 * Initial release
 * Database updated to 06.03.2012. version

## 中繼資料

 *  版本 **2.12**
 *  最後更新 **7 年前**
 *  啟用安裝數 **100+**
 *  WordPress 版本需求 ** 3.0 或更新版本 **
 *  已測試相容的 WordPress 版本 **3.4.2**
 *  語言
 * [English (US)](https://wordpress.org/plugins/quick-flag/)
 * 標籤:
 * [geolocation](https://tw.wordpress.org/plugins/tags/geolocation/)[ip to country](https://tw.wordpress.org/plugins/tags/ip-to-country/)
   [ip2country](https://tw.wordpress.org/plugins/tags/ip2country/)
 *  [進階檢視](https://tw.wordpress.org/plugins/quick-flag/advanced/)

## 評分

 5 星，滿分為 5 星

 *  [  3 個 5 星使用者評論     ](https://wordpress.org/support/plugin/quick-flag/reviews/?filter=5)
 *  [  0 個 4 星使用者評論     ](https://wordpress.org/support/plugin/quick-flag/reviews/?filter=4)
 *  [  0 個 3 星使用者評論     ](https://wordpress.org/support/plugin/quick-flag/reviews/?filter=3)
 *  [  0 個 2 星使用者評論     ](https://wordpress.org/support/plugin/quick-flag/reviews/?filter=2)
 *  [  0 個 1 星使用者評論     ](https://wordpress.org/support/plugin/quick-flag/reviews/?filter=1)

[Your review](https://wordpress.org/support/plugin/quick-flag/reviews/#new-post)

[查看全部使用者評論](https://wordpress.org/support/plugin/quick-flag/reviews/)

## 參與者

 *   [ Marko-M ](https://profiles.wordpress.org/marko-m/)

## 技術支援

使用者可在技術支援論壇提出意見反應或使用問題。

 [檢視技術支援論壇](https://wordpress.org/support/plugin/quick-flag/)

## 贊助

想要支援這個外掛的發展嗎？

 [ 贊助這個外掛 ](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=CZQW2VZNHMGGN)