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


PHP qa_favorite_form函数代码示例

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


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

示例1: 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;
}
开发者ID:kosmoluna,项目名称:question2answer,代码行数:53,代码来源:q-list.php

示例2: 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

示例3: qa_db_points_set_bonus

    require_once QA_INCLUDE_DIR . 'qa-db-points.php';
    qa_db_points_set_bonus($userid, (int) qa_post_text('bonus'));
    qa_db_points_update_ifuser($userid, null);
    qa_redirect(qa_request(), null, null, null, 'activity');
}
//	Get information on user references in answers and other stuff need for page
$pagesize = qa_opt('page_size_user_posts');
$questions = qa_any_sort_and_dedupe(array_merge($questions, $answerqs, $commentqs, $editqs));
$questions = array_slice($questions, 0, $pagesize);
$usershtml = qa_userids_handles_html(qa_any_get_userids_handles($questions));
$usershtml[$userid] = $userhtml;
//	Prepare content for theme
$qa_content = qa_content_prepare(true);
$qa_content['title'] = qa_lang_html_sub('profile/user_x', $userhtml);
if (isset($loginuserid) && !QA_FINAL_EXTERNAL_USERS) {
    $qa_content['favorite'] = qa_favorite_form(QA_ENTITY_USER, $useraccount['userid'], $favorite, qa_lang_sub($favorite ? 'main/remove_x_favorites' : 'users/add_user_x_favorites', $handle));
}
//	General information about the user, only available if we're using internal user management
if (!QA_FINAL_EXTERNAL_USERS) {
    $qa_content['form_profile'] = array('tags' => 'METHOD="POST" ACTION="' . qa_self_html() . '"', 'style' => 'wide', 'fields' => array('avatar' => array('type' => 'image', 'style' => 'tall', 'label' => '', 'html' => qa_get_user_avatar_html($useraccount['flags'], $useraccount['email'], $useraccount['handle'], $useraccount['avatarblobid'], $useraccount['avatarwidth'], $useraccount['avatarheight'], qa_opt('avatar_profile_size'))), 'removeavatar' => null, 'duration' => array('type' => 'static', 'label' => qa_lang_html('users/member_for'), 'value' => qa_html(qa_time_to_string(qa_opt('db_time') - $useraccount['created']))), 'level' => array('type' => 'static', 'label' => qa_lang_html('users/member_type'), 'tags' => 'NAME="level"', 'value' => qa_html(qa_user_level_string($useraccount['level'])), 'note' => $useraccount['flags'] & QA_USER_FLAGS_USER_BLOCKED && isset($maxlevelassign) ? qa_lang_html('users/user_blocked') : '')));
    if (empty($qa_content['form_profile']['fields']['avatar']['html'])) {
        unset($qa_content['form_profile']['fields']['avatar']);
    }
    //	Private message form
    if (qa_opt('allow_private_messages') && isset($loginuserid) && $loginuserid != $userid && !($useraccount['flags'] & QA_USER_FLAGS_NO_MESSAGES)) {
        $qa_content['form_profile']['fields']['level']['value'] .= strtr(qa_lang_html('profile/send_private_message'), array('^1' => '<A HREF="' . qa_path_html('message/' . $handle) . '">', '^2' => '</A>'));
    }
    //	Show any extra privileges due to user's level or their points
    $showpermits = array();
    $permitoptions = qa_get_permit_options();
    foreach ($permitoptions as $permitoption) {
开发者ID:ruuttt,项目名称:question2answer,代码行数:31,代码来源:qa-page-user.php

示例4: qa_get_logged_in_userid

$userid = qa_get_logged_in_userid();
//	Find the questions with this tag
if (!strlen($tag)) {
    qa_redirect('tags');
}
list($questions, $tagword) = 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));
$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)) {
    $favoritemap = qa_get_favorite_non_qs_map();
    $favorite = @$favoritemap['tag'][qa_strtolower($tagword['word'])];
    $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() . '"', 'hidden' => array('code' => qa_get_form_security_code('vote')));
$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_options($question));
}
$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)));
开发者ID:netham91,项目名称:question2answer,代码行数:31,代码来源:qa-page-tag.php

示例5: isset

    require QA_INCLUDE_DIR . 'pages/question-post.php';
}
$formrequested = isset($formtype);
if (!$formrequested && $question['answerbutton']) {
    $immedoption = qa_opt('show_a_form_immediate');
    if ($immedoption == 'always' || $immedoption == 'if_no_as' && !$question['isbyuser'] && !$question['acount']) {
        $formtype = 'a_add';
    }
    // show answer form by default
}
//	Get information on the users referenced
$usershtml = qa_userids_handles_html(array_merge(array($question), $answers, $commentsfollows), true);
//	Prepare content for theme
$qa_content = qa_content_prepare(true, array_keys(qa_category_path($categories, $question['categoryid'])));
if (isset($userid) && !$formrequested) {
    $qa_content['favorite'] = qa_favorite_form(QA_ENTITY_QUESTION, $questionid, $favorite, qa_lang($favorite ? 'question/remove_q_favorites' : 'question/add_q_favorites'));
}
$qa_content['script_rel'][] = 'qa-content/qa-question.js?' . QA_VERSION;
if (isset($pageerror)) {
    $qa_content['error'] = $pageerror;
} elseif ($question['queued']) {
    $qa_content['error'] = $question['isbyuser'] ? qa_lang_html('question/q_your_waiting_approval') : qa_lang_html('question/q_waiting_your_approval');
}
if ($question['hidden']) {
    $qa_content['hidden'] = true;
}
qa_sort_by($commentsfollows, 'created');
//	Prepare content for the question...
if ($formtype == 'q_edit') {
    // ...in edit mode
    $qa_content['title'] = qa_lang_html($question['editable'] ? 'question/edit_q_title' : (qa_using_categories() ? 'question/recat_q_title' : 'question/retag_q_title'));
开发者ID:nikhilkumar80,项目名称:question2answer,代码行数:31,代码来源:question.php

示例6: post_avatar

 function post_avatar($post, $class, $prefix = null)
 {
     if (qa_opt('it_layout_lists') == 'qlist') {
         qa_html_theme_base::post_avatar($post, $class, $prefix = null);
         return;
     }
     // check if it's a question list or question item
     if ($class != 'qa-q-item') {
         //if (!( ($this->template=='qa') or ($this->template=='questions') ))
         qa_html_theme_base::post_avatar($post, $class, $prefix);
     } else {
         $qlink = qa_q_path($post['raw']['postid'], $post['raw']['title'], true);
         $this->output('<div class="q-item-meta">');
         // set avatar
         if (isset($post['avatar'])) {
             if (isset($prefix)) {
                 $this->output($prefix);
             }
             $this->output('<section class="' . $class . '-avatar">' . $post['avatar']);
             $this->output('<section class="popup-user-avatar">');
             qa_html_theme_base::post_meta_what($post, $class);
             qa_html_theme_base::post_meta_who($post, $class);
             $this->output('</section>');
             $this->output('</section>');
         }
         // set category
         if ($post["raw"]["categoryid"]) {
             require_once QA_INCLUDE_DIR . 'qa-db-metas.php';
             $categoryid = $post["raw"]["categoryid"];
             $catname = $post["raw"]["categoryname"];
             $catbackpath = $post["raw"]["categorybackpath"];
             $et_category = json_decode(qa_db_categorymeta_get($categoryid, 'et_category'), true);
             $this->output('<section class="' . $class . '-category">');
             $categorypathprefix = 'questions/';
             $this->output('<a class="' . $class . '-category-link" title="' . $et_category['et_cat_title'] . '" href="' . qa_path_html($categorypathprefix . implode('/', array_reverse(explode('/', $catbackpath)))) . '">');
             if (!empty($et_category['et_cat_icon48'])) {
                 $this->output('<img class="qa-category-image" width="48" height="48" alt="' . $et_category['et_cat_desc'] . '" src="' . $et_category['et_cat_icon48'] . '">');
             } else {
                 $this->output(qa_html($catname));
             }
             $this->output('</a>');
             if (!empty($et_category['et_cat_desc'])) {
                 $this->output('<section class="' . $class . '-category-description">');
                 $this->output($et_category['et_cat_desc']);
                 $this->output('</section>');
             }
             $this->output('</section>');
         }
         $this->output('</div>');
         $this->output('<div class="qa-item-meta-bar">');
         // Voting
         $this->voting_inner_html($post);
         // favourites
         if (qa_is_logged_in()) {
             $favourited = $post['favourited'];
             $favorite = qa_favorite_form(QA_ENTITY_QUESTION, $post['raw']['postid'], $favourited, qa_lang($favourited ? 'question/remove_q_favorites' : 'question/add_q_favorites'));
             if (isset($favorite)) {
                 //$this->output('<form '.$favorite['form_tags'].'>');
                 $this->output('<div class="qa-favoriting qa-favoriting-' . $post['raw']['postid'] . '" ' . @$favorite['favorite_tags'] . '>');
                 $this->favorite_inner_html($favorite, $post['favourites']);
                 $this->output('</div>');
                 $this->output('<input type="hidden" id="fav_code_' . $post['raw']['postid'] . '" name="fav_code" value="' . @$favorite['form_hidden']['code'] . '"/>');
                 //$this->output('</form>');
             }
         } else {
             $this->output('<div class="qa-favoriting qa-favoriting-' . $post['raw']['postid'] . '" ' . @$favorite['favorite_tags'] . '>');
             $this->output('<button class="btn btn-default btn-xs fa fa-heart qa-favorite" type="button" onclick="return qa_favorite_click(this);" name="favorite-login_q' . $post['raw']['postid'] . '" title="Favourite">' . $post['favourites'] . '</button>');
             //<button class="btn btn-default btn-xs fa fa-heart qa-favorite" type="button" onclick="return qa_favorite_click(this);" name="favorite_Q_125_1" title="Add to my favorites">2</button>
             $this->output('</div>');
         }
         // discussions
         $this->output('<div class="qa-list-discussions">');
         $this->output('<a class="btn btn-default btn-xs fa fa-comment discussions-item-list" href="' . $qlink . '">' . ($post['comments'] + $post["answers_raw"]) . '</a>');
         $this->output('</div>');
         // Share
         $this->output('<div class="qa-list-share">');
         $this->output('<button type="button" class="btn btn-default btn-xs fa fa-share-alt share-item-list" data-share-link="' . $qlink . '" data-share-title="' . $post['raw']['title'] . '"></button>');
         $this->output('</div>');
         $this->output('</div>');
     }
     //qa_html_theme_base::voting_inner_html($post);
 }
开发者ID:swuit,项目名称:swuit-q2a,代码行数:82,代码来源:qa-layer-base.php


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