Use new code style
This commit is contained in:
@ -91,8 +91,7 @@ class Country_BR extends Country {
|
||||
public function get_name() {
|
||||
|
||||
return __('Brazil', 'wp-ultimo-locations');
|
||||
|
||||
} // end get_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of states for BR.
|
||||
@ -131,7 +130,5 @@ class Country_BR extends Country {
|
||||
'SP' => __('São Paulo', 'wp-ultimo-locations'),
|
||||
'TO' => __('Tocantins', 'wp-ultimo-locations'),
|
||||
);
|
||||
|
||||
} // end states;
|
||||
|
||||
} // end class Country_BR;
|
||||
}
|
||||
}
|
||||
|
@ -77,8 +77,7 @@ class Country_CA extends Country {
|
||||
public function get_name() {
|
||||
|
||||
return __('Canada', 'wp-ultimo-locations');
|
||||
|
||||
} // end get_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of states for CA.
|
||||
@ -103,7 +102,5 @@ class Country_CA extends Country {
|
||||
'SK' => __('Saskatchewan', 'wp-ultimo-locations'),
|
||||
'YT' => __('Yukon', 'wp-ultimo-locations'),
|
||||
);
|
||||
|
||||
} // end states;
|
||||
|
||||
} // end class Country_CA;
|
||||
}
|
||||
}
|
||||
|
@ -96,8 +96,7 @@ class Country_CN extends Country {
|
||||
public function get_name() {
|
||||
|
||||
return __('China', 'wp-ultimo-locations');
|
||||
|
||||
} // end get_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of states for CN.
|
||||
@ -143,7 +142,5 @@ class Country_CN extends Country {
|
||||
'YN' => __('Yunnan', 'wp-ultimo'),
|
||||
'ZJ' => __('Zhejiang', 'wp-ultimo'),
|
||||
);
|
||||
|
||||
} // end states;
|
||||
|
||||
} // end class Country_CN;
|
||||
}
|
||||
}
|
||||
|
@ -80,8 +80,7 @@ class Country_DE extends Country {
|
||||
public function get_name() {
|
||||
|
||||
return __('Germany', 'wp-ultimo-locations');
|
||||
|
||||
} // end get_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of states for DE.
|
||||
@ -109,7 +108,5 @@ class Country_DE extends Country {
|
||||
'SH' => __('Schleswig-Holstein', 'wp-ultimo-locations'),
|
||||
'TH' => __('Thuringia', 'wp-ultimo-locations'),
|
||||
);
|
||||
|
||||
} // end states;
|
||||
|
||||
} // end class Country_DE;
|
||||
}
|
||||
}
|
||||
|
@ -40,8 +40,7 @@ class Country_Default extends Country {
|
||||
public function get_name() {
|
||||
|
||||
return $this->name;
|
||||
|
||||
} // end get_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a country instance with a code and name.
|
||||
@ -55,18 +54,19 @@ class Country_Default extends Country {
|
||||
*/
|
||||
public static function build($code, $name = null, $attributes = array()) {
|
||||
|
||||
$instance = new self;
|
||||
$instance = new self();
|
||||
|
||||
$instance->name = $name ? $name : wu_get_country_name($code);
|
||||
|
||||
$instance->attributes = wp_parse_args($attributes, array(
|
||||
'country_code' => strtoupper($code),
|
||||
'currency' => strtoupper($code),
|
||||
'phone_code' => 00,
|
||||
));
|
||||
$instance->attributes = wp_parse_args(
|
||||
$attributes,
|
||||
array(
|
||||
'country_code' => strtoupper($code),
|
||||
'currency' => strtoupper($code),
|
||||
'phone_code' => 00,
|
||||
)
|
||||
);
|
||||
|
||||
return $instance;
|
||||
|
||||
} // end build;
|
||||
|
||||
} // end class Country_Default;
|
||||
}
|
||||
}
|
||||
|
@ -82,8 +82,7 @@ class Country_ES extends Country {
|
||||
public function get_name() {
|
||||
|
||||
return __('Spain', 'wp-ultimo-locations');
|
||||
|
||||
} // end get_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of states for ES.
|
||||
@ -123,7 +122,5 @@ class Country_ES extends Country {
|
||||
'ZA' => __('Zamora Province', 'wp-ultimo-locations'),
|
||||
'AV' => __('Ávila', 'wp-ultimo-locations'),
|
||||
);
|
||||
|
||||
} // end states;
|
||||
|
||||
} // end class Country_ES;
|
||||
}
|
||||
}
|
||||
|
@ -77,8 +77,7 @@ class Country_FR extends Country {
|
||||
public function get_name() {
|
||||
|
||||
return __('France', 'wp-ultimo-locations');
|
||||
|
||||
} // end get_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of states for FR.
|
||||
@ -213,7 +212,5 @@ class Country_FR extends Country {
|
||||
'WF' => __('Wallis and Futuna', 'wp-ultimo-locations'),
|
||||
'IDF' => __('Île-de-France', 'wp-ultimo-locations'),
|
||||
);
|
||||
|
||||
} // end states;
|
||||
|
||||
} // end class Country_FR;
|
||||
}
|
||||
}
|
||||
|
@ -68,8 +68,7 @@ class Country_GB extends Country {
|
||||
public function get_name() {
|
||||
|
||||
return __('United Kingdom', 'wp-ultimo-locations');
|
||||
|
||||
} // end get_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of states for GB.
|
||||
@ -328,7 +327,5 @@ class Country_GB extends Country {
|
||||
'WOR' => __('Worcestershire', 'wp-ultimo-locations'),
|
||||
'WRX' => __('Wrexham County Borough', 'wp-ultimo-locations'),
|
||||
);
|
||||
|
||||
} // end states;
|
||||
|
||||
} // end class Country_GB;
|
||||
}
|
||||
}
|
||||
|
@ -100,8 +100,7 @@ class Country_IN extends Country {
|
||||
public function get_name() {
|
||||
|
||||
return __('India', 'wp-ultimo-locations');
|
||||
|
||||
} // end get_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of states for IN.
|
||||
@ -149,7 +148,5 @@ class Country_IN extends Country {
|
||||
'UT' => __('Uttarakhand', 'wp-ultimo-locations'),
|
||||
'WB' => __('West Bengal', 'wp-ultimo-locations'),
|
||||
);
|
||||
|
||||
} // end states;
|
||||
|
||||
} // end class Country_IN;
|
||||
}
|
||||
}
|
||||
|
@ -111,8 +111,7 @@ class Country_JP extends Country {
|
||||
public function get_name() {
|
||||
|
||||
return __('Japan', 'wp-ultimo-locations');
|
||||
|
||||
} // end get_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of states for JP.
|
||||
@ -171,7 +170,5 @@ class Country_JP extends Country {
|
||||
'09' => __('Tochigi Prefecture', 'wp-ultimo-locations'),
|
||||
'06' => __('Yamagata Prefecture', 'wp-ultimo-locations'),
|
||||
);
|
||||
|
||||
} // end states;
|
||||
|
||||
} // end class Country_JP;
|
||||
}
|
||||
}
|
||||
|
@ -96,8 +96,7 @@ class Country_MX extends Country {
|
||||
public function get_name() {
|
||||
|
||||
return __('Mexico', 'wp-ultimo-locations');
|
||||
|
||||
} // end get_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of states for MX.
|
||||
@ -141,7 +140,5 @@ class Country_MX extends Country {
|
||||
'YUC' => __('Yucatán', 'wp-ultimo-locations'),
|
||||
'ZAC' => __('Zacatecas', 'wp-ultimo-locations'),
|
||||
);
|
||||
|
||||
} // end states;
|
||||
|
||||
} // end class Country_MX;
|
||||
}
|
||||
}
|
||||
|
@ -80,8 +80,7 @@ class Country_MY extends Country {
|
||||
public function get_name() {
|
||||
|
||||
return __('Malaysia', 'wp-ultimo-locations');
|
||||
|
||||
} // end get_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of states for MY.
|
||||
@ -109,7 +108,5 @@ class Country_MY extends Country {
|
||||
'08' => __('Perak', 'wp-ultimo-locations'),
|
||||
'09' => __('Perlis', 'wp-ultimo-locations'),
|
||||
);
|
||||
|
||||
} // end states;
|
||||
|
||||
} // end class Country_MY;
|
||||
}
|
||||
}
|
||||
|
@ -71,8 +71,7 @@ class Country_NE extends Country {
|
||||
public function get_name() {
|
||||
|
||||
return __('Niger', 'wp-ultimo-locations');
|
||||
|
||||
} // end get_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of states for NE.
|
||||
@ -91,7 +90,5 @@ class Country_NE extends Country {
|
||||
'6' => __('Tillabéri Region', 'wp-ultimo-locations'),
|
||||
'7' => __('Zinder Region', 'wp-ultimo-locations'),
|
||||
);
|
||||
|
||||
} // end states;
|
||||
|
||||
} // end class Country_NE;
|
||||
}
|
||||
}
|
||||
|
@ -76,8 +76,7 @@ class Country_NL extends Country {
|
||||
public function get_name() {
|
||||
|
||||
return __('Netherlands', 'wp-ultimo-locations');
|
||||
|
||||
} // end get_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of states for NL.
|
||||
@ -104,7 +103,5 @@ class Country_NL extends Country {
|
||||
'UT' => __('Utrecht', 'wp-ultimo-locations'),
|
||||
'ZE' => __('Zeeland', 'wp-ultimo-locations'),
|
||||
);
|
||||
|
||||
} // end states;
|
||||
|
||||
} // end class Country_NL;
|
||||
}
|
||||
}
|
||||
|
@ -147,8 +147,7 @@ class Country_RU extends Country {
|
||||
public function get_name() {
|
||||
|
||||
return __('Russia', 'wp-ultimo-locations');
|
||||
|
||||
} // end get_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of states for RU.
|
||||
@ -244,7 +243,5 @@ class Country_RU extends Country {
|
||||
'YAR' => __('Yaroslavl Oblast', 'wp-ultimo-locations'),
|
||||
'ZAB' => __('Zabaykalsky Krai', 'wp-ultimo-locations'),
|
||||
);
|
||||
|
||||
} // end states;
|
||||
|
||||
} // end class Country_RU;
|
||||
}
|
||||
}
|
||||
|
@ -66,8 +66,7 @@ class Country_SG extends Country {
|
||||
public function get_name() {
|
||||
|
||||
return __('Singapore', 'wp-ultimo-locations');
|
||||
|
||||
} // end get_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of states for SG.
|
||||
@ -84,7 +83,5 @@ class Country_SG extends Country {
|
||||
'04' => __('South East Community Development Council', 'wp-ultimo-locations'),
|
||||
'05' => __('South West Community Development Council', 'wp-ultimo-locations'),
|
||||
);
|
||||
|
||||
} // end states;
|
||||
|
||||
} // end class Country_SG;
|
||||
}
|
||||
}
|
||||
|
@ -145,8 +145,7 @@ class Country_TR extends Country {
|
||||
public function get_name() {
|
||||
|
||||
return __('Turkey', 'wp-ultimo-locations');
|
||||
|
||||
} // end get_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of states for TR.
|
||||
@ -239,7 +238,5 @@ class Country_TR extends Country {
|
||||
'09' => __('Aydın', 'wp-ultimo-locations'),
|
||||
'04' => __('Ağrı', 'wp-ultimo-locations'),
|
||||
);
|
||||
|
||||
} // end states;
|
||||
|
||||
} // end class Country_TR;
|
||||
}
|
||||
}
|
||||
|
@ -116,8 +116,7 @@ class Country_US extends Country {
|
||||
public function get_name() {
|
||||
|
||||
return __('United States', 'wp-ultimo-locations');
|
||||
|
||||
} // end get_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of states for US.
|
||||
@ -195,7 +194,5 @@ class Country_US extends Country {
|
||||
'WI' => __('Wisconsin', 'wp-ultimo-locations'),
|
||||
'WY' => __('Wyoming', 'wp-ultimo-locations'),
|
||||
);
|
||||
|
||||
} // end states;
|
||||
|
||||
} // end class Country_US;
|
||||
}
|
||||
}
|
||||
|
@ -73,8 +73,7 @@ class Country_ZA extends Country {
|
||||
public function get_name() {
|
||||
|
||||
return __('South Africa', 'wp-ultimo-locations');
|
||||
|
||||
} // end get_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of states for ZA.
|
||||
@ -95,7 +94,5 @@ class Country_ZA extends Country {
|
||||
'NC' => __('Northern Cape', 'wp-ultimo-locations'),
|
||||
'WC' => __('Western Cape', 'wp-ultimo-locations'),
|
||||
);
|
||||
|
||||
} // end states;
|
||||
|
||||
} // end class Country_ZA;
|
||||
}
|
||||
}
|
||||
|
@ -59,8 +59,7 @@ abstract class Country {
|
||||
public function __get($attribute) {
|
||||
|
||||
return wu_get_isset($this->attributes, $attribute, null);
|
||||
|
||||
} // end __get;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of states/provinces of this country.
|
||||
@ -85,8 +84,7 @@ abstract class Country {
|
||||
* @return array The filtered list of states.
|
||||
*/
|
||||
return apply_filters('wu_country_get_states', $states, $this->country_code, $this);
|
||||
|
||||
} // end get_states;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns states as options.
|
||||
@ -103,17 +101,14 @@ abstract class Country {
|
||||
$placeholder_option = array();
|
||||
|
||||
if ($placeholder !== false && $options) {
|
||||
|
||||
$division_name = $this->get_administrative_division_name();
|
||||
|
||||
// translators: %s is the name of the administrative division (state, province, etc).
|
||||
$placeholder_option[''] = $placeholder !== '' ? $placeholder : sprintf(__('Select your %s', 'wp-ultimo'), $division_name);
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
return array_merge($placeholder_option, $options);
|
||||
|
||||
} // end get_states_as_options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of cities for a country and state.
|
||||
@ -126,20 +121,16 @@ abstract class Country {
|
||||
public function get_cities($state_code = '') {
|
||||
|
||||
if (empty($state_code)) {
|
||||
|
||||
return array();
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$repository_file = wu_path("inc/country/{$this->country_code}/{$state_code}.php");
|
||||
|
||||
if (file_exists($repository_file) === false) {
|
||||
|
||||
return array();
|
||||
}
|
||||
|
||||
} // end if;
|
||||
|
||||
$cities = include($repository_file);
|
||||
$cities = include $repository_file;
|
||||
|
||||
/**
|
||||
* Returns the list of cities for a state in a country.
|
||||
@ -153,8 +144,7 @@ abstract class Country {
|
||||
* @return array The filtered list of states.
|
||||
*/
|
||||
return apply_filters('wu_country_get_cities', $cities, $this->country_code, $state_code, $this);
|
||||
|
||||
} // end get_cities;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get state cities as options.
|
||||
@ -172,16 +162,13 @@ abstract class Country {
|
||||
$placeholder_option = array();
|
||||
|
||||
if ($placeholder !== false && $options) {
|
||||
|
||||
$placeholder_option[''] = $placeholder !== '' ? $placeholder : __('Select your city', 'wp-ultimo');
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$options = array_combine($options, $options);
|
||||
|
||||
return array_merge($placeholder_option, $options);
|
||||
|
||||
} // end get_cities_as_options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of states for a country.
|
||||
@ -192,8 +179,7 @@ abstract class Country {
|
||||
protected function states() {
|
||||
|
||||
return array();
|
||||
|
||||
} // end states;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name of municipalities for a country/state.
|
||||
@ -214,8 +200,7 @@ abstract class Country {
|
||||
$name = $ucwords ? ucwords($name) : $name;
|
||||
|
||||
return apply_filters('wu_country_get_municipality_name', $name, $this->country_code, $state_code, $ucwords, $this);
|
||||
|
||||
} // end get_municipality_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name given to states for a country.
|
||||
@ -263,7 +248,5 @@ abstract class Country {
|
||||
* @return string The modified division name.
|
||||
*/
|
||||
return apply_filters('wu_country_get_administrative_division_name', $name, $this->country_code, $state_code, $ucwords, $this);
|
||||
|
||||
} // end get_administrative_division_name;
|
||||
|
||||
} // end class Country;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user