当前位置: 首页>>代码示例>>PHP>>正文


PHP qa_html_theme_base::ranking方法代码示例

本文整理汇总了PHP中qa_html_theme_base::ranking方法的典型用法代码示例。如果您正苦于以下问题:PHP qa_html_theme_base::ranking方法的具体用法?PHP qa_html_theme_base::ranking怎么用?PHP qa_html_theme_base::ranking使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在qa_html_theme_base的用法示例。


在下文中一共展示了qa_html_theme_base::ranking方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: ranking

 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);
 }
开发者ID:Kailashaghera,项目名称:Q2A-Ultimate-SEO,代码行数:45,代码来源:layer.php

示例2: 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);
 }
开发者ID:architbakliwal,项目名称:Q2A,代码行数:12,代码来源:qa-badge-layer.php

示例3: 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);
        }
    }
开发者ID:microbye,项目名称:Donut,代码行数:98,代码来源:qa-donut-layer.php


注:本文中的qa_html_theme_base::ranking方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。