本文整理汇总了PHP中KunenaDate::format方法的典型用法代码示例。如果您正苦于以下问题:PHP KunenaDate::format方法的具体用法?PHP KunenaDate::format怎么用?PHP KunenaDate::format使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KunenaDate
的用法示例。
在下文中一共展示了KunenaDate::format方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: profileIcon
/**
* @param string $name
*
* @return string
*/
public function profileIcon($name)
{
switch ($name) {
case 'gender':
switch ($this->gender) {
case 1:
$gender = 'male';
break;
case 2:
$gender = 'female';
break;
default:
$gender = 'unknown';
}
$title = JText::_('COM_KUNENA_MYPROFILE_GENDER') . ': ' . JText::_('COM_KUNENA_MYPROFILE_GENDER_' . $gender);
return '<span class="kicon-profile kicon-profile-gender-' . $gender . '" title="' . $title . '"></span>';
break;
case 'birthdate':
if ($this->birthdate) {
$date = new KunenaDate($this->birthdate);
if ($date->format('%Y') < 1902) {
break;
}
return '<span class="kicon-profile kicon-profile-birthdate" title="' . JText::_('COM_KUNENA_MYPROFILE_BIRTHDATE') . ': ' . $this->birthdate->toKunena('date', 'GMT') . '"></span>';
}
break;
case 'location':
if ($this->location) {
return '<span class="kicon-profile kicon-profile-location" title="' . JText::_('COM_KUNENA_MYPROFILE_LOCATION') . ': ' . $this->escape($this->location) . '"></span>';
}
break;
case 'website':
$url = $this->websiteurl;
if (!preg_match("~^(?:f|ht)tps?://~i", $this->websiteurl)) {
$url = 'http://' . $this->websiteurl;
}
if (!$this->websitename) {
$websitename = $this->websiteurl;
} else {
$websitename = $this->websitename;
}
if ($this->websiteurl) {
return '<a href="' . $this->escape($url) . '" target="_blank"><span class="kicon-profile kicon-profile-website" title="' . JText::_('COM_KUNENA_MYPROFILE_WEBSITE') . ': ' . $this->escape($websitename) . '"></span></a>';
}
break;
case 'private':
$pms = KunenaFactory::getPrivateMessaging();
return $pms->showIcon($this->userid);
break;
case 'email':
// TODO: show email
return;
// '<span class="email" title="'. JText::_('COM_KUNENA_MYPROFILE_EMAIL').'"></span>';
break;
case 'profile':
if (!$this->userid) {
return;
}
return $this->getLink('<span class="profile" title="' . JText::_('COM_KUNENA_VIEW_PROFILE') . '"></span>');
break;
}
}