$geocode_error
$geocode_error : \WP_Error
The last geocode error, or empty if no error.
Static class to provide a namespace for Geo Mashup data functions.
object_storage(string $object_name, array $new_storage) : array|boolean
Get or set storage information for an object name.
Potentially you could add storage information for a new kind of object:
GeoMashupDB::object_storage( 'foo', array(
'table' => $wpdb->prefix . 'foos',
'id_column' => 'foo_id',
'label_column' => 'foo_display_name',
'sort' => 'foo_order ASC' )
); Would add the necessary information for a custom table of foo objects. By convention the object name is the singular form of the table name without a prefix.
string | $object_name | A type of object to be stored, default is 'post', 'user', and 'comment'. |
array | $new_storage | If provided, adds or replaces the storage information for the object name. |
The storage information array, or false if not found.
query_vars( $public_query_vars)
WordPress filter to add Geo Mashup public query variables.
query_vars filter called by Wordpress.
$public_query_vars |
since | 1.3 |
---|
parse_query( $query)
WordPress action to capture custom orderby field before it is removed.
parse_query action called by WordPress.
$query |
since | 1.3 |
---|---|
static |
posts_fields( $fields, $query)
WordPress filter to add Geo Mashup fields to WordPress post queries.
posts_fields filter called by WordPress.
$fields | ||
$query |
since | 1.3 |
---|
posts_join( $join, $query)
WordPress filter to join Geo Mashup tables to WordPress post queries.
posts_join filter called by WordPress.
$join | ||
$query |
since | 1.3 |
---|
posts_where( $where, $query)
WordPress filter to incorporate geo mashup query vars in WordPress post queries.
posts_where filter called by WordPress.
$where | ||
$query |
since | 1.3 |
---|
activation_log(string $message, boolean $write) : string
Append to the activation log.
Add a message and optionally write the activation log. Needs to be written before the end of the request or it will not be saved.
string | $message | The message to append. |
boolean | $write | Whether to save the log. |
The current log.
since | 1.4 |
---|
since | 1.2 |
---|
get_administrative_name(string $country_code, string $admin_code, string $language) : string|null
Try to get a language-sensitive place administrative name.
First look in the names cached in the database, then query geonames.org for it. If a name can't be found for the requested language, a default name is returned, usually in the local language. If nothing can be found, returns NULL.
string | $country_code | Two-character ISO country code. |
string | $admin_code | Code for the administrative area within the country, or NULL to get the country name. |
string | $language | Language code, defaults to the WordPress locale language. |
Place name in the appropriate language, or if not available in the default language.
since | 1.4 |
---|
primary_language_code(string $language) : string
Trim a locale or browser accepted languages string down to the 2 or 3 character primary language code.
string | $language | Local or language code string, NULL for blog locale. |
Two (rarely three?) character language code.
since | 1.2 |
---|
geocode(mixed $query, array $location, string $language) : boolean
Try to fill in coordinates and other fields of a location from a textual location search.
Multiple geocoding services may be used. Google services are only used if the default map provider is Google.
mixed | $query | The search string. |
array | $location | The location array to geocode, modified. |
string | $language |
Whether a lookup succeeded.
since | 1.3 |
---|
are_any_location_fields_empty(array $location, array $fields) : boolean
Check a location for empty fields.
array | $location | The location to check. |
array | $fields | The fields to check. |
Whether any of the specified fields are empty.
since | 1.4 |
---|
bulk_reverse_geocode() : string
Try to reverse-geocode all locations with relevant missing data.
Used by the options page. Tries to comply with the PHP maximum execution time, and delay requests if Google sends a 604.
An HTML log of the actions performed.
since | 1.3 |
---|
cache_administrative_name(string $country_code, string $admin_code, string $isolanguage, string $name, string $geoname_id) : integer
Store an administrative name in the database to prevent future web service lookups.
string | $country_code | |
string | $admin_code | |
string | $isolanguage | |
string | $name | |
string | $geoname_id |
Rows affected.
since | 1.2 |
---|
duplicate_geodata() : boolean
Copy missing geo data to and from the standard location (http://codex.wordpress.org/Geodata) for posts, users, and comments.
True if no more orphan locations can be found.
since | 1.4 |
---|
blank_location(string $format) : array|object
Get a blank location.
Used to return object fields too - use blank_object_location for that if desired.
string | $format | OBJECT or ARRAY_A |
Empty location.
since | 1.2 |
---|
blank_object_location(string $format) : array|object
Get a blank object location.
string | $format | OBJECT or ARRAY_A |
Empty object location.
since | 1.4 |
---|
get_distinct_located_values(string $names, array $where) : array
Get distinct values of one or more object location fields.
Can be used to get a list of countries with locations, for example.
string | $names | Comma separated table field names. |
array | $where | Associtive array of conditional field names and values. |
WP_DB query results.
since | 1.2 |
---|
get_post_location(\id $post_id) : object
Get the location of a post.
\id | $post_id |
Post location.
since | 1.2 |
---|
get_object_location(string $object_name, integer $object_id, string $output) : object|array
Get the location of an object.
string | $object_name | 'post', 'user', a GeoMashupDB::object_storage() index. |
integer | $object_id | Object |
string | $output | (optional) one of ARRAY_A | ARRAY_N | OBJECT constants. Return an
|
Result or null if not found.
since | 1.3 |
---|
get_location(integer $location_id, string $output) : object|array
Get a location by ID.
integer | $location_id | |
string | $output | (optional) one of ARRAY_A | ARRAY_N | OBJECT constants. Return an
|
Result or null if not found.
since | 1.4 |
---|
get_post_locations(string $query_args) : array
Get locations of posts.
string | $query_args | Same as GeoMashupDB::get_object_locations() |
Array of matching rows.
since | 1.2 |
---|
get_object_locations(string $query_args) : array
Get locations of objects.
$results = GeoMashupDB::get_object_locations( array(
'object_name' => 'user',
'minlat' => 30,
'maxlat' => 40,
'minlon' => -106,
'maxlat' => -103 )
);
string | $query_args | Override default args. |
Array of matching rows.
since | 1.3 |
---|
wpml_filter_get_translatable_documents( $post_types) : array
Expand the post types returned by WPML for our queries
$post_types |
Location enabled post types, flipped so ids are keys as WPML expects
since | 1.5 |
---|
set_object_location(string $object_name, \id $object_id, \id|array $location, boolean $do_lookups, string $geo_date) : \id|\WP_Error
Save an object location in the database.
Object data is saved in the geo_mashup_location_relationships table, and location data is saved in geo_mashup_locations.
string | $object_name | 'post', 'user', a GeoMashupDB::object_storage() index. |
\id | $object_id | ID of the object to save the location for. |
\id|array | $location | If an ID, the location is not modified. If an array of valid location fields,
|
boolean | $do_lookups | Whether to try looking up missing location information, which can take extra time.
|
string | $geo_date | Optional geo date to associate with the object. |
The location ID now assiociated with the object.
since | 1.3 |
---|
set_location(array $location, boolean $do_lookups) : \id|\WP_Error
Save a location.
This can create a new location or update an existing one. If a location exists within 5 decimal places of the passed in coordinates, it will be updated. If the saved_name of a different location is given, it will be removed from the other location and saved with this one. Blank fields will not replace existing data.
array | $location | Location to save, may be modified to match actual saved data. |
boolean | $do_lookups | Whether to try to look up address information before saving,
|
The location ID saved, or a WordPress error.
since | 1.2 |
---|
delete_object_location(string $object_name, \id|array $object_ids) : integer|\WP_Error
Delete an object location or locations.
This removes the association of an object with a location, but does NOT delete the location.
string | $object_name | 'post', 'user', a GeoMashupDB::object_storage() index. |
\id|array | $object_ids | Object ID or array of IDs to remove the locations of. |
Rows affected or WordPress error.
since | 1.3 |
---|
delete_location(\id|array $ids) : integer|\WP_Error
Delete a location or locations.
\id|array | $ids | Location ID or array of IDs to delete. |
Rows affected or Wordpress error.
since | 1.2 |
---|
get_saved_locations() : array|\WP_Error
Get locations with saved names.
Array of location rows or WP_Error.
since | 1.2 |
---|
category_located_post_count(\id $category_id) : integer
Get the number of located posts in a category.
\id | $category_id |
since | 1.2 |
---|
get_comment_in( $args) : array
Get multiple comments.
What is the WordPress way? Expect deprecation.
$args |
Comments.
None found |
get_user_in( $args) : array
Get multiple users.
Now just a wrapper for get_users().
$args |
Users.
None found |
delete_post( $id)
When a post is deleted, remove location relationships for it.
delete_post action called by WordPress.
$id |
since | 1.2 |
---|
delete_comment( $id)
When a comment is deleted, remove location relationships for it.
delete_comment action called by WordPress.
$id |
since | 1.2 |
---|
delete_user( $id)
When a user is deleted, remove location relationships for it.
delete_user action called by WordPress.
$id |
since | 1.2 |
---|
post_meta_key_suggest()
Geo Mashup action to echo post meta keys that match a jQuery suggest query.
since | 1.4 |
---|
copy_from_geodata( $meta_type, $meta_id, $object_id, $meta_key, $meta_value)
Create a Geo Mashup object location from WordPress geodata.
$meta_type | ||
$meta_id | ||
$object_id | ||
$meta_key | ||
$meta_value |
since | 1.4 |
---|
set_installed_version(string $new_version)
Set the installed database version.
string | $new_version |
since | 1.4 |
---|
query_extension(\WP_Query $query, string $key, mixed $value) : mixed
Set or get custom data associated with a WP_Query object.
\WP_Query | $query | |
string | $key | Optional - return all data for the query if missing. |
mixed | $value | Optional - set or overwrite data for the key if present. |
Extension data if present.
since | 1.7 |
---|
get_cached_administrative_name(string $country_code, string $admin_code, string $language) : string|null
Look in the database for a cached administrative name.
string | $country_code | Two-character ISO country code. |
string | $admin_code | Code for the administrative area within the country, or NULL to get the country name. |
string | $language | Language code, defaults to the WordPress locale language. |
Place name or NULL.
since | 1.2 |
---|
fill_empty_location_fields(array $primary, array $secondary)
Copy empty fields in one location array from another.
array | $primary | Location to copy to, modified. |
array | $secondary | Location to copy from. |
since | 1.4 |
---|
reverse_geocode_location(array $location, string $language) : boolean
Add missing location fields, and update country and admin codes with authoritative Geonames values.
array | $location | The location to geocode, modified. |
string | $language | Optional ISO language code. |
Success.
since | 1.3 |
---|
duplicate_geodata_type(string $meta_type) : boolean
Copy missing geo data to and from the standard location (http://codex.wordpress.org/Geodata) for a specific object type.
string | $meta_type | One of the WP meta types, 'post', 'user', 'comment' |
True if no more orphan locations can be found.
since | 1.4 |
---|---|
global |
object $wpdb |
convert_prior_locations() : boolean
Convert Geo plugin locations to Geo Mashup format.
True if no more unconverted locations can be found.
since | 1.2 |
---|