1. CCA methods and functions that can be called in your code:
Remember shortcodes are available as well
a. Get the country code for the visitor’s location:
Returns the alphabetic 2 character ISO country code for the visitor, or an empty string if not found.
Use the ‘lower’ argument if you want the country code in lowercase.
b. Get the country name of the visitor’s location:
Returns the country name (see dropdown box above for actual text used for a country). For compactness small less visited “countries” e.g. “British Antartic Territiories” are omitted.
c. Determine whether or not visitor is from the European Union:
Returns true if visitor is from the EU; or false otherwise. The list of “is EU” country codes user modifiable via the “Countries” tab of CCA settings.
d. Determine whether visitor is from one or more specified countries:
“‘AA,BB'” is a comma separated list of country codes. The function returns true if the visitor is from one of the countries in this list (otherwise false is returned).
e. Determine whether visitor is NOT from one of the specified countries:
“‘AA,BB'” is a comma separated list of country codes. The function returns true if the visitor is NOT from one of the countries in this list (otherwise false is returned).
f. Get a country code/country name array:
You can use this array to create a country/ISO Code selection box e.g.:
$country_array = CCAgeoip::get_country_array(); $selected = 'US'; foreach($country_array as $country_code=>$country_name ) : echo '<option value="' . $country_code .'" ' . selected($selected, $country_code, FALSE ) . '>' . $country_name .'</option>'; endforeach;
2. Filter and Action hooks
The CCA plugin is designed to be extendable. It is possible to add options to settings and widget tabs, add additional tabs, and your own additional functionality.
Some of the functionality added by the CCA goodies extension
Along with the CCA goodies extension you can also use the RSS built into the base CCA plugin as an example for building your own extension. (although RSS functionality is included in the CCA plugin, it is generated by actions and filters, and could have been provided by a separate extension plugin).
Documenting available filters/actions is still on my to do list; I may remove or rename some – so contact me before you make use of them; I may also give your extension a write up.