function ranking($ranking) { if ($this->template == 'tags') { global $useo_tag_desc_list; // Already filled in qa-tag-desc-overrides.php - All tags used in this page are listed in this array if (count(@$useo_tag_desc_list)) { // Get all tag meta in this query $result = qa_db_query_sub('SELECT tag, title, content FROM ^tagmetas WHERE tag IN ($)', array_keys($useo_tag_desc_list)); $useo_tag_desc_map = qa_db_read_all_assoc($result); $useo_tag_desc_list = null; $plugin_tag_map = array(); foreach ($useo_tag_desc_map as &$value) { if ($value['title'] == 'title') { $plugin_tag_map[$value['tag']]['title'] = $value['content']; } if ($value['title'] == 'description') { $plugin_tag_map[$value['tag']]['description'] = $value['content']; } if ($value['title'] == 'icon') { $plugin_tag_map[$value['tag']]['icon'] = $value['content']; } } // add title and icon to each tag $html = new DOMDocument(); foreach ($ranking['items'] as &$item) { $html->loadHTML(mb_convert_encoding($item['label'], 'HTML-ENTITIES', 'UTF-8')); foreach ($html->getElementsByTagName('a') as $a) { if (!empty($plugin_tag_map[$a->nodeValue]['title'])) { $a->setAttribute('title', $plugin_tag_map[$a->nodeValue]['title']); } if (!empty($plugin_tag_map[$a->nodeValue]['icon'])) { $element = $html->createElement('img'); $element->setAttribute('src', $plugin_tag_map[$a->nodeValue]['icon']); $element->setAttribute('class', 'qa-tag-img'); $element->setAttribute('width', qa_opt('useo_tag_desc_icon_width')); $element->setAttribute('height', qa_opt('useo_tag_desc_icon_height')); $a->insertBefore($element, $a->firstChild); } } $item['label'] = $html->saveHTML(); } } } qa_html_theme_base::ranking($ranking); }
function ranking($ranking) { if (@$ranking['type'] == 'users' && qa_opt('badge_show_users_badges')) { foreach ($ranking['items'] as $idx => $item) { $handle = preg_replace('/ *<[^>]+> */', '', $item['label']); if (isset($ranking['items'][$idx]['score'])) { $ranking['items'][$idx]['score'] .= '</td><td class="qa-top-users-score">' . qa_badge_plugin_user_widget($handle); } } } qa_html_theme_base::ranking($ranking); }
function ranking($ranking) { $class = @$ranking['type'] == 'users' ? 'qa-top-users' : 'qa-top-tags'; $item_count = min($ranking['rows'], count($ranking['items'])); if (@$ranking['type'] == 'users') { if (count($ranking['items'])) { $this->output('<div class="page-users-list clearfix"><div class="row">'); $columns = qa_opt('columns_users'); $pagesize = qa_opt('page_size_users'); $start = qa_get_start(); $users = qa_db_select_with_pending(qa_db_top_users_selectspec($start, qa_opt_if_loaded('page_size_users'))); $users = array_slice($users, 0, $pagesize); $usershtml = qa_userids_handles_html($users); foreach ($ranking['items'] as $user) { $this->output('<div class="user-box col-sm-' . ceil(12 / $columns) . ' col-xs-12">'); $user_raw = !empty($user['raw']) ? $user['raw'] : $user; $handle = @$user_raw['handle']; $handle_html = @$usershtml[$user_raw['userid']]; if (defined('QA_WORDPRESS_INTEGRATE_PATH')) { $level_html = $user['score']; unset($user['score']); } else { if (is_numeric($user['score'])) { $user_level = donut_get_user_level($user_raw['userid']); $level_html = qa_user_level_string($user_level); } else { $level_html = $user['score']; unset($user['score']); } } if (empty($handle_html)) { $handle_html = $user['label']; } $avatar = QA_FINAL_EXTERNAL_USERS ? qa_get_external_avatar_html(@$user_raw['userid'], qa_opt('avatar_users_size'), true) : qa_get_user_avatar_html(@$user_raw['flags'], @$user_raw['email'], @$user_raw['handle'], @$user_raw['avatarblobid'], @$user_raw['avatarwidth'], @$user_raw['avatarheight'], 70, true); if (isset($user['score'])) { $userpoints = $user['score']; $pointshtml = $userpoints === 1 ? qa_lang_html_sub('main/1_point', '1', '1') : qa_lang_html_sub('main/x_points', qa_html($userpoints)); if (!empty($pointshtml)) { $pointshtml = '<p class="score">' . $pointshtml . '</p>'; } } $this->output(' <div class="user-box-inner"> <div class="user-avatar"> ' . $avatar . ' </div> <div class="user-data"> ' . $handle_html . ' <div class="user-level"> ' . $level_html . ' </div> <div class="counts clearfix"> ' . @$pointshtml . ' </div> </div>'); if (qa_opt('badge_active') && function_exists('qa_get_badge_list')) { $this->output('<div class="badge-list">' . donut_user_badge($handle) . '</div>'); } $this->output('</div>'); $this->output('</div>'); } $this->output('</div>'); $this->output('</div>'); } else { $title = isset($this->content['ranking_users']['title']) ? $this->content['ranking_users']['title'] : @$this->content['title']; $this->output(' <div class="no-items"> <div class="alert alert-info"><span class="fa fa-warning"></span> ' . $title . '</div> </div>'); } } elseif (@$ranking['type'] == 'tags') { if (count($ranking['items'])) { $this->output('<div id="tags-list" class="row ' . $class . '">'); $columns = qa_opt('columns_tags'); for ($column = 0; $column < $columns; $column++) { $this->set_context('ranking_column', $column); $this->output('<div class="col-md-' . ceil(12 / $columns) . ' col-xs-12" >'); $this->output('<ul class="donut-tags-list">'); for ($row = 0; $row < $item_count; $row++) { $this->set_context('ranking_row', $row); $this->donut_tags_item(@$ranking['items'][$column * $item_count + $row], $class, $column > 0); } $this->clear_context('ranking_column'); $this->output('</ul>'); $this->output('</div>'); } $this->clear_context('ranking_row'); $this->output('</div>'); } else { $this->output(' <div class="no-items"> <div class="alert alert-info"><span class="fa fa-warning"></span> ' . $this->content['ranking_tags']['title'] . '</div> </div>'); } } else { parent::ranking($ranking); } }