本文整理汇总了PHP中qa_post_html_defaults函数的典型用法代码示例。如果您正苦于以下问题:PHP qa_post_html_defaults函数的具体用法?PHP qa_post_html_defaults怎么用?PHP qa_post_html_defaults使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了qa_post_html_defaults函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: it_q_list_page_content
function it_q_list_page_content($questions, $pagesize, $start, $count, $sometitle, $nonetitle, $navcategories, $categoryid, $categoryqcount, $categorypathprefix, $feedpathprefix, $suggest, $pagelinkparams = null, $categoryparams = null, $dummy = null)
{
require_once QA_INCLUDE_DIR . 'qa-app-format.php';
require_once QA_INCLUDE_DIR . 'qa-app-updates.php';
$userid = qa_get_logged_in_userid();
// Chop down to size, get user information for display
if (isset($pagesize)) {
$questions = array_slice($questions, 0, $pagesize);
}
$usershtml = qa_userids_handles_html(qa_any_get_userids_handles($questions));
$qa_content['q_list']['form'] = array('tags' => 'method="post" action="' . qa_self_html() . '"', 'hidden' => array('code' => qa_get_form_security_code('vote')));
$qa_content['q_list']['qs'] = array();
if (count($questions)) {
$qa_content['title'] = $sometitle;
$defaults = qa_post_html_defaults('Q');
foreach ($questions as $question) {
$qa_content['q_list']['qs'][] = qa_any_to_q_html_fields($question, $userid, it_cookie_get(), $usershtml, null, qa_post_html_options($question, $defaults));
}
} else {
$qa_content['title'] = $nonetitle;
}
if (isset($count) && isset($pagesize)) {
$qa_content['page_links'] = qa_html_page_links(qa_request(), $start, $pagesize, $count, qa_opt('pages_prev_next'), $pagelinkparams);
}
return $qa_content;
}
示例2: qa_q_list_page_content
function qa_q_list_page_content($questions, $pagesize, $start, $count, $sometitle, $nonetitle, $navcategories, $categoryid, $categoryqcount, $categorypathprefix, $feedpathprefix, $suggest, $pagelinkparams = null, $categoryparams = null, $dummy = null)
{
if (qa_to_override(__FUNCTION__)) {
$args = func_get_args();
return qa_call_override(__FUNCTION__, $args);
}
require_once QA_INCLUDE_DIR . 'app/format.php';
require_once QA_INCLUDE_DIR . 'app/updates.php';
$userid = qa_get_logged_in_userid();
// Chop down to size, get user information for display
if (isset($pagesize)) {
$questions = array_slice($questions, 0, $pagesize);
}
$usershtml = qa_userids_handles_html(qa_any_get_userids_handles($questions));
// Prepare content for theme
$qa_content = qa_content_prepare(true, array_keys(qa_category_path($navcategories, $categoryid)));
$qa_content['q_list']['form'] = array('tags' => 'method="post" action="' . qa_self_html() . '"', 'hidden' => array('code' => qa_get_form_security_code('vote')));
$qa_content['q_list']['qs'] = array();
if (count($questions)) {
$qa_content['title'] = $sometitle;
$defaults = qa_post_html_defaults('Q');
if (isset($categorypathprefix)) {
$defaults['categorypathprefix'] = $categorypathprefix;
}
foreach ($questions as $question) {
$fields = qa_any_to_q_html_fields($question, $userid, qa_cookie_get(), $usershtml, null, qa_post_html_options($question, $defaults));
if (!empty($fields['raw']['closedbyid'])) {
$fields['closed'] = array('state' => qa_lang_html('main/closed'));
}
$qa_content['q_list']['qs'][] = $fields;
}
} else {
$qa_content['title'] = $nonetitle;
}
if (isset($userid) && isset($categoryid)) {
$favoritemap = qa_get_favorite_non_qs_map();
$categoryisfavorite = @$favoritemap['category'][$navcategories[$categoryid]['backpath']];
$qa_content['favorite'] = qa_favorite_form(QA_ENTITY_CATEGORY, $categoryid, $categoryisfavorite, qa_lang_sub($categoryisfavorite ? 'main/remove_x_favorites' : 'main/add_category_x_favorites', $navcategories[$categoryid]['title']));
}
if (isset($count) && isset($pagesize)) {
$qa_content['page_links'] = qa_html_page_links(qa_request(), $start, $pagesize, $count, qa_opt('pages_prev_next'), $pagelinkparams);
}
if (empty($qa_content['page_links'])) {
$qa_content['suggest_next'] = $suggest;
}
if (qa_using_categories() && count($navcategories) && isset($categorypathprefix)) {
$qa_content['navigation']['cat'] = qa_category_navigation($navcategories, $categoryid, $categorypathprefix, $categoryqcount, $categoryparams);
}
if (isset($feedpathprefix) && (qa_opt('feed_per_category') || !isset($categoryid))) {
$qa_content['feed'] = array('url' => qa_path_html(qa_feed_request($feedpathprefix . (isset($categoryid) ? '/' . qa_category_path_request($navcategories, $categoryid) : ''))), 'label' => strip_tags($sometitle));
}
return $qa_content;
}
示例3: qa_favorite_q_list_view
function qa_favorite_q_list_view($questions, $usershtml)
{
$q_list = array('qs' => array());
if (count($questions) === 0) {
return $q_list;
}
$q_list['form'] = array('tags' => 'method="post" action="' . qa_self_html() . '"', 'hidden' => array('code' => qa_get_form_security_code('vote')));
$defaults = qa_post_html_defaults('Q');
foreach ($questions as $question) {
$q_list['qs'][] = qa_post_html_fields($question, qa_get_logged_in_userid(), qa_cookie_get(), $usershtml, null, qa_post_html_options($question, $defaults));
}
return $q_list;
}
示例4: get_user_activity
function get_user_activity($handle, $limit = 10)
{
$userid = qa_handle_to_userid($handle);
require_once QA_INCLUDE_DIR . 'qa-db-selects.php';
require_once QA_INCLUDE_DIR . 'qa-app-format.php';
$identifier = QA_FINAL_EXTERNAL_USERS ? $userid : $handle;
list($useraccount, $questions, $answerqs, $commentqs, $editqs) = qa_db_select_with_pending(QA_FINAL_EXTERNAL_USERS ? null : qa_db_user_account_selectspec($handle, false), qa_db_user_recent_qs_selectspec($userid, $identifier, $limit), qa_db_user_recent_a_qs_selectspec($userid, $identifier), qa_db_user_recent_c_qs_selectspec($userid, $identifier), qa_db_user_recent_edit_qs_selectspec($userid, $identifier));
if (!QA_FINAL_EXTERNAL_USERS && !is_array($useraccount)) {
// check the user exists
return include QA_INCLUDE_DIR . 'qa-page-not-found.php';
}
// Get information on user references
$questions = qa_any_sort_and_dedupe(array_merge($questions, $answerqs, $commentqs, $editqs));
$questions = array_slice($questions, 0, $limit);
$usershtml = qa_userids_handles_html(qa_any_get_userids_handles($questions), false);
$htmldefaults = qa_post_html_defaults('Q');
$htmldefaults['whoview'] = false;
$htmldefaults['voteview'] = false;
$htmldefaults['avatarsize'] = 0;
foreach ($questions as $question) {
$qa_content[] = qa_any_to_q_html_fields($question, $userid, qa_cookie_get(), $usershtml, null, array('voteview' => false) + qa_post_html_options($question, $htmldefaults));
}
$output = '<div class="user-activities">';
$output .= '<ul>';
if (isset($qa_content)) {
foreach ($qa_content as $qs) {
$icon = 'icon-time undefined';
$output .= '<li class="activity-item">';
$output .= '<div class="list-right">';
$output .= '<div class="type pull-left ' . $icon . '"></div>';
$output .= '<div class="what"><a class="what-task" href="' . @$qs['url'] . '">' . $qs['what'] . '</a>';
$output .= '<a href="' . $qs['url'] . '">' . $qs['title'] . '</a> </div>';
$output .= '<strong class="when">' . implode(' ', $qs['when']) . '</strong>';
$output .= '</div>';
$output .= '</li>';
}
} else {
$output .= '<li>' . qa_lang('cleanstrap/no_activity_yet') . '</li>';
}
$output .= '</ul>';
$output .= '</div>';
return $output;
}
示例5: qa_q_list_page_content
function qa_q_list_page_content($questions, $pagesize, $start, $count, $sometitle, $nonetitle, $navcategories, $categoryid, $categoryqcount, $categorypathprefix, $feedpathprefix, $suggest, $pagelinkparams = array())
{
require_once QA_INCLUDE_DIR . 'qa-app-format.php';
global $qa_login_userid, $qa_cookieid, $qa_request;
// get globals from qa-page.php
// Chop down to size, get user information for display
if (isset($pagesize)) {
$questions = array_slice($questions, 0, $pagesize);
}
$usershtml = qa_userids_handles_html(qa_any_get_userids_handles($questions));
// Prepare content for theme
$qa_content = qa_content_prepare(true, array_keys(qa_category_path($navcategories, $categoryid)));
$qa_content['q_list']['form'] = array('tags' => 'METHOD="POST" ACTION="' . qa_self_html() . '"');
$qa_content['q_list']['qs'] = array();
if (count($questions)) {
$qa_content['title'] = $sometitle;
$options = qa_post_html_defaults('Q');
if (isset($categorypathprefix)) {
$options['categorypathprefix'] = $categorypathprefix;
}
foreach ($questions as $question) {
$qa_content['q_list']['qs'][] = qa_any_to_q_html_fields($question, $qa_login_userid, $qa_cookieid, $usershtml, null, $options);
}
} else {
$qa_content['title'] = $nonetitle;
}
if (isset($count) && isset($pagesize)) {
$qa_content['page_links'] = qa_html_page_links($qa_request, $start, $pagesize, $count, qa_opt('pages_prev_next'), $pagelinkparams);
}
if (empty($qa_content['page_links'])) {
$qa_content['suggest_next'] = $suggest;
}
if (qa_using_categories() && count($navcategories) && isset($categorypathprefix)) {
$qa_content['navigation']['cat'] = qa_category_navigation($navcategories, $categoryid, $categorypathprefix, $categoryqcount);
}
if (isset($feedpathprefix) && (qa_opt('feed_per_category') || !isset($categoryid))) {
$qa_content['feed'] = array('url' => qa_path_html(qa_feed_request($feedpathprefix . (isset($categoryid) ? '/' . qa_category_path_request($navcategories, $categoryid) : ''))), 'label' => strip_tags($sometitle));
}
return $qa_content;
}
示例6: output_widget
function output_widget($region, $place, $themeobject, $template, $request, $qa_content)
{
require_once QA_INCLUDE_DIR . 'qa-db-selects.php';
if (@$qa_content['q_view']['raw']['type'] != 'Q') {
// question might not be visible, etc...
return;
}
$questionid = $qa_content['q_view']['raw']['postid'];
$userid = qa_get_logged_in_userid();
$cookieid = qa_cookie_get();
$questions = qa_db_single_select(qa_db_related_qs_selectspec($userid, $questionid, qa_opt('page_size_related_qs')));
$minscore = qa_match_to_min_score(qa_opt('match_related_qs'));
foreach ($questions as $key => $question) {
if ($question['score'] < $minscore) {
unset($questions[$key]);
}
}
$titlehtml = qa_lang_html(count($questions) ? 'main/related_qs_title' : 'main/no_related_qs_title');
if ($region == 'side') {
$themeobject->output('<DIV CLASS="qa-related-qs">', '<H2 STYLE="margin-top:0; padding-top:0;">', $titlehtml, '</H2>');
$themeobject->output('<UL CLASS="qa-related-q-list">');
foreach ($questions as $question) {
$themeobject->output('<LI CLASS="qa-related-q-item"><A HREF="' . qa_q_path_html($question['postid'], $question['title']) . '">' . qa_html($question['title']) . '</A></LI>');
}
$themeobject->output('</UL>', '</DIV>');
} else {
$themeobject->output('<H2>', $titlehtml, '</H2>');
$q_list = array('form' => array('tags' => 'METHOD="POST" ACTION="' . qa_self_html() . '"'), 'qs' => array());
$options = qa_post_html_defaults('Q');
$usershtml = qa_userids_handles_html($questions);
foreach ($questions as $question) {
$q_list['qs'][] = qa_post_html_fields($question, $userid, $cookieid, $usershtml, null, $options);
}
$themeobject->q_list_and_form($q_list);
}
}
示例7: output_widget
public function output_widget($region, $place, $themeobject, $template, $request, $qa_content)
{
require_once QA_INCLUDE_DIR . 'db/selects.php';
if (!isset($qa_content['q_view']['raw']['type']) || $qa_content['q_view']['raw']['type'] != 'Q') {
// question might not be visible, etc...
return;
}
$questionid = $qa_content['q_view']['raw']['postid'];
$userid = qa_get_logged_in_userid();
$cookieid = qa_cookie_get();
$questions = qa_db_single_select(qa_db_related_qs_selectspec($userid, $questionid, qa_opt('page_size_related_qs')));
$minscore = qa_match_to_min_score(qa_opt('match_related_qs'));
foreach ($questions as $key => $question) {
if ($question['score'] < $minscore) {
unset($questions[$key]);
}
}
$titlehtml = qa_lang_html(count($questions) ? 'main/related_qs_title' : 'main/no_related_qs_title');
if ($region == 'side') {
$themeobject->output('<div class="qa-related-qs">', '<h2 style="margin-top:0; padding-top:0;">', $titlehtml, '</h2>');
$themeobject->output('<ul class="qa-related-q-list">');
foreach ($questions as $question) {
$themeobject->output('<li class="qa-related-q-item">' . '<a href="' . qa_q_path_html($question['postid'], $question['title']) . '">' . qa_html($question['title']) . '</a>' . '</li>');
}
$themeobject->output('</ul>', '</div>');
} else {
$themeobject->output('<h2>', $titlehtml, '</h2>');
$q_list = array('form' => array('tags' => 'method="post" action="' . qa_self_html() . '"', 'hidden' => array('code' => qa_get_form_security_code('vote'))), 'qs' => array());
$defaults = qa_post_html_defaults('Q');
$usershtml = qa_userids_handles_html($questions);
foreach ($questions as $question) {
$q_list['qs'][] = qa_post_html_fields($question, $userid, $cookieid, $usershtml, null, qa_post_html_options($question, $defaults));
}
$themeobject->q_list_and_form($q_list);
}
}
示例8: qa_post_html_options
function qa_post_html_options($post, $defaults = null, $full = false)
{
if (qa_to_override(__FUNCTION__)) {
$args = func_get_args();
return qa_call_override(__FUNCTION__, $args);
}
if (!isset($defaults)) {
$defaults = qa_post_html_defaults($post['basetype'], $full);
}
$defaults['voteview'] = qa_get_vote_view($post, $full);
$defaults['ipview'] = !qa_user_post_permit_error('permit_anon_view_ips', $post);
return $defaults;
}
示例9: qa_redirect
qa_redirect('tags');
}
@(list($questions, $tagword, $favorite) = qa_db_select_with_pending(qa_db_tag_recent_qs_selectspec($userid, $tag, $start, false, qa_opt_if_loaded('page_size_tag_qs')), qa_db_tag_word_selectspec($tag), isset($userid) ? qa_db_is_favorite_selectspec($userid, QA_ENTITY_TAG, $tag) : null));
$pagesize = qa_opt('page_size_tag_qs');
$questions = array_slice($questions, 0, $pagesize);
$usershtml = qa_userids_handles_html($questions);
// Prepare content for theme
$qa_content = qa_content_prepare(true);
$qa_content['title'] = qa_lang_html_sub('main/questions_tagged_x', qa_html($tag));
if (isset($userid) && isset($tagword)) {
$qa_content['favorite'] = qa_favorite_form(QA_ENTITY_TAG, $tagword['wordid'], $favorite, qa_lang_sub($favorite ? 'main/remove_x_favorites' : 'main/add_tag_x_favorites', $tagword['word']));
}
if (!count($questions)) {
$qa_content['q_list']['title'] = qa_lang_html('main/no_questions_found');
}
$qa_content['q_list']['form'] = array('tags' => 'METHOD="POST" ACTION="' . qa_self_html() . '"');
$qa_content['q_list']['qs'] = array();
foreach ($questions as $postid => $question) {
$qa_content['q_list']['qs'][] = qa_post_html_fields($question, $userid, qa_cookie_get(), $usershtml, null, qa_post_html_defaults('Q'));
}
$qa_content['page_links'] = qa_html_page_links(qa_request(), $start, $pagesize, $tagword['tagcount'], qa_opt('pages_prev_next'));
if (empty($qa_content['page_links'])) {
$qa_content['suggest_next'] = qa_html_suggest_qs_tags(true);
}
if (qa_opt('feed_for_tag_qs')) {
$qa_content['feed'] = array('url' => qa_path_html(qa_feed_request('tag/' . $tag)), 'label' => qa_lang_html_sub('main/questions_tagged_x', qa_html($tag)));
}
return $qa_content;
/*
Omit PHP closing tag to help avoid accidental output
*/
示例10: get_user_activity
function get_user_activity($handle)
{
$userid = qa_handle_to_userid($handle);
require_once QA_INCLUDE_DIR . 'qa-db-selects.php';
require_once QA_INCLUDE_DIR . 'qa-app-format.php';
$loginuserid = qa_get_logged_in_userid();
$identifier = QA_FINAL_EXTERNAL_USERS ? $userid : $handle;
list($useraccount, $questions, $answerqs, $commentqs, $editqs) = qa_db_select_with_pending(QA_FINAL_EXTERNAL_USERS ? null : qa_db_user_account_selectspec($handle, false), qa_db_user_recent_qs_selectspec($loginuserid, $identifier, qa_opt_if_loaded('page_size_activity')), qa_db_user_recent_a_qs_selectspec($loginuserid, $identifier), qa_db_user_recent_c_qs_selectspec($loginuserid, $identifier), qa_db_user_recent_edit_qs_selectspec($loginuserid, $identifier));
if (!QA_FINAL_EXTERNAL_USERS && !is_array($useraccount)) {
// check the user exists
return include QA_INCLUDE_DIR . 'qa-page-not-found.php';
}
// Get information on user references
$questions = qa_any_sort_and_dedupe(array_merge($questions, $answerqs, $commentqs, $editqs));
$questions = array_slice($questions, 0, qa_opt('page_size_activity'));
$usershtml = qa_userids_handles_html(qa_any_get_userids_handles($questions), false);
$htmldefaults = qa_post_html_defaults('Q');
$htmldefaults['whoview'] = false;
$htmldefaults['voteview'] = false;
$htmldefaults['avatarsize'] = 0;
foreach ($questions as $question) {
$qa_content[] = qa_any_to_q_html_fields($question, $loginuserid, qa_cookie_get(), $usershtml, null, array('voteview' => false) + qa_post_html_options($question, $htmldefaults));
}
$output = '<div class="widget user-activities">';
$output .= '<h3 class="widget-title">' . ra_name($handle) . '\'s ' . _ra_lang('activities') . '</h3>';
$output .= '<ul class="question-list">';
if (isset($qa_content)) {
foreach ($qa_content as $qs) {
if ($qs['what'] == 'answered') {
$icon = 'icon-chat-3 answered';
} elseif ($qs['what'] == 'asked') {
$icon = 'icon-question asked';
} elseif ($qs['what'] == 'commented') {
$icon = 'icon-chat-2 commented';
} elseif ($qs['what'] == 'edited' || $qs['what'] == 'answer edited') {
$icon = 'icon-edit edited';
} elseif ($qs['what'] == 'closed') {
$icon = 'icon-error closed';
} elseif ($qs['what'] == 'answer selected') {
$icon = 'icon-checked selected';
} elseif ($qs['what'] == 'recategorized') {
$icon = 'icon-folder-close recategorized';
} else {
$icon = 'icon-pin undefined';
}
$output .= '<li class="activity-item">';
$output .= '<div class="type pull-left ' . $icon . '"></div>';
$output .= '<div class="list-right">';
$output .= '<h5 class="when"><a href="' . @$qs['what_url'] . '">' . $qs['what'] . '</a> ' . implode(' ', $qs['when']) . '</h5>';
$output .= '<h5 class="what"><a href="' . $qs['url'] . '">' . $qs['title'] . '</a></h5>';
$output .= '</div>';
$output .= '</li>';
}
} else {
$output .= '<li>' . _ra_lang('No activity yet.') . '</li>';
}
$output .= '</ul>';
$output .= '</div>';
return $output;
}
示例11: qa_userids_handles_html
$usershtml = qa_userids_handles_html($fullquestions);
// Report the search event
qa_report_event('search', $userid, qa_get_logged_in_handle(), qa_cookie_get(), array('query' => $inquery, 'start' => $start));
}
// Prepare content for theme
$qa_content = qa_content_prepare(true);
if (strlen(qa_get('q'))) {
$qa_content['search']['value'] = qa_html($inquery);
if (count($results)) {
$qa_content['title'] = qa_lang_html_sub('main/results_for_x', qa_html($inquery));
} else {
$qa_content['title'] = qa_lang_html_sub('main/no_results_for_x', qa_html($inquery));
}
$qa_content['q_list']['form'] = array('tags' => 'method="post" action="' . qa_self_html() . '"', 'hidden' => array('code' => qa_get_form_security_code('vote')));
$qa_content['q_list']['qs'] = array();
$qdefaults = qa_post_html_defaults('Q');
foreach ($results as $result) {
if (!isset($result['question'])) {
// if we have any non-question results, display with less statistics
$qdefaults['voteview'] = false;
$qdefaults['answersview'] = false;
$qdefaults['viewsview'] = false;
break;
}
}
foreach ($results as $result) {
if (isset($result['question'])) {
$fields = qa_post_html_fields($result['question'], $userid, qa_cookie_get(), $usershtml, null, qa_post_html_options($result['question'], $qdefaults));
} elseif (isset($result['url'])) {
$fields = array('what' => qa_html($result['url']), 'meta_order' => qa_lang_html('main/meta_order'));
} else {
示例12: qa_lang_html_sub
if (@$userpoints['aselects']) {
$qa_content['form_activity']['fields']['questions']['value'] .= $userpoints['aselects'] == 1 ? qa_lang_html_sub('profile/1_with_best_chosen', '<SPAN CLASS="qa-uf-user-q-selects">1</SPAN>', '1') : qa_lang_html_sub('profile/x_with_best_chosen', '<SPAN CLASS="qa-uf-user-q-selects">' . number_format($userpoints['aselects']) . '</SPAN>');
}
if (@$userpoints['aselecteds']) {
$qa_content['form_activity']['fields']['answers']['value'] .= $userpoints['aselecteds'] == 1 ? qa_lang_html_sub('profile/1_chosen_as_best', '<SPAN CLASS="qa-uf-user-a-selecteds">1</SPAN>', '1') : qa_lang_html_sub('profile/x_chosen_as_best', '<SPAN CLASS="qa-uf-user-a-selecteds">' . number_format($userpoints['aselecteds']) . '</SPAN>');
}
// For plugin layers to access
$qa_content['raw']['userid'] = $userid;
$qa_content['raw']['points'] = $userpoints;
$qa_content['raw']['rank'] = $userrank;
// Recent posts by this user
if ($pagesize > 0) {
if (count($questions)) {
$qa_content['q_list']['title'] = qa_lang_html_sub('profile/recent_activity_by_x', $userhtml);
} else {
$qa_content['q_list']['title'] = qa_lang_html_sub('profile/no_posts_by_x', $userhtml);
}
$qa_content['q_list']['form_profile'] = array('tags' => 'METHOD="POST" ACTION="' . qa_self_html() . '"');
$qa_content['q_list']['qs'] = array();
$htmloptions = qa_post_html_defaults('Q');
$htmloptions['whoview'] = true;
//false;
$htmloptions['avatarsize'] = 0;
foreach ($questions as $question) {
$qa_content['q_list']['qs'][] = qa_any_to_q_html_fields($question, $loginuserid, qa_cookie_get(), $usershtml, null, $htmloptions);
}
}
return $qa_content;
/*
Omit PHP closing tag to help avoid accidental output
*/
示例13: process_request
function process_request($request)
{
// get all variables
preg_match($this->reqmatch, $request, $matches);
$post_type = $matches[1];
$handle = $matches[2];
$start = (int) qa_get('start');
$pagesize = qa_opt('page_size_qs');
$hidecss = qa_opt($this->cssopt) === '1';
// regular page request
$qa_content = qa_content_prepare();
require_once QA_INCLUDE_DIR . 'qa-util-string.php';
// display CSS for stat summary
if (!$hidecss) {
$qa_content['custom'] = "<style>\n" . ".qa-useract-page-links { margin: 16px 0; color: #555753; font-size: 16px; text-align: center; }\n" . ".qa-useract-page-links > a { font-weight: bold; }\n" . ".qa-useract-stats { margin: 8px 0; text-align: center; }\n" . ".qa-useract-stat { display: inline-block; margin: 0 16px 8px; }\n" . ".qa-useract-count { font-size: 18px; font-weight: bold; }\n" . ".qa-useract-wrapper .qa-q-item-main { width: 658px; }\n" . ".qa-useract-wrapper .qa-a-count { height: auto; border: 1px solid #ebeaca; border-radius: 8px; -moz-border-radius: 8px; -webkit-border-radius:8px; }\n" . ".qa-useract-wrapper .qa-a-snippet { margin-top: 2px; color: #555753; }\n" . ".qa-useract-wrapper .qa-q-item-meta { float: none; }\n" . "</style>\n\n";
}
// list of questions by this user
if ($post_type === 'questions') {
$qa_content['title'] = qa_lang_html_sub('useractivity/questions_by', $handle);
list($userid, $count, $sel_count) = $this->_questions_stats($handle);
// get questions
$columns = 'postid, categoryid, type, LEFT(type,1) AS basetype, INSTR(type,"_HIDDEN")>0 AS hidden, acount, selchildid, closedbyid, upvotes, downvotes, netvotes, hotness, flagcount, BINARY title AS title, BINARY tags AS tags, UNIX_TIMESTAMP(created) AS created';
$sql_questions = 'SELECT ' . $columns . ' FROM ^posts WHERE type="Q" AND userid=# ORDER BY created DESC LIMIT #,#';
$result = qa_db_query_sub($sql_questions, $userid, $start, $pagesize);
$questions = qa_db_read_all_assoc($result);
$htmloptions = qa_post_html_defaults('Q');
$htmloptions['whoview'] = false;
$htmloptions['avatarsize'] = 0;
// html for stats
$qa_content['custom'] .= '<div class="qa-useract-stats">' . ' <div class="qa-useract-stat"><span class="qa-useract-count">' . $count . '</span><br>' . ($count == 1 ? qa_lang_html('useractivity/question') : qa_lang_html('useractivity/questions')) . '</div>' . ' <div class="qa-useract-stat"><span class="qa-useract-count">' . $sel_count . '</span><br>' . ($sel_count == 1 ? qa_lang_html('useractivity/best_answer_given') : qa_lang_html('useractivity/best_answers_given')) . '</div>' . '</div>';
// create html for question list
$qa_content['q_list']['qs'] = array();
foreach ($questions as $question) {
$qa_content['q_list']['qs'][] = qa_any_to_q_html_fields($question, qa_get_logged_in_userid(), qa_cookie_get(), null, null, $htmloptions);
}
// pagination
$qa_content['page_links'] = qa_html_page_links($request, $start, $pagesize, $count, qa_opt('pages_prev_next'), null);
return $qa_content;
} else {
if ($post_type === 'answers') {
$qa_content['title'] = qa_lang_html_sub('useractivity/answers_by', $handle);
// userid and answer count
$sql_count = 'SELECT u.userid, count(a.postid) AS qs, sum(q.selchildid=a.postid) AS selected ' . 'FROM ^posts a, ^posts q, ^users u ' . 'WHERE a.parentid=q.postid AND u.userid=a.userid AND a.type="A" AND q.type="Q" AND u.handle=$';
$result = qa_db_query_sub($sql_count, $handle);
$row = qa_db_read_one_assoc($result);
$userid = $row['userid'];
$count = $row['qs'];
$sel_count = $row['selected'];
// get answers
$columns = 'q.postid AS qpostid, BINARY q.title AS qtitle, q.selchildid AS qselid, q.netvotes AS qvotes, a.postid AS apostid, BINARY a.content AS acontent, a.netvotes AS avotes, UNIX_TIMESTAMP(a.created) AS acreated, a.format';
$sql_answers = 'SELECT ' . $columns . ' FROM ^posts a, ^posts q WHERE a.parentid=q.postid AND a.type="A" AND q.type="Q" AND a.userid=# ORDER BY a.created DESC LIMIT #,#';
$result = qa_db_query_sub($sql_answers, $userid, $start, $pagesize);
$answers = qa_db_read_all_assoc($result);
$qa_content['custom'] .= '<div class="qa-useract-stats">' . ' <div class="qa-useract-stat"><span class="qa-useract-count">' . $count . '</span><br>' . ($count == 1 ? qa_lang_html('useractivity/answer') : qa_lang_html('useractivity/answers')) . '</div>' . ' <div class="qa-useract-stat"><span class="qa-useract-count">' . $sel_count . '</span><br>' . ($sel_count == 1 ? qa_lang_html('useractivity/best_answer_received') : qa_lang_html('useractivity/best_answers_received')) . '</div>' . '</div>';
$qa_content['custom_2'] = '<div class="qa-useract-wrapper">';
foreach ($answers as $ans) {
// to avoid ugly content, convert answer to HTML then strip the tags and remove any URLs
$ans['acontent'] = qa_viewer_html($ans['acontent'], $ans['format']);
$ans['acontent'] = strip_tags($ans['acontent']);
$ans['acontent'] = preg_replace('#\\shttp://[^\\s]+#', '', $ans['acontent']);
$ans['acontent'] = qa_substr($ans['acontent'], 0, 100);
if (strlen($ans['acontent']) == 100) {
$ans['acontent'] .= '...';
}
// question url
$ans['qurl'] = qa_path_html(qa_q_request($ans['qpostid'], $ans['qtitle']));
// answer date
$ans['acreated'] = qa_when_to_html($ans['acreated'], qa_opt('show_full_date_days'));
// html content
$qa_content['custom_2'] .= $this->_answer_tmpl($ans);
}
$qa_content['custom_2'] .= '</div>';
// pagination
$qa_content['page_links'] = qa_html_page_links($request, $start, $pagesize, $count, qa_opt('pages_prev_next'), null);
return $qa_content;
}
}
}
示例14: qa_match_to_min_score
if ($relatedcount > 1 && !$question['hidden']) {
$minscore = qa_match_to_min_score(qa_opt('match_related_qs'));
foreach ($relatedquestions as $key => $related) {
if ($related['postid'] == $questionid || $related['score'] < $minscore) {
// related questions will include itself so remove that
unset($relatedquestions[$key]);
}
}
if (count($relatedquestions)) {
$qa_content['q_list']['title'] = qa_lang('main/related_qs_title');
} else {
$qa_content['q_list']['title'] = qa_lang('main/no_related_qs_title');
}
$qa_content['q_list']['qs'] = array();
foreach ($relatedquestions as $related) {
$qa_content['q_list']['qs'][] = qa_post_html_fields($related, $qa_login_userid, $qa_cookieid, $usershtml, null, qa_post_html_defaults('Q'));
}
}
// Some generally useful stuff
if (qa_using_categories() && count($categories)) {
$qa_content['navigation']['cat'] = qa_category_navigation($categories, $question['categoryid']);
}
if (isset($jumptoanchor)) {
$qa_content['script_onloads'][] = array("window.location.hash=" . qa_js($jumptoanchor) . ";");
}
if (isset($focusonid)) {
$qa_content['script_onloads'][] = array("document.getElementById(" . qa_js($focusonid) . ").focus();");
}
// Determine whether the page view should be counted
if (qa_opt('do_count_q_views') && !$formrequested && !qa_is_http_post() && qa_is_human_probably() && (!$question['views'] || ($question['lastviewip'] != qa_remote_ip_address() || !isset($question['lastviewip'])) && ($question['createip'] != qa_remote_ip_address() || !isset($question['createip'])) && ($question['userid'] != $qa_login_userid || !isset($question['userid'])) && ($question['cookieid'] != $qa_cookieid || !isset($question['cookieid'])))) {
$qa_content['inc_views_postid'] = $questionid;
示例15: qa_page_q_comment_follow_list
function qa_page_q_comment_follow_list($parent, $commentsfollows, $alwaysfull, $usershtml, $formrequested, $formpostid)
{
$parentid = $parent['postid'];
$userid = qa_get_logged_in_userid();
$cookieid = qa_cookie_get();
$commentlist = array('tags' => 'ID="c' . qa_html($parentid) . '_list"', 'cs' => array());
$showcomments = array();
foreach ($commentsfollows as $commentfollowid => $commentfollow) {
if ($commentfollow['parentid'] == $parentid && $commentfollow['viewable'] && $commentfollowid != $formpostid) {
$showcomments[$commentfollowid] = $commentfollow;
}
}
$countshowcomments = count($showcomments);
if (!$alwaysfull && $countshowcomments > qa_opt('show_fewer_cs_from')) {
$skipfirst = $countshowcomments - qa_opt('show_fewer_cs_count');
} else {
$skipfirst = 0;
}
if ($skipfirst == $countshowcomments) {
// showing none
if ($skipfirst == 1) {
$expandtitle = qa_lang_html('question/show_1_comment');
} else {
$expandtitle = qa_lang_html_sub('question/show_x_comments', $skipfirst);
}
} else {
if ($skipfirst == 1) {
$expandtitle = qa_lang_html('question/show_1_previous_comment');
} else {
$expandtitle = qa_lang_html_sub('question/show_x_previous_comments', $skipfirst);
}
}
if ($skipfirst > 0) {
$commentlist['cs'][$parentid] = array('url' => qa_html('?state=showcomments-' . $parentid . '&show=' . $parentid . '#' . urlencode(qa_anchor($parent['basetype'], $parentid))), 'expand_tags' => 'onClick="return qa_show_comments(' . qa_js($parentid) . ', this);"', 'title' => $expandtitle);
}
foreach ($showcomments as $commentfollowid => $commentfollow) {
if ($skipfirst > 0) {
$skipfirst--;
} elseif ($commentfollow['basetype'] == 'C') {
$commentlist['cs'][$commentfollowid] = qa_page_q_comment_view($parent, $commentfollow, $usershtml, $formrequested);
} elseif ($commentfollow['basetype'] == 'Q') {
$htmloptions = qa_post_html_defaults('Q');
$htmloptions['avatarsize'] = qa_opt('avatar_q_page_c_size');
$commentlist['cs'][$commentfollowid] = qa_post_html_fields($commentfollow, $userid, $cookieid, $usershtml, null, $htmloptions);
}
}
if (!count($commentlist['cs'])) {
$commentlist['hidden'] = true;
}
return $commentlist;
}