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


PHP qa_using_tags函数代码示例

本文整理汇总了PHP中qa_using_tags函数的典型用法代码示例。如果您正苦于以下问题:PHP qa_using_tags函数的具体用法?PHP qa_using_tags怎么用?PHP qa_using_tags使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: process_request

 function process_request($request)
 {
     //	Get list of unanswered open questions
     $userid = qa_get_logged_in_userid();
     $start = qa_get_start();
     $questions_selectspec = $this->qa_db_open_qs_selectspec($userid, $start);
     $questions = qa_db_select_with_pending($questions_selectspec);
     //	Prepare and return the content for the theme
     $questions_found_title = qa_lang_html('open_questions/questions_found_title');
     $no_questions_title = qa_lang_html('open_questions/no_questions_title');
     $count = qa_opt('cache_unaqcount');
     $qa_content = qa_q_list_page_content($questions, qa_opt('page_size_una_qs'), $start, @$count, $questions_found_title, $no_questions_title, null, null, false, null, null, qa_html_suggest_qs_tags(qa_using_tags()), null, null);
     return $qa_content;
 }
开发者ID:nakov,项目名称:q2a-plugin-open-questions,代码行数:14,代码来源:qa-open-questions.php

示例2: process_request

 public function process_request($request)
 {
     $requestparts = explode('/', qa_request());
     $slugs = array_slice($requestparts, 1);
     $countslugs = count($slugs);
     $userid = qa_get_logged_in_userid();
     $start = qa_get_start();
     $count = qa_opt_if_loaded('page_size_activity');
     $totalcount = qa_opt('cache_qcount');
     $qspec = qa_db_posts_basic_selectspec($userid, false);
     qa_db_add_selectspec_opost($qspec, 'ra', false, false);
     qa_db_add_selectspec_ousers($qspec, 'rau', 'raup');
     $qspec['source'] .= " JOIN (SELECT questionid, childid FROM ^homepage ORDER BY ^homepage.updated DESC) AS rcaq ON ^posts.postid=rcaq.questionid" . " LEFT JOIN ^posts AS ra ON childid=ra.postid" . (QA_FINAL_EXTERNAL_USERS ? "" : " LEFT JOIN ^users AS rau ON ra.userid=rau.userid") . " LEFT JOIN ^userpoints AS raup ON ra.userid=raup.userid LIMIT #,#";
     array_push($qspec['columns'], 'childid');
     array_push($qspec['arguments'], $start, $count);
     $qspec['sortdesc'] = 'otime';
     $query = 'SELECT ';
     foreach ($qspec['columns'] as $columnas => $columnfrom) {
         $query .= $columnfrom . (is_int($columnas) ? '' : ' AS ' . $columnas) . ', ';
     }
     $query = qa_db_apply_sub(substr($query, 0, -2) . (strlen(@$qspec['source']) ? ' FROM ' . $qspec['source'] : ''), @$qspec['arguments']);
     $results = qa_db_read_all_assoc(qa_db_query_raw($query));
     qa_db_post_select($results, $qspec);
     list($categories, $categoryid) = qa_db_select_with_pending(qa_db_category_nav_selectspec($slugs, false, false, true), $countslugs ? qa_db_slugs_to_category_id_selectspec($slugs) : null);
     $questions = qa_any_sort_and_dedupe($results);
     // $questions=qa_any_sort_and_dedupe(array_merge($recentquestions,$recentanswers));
     $pagesize = qa_opt('page_size_home');
     if ($countslugs) {
         if (!isset($categoryid)) {
             return include QA_INCLUDE_DIR . 'qa-page-not-found.php';
         }
         $categorytitlehtml = qa_html($categories[$categoryid]['title']);
         $sometitle = qa_lang_html_sub('main/recent_qs_as_in_x', $categorytitlehtml);
         $nonetitle = qa_lang_html_sub('main/no_questions_in_x', $categorytitlehtml);
     } else {
         $sometitle = qa_lang_html('main/recent_qs_as_title');
         $nonetitle = qa_lang_html('main/no_questions_found');
     }
     require_once QA_INCLUDE_DIR . 'qa-app-q-list.php';
     $qa_content = qa_q_list_page_content($questions, $pagesize, $start, $totalcount, $sometitle, $nonetitle, $categories, $categoryid, true, qa_opt('eql_homepage_url'), qa_opt('feed_for_qa') ? qa_opt('eql_homepage_url') : null, count($questions) < $pagesize ? qa_html_suggest_ask($categoryid) : qa_html_suggest_qs_tags(qa_using_tags(), qa_category_path_request($categories, $categoryid)), null, null);
     return $qa_content;
 }
开发者ID:BrunoVandekerkhove,项目名称:q2a-expandable-question-lists,代码行数:42,代码来源:qa-eql-homepage.php

示例3: qa_lang_html_sub

        break;
    case 'upvotes':
        if ($countslugs) {
            $sometitle = qa_lang_html_sub('main/unupvoteda_qs_in_x', $categorytitlehtml);
            $nonetitle = qa_lang_html_sub('main/no_una_questions_in_x', $categorytitlehtml);
        } else {
            $sometitle = qa_lang_html('main/unupvoteda_qs_title');
            $nonetitle = qa_lang_html('main/no_unupvoteda_qs_found');
            $count = qa_opt('cache_unupaqcount');
        }
        break;
    default:
        $feedpathprefix = qa_opt('feed_for_unanswered') ? 'unanswered' : null;
        $linkparams = array();
        if ($countslugs) {
            $sometitle = qa_lang_html_sub('main/unanswered_qs_in_x', $categorytitlehtml);
            $nonetitle = qa_lang_html_sub('main/no_una_questions_in_x', $categorytitlehtml);
        } else {
            $sometitle = qa_lang_html('main/unanswered_qs_title');
            $nonetitle = qa_lang_html('main/no_una_questions_found');
            $count = qa_opt('cache_unaqcount');
        }
        break;
}
//	Prepare and return content for theme
$qa_content = qa_q_list_page_content($questions, qa_opt('page_size_una_qs'), $start, @$count, $sometitle, $nonetitle, QA_ALLOW_UNINDEXED_QUERIES ? $categories : null, QA_ALLOW_UNINDEXED_QUERIES ? $categoryid : null, false, 'unanswered/', $feedpathprefix, qa_html_suggest_qs_tags(qa_using_tags()), $linkparams, $linkparams);
$qa_content['navigation']['sub'] = qa_unanswered_sub_navigation($by, $categoryslugs);
return $qa_content;
/*
	Omit PHP closing tag to help avoid accidental output
*/
开发者ID:mostafiz93,项目名称:PrintfScanf,代码行数:31,代码来源:qa-page-unanswered.php

示例4: array

$linkparams = array('sort' => $sort);
switch ($sort) {
    case 'hot':
        $sometitle = $countslugs ? qa_lang_html_sub('main/hot_qs_in_x', $categorytitlehtml) : qa_lang_html('main/hot_qs_title');
        $feedpathprefix = qa_opt('feed_for_hot') ? 'hot' : null;
        break;
    case 'votes':
        $sometitle = $countslugs ? qa_lang_html_sub('main/voted_qs_in_x', $categorytitlehtml) : qa_lang_html('main/voted_qs_title');
        break;
    case 'answers':
        $sometitle = $countslugs ? qa_lang_html_sub('main/answered_qs_in_x', $categorytitlehtml) : qa_lang_html('main/answered_qs_title');
        break;
    case 'views':
        $sometitle = $countslugs ? qa_lang_html_sub('main/viewed_qs_in_x', $categorytitlehtml) : qa_lang_html('main/viewed_qs_title');
        break;
    default:
        $linkparams = array();
        $sometitle = $countslugs ? qa_lang_html_sub('main/recent_qs_in_x', $categorytitlehtml) : qa_lang_html('main/recent_qs_title');
        $categorypathprefix = 'questions/';
        $feedpathprefix = qa_opt('feed_for_questions') ? 'questions' : null;
        break;
}
//	Prepare and return content for theme
$qa_content = qa_q_list_page_content($questions, qa_opt('page_size_qs'), $start, $countslugs ? $categories[$categoryid]['qcount'] : qa_opt('cache_qcount'), $sometitle, $nonetitle, $categories, $categoryid, true, $categorypathprefix, $feedpathprefix, $countslugs ? qa_html_suggest_qs_tags(qa_using_tags()) : qa_html_suggest_ask($categoryid), $linkparams, $linkparams);
if (QA_ALLOW_UNINDEXED_QUERIES || !$countslugs) {
    $qa_content['navigation']['sub'] = qa_qs_sub_navigation($sort, $categoryslugs);
}
return $qa_content;
/*
	Omit PHP closing tag to help avoid accidental output
*/
开发者ID:kosmoluna,项目名称:question2answer,代码行数:31,代码来源:questions.php

示例5: process_request

    function process_request($request)
    {
        //@ini_set('display_errors', 0); // we don't want to show PHP errors inside XML
        if ($request == 'sitemap.xml') {
            $req = '';
        } else {
            $req_str = substr($request, 8, strlen($request) - 12);
            // extract "X-Y-Z" from "sitemap-X-Y-Z.xml"
            $req = explode('-', $req_str);
        }
        $siteurl = qa_opt('site_url');
        header('Content-type: text/xml; charset=utf-8');
        // Index Pages
        // Indexed all XML sitemaps for question's lists
        // example: sitemap.xml
        if ($req == '') {
            $this->sitemap_index_header();
            $q_sitemaps = qa_db_read_one_assoc(qa_db_query_sub("SELECT count(*) as total from ^posts WHERE type='Q'"));
            $count = qa_opt('useo_sitemap_question_count');
            $q_sitemap_count = ceil($q_sitemaps['total'] / $count);
            for ($i = 0; $i < $q_sitemap_count; $i++) {
                $this->sitemap_index_output('sitemap-' . $i . '.xml');
            }
            $this->sitemap_index_footer();
        }
        // Indexed all important XML sitemaps
        // example: sitemap-index.xml
        if (count($req) == 1 && $req[0] == 'index') {
            $this->sitemap_index_header();
            $this->sitemap_index();
            $this->sitemap_index_footer();
        }
        // Indexed all XML sitemaps, including categories question page
        // example: sitemap-index.xml
        if (count($req) == 1 && $req[0] == 'all') {
            $this->sitemap_index_header();
            $this->sitemap_all();
            $this->sitemap_index_footer();
        }
        //	Question pages
        // numbered question sitenaps
        // example: sitemap-1.xml, sitemap-12.xml
        if (count($req) == 1 && strval((int) $req[0]) == $req[0]) {
            $hotstats = qa_db_read_one_assoc(qa_db_query_sub("SELECT MIN(hotness) AS base, MAX(hotness)-MIN(hotness) AS spread FROM ^posts WHERE type='Q'"));
            $count = qa_opt('useo_sitemap_question_count');
            $start = (int) $req[0] * $count;
            $questions = qa_db_read_all_assoc(qa_db_query_sub("SELECT postid, title, hotness FROM ^posts WHERE type='Q' ORDER BY postid LIMIT #,#", $start, $count));
            if (count($questions)) {
                $this->sitemap_header();
                foreach ($questions as $question) {
                    $this->sitemap_output(qa_q_request($question['postid'], $question['title']), 0.1 + 0.9 * ($question['hotness'] - $hotstats['base']) / (1 + $hotstats['spread']));
                }
                $this->sitemap_footer();
            }
        }
        //User pages
        if ($req[0] == 'users' && !QA_FINAL_EXTERNAL_USERS && qa_opt('useo_sitemap_users_enable')) {
            // user's numbered sitemaps
            // example: sitemap-users-1.xml, sitemap-users-12.xml
            if (isset($req[1]) && strval((int) $req[1]) == $req[1] && (int) qa_opt('useo_sitemap_users_count') != 0) {
                $count = qa_opt('useo_sitemap_users_count');
                $start = (int) $req[1] * $count;
                $users = qa_db_read_all_assoc(qa_db_query_sub("SELECT userid, handle FROM ^users ORDER BY userid LIMIT #,#", $start, $count));
                if (count($users)) {
                    $this->sitemap_header();
                    foreach ($users as $user) {
                        $this->sitemap_output('user/' . $user['handle'], 0.25);
                    }
                    $this->sitemap_footer();
                }
            } else {
                // All users sitemap
                // example: sitemap-users.xml
                if (!isset($req[1])) {
                    $users = qa_db_read_all_assoc(qa_db_query_sub("SELECT userid, handle FROM ^users ORDER BY userid"));
                    if (count($users)) {
                        $this->sitemap_header();
                        foreach ($users as $user) {
                            $this->sitemap_output('user/' . $user['handle'], 0.25);
                        }
                        $this->sitemap_footer();
                    }
                }
            }
        }
        //	Tag pages
        if ($req[0] == 'tags' && qa_using_tags() && qa_opt('useo_sitemap_tags_enable')) {
            // link to each tag's page sitemaps
            // example: sitemap-tags-1.xml, sitemap-tags-12.xml
            if (isset($req[1]) && strval((int) $req[1]) == $req[1] && (int) qa_opt('useo_sitemap_tags_count') != 0) {
                $count = qa_opt('useo_sitemap_tags_count');
                $start = (int) $req[1] * $count;
                $tagwords = qa_db_read_all_assoc(qa_db_query_sub("SELECT wordid, word, tagcount FROM ^words WHERE tagcount>0 ORDER BY wordid LIMIT #,#", $start, $count));
                if (count($tagwords)) {
                    $this->sitemap_header();
                    foreach ($tagwords as $tagword) {
                        $this->sitemap_output('tag/' . $tagword['word'], 0.5 / (1 + 1 / $tagword['tagcount']));
                        // priority between 0.25 and 0.5 depending on tag frequency
                    }
                    $this->sitemap_footer();
//.........这里部分代码省略.........
开发者ID:Kailashaghera,项目名称:Q2A-Ultimate-SEO,代码行数:101,代码来源:scalable-xml-sitemaps.php

示例6: header

	More about this license: http://www.question2answer.org/license.php
*/
if (!defined('QA_VERSION')) {
    // don't allow this page to be requested directly from browser
    header('Location: ../');
    exit;
}
require_once QA_INCLUDE_DIR . 'qa-db-selects.php';
require_once QA_INCLUDE_DIR . 'qa-app-format.php';
require_once QA_INCLUDE_DIR . 'qa-app-q-list.php';
$categoryslugs = qa_request_parts(1);
$countslugs = count($categoryslugs);
$userid = qa_get_logged_in_userid();
//	Get list of comments with related questions, plus category information
list($questions, $categories, $categoryid) = qa_db_select_with_pending(qa_db_recent_c_qs_selectspec($userid, 0, $categoryslugs), qa_db_category_nav_selectspec($categoryslugs, false, false, true), $countslugs ? qa_db_slugs_to_category_id_selectspec($categoryslugs) : null);
if ($countslugs) {
    if (!isset($categoryid)) {
        return include QA_INCLUDE_DIR . 'qa-page-not-found.php';
    }
    $categorytitlehtml = qa_html($categories[$categoryid]['title']);
    $sometitle = qa_lang_html_sub('main/recent_cs_in_x', $categorytitlehtml);
    $nonetitle = qa_lang_html_sub('main/no_comments_in_x', $categorytitlehtml);
} else {
    $sometitle = qa_lang_html('main/recent_cs_title');
    $nonetitle = qa_lang_html('main/no_comments_found');
}
//	Prepare and return content for theme
return qa_q_list_page_content(qa_any_sort_and_dedupe($questions), qa_opt('page_size_activity'), 0, null, $sometitle, $nonetitle, $categories, $categoryid, false, 'comments/', qa_opt('feed_for_activity') ? 'comments' : null, qa_html_suggest_qs_tags(qa_using_tags(), qa_category_path_request($categories, $categoryid)));
/*
	Omit PHP closing tag to help avoid accidental output
*/
开发者ID:mostafiz93,项目名称:PrintfScanf,代码行数:31,代码来源:qa-page-comments.php

示例7: qa_page_q_edit_q_form

function qa_page_q_edit_q_form()
{
    global $qa_content, $question, $inqtitle, $inqcontent, $inqformat, $inqeditor, $inqtags, $qerrors, $innotify, $inemail, $completetags, $categories;
    $content = isset($inqcontent) ? $inqcontent : $question['content'];
    $format = isset($inqformat) ? $inqformat : $question['format'];
    $editorname = isset($inqeditor) ? $inqeditor : qa_opt('editor_for_qs');
    $editor = qa_load_editor($content, $format, $editorname);
    $form = array('style' => 'tall', 'fields' => array('title' => array('label' => qa_lang_html('question/q_title_label'), 'tags' => 'NAME="qtitle"', 'value' => qa_html(isset($inqtitle) ? $inqtitle : $question['title']), 'error' => qa_html(@$qerrors['title'])), 'category' => array('label' => qa_lang_html('question/q_category_label')), 'content' => array_merge($editor->get_field($qa_content, $content, $format, 'qcontent', 12, true), array('label' => qa_lang_html('question/q_content_label'), 'error' => qa_html(@$qerrors['content']))), 'tags' => array('error' => qa_html(@$qerrors['tags']))), 'buttons' => array('save' => array('label' => qa_lang_html('main/save_button')), 'cancel' => array('tags' => 'NAME="docancel"', 'label' => qa_lang_html('main/cancel_button'))), 'hidden' => array('editor' => qa_html($editorname), 'dosaveq' => '1'));
    if (qa_using_categories() && count($categories)) {
        qa_set_up_category_field($qa_content, $form['fields']['category'], 'category', $categories, isset($incategoryid) ? $incategoryid : $question['categoryid'], qa_opt('allow_no_category') || !isset($question['categoryid']), qa_opt('allow_no_sub_category'));
    } else {
        unset($form['fields']['category']);
    }
    if (qa_using_tags()) {
        qa_set_up_tag_field($qa_content, $form['fields']['tags'], 'qtags', isset($inqtags) ? $inqtags : qa_tagstring_to_tags($question['tags']), array(), $completetags, qa_opt('page_size_ask_tags'));
    } else {
        unset($form['fields']['tags']);
    }
    if ($question['isbyuser']) {
        qa_set_up_notify_fields($qa_content, $form['fields'], 'Q', qa_get_logged_in_email(), isset($innotify) ? $innotify : !empty($question['notify']), isset($inemail) ? $inemail : @$question['notify'], @$qerrors['email']);
    }
    return $form;
}
开发者ID:TheProjecter,项目名称:microprobe,代码行数:23,代码来源:qa-page-question-post.php

示例8: qa_post_html_defaults

function qa_post_html_defaults($basetype, $full = false)
{
    require_once QA_INCLUDE_DIR . 'qa-app-users.php';
    return array('tagsview' => $basetype == 'Q' && qa_using_tags(), 'voteview' => qa_get_vote_view($basetype, $full), 'flagsview' => qa_opt('flagging_of_posts') && $full, 'answersview' => $basetype == 'Q', 'viewsview' => $basetype == 'Q' && qa_opt('do_count_q_views') && qa_opt('show_view_counts'), 'whatlink' => qa_opt('show_a_c_links'), 'whenview' => qa_opt('show_when_created'), 'ipview' => !qa_user_permit_error('permit_anon_view_ips'), 'whoview' => true, 'avatarsize' => qa_opt('avatar_q_list_size'), 'pointsview' => qa_opt('show_user_points'), 'pointstitle' => qa_opt('show_user_titles') ? qa_get_points_to_titles() : array(), 'blockwordspreg' => qa_get_block_words_preg(), 'showurllinks' => qa_opt('show_url_links'), 'linksnewwindow' => qa_opt('links_in_new_window'), 'microformats' => $full);
}
开发者ID:TheProjecter,项目名称:microprobe,代码行数:5,代码来源:qa-app-options.php

示例9: qa_html

    if (qa_opt('show_home_description')) {
        $qa_content['description'] = qa_html(qa_opt('home_description'));
    }
    $qa_content['custom'] = qa_opt('custom_home_content');
    return $qa_content;
}
//	If we got this far, it's a good old-fashioned Q&A listing page
require_once QA_INCLUDE_DIR . 'app/q-list.php';
qa_set_template('qa');
$questions = qa_any_sort_and_dedupe(array_merge($questions1, $questions2));
$pagesize = qa_opt('page_size_home');
if ($countslugs) {
    if (!isset($categoryid)) {
        return include QA_INCLUDE_DIR . 'qa-page-not-found.php';
    }
    $categorytitlehtml = qa_html($categories[$categoryid]['title']);
    $sometitle = qa_lang_html_sub('main/recent_qs_as_in_x', $categorytitlehtml);
    $nonetitle = qa_lang_html_sub('main/no_questions_in_x', $categorytitlehtml);
} else {
    $sometitle = qa_lang_html('main/recent_qs_as_title');
    $nonetitle = qa_lang_html('main/no_questions_found');
}
//	Prepare and return content for theme for Q&A listing page
$qa_content = qa_q_list_page_content($questions, $pagesize, 0, null, $sometitle, $nonetitle, $categories, $categoryid, true, $explicitqa ? 'qa/' : '', qa_opt('feed_for_qa') ? 'qa' : null, count($questions) < $pagesize ? qa_html_suggest_ask($categoryid) : qa_html_suggest_qs_tags(qa_using_tags(), qa_category_path_request($categories, $categoryid)), null, null);
if (!$explicitqa && !$countslugs && qa_opt('show_home_description')) {
    $qa_content['description'] = qa_html(qa_opt('home_description'));
}
return $qa_content;
/*
	Omit PHP closing tag to help avoid accidental output
*/
开发者ID:ronkeizer,项目名称:question2answer,代码行数:31,代码来源:default.php

示例10: qa_get_permit_options

function qa_get_permit_options()
{
    if (qa_to_override(__FUNCTION__)) {
        $args = func_get_args();
        return qa_call_override(__FUNCTION__, $args);
    }
    $permits = array('permit_view_q_page', 'permit_post_q', 'permit_post_a');
    if (qa_opt('comment_on_qs') || qa_opt('comment_on_as')) {
        $permits[] = 'permit_post_c';
    }
    if (qa_opt('voting_on_qs')) {
        $permits[] = 'permit_vote_q';
    }
    if (qa_opt('voting_on_as')) {
        $permits[] = 'permit_vote_a';
    }
    if (qa_opt('voting_on_qs') || qa_opt('voting_on_as')) {
        $permits[] = 'permit_vote_down';
    }
    if (qa_using_tags() || qa_using_categories()) {
        $permits[] = 'permit_retag_cat';
    }
    array_push($permits, 'permit_edit_q', 'permit_edit_a');
    if (qa_opt('comment_on_qs') || qa_opt('comment_on_as')) {
        $permits[] = 'permit_edit_c';
    }
    if (qa_opt('allow_close_questions')) {
        $permits[] = 'permit_close_q';
    }
    array_push($permits, 'permit_select_a', 'permit_anon_view_ips');
    if (qa_opt('flagging_of_posts')) {
        $permits[] = 'permit_flag';
    }
    $permits[] = 'permit_moderate';
    array_push($permits, 'permit_hide_show', 'permit_delete_hidden');
    return $permits;
}
开发者ID:mathjoy,项目名称:math-duodaa,代码行数:37,代码来源:qa-app-options.php

示例11: qa_content_prepare

function qa_content_prepare($voting = false, $categoryids = null)
{
    if (qa_to_override(__FUNCTION__)) {
        $args = func_get_args();
        return qa_call_override(__FUNCTION__, $args);
    }
    global $qa_template, $qa_page_error_html;
    if (QA_DEBUG_PERFORMANCE) {
        global $qa_usage;
        $qa_usage->mark('control');
    }
    $request = qa_request();
    $requestlower = qa_request();
    $navpages = qa_db_get_pending_result('navpages');
    $widgets = qa_db_get_pending_result('widgets');
    if (isset($categoryids) && !is_array($categoryids)) {
        // accept old-style parameter
        $categoryids = array($categoryids);
    }
    $lastcategoryid = count($categoryids) ? end($categoryids) : null;
    $charset = 'utf-8';
    $qa_content = array('content_type' => 'text/html; charset=' . $charset, 'charset' => $charset, 'direction' => qa_opt('site_text_direction'), 'site_title' => qa_html(qa_opt('site_title')), 'head_lines' => array(), 'navigation' => array('user' => array(), 'main' => array(), 'footer' => array('feedback' => array('url' => qa_path_html('feedback'), 'label' => qa_lang_html('main/nav_feedback')))), 'sidebar' => qa_opt('show_custom_sidebar') ? qa_opt('custom_sidebar') : null, 'sidepanel' => qa_opt('show_custom_sidepanel') ? qa_opt('custom_sidepanel') : null, 'widgets' => array());
    if (qa_opt('show_custom_in_head')) {
        $qa_content['head_lines'][] = qa_opt('custom_in_head');
    }
    if (qa_opt('show_custom_header')) {
        $qa_content['body_header'] = qa_opt('custom_header');
    }
    if (qa_opt('show_custom_footer')) {
        $qa_content['body_footer'] = qa_opt('custom_footer');
    }
    if (isset($categoryids)) {
        $qa_content['categoryids'] = $categoryids;
    }
    foreach ($navpages as $page) {
        if ($page['nav'] == 'B') {
            qa_navigation_add_page($qa_content['navigation']['main'], $page);
        }
    }
    if (qa_opt('nav_home') && qa_opt('show_custom_home')) {
        $qa_content['navigation']['main']['$'] = array('url' => qa_path_html(''), 'label' => qa_lang_html('main/nav_home'));
    }
    if (qa_opt('nav_activity')) {
        $qa_content['navigation']['main']['activity'] = array('url' => qa_path_html('activity'), 'label' => qa_lang_html('main/nav_activity'));
    }
    $hascustomhome = qa_has_custom_home();
    if (qa_opt($hascustomhome ? 'nav_qa_not_home' : 'nav_qa_is_home')) {
        $qa_content['navigation']['main'][$hascustomhome ? 'qa' : '$'] = array('url' => qa_path_html($hascustomhome ? 'qa' : ''), 'label' => qa_lang_html('main/nav_qa'));
    }
    if (qa_opt('nav_questions')) {
        $qa_content['navigation']['main']['questions'] = array('url' => qa_path_html('questions'), 'label' => qa_lang_html('main/nav_qs'));
    }
    if (qa_opt('nav_hot')) {
        $qa_content['navigation']['main']['hot'] = array('url' => qa_path_html('hot'), 'label' => qa_lang_html('main/nav_hot'));
    }
    if (qa_opt('nav_unanswered')) {
        $qa_content['navigation']['main']['unanswered'] = array('url' => qa_path_html('unanswered'), 'label' => qa_lang_html('main/nav_unanswered'));
    }
    if (qa_using_tags() && qa_opt('nav_tags')) {
        $qa_content['navigation']['main']['tag'] = array('url' => qa_path_html('tags'), 'label' => qa_lang_html('main/nav_tags'), 'selected_on' => array('tags$', 'tag/'));
    }
    if (qa_using_categories() && qa_opt('nav_categories')) {
        $qa_content['navigation']['main']['categories'] = array('url' => qa_path_html('categories'), 'label' => qa_lang_html('main/nav_categories'), 'selected_on' => array('categories$', 'categories/'));
    }
    if (qa_opt('nav_users')) {
        $qa_content['navigation']['main']['user'] = array('url' => qa_path_html('users'), 'label' => qa_lang_html('main/nav_users'), 'selected_on' => array('users$', 'users/', 'user/'));
    }
    // Only the 'level' permission error prevents the menu option being shown - others reported on qa-page-ask.php
    if (qa_opt('nav_ask') && qa_user_maximum_permit_error('permit_post_q') != 'level') {
        $qa_content['navigation']['main']['ask'] = array('url' => qa_path_html('ask', qa_using_categories() && strlen($lastcategoryid) ? array('cat' => $lastcategoryid) : null), 'label' => qa_lang_html('main/nav_ask'));
    }
    if (qa_get_logged_in_level() >= QA_USER_LEVEL_ADMIN || !qa_user_maximum_permit_error('permit_moderate') || !qa_user_maximum_permit_error('permit_hide_show') || !qa_user_maximum_permit_error('permit_delete_hidden')) {
        $qa_content['navigation']['main']['admin'] = array('url' => qa_path_html('admin'), 'label' => qa_lang_html('main/nav_admin'), 'selected_on' => array('admin/'));
    }
    $qa_content['search'] = array('form_tags' => 'method="get" action="' . qa_path_html('search') . '"', 'form_extra' => qa_path_form_html('search'), 'title' => qa_lang_html('main/search_title'), 'field_tags' => 'name="q"', 'button_label' => qa_lang_html('main/search_button'));
    if (!qa_opt('feedback_enabled')) {
        unset($qa_content['navigation']['footer']['feedback']);
    }
    foreach ($navpages as $page) {
        if ($page['nav'] == 'M' || $page['nav'] == 'O' || $page['nav'] == 'F') {
            qa_navigation_add_page($qa_content['navigation'][$page['nav'] == 'F' ? 'footer' : 'main'], $page);
        }
    }
    $regioncodes = array('F' => 'full', 'M' => 'main', 'S' => 'side');
    $placecodes = array('T' => 'top', 'H' => 'high', 'L' => 'low', 'B' => 'bottom');
    foreach ($widgets as $widget) {
        if (is_numeric(strpos(',' . $widget['tags'] . ',', ',' . $qa_template . ',')) || is_numeric(strpos(',' . $widget['tags'] . ',', ',all,'))) {
            // see if it has been selected for display on this template
            $region = @$regioncodes[substr($widget['place'], 0, 1)];
            $place = @$placecodes[substr($widget['place'], 1, 2)];
            if (isset($region) && isset($place)) {
                // check region/place codes recognized
                $module = qa_load_module('widget', $widget['title']);
                if (isset($module) && method_exists($module, 'allow_template') && $module->allow_template(substr($qa_template, 0, 7) == 'custom-' ? 'custom' : $qa_template) && method_exists($module, 'allow_region') && $module->allow_region($region) && method_exists($module, 'output_widget')) {
                    $qa_content['widgets'][$region][$place][] = $module;
                }
                // if module loaded and happy to be displayed here, tell theme about it
            }
        }
    }
//.........这里部分代码省略.........
开发者ID:Trideon,项目名称:gigolo,代码行数:101,代码来源:qa-page.php

示例12: process_request

 public function process_request($request)
 {
     @ini_set('display_errors', 0);
     // we don't want to show PHP errors inside XML
     header('Content-type: text/xml; charset=utf-8');
     echo '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
     echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . "\n";
     //	Question pages
     if (qa_opt('xml_sitemap_show_questions')) {
         $hotstats = qa_db_read_one_assoc(qa_db_query_sub("SELECT MIN(hotness) AS base, MAX(hotness)-MIN(hotness) AS spread FROM ^posts WHERE type='Q'"));
         $nextpostid = 0;
         while (1) {
             $questions = qa_db_read_all_assoc(qa_db_query_sub("SELECT postid, title, hotness FROM ^posts WHERE postid>=# AND type='Q' ORDER BY postid LIMIT 100", $nextpostid));
             if (!count($questions)) {
                 break;
             }
             foreach ($questions as $question) {
                 $this->sitemap_output(qa_q_request($question['postid'], $question['title']), 0.1 + 0.9 * ($question['hotness'] - $hotstats['base']) / (1 + $hotstats['spread']));
                 $nextpostid = max($nextpostid, $question['postid'] + 1);
             }
         }
     }
     //	User pages
     if (!QA_FINAL_EXTERNAL_USERS && qa_opt('xml_sitemap_show_users')) {
         $nextuserid = 0;
         while (1) {
             $users = qa_db_read_all_assoc(qa_db_query_sub("SELECT userid, handle FROM ^users WHERE userid>=# ORDER BY userid LIMIT 100", $nextuserid));
             if (!count($users)) {
                 break;
             }
             foreach ($users as $user) {
                 $this->sitemap_output('user/' . $user['handle'], 0.25);
                 $nextuserid = max($nextuserid, $user['userid'] + 1);
             }
         }
     }
     //	Tag pages
     if (qa_using_tags() && qa_opt('xml_sitemap_show_tag_qs')) {
         $nextwordid = 0;
         while (1) {
             $tagwords = qa_db_read_all_assoc(qa_db_query_sub("SELECT wordid, word, tagcount FROM ^words WHERE wordid>=# AND tagcount>0 ORDER BY wordid LIMIT 100", $nextwordid));
             if (!count($tagwords)) {
                 break;
             }
             foreach ($tagwords as $tagword) {
                 $this->sitemap_output('tag/' . $tagword['word'], 0.5 / (1 + 1 / $tagword['tagcount']));
                 // priority between 0.25 and 0.5 depending on tag frequency
                 $nextwordid = max($nextwordid, $tagword['wordid'] + 1);
             }
         }
     }
     //	Question list for each category
     if (qa_using_categories() && qa_opt('xml_sitemap_show_category_qs')) {
         $nextcategoryid = 0;
         while (1) {
             $categories = qa_db_read_all_assoc(qa_db_query_sub("SELECT categoryid, backpath FROM ^categories WHERE categoryid>=# AND qcount>0 ORDER BY categoryid LIMIT 2", $nextcategoryid));
             if (!count($categories)) {
                 break;
             }
             foreach ($categories as $category) {
                 $this->sitemap_output('questions/' . implode('/', array_reverse(explode('/', $category['backpath']))), 0.5);
                 $nextcategoryid = max($nextcategoryid, $category['categoryid'] + 1);
             }
         }
     }
     //	Pages in category browser
     if (qa_using_categories() && qa_opt('xml_sitemap_show_categories')) {
         $this->sitemap_output('categories', 0.5);
         $nextcategoryid = 0;
         while (1) {
             // only find categories with a child
             $categories = qa_db_read_all_assoc(qa_db_query_sub("SELECT parent.categoryid, parent.backpath FROM ^categories AS parent " . "JOIN ^categories AS child ON child.parentid=parent.categoryid WHERE parent.categoryid>=# GROUP BY parent.categoryid LIMIT 100", $nextcategoryid));
             if (!count($categories)) {
                 break;
             }
             foreach ($categories as $category) {
                 $this->sitemap_output('categories/' . implode('/', array_reverse(explode('/', $category['backpath']))), 0.5);
                 $nextcategoryid = max($nextcategoryid, $category['categoryid'] + 1);
             }
         }
     }
     echo "</urlset>\n";
     return null;
 }
开发者ID:kosmoluna,项目名称:question2answer,代码行数:84,代码来源:qa-xml-sitemap.php

示例13: process_request

 function process_request($request)
 {
     @ini_set('display_errors', 0);
     // we don't want to show PHP errors inside XML
     $siteurl = qa_opt('site_url');
     header('Content-type: text/xml; charset=utf-8');
     echo '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
     echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . "\n";
     //	Question pages
     $nextpostid = 0;
     while (1) {
         $questions = qa_db_read_all_assoc(qa_db_query_sub("SELECT postid, BINARY title AS title, upvotes, downvotes FROM ^posts WHERE postid>=# AND type='Q' ORDER BY postid LIMIT 100", $nextpostid));
         if (!count($questions)) {
             break;
         }
         foreach ($questions as $question) {
             $priority = 0.5;
             // between 0 and 1 depending on up/down votes (0.5 if net votes are zero)
             $netvotes = $question['upvotes'] - $question['downvotes'];
             if ($netvotes != 0) {
                 $absvotes = abs($netvotes);
                 $signvotes = $netvotes / $absvotes;
                 $priority += $signvotes * 0.5 / (1 + 1 / $absvotes);
             }
             echo "\t<url>\n" . "\t\t<loc>" . qa_path_html(qa_q_request($question['postid'], $question['title']), null, $siteurl) . "</loc>\n" . "\t\t<priority>" . $priority . "</priority>\n" . "\t</url>\n";
             $nextpostid = max($nextpostid, $question['postid'] + 1);
         }
     }
     //	Tag pages
     if (qa_using_tags()) {
         $nextwordid = 0;
         while (1) {
             $tagwords = qa_db_read_all_assoc(qa_db_query_sub("SELECT wordid, BINARY word AS word, tagcount FROM ^words WHERE wordid>=# AND tagcount>0 ORDER BY wordid LIMIT 100", $nextwordid));
             if (!count($tagwords)) {
                 break;
             }
             foreach ($tagwords as $tagword) {
                 $priority = 0.5 / (1 + 1 / $tagword['tagcount']);
                 // between 0.25 and 0.5 depending on tag frequency
                 echo "\t<url>\n" . "\t\t<loc>" . qa_path_html('tag/' . $tagword['word'], null, $siteurl) . "</loc>\n" . "\t\t<priority>" . $priority . "</priority>\n" . "\t</url>\n";
                 $nextwordid = max($nextwordid, $tagword['wordid'] + 1);
             }
         }
     }
     //	User pages
     if (!QA_FINAL_EXTERNAL_USERS) {
         $nextuserid = 0;
         while (1) {
             $users = qa_db_read_all_assoc(qa_db_query_sub("SELECT userid, BINARY handle AS handle FROM ^users WHERE userid>=# ORDER BY userid LIMIT 100", $nextuserid));
             if (!count($users)) {
                 break;
             }
             foreach ($users as $user) {
                 $priority = 0.25;
                 echo "\t<url>\n" . "\t\t<loc>" . qa_path_html('user/' . $user['handle'], null, $siteurl) . "</loc>\n" . "\t\t<priority>" . $priority . "</priority>\n" . "\t</url>\n";
                 $nextuserid = max($nextuserid, $user['userid'] + 1);
             }
         }
     }
     echo "</urlset>\n";
     return null;
 }
开发者ID:TheProjecter,项目名称:microprobe,代码行数:62,代码来源:qa-xml-sitemap.php

示例14: or

	as published by the Free Software Foundation; either version 2
	of the License, or (at your option) any later version.
	
	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	More about this license: http://www.question2answer.org/license.php
*/
require_once QA_INCLUDE_DIR . 'qa-db-selects.php';
require_once QA_INCLUDE_DIR . 'qa-util-string.php';
//	Collect the information we need from the database
$intitle = qa_post_text('title');
$doaskcheck = qa_opt('do_ask_check_qs');
$doexampletags = qa_using_tags() && qa_opt('do_example_tags');
if ($doaskcheck || $doexampletags) {
    $countqs = max($doexampletags ? QA_DB_RETRIEVE_ASK_TAG_QS : 0, $doaskcheck ? qa_opt('page_size_ask_check_qs') : 0);
    $relatedquestions = qa_db_select_with_pending(qa_db_search_posts_selectspec(null, qa_string_to_words($intitle), null, null, null, null, 0, false, $countqs));
}
//	Collect example tags if appropriate
if ($doexampletags) {
    require_once QA_INCLUDE_DIR . 'qa-app-format.php';
    $tagweight = array();
    foreach ($relatedquestions as $question) {
        $tags = qa_tagstring_to_tags($question['tags']);
        foreach ($tags as $tag) {
            @($tagweight[$tag] += exp($question['score']));
        }
    }
    arsort($tagweight, SORT_NUMERIC);
开发者ID:ramo01,项目名称:1kapp,代码行数:31,代码来源:qa-ajax-asktitle.php

示例15: qa_page_q_edit_q_submit

function qa_page_q_edit_q_submit($question, $answers, $commentsfollows, $closepost, &$in, &$errors)
{
    $in = array();
    if ($question['editable']) {
        $in['title'] = qa_post_text('q_title');
        qa_get_post_content('q_editor', 'q_content', $in['editor'], $in['content'], $in['format'], $in['text']);
        $in['extra'] = qa_opt('extra_field_active') ? qa_post_text('q_extra') : null;
    }
    if ($question['retagcatable']) {
        if (qa_using_tags()) {
            $in['tags'] = qa_get_tags_field_value('q_tags');
        }
        if (qa_using_categories()) {
            $in['categoryid'] = qa_get_category_field_value('q_category');
        }
    }
    if ($question['isbyuser']) {
        $in['notify'] = qa_post_text('q_notify') ? true : false;
        $in['email'] = qa_post_text('q_email');
    }
    // here the $in array only contains values for parts of the form that were displayed, so those are only ones checked by filters
    $errors = array();
    $filtermodules = qa_load_modules_with('filter', 'filter_question');
    foreach ($filtermodules as $filtermodule) {
        $oldin = $in;
        $filtermodule->filter_question($in, $errors, $question);
        if ($question['editable']) {
            qa_update_post_text($in, $oldin);
        }
    }
    if (empty($errors)) {
        $userid = qa_get_logged_in_userid();
        $handle = qa_get_logged_in_handle();
        $cookieid = qa_cookie_get();
        // now we fill in the missing values in the $in array, so that we have everything we need for qa_question_set_content()
        // we do things in this way to avoid any risk of a validation failure on elements the user can't see (e.g. due to admin setting changes)
        if (!$question['editable']) {
            $in['title'] = $question['title'];
            $in['content'] = $question['content'];
            $in['format'] = $question['format'];
            $in['text'] = qa_viewer_text($in['content'], $in['format']);
            $in['extra'] = $question['extra'];
        }
        if (!isset($in['tags'])) {
            $in['tags'] = qa_tagstring_to_tags($question['tags']);
        }
        if (!array_key_exists('categoryid', $in)) {
            $in['categoryid'] = $question['categoryid'];
        }
        $setnotify = $question['isbyuser'] ? qa_combine_notify_email($question['userid'], $in['notify'], $in['email']) : $question['notify'];
        qa_question_set_content($question, $in['title'], $in['content'], $in['format'], $in['text'], qa_tags_to_tagstring($in['tags']), $setnotify, $userid, $handle, $cookieid, $in['extra']);
        if (qa_using_categories() && strcmp($in['categoryid'], $question['categoryid'])) {
            qa_question_set_category($question, $in['categoryid'], $userid, $handle, $cookieid, $answers, $commentsfollows, $closepost);
        }
        return true;
    }
    return false;
}
开发者ID:robomartin,项目名称:Import-Tags,代码行数:58,代码来源:qa-page-question-post.php


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