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


PHP qa_category_path函数代码示例

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


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

示例1: qa_create_event_for_category

function qa_create_event_for_category($categoryid, $questionid, $updatetype, $lastuserid, $timestamp = null)
{
    if (isset($categoryid)) {
        require_once QA_INCLUDE_DIR . 'db/selects.php';
        require_once QA_INCLUDE_DIR . 'app/format.php';
        $categories = qa_category_path(qa_db_single_select(qa_db_category_nav_selectspec($categoryid, true)), $categoryid);
        foreach ($categories as $category) {
            qa_db_event_create_for_entity(QA_ENTITY_CATEGORY, $category['categoryid'], $questionid, $questionid, $updatetype, $lastuserid, $timestamp);
        }
    }
}
开发者ID:swuit,项目名称:swuit-q2a,代码行数:11,代码来源:events.php

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

示例3: 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;
}
开发者ID:TheProjecter,项目名称:microprobe,代码行数:40,代码来源:qa-app-q-list.php

示例4: qa_captcha_validate_post

        }
        if ($captchareason) {
            require_once 'qa-app-captcha.php';
            qa_captcha_validate_post($errors);
        }
        if (empty($errors)) {
            $cookieid = isset($userid) ? qa_cookie_get() : qa_cookie_get_create();
            // create a new cookie if necessary
            $questionid = qa_question_create($followanswer, $userid, qa_get_logged_in_handle(), $cookieid, $in['title'], $in['content'], $in['format'], $in['text'], qa_tags_to_tagstring($in['tags']), $in['notify'], $in['email'], $in['categoryid'], $in['extra'], $in['queued'], $in['name']);
            qa_redirect(qa_q_request($questionid, $in['title']));
            // our work is done here
        }
    }
}
//	Prepare content for theme
$qa_content = qa_content_prepare(false, array_keys(qa_category_path($categories, @$in['categoryid'])));
$qa_content['title'] = qa_lang_html(isset($followanswer) ? 'question/ask_follow_title' : 'question/ask_title');
$qa_content['error'] = @$errors['page'];
$editorname = isset($in['editor']) ? $in['editor'] : qa_opt('editor_for_qs');
$editor = qa_load_editor(@$in['content'], @$in['format'], $editorname);
$field = qa_editor_load_field($editor, $qa_content, @$in['content'], @$in['format'], 'content', 12, false);
$field['label'] = qa_lang_html('question/q_content_label');
$field['error'] = qa_html(@$errors['content']);
$custom = qa_opt('show_custom_ask') ? trim(qa_opt('custom_ask')) : '';
$qa_content['form'] = array('tags' => 'name="ask" method="post" action="' . qa_self_html() . '"', 'style' => 'tall', 'fields' => array('custom' => array('type' => 'custom', 'note' => $custom), 'title' => array('label' => qa_lang_html('question/q_title_label'), 'tags' => 'name="title" id="title" autocomplete="off"', 'value' => qa_html(@$in['title']), 'error' => qa_html(@$errors['title'])), 'similar' => array('type' => 'custom', 'html' => '<span id="similar"></span>'), 'content' => $field), 'buttons' => array('ask' => array('tags' => 'onclick="qa_show_waiting_after(this, false); ' . (method_exists($editor, 'update_script') ? $editor->update_script('content') : '') . '"', 'label' => qa_lang_html('question/ask_button'))), 'hidden' => array('editor' => qa_html($editorname), 'code' => qa_get_form_security_code('ask'), 'doask' => '1'));
if (!strlen($custom)) {
    unset($qa_content['form']['fields']['custom']);
}
if (qa_opt('do_ask_check_qs') || qa_opt('do_example_tags')) {
    $qa_content['script_rel'][] = 'qa-content/qa-ask.js?' . QA_VERSION;
    $qa_content['form']['fields']['title']['tags'] .= ' onchange="qa_title_change(this.value);"';
开发者ID:mostafiz93,项目名称:PrintfScanf,代码行数:31,代码来源:qa-page-ask.php

示例5: 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 (array_key_exists('categoryid', $in)) {
        // need to check if we can move it to that category, and if we need moderation
        $categories = qa_db_select_with_pending(qa_db_category_nav_selectspec($in['categoryid'], true));
        $categoryids = array_keys(qa_category_path($categories, $in['categoryid']));
        $userlevel = qa_user_level_for_categories($categoryids);
    } else {
        $userlevel = null;
    }
    if ($question['isbyuser']) {
        $in['name'] = qa_post_text('q_name');
        $in['notify'] = qa_post_text('q_notify') ? true : false;
        $in['email'] = qa_post_text('q_email');
    }
    if (!qa_user_post_permit_error('permit_edit_silent', $question)) {
        $in['silent'] = qa_post_text('q_silent');
    }
    // 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();
    if (!qa_check_form_security_code('edit-' . $question['postid'], qa_post_text('code'))) {
        $errors['page'] = qa_lang_html('misc/form_security_again');
    } else {
        $in['queued'] = qa_opt('moderate_edited_again') && qa_user_moderation_reason($userlevel);
        $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 (array_key_exists('categoryid', $in) && strcmp($in['categoryid'], $question['categoryid'])) {
            if (qa_user_permit_error('permit_post_q', null, $userlevel)) {
                $errors['categoryid'] = qa_lang_html('question/category_ask_not_allowed');
            }
        }
        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'];
            }
            if (!isset($in['silent'])) {
                $in['silent'] = false;
            }
            $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'], @$in['name'], $in['queued'], $in['silent']);
            if (qa_using_categories() && strcmp($in['categoryid'], $question['categoryid'])) {
                qa_question_set_category($question, $in['categoryid'], $userid, $handle, $cookieid, $answers, $commentsfollows, $closepost, $in['silent']);
            }
            return true;
        }
    }
    return false;
}
开发者ID:netham91,项目名称:question2answer,代码行数:83,代码来源:qa-page-question-post.php

示例6: qa_set_up_category_field

function qa_set_up_category_field(&$qa_content, &$field, $fieldname, $navcategories, $categoryid, $allownone, $allownosub, $maxdepth = null, $excludecategoryid = null)
{
    $pathcategories = qa_category_path($navcategories, $categoryid);
    $startpath = '';
    foreach ($pathcategories as $category) {
        $startpath .= '/' . $category['categoryid'];
    }
    if (isset($maxdepth)) {
        $maxdepth = min(QA_CATEGORY_DEPTH, $maxdepth);
    } else {
        $maxdepth = QA_CATEGORY_DEPTH;
    }
    $qa_content['script_rel'][] = 'qa-content/qa-ask.js?' . QA_VERSION;
    $qa_content['script_onloads'][] = sprintf('qa_category_select(%s, %s);', qa_js($fieldname), qa_js($startpath));
    $qa_content['script_var']['qa_cat_exclude'] = $excludecategoryid;
    $qa_content['script_var']['qa_cat_allownone'] = (int) $allownone;
    $qa_content['script_var']['qa_cat_allownosub'] = (int) $allownosub;
    $qa_content['script_var']['qa_cat_maxdepth'] = $maxdepth;
    $field['type'] = 'select';
    $field['tags'] = sprintf('name="%s_0" id="%s_0" onchange="qa_category_select(%s);"', $fieldname, $fieldname, qa_js($fieldname));
    $field['options'] = array();
    // create the menu that will be shown if Javascript is disabled
    if ($allownone) {
        $field['options'][''] = qa_lang_html('main/no_category');
    }
    // this is also copied to first menu created by Javascript
    $keycategoryids = array();
    if ($allownosub) {
        $category = @$navcategories[$categoryid];
        $upcategory = @$navcategories[$category['parentid']];
        // first get supercategories
        while (isset($upcategory)) {
            $keycategoryids[$upcategory['categoryid']] = true;
            $upcategory = @$navcategories[$upcategory['parentid']];
        }
        $keycategoryids = array_reverse($keycategoryids, true);
        $depth = count($keycategoryids);
        // number of levels above
        if (isset($category)) {
            $depth++;
            // to count category itself
            foreach ($navcategories as $navcategory) {
                // now get siblings and self
                if (!strcmp($navcategory['parentid'], $category['parentid'])) {
                    $keycategoryids[$navcategory['categoryid']] = true;
                }
            }
        }
        if ($depth < $maxdepth) {
            foreach ($navcategories as $navcategory) {
                // now get children, if not too deep
                if (!strcmp($navcategory['parentid'], $categoryid)) {
                    $keycategoryids[$navcategory['categoryid']] = true;
                }
            }
        }
    } else {
        $haschildren = false;
        foreach ($navcategories as $navcategory) {
            // check if it has any children
            if (!strcmp($navcategory['parentid'], $categoryid)) {
                $haschildren = true;
                break;
            }
        }
        if (!$haschildren) {
            $keycategoryids[$categoryid] = true;
        }
        // show this category if it has no children
    }
    foreach ($keycategoryids as $keycategoryid => $dummy) {
        if (strcmp($keycategoryid, $excludecategoryid)) {
            $field['options'][$keycategoryid] = qa_category_path_html($navcategories, $keycategoryid);
        }
    }
    $field['value'] = @$field['options'][$categoryid];
    $field['note'] = '<div id="' . $fieldname . '_note">' . '<noscript style="color:red;">' . qa_lang_html('question/category_js_note') . '</noscript>' . '</div>';
}
开发者ID:amiyasahu,项目名称:question2answer,代码行数:78,代码来源:format.php

示例7: isset

         $positionoptions[$category['position']] = $positionhtml;
         if (!strcmp($category['categoryid'], @$editcategory['categoryid'])) {
             $passedself = true;
         }
         $previous = $category;
     }
 }
 if (isset($editcategory['position'])) {
     $positionvalue = $positionoptions[$editcategory['position']];
 } else {
     $positionvalue = isset($previous) ? qa_lang_html_sub('admin/after_x', qa_html($previous['title'])) : qa_lang_html('admin/first');
     $positionoptions[1 + @max(array_keys($positionoptions))] = $positionvalue;
 }
 $qa_content['form']['fields']['position'] = array('id' => 'position_display', 'tags' => 'name="position"', 'label' => qa_lang_html('admin/position'), 'type' => 'select', 'options' => $positionoptions, 'value' => $positionvalue);
 if (isset($editcategory['categoryid'])) {
     $catdepth = count(qa_category_path($categories, $editcategory['categoryid']));
     if ($catdepth < QA_CATEGORY_DEPTH) {
         $childrenhtml = '';
         foreach ($categories as $category) {
             if (!strcmp($category['parentid'], $editcategory['categoryid'])) {
                 $childrenhtml .= (strlen($childrenhtml) ? ', ' : '') . '<a href="' . qa_path_html(qa_request(), array('edit' => $category['categoryid'])) . '">' . qa_html($category['title']) . '</a>' . ' (' . $category['qcount'] . ')';
             }
         }
         if (!strlen($childrenhtml)) {
             $childrenhtml = qa_lang_html('admin/category_no_subs');
         }
         $childrenhtml .= ' - <a href="' . qa_path_html(qa_request(), array('addsub' => $editcategory['categoryid'])) . '" style="white-space: nowrap;"><b>' . qa_lang_html('admin/category_add_sub') . '</b></a>';
         $qa_content['form']['fields']['children'] = array('id' => 'children_display', 'label' => qa_lang_html('admin/category_subs'), 'type' => 'static', 'value' => $childrenhtml);
     } else {
         $qa_content['form']['fields']['name']['note'] = qa_lang_html_sub('admin/category_no_add_subs_x', QA_CATEGORY_DEPTH);
     }
开发者ID:kosmoluna,项目名称:question2answer,代码行数:31,代码来源:admin-categories.php

示例8: isset

}
if (qa_is_http_post() || strlen($pagestate)) {
    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') {
开发者ID:nikhilkumar80,项目名称:question2answer,代码行数:31,代码来源:question.php


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