2019-02-26 07:00:04 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* @file country.kr.php
|
|
|
|
* @date 2018-04-15
|
2022-11-25 14:15:20 +00:00
|
|
|
* @author Go Namhyeon <abuse@catswords.net>
|
2019-02-26 07:00:04 +00:00
|
|
|
* @brief Country Helper (Korean)
|
|
|
|
*/
|
|
|
|
|
|
|
|
// parse telephone number
|
2020-02-10 06:23:04 +00:00
|
|
|
if(!is_fn("get_kr_parsed_tel_number")) {
|
2019-05-20 08:19:05 +00:00
|
|
|
function get_kr_parsed_tel_number($tel) {
|
|
|
|
$output = preg_replace("/[^0-9]/", "", $tel); // 숫자 이외 제거
|
|
|
|
$local_code = substr($tel, 0, 2);
|
|
|
|
if ($local_code == '02') {
|
|
|
|
$output = preg_replace("/([0-9]{2})([0-9]{3,4})([0-9]{4})$/", "\\1-\\2-\\3", $tel);
|
|
|
|
} elseif (strlen($tel) == '8' && in_array($local_code, array('15', '16', '18'))) {
|
|
|
|
$output = preg_replace("/([0-9]{4})([0-9]{4})$/", "\\1-\\2", $tel); // 지능망 번호이면
|
|
|
|
} else {
|
|
|
|
$output = preg_replace("/([0-9]{3})([0-9]{3,4})([0-9]{4})$/", "\\1-\\2-\\3", $tel);
|
|
|
|
}
|
|
|
|
return $output;
|
|
|
|
}
|
2019-02-26 07:00:04 +00:00
|
|
|
}
|
|
|
|
|
2020-02-10 06:23:04 +00:00
|
|
|
if(!is_fn("get_kr_get_lastname")) {
|
2019-05-20 08:19:05 +00:00
|
|
|
function get_kr_get_lastname()
|
|
|
|
if(loadHelper("string.utils")) {
|
|
|
|
$words = read_storage_file_by_line("kr.lastname.txt", array(
|
|
|
|
"storage_type" => "country",
|
|
|
|
)));
|
|
|
|
return $words[get_random_index($words)];
|
|
|
|
}
|
|
|
|
}
|
2019-02-26 07:00:04 +00:00
|
|
|
}
|
|
|
|
|
2020-02-10 06:23:04 +00:00
|
|
|
if(!is_fn("get_kr_get_firstname")) {
|
2019-05-20 08:19:05 +00:00
|
|
|
function get_kr_get_firstname() {
|
|
|
|
if(loadHelper("string.utils")) {
|
|
|
|
$words = read_storage_file_by_line("kr.firstname.txt", array(
|
|
|
|
"storage_type" => "country",
|
|
|
|
)));
|
|
|
|
return $words[get_random_index($words)];
|
|
|
|
}
|
|
|
|
}
|
2019-02-26 07:00:04 +00:00
|
|
|
}
|
|
|
|
|
2020-02-10 06:23:04 +00:00
|
|
|
if(!is_fn("get_kr_get_generated_name")) {
|
2019-05-20 08:19:05 +00:00
|
|
|
function get_kr_get_generated_name() {
|
|
|
|
return sprintf("%s%s", get_kr_get_lastname(), get_kr_get_firstname());
|
|
|
|
}
|
2019-02-26 07:00:04 +00:00
|
|
|
}
|