本文整理汇总了PHP中country::getCountryId方法的典型用法代码示例。如果您正苦于以下问题:PHP country::getCountryId方法的具体用法?PHP country::getCountryId怎么用?PHP country::getCountryId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类country
的用法示例。
在下文中一共展示了country::getCountryId方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CheckInput
/**
* Проверяем введенные данные записываем их в класс и приводим их к нормальной форме
*
* @return string Сообщение об ошибке
*/
function CheckInput($sbr = false)
{
$this->org_name = $this->org_name ? change_q(substr($this->org_name, 0, 128)) : '';
$this->phone = $this->phone ? substr(change_q($this->phone), 0, 24) : '';
$this->fax = $this->fax ? substr(change_q($this->fax), 0, 24) : '';
$this->email = $this->email ? substr(change_q($this->email), 0, 64) : '';
$this->country = $this->country ? substr(change_q($this->country), 0, 64) : '';
$this->country_id = intval($this->country_id);
$this->city = $this->city ? substr(change_q($this->city), 0, 64) : '';
$this->city_id = intval($this->city_id);
$this->index = $this->index ? substr(change_q($this->index), 0, 7) : '';
$this->address = $this->address ? substr(change_q($this->address), 0, 128) : '';
$this->address_grz = $this->address_grz ? substr(change_q($this->address_grz), 0, 128) : '';
$this->inn = $this->inn ? substr(change_q($this->inn), 0, 32) : '';
$this->kpp = $this->kpp ? substr(change_q($this->kpp), 0, 32) : '';
$this->okpo = $this->okpo ? substr(change_q($this->okpo), 0, 10) : '';
$this->full_name = $this->full_name ? change_q(substr($this->full_name, 0, 128)) : '';
$this->fio = $this->fio ? substr(change_q($this->fio), 0, 64) : '';
$this->address_jry = $this->address_jry ? substr(change_q($this->address_jry), 0, 128) : '';
$this->bank_name = $this->bank_name ? substr(change_q($this->bank_name), 0, 64) : '';
$this->bank_city = $this->bank_city ? substr(change_q($this->bank_city), 0, 32) : '';
$this->bank_ks = $this->bank_ks ? substr(change_q($this->bank_ks), 0, 64) : '';
$this->bank_rs = $this->bank_rs ? substr(change_q($this->bank_rs), 0, 64) : '';
$country_id = country::getCountryId($this->country);
$aRequired = array("org_name", "phone", "email", "country_id", "city_id", "index", "address", "inn", "full_name", "address_jry");
// убираем не обязательные поля в зависимости от ситуации
if ($this->country_id != 1) {
unset($aRequired[7]);
// inn
}
if ($sbr) {
unset($aRequired[0]);
// org_name
}
$error = $this->check_required($aRequired);
if (isset($error['country'])) {
$error['country'] = 'Пожалуйста, выберите страну';
}
if (isset($error['city'])) {
$error['city'] = 'Пожалуйста, выберите город';
}
if (!is_email($this->email)) {
$error['email'] = "Поле заполнено некорректно";
}
if ($this->kpp && !preg_match("/^\\d{9}\$/", $this->kpp)) {
$error['kpp'] = "Поле заполнено некорректно";
}
if ($country_id == 1) {
if (!preg_match("/^\\d{10,12}\$/", $this->inn) || strlen($this->inn) == 11) {
$error['inn'] = "Поле заполнено некорректно";
}
}
if (!preg_match("/^([0-9]+)\$/", $this->index)) {
$error['index'] = "Поле заполнено некорректно";
}
if ($this->okpo && !preg_match('/^(?:\\d{8}|\\d{10})$/', $this->okpo)) {
$error['okpo'] = "Поле заполнено некорректно";
}
if (!preg_match("/^[A-Za-z\\d\\-\\(\\)+\\s]+\$/", $this->phone)) {
$error['phone'] = "Поле заполнено некорректно";
}
return $error;
}
示例2: parseAddress
/**
* Пытаемся разобрать адресс, если не получиться то вернем то что передали
* Например: 127287, Россия, г. Москва, ул. 2-я Хуторская д 38А стр.9
*/
function parseAddress($address)
{
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/country.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/city.php';
$index = null;
$country_name = null;
$country_id = null;
$city_id = null;
$city_name = null;
$parts = explode(',', $address);
if ($parts) {
$countryObject = new country();
$cityObject = new city();
$parts = array_map('trim', $parts);
//Индекс
$country_pos = 0;
if (intval($parts[0]) > 0) {
$index = intval($parts[0]);
$country_pos = 1;
}
//Страна
$city_pos = $country_pos;
$_country_name = ucfirst($parts[$country_pos]);
if ($country_id = $countryObject->getCountryId($_country_name)) {
$country_name = $_country_name;
$city_pos++;
}
//Город
$street_pos = $city_pos;
$_city_name = ucfirst(trim(str_replace('г.', '', $parts[$city_pos])));
if ($city_data = $cityObject->getByName($_city_name)) {
$city_id = $city_data['id'];
$city_name = $_city_name;
$street_pos++;
//Если нет страны то пробуем ее определить из города
$country_id = !$country_id ? $city_data['country_id'] : $country_id;
}
//Неудалось разобрать адресс
if (!$street_pos) {
return false;
}
$parts = array_slice($parts, $street_pos);
$address = implode(', ', $parts);
return array('index' => $index, 'country' => $country_name, 'country_id' => $country_id, 'city' => $city_name, 'city_id' => $city_id, 'address' => $address);
}
return false;
}
示例3: preg_replace
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/city.php";
$keywords = $_POST['pf_keywords'];
if ($keywords) {
$keywords = preg_replace('/\\s+/si', ' ', $keywords);
}
$prj_filter = new projects_filters();
$f_category = isset($_POST['pf_categofy']) ? $_POST['pf_categofy'] : '';
if ((int) $_POST['comboe_column_id'] === 1 && $_POST['comboe_db_id'] > 0) {
$f_category[1][$_POST['comboe_db_id']] = 1;
}
if ((int) $_POST['comboe_column_id'] === 0 && $_POST['comboe_db_id'] > 0) {
$f_category[0][$_POST['comboe_db_id']] = 1;
}
// Временное решение
list($f_country, $f_city) = split(": ", $_POST['location']);
$_POST['pf_country'] = country::getCountryId($f_country);
$_POST['pf_city'] = city::getCityIdByCountry($f_city, (int) $_POST['pf_country']);
if ((int) $_POST['pf_cost_from'] == 0) {
$_POST['pf_wo_budjet'] = 1;
##0028132
}
$prj_filter->Save(get_uid(), $_POST['pf_cost_from'], $_POST['pf_cost_to'], $_POST['pf_currency'], isset($_POST['pf_wo_budjet']), $f_category, $_POST['pf_country'], $_POST['pf_city'], $_POST['pf_keywords'], isset($_POST['pf_my_specs']), $rerror, $error, 0, $filter_page, $kind == 1 || $kind == 2, $_POST['pf_only_sbr'], $_POST['pf_pro_only'], $_POST['pf_verify_only'], $_POST['pf_less_offers'], $_POST['pf_end_days_from'], $_POST['pf_end_days_to'], false, 4, $_POST['pf_urgent_only'], $_POST['pf_block_only'], isset($_POST['hide_exec']));
$location = '/projects/' . ($kind != 5 ? '?kind=' . $kind : '');
break;
// Деактивация фильтра проектов
// Деактивация фильтра проектов
case "deletefilter":
if ($PDA) {
$prj_filter = new projects_filters_pda();
$prj_filter->UpdateActiveFilter(get_uid(), false);
} else {