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


PHP qa_load_theme_class函数代码示例

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


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

示例1: 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-app-users.php';
require_once QA_INCLUDE_DIR . 'qa-app-cookies.php';
require_once QA_INCLUDE_DIR . 'qa-app-favorites.php';
require_once QA_INCLUDE_DIR . 'qa-app-format.php';
$entitytype = qa_post_text('entitytype');
$entityid = qa_post_text('entityid');
$setfavorite = qa_post_text('favorite');
$userid = qa_get_logged_in_userid();
if (!qa_check_form_security_code('favorite-' . $entitytype . '-' . $entityid, qa_post_text('code'))) {
    echo "QA_AJAX_RESPONSE\n0\n" . qa_lang('misc/form_security_reload');
} elseif (isset($userid)) {
    $cookieid = qa_cookie_get();
    qa_user_favorite_set($userid, qa_get_logged_in_handle(), $cookieid, $entitytype, $entityid, $setfavorite);
    $favoriteform = qa_favorite_form($entitytype, $entityid, $setfavorite, qa_lang($setfavorite ? 'main/remove_favorites' : 'main/add_favorites'));
    $themeclass = qa_load_theme_class(qa_get_site_theme(), 'ajax-favorite', null, null);
    echo "QA_AJAX_RESPONSE\n1\n";
    $themeclass->favorite_inner_html($favoriteform);
}
/*
	Omit PHP closing tag to help avoid accidental output
*/
开发者ID:mostafiz93,项目名称:PrintfScanf,代码行数:31,代码来源:qa-ajax-favorite.php

示例2: qa_post_text

$parentid = qa_post_text('parentid');
$userid = qa_get_logged_in_userid();
list($comment, $question, $parent, $children) = qa_db_select_with_pending(qa_db_full_post_selectspec($userid, $commentid), qa_db_full_post_selectspec($userid, $questionid), qa_db_full_post_selectspec($userid, $parentid), qa_db_full_child_posts_selectspec($userid, $parentid));
//	Check if there was an operation that succeeded
if (@$comment['basetype'] == 'C' && @$question['basetype'] == 'Q' && (@$parent['basetype'] == 'Q' || @$parent['basetype'] == 'A')) {
    $comment = $comment + qa_page_q_post_rules($comment, $parent, $children, null);
    // array union
    if (qa_page_q_single_click_c($comment, $question, $parent, $error)) {
        $comment = qa_db_select_with_pending(qa_db_full_post_selectspec($userid, $commentid));
        //	If so, page content to be updated via Ajax
        echo "QA_AJAX_RESPONSE\n1";
        //	If the comment was not deleted...
        if (isset($comment)) {
            $parent = $parent + qa_page_q_post_rules($parent, $questionid == $parentid ? null : $question, null, $children);
            // in theory we should retrieve the parent's siblings for the above, but they're not going to be relevant
            $comment = $comment + qa_page_q_post_rules($comment, $parent, $children, null);
            $usershtml = qa_userids_handles_html(array($comment), true);
            $c_view = qa_page_q_comment_view($question, $parent, $comment, $usershtml, false);
            $themeclass = qa_load_theme_class(qa_get_site_theme(), 'ajax-comment', null, null);
            //	... send back the HTML for it
            echo "\n";
            $themeclass->c_list_item($c_view);
        }
        return;
    }
}
echo "QA_AJAX_RESPONSE\n0\n";
// fall back to non-Ajax submission if something failed
/*
	Omit PHP closing tag to help avoid accidental output
*/
开发者ID:GitFuture,项目名称:bmf,代码行数:31,代码来源:click-comment.php

示例3: qa_post_text

require_once QA_INCLUDE_DIR . 'app/users.php';
require_once QA_INCLUDE_DIR . 'app/cookies.php';
require_once QA_INCLUDE_DIR . 'db/selects.php';
$message = qa_post_text('message');
$tohandle = qa_post_text('handle');
$morelink = qa_post_text('morelink');
$touseraccount = qa_db_select_with_pending(qa_db_user_account_selectspec($tohandle, false));
$loginuserid = qa_get_logged_in_userid();
$errorhtml = qa_wall_error_html($loginuserid, $touseraccount['userid'], $touseraccount['flags']);
if ($errorhtml || !strlen($message) || !qa_check_form_security_code('wall-' . $tohandle, qa_post_text('code'))) {
    echo "QA_AJAX_RESPONSE\n0";
} else {
    $messageid = qa_wall_add_post($loginuserid, qa_get_logged_in_handle(), qa_cookie_get(), $touseraccount['userid'], $touseraccount['handle'], $message, '');
    $touseraccount['wallposts']++;
    // won't have been updated
    $usermessages = qa_db_select_with_pending(qa_db_recent_messages_selectspec(null, null, $touseraccount['userid'], true, qa_opt('page_size_wall')));
    $usermessages = qa_wall_posts_add_rules($usermessages, 0);
    $themeclass = qa_load_theme_class(qa_get_site_theme(), 'wall', null, null);
    echo "QA_AJAX_RESPONSE\n1\n";
    echo 'm' . $messageid . "\n";
    // element in list to be revealed
    foreach ($usermessages as $message) {
        $themeclass->message_item(qa_wall_post_view($message));
    }
    if ($morelink && $touseraccount['wallposts'] > count($usermessages)) {
        $themeclass->message_item(qa_wall_view_more_link($tohandle, count($usermessages)));
    }
}
/*
	Omit PHP closing tag to help avoid accidental output
*/
开发者ID:Trideon,项目名称:gigolo,代码行数:31,代码来源:wallpost.php

示例4: qa_post_text

*/
require_once QA_INCLUDE_DIR . 'qa-app-users.php';
require_once QA_INCLUDE_DIR . 'qa-app-cookies.php';
require_once QA_INCLUDE_DIR . 'qa-app-votes.php';
require_once QA_INCLUDE_DIR . 'qa-app-format.php';
require_once QA_INCLUDE_DIR . 'qa-app-options.php';
require_once QA_INCLUDE_DIR . 'qa-db-selects.php';
$postid = qa_post_text('postid');
$vote = qa_post_text('vote');
$code = qa_post_text('code');
$userid = qa_get_logged_in_userid();
$cookieid = qa_cookie_get();
if (!qa_check_form_security_code('vote', $code)) {
    $voteerror = qa_lang_html('misc/form_security_reload');
} else {
    $post = qa_db_select_with_pending(qa_db_full_post_selectspec($userid, $postid));
    $voteerror = qa_vote_error_html($post, $vote, $userid, qa_request());
}
if ($voteerror === false) {
    qa_vote_set($post, $userid, qa_get_logged_in_handle(), $cookieid, $vote);
    $post = qa_db_select_with_pending(qa_db_full_post_selectspec($userid, $postid));
    $fields = qa_post_html_fields($post, $userid, $cookieid, array(), null, array('voteview' => qa_get_vote_view($post, true)));
    $themeclass = qa_load_theme_class(qa_get_site_theme(), 'voting', null, null);
    echo "QA_AJAX_RESPONSE\n1\n";
    $themeclass->voting_inner_html($fields);
} else {
    echo "QA_AJAX_RESPONSE\n0\n" . $voteerror;
}
/*
	Omit PHP closing tag to help avoid accidental output
*/
开发者ID:gogupe,项目名称:question2answer-releases,代码行数:31,代码来源:qa-ajax-vote.php

示例5: qa_get_logged_in_userid

    $userid = qa_get_logged_in_userid();
    list($question, $childposts) = qa_db_select_with_pending(qa_db_full_post_selectspec($userid, $questionid), qa_db_full_child_posts_selectspec($userid, $questionid));
    if (@$question['basetype'] == 'Q' && !isset($question['closedbyid'])) {
        $answers = qa_page_q_load_as($question, $childposts);
        //	Try to create the new answer
        $answerid = qa_page_q_add_a_submit($question, $answers, $usecaptcha, $in, $errors);
        $countanswers = $question['acount'] + 1;
        if (isset($answerid)) {
            //	If successful, page content will be updated via Ajax
            $answer = qa_db_select_with_pending(qa_db_full_post_selectspec($userid, $answerid));
            $question = $question + qa_page_q_post_rules($question, null, null, $childposts);
            // array union
            $answer = $answer + qa_page_q_post_rules($answer, $question, $answers, null);
            $usershtml = qa_userids_handles_html(array($answer), true);
            $a_view = qa_page_q_answer_view($question, $answer, false, $usershtml, false);
            $themeclass = qa_load_theme_class(qa_get_site_theme(), 'ajax-answer', null, null);
            echo "QA_AJAX_RESPONSE\n1\n";
            //	Send back whether the 'answer' button should still be visible
            echo (int) qa_opt('allow_multi_answers') . "\n";
            //	Send back the count of answers
            if ($countanswers == 1) {
                echo qa_lang_html('question/1_answer_title') . "\n";
            } else {
                echo qa_lang_html_sub('question/x_answers_title', $countanswers) . "\n";
            }
            //	Send back the HTML
            $themeclass->a_list_item($a_view);
            return;
        }
    }
}
开发者ID:mathjoy,项目名称:math-duodaa,代码行数:31,代码来源:qa-ajax-answer.php

示例6: qa_output_content


//.........这里部分代码省略.........
        if (!is_array($navigation) || $navtype == 'cat') {
            continue;
        }
        foreach ($navigation as $navprefix => $navlink) {
            $selected =& $qa_content['navigation'][$navtype][$navprefix]['selected'];
            if (isset($navlink['selected_on'])) {
                // match specified paths
                foreach ($navlink['selected_on'] as $path) {
                    if (strpos($requestlower . '$', $path) === 0) {
                        $selected = true;
                    }
                }
            } elseif ($requestlower === $navprefix || $requestlower . '$' === $navprefix) {
                // exact match for array key
                $selected = true;
            }
        }
    }
    //	Slide down notifications
    if (!empty($qa_content['notices'])) {
        foreach ($qa_content['notices'] as $notice) {
            $qa_content['script_onloads'][] = array("qa_reveal(document.getElementById(" . qa_js($notice['id']) . "), 'notice');");
        }
    }
    //	Handle maintenance mode
    if (qa_opt('site_maintenance') && $requestlower != 'login') {
        if (qa_get_logged_in_level() >= QA_USER_LEVEL_ADMIN) {
            if (!isset($qa_content['error'])) {
                $qa_content['error'] = strtr(qa_lang_html('admin/maintenance_admin_only'), array('^1' => '<a href="' . qa_path_html('admin/general') . '">', '^2' => '</a>'));
            }
        } else {
            $qa_content = qa_content_prepare();
            $qa_content['error'] = qa_lang_html('misc/site_in_maintenance');
        }
    }
    //	Handle new users who must confirm their email now, or must be approved before continuing
    $userid = qa_get_logged_in_userid();
    if (isset($userid) && $requestlower != 'confirm' && $requestlower != 'account') {
        $flags = qa_get_logged_in_flags();
        if ($flags & QA_USER_FLAGS_MUST_CONFIRM && !($flags & QA_USER_FLAGS_EMAIL_CONFIRMED) && qa_opt('confirm_user_emails')) {
            $qa_content = qa_content_prepare();
            $qa_content['title'] = qa_lang_html('users/confirm_title');
            $qa_content['error'] = strtr(qa_lang_html('users/confirm_required'), array('^1' => '<a href="' . qa_path_html('confirm') . '">', '^2' => '</a>'));
        } elseif ($flags & QA_USER_FLAGS_MUST_APPROVE && qa_get_logged_in_level() < QA_USER_LEVEL_APPROVED && qa_opt('moderate_users')) {
            $qa_content = qa_content_prepare();
            $qa_content['title'] = qa_lang_html('users/approve_title');
            $qa_content['error'] = strtr(qa_lang_html('users/approve_required'), array('^1' => '<a href="' . qa_path_html('account') . '">', '^2' => '</a>'));
        }
    }
    //	Combine various Javascript elements in $qa_content into single array for theme layer
    $script = array('<script>');
    if (isset($qa_content['script_var'])) {
        foreach ($qa_content['script_var'] as $var => $value) {
            $script[] = 'var ' . $var . ' = ' . qa_js($value) . ';';
        }
    }
    if (isset($qa_content['script_lines'])) {
        foreach ($qa_content['script_lines'] as $scriptlines) {
            $script[] = '';
            $script = array_merge($script, $scriptlines);
        }
    }
    if (isset($qa_content['focusid'])) {
        $qa_content['script_onloads'][] = array("var elem = document.getElementById(" . qa_js($qa_content['focusid']) . ");", "if (elem) {", "\telem.select();", "\telem.focus();", "}");
    }
    if (isset($qa_content['script_onloads'])) {
        array_push($script, '', 'var qa_oldonload = window.onload;', 'window.onload = function() {', "\tif (typeof qa_oldonload == 'function')", "\t\tqa_oldonload();");
        foreach ($qa_content['script_onloads'] as $scriptonload) {
            $script[] = "\t";
            foreach ((array) $scriptonload as $scriptline) {
                $script[] = "\t" . $scriptline;
            }
        }
        $script[] = '};';
    }
    $script[] = '</script>';
    if (isset($qa_content['script_rel'])) {
        $uniquerel = array_unique($qa_content['script_rel']);
        // remove any duplicates
        foreach ($uniquerel as $script_rel) {
            $script[] = '<script src="' . qa_html(qa_path_to_root() . $script_rel) . '"></script>';
        }
    }
    if (isset($qa_content['script_src'])) {
        $uniquesrc = array_unique($qa_content['script_src']);
        // remove any duplicates
        foreach ($uniquesrc as $script_src) {
            $script[] = '<script src="' . qa_html($script_src) . '"></script>';
        }
    }
    $qa_content['script'] = $script;
    //	Load the appropriate theme class and output the page
    $tmpl = substr($qa_template, 0, 7) == 'custom-' ? 'custom' : $qa_template;
    $themeclass = qa_load_theme_class(qa_get_site_theme(), $tmpl, $qa_content, qa_request());
    $themeclass->initialize();
    header('Content-type: ' . $qa_content['content_type']);
    $themeclass->doctype();
    $themeclass->html();
    $themeclass->finish();
}
开发者ID:Trideon,项目名称:gigolo,代码行数:101,代码来源:qa-page.php

示例7: qa_ajax_vote_db_fail_handler

require_once QA_INCLUDE_DIR . 'qa-app-users.php';
require_once QA_INCLUDE_DIR . 'qa-app-cookies.php';
require_once QA_INCLUDE_DIR . 'qa-app-votes.php';
require_once QA_INCLUDE_DIR . 'qa-app-format.php';
require_once QA_INCLUDE_DIR . 'qa-app-options.php';
require_once QA_INCLUDE_DIR . 'qa-db-selects.php';
function qa_ajax_vote_db_fail_handler()
{
    echo "QA_AJAX_RESPONSE\n0\nA database error occurred.";
    exit;
}
qa_base_db_connect('qa_ajax_vote_db_fail_handler');
$postid = qa_post_text('postid');
$qa_login_userid = qa_get_logged_in_userid();
$qa_cookieid = qa_cookie_get();
$post = qa_db_select_with_pending(qa_db_full_post_selectspec($qa_login_userid, $postid));
$voteerror = qa_vote_error_html($post, $qa_login_userid, $qa_request);
if ($voteerror === false) {
    qa_vote_set($post, $qa_login_userid, qa_get_logged_in_handle(), $qa_cookieid, qa_post_text('vote'));
    $post = qa_db_select_with_pending(qa_db_full_post_selectspec($qa_login_userid, $postid));
    $fields = qa_post_html_fields($post, $qa_login_userid, $qa_cookieid, array(), null, array('voteview' => qa_opt('votes_separated') ? 'updown' : 'net'));
    $themeclass = qa_load_theme_class(qa_opt('site_theme'), 'voting', null, null);
    echo "QA_AJAX_RESPONSE\n1\n";
    $themeclass->voting_inner_html($fields);
} else {
    echo "QA_AJAX_RESPONSE\n0\n" . $voteerror;
}
qa_base_db_disconnect();
/*
	Omit PHP closing tag to help avoid accidental output
*/
开发者ID:TheProjecter,项目名称:microprobe,代码行数:31,代码来源:qa-ajax-vote.php

示例8: array_unique

 $script[] = '//--></SCRIPT>';
 if (isset($qa_content['script_rel'])) {
     $uniquerel = array_unique($qa_content['script_rel']);
     // remove any duplicates
     foreach ($uniquerel as $script_rel) {
         $script[] = '<SCRIPT SRC="' . qa_html($qa_root_url_relative . $script_rel) . '" TYPE="text/javascript"></SCRIPT>';
     }
 }
 if (isset($qa_content['script_src'])) {
     foreach ($qa_content['script_src'] as $script_src) {
         $script[] = '<SCRIPT SRC="' . qa_html($script_src) . '" TYPE="text/javascript"></SCRIPT>';
     }
 }
 $qa_content['script'] = $script;
 //	Load the appropriate theme class and output the page
 $themeclass = qa_load_theme_class(qa_opt('site_theme'), $qa_template, $qa_content, $qa_request);
 header('Content-type: ' . $qa_content['content_type']);
 $themeclass->doctype();
 $themeclass->html();
 $themeclass->finish();
 //	End of output phase
 if (QA_DEBUG_PERFORMANCE) {
     qa_usage_mark('theme');
 }
 //	Increment question view counter (do at very end so page can be output first)
 if (isset($qa_content['inc_views_postid'])) {
     require_once QA_INCLUDE_DIR . 'qa-db-hotness.php';
     qa_db_hotness_update($qa_content['inc_views_postid'], null, true);
     if (QA_DEBUG_PERFORMANCE) {
         qa_usage_mark('stats');
     }
开发者ID:TheProjecter,项目名称:microprobe,代码行数:31,代码来源:qa-page.php

示例9: array

            break;
        }
        $exampletags[] = $tag;
        if (count($exampletags) >= $maxcount) {
            break;
        }
    }
} else {
    $exampletags = array();
}
//	Output the response header and example tags
echo "QA_AJAX_RESPONSE\n1\n";
echo strtr(qa_html(implode(',', $exampletags)), "\r\n", '  ') . "\n";
//	Collect and output the list of related questions
if ($doaskcheck) {
    $minscore = qa_match_to_min_score(qa_opt('match_ask_check_qs'));
    $maxcount = qa_opt('page_size_ask_check_qs');
    $relatedquestions = array_slice($relatedquestions, 0, $maxcount);
    $limitedquestions = array();
    foreach ($relatedquestions as $question) {
        if ($question['score'] < $minscore) {
            break;
        }
        $limitedquestions[] = $question;
    }
    $themeclass = qa_load_theme_class(qa_get_site_theme(), 'ajax-asktitle', null, null);
    $themeclass->q_ask_similar($limitedquestions, qa_lang_html('question/ask_same_q'));
}
/*
	Omit PHP closing tag to help avoid accidental output
*/
开发者ID:GitFuture,项目名称:bmf,代码行数:31,代码来源:asktitle.php


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