MySLP_Location
extends MySLP_Base
in package
Class MySLP_Location
Table of Contents
Properties
- $countrycodes : mixed
- Country ISO codes
- $extendo : mixed
- Name of table if we want to extend the column
- $geocodeURL : mixed
- Holds the geo location API url
- $slptbl : mixed
- Main SLP table
Methods
- __construct() : mixed
- Default things to do/load when running this plugin
- add_hooks() : mixed
- Adding hooks
- delete_location() : false|int|void
- Delete location by id
- enqueue_scripts() : mixed
- Set the scripting here
- get_custom_location() : array<string|int, mixed>|null|object|void
- Get location data defined column
- get_instance() : mixed
- Return an instance of the object.
- get_location() : array<string|int, mixed>|null|object|void
- Get location data by ID
- get_locations() : array<string|int, mixed>|null|object|void
- Get all location data $data param is array with the following key:
- get_total_locations() : null|string
- Get total locations.
- get_uncoded_location() : mixed
- Get all uncoded location geo data
- getLocation() : mixed
- Set data incoming from REST API and store here for later access in admin class for adding location to database using standard function from SLP
- update_geodata() : false|int
- Update main location data( on store_locator table only )
- initialize() : mixed
- Do these things when this object is invoked.
- cntry_to_iso_code() : int|null|string|void
- Convert country name into ISO code This is useful for displaying country icon
- get_extendo() : array<string|int, mixed>|null|object|void
- Get location extended data by ID
- get_table_name() : string
- Set table name using wpdb class
Properties
$countrycodes
Country ISO codes
protected
mixed
$countrycodes
= array('AF' => 'Afghanistan', 'AX' => 'Åland Islands', 'AL' => 'Albania', 'DZ' => 'Algeria', 'AS' => 'American Samoa', 'AD' => 'Andorra', 'AO' => 'Angola', 'AI' => 'Anguilla', 'AQ' => 'Antarctica', 'AG' => 'Antigua and Barbuda', 'AR' => 'Argentina', 'AU' => 'Australia', 'AT' => 'Austria', 'AZ' => 'Azerbaijan', 'BS' => 'Bahamas', 'BH' => 'Bahrain', 'BD' => 'Bangladesh', 'BB' => 'Barbados', 'BY' => 'Belarus', 'BE' => 'Belgium', 'BZ' => 'Belize', 'BJ' => 'Benin', 'BM' => 'Bermuda', 'BT' => 'Bhutan', 'BO' => 'Bolivia', 'BA' => 'Bosnia and Herzegovina', 'BW' => 'Botswana', 'BV' => 'Bouvet Island', 'BR' => 'Brazil', 'IO' => 'British Indian Ocean Territory', 'BN' => 'Brunei Darussalam', 'BG' => 'Bulgaria', 'BF' => 'Burkina Faso', 'BI' => 'Burundi', 'KH' => 'Cambodia', 'CM' => 'Cameroon', 'CA' => 'Canada', 'CV' => 'Cape Verde', 'KY' => 'Cayman Islands', 'CF' => 'Central African Republic', 'TD' => 'Chad', 'CL' => 'Chile', 'CN' => 'China', 'CX' => 'Christmas Island', 'CC' => 'Cocos (Keeling) Islands', 'CO' => 'Colombia', 'KM' => 'Comoros', 'CG' => 'Congo', 'CD' => 'Zaire', 'CK' => 'Cook Islands', 'CR' => 'Costa Rica', 'CI' => 'Côte D\'Ivoire', 'HR' => 'Croatia', 'CU' => 'Cuba', 'CY' => 'Cyprus', 'CZ' => 'Czech Republic', 'DK' => 'Denmark', 'DJ' => 'Djibouti', 'DM' => 'Dominica', 'DO' => 'Dominican Republic', 'EC' => 'Ecuador', 'EG' => 'Egypt', 'SV' => 'El Salvador', 'GQ' => 'Equatorial Guinea', 'ER' => 'Eritrea', 'EE' => 'Estonia', 'ET' => 'Ethiopia', 'FK' => 'Falkland Islands (Malvinas)', 'FO' => 'Faroe Islands', 'FJ' => 'Fiji', 'FI' => 'Finland', 'FR' => 'France', 'GF' => 'French Guiana', 'PF' => 'French Polynesia', 'TF' => 'French Southern Territories', 'GA' => 'Gabon', 'GM' => 'Gambia', 'GE' => 'Georgia', 'DE' => 'Germany', 'GH' => 'Ghana', 'GI' => 'Gibraltar', 'GR' => 'Greece', 'GL' => 'Greenland', 'GD' => 'Grenada', 'GP' => 'Guadeloupe', 'GU' => 'Guam', 'GT' => 'Guatemala', 'GG' => 'Guernsey', 'GN' => 'Guinea', 'GW' => 'Guinea-Bissau', 'GY' => 'Guyana', 'HT' => 'Haiti', 'HM' => 'Heard Island and Mcdonald Islands', 'VA' => 'Vatican City State', 'HN' => 'Honduras', 'HK' => 'Hong Kong', 'HU' => 'Hungary', 'IS' => 'Iceland', 'IN' => 'India', 'ID' => 'Indonesia', 'IR' => 'Iran, Islamic Republic of', 'IQ' => 'Iraq', 'IE' => 'Ireland', 'IM' => 'Isle of Man', 'IL' => 'Israel', 'IT' => 'Italy', 'JM' => 'Jamaica', 'JP' => 'Japan', 'JE' => 'Jersey', 'JO' => 'Jordan', 'KZ' => 'Kazakhstan', 'KE' => 'Kenya', 'KI' => 'Kiribati', 'KP' => array('Korea, Democratic People\'s Republic of', 'North Korea'), 'KR' => array('Korea, Republic of', 'South Korea'), 'KW' => 'Kuwait', 'KG' => 'Kyrgyzstan', 'LA' => array('Lao People\'s Democratic Republic', 'Laos'), 'LV' => 'Latvia', 'LB' => 'Lebanon', 'LS' => 'Lesotho', 'LR' => 'Liberia', 'LY' => 'Libyan Arab Jamahiriya', 'LI' => 'Liechtenstein', 'LT' => 'Lithuania', 'LU' => 'Luxembourg', 'MO' => 'Macao', 'MK' => 'Macedonia, the Former Yugoslav Republic of', 'MG' => 'Madagascar', 'MW' => 'Malawi', 'MY' => 'Malaysia', 'MV' => 'Maldives', 'ML' => 'Mali', 'MT' => 'Malta', 'MH' => 'Marshall Islands', 'MQ' => 'Martinique', 'MR' => 'Mauritania', 'MU' => 'Mauritius', 'YT' => 'Mayotte', 'MX' => 'Mexico', 'FM' => 'Micronesia, Federated States of', 'MD' => 'Moldova, Republic of', 'MC' => 'Monaco', 'MN' => 'Mongolia', 'ME' => 'Montenegro', 'MS' => 'Montserrat', 'MA' => 'Morocco', 'MZ' => 'Mozambique', 'MM' => 'Myanmar', 'NA' => 'Namibia', 'NR' => 'Nauru', 'NP' => 'Nepal', 'NL' => array('Netherlands', 'Holland'), 'AN' => 'Netherlands Antilles', 'NC' => 'New Caledonia', 'NZ' => 'New Zealand', 'NI' => 'Nicaragua', 'NE' => 'Niger', 'NG' => 'Nigeria', 'NU' => 'Niue', 'NF' => 'Norfolk Island', 'MP' => 'Northern Mariana Islands', 'NO' => 'Norway', 'OM' => 'Oman', 'PK' => 'Pakistan', 'PW' => 'Palau', 'PS' => array('Palestinian Territory, Occupied', 'Palestine'), 'PA' => 'Panama', 'PG' => 'Papua New Guinea', 'PY' => 'Paraguay', 'PE' => 'Peru', 'PH' => 'Philippines', 'PN' => 'Pitcairn', 'PL' => 'Poland', 'PT' => 'Portugal', 'PR' => 'Puerto Rico', 'QA' => 'Qatar', 'RE' => 'Réunion', 'RO' => 'Romania', 'RU' => 'Russian Federation', 'RW' => 'Rwanda', 'SH' => 'Saint Helena', 'KN' => 'Saint Kitts and Nevis', 'LC' => 'Saint Lucia', 'PM' => 'Saint Pierre and Miquelon', 'VC' => 'Saint Vincent and the Grenadines', 'WS' => 'Samoa', 'SM' => 'San Marino', 'ST' => 'Sao Tome and Principe', 'SA' => 'Saudi Arabia', 'SN' => 'Senegal', 'RS' => 'Serbia', 'SC' => 'Seychelles', 'SL' => 'Sierra Leone', 'SG' => 'Singapore', 'SK' => 'Slovakia', 'SI' => 'Slovenia', 'SB' => 'Solomon Islands', 'SO' => 'Somalia', 'ZA' => 'South Africa', 'GS' => 'South Georgia and the South Sandwich Islands', 'ES' => 'Spain', 'LK' => 'Sri Lanka', 'SD' => 'Sudan', 'SR' => 'Suriname', 'SJ' => 'Svalbard and Jan Mayen', 'SZ' => 'Swaziland', 'SE' => 'Sweden', 'CH' => 'Switzerland', 'SY' => 'Syrian Arab Republic', 'TW' => array('Taiwan, Province of China', 'Taiwan'), 'TJ' => 'Tajikistan', 'TZ' => 'Tanzania, United Republic of', 'TH' => 'Thailand', 'TL' => 'Timor-Leste', 'TG' => 'Togo', 'TK' => 'Tokelau', 'TO' => 'Tonga', 'TT' => 'Trinidad and Tobago', 'TN' => 'Tunisia', 'TR' => 'Turkey', 'TM' => 'Turkmenistan', 'TC' => 'Turks and Caicos Islands', 'TV' => 'Tuvalu', 'UG' => 'Uganda', 'UA' => 'Ukraine', 'AE' => array('United Arab Emirates', 'UAE'), 'GB' => array('United Kingdom', 'UK'), 'US' => array('United States', 'United States of America', 'USA'), 'UM' => 'United States Minor Outlying Islands', 'UY' => 'Uruguay', 'UZ' => 'Uzbekistan', 'VU' => 'Vanuatu', 'VE' => 'Venezuela', 'VN' => array('Viet Nam', 'Vietnam'), 'VG' => 'Virgin Islands, British', 'VI' => 'Virgin Islands, U.S.', 'WF' => 'Wallis and Futuna', 'EH' => 'Western Sahara', 'YE' => 'Yemen', 'ZM' => 'Zambia', 'ZW' => 'Zimbabwe')
$extendo
Name of table if we want to extend the column
protected
mixed
$extendo
$geocodeURL
Holds the geo location API url
protected
mixed
$geocodeURL
$slptbl
Main SLP table
protected
mixed
$slptbl
Methods
__construct()
Default things to do/load when running this plugin
public
__construct() : mixed
add_hooks()
Adding hooks
public
add_hooks() : mixed
delete_location()
Delete location by id
public
delete_location( $id) : false|int|void
Parameters
Return values
false|int|voidenqueue_scripts()
Set the scripting here
public
enqueue_scripts( $hook) : mixed
Parameters
get_custom_location()
Get location data defined column
public
get_custom_location(array<string|int, mixed> $columns, string $order, string $sort[, int $sl_id = null ]) : array<string|int, mixed>|null|object|void
Parameters
- $columns : array<string|int, mixed>
- $order : string
- $sort : string
- $sl_id : int = null
Return values
array<string|int, mixed>|null|object|voidget_instance()
Return an instance of the object.
public
static get_instance([array<string|int, mixed> $params = null ]) : mixed
Parameters
- $params : array<string|int, mixed> = null
get_location()
Get location data by ID
public
get_location( $sl_id) : array<string|int, mixed>|null|object|void
Parameters
Return values
array<string|int, mixed>|null|object|voidget_locations()
Get all location data $data param is array with the following key:
public
get_locations( $loc_data) : array<string|int, mixed>|null|object|void
Parameters
Return values
array<string|int, mixed>|null|object|voidget_total_locations()
Get total locations.
public
get_total_locations( $blog_id) : null|string
Serves as backup function in case the REST API failed
Parameters
Return values
null|stringget_uncoded_location()
Get all uncoded location geo data
public
get_uncoded_location() : mixed
getLocation()
Set data incoming from REST API and store here for later access in admin class for adding location to database using standard function from SLP
public
getLocation( $location) : mixed
Parameters
update_geodata()
Update main location data( on store_locator table only )
public
update_geodata( $sl_id, $lat, $lon) : false|int
Parameters
Return values
false|intinitialize()
Do these things when this object is invoked.
protected
initialize() : mixed
cntry_to_iso_code()
Convert country name into ISO code This is useful for displaying country icon
private
cntry_to_iso_code( $country[, bool $lowercase = false ]) : int|null|string|void
Parameters
Return values
int|null|string|voidget_extendo()
Get location extended data by ID
private
get_extendo( $sl_id) : array<string|int, mixed>|null|object|void
Parameters
Return values
array<string|int, mixed>|null|object|voidget_table_name()
Set table name using wpdb class
private
get_table_name( $table) : string