PHP Класс WC_Countries

The WooCommerce countries class stores country/state data.
Автор: WooThemes
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$address_formats Array of address formats for locales
$locale Array of locales

Открытые методы

Метод Описание
__get ( mixed $key ) : mixed Auto-load in-accessible properties on demand.
country_dropdown_options ( string $selected_country = '', string $selected_state = '', boolean $escape = false ) Outputs the list of countries and states for use in dropdown boxes.
estimated_for_prefix ( $country_code = '' ) : string Prefix certain countries with 'the'
ex_tax_or_vat ( ) : string Include the Ex Tax label.
get_address_fields ( mixed $country = '', string $type = 'billing_' ) : array Apply locale and get address fields.
get_address_formats ( ) : array Get country address formats.
get_allowed_countries ( ) : array Get the allowed countries for the store.
get_allowed_country_states ( ) : array Get allowed country states.
get_base_city ( ) : string Get the base city for the store.
get_base_country ( ) : string Get the base country for the store.
get_base_postcode ( ) : string Get the base postcode for the store.
get_base_state ( ) : string Get the base state for the store.
get_continent_code_for_country ( string $cc ) : string Get continent code for a country code.
get_continents ( ) : array Get all continents.
get_countries ( ) : array Get all countries.
get_country_locale ( ) : array Get country locale settings.
get_country_locale_field_selectors ( ) : array Get JS selectors for fields which are shown/hidden depending on the locale.
get_default_address_fields ( ) : array Returns the fields we show by default. This can be filtered later on.
get_european_union_countries ( $type = '' ) : string[] Gets an array of countries in the EU.
get_formatted_address ( array $args = [] ) : string Get country address format.
get_shipping_countries ( ) : array Get the countries you ship to.
get_shipping_country_states ( ) : array Get shipping country states.
get_states ( string $cc = null ) : array Get the states for a country.
inc_tax_or_vat ( ) : string Include the Inc Tax label.
load_country_states ( ) Load the states.
shipping_to_prefix ( $country_code = '' ) : string Gets the correct string for shipping - either 'to the' or 'to'
tax_or_vat ( ) : string Correctly name tax in some countries VAT on the frontend.

Приватные методы

Метод Описание
trim_formatted_address_line ( string $line ) : string Trim white space and commas off a line.

Описание методов

__get() публичный метод

Auto-load in-accessible properties on demand.
public __get ( mixed $key ) : mixed
$key mixed
Результат mixed

country_dropdown_options() публичный метод

Outputs the list of countries and states for use in dropdown boxes.
public country_dropdown_options ( string $selected_country = '', string $selected_state = '', boolean $escape = false )
$selected_country string (default: '')
$selected_state string (default: '')
$escape boolean (default: false)

estimated_for_prefix() публичный метод

Prefix certain countries with 'the'
public estimated_for_prefix ( $country_code = '' ) : string
Результат string

ex_tax_or_vat() публичный метод

Include the Ex Tax label.
public ex_tax_or_vat ( ) : string
Результат string

get_address_fields() публичный метод

Apply locale and get address fields.
public get_address_fields ( mixed $country = '', string $type = 'billing_' ) : array
$country mixed (default: '')
$type string (default: 'billing_')
Результат array

get_address_formats() публичный метод

Get country address formats.
public get_address_formats ( ) : array
Результат array

get_allowed_countries() публичный метод

Get the allowed countries for the store.
public get_allowed_countries ( ) : array
Результат array

get_allowed_country_states() публичный метод

Get allowed country states.
public get_allowed_country_states ( ) : array
Результат array

get_base_city() публичный метод

Get the base city for the store.
public get_base_city ( ) : string
Результат string

get_base_country() публичный метод

Get the base country for the store.
public get_base_country ( ) : string
Результат string

get_base_postcode() публичный метод

Get the base postcode for the store.
public get_base_postcode ( ) : string
Результат string

get_base_state() публичный метод

Get the base state for the store.
public get_base_state ( ) : string
Результат string

get_continent_code_for_country() публичный метод

Get continent code for a country code.
С версии: 2.6.0
public get_continent_code_for_country ( string $cc ) : string
$cc string string
Результат string

get_continents() публичный метод

Get all continents.
public get_continents ( ) : array
Результат array

get_countries() публичный метод

Get all countries.
public get_countries ( ) : array
Результат array

get_country_locale() публичный метод

Get country locale settings.
public get_country_locale ( ) : array
Результат array

get_country_locale_field_selectors() публичный метод

Get JS selectors for fields which are shown/hidden depending on the locale.
public get_country_locale_field_selectors ( ) : array
Результат array

get_default_address_fields() публичный метод

Returns the fields we show by default. This can be filtered later on.
public get_default_address_fields ( ) : array
Результат array

get_european_union_countries() публичный метод

MC (monaco) and IM (isle of man, part of UK) also use VAT.
public get_european_union_countries ( $type = '' ) : string[]
$type Type of countries to retrieve. Blank for EU member countries. eu_vat for EU VAT countries.
Результат string[]

get_formatted_address() публичный метод

Get country address format.
public get_formatted_address ( array $args = [] ) : string
$args array (default: array())
Результат string address

get_shipping_countries() публичный метод

Get the countries you ship to.
public get_shipping_countries ( ) : array
Результат array

get_shipping_country_states() публичный метод

Get shipping country states.
public get_shipping_country_states ( ) : array
Результат array

get_states() публичный метод

Get the states for a country.
public get_states ( string $cc = null ) : array
$cc string country code
Результат array of states

inc_tax_or_vat() публичный метод

Include the Inc Tax label.
public inc_tax_or_vat ( ) : string
Результат string

load_country_states() публичный метод

Load the states.
public load_country_states ( )

shipping_to_prefix() публичный метод

Gets the correct string for shipping - either 'to the' or 'to'
public shipping_to_prefix ( $country_code = '' ) : string
Результат string

tax_or_vat() публичный метод

Correctly name tax in some countries VAT on the frontend.
public tax_or_vat ( ) : string
Результат string

Описание свойств

$address_formats публичное свойство

Array of address formats for locales
public $address_formats

$locale публичное свойство

Array of locales
public $locale