本文整理汇总了PHP中qa_html_theme_base::vote_count方法的典型用法代码示例。如果您正苦于以下问题:PHP qa_html_theme_base::vote_count方法的具体用法?PHP qa_html_theme_base::vote_count怎么用?PHP qa_html_theme_base::vote_count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qa_html_theme_base
的用法示例。
在下文中一共展示了qa_html_theme_base::vote_count方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: vote_count
public function vote_count($post)
{
$votersflaggers = $this->get_post_voters_flaggers($post['raw'], @$post['vote_opostid'] ? $post['raw']['opostid'] : $post['raw']['postid']);
$tooltip = '';
if (isset($votersflaggers)) {
$uphandles = '';
$downhandles = '';
foreach ($votersflaggers as $voterflagger) {
if ($voterflagger['vote'] > 0) {
$uphandles .= (strlen($uphandles) ? ', ' : '') . qa_html($voterflagger['handle']);
}
if ($voterflagger['vote'] < 0) {
$downhandles .= (strlen($downhandles) ? ', ' : '') . qa_html($voterflagger['handle']);
}
$tooltip = trim((strlen($uphandles) ? '↑ ' . $uphandles : '') . "\n\n" . (strlen($downhandles) ? '↓ ' . $downhandles : ''));
}
}
$post['vote_count_tags'] = @$post['vote_count_tags'] . ' title="' . $tooltip . '"';
qa_html_theme_base::vote_count($post);
}
示例2: vote_count
public function vote_count($post)
{
$postid = isset($post['vote_opostid']) && $post['vote_opostid'] ? $post['raw']['opostid'] : $post['raw']['postid'];
$votersflaggers = $this->get_post_voters_flaggers($post['raw'], $postid);
if (isset($votersflaggers)) {
$uphandles = array();
$downhandles = array();
foreach ($votersflaggers as $voterflagger) {
if ($voterflagger['vote'] != 0) {
$newflagger = qa_html($voterflagger['handle']);
if ($voterflagger['vote'] > 0) {
$uphandles[] = $newflagger;
} else {
// if ($voterflagger['vote'] < 0)
$downhandles[] = $newflagger;
}
}
}
$tooltip = trim((empty($uphandles) ? '' : '↑ ' . implode(', ', $uphandles)) . "\n\n" . (empty($downhandles) ? '' : '↓ ' . implode(', ', $downhandles)));
$post['vote_count_tags'] = sprintf('%s title="%s"', isset($post['vote_count_tags']) ? $post['vote_count_tags'] : '', $tooltip);
}
parent::vote_count($post);
}