CWIS Developer Documentation
|
Standard utility library. More...
Static Public Member Functions | |
static | GetMyCaller () |
Get string with file and line number for call to current function. More... | |
static | CheckMyCaller ($DesiredCaller, $ExceptionMsg=NULL) |
Check the caller of the current function. More... | |
static | Pluralize ($Word) |
Pluralize an English word. More... | |
static | Singularize ($Word) |
Singularize an English word. More... | |
static | SortCompare ($A, $B) |
Perform compare and return value appropriate for sort function callbacks. More... | |
static | GetLatLngForZipCode ($Zip) |
Look up the GPS coordinates for a US ZIP code. More... | |
static | ZipCodeDistance ($ZipA, $ZipB) |
Compute the distance between two US ZIP codes. More... | |
static | ComputeGreatCircleDistance ($LatSrc, $LonSrc, $LatDst, $LonDst) |
Computes the distance in kilometers between two points, assuming a spherical earth. More... | |
static | ComputeBearing ($LatSrc, $LonSrc, $LatDst, $LonDst) |
Computes the initial angle on a course connecting two points, assuming a spherical earth. More... | |
Public Attributes | |
const | SQL_DATE_FORMAT = "Y-m-d H:i:s" |
Format to feed to date() to get SQL-compatible date/time string. More... | |
Standard utility library.
Definition at line 14 of file StdLib.php.
|
static |
Check the caller of the current function.
In the desired caller parameter, if a file name is specified it should include the ".php" extension but should not have a leading path. In the exception message parameter, the following strings can be used and the appropriate values will be substituted in: FILE% (no leading path), LINE%, FULLFILE% (includes leading path), CLASS%, FUNCTION%, and METHOD% (equivalent to "%CLASS%::%FUNCTION%").
string | $DesiredCaller | String describing desired caller, in the form "Class", "Class::Method", "Function", "File", or "File:Line". |
string | $ExceptionMsg | If specified and the caller was not the desired caller, an exception will be thrown with this message. (OPTIONAL) |
Definition at line 47 of file StdLib.php.
Referenced by Plugin\__construct(), SPTImage\ClearImageSymlinksForResource(), MetadataField\Drop(), SPTImage\GetImageUrlForResource(), Plugin\InstalledVersion(), Plugin\IsInstalled(), and Plugin\IsReady().
|
static |
Computes the initial angle on a course connecting two points, assuming a spherical earth.
int | $LatSrc | Latitude of the source coordinate. |
int | $LonSrc | Longitude of the source coordinate. |
int | $LatDst | Latitude of the destination coordinate. |
int | $LonDst | Longitude of the destination coordinate. |
Definition at line 307 of file StdLib.php.
|
static |
Computes the distance in kilometers between two points, assuming a spherical earth.
int | $LatSrc | Latitude of the source coordinate. |
int | $LonSrc | Longitude of the source coordinate. |
int | $LatDst | Latitude of the destination coordinate. |
int | $LonDst | Longitude of the destination coordinate. |
Definition at line 278 of file StdLib.php.
|
static |
Look up the GPS coordinates for a US ZIP code.
Database of GPS coordinates used was drawn from Census 2010. See the "Zip Code Tabulation Areas" section on https://www.census.gov/geo/maps-data/data/gazetteer2010.html for the original source file. The version used here has been cut down to columns 1, 8, and 9 from that source.
int | $Zip | Zip code to look up. |
Exception | When coordinates file cannot be opened. |
Definition at line 204 of file StdLib.php.
|
static |
Get string with file and line number for call to current function.
Definition at line 23 of file StdLib.php.
|
static |
Pluralize an English word.
string | $Word | Word to make plural. |
Definition at line 105 of file StdLib.php.
Referenced by Item\SetDatabaseAccessValues().
|
static |
Singularize an English word.
string | $Word | Word to make singular. |
Definition at line 141 of file StdLib.php.
Referenced by MetadataSchema\Create().
|
static |
Perform compare and return value appropriate for sort function callbacks.
mixed | $A | First value to compare. |
mixed | $B | Second value to compare. |
Definition at line 179 of file StdLib.php.
Referenced by ApplicationFramework\HookEvent().
|
static |
Compute the distance between two US ZIP codes.
int | $ZipA | First zip code. |
int | $ZipB | Second zip code. |
Definition at line 251 of file StdLib.php.
const StdLib::SQL_DATE_FORMAT = "Y-m-d H:i:s" |
Format to feed to date() to get SQL-compatible date/time string.
Definition at line 323 of file StdLib.php.
Referenced by ApplicationFramework\GetLock().