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


PHP qa_q_path函数代码示例

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


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

示例1: process_event

 public function process_event($event, $userid, $handle, $cookieid, $params)
 {
     switch ($event) {
         case 'q_post':
             $this->send_hipchat_notification($this->build_new_question_message(isset($handle) ? $handle : qa_lang('main/anonymous'), $params['title'], qa_q_path($params['postid'], $params['title'], true)));
             break;
         case 'a_post':
             $parentpost = qa_post_get_full($params['parentid']);
             $this->send_hipchat_notification($this->build_new_answer_message(isset($handle) ? $handle : qa_lang('main/anonymous'), $parentpost['title'], qa_path(qa_q_request($params['parentid'], $parentpost['title']), null, qa_opt('site_url'), null, qa_anchor('A', $params['postid']))));
             break;
     }
 }
开发者ID:jereze,项目名称:qa-hipchat-notifications,代码行数:12,代码来源:qa-hipchat-notifications-event.php

示例2: sendEmail

 function sendEmail($event, $userid, $handle, $params)
 {
     $email = $this->getEmail($userid);
     if ($email == qa_opt('feedback_email')) {
         return;
     }
     $parent = qa_db_read_one_assoc(qa_db_query_sub('SELECT * FROM ^posts WHERE postid=#', $params['parentid']), true);
     if ($parent['type'] == 'A') {
         $parent = qa_db_read_one_assoc(qa_db_query_sub('SELECT * FROM ^posts WHERE postid=#', $parent['parentid']), true);
     }
     $url = qa_q_path($parent['postid'], $parent['title'], true, $event == 'a_post' ? 'A' : 'C', $params['postid']);
     $title = $parent['title'];
     $type = $event == 'a_post' ? 'answer' : 'comment';
     $subs = array();
     qa_send_notification(null, qa_opt('feedback_email'), null, qa_lang('admin_plus/posted_subject'), qa_lang('admin_plus/posted_body'), array('^post_handle' => isset($handle) ? $handle : qa_lang('main/anonymous'), '^post_type' => $type, '^post_title' => $title, '^post_content' => $params['content'], '^site_url' => qa_opt('site_url'), '^url' => $url));
 }
开发者ID:NoahY,项目名称:q2a-admin-plus,代码行数:16,代码来源:qa-admin-check.php

示例3: logged_in

    function logged_in()
    {
        if (qa_get_logged_in_userid()) {
            if ($this->template == "question") {
                $qnum = qa_request_part("0");
                qa_db_query_sub("UPDATE ^userevents SET lastview = NOW() WHERE questionid = {$qnum} AND userid = " . qa_get_logged_in_userid());
            }
            $questions = qa_db_read_all_assoc(qa_db_query_sub("SELECT DISTINCT(questionid), lastpostid FROM ^userevents WHERE lastview < updated OR lastview IS NULL"));
            $count = count($questions);
            $notifyclass = "qa-notification-none";
            if ($count > 0) {
                $notifyclass = "qa-notification-new";
            }
            $this->output('
				<span class="qa-notification-counter ' . $notifyclass . '">' . $count . '</span>
				');
            $this->output('<div class="qa-notification-dialog">');
            foreach ($questions as $question) {
                $q = qa_post_get_full($question["questionid"]);
                $post = qa_post_get_full($question["lastpostid"]);
                $type = "";
                if ($post["type"] == "A") {
                    $type = "answer";
                } else {
                    if ($post["type"] == "C") {
                        $type = "comment";
                    }
                }
                if ($post["userid"] == NULL) {
                    $user = "anonymous";
                } else {
                    $user = qa_userids_to_handles(array($post["userid"]));
                    $user = $user[$post["userid"]];
                }
                $this->output('<div class="qa-notification-dialog-entry">', '<a href="' . qa_q_path($question["questionid"], $q["title"]) . '">' . $q["title"] . '</a>', '<div>New ' . $type . ' by ' . $user . ': "' . substr($post["content"], 0, 100) . '"</div>', '</div>');
            }
            $this->output('</div>');
        }
        qa_html_theme_base::logged_in();
    }
开发者ID:ramblinjan,项目名称:Q2A-Notification,代码行数:40,代码来源:notification-layer.php

示例4: send_default_emails

 function send_default_emails($event, $userid, $handle, $cookieid, $params)
 {
     switch ($event) {
         case 'q_queue':
         case 'q_requeue':
             if (qa_opt('moderate_notify_admin')) {
                 qw_send_notification(null, qa_opt('feedback_email'), null, $event == 'q_requeue' ? qa_lang('emails/remoderate_subject') : qa_lang('emails/moderate_subject'), $event == 'q_requeue' ? nl2br(qa_lang('emails/remoderate_body')) : nl2br(qa_lang('emails/moderate_body')), array('^p_handle' => isset($handle) ? $handle : (strlen($params['name']) ? $params['name'] : (strlen(@$oldquestion['name']) ? $oldquestion['name'] : qa_lang('main/anonymous'))), '^p_context' => trim(@$params['title'] . "\n\n" . $params['text']), '^url' => qa_q_path($params['postid'], $params['title'], true), '^a_url' => qa_path_absolute('admin/moderate')));
             }
             break;
         case 'a_queue':
         case 'a_requeue':
             if (qa_opt('moderate_notify_admin')) {
                 qw_send_notification(null, qa_opt('feedback_email'), null, $event == 'a_requeue' ? qa_lang('emails/remoderate_subject') : qa_lang('emails/moderate_subject'), $event == 'a_requeue' ? nl2br(qa_lang('emails/remoderate_body')) : nl2br(qa_lang('emails/moderate_body')), array('^p_handle' => isset($handle) ? $handle : (strlen($params['name']) ? $params['name'] : (strlen(@$oldanswer['name']) ? $oldanswer['name'] : qa_lang('main/anonymous'))), '^p_context' => $params['text'], '^url' => qa_q_path($params['parentid'], $params['parent']['title'], true, 'A', $params['postid']), '^a_url' => qa_path_absolute('admin/moderate')));
             }
             break;
         case 'c_queue':
         case 'c_requeue':
             if (qa_opt('moderate_notify_admin')) {
                 qw_send_notification(null, qa_opt('feedback_email'), null, $event == 'c_requeue' ? qa_lang('emails/remoderate_subject') : qa_lang('emails/moderate_subject'), $event == 'c_requeue' ? nl2br(qa_lang('emails/remoderate_body')) : nl2br(qa_lang('emails/moderate_body')), array('^p_handle' => isset($handle) ? $handle : (strlen($params['name']) ? $params['name'] : (strlen(@$oldcomment['name']) ? $oldcomment['name'] : (strlen(@$oldanswer['name']) ? $oldanswer['name'] : qa_lang('main/anonymous')))), '^p_context' => $params['text'], '^url' => qa_q_path($params['questionid'], $params['question']['title'], true, 'C', $params['postid']), '^a_url' => qa_path_absolute('admin/moderate')));
             }
             break;
         case 'q_flag':
         case 'a_flag':
         case 'c_flag':
             $flagcount = $params['flagcount'];
             $oldpost = $params['oldpost'];
             $notifycount = $flagcount - qa_opt('flagging_notify_first');
             if ($notifycount >= 0 && $notifycount % qa_opt('flagging_notify_every') == 0) {
                 qw_send_notification(null, qa_opt('feedback_email'), null, qa_lang('emails/flagged_subject'), nl2br(qa_lang('emails/flagged_body')), array('^p_handle' => isset($oldpost['handle']) ? $oldpost['handle'] : (strlen($oldpost['name']) ? $oldpost['name'] : qa_lang('main/anonymous')), '^flags' => $flagcount == 1 ? qa_lang_html_sub('main/1_flag', '1', '1') : qa_lang_html_sub('main/x_flags', $flagcount), '^p_context' => trim(@$oldpost['title'] . "\n\n" . qa_viewer_text($oldpost['content'], $oldpost['format'])), '^url' => qa_q_path($params['questionid'], $params['question']['title'], true, $oldpost['basetype'], $oldpost['postid']), '^a_url' => qa_path_absolute('admin/flagged')));
             }
             break;
         case 'u_register':
             if (qa_opt('register_notify_admin')) {
                 qw_send_notification(null, qa_opt('feedback_email'), null, qa_lang('emails/u_registered_subject'), qa_opt('moderate_users') ? nl2br(qa_lang('emails/u_to_approve_body')) : nl2br(qa_lang('emails/u_registered_body')), array('^u_handle' => $handle, '^url' => qa_path_absolute('user/' . $handle), '^a_url' => qa_path_absolute('admin/approve')));
             }
             break;
     }
 }
开发者ID:rahularyan,项目名称:dude-theme,代码行数:38,代码来源:default-email-notify.php

示例5: process_event

 function process_event($event, $userid, $handle, $cookieid, $params)
 {
     require_once QA_INCLUDE_DIR . 'qa-app-emails.php';
     require_once QA_INCLUDE_DIR . 'qa-app-format.php';
     require_once QA_INCLUDE_DIR . 'qa-util-string.php';
     switch ($event) {
         case 'q_post':
             $followanswer = @$params['followanswer'];
             $sendhandle = isset($handle) ? $handle : (strlen($params['name']) ? $params['name'] : qa_lang('main/anonymous'));
             if (isset($followanswer['notify']) && !qa_post_is_by_user($followanswer, $userid, $cookieid)) {
                 $blockwordspreg = qa_get_block_words_preg();
                 $sendtext = qa_viewer_text($followanswer['content'], $followanswer['format'], array('blockwordspreg' => $blockwordspreg));
                 qa_send_notification($followanswer['userid'], $followanswer['notify'], @$followanswer['handle'], qa_lang('emails/a_followed_subject'), qa_lang('emails/a_followed_body'), array('^q_handle' => $sendhandle, '^q_title' => qa_block_words_replace($params['title'], $blockwordspreg), '^a_content' => $sendtext, '^url' => qa_q_path($params['postid'], $params['title'], true)));
             }
             if (qa_opt('notify_admin_q_post')) {
                 qa_send_notification(null, qa_opt('feedback_email'), null, qa_lang('emails/q_posted_subject'), qa_lang('emails/q_posted_body'), array('^q_handle' => $sendhandle, '^q_title' => $params['title'], '^q_content' => $params['text'], '^url' => qa_q_path($params['postid'], $params['title'], true)));
             }
             break;
         case 'a_post':
             $question = $params['parent'];
             if (isset($question['notify']) && !qa_post_is_by_user($question, $userid, $cookieid)) {
                 qa_send_notification($question['userid'], $question['notify'], @$question['handle'], qa_lang('emails/q_answered_subject'), qa_lang('emails/q_answered_body'), array('^a_handle' => isset($handle) ? $handle : (strlen($params['name']) ? $params['name'] : qa_lang('main/anonymous')), '^q_title' => $question['title'], '^a_content' => qa_block_words_replace($params['text'], qa_get_block_words_preg()), '^url' => qa_q_path($question['postid'], $question['title'], true, 'A', $params['postid'])));
             }
             break;
         case 'c_post':
             $parent = $params['parent'];
             $question = $params['question'];
             $senttoemail = array();
             // to ensure each user or email gets only one notification about an added comment
             $senttouserid = array();
             switch ($parent['basetype']) {
                 case 'Q':
                     $subject = qa_lang('emails/q_commented_subject');
                     $body = qa_lang('emails/q_commented_body');
                     $context = $parent['title'];
                     break;
                 case 'A':
                     $subject = qa_lang('emails/a_commented_subject');
                     $body = qa_lang('emails/a_commented_body');
                     $context = qa_viewer_text($parent['content'], $parent['format']);
                     break;
             }
             $blockwordspreg = qa_get_block_words_preg();
             $sendhandle = isset($handle) ? $handle : (strlen($params['name']) ? $params['name'] : qa_lang('main/anonymous'));
             $sendcontext = qa_block_words_replace($context, $blockwordspreg);
             $sendtext = qa_block_words_replace($params['text'], $blockwordspreg);
             $sendurl = qa_q_path($question['postid'], $question['title'], true, 'C', $params['postid']);
             if (isset($parent['notify']) && !qa_post_is_by_user($parent, $userid, $cookieid)) {
                 $senduserid = $parent['userid'];
                 $sendemail = @$parent['notify'];
                 if (qa_email_validate($sendemail)) {
                     $senttoemail[$sendemail] = true;
                 } elseif (isset($senduserid)) {
                     $senttouserid[$senduserid] = true;
                 }
                 qa_send_notification($senduserid, $sendemail, @$parent['handle'], $subject, $body, array('^c_handle' => $sendhandle, '^c_context' => $sendcontext, '^c_content' => $sendtext, '^url' => $sendurl));
             }
             foreach ($params['thread'] as $comment) {
                 if (isset($comment['notify']) && !qa_post_is_by_user($comment, $userid, $cookieid)) {
                     $senduserid = $comment['userid'];
                     $sendemail = @$comment['notify'];
                     if (qa_email_validate($sendemail)) {
                         if (@$senttoemail[$sendemail]) {
                             continue;
                         }
                         $senttoemail[$sendemail] = true;
                     } elseif (isset($senduserid)) {
                         if (@$senttouserid[$senduserid]) {
                             continue;
                         }
                         $senttouserid[$senduserid] = true;
                     }
                     qa_send_notification($senduserid, $sendemail, @$comment['handle'], qa_lang('emails/c_commented_subject'), qa_lang('emails/c_commented_body'), array('^c_handle' => $sendhandle, '^c_context' => $sendcontext, '^c_content' => $sendtext, '^url' => $sendurl));
                 }
             }
             break;
         case 'q_queue':
         case 'q_requeue':
             if (qa_opt('moderate_notify_admin')) {
                 qa_send_notification(null, qa_opt('feedback_email'), null, $event == 'q_requeue' ? qa_lang('emails/remoderate_subject') : qa_lang('emails/moderate_subject'), $event == 'q_requeue' ? qa_lang('emails/remoderate_body') : qa_lang('emails/moderate_body'), array('^p_handle' => isset($handle) ? $handle : (strlen($params['name']) ? $params['name'] : (strlen(@$oldquestion['name']) ? $oldquestion['name'] : qa_lang('main/anonymous'))), '^p_context' => trim(@$params['title'] . "\n\n" . $params['text']), '^url' => qa_q_path($params['postid'], $params['title'], true), '^a_url' => qa_path_absolute('admin/moderate')));
             }
             break;
         case 'a_queue':
         case 'a_requeue':
             if (qa_opt('moderate_notify_admin')) {
                 qa_send_notification(null, qa_opt('feedback_email'), null, $event == 'a_requeue' ? qa_lang('emails/remoderate_subject') : qa_lang('emails/moderate_subject'), $event == 'a_requeue' ? qa_lang('emails/remoderate_body') : qa_lang('emails/moderate_body'), array('^p_handle' => isset($handle) ? $handle : (strlen($params['name']) ? $params['name'] : (strlen(@$oldanswer['name']) ? $oldanswer['name'] : qa_lang('main/anonymous'))), '^p_context' => $params['text'], '^url' => qa_q_path($params['parentid'], $params['parent']['title'], true, 'A', $params['postid']), '^a_url' => qa_path_absolute('admin/moderate')));
             }
             break;
         case 'c_queue':
         case 'c_requeue':
             if (qa_opt('moderate_notify_admin')) {
                 qa_send_notification(null, qa_opt('feedback_email'), null, $event == 'c_requeue' ? qa_lang('emails/remoderate_subject') : qa_lang('emails/moderate_subject'), $event == 'c_requeue' ? qa_lang('emails/remoderate_body') : qa_lang('emails/moderate_body'), array('^p_handle' => isset($handle) ? $handle : (strlen($params['name']) ? $params['name'] : (strlen(@$oldcomment['name']) ? $oldcomment['name'] : (strlen(@$oldanswer['name']) ? $oldanswer['name'] : qa_lang('main/anonymous')))), '^p_context' => $params['text'], '^url' => qa_q_path($params['questionid'], $params['question']['title'], true, 'C', $params['postid']), '^a_url' => qa_path_absolute('admin/moderate')));
             }
             break;
         case 'q_flag':
         case 'a_flag':
         case 'c_flag':
             $flagcount = $params['flagcount'];
             $oldpost = $params['oldpost'];
             $notifycount = $flagcount - qa_opt('flagging_notify_first');
//.........这里部分代码省略.........
开发者ID:netham91,项目名称:question2answer,代码行数:101,代码来源:qa-event-notify.php

示例6: isset

         case 'C-' . QA_UPDATE_TYPE:
             $langstring = 'misc/feed_c_moved_prefix';
             break;
         case 'C-' . QA_UPDATE_VISIBLE:
             $langstring = $question['ohidden'] ? 'misc/feed_hidden_prefix' : 'misc/feed_c_reshown_prefix';
             break;
         case 'C-' . QA_UPDATE_CONTENT:
             $langstring = 'misc/feed_c_edited_prefix';
             break;
         case 'Q-' . QA_UPDATE_CONTENT:
         default:
             $langstring = 'misc/feed_edited_prefix';
             break;
     }
     $titleprefix = isset($langstring) ? qa_lang($langstring) : '';
     $urlxml = qa_xml(qa_q_path($question['postid'], $question['title'], true, @$question['obasetype'], @$question['opostid']));
 }
 if (isset($blockwordspreg)) {
     $question['title'] = qa_block_words_replace($question['title'], $blockwordspreg);
 }
 //	Build the inner XML structure for each item
 $lines[] = '<item>';
 $lines[] = '<title>' . qa_xml($titleprefix . $question['title']) . '</title>';
 $lines[] = '<link>' . $urlxml . '</link>';
 if (isset($htmlcontent)) {
     $lines[] = '<description>' . qa_xml($htmlcontent) . '</description>';
 }
 if (isset($question['categoryname'])) {
     $lines[] = '<category>' . qa_xml($question['categoryname']) . '</category>';
 }
 $lines[] = '<guid isPermaLink="true">' . $urlxml . '</guid>';
开发者ID:swuit,项目名称:swuit-q2a,代码行数:31,代码来源:qa-feed.php

示例7: qa_q_path_html

function qa_q_path_html($questionid, $title, $absolute = false, $showtype = null, $showid = null)
{
    return qa_html(qa_q_path($questionid, $title, $absolute, $showtype, $showid));
}
开发者ID:netham91,项目名称:question2answer,代码行数:4,代码来源:qa-base.php

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

示例9: qa_get_search_results

function qa_get_search_results($query, $start, $count, $userid, $absoluteurls, $fullcontent)
{
    //	Identify which search module should be used
    $searchmodules = qa_load_modules_with('search', 'process_search');
    if (!count($searchmodules)) {
        qa_fatal_error('No search engine is available');
    }
    $module = reset($searchmodules);
    // use first one by default
    if (count($searchmodules) > 1) {
        $tryname = qa_opt('search_module');
        // use chosen one if it's available
        if (isset($searchmodules[$tryname])) {
            $module = $searchmodules[$tryname];
        }
    }
    //	Get the results
    $results = $module->process_search($query, $start, $count, $userid, $absoluteurls, $fullcontent);
    //	Work out what additional information (if any) we need to retrieve for the results
    $keypostidgetfull = array();
    $keypostidgettype = array();
    $keypostidgetquestion = array();
    $keypageidgetpage = array();
    foreach ($results as $result) {
        if (isset($result['question_postid']) && !isset($result['question'])) {
            $keypostidgetfull[$result['question_postid']] = true;
        }
        if (isset($result['match_postid'])) {
            if (!(isset($result['question_postid']) || isset($result['question']))) {
                $keypostidgetquestion[$result['match_postid']] = true;
            } elseif (!isset($result['match_type'])) {
                $keypostidgettype[$result['match_postid']] = true;
            }
        }
        if (isset($result['page_pageid']) && !isset($result['page'])) {
            $keypageidgetpage[$result['page_pageid']] = true;
        }
    }
    //	Perform the appropriate database queries
    list($postidfull, $postidtype, $postidquestion, $pageidpage) = qa_db_select_with_pending(count($keypostidgetfull) ? qa_db_posts_selectspec($userid, array_keys($keypostidgetfull), $fullcontent) : null, count($keypostidgettype) ? qa_db_posts_basetype_selectspec(array_keys($keypostidgettype)) : null, count($keypostidgetquestion) ? qa_db_posts_to_qs_selectspec($userid, array_keys($keypostidgetquestion), $fullcontent) : null, count($keypageidgetpage) ? qa_db_pages_selectspec(null, array_keys($keypageidgetpage)) : null);
    //	Supplement the results as appropriate
    foreach ($results as $key => $result) {
        if (isset($result['question_postid']) && !isset($result['question'])) {
            if (@$postidfull[$result['question_postid']]['basetype'] == 'Q') {
                $result['question'] = @$postidfull[$result['question_postid']];
            }
        }
        if (isset($result['match_postid'])) {
            if (!(isset($result['question_postid']) || isset($result['question']))) {
                $result['question'] = @$postidquestion[$result['match_postid']];
                if (!isset($result['match_type'])) {
                    $result['match_type'] = @$result['question']['obasetype'];
                }
            } elseif (!isset($result['match_type'])) {
                $result['match_type'] = @$postidtype[$result['match_postid']];
            }
        }
        if (isset($result['question']) && !isset($result['question_postid'])) {
            $result['question_postid'] = $result['question']['postid'];
        }
        if (isset($result['page_pageid']) && !isset($result['page'])) {
            $result['page'] = @$pageidpage[$result['page_pageid']];
        }
        if (!isset($result['title'])) {
            if (isset($result['question'])) {
                $result['title'] = $result['question']['title'];
            } elseif (isset($result['page'])) {
                $result['title'] = $result['page']['heading'];
            }
        }
        if (!isset($result['url'])) {
            if (isset($result['question'])) {
                $result['url'] = qa_q_path($result['question']['postid'], $result['question']['title'], $absoluteurls, @$result['match_type'], @$result['match_postid']);
            } elseif (isset($result['page'])) {
                $result['url'] = qa_path($result['page']['tags'], null, qa_opt('site_url'));
            }
        }
        $results[$key] = $result;
    }
    //	Return the results
    return $results;
}
开发者ID:mostafiz93,项目名称:PrintfScanf,代码行数:82,代码来源:qa-app-search.php

示例10: qw_notify_users_by_email


//.........这里部分代码省略.........
            case 'u_message':
            case 'u_wall_post':
            case 'u_level':
            case 'q_post_user_fl':
            case 'q_post_tag_fl':
            case 'q_post_cat_fl':
                //this is because we wont have the $parent['email'] for each effected userids when a these selected events occurs
                $user_details = qw_get_user_details_from_userid($effecteduserid);
                $handle = $user_details['handle'];
                $name = !!$name ? $name : $user_details['handle'];
                $email = $user_details['email'];
                break;
            case 'q_approve':
            case 'q_reject':
                $oldquestion = $params['oldquestion'];
                $handle = $oldquestion['handle'];
                $name = !!$name ? $name : $oldquestion['handle'];
                $email = $oldquestion['email'];
                break;
            case 'a_approve':
            case 'a_reject':
                $oldanswer = $params['oldanswer'];
                $handle = $oldquestion['handle'];
                $name = !!$name ? $name : $oldanswer['handle'];
                $email = $oldanswer['email'];
                break;
            case 'c_approve':
            case 'c_reject':
                $oldcomment = $params['oldcomment'];
                $handle = $oldcomment['handle'];
                $name = !!$name ? $name : $oldcomment['handle'];
                $email = $oldcomment['email'];
                break;
            default:
                break;
        }
        include_once QA_INCLUDE_DIR . 'qa-util-string.php';
        $notifying_user['userid'] = $effecteduserid;
        $notifying_user['name'] = $name;
        $notifying_user['email'] = $email;
        $notifying_user['handle'] = isset($handle) ? $handle : qa_lang('main/anonymous');
        //consider only first 50 characters for saving notification
        if ($event === 'u_message') {
            $content = isset($params['message']) && !empty($params['message']) ? $params['message'] : "";
            $title = "";
            $canreply = !(qa_get_logged_in_flags() & QA_USER_FLAGS_NO_MESSAGES);
            $url = qa_path_absolute($canreply ? 'message/' . $logged_in_handle : 'user/' . $logged_in_handle);
        } else {
            if ($event === 'u_wall_post') {
                $content = isset($params['text']) && !empty($params['text']) ? $params['text'] : "";
                if (!!$content) {
                    $blockwordspreg = qa_get_block_words_preg();
                    $content = qa_block_words_replace($content, $blockwordspreg);
                }
                $title = "";
                $url = qa_path_absolute('user/' . $params['handle'] . '/wall', null, null);
            } else {
                if ($event === 'u_level') {
                    $title = "";
                    $url = qa_path_absolute('user/' . $params['handle']);
                    $old_level = $params['oldlevel'];
                    $new_level = $params['level'];
                    if ($new_level < $old_level) {
                        return;
                    }
                    $approved_only = "";
                    if ($new_level == QA_USER_LEVEL_APPROVED && $old_level < QA_USER_LEVEL_APPROVED) {
                        $approved_only = true;
                    } else {
                        $approved_only = false;
                    }
                    if ($approved_only === false) {
                        $new_designation = qw_get_user_desg($new_level);
                    }
                    $content = strtr(qa_lang($approved_only ? 'notification/u_level_approved_body_email' : 'notification/u_level_improved_body_email'), array('^done_by' => isset($logged_in_user_name) ? $logged_in_user_name : isset($logged_in_handle) ? $logged_in_handle : qa_lang('main/anonymous'), '^new_designation' => @$new_designation));
                } else {
                    if ($event === "q_post_user_fl" || $event === "q_post_tag_fl" || $event === "q_post_cat_fl") {
                        $content = isset($params['text']) && !empty($params['text']) ? $params['text'] : "";
                        //shrink the email body content
                        if (!!$content && strlen($content) > 50) {
                            $content = qw_shrink_email_body($content, 50);
                        }
                        $title = isset($params['title']) && !empty($params['title']) ? $params['title'] : "";
                        $url = qa_q_path($params['postid'], $title, true);
                    } else {
                        $content = isset($params['text']) && !empty($params['text']) ? $params['text'] : "";
                        //shrink the email body content
                        if (!!$content && strlen($content) > 50) {
                            $content = qw_shrink_email_body($content, 50);
                        }
                        $title = isset($params['qtitle']) && !empty($params['qtitle']) ? $params['qtitle'] : "";
                        $url = qa_q_path($params['qid'], $title, true);
                    }
                }
            }
        }
        $q_handle = isset($logged_in_user_name) ? $logged_in_user_name : isset($logged_in_handle) ? $logged_in_handle : qa_lang('main/anonymous');
        qw_save_email_notification(null, $notifying_user, $logged_in_handle, $event, array('^q_handle' => $q_handle, '^q_title' => $title, '^q_content' => $content, '^url' => !!$url ? $url : "", '^done_by' => $q_handle, '^author_link' => qa_path_absolute('user/' . $q_handle), '^author_pic' => qa_path_absolute('user/' . $q_handle), '^handle' => $handle));
    }
}
开发者ID:rahularyan,项目名称:dude-theme,代码行数:101,代码来源:email-events.php

示例11: create_breadcrumbs

 function create_breadcrumbs($navs, $qa_content, $widget_opt, $template)
 {
     $br = "";
     if ($template == 'not-found') {
         $br .= $this->breadcrumb_part(array('type' => 'not-found', 'url' => '/', 'text' => qa_lang('breadcrumbs/not_found')));
     } elseif ($template === 'question') {
         //if it is a question page
         // category is the first priority
         $question_page = @$qa_content['q_view'];
         $cat = @$question_page['where'];
         $tags = @$question_page['q_tags'];
         $total_navs = count($navs);
         $index = 1;
         if (!empty($cat)) {
             $categoryids = @$qa_content['categoryids'];
             if (!empty($categoryids)) {
                 foreach ($categoryids as $categoryid) {
                     $category_details = $this->get_cat($categoryid);
                     if (is_array($category_details) && !empty($category_details)) {
                         $backpath = $category_details['backpath'];
                         $text = $category_details['title'];
                         $url = $this->cat_path($backpath);
                         $data = array('type' => 'cat', 'text' => $text, 'url' => $url, 'index' => $index, 'total_navs' => $total_navs);
                         $br .= $this->breadcrumb_part($data);
                     }
                 }
                 $index++;
             }
         } else {
             //if question is asked with out any categories
             $br .= $this->breadcrumb_part(array('type' => 'questions', 'url' => qa_path_html('questions'), 'text' => qa_lang('breadcrumbs/questions'), 'index' => $index++, 'total_navs' => $total_navs));
         }
         if (!empty($qa_content['q_view'])) {
             $q_title = !empty($qa_content['q_view']['raw']['title']) ? $qa_content['q_view']['raw']['title'] : '';
             $q_id = !empty($qa_content['q_view']['raw']['postid']) ? $qa_content['q_view']['raw']['postid'] : '';
             $trunc_len = $widget_opt[q2a_breadcrumbs_admin::TRUNCATE_LENGTH];
             if ($trunc_len <= 0) {
                 $trunc_len = strlen($q_title);
             }
             $br .= $this->breadcrumb_part(array('type' => 'questions', 'url' => qa_q_path($q_id, $q_title, true), 'text' => $this->truncate($q_title, $trunc_len), 'index' => $index, 'total_navs' => $total_navs, 'is_question' => true));
         }
     } else {
         //for non questions page
         if (count($navs) > 0) {
             $link = "";
             $type = $navs[0];
             if (empty($type)) {
                 return;
                 //if there is not a single part -- go back from here
             }
             $translate_this_arr = array("questions", "unanswered", "tags", "tag", "users", "user", "categories", "ask", 'message', "special", 'blocked', 'activity');
             $total_navs = count($navs);
             $index = 1;
             if (empty($template) || $template == 'qa') {
                 $type = 'qa';
             }
             foreach ($navs as $nav) {
                 $link .= !!$link ? "/" . $nav : $nav;
                 // added this to fix users page bug and tag page bug
                 $prev_link = $link;
                 $link = $link === "user" ? "users" : $link;
                 $link = $link === "tag" ? "tags" : $link;
                 $text = in_array($nav, $translate_this_arr) ? qa_lang("breadcrumbs/" . $nav) : ucwords($nav);
                 $link = qa_path($link);
                 if (in_array($template, array('plugin', 'custom')) && !empty($qa_content['title'])) {
                     $text = $qa_content['title'];
                 } else {
                     if ($template == 'search') {
                         $text = qa_lang('breadcrumbs/searching_for') . qa_get('q');
                         $link = qa_self_html();
                     } else {
                         if ($template == 'questions') {
                             $sort = qa_get('sort');
                             $non_cat = array('', 'hot', 'votes', 'answers', 'views', 'questions');
                             if (!in_array($nav, $non_cat)) {
                                 //then it is showing categories
                                 $category_details = $this->get_cat_from_tags($nav);
                                 $text = $category_details['title'];
                             }
                         } else {
                             if ($template == 'categories') {
                                 if ($nav !== 'categories') {
                                     //then it is showing categories
                                     $category_details = $this->get_cat_from_tags($nav);
                                     $text = $category_details['title'];
                                 }
                             } else {
                                 if ($template == 'tag') {
                                     if ($nav == 'tag' && $index == 1) {
                                         $text = qa_lang('breadcrumbs/tags');
                                     }
                                 } else {
                                     if ($template == 'qa') {
                                         if ($index >= 1) {
                                             //then it is showing categories
                                             $category_details = $this->get_cat_from_tags($nav);
                                             $text = $category_details['title'];
                                         }
                                     } else {
                                         if ($template == 'activity') {
//.........这里部分代码省略.........
开发者ID:Alvarofg,项目名称:q2a-breadcrumbs,代码行数:101,代码来源:qa-breadcrumbs-widget.php


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