本文整理汇总了PHP中Format::phone方法的典型用法代码示例。如果您正苦于以下问题:PHP Format::phone方法的具体用法?PHP Format::phone怎么用?PHP Format::phone使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Format
的用法示例。
在下文中一共展示了Format::phone方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: toString
function toString($value)
{
$config = $this->getConfiguration();
list($phone, $ext) = explode("X", $value, 2);
switch ($config['format']) {
case 'us':
$phone = Format::phone($phone);
break;
}
if ($ext) {
$phone .= " x{$ext}";
}
return $phone;
}
示例2:
echo $row['dept_name'];
?>
</td>
<td><?php
echo $row['email'];
?>
</td>
<td><?php
echo Format::phone($row['phone']);
?>
<?php
echo $ext;
?>
</td>
<td><?php
echo Format::phone($row['mobile']);
?>
</td>
</tr>
<?
$class = ($class =='row2') ?'row1':'row2';
}
?>
</table>
<?
else:
echo "<b>Problems displaying directory</b>";
endif;
include_once(STAFFINC_DIR.'footer.inc.php');
?>
示例3:
<td><?php
echo Format::htmlchars($ticket->getName());
?>
</td>
</tr>
<tr>
<th width="100">Email:</th>
<td><?php
echo $ticket->getEmail();
?>
</td>
</tr>
<tr>
<th>Phone:</th>
<td><?php
echo Format::phone($ticket->getPhoneNumber());
?>
</td>
</tr>
</table>
</td>
</tr>
</table>
<div class="msg">Subject: <?php
echo Format::htmlchars($ticket->getSubject());
?>
</div>
<div>
<?php
if ($errors['err']) {
?>
示例4: save
function save($id, $vars, &$errors)
{
$vars['username'] = Format::striptags($vars['username']);
$vars['firstname'] = Format::striptags($vars['firstname']);
$vars['lastname'] = Format::striptags($vars['lastname']);
if ($id && $id != $vars['id']) {
$errors['err'] = __('Internal Error');
}
if (!$vars['firstname']) {
$errors['firstname'] = __('First name required');
}
if (!$vars['lastname']) {
$errors['lastname'] = __('Last name required');
}
$error = '';
if (!$vars['username'] || !Validator::is_username($vars['username'], $error)) {
$errors['username'] = $error ? $error : __('Username is required');
} elseif (($uid = Staff::getIdByUsername($vars['username'])) && $uid != $id) {
$errors['username'] = __('Username already in use');
}
if (!$vars['email'] || !Validator::is_valid_email($vars['email'])) {
$errors['email'] = __('Valid email is required');
} elseif (Email::getIdByEmail($vars['email'])) {
$errors['email'] = __('Already in use system email');
} elseif (($uid = Staff::getIdByEmail($vars['email'])) && $uid != $id) {
$errors['email'] = __('Email already in use by another agent');
}
if ($vars['phone'] && !Validator::is_phone($vars['phone'])) {
$errors['phone'] = __('Valid phone number is required');
}
if ($vars['mobile'] && !Validator::is_phone($vars['mobile'])) {
$errors['mobile'] = __('Valid phone number is required');
}
if ($vars['passwd1'] || $vars['passwd2'] || !$id) {
if ($vars['passwd1'] && strcmp($vars['passwd1'], $vars['passwd2'])) {
$errors['passwd2'] = __('Passwords do not match');
} elseif ($vars['backend'] != 'local' || $vars['welcome_email']) {
// Password can be omitted
} elseif (!$vars['passwd1'] && !$id) {
$errors['passwd1'] = __('Temporary password is required');
$errors['temppasswd'] = __('Required');
} elseif ($vars['passwd1'] && strlen($vars['passwd1']) < 6) {
$errors['passwd1'] = __('Password must be at least 6 characters');
}
}
if (!$vars['dept_id']) {
$errors['dept_id'] = __('Department is required');
}
if (!$vars['group_id']) {
$errors['group_id'] = __('Group is required');
}
if (!$vars['timezone_id']) {
$errors['timezone_id'] = __('Time zone selection is required');
}
// Ensure we will still have an administrator with access
if ($vars['isadmin'] !== '1' || $vars['isactive'] !== '1') {
$sql = 'select count(*), max(staff_id) from ' . STAFF_TABLE . ' WHERE isadmin=1 and isactive=1';
if (($res = db_query($sql)) && (list($count, $sid) = db_fetch_row($res))) {
if ($count == 1 && $sid == $id) {
$errors['isadmin'] = __('Cowardly refusing to remove or lock out the only active administrator');
}
}
}
if ($errors) {
return false;
}
$sql = 'SET updated=NOW() ' . ' ,isadmin=' . db_input($vars['isadmin']) . ' ,isactive=' . db_input($vars['isactive']) . ' ,isvisible=' . db_input(isset($vars['isvisible']) ? 1 : 0) . ' ,onvacation=' . db_input(isset($vars['onvacation']) ? 1 : 0) . ' ,assigned_only=' . db_input(isset($vars['assigned_only']) ? 1 : 0) . ' ,dept_id=' . db_input($vars['dept_id']) . ' ,group_id=' . db_input($vars['group_id']) . ' ,timezone_id=' . db_input($vars['timezone_id']) . ' ,daylight_saving=' . db_input(isset($vars['daylight_saving']) ? 1 : 0) . ' ,username=' . db_input($vars['username']) . ' ,firstname=' . db_input($vars['firstname']) . ' ,lastname=' . db_input($vars['lastname']) . ' ,email=' . db_input($vars['email']) . ' ,backend=' . db_input($vars['backend']) . ' ,phone="' . db_input(Format::phone($vars['phone']), false) . '"' . ' ,phone_ext=' . db_input($vars['phone_ext']) . ' ,mobile="' . db_input(Format::phone($vars['mobile']), false) . '"' . ' ,signature=' . db_input(Format::sanitize($vars['signature'])) . ' ,notes=' . db_input(Format::sanitize($vars['notes']));
if ($vars['passwd1']) {
$sql .= ' ,passwd=' . db_input(Passwd::hash($vars['passwd1']));
if (isset($vars['change_passwd'])) {
$sql .= ' ,change_passwd=1';
}
} elseif (!isset($vars['change_passwd'])) {
$sql .= ' ,change_passwd=0';
}
if ($id) {
$sql = 'UPDATE ' . STAFF_TABLE . ' ' . $sql . ' WHERE staff_id=' . db_input($id);
if (db_query($sql) && db_affected_rows()) {
return true;
}
$errors['err'] = sprintf(__('Unable to update %s.'), __('this agent')) . ' ' . __('Internal error occurred');
} else {
$sql = 'INSERT INTO ' . STAFF_TABLE . ' ' . $sql . ', created=NOW()';
if (db_query($sql) && ($uid = db_insert_id())) {
return $uid;
}
$errors['err'] = sprintf(__('Unable to create %s.'), __('this agent')) . ' ' . __('Internal error occurred');
}
return false;
}
示例5: getPhoneNumber
function getPhoneNumber()
{
$phone = Format::phone($this->getPhone());
if ($ext = $this->getPhoneExt()) {
$phone .= " {$ext}";
}
return $phone;
}
示例6: while
<?php
if ($res && ($num = db_num_rows($res))) {
$defaultDept = Dept::getDefaultDeptName();
//Default public dept.
while ($row = db_fetch_array($res)) {
$dept = $row['ispublic'] ? $row['dept_name'] : $defaultDept;
$subject = Format::htmlchars(Format::truncate($row['subject'], 40));
if ($row['attachments']) {
$subject .= ' <span class="Icon file"></span>';
}
$ticketID = $row['ticketID'];
if ($row['isanswered'] && !strcasecmp($row['status'], 'open')) {
$subject = "<b>{$subject}</b>";
$ticketID = "<b>{$ticketID}</b>";
}
$phone = Format::phone($row['phone']);
if ($row['phone_ext']) {
$phone .= ' ' . $row['phone_ext'];
}
?>
<tr id="<?php
echo $row['ticketID'];
?>
">
<td class="centered">
<a class="Icon <?php
echo strtolower($row['source']);
?>
Ticket" title="<?php
echo $row['email'];
?>
示例7: save
function save($id, $vars, &$errors)
{
$vars['username'] = Format::striptags($vars['username']);
$vars['firstname'] = Format::striptags($vars['firstname']);
$vars['lastname'] = Format::striptags($vars['lastname']);
if ($id && $id != $vars['id']) {
$errors['err'] = 'Internal Error';
}
if (!$vars['firstname']) {
$errors['firstname'] = 'First name required';
}
if (!$vars['lastname']) {
$errors['lastname'] = 'Last name required';
}
$error = '';
if (!$vars['username'] || !Validator::is_username($vars['username'], $error)) {
$errors['username'] = $error ? $error : 'Username required';
} elseif (($uid = Staff::getIdByUsername($vars['username'])) && $uid != $id) {
$errors['username'] = 'Username already in use';
}
if (!$vars['email'] || !Validator::is_email($vars['email'])) {
$errors['email'] = 'Valid email required';
} elseif (Email::getIdByEmail($vars['email'])) {
$errors['email'] = 'Already in-use system email';
} elseif (($uid = Staff::getIdByEmail($vars['email'])) && $uid != $id) {
$errors['email'] = 'Email already in use by another staff member';
}
if ($vars['phone'] && !Validator::is_phone($vars['phone'])) {
$errors['phone'] = 'Valid number required';
}
if ($vars['mobile'] && !Validator::is_phone($vars['mobile'])) {
$errors['mobile'] = 'Valid number required';
}
if ($vars['passwd1'] || $vars['passwd2'] || !$id) {
if ($vars['passwd1'] && strcmp($vars['passwd1'], $vars['passwd2'])) {
$errors['passwd2'] = 'Password(s) do not match';
} elseif ($vars['backend'] != 'local' || $vars['welcome_email']) {
// Password can be omitted
} elseif (!$vars['passwd1'] && !$id) {
$errors['passwd1'] = 'Temp. password required';
$errors['temppasswd'] = 'Required';
} elseif ($vars['passwd1'] && strlen($vars['passwd1']) < 6) {
$errors['passwd1'] = 'Must be at least 6 characters';
}
}
if (!$vars['dept_id']) {
$errors['dept_id'] = 'Department required';
}
if (!$vars['group_id']) {
$errors['group_id'] = 'Group required';
}
if (!$vars['timezone_id']) {
$errors['timezone_id'] = 'Time zone required';
}
if ($errors) {
return false;
}
$sql = 'SET updated=NOW() ' . ' ,isadmin=' . db_input($vars['isadmin']) . ' ,isactive=' . db_input($vars['isactive']) . ' ,isvisible=' . db_input(isset($vars['isvisible']) ? 1 : 0) . ' ,onvacation=' . db_input(isset($vars['onvacation']) ? 1 : 0) . ' ,assigned_only=' . db_input(isset($vars['assigned_only']) ? 1 : 0) . ' ,dept_id=' . db_input($vars['dept_id']) . ' ,group_id=' . db_input($vars['group_id']) . ' ,timezone_id=' . db_input($vars['timezone_id']) . ' ,daylight_saving=' . db_input(isset($vars['daylight_saving']) ? 1 : 0) . ' ,username=' . db_input($vars['username']) . ' ,firstname=' . db_input($vars['firstname']) . ' ,lastname=' . db_input($vars['lastname']) . ' ,email=' . db_input($vars['email']) . ' ,backend=' . db_input($vars['backend']) . ' ,phone="' . db_input(Format::phone($vars['phone']), false) . '"' . ' ,phone_ext=' . db_input($vars['phone_ext']) . ' ,mobile="' . db_input(Format::phone($vars['mobile']), false) . '"' . ' ,signature=' . db_input(Format::sanitize($vars['signature'])) . ' ,notes=' . db_input(Format::sanitize($vars['notes']));
if ($vars['passwd1']) {
$sql .= ' ,passwd=' . db_input(Passwd::hash($vars['passwd1']));
if (isset($vars['change_passwd'])) {
$sql .= ' ,change_passwd=1';
}
} elseif (!isset($vars['change_passwd'])) {
$sql .= ' ,change_passwd=0';
}
if ($id) {
$sql = 'UPDATE ' . STAFF_TABLE . ' ' . $sql . ' WHERE staff_id=' . db_input($id);
if (db_query($sql) && db_affected_rows()) {
return true;
}
$errors['err'] = 'Unable to update the user. Internal error occurred';
} else {
$sql = 'INSERT INTO ' . STAFF_TABLE . ' ' . $sql . ', created=NOW()';
if (db_query($sql) && ($uid = db_insert_id())) {
return $uid;
}
$errors['err'] = 'Unable to create user. Internal error';
}
return false;
}
示例8:
<td><?php
echo Format::htmlchars($ticket->getName());
?>
</td>
</tr>
<tr>
<th>Email:</th>
<td><?php
echo $ticket->getEmail();
?>
</td>
</tr>
<tr>
<th>Phone:</th>
<td><?php
echo Format::phone($ticket->getPhone());
?>
</td>
</tr>
<tr>
<th>Source:</th>
<td><?php
echo $ticket->getSource();
?>
<?php
echo $ticket->getIP();
?>
</td>
</tr>
</table>
</td>
示例9: __
<th width="80"><a <?php echo $ext_sort; ?> href="directory.php?<?php echo $qstr; ?>&sort=ext"><?php echo __(/* As in a phone number `extension` */ 'Extension');?></a></th>
<th width="120"><a <?php echo $mobile_sort; ?> href="directory.php?<?php echo $qstr; ?>&sort=mobile"><?php echo __('Mobile Number');?></a></th>
</tr>
</thead>
<tbody>
<?php
if($res && db_num_rows($res)):
$ids=($errors && is_array($_POST['ids']))?$_POST['ids']:null;
while ($row = db_fetch_array($res)) { ?>
<tr id="<?php echo $row['staff_id']; ?>">
<td> <?php echo Format::htmlchars($row['name']); ?></td>
<td> <?php echo Format::htmlchars($row['dept']); ?></td>
<td> <?php echo Format::htmlchars($row['email']); ?></td>
<td> <?php echo Format::phone($row['phone']); ?></td>
<td> <?php echo $row['phone_ext']; ?></td>
<td> <?php echo Format::phone($row['mobile']); ?></td>
</tr>
<?php
} //end of while.
endif; ?>
<tfoot>
<tr>
<td colspan="6">
<?php if($res && $num) {
echo '<div> '.__('Page').':'.$pageNav->getPageLinks().' </div>';
?>
<?php } else {
echo __('No agents found!');
} ?>
</td>
</tr>
示例10: sprintf
<td><?=Format::htmlchars($ticket->getName())?></td>
</tr>
<tr>
<th>Email:</th>
<td><?php
echo $ticket->getEmail();
if(($related=$ticket->getRelatedTicketsCount())) {
echo sprintf(' <a href="tickets.php?a=search&query=%s" title="Related Tickets">(<b>%d</b>)</a>',
urlencode($ticket->getEmail()),$related);
}
?>
</td>
</tr>
<tr>
<th>Phone:</th>
<td><?=Format::phone($ticket->getPhoneNumber())?></td>
</tr>
<tr>
<th>Source:</th>
<td><?=$ticket->getSource()?></td>
</tr>
</table>
</td>
</tr>
<tr><td colspan=2 class="msg">Subject: <?=Format::htmlchars($ticket->getSubject())?></td></tr>
<tr>
<td valign="top" width=50%>
<table align="center" class="ticketinfo" cellspacing="1" cellpadding="3" width="100%" border=0>
<tr>
<th>Assigned Staff:</th>
示例11: getPhoneNumber
function getPhoneNumber(){
$phone=Format::phone($this->getPhone());
if(($ext=$this->getPhoneExt()))
$phone.=" $ext";
return $phone;
}
示例12: getPhoneNumber
function getPhoneNumber()
{
$phone = Format::phone($this->getPhone());
return $phone;
}