本文整理汇总了PHP中KunenaUserHelper::getTopPosters方法的典型用法代码示例。如果您正苦于以下问题:PHP KunenaUserHelper::getTopPosters方法的具体用法?PHP KunenaUserHelper::getTopPosters怎么用?PHP KunenaUserHelper::getTopPosters使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KunenaUserHelper
的用法示例。
在下文中一共展示了KunenaUserHelper::getTopPosters方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadTopPosters
/**
* @param int $limit
*
* @return array
*/
public function loadTopPosters($limit = 0)
{
$limit = $limit ? $limit : $this->_config->popusercount;
if (count($this->topPosters) < $limit) {
$this->topPosters = KunenaUserHelper::getTopPosters($limit);
$top = reset($this->topPosters);
if (!$top) {
return array();
}
$top->title = JText::_('COM_KUNENA_LIB_STAT_TOP_POSTERS');
$top->titleName = JText::_('COM_KUNENA_USERNAME');
$top->titleCount = JText::_('COM_KUNENA_USRL_POSTS');
foreach ($this->topPosters as &$item) {
$item = clone $item;
$item->link = KunenaUserHelper::get($item->id)->getLink();
$item->percent = round(100 * $item->count / $top->count);
}
}
return array_slice($this->topPosters, 0, $limit);
}
示例2: loadTopPosters
public function loadTopPosters($limit=0) {
$limit = $limit ? $limit : $this->_config->popusercount;
if (count($this->topPosters) < $limit) {
$this->topPosters = KunenaUserHelper::getTopPosters($limit);
$top = reset($this->topPosters);
if (empty($top->count)) {
$this->topPosters = array();
return;
}
foreach ($this->topPosters as $item) {
$item->link = CKunenaLink::GetProfileLink($item->id);
$item->percent = round(100 * $item->count / $top->count);
}
$top->title = JText::_('COM_KUNENA_STAT_TOP') .' '. $limit .' '. JText::_('COM_KUNENA_STAT_POPULAR') .' '. JText::_('COM_KUNENA_STAT_POPULAR_USER_TMSG');
$top->titleName = JText::_('COM_KUNENA_USRL_USERNAME');
$top->titleCount = JText::_('COM_KUNENA_USRL_POSTS');
}
return array_slice($this->topPosters, 0, $limit);
}