API functions from PGC towards the Sandbox. The sandbox is not allowed to use more than 1G memory or execute for longer than 60 seconds. More...
Static Public Member Functions | |
static | CollectErrors ($errno, $errstr, $errfile, $errline) |
static | GetCollectedErrors () |
static | SetUserPremiumState ($premium) |
static | SetQueueToken ($token) |
static | AddOutput ($output) |
static | GetOutput () |
static | Log () |
Log a string that can be retrieved if the script timeouts. More... | |
static | GetFinds ($profileId, $params=array()) |
Returns an associative array with the finds from given profileId. More... | |
static | GetHides ($profileId, $params=array()) |
Returns an associative array with the hides from given profileId. More... | |
static | GetBookmarklist ($bmcode, $params=array()) |
Retuns an array with gccodes from a bookmark list. More... | |
static | HTMLEscape ($string) |
Returns an HTML escaped string. More... | |
static | CreateHTMLTable ($data) |
Returns a HTML table created from the data you provide. More... | |
static | ProfileName2Id ($profileName) |
Returns the Profile ID of a user from given Profile name. More... | |
static | ProfileId2Name ($profileId) |
Returns the Profile name of a user from given Profile ID. More... | |
static | UTF8ToUpper ($string) |
Converts string to upper case. More... | |
static | UTF8ToLower ($string) |
Converts string to lower case. More... | |
static | UTF8SubStr ($string, $start, $length) |
Gets a part of a string. More... | |
static | UTF8StrLen ($string) |
Returns length of string. More... | |
static | Gccode2CacheName ($gccode) |
Returns a Cache name from a gccode. More... | |
static | DistanceVincenty ($latitude1, $longitude1, $latitude2, $longitude2) |
Returns distance in meters. More... | |
static | DistanceHaversine ($latitude1, $longitude1, $latitude2, $longitude2) |
Returns distance in meters. More... | |
static | GetPublishers ($profileId, $params=array()) |
Retuns an associative array with cache_id, gccode, publisher_id, publisher_name, publish_date, visitdate, log_id for each find. More... | |
static | GetSouvenirs ($profileId, $params=array()) |
Retuns an associative array with date_discovered, souvenir_guid, image_path, thumb_path, title, pgc_group for each souvenir. More... | |
static | GetFavorites ($favoriteType='points', $params=array()) |
Retuns an associative array with cache data. More... | |
static | GetOldestCaches ($params=[]) |
Retuns an associative array with cache data for the oldest geocaches according to the filter. Based on hidden date. More... | |
static | GetHighestCaches ($params=[]) |
Retuns an associative array with cache data for the highest elevation geocaches according to the filter. Based on Project-GC's elevation data. More... | |
static | GetLowestCaches ($params=[]) |
Retuns an associative array with cache data for the lowest elevation geocaches according to the filter. Based on Project-GC's elevation data. More... | |
static | GetAttributeList () |
Get list of all known attributes. More... | |
static | GetNumTrackablesDiscovered ($profileId) |
Get number of discovered trackables. More... | |
static | GetMembershipCreatedDate ($profileId) |
Gets the date the user registered at Geocaching.com. More... | |
static | GetNumCachesInArea ($params) |
Gets the number of geocaches in a defined area. More... | |
static | GetBadgeGenDataV3 ($profileId, $params) |
Get BadgeGen (v3) badges and belt for specified user. More... | |
static | GetBadgeGenDataV4 ($profileId, $params=[]) |
Get BadgeGen (v4) badges and belt for specified user. More... | |
static | GetJsonData ($lookupKey) |
Get a json blob from the PGC servers. More... | |
static | GetFPDetailsForUser ($profileId) |
Returns a list of all gccodes the user has favorited. More... | |
static | GetRegionNamesInCountry ($country) |
Returns a list of region names given a country. More... | |
static | GetCountyNamesInCountry ($country) |
Returns a list of county names given a country. More... | |
static | GetCountryPolygonInfo ($country) |
static | GetRegionPolygonInfoFromCountry ($country) |
static | GetCountyPolygonInfoFromCountry ($country) |
static | GetCountyPolygonInfoFromRegion ($country, $region) |
static | GetCountyNamesInRegion ($country, $region) |
Returns a list of county names given a country. More... | |
static | GetNumberOfRegionsInCountry ($country) |
Returns number of regions in a country. More... | |
static | GetNumberOfCountiesInCountry ($country) |
Returns number of counties in a country. More... | |
static | GetNumberOfCountiesInRegion ($country, $region) |
Returns number of counties in a region. More... | |
static | GetContinentDefinitions ($continent=FALSE) |
Get continent definitions. More... | |
static | GetLabCacheFinds ($profileId) |
Returns an associative array with the labcache finds from given profileId. More... | |
static | GetLonelyFinds ($profileId, $days, $params=[]) |
Returns an associative array with finds on geocaches that haven't been found in $days days before the Geocacher found it. More... | |
static | GetIso3166_1alpha2Table ($flip=false) |
Returns an associative array with country-abbreviation as key and country name as value (or the opposite if flip is used) More... | |
static | GetFurthestFound ($profileId, $params=[]) |
Get the furthest found from home. More... | |
static | Get360HomeBasicData ($profileId, $params=[]) |
static | GetPGCGeoJson ($level, $country, $regionNames=[], $countyNames=[], $landonly=false) |
Returns a list of GeoJSONs in string format. More... | |
static | GetCPUUsage () |
Get number of cpu seconds according to the LUA Sandbox. More... | |
static | print () |
Prints output into the Debug output window. More... | |
Public Attributes | |
const | MAXMEM = 1024*1024*1024 |
const | MAXCPUTIME = 60 |
Static Public Attributes | |
static | $sandbox = NULL |
API functions from PGC towards the Sandbox. The sandbox is not allowed to use more than 1G memory or execute for longer than 60 seconds.
|
static |
Returns a HTML table created from the data you provide.
At this point, there is no options to design the table. Neither can headers be provided. It's WIP.
[in] | array | $data | An associative array of the data you want back as HTML. |
|
static |
Returns distance in meters.
Returns distance between two set of coordinates according to the Haversine formula. Haversine is less accurate than Vincenty. Will return false if one of the input parameters is false. False on coordinates is used for premium only geocaches for non premium users.
[in] | float | $latitude1 | |
[in] | float | $longitude1 | |
[in] | float | $latitude2 | |
[in] | float | $longitude2 |
|
static |
Returns distance in meters.
Returns distance between two set of coordinates according to the Vincenty formula. Vincenty is more accurate than Haversine. Will return false if one of the input parameters is false. False on coordinates is used for premium only geocaches for non premium users.
[in] | float | $latitude1 | |
[in] | float | $longitude1 | |
[in] | float | $latitude2 | |
[in] | float | $longitude2 |
|
static |
Returns a Cache name from a gccode.
[in] | string | $gccode | The gccode (GCxxxxx). |
|
static |
Get list of all known attributes.
|
static |
Get BadgeGen (v3) badges and belt for specified user.
[in] | int | $profileId | An integer with the users profile id. |
[in] | array | $params | An optional associative array with extra options.
|
|
static |
Get BadgeGen (v4) badges and belt for specified user.
[in] | int | $profileId | An integer with the users profile id. |
[in] | array | $params | An optional associative array with extra options.
|
|
static |
Retuns an array with gccodes from a bookmark list.
[in] | string | $bmcode | A bookmark list bmcode. |
[in] | array | $params | An optional array of options.
|
|
static |
Get continent definitions.
Returns an associative array with continents and their belonging countries. If the optional parameter continent is used, a list of countries are returned only.
[in] | string | continent - Optional, if given, a list of countries for the given continent is returned |
|
static |
[in] | string | country |
|
static |
Returns a list of county names given a country.
[in] | string | country |
|
static |
Returns a list of county names given a country.
[in] | string | country |
[in] | string | region |
|
static |
[in] | string | country |
|
static |
[in] | string | country |
[in] | string | region |
|
static |
Get number of cpu seconds according to the LUA Sandbox.
|
static |
Retuns an associative array with cache data.
[in] | string | $favoriteType | Can be one of points, percentage, wilson. Defaults to points. |
[in] | array | $params | An optional associative array of options for filtering/limit.
|
|
static |
Returns an associative array with the finds from given profileId.
Coordinates for Premium geocaches will not be returned if the logged in user is not a Premium member with Groundspeak.
[in] | int | $profileId | An integer with the users profile id. |
[in] | array | $params | An optional associative array of options for filtering/sorting/limit.
|
|
static |
Returns a list of all gccodes the user has favorited.
Since Project-GC does not detect FP changes very fast, this list might be quite inaccurate if the user has spent or removed favorite points without logging the geocaches lately.
[in] | int | $profileId |
|
static |
Get the furthest found from home.
If the user doesn't have home coordinates a value of FALSE will be returned.
[in] | int | $profileId | An integer with the users profile id. |
[in] | array | $params | An optional associative array of options for filtering/sorting/limit.
|
|
static |
Returns an associative array with the hides from given profileId.
Coordinates for Premium geocaches will not be returned if the logged in user is not a Premium member with Groundspeak.
[in] | int | $profileId | An integer with the users profile id. |
[in] | array | $params | An optional associative array of options for filtering/sorting/limit.
|
|
static |
Retuns an associative array with cache data for the highest elevation geocaches according to the filter. Based on Project-GC's elevation data.
Can return more than limit rows. Will first figure out the lowest elevation allowed, and then fetch all geocaches matching the filters.
[in] | array | $params | An optional associative array of options for filtering/limit.
|
|
static |
Returns an associative array with country-abbreviation as key and country name as value (or the opposite if flip is used)
[in] | bool | $flip | True to flip the array and use names as keys. |
|
static |
Get a json blob from the PGC servers.
This function is a bit special. If you have larger data-sets, you can ask support to have it stored on the Project-GC servers, and then retrieve it like this. This is to avoid having several kilobytes or megabytes of data inside the LUA scripts.
[in] | string | $lookupKey | A lookup string for the json data you want returned. |
|
static |
Returns an associative array with the labcache finds from given profileId.
Returned fields: guid, name, date_found
[in] | int | $profileId | An integer with the users profile id. |
|
static |
Returns an associative array with finds on geocaches that haven't been found in $days days before the Geocacher found it.
[in] | int | $profileId | An integer with the users profile id. |
[in] | int | $days | An integer with the minimum number of days required. |
[in] | array | $params | An optional associative array of options.
|
|
static |
Retuns an associative array with cache data for the lowest elevation geocaches according to the filter. Based on Project-GC's elevation data.
Can return more than limit rows. Will first figure out the highest elevation allowed, and then fetch all geocaches matching the filters.
[in] | array | $params | An optional associative array of options for filtering/limit.
|
|
static |
Gets the date the user registered at Geocaching.com.
[in] | int | $profileId | An integer with the users profile id. |
|
static |
Returns number of counties in a country.
The number returned is based on Project-GC's polygon data. If no such data exists, a FALSE will be returned.
[in] | string | country |
|
static |
Returns number of counties in a region.
The number returned is based on Project-GC's polygon data. If no such data exists, a FALSE will be returned.
[in] | string | country |
[in] | string | region |
|
static |
Returns number of regions in a country.
The number returned is based on Project-GC's polygon data. If no such data exists, a FALSE will be returned.
[in] | string | country |
|
static |
Gets the number of geocaches in a defined area.
[in] | array | $params | An optional associative array of options for filtering.
|
|
static |
Get number of discovered trackables.
[in] | int | $profileId | An integer with the users profile id. |
|
static |
Retuns an associative array with cache data for the oldest geocaches according to the filter. Based on hidden date.
Can return more than limit rows. Will first figure out the newest hidden date allowed, and then fetch all geocaches matching the filters before that date.
[in] | array | $params | An optional associative array of options for filtering/limit.
|
|
static |
Returns a list of GeoJSONs in string format.
[in] | int | $level | One of: country, region, county. Has no default. |
[in] | int | $country | A string representing the country. |
[in] | array | $regionNames | A list of region names to filter on. Can be left empty/unset. Ignored if level is 'country'. |
[in] | array | $countyNames | A list of county names to filter on. Can be left empty/unset. Ignored if level is 'country' or 'region'. |
[in] | bool | $landOnly | Returns polygons clipped to coastline if true. These generally are more expensive to use, don't overlay all of the geocaches, but look better/more correct. |
|
static |
Retuns an associative array with cache_id, gccode, publisher_id, publisher_name, publish_date, visitdate, log_id for each find.
Note that a cache can be published multiple times and will then be returned once for each publisher (or twice if it was the same publisher). One should also be aware of that "Publish listing" is a log type that haven't always existed, not all geocaches has a publisher.
[in] | int | $profileId | An integer with the users profile id. |
[in] | array | $params | An optional array of options for filtering.
|
|
static |
Returns a list of region names given a country.
[in] | string | country |
|
static |
[in] | string | country |
|
static |
Retuns an associative array with date_discovered, souvenir_guid, image_path, thumb_path, title, pgc_group for each souvenir.
[in] | int | $profileId | An integer with the users profile id. |
[in] | array | $params | An optional associative array of options for filtering/sorting/limit.
|
|
static |
Returns an HTML escaped string.
This should be used on all data contributed from users that will be outputed as HTML. Including data from Geocaching.com, for example cache names.
[in] | array | $string | A string that should be escaped. |
|
static |
Log a string that can be retrieved if the script timeouts.
Max amount of log per checker run is 100 kB. The log entries will be available for 1 hour. Normally all in-parameters are concatenated to a single string. New-line isn't added automatically. But! If the first argument is an array, that argument, and only that argument, will be converted to a readable blob The log output can be retrieved at https://project-gc.com/Tools/Challenges?viewDebugLog=token, where token is the token you get when running the script.
|
static |
Prints output into the Debug output window.
This function can handle multiple arguments. Each argument can be either a string or a list. In case of lists it will output a formatted dump.
|
static |
Returns the Profile name of a user from given Profile ID.
[in] | integer | $profileId | The Profile ID to convert to a Profile name. |
|
static |
Returns the Profile ID of a user from given Profile name.
[in] | string | $profileName | The Profile name to convert to an ID. |
|
static |
Returns length of string.
Implemented since LUA doesn't have unicode support in their functions (for example string.len).
[in] | string | $string | The UTF-8 string to extract from. |
|
static |
Gets a part of a string.
Implemented since LUA doesn't have unicode support in their functions (for example string.substr).
[in] | string | $string | The UTF-8 string to extract from. |
[in] | int | $start | Position of the first character to use. 1-based (first character is number 1). |
[in] | int | $length | Maximum number of characters to use from string. |
|
static |
Converts string to lower case.
Implemented since LUA doesn't have unicode support in their functions (for example string.lower).
[in] | string | $string | The UTF-8 string to convert to lower case. |
|
static |
Converts string to upper case.
Implemented since LUA doesn't have unicode support in their functions (for example string.upper).
[in] | string | $string | The UTF-8 string to convert to upper case. |