当前位置: 首页>>代码示例>>PHP>>正文


PHP Phone::format方法代码示例

本文整理汇总了PHP中Phone::format方法的典型用法代码示例。如果您正苦于以下问题:PHP Phone::format方法的具体用法?PHP Phone::format怎么用?PHP Phone::format使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Phone的用法示例。


在下文中一共展示了Phone::format方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: formArrayWalk

 private static function formArrayWalk(array $data, $function, &$success = true, $requiresEmptyPhone = false, $maxPublicity = null)
 {
     $phones = array();
     if (!is_null($data)) {
         foreach ($data as $item) {
             $phone = new Phone($item);
             $success = !$phone->error && ($phone->format() || $phone->isEmpty()) && $success;
             if (!$phone->isEmpty()) {
                 // Restrict phone visibility to $maxPublicity
                 if (!is_null($maxPublicity) && Visibility::isLessRestrictive($maxPublicity, $phone->pub)) {
                     $phone->pub = $maxPublicity;
                 }
                 $phones[] = call_user_func(array($phone, $function));
             }
         }
     }
     if (count($phones) == 0 && $requiresEmptyPhone) {
         $phone = new Phone();
         if (!is_null($maxPublicity) && Visibility::isLessRestrictive($maxPublicity, $phone->pub)) {
             // Restrict phone visibility to $maxPublicity
             $phone->pub = $maxPublicity;
         }
         $phones[] = call_user_func(array($phone, $function));
     }
     return $phones;
 }
开发者ID:Ekleog,项目名称:platal,代码行数:26,代码来源:phone.php

示例2: array

#!/usr/bin/php5
<?php 
require_once 'connect.db.inc.php';
$globals->debug = 0;
//do not store backtraces
$phones = array('AF' => '93', 'AN' => '599', 'BY' => '375', 'FM' => '691', 'GE' => '995', 'GL' => '299', 'ID' => '62', 'IL' => '972', 'IN' => '91', 'IQ' => '964', 'IR' => '98', 'JO' => '962', 'JP' => '81', 'KG' => '996', 'KW' => '965', 'KZ' => '7', 'LA' => '856', 'LB' => '961', 'LK' => '94', 'MM' => '95', 'MN' => '976', 'MV' => '960', 'MY' => '60', 'NP' => '977', 'OM' => '968', 'PH' => '63', 'PK' => '92', 'QA' => '974', 'SA' => '966', 'SG' => '65', 'SY' => '963', 'TH' => '66', 'TJ' => '992', 'TM' => '993', 'TR' => '90', 'TW' => '886', 'UZ' => '998', 'VG' => '1284', 'VN' => '84', 'YE' => '967');
foreach ($phones as $country => $phone) {
    XDB::execute('UPDATE  geoloc_countries
                     SET  phonePrefix = {?}
                   WHERE  iso_3166_1_a2 = {?}', $phone, $country);
}
$res = XDB::iterator('SELECT  pid, link_type, link_id, tel_id AS id, search_tel AS search, search_tel AS display
                        FROM  profile_phones
                       WHERE  search_tel LIKE \'33%\'');
while ($item = $res->next()) {
    $phone = new Phone($item);
    $phone->format();
    XDB::execute('UPDATE  profile_phones
                     SET  display_tel = {?}
                   WHERE  pid = {?} AND link_type = {?}
                          AND link_id = {?} AND tel_id = {?}', $phone->display, $phone->pid(), $phone->linkType(), $phone->linkId(), $phone->id());
}
/* vim:set et sw=4 sts=4 ts=4: */
开发者ID:Ekleog,项目名称:platal,代码行数:23,代码来源:phone.php

示例3: while

 }
 //allows additionnal spaces and numbers
 $regexp .= '[0-9 ]*';
 //closes parenthesis
 for ($i = 0; $i < $nbPar; $i++) {
     $regexp .= ')?';
 }
 $regexp .= '$';
 $res = XDB::iterator("SELECT pid, link_type, link_id, tel_id, tel_type, search_tel,\n                                     display_tel, pub, comment\n                                FROM profile_phones\n                               WHERE search_tel LIKE {?} AND display_tel NOT REGEXP {?}", $prefix . '%', $regexp);
 if ($res->numRows() > 0) {
     //To speed up the update of phone numbers, theses updates are grouped by block of 1000
     $values = '';
     $i = 0;
     while ($phone = $res->next()) {
         $phone = new Phone(array('display' => $phone['display_tel']));
         $phone->format(array('format' => $format, 'phoneprf' => $prefix));
         if ($values != '') {
             $values .= ",\n";
         }
         $values .= "('" . addslashes($phone['pid']) . "', '" . addslashes($phone['link_type']) . "', '" . addslashes($phone['link_id']) . "', '" . addslashes($phone['tel_id']) . "', '" . addslashes($phone['tel_type']) . "', '" . addslashes($phone['search_tel']) . "', '" . addslashes($phone->display) . "', '" . addslashes($phone['pub']) . "', '" . addslashes($phone['comment']) . "')";
         $i++;
         if ($i == 1000) {
             do_update_by_block($values);
             $values = '';
             $i = 0;
         }
     }
     if ($values != '') {
         do_update_by_block($values);
     }
 }
开发者ID:Ekleog,项目名称:platal,代码行数:31,代码来源:phones.check.php

示例4: __construct

 public function __construct($number, $num_type = self::NUM_ANY, $phone_type = self::PHONE_ANY)
 {
     $phone = new Phone(array('display' => $number));
     $phone->format();
     $this->number = $phone->search;
     $this->num_type = $num_type;
     $this->phone_type = $phone_type;
 }
开发者ID:Ekleog,项目名称:platal,代码行数:8,代码来源:conditions.inc.php


注:本文中的Phone::format方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。