$name = $what['name']; } if (isset($data['vname']) and names($data['vname'], 255)) { $what['vname'] = names($data['vname'], 255); $vname = $what['vname']; } if (isset($data['phone']) and phone($data['phone'])) { $what['phone'] = phone($data['phone']); $phone = $what['phone']; } if (isset($data['handy']) and phone($data['handy'])) { $what['handy'] = phone($data['handy']); $handy = $what['handy']; } if (isset($data['fax']) and phone($data['fax'])) { $what['fax'] = phone($data['fax']); $fax = $what['fax']; } if (isset($data['city']) and names($data['city'], 50)) { $what['city'] = names($data['city'], 50); $city = $what['city']; } if (isset($data['cityn']) and is_number($data['cityn'], 6)) { $what['cityn'] = is_number($data['cityn'], 6); $cityn = $what['cityn']; } if (isset($data['street']) and names($data['street'], 50)) { $what['street'] = names($data['street'], 50); $street = $what['street']; } if (isset($data['streetn']) and wpreg_check($data['streetn'], 6)) {
if ($response) { print $value == 1 ? "SI" : "NO"; } else { print "ko;" . $db->error(); } break; case "address": $student = $_REQUEST['student']; $value = $_REQUEST['address']; $response = address($student, $value, $db); if (!$response) { print "Errore"; } else { print "<a href='#' id='row" . $student . "_field3' onclick='change_address(this, " . $student . ")' style='font-weight: normal; color: #303030'>{$value}</a>"; } break; case "phone": $student = $_REQUEST['student']; $value = $_REQUEST['phone']; $response = phone($student, $value, $db); if (!$response) { print "Errore"; } else { print "<a href='#' id='row" . $student . "_field4' onclick='change_phone(this, " . $student . ")' style='font-weight: normal; color: #303030'>{$value}</a>"; } break; default: print "Parametro sconosciuto: " . $_REQUEST['action']; break; } exit;
public function testHelperFunction() { // Test landline number without format parameter. $actual = phone('016123456', 'BE'); $expected = '+32 16 12 34 56'; $this->assertEquals($expected, $actual); // Test landline number with format parameter. $actual = phone('016123456', 'BE', PhoneNumberFormat::NATIONAL); $expected = '016 12 34 56'; $this->assertEquals($expected, $actual); // Test fetching of util. $this->assertTrue(phone() instanceof PhoneNumberUtil); }
$lname = $_POST['lastname']; $email = $_POST['email']; $phone = $_POST['phone']; $source = $_POST['source']; $message = $_POST['message']; $website = $_POST['website']; $clearance = 0; //Validate Requireds $reqs = [$fname, $lname, $email, $phone, $source]; foreach ($reqs as $r) { $clearance += required($r) ? 0 : 1; } //Validate Email $clearance += email($email) ? 0 : 1; //Validate Phone $clearance += phone($phone) ? 0 : 1; //Check Validation & Send Email if ($clearance !== 0) { /* submission invalidation */ /* error-handling */ } else { /* submission clear */ //Load CMS Constants $community_number = "576"; $followup_code = "E"; //Load Request Data $data = "FirstName:" . $fname; $data .= "~LastName:" . $lname; $data .= "~Email:" . $email; $data .= "~Phone:" . $phone; $data .= "~Source:" . $source;
$xml = new SimpleXMLElement(tidy_repair_string(file_get_contents('php://stdin'), $config, 'utf8')); foreach ($xml->xpath('//div[@class="brewery"]/ul[@class="vcard simple"]') as $block) { $name = filter((string) $block->xpath('li[@class="name"]')[0]); $addrBlock = $block->xpath('li[@class="address"]'); if (empty($addrBlock)) { $address1 = ''; $address2 = filter((string) $block->xpath('li[@class="name"]/following-sibling::li')[0]); } else { $address1 = filter((string) $addrBlock[0]); $address2 = filter((string) $block->xpath('li[@class="address"]/following-sibling::li')[0]); } if (preg_match('/^([^,]+)\\s*,\\s*([A-Z]{2})\\s+([\\d-]+)/', $address2, $match)) { $address2 = ''; $city = $match[1]; $state = $match[2]; $zip = $match[3]; } else { $city = ''; $state = ''; $zip = ''; } $phoneBlock = $block->xpath('li[@class="telephone"]'); $phone = empty($phoneBlock) ? '' : phone(untag(filter((string) $phoneBlock[0]))); $typeBlock = $block->xpath('li[@class="brewery_type"]'); $type = empty($typeBlock) ? '' : strtolower(untag(filter((string) $typeBlock[0]))); $urlBlock = $block->xpath('li[@class="url"]/a'); $url = empty($urlBlock) ? '' : strtolower(filter((string) $urlBlock[0]->attributes()->href)); $data = ['name' => $name, 'address1' => $address1, 'address2' => $address2, 'city' => $city, 'state' => $state, 'zip' => $zip, 'phone' => $phone, 'type' => $type, 'url' => $url]; fputcsv($fp, $data); } fclose($fp);
/** * Formats a phone number and country for display. * * @param string $phone * @param string $country * @param int|null $format * @return string * * @deprecated 2.8.0 */ function phone_format($phone, $country = null, $format = PhoneNumberFormat::INTERNATIONAL) { return phone($phone, $country, $format); }
?> <div class="fluid-block b-top-header" > <div class="adaptive-block grid grid-12 " > <div class="grid-row" > <div class="clmn-12 clmn-xs-12 clmn-sm-12 clmn-md-12 clmn-lg-12 " > <div class="logo-cont" > <a href="/en/" ><span class="logo" ></span></a> </div> <div class="contact-cont" > <div class="icon-cont" > <a class="item phone" href="tel:+<?php echo phone(get_field('soc-phone', $lng_id)); ?> " ><?php the_field('soc-phone', $lng_id); ?> </a> <a class="item fb " href="<?php the_field('soc-fb', $lng_id); ?> " ></a> <a class="item twi " href="<?php the_field('soc-twi', $lng_id); ?> " ></a> <a class="item inst " href="<?php the_field('soc-inst', $lng_id);
} // возвращаем результат return ($plus ? "+" : "") . $countryCode . '(' . $cityCode . ')' . phoneBlocks($phone); } } } // возвращаем результат без кода страны и города return ($plus ? "+" : "") . phoneBlocks($phone); } // функция превращает любое числов в строку формата XX-XX-... или XXX-XX-XX-... в зависимости от четности кол-ва цифр function phoneBlocks($number) { $add = ''; if (strlen($number) % 2) { $add = $number[0]; $number = substr($number, 1, strlen($number) - 1); } return $add . implode("-", str_split($number, 2)); } // echo phone("+38 (044) 226-22-04") . "<br />"; echo phone("0038 (044) 226-22-04") . "<br />"; echo phone("+79263874815") . "<br />"; echo phone("4816145") . "<br />"; echo phone("+44 (0) 870 770 5370") . "<br />"; echo phone("0044 (0) 870 770 5370") . "<br />"; echo phone("+436764505509") . "<br />"; echo phone("(+38-048) 784-15-46 ") . "<br />"; echo phone("(38-057) 706-34-03 ") . "<br />"; echo phone("+38 (044) 244 12 01 ") . "<br />";