本文整理汇总了PHP中Card::getTel方法的典型用法代码示例。如果您正苦于以下问题:PHP Card::getTel方法的具体用法?PHP Card::getTel怎么用?PHP Card::getTel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Card
的用法示例。
在下文中一共展示了Card::getTel方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: format
/**
* Formats a card.
*
* @param \Libreworks\Microformats\Card $card The card to format
* @return string The HTML markup
*/
public function format(Card $card)
{
$tags = [];
$name = $card->getName();
$fullName = $card->getFullName();
if ($name !== null) {
$tags[] = '<dt>Name</dt><dd><span class="p-name">' . $this->nameFormatter->format($name) . '</span></dd>';
} elseif (strlen($fullName) > 0) {
$tags[] = '<dt>Name</dt><dd><span class="p-name">' . htmlspecialchars($fullName) . '</span></dd>';
}
$photo = $card->getPhoto();
if ($photo !== null) {
$tags[] = '<dt>Photo</dt><dd><img class="u-photo" src="' . htmlspecialchars($photo) . '" alt="Photo" /></dd></span>';
}
$logo = $card->getLogo();
if ($logo !== null) {
$tags[] = '<dt>Logo</dt><dd><img class="u-logo" src="' . htmlspecialchars($logo) . '" alt="Logo" /></dd></span>';
}
$address = $card->getAddress();
if ($address !== null) {
$tags[] = '<dt>Address</dt><dd class="p-adr">' . $this->addressFormatter->format($address) . '</dd>';
}
$tel = $card->getTel();
if (strlen($tel) > 0) {
$tags[] = '<dt>Phone</dt><dd><a href="tel:' . preg_replace('/[^0-9\\+]/', '', $tel) . '" class="p-tel">' . htmlspecialchars($tel) . '</a></dd>';
}
$email = $card->getEmail();
if (strlen($email) > 0) {
$tags[] = '<dt>Email</dt><dd><a href="mailto:' . htmlspecialchars($email) . '" class="u-email">' . htmlspecialchars($email) . '</a></dd>';
}
$url = $card->getUrl();
if (strlen($url) > 0) {
$tags[] = '<dt>Homepage</dt><dd><a href="' . htmlspecialchars($url) . '" class="u-url>' . htmlspecialchars($url) . '</a></dd>';
}
$impp = $card->getImpp();
if (strlen($impp) > 0) {
$tags[] = '<dt>IMPP</dt><dd><a href="' . htmlspecialchars($impp) . '" class="u-impp">' . htmlspecialchars($impp) . '</a></dd>';
}
$org = $card->getOrg();
$orgName = $card->getOrgName();
if ($org !== null) {
$tags[] = '<dt>Organization</dt><dd class="p-org">' . $this->format($org) . '</dd>';
} elseif (strlen($orgName) > 0) {
$tags[] = '<dt>Organization</dt><dd><span class="p-org p-organization-name">' . htmlspecialchars($orgName) . '</span></dd>';
}
$title = $card->getTitle();
if (strlen($title) > 0) {
$tags[] = '<dt>Title</dt><dd><span class="p-job-title">' . htmlspecialchars($title) . '</span></dd>';
}
$role = $card->getRole();
if (strlen($role) > 0) {
$tags[] = '<dt>Role</dt><dd><span class="p-role">' . htmlspecialchars($role) . '</span></dd>';
}
$sex = $card->getSex();
if (strlen($sex) > 0) {
$tags[] = '<dt>Sex</dt><dd><span class="p-sex">' . htmlspecialchars($role) . '</span></dd>';
}
$gender = $card->getGender();
if (strlen($gender) > 0) {
$tags[] = '<dt>Gender</dt><dd><span class="p-gender">' . htmlspecialchars($gender) . '</span></dd>';
}
$birthday = $card->getBirthday();
if ($birthday !== null) {
$tags[] = '<dt>Birthday</dt><dd><time class="dt-bday" datetime="' . $birthday->format('Y-m-d') . '">' . $birthday->format('F j, Y') . '</time></dd>';
}
$anniversary = $card->getAnniversary();
if ($anniversary !== null) {
$tags[] = '<dt>Anniversary</dt><dd><time class="dt-anniversary" datetime="' . $anniversary->format('Y-m-d') . '">' . $anniversary->format('F j, Y') . '</time></dd>';
}
$key = $card->getKey();
if (strlen($key) > 0) {
$tags[] = '<dt>Public Key</dt><dd><span class="u-key">' . htmlspecialchars($key) . '</span></dd>';
}
$category = $card->getCategory();
if (strlen($category) > 0) {
$tags[] = '<dt>Category</dt><dd><span class="p-category">' . htmlspecialchars($category) . '</span></dd>';
}
$note = $card->getNote();
if (strlen($note) > 0) {
$tags[] = '<dt>Note</dt><dd><div class="p-note">' . htmlspecialchars($note) . '</div></dd>';
}
return '<dl class="h-card">' . implode(' ', $tags) . '</dl>';
}