本文整理汇总了PHP中phone_format函数的典型用法代码示例。如果您正苦于以下问题:PHP phone_format函数的具体用法?PHP phone_format怎么用?PHP phone_format使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了phone_format函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: phoneUrl
/**
* Display a phone number as a hyperlink with the tel protocol
*
* @param string $value The number to display.
*
* @return string
*/
public static function phoneUrl($value)
{
if (empty($value)) {
return '';
}
$plainValue = preg_replace('/[^0-9x\\#*]/', null, $value);
try {
$formattedValue = phone_format($plainValue, 'US');
} catch (Exception $e) {
$formattedValue = $plainValue;
}
return sprintf('<a href="tel://%s">%s</a>', $plainValue, $formattedValue);
}
示例2: run
public function run()
{
// we remove all the files in the config folder
$files = glob(storage_path('app/settings/*'));
foreach ($files as $file) {
if (is_file($file)) {
unlink($file);
}
}
// we create the folder if it doesn't exist
if (!is_dir($storage_path = storage_path('app/settings'))) {
if (!is_dir($path = storage_path('app'))) {
mkdir($path);
}
mkdir($path . '/settings');
}
$logo_dark = ImageManager::optimizeAndResize(database_path('seeds/files/settings/logo-una-dark.png'), config('image.settings.logo.name.dark'), config('image.settings.logo.extension'), config('image.settings.storage_path'), config('image.settings.logo.sizes'), false);
$logo_light = ImageManager::optimizeAndResize(database_path('seeds/files/settings/logo-una-light.png'), config('image.settings.logo.name.light'), config('image.settings.logo.extension'), config('image.settings.storage_path'), config('image.settings.logo.sizes'), false);
// we insert base settings
$inputs = ['app_name_fr' => 'Club Université Nantes Aviron (UNA)', 'app_name_en' => 'Nantes University Rowing club', 'app_slogan_fr' => 'Le plus grand club universitaire de France.', 'app_slogan_en' => 'The biggest university rowing club from France.', 'breadcrumbs' => true, 'multilingual' => false, 'phone_number' => phone_format('0954014810', 'FR', PhoneNumberFormat::INTERNATIONAL), 'contact_email' => 'contact@una-club.fr', 'support_email' => 'support@una-club.fr', 'address' => '2 rue de la Houssinière', 'zip_code' => '44300', 'city' => 'Nantes', 'rss' => true, 'loading_spinner' => '<i class="fa fa-spinner fa-spin"></i>', 'success_icon' => '<i class="fa fa-thumbs-up"></i>', 'error_icon' => '<i class="fa fa-thumbs-down"></i>', 'info_icon' => '<i class="fa fa-bullhorn"></i>', 'facebook' => 'https://www.facebook.com/UniversiteNantesAviron', 'twitter' => 'https://twitter.com/UNAClub', 'google_plus' => 'https://plus.google.com/+Univ-nantes-avironFr', 'youtube' => 'https://www.youtube.com/channel/UCOeYQGBxGMGqW-DyfK2fVCQ', 'logo_dark' => $logo_dark, 'logo_light' => $logo_light];
file_put_contents(storage_path('app/settings/settings.json'), json_encode($inputs));
// we place the default favicon
File::copy(database_path('seeds/files/settings/favicon.ico'), public_path('favicon.ico'));
}
示例3: get_state
?>
</td> -->
<td scope="row"><?php
echo get_state($lt->cd_state);
?>
</td>
<td scope="row"><?php
echo $lt->cd_name;
?>
</td>
<td scope="row"><?php
echo phone_format($lt->cd_tel);
?>
</td>
<td scope="row"><?php
echo phone_format($lt->cd_hp);
?>
</td>
<td scope="row"><?php
echo $lt->cd_day_cnt;
?>
+<?php
echo $lt->cd_device_day_cnt;
?>
/<?php
echo $lt->cd_day_limit;
?>
</td>
</tr>
<?php
}
示例4: formatPhone
protected function formatPhone($phone_number)
{
$locale = strtoupper(app()->getLocale());
$phoneUtil = PhoneNumberUtil::getInstance();
try {
$phone = $phoneUtil->parse($phone_number, $locale);
$is_valid = $phoneUtil->isValidNumber($phone, $locale);
if ($is_valid) {
return phone_format($phone_number, $locale, PhoneNumberFormat::INTERNATIONAL);
} else {
return $phone_number;
}
} catch (Exception $e) {
return $phone_number;
}
}
示例5: enum
enum('NA', 'Not Required', 'Mortgage Arranged', 'Requires Mortgage')
*/
$db_data["cli_oldnotes"] = serialize($additional_requirements);
$db_data["cli_method"] = 'Import';
// telephone numbers must be placed in tel table, and linked to current client
$ord = 1;
if (strlen($row["Tel"] > 3)) {
$db_data_tel[$row["Client_ID"]][] = array('tel_number' => phone_format($row["Tel"]), 'tel_type' => 'Home', 'tel_cli' => $row["Client_ID"], 'tel_ord' => $ord);
$ord++;
}
if (strlen($row["Fax"] > 3)) {
$db_data_tel[$row["Client_ID"]][] = array('tel_number' => phone_format($row["Fax"]), 'tel_type' => 'Fax', 'tel_cli' => $row["Client_ID"], 'tel_ord' => $ord);
$ord++;
}
if (strlen($row["Mobile"] > 3)) {
$db_data_tel[$row["Client_ID"]][] = array('tel_number' => phone_format($row["Mobile"]), 'tel_type' => 'Mobile', 'tel_cli' => $row["Client_ID"], 'tel_ord' => $ord);
$ord++;
}
$db_dimension[$counter]["client"] = $db_data;
$db_dimension[$counter]["tel"] = $db_data_tel;
unset($db_data, $db_data_tel);
#print_r($db_data);
$counter++;
}
}
// inserting into new table
require_once "../inx/db.inc.php";
require_once "../inx/postcode.inc.php";
require_once "../inx/postcode.class.inc.php";
foreach ($db_dimension as $key => $values) {
// decided to skip part-names, so anything with a ? is now ignored
示例6: convert_field
function convert_field($value, $datatype = '')
{
//echo "BEFORE: ".$value."\n";
$value = trim($value);
if ($datatype == 'phone') {
$value = phone_format($value);
} else {
if ($datatype == 'date') {
$value = mysql_date($value);
} else {
if ($datatype == 'time') {
$value = mysql_time($value);
} else {
if ($datatype == 'int') {
if ($value || $value === 0 || $value === "0") {
$value = intval($value);
} else {
$value = NULL;
}
} else {
if ($datatype == 'float') {
if ($value || $value === 0) {
$value = floatval($value);
} else {
$value = NULL;
}
} else {
if ($datatype == 'double') {
if ($value || $value === 0) {
$value = doubleval($value);
} else {
$value = NULL;
}
} else {
if ($datatype == 'url') {
$value = prep_url($value);
}
}
}
}
}
}
}
//echo "AFTER: ".$value." DATATYPE: ".$datatype."\n";
return $value;
}
示例7: db_query
$db_data['tel_type'] = $_POST["tel" . $tel_count . "type"];
$db_data['tel_con'] = $con_id;
db_query($db_data, "UPDATE", "tel", "tel_id", $val['id']);
}
}
}
// check if new phone has been entrered
// new phones perhaps should go at the top, reordering the rest down by 1 ? for the time being, they are put at the bottom
if ($telephone) {
$ord = count($telephone) + 1;
} else {
$ord = 1;
}
if ($_POST["telnew"]) {
if (phone_validate($_POST["telnew"])) {
$db_data = array('tel_number' => phone_format($_POST["telnew"]), 'tel_type' => $_POST["telnewtype"], 'tel_con' => $con_id, 'tel_ord' => $ord);
db_query($db_data, "INSERT", "tel", "tel_id");
unset($db_data);
} else {
$errors[] = 'Please enter a valid phone number';
}
}
} elseif ($_POST["form2"]) {
$viewForm = 2;
// addresses from postcode lookup will already be stored in table, and will provide pro_pro_id
// this needs to be stored in the link table pro2cli
if ($_POST["pro_pro_id"]) {
$pro_id = $_POST["pro_pro_id"];
$db_data["p2c_pro"] = $pro_id;
$db_data["p2c_con"] = $_POST["con_id"];
$db_data["p2c_type"] = $_POST["p2c_type"];
示例8: save_call
function save_call($external_input)
{
global $version, $client_db;
$input = new ClientCard();
$input = $external_input;
if (!is_session_alive($input->session_id)) {
return -1;
}
$number = phone_format(preg_replace("/[^0-9]/", "", $input->input_number));
$number1 = phone_format(preg_replace("/[^0-9]/", "", $input->phone1));
$number2 = phone_format(preg_replace("/[^0-9]/", "", $input->phone2));
$number3 = phone_format(preg_replace("/[^0-9]/", "", $input->phone3));
$number4 = phone_format(preg_replace("/[^0-9]/", "", $input->fax));
if (trim($number) == '') {
return -3;
}
$search_phone = debugging_values("SELECT id FROM `" . $client_db . "`.`clients" . $version . "` WHERE (main_number LIKE '" . $number . "' OR phone1 LIKE '" . $number . "' OR phone2 LIKE '" . $number . "' OR phone3 LIKE '" . $number . "' OR fax LIKE '" . $number . "')", 1, 1);
if (count($search_phone) == 0) {
debugging_values("INSERT INTO `" . $client_db . "`.`clients" . $version . "`(`id`, `name`, `contact`, `city`, `adress`, `phone1`, `phone2`, `phone3`, `fax`, `emails`, `dopinfo`, `creation_date`, `last_call`, `info`, `main_number`,\n\t\t`client_id`, `agreement_num`, `agreement_type`, `agreement_beg`, `agreement_end`, `discount_ins`, `discount_mat`, `internal`, `client_code`, `ttk`)\n VALUES (NULL, '" . mysql_escape_string($input->client_name) . "', '" . mysql_escape_string($input->contact_name) . "',\n '" . mysql_escape_string($input->city) . "', '" . mysql_escape_string($input->adress) . "',\n '" . str_replace('%', '', $number1) . "', '" . str_replace('%', '', $number2) . "', '" . str_replace('%', '', $number3) . "', '" . str_replace('%', '', $number4) . "',\n '" . mysql_escape_string($input->emails) . "', '" . mysql_escape_string($input->dopinfo) . "',\n NOW(), NOW(), 1, '" . str_replace('%', '', $number) . "',\n '" . mysql_escape_string($input->client_id) . "', '" . mysql_escape_string($input->agreement_num) . "',\n '" . mysql_escape_string($input->agreement_type) . "', '" . mysql_escape_string($input->agreement_beg) . "',\n '" . mysql_escape_string($input->agreement_end) . "', '" . mysql_escape_string($input->discount_ins) . "',\n '" . mysql_escape_string($input->discount_mat) . "', '0', \n '" . mysql_escape_string($input->client_code) . "', '" . mysql_escape_string($input->ttk) . "')", 1, 1);
$client_id = mysql_insert_id();
if (mysql_errno()) {
return -5;
}
} else {
$client_id = $search_phone[0]['id'];
debugging_values("UPDATE `" . $client_db . "`.`clients" . $version . "` SET\n\t\t name = '" . mysql_escape_string($input->client_name) . "',\n\t\t contact = '" . mysql_escape_string($input->contact_name) . "',\n\t\t city = '" . mysql_escape_string($input->city) . "',\n\t\t adress = '" . mysql_escape_string($input->adress) . "',\n\t\t phone1 = '" . str_replace('%', '', $number1) . "',\n\t\t phone2 = '" . str_replace('%', '', $number2) . "',\n\t\t phone3 = '" . str_replace('%', '', $number3) . "',\n\t\t fax = '" . str_replace('%', '', $number4) . "',\n\t\t emails = '" . mysql_escape_string($input->emails) . "',\n\t\t dopinfo = '" . mysql_escape_string($input->dopinfo) . "',\n\t\t last_call = NOW(),\n\t\t client_id = '" . mysql_escape_string($input->client_id) . "',\n\t\t agreement_num = '" . mysql_escape_string($input->agreement_num) . "',\n\t\t agreement_type = '" . mysql_escape_string($input->agreement_type) . "',\n\t\t agreement_beg = '" . mysql_escape_string($input->agreement_beg) . "',\n\t\t agreement_end = '" . mysql_escape_string($input->agreement_end) . "',\n\t\t discount_ins = '" . mysql_escape_string($input->discount_ins) . "',\n\t\t discount_mat = '" . mysql_escape_string($input->discount_mat) . "',\n\t\t client_code = '" . mysql_escape_string($input->client_code) . "',\n\t\t ttk = '" . mysql_escape_string($input->ttk) . "'\n\t\t WHERE (main_number LIKE '" . $number . "' OR phone1 LIKE '" . $number . "' OR phone2 LIKE '" . $number . "' OR phone3 LIKE '" . $number . "' OR fax LIKE '" . $number . "')", 1, 1);
}
$uid = debugging_values("SELECT unique_id FROM `" . $client_db . "`.`calls_temp` WHERE number LIKE '" . mysql_escape_string($input->input_number) . "' ORDER BY id DESC LIMIT 1", 1, 1);
if (count($uid) == 0) {
$unique_id = '';
} else {
$unique_id = $uid[0]['unique_id'];
}
debugging_values("INSERT INTO `" . $client_db . "`.`calls" . $version . "` (`id`, `client_id`, `call_date`, `comment`, `operator`, `unique_id`) VALUES\n\t (NULL,\n\t '" . $client_id . "',\n\t NOW(),\n\t '" . mysql_escape_string($input->call_comment) . "',\n\t '" . mysql_escape_string($input->operator) . "',\n\t '" . $unique_id . "')", 1, 1);
if (mysql_errno()) {
return -5;
} else {
return 0;
}
}
示例9: array
}
$args = array('post_type' => 'locations', 'tax_query' => array(array('taxonomy' => 'category', 'field' => 'slug', 'terms' => $slug)), 'orderby' => $orderby, 'order' => $order, 'nopaging' => true);
$loop = new WP_Query($args);
?>
<div class="row limited-width">
<?php
while ($loop->have_posts()) {
$loop->the_post();
?>
<?php
$todayIs = strtolower(date('l'));
$nowTime = strtotime(date('H:i'));
// Format the phone number
$phone = phone_format(get_field('phone'));
// Split up the tags field
$tags = explode(',', get_field('tags'));
$number_tags = count($tags);
?>
<?php
/* Add tags as class to the location box for filtering with JS */
$theTags = get_field('tags');
$tagClasses = strtolower(preg_replace('/[\\s]/', '', $theTags));
$tagClasses = preg_replace('[,]', ' ', $tagClasses);
$status = get_field('status');
/*
Possible Statuses:
cool : Cool
opening-soon : Opening Soon
示例10: update
public function update(Request $request)
{
// we check the current user permission
if (!Permission::hasPermission('settings.update')) {
// we redirect the current user to the settings view if he has the required permission
if (Sentinel::getUser()->hasAccess('settings.view')) {
return redirect()->route('settings.view');
} else {
// or we redirect the current user to the home page
return redirect()->route('dashboard.index');
}
}
// we clear the cache
Artisan::call('cache:clear');
Artisan::call('config:clear');
// we sanitize the entries
$request->replace(InputSanitizer::sanitize($request->all()));
// if the boolean field is not given, we set it to false
$request->merge(['breadcrumb' => $request->get('breadcrumb', false)]);
$request->merge(['multilingual' => $request->get('multilingual', false)]);
$request->merge(['rss' => $request->get('rss', false)]);
// we get the inputs
$inputs = $request->except('_token', '_method');
// we set the rules according to the multilingual config
$rules = ['app_name_fr' => 'required|string', 'app_slogan_fr' => 'string', 'breadcrumbs' => 'boolean', 'multilingual' => 'boolean', 'phone_number' => 'phone:FR', 'contact_email' => 'required|email', 'support_email' => 'required|email', 'address' => 'string', 'zip_code' => 'digits:5', 'city' => 'string', 'facebook' => 'url', 'twitter' => 'url', 'google_plus' => 'url', 'youtube' => 'url', 'linkedin' => 'url', 'pinterest' => 'url', 'rss' => 'boolean', 'favicon' => 'mimes:ico|image_size:16,16', 'logo_light' => 'image|mimes:png|image_size:>=300,*', 'logo_dark' => 'image|mimes:png|image_size:>=300,*', 'loading_spinner' => 'string', 'success_icon' => 'string', 'error_icon' => 'string', 'info_icon' => 'string', 'google_analytics_script' => 'string', 'google_analytics_view_id' => 'numeric', 'google_analytics_json' => 'mimes:json'];
if (config('settings.multilingual')) {
$rules['app_name_en'] = 'required|string';
$rules['app_slogan_en'] = 'string';
}
// we check the inputs validity
if (!Validation::check($inputs, $rules)) {
// we flash the request
$request->flash();
return redirect()->back();
}
// we save the settings
try {
// we format the number into its international equivalent
if (isset($inputs['phone_number']) && !empty($inputs['phone_number'])) {
$inputs['phone_number'] = $formatted_phone_number = phone_format($inputs['phone_number'], 'FR', PhoneNumberFormat::INTERNATIONAL);
}
// we put the favicon at the root of the project
if ($favicon = $request->file('favicon')) {
$favicon->move('./', 'favicon.ico');
}
// logo light treatment
if ($logo_light = $request->file('logo_light')) {
// if a previous version of the image is found, we delete it
if ($current_logo_light = config('settings.logo_light')) {
ImageManager::remove($current_logo_light, config('image.settings.storage_path'), config('image.settings.logo.sizes'));
}
// we optimize, resize and save the image
$file_name = ImageManager::optimizeAndResize($logo_light->getRealPath(), config('image.settings.logo.name.light'), $logo_light->getClientOriginalExtension(), config('image.settings.storage_path'), config('image.settings.logo.sizes'));
// we add the image name to the inputs for saving
$inputs['logo_light'] = $file_name;
} elseif (config('settings.logo_light')) {
$inputs['logo_light'] = config('settings.logo_light');
}
// logo dark treatment
if ($logo_dark = $request->file('logo_dark')) {
// if a previous version of the image is found, we delete it
if ($current_logo_dark = config('settings.logo_dark')) {
ImageManager::remove($current_logo_dark, config('image.settings.storage_path'), config('image.settings.logo.sizes'));
}
// we optimize, resize and save the image
$file_name = ImageManager::optimizeAndResize($logo_dark->getRealPath(), config('image.settings.logo.name.dark'), $logo_dark->getClientOriginalExtension(), config('image.settings.storage_path'), config('image.settings.logo.sizes'));
// we add the image name to the inputs for saving
$inputs['logo_dark'] = $file_name;
} elseif (config('settings.logo_dark')) {
$inputs['logo_dark'] = config('settings.logo_dark');
}
// we create or replace the google analytics view id in the env file
Env::createOrReplace('ANALYTICS_VIEW_ID', $inputs['google_analytics_view_id']);
unset($inputs['google_analytics_view_id']);
// google analytics credential json treatment
if ($google_analytics_credentials_json = $request->file('google_analytics_credentials_json')) {
// if a previous version of the file is found, we delete it
if ($current_google_analytics_credentials_json = env('ANALYTICS_CREDENTIALS_JSON')) {
FileManager::remove($current_google_analytics_credentials_json, config('file.settings.storage_path'));
}
// we save the file
$file_name = FileManager::storeAndRename($google_analytics_credentials_json->getRealPath(), config('file.settings.google_analytics_credentials_json.name'), $google_analytics_credentials_json->getClientOriginalExtension(), config('file.settings.storage_path'));
// we create or replace the google analytics credential json path in the env file
Env::createOrReplace('ANALYTICS_CREDENTIALS_JSON', $file_name);
unset($inputs['google_analytics_credentials_json']);
}
// we update the json file
file_put_contents(storage_path('app/settings/settings.json'), json_encode($inputs));
// we notify the current user
Modal::alert([trans('settings.message.update.success')], 'success');
// we renew the config cache
if (config('app.env') !== 'local') {
Artisan::call('route:cache');
Artisan::call('config:cache');
}
return redirect()->back();
} catch (Exception $e) {
// we flash the request
$request->flash();
// we log the error
//.........这里部分代码省略.........
示例11: unset
unset($db_data_tel);
}
if (strlen($row["WorkTelephone"] > 3)) {
$db_data_tel = array('tel_number' => phone_format($row["WorkTelephone"]), 'tel_type' => 'Work', 'tel_cli' => $cli_id, 'tel_ord' => $ord);
db_query($db_data_tel, "INSERT", "tel", "tel_id");
$ord++;
unset($db_data_tel);
}
if (strlen($row["Facsimile"] > 3)) {
$db_data_tel = array('tel_number' => phone_format($row["Facsimile"]), 'tel_type' => 'Fax', 'tel_cli' => $cli_id, 'tel_ord' => $ord);
db_query($db_data_tel, "INSERT", "tel", "tel_id");
$ord++;
unset($db_data_tel);
}
if (strlen($row["Mobile"] > 3)) {
$db_data_tel = array('tel_number' => phone_format($row["Mobile"]), 'tel_type' => 'Mobile', 'tel_cli' => $cli_id, 'tel_ord' => $ord);
db_query($db_data_tel, "INSERT", "tel", "tel_id");
$ord++;
unset($db_data_tel);
}
}
unset($db_data, $db_data_tel);
#print_r($db_data);
$counter++;
}
}
$db_data_import["imp_source"] = 'figthedog';
$db_data_import["imp_report"] = serialize($duplicates);
$db_data_import["imp_skipped"] = serialize($skipped);
db_query($db_data_import, "INSERT", "import", "imp_id");
}
示例12: getPhoneNumberAttribute
public function getPhoneNumberAttribute()
{
return phone_format($this->phone, 'US', 'E164');
}
示例13: export
public function export($data, $field)
{
$fieldname = strval($field['name']);
return phone_format($data->{$fieldname});
}
示例14: phone_format
?>
</td>
<td scope="row"><?php
echo $lt->pf_port;
?>
</td>
<td scope="row"><?php
echo $lt->pf_name;
?>
</td>
<td scope="row"><?php
echo phone_format($lt->pf_tel);
?>
</td>
<td scope="row"><?php
echo phone_format($lt->pf_hp);
?>
</td>
<td scope="row"><?php
echo $lt->pf_status;
?>
</td>
</tr>
<?php
}
?>
</tbody>
<tfoot>
<tr>
<th colspan="12" style="text-align:left">
示例15: store
/**
* Сохранение данных заявки
* с предварительной валидацией данных
*
*/
public function store(PublicOrder $publicOrder, Request $request)
{
Session::reflash();
$input = $request->all();
$validateData = $this->validateData($input);
$validation = Validator::make($validateData['input'], $validateData['rules'], $validateData['messages']);
if ($validation->fails()) {
return redirect()->route('validateError')->withInput()->withErrors($validation);
}
$validateData['input']['phone'] = phone_format($validateData['input']['phone'], 'RU');
$publicOrder->saveOrder($validateData['input']);
$this->orderEmail($validateData['input']);
return view('public.thanks', ['input' => $validateData['input']]);
}