• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP qa_block_words_replace函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: test__qa_block_words_replace

 public function test__qa_block_words_replace()
 {
     $wordpreg = qa_block_words_to_preg($this->blockWordString);
     $test = qa_block_words_replace('tired of my ocean boat style', $wordpreg);
     $expected = '***** of my ***** **** *****';
     $this->assertEquals($expected, $test);
 }
开发者ID:kosmoluna,项目名称:question2answer,代码行数:7,代码来源:UtilStringTest.php


示例2: qa_question_set_selchildid

function qa_question_set_selchildid($userid, $handle, $cookieid, $oldquestion, $selchildid, $answers)
{
    $oldselchildid = $oldquestion['selchildid'];
    qa_db_post_set_selchildid($oldquestion['postid'], isset($selchildid) ? $selchildid : null);
    qa_db_points_update_ifuser($oldquestion['userid'], 'aselects');
    if (isset($oldselchildid)) {
        if (isset($answers[$oldselchildid])) {
            qa_db_points_update_ifuser($answers[$oldselchildid]['userid'], 'aselecteds');
            qa_report_event('a_unselect', $userid, $handle, $cookieid, array('parentid' => $oldquestion['postid'], 'postid' => $oldselchildid));
        }
    }
    if (isset($selchildid)) {
        $answer = $answers[$selchildid];
        qa_db_points_update_ifuser($answer['userid'], 'aselecteds');
        if (isset($answer['notify']) && !qa_post_is_by_user($answer, $userid, $cookieid)) {
            require_once QA_INCLUDE_DIR . 'qa-app-emails.php';
            require_once QA_INCLUDE_DIR . 'qa-app-options.php';
            require_once QA_INCLUDE_DIR . 'qa-util-string.php';
            require_once QA_INCLUDE_DIR . 'qa-app-format.php';
            $blockwordspreg = qa_get_block_words_preg();
            $sendtitle = qa_block_words_replace($oldquestion['title'], $blockwordspreg);
            $sendcontent = qa_viewer_text($answer['content'], $answer['format'], array('blockwordspreg' => $blockwordspreg));
            qa_send_notification($answer['userid'], $answer['notify'], @$answer['handle'], qa_lang('emails/a_selected_subject'), qa_lang('emails/a_selected_body'), array('^s_handle' => isset($handle) ? $handle : qa_lang('main/anonymous'), '^q_title' => $sendtitle, '^a_content' => $sendcontent, '^url' => qa_path(qa_q_request($oldquestion['postid'], $sendtitle), null, qa_opt('site_url'), null, qa_anchor('A', $selchildid))));
        }
        qa_report_event('a_select', $userid, $handle, $cookieid, array('parentid' => $oldquestion['postid'], 'postid' => $selchildid));
    }
}
开发者ID:TheProjecter,项目名称:microprobe,代码行数:27,代码来源:qa-app-post-update.php


示例3: get_html

 function get_html($content, $format, $options)
 {
     if (isset($options['blockwordspreg'])) {
         require_once QA_INCLUDE_DIR . 'qa-util-string.php';
         $content = qa_block_words_replace($content, $options['blockwordspreg']);
     }
     require_once $this->plugindir . 'inc.markdown.php';
     $html = Markdown($content);
     return qa_sanitize_html($html, @$options['linksnewwindow']);
 }
开发者ID:mostafiz93,项目名称:PrintfScanf,代码行数:10,代码来源:qa-markdown-viewer.php


示例4: qa_q_request

function qa_q_request($questionid, $title)
{
    // URL Clean
    if (qa_opt('useo_url_cleanup')) {
        //clean url's title
        $words = qa_opt('useo_url_words_list');
        $raw_title = $title;
        // ~~ str_replace method
        //$word_list = explode(',', $words);
        //$title = str_replace($word_list, '', $raw_title);
        // ~~preg_replace method with Q2A functions
        require_once QA_INCLUDE_DIR . 'qa-util-string.php';
        $word_list = qa_block_words_to_preg($words);
        $title = trim(qa_block_words_replace($title, $word_list, ''));
        if (strlen($title) == 0 && qa_opt('useo_url_dont_make_empty')) {
            $title = $raw_title;
        }
    }
    $url = qa_q_request_base($questionid, $title);
    // capitalize letters
    if (qa_opt('useo_url_q_uppercase')) {
        $type = qa_opt('useo_url_q_uppercase_type');
        if ($type == 1) {
            // first word's first letter
            $parts = explode('/', $url);
            $parts[1] = ucfirst($parts[1]);
            $url = implode('/', $parts);
        } else {
            if ($type == 2) {
                // all word's first letter
                $url = str_replace(' ', '?', ucwords(str_replace('?', ' ', str_replace(' ', '/', ucwords(str_replace('/', ' ', str_replace(' ', '-', ucwords(str_replace('-', ' ', strtolower($url))))))))));
            } else {
                // whole words
                $url = strtoupper($url);
            }
        }
    }
    return $url;
}
开发者ID:Kailashaghera,项目名称:Q2A-Ultimate-SEO,代码行数:39,代码来源:overrides.php


示例5: isset

         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>';
 if (isset($time)) {
     $lines[] = '<pubDate>' . qa_xml(gmdate('r', $time)) . '</pubDate>';
 }
开发者ID:swuit,项目名称:swuit-q2a,代码行数:31,代码来源:qa-feed.php


示例6: qa_q_request

function qa_q_request($questionid, $title)
{
    if (qa_to_override(__FUNCTION__)) {
        $args = func_get_args();
        return qa_call_override(__FUNCTION__, $args);
    }
    require_once QA_INCLUDE_DIR . 'qa-app-options.php';
    require_once QA_INCLUDE_DIR . 'qa-util-string.php';
    $title = qa_block_words_replace($title, qa_get_block_words_preg());
    $words = qa_string_to_words($title, true, false, false);
    $wordlength = array();
    foreach ($words as $index => $word) {
        $wordlength[$index] = qa_strlen($word);
    }
    $remaining = qa_opt('q_urls_title_length');
    if (array_sum($wordlength) > $remaining) {
        arsort($wordlength, SORT_NUMERIC);
        // sort with longest words first
        foreach ($wordlength as $index => $length) {
            if ($remaining > 0) {
                $remaining -= $length;
            } else {
                unset($words[$index]);
            }
        }
    }
    $title = implode('-', $words);
    if (qa_opt('q_urls_remove_accents')) {
        $title = qa_string_remove_accents($title);
    }
    return (int) $questionid . '/' . $title;
}
开发者ID:netham91,项目名称:question2answer,代码行数:32,代码来源:qa-base.php


示例7: qa_page_q_question_view

function qa_page_q_question_view($question, $parentquestion, $closepost, $usershtml, $formrequested)
{
    $questionid = $question['postid'];
    $userid = qa_get_logged_in_userid();
    $cookieid = qa_cookie_get();
    $htmloptions = qa_post_html_defaults('Q', true);
    $htmloptions['answersview'] = false;
    // answer count is displayed separately so don't show it here
    $htmloptions['avatarsize'] = qa_opt('avatar_q_page_q_size');
    $q_view = qa_post_html_fields($question, $userid, $cookieid, $usershtml, null, $htmloptions);
    $q_view['main_form_tags'] = 'METHOD="POST" ACTION="' . qa_self_html() . '"';
    //	Buttons for operating on the question
    if (!$formrequested) {
        // don't show if another form is currently being shown on page
        $clicksuffix = ' onClick="qa_show_waiting_after(this, false);"';
        // add to operations that write to database
        $buttons = array();
        if ($question['editbutton']) {
            $buttons['edit'] = array('tags' => 'NAME="q_doedit"', 'label' => qa_lang_html('question/edit_button'), 'popup' => qa_lang_html('question/edit_q_popup'));
        }
        $hascategories = qa_using_categories();
        if ($question['retagcatbutton']) {
            $buttons['retagcat'] = array('tags' => 'NAME="q_doedit"', 'label' => qa_lang_html($hascategories ? 'question/recat_button' : 'question/retag_button'), 'popup' => qa_lang_html($hascategories ? qa_using_tags() ? 'question/retag_cat_popup' : 'question/recat_popup' : 'question/retag_popup'));
        }
        if ($question['flagbutton']) {
            $buttons['flag'] = array('tags' => 'NAME="q_doflag"' . $clicksuffix, 'label' => qa_lang_html($question['flagtohide'] ? 'question/flag_hide_button' : 'question/flag_button'), 'popup' => qa_lang_html('question/flag_q_popup'));
        }
        if ($question['unflaggable']) {
            $buttons['unflag'] = array('tags' => 'NAME="q_dounflag"' . $clicksuffix, 'label' => qa_lang_html('question/unflag_button'), 'popup' => qa_lang_html('question/unflag_popup'));
        }
        if ($question['clearflaggable']) {
            $buttons['clearflags'] = array('tags' => 'NAME="q_doclearflags"' . $clicksuffix, 'label' => qa_lang_html('question/clear_flags_button'), 'popup' => qa_lang_html('question/clear_flags_popup'));
        }
        if ($question['closeable']) {
            $buttons['close'] = array('tags' => 'NAME="q_doclose"', 'label' => qa_lang_html('question/close_button'), 'popup' => qa_lang_html('question/close_q_popup'));
        }
        if ($question['reopenable']) {
            $buttons['reopen'] = array('tags' => 'NAME="q_doreopen"' . $clicksuffix, 'label' => qa_lang_html('question/reopen_button'));
        }
        if ($question['moderatable']) {
            $buttons['approve'] = array('tags' => 'NAME="q_doapprove"' . $clicksuffix, 'label' => qa_lang_html('question/approve_button'));
            $buttons['reject'] = array('tags' => 'NAME="q_doreject"' . $clicksuffix, 'label' => qa_lang_html('question/reject_button'));
        }
        if ($question['hideable']) {
            $buttons['hide'] = array('tags' => 'NAME="q_dohide"' . $clicksuffix, 'label' => qa_lang_html('question/hide_button'), 'popup' => qa_lang_html('question/hide_q_popup'));
        }
        if ($question['reshowable']) {
            $buttons['reshow'] = array('tags' => 'NAME="q_doreshow"' . $clicksuffix, 'label' => qa_lang_html('question/reshow_button'));
        }
        if ($question['deleteable']) {
            $buttons['delete'] = array('tags' => 'NAME="q_dodelete"' . $clicksuffix, 'label' => qa_lang_html('question/delete_button'), 'popup' => qa_lang_html('question/delete_q_popup'));
        }
        if ($question['claimable']) {
            $buttons['claim'] = array('tags' => 'NAME="q_doclaim"' . $clicksuffix, 'label' => qa_lang_html('question/claim_button'));
        }
        if ($question['answerbutton']) {
            // don't show if shown by default
            $buttons['answer'] = array('tags' => 'NAME="q_doanswer" ID="q_doanswer" onClick="return qa_toggle_element(\'anew\')"', 'label' => qa_lang_html('question/answer_button'), 'popup' => qa_lang_html('question/answer_q_popup'));
        }
        if ($question['commentbutton']) {
            $buttons['comment'] = array('tags' => 'NAME="q_docomment" onClick="return qa_toggle_element(\'c' . $questionid . '\')"', 'label' => qa_lang_html('question/comment_button'), 'popup' => qa_lang_html('question/comment_q_popup'));
        }
        $q_view['form'] = array('style' => 'light', 'buttons' => $buttons, 'hidden' => array('qa_click' => ''));
    }
    //	Information about the question of the answer that this question follows on from (or a question directly)
    if (isset($parentquestion)) {
        $q_view['follows'] = array('label' => qa_lang_html($question['parentid'] == $parentquestion['postid'] ? 'question/follows_q' : 'question/follows_a'), 'title' => qa_html(qa_block_words_replace($parentquestion['title'], qa_get_block_words_preg())), 'url' => qa_q_path_html($parentquestion['postid'], $parentquestion['title'], false, $question['parentid'] == $parentquestion['postid'] ? 'Q' : 'A', $question['parentid']));
    }
    //	Information about the question that this question is a duplicate of (if appropriate)
    if (isset($closepost)) {
        if ($closepost['basetype'] == 'Q') {
            $q_view['closed'] = array('label' => qa_lang_html('question/closed_as_duplicate'), 'content' => qa_html(qa_block_words_replace($closepost['title'], qa_get_block_words_preg())), 'url' => qa_q_path_html($closepost['postid'], $closepost['title']));
        } elseif ($closepost['type'] == 'NOTE') {
            $viewer = qa_load_viewer($closepost['content'], $closepost['format']);
            $q_view['closed'] = array('label' => qa_lang_html('question/closed_with_note'), 'content' => $viewer->get_html($closepost['content'], $closepost['format'], array('blockwordspreg' => qa_get_block_words_preg())));
        }
    }
    //	Extra value display
    if (strlen(@$question['extra']) && qa_opt('extra_field_active') && qa_opt('extra_field_display')) {
        $q_view['extra'] = array('label' => qa_html(qa_opt('extra_field_label')), 'content' => qa_html(qa_block_words_replace($question['extra'], qa_get_block_words_preg())));
    }
    return $q_view;
}
开发者ID:mathjoy,项目名称:math-duodaa,代码行数:83,代码来源:qa-page-question-view.php


示例8: qa_post_html_fields

function qa_post_html_fields($post, $userid, $cookieid, $usershtml, $dummy, $options = array())
{
    if (qa_to_override(__FUNCTION__)) {
        $args = func_get_args();
        return qa_call_override(__FUNCTION__, $args);
    }
    require_once QA_INCLUDE_DIR . 'app/updates.php';
    if (isset($options['blockwordspreg'])) {
        require_once QA_INCLUDE_DIR . 'util/string.php';
    }
    $fields = array('raw' => $post);
    //	Useful stuff used throughout function
    $postid = $post['postid'];
    $isquestion = $post['basetype'] == 'Q';
    $isanswer = $post['basetype'] == 'A';
    $isbyuser = qa_post_is_by_user($post, $userid, $cookieid);
    $anchor = urlencode(qa_anchor($post['basetype'], $postid));
    $elementid = isset($options['elementid']) ? $options['elementid'] : $anchor;
    $microformats = @$options['microformats'];
    $isselected = @$options['isselected'];
    $favoritedview = @$options['favoritedview'];
    $favoritemap = $favoritedview ? qa_get_favorite_non_qs_map() : array();
    //	High level information
    $fields['hidden'] = @$post['hidden'];
    $fields['tags'] = 'id="' . qa_html($elementid) . '"';
    $fields['classes'] = $isquestion && $favoritedview && @$post['userfavoriteq'] ? 'qa-q-favorited' : '';
    if ($isquestion && isset($post['closedbyid'])) {
        $fields['classes'] = ltrim($fields['classes'] . ' qa-q-closed');
    }
    if ($microformats) {
        $fields['classes'] .= ' hentry ' . ($isquestion ? 'question' : ($isanswer ? $isselected ? 'answer answer-selected' : 'answer' : 'comment'));
    }
    //	Question-specific stuff (title, URL, tags, answer count, category)
    if ($isquestion) {
        if (isset($post['title'])) {
            $fields['url'] = qa_q_path_html($postid, $post['title']);
            if (isset($options['blockwordspreg'])) {
                $post['title'] = qa_block_words_replace($post['title'], $options['blockwordspreg']);
            }
            $fields['title'] = qa_html($post['title']);
            if ($microformats) {
                $fields['title'] = '<span class="entry-title">' . $fields['title'] . '</span>';
            }
            /*if (isset($post['score'])) // useful for setting match thresholds
            		$fields['title'].=' <small>('.$post['score'].')</small>';*/
        }
        if (@$options['tagsview'] && isset($post['tags'])) {
            $fields['q_tags'] = array();
            $tags = qa_tagstring_to_tags($post['tags']);
            foreach ($tags as $tag) {
                if (isset($options['blockwordspreg']) && count(qa_block_words_match_all($tag, $options['blockwordspreg']))) {
                    // skip censored tags
                    continue;
                }
                $fields['q_tags'][] = qa_tag_html($tag, $microformats, @$favoritemap['tag'][qa_strtolower($tag)]);
            }
        }
        if (@$options['answersview'] && isset($post['acount'])) {
            $fields['answers_raw'] = $post['acount'];
            $fields['answers'] = $post['acount'] == 1 ? qa_lang_html_sub_split('main/1_answer', '1', '1') : qa_lang_html_sub_split('main/x_answers', number_format($post['acount']));
            $fields['answer_selected'] = isset($post['selchildid']);
        }
        if (@$options['viewsview'] && isset($post['views'])) {
            $fields['views_raw'] = $post['views'];
            $fields['views'] = $post['views'] == 1 ? qa_lang_html_sub_split('main/1_view', '1', '1') : qa_lang_html_sub_split('main/x_views', number_format($post['views']));
        }
        if (@$options['categoryview'] && isset($post['categoryname']) && isset($post['categorybackpath'])) {
            $favoriteclass = '';
            if (count(@$favoritemap['category'])) {
                if (@$favoritemap['category'][$post['categorybackpath']]) {
                    $favoriteclass = ' qa-cat-favorited';
                } else {
                    foreach ($favoritemap['category'] as $categorybackpath => $dummy) {
                        if (substr('/' . $post['categorybackpath'], -strlen($categorybackpath)) == $categorybackpath) {
                            $favoriteclass = ' qa-cat-parent-favorited';
                        }
                    }
                }
            }
            $fields['where'] = qa_lang_html_sub_split('main/in_category_x', '<a href="' . qa_path_html(@$options['categorypathprefix'] . implode('/', array_reverse(explode('/', $post['categorybackpath'])))) . '" class="qa-category-link' . $favoriteclass . '">' . qa_html($post['categoryname']) . '</a>');
        }
    }
    //	Answer-specific stuff (selection)
    if ($isanswer) {
        $fields['selected'] = $isselected;
        if ($isselected) {
            $fields['select_text'] = qa_lang_html('question/select_text');
        }
    }
    //	Post content
    if (@$options['contentview'] && isset($post['content'])) {
        $viewer = qa_load_viewer($post['content'], $post['format']);
        $fields['content'] = $viewer->get_html($post['content'], $post['format'], array('blockwordspreg' => @$options['blockwordspreg'], 'showurllinks' => @$options['showurllinks'], 'linksnewwindow' => @$options['linksnewwindow']));
        if ($microformats) {
            $fields['content'] = '<div class="entry-content">' . $fields['content'] . '</div>';
        }
        $fields['content'] = '<a name="' . qa_html($postid) . '"></a>' . $fields['content'];
        // this is for backwards compatibility with any existing links using the old style of anchor
        // that contained the post id only (changed to be valid under W3C specifications)
    }
//.........这里部分代码省略.........
开发者ID:amiyasahu,项目名称:question2answer,代码行数:101,代码来源:format.php


示例9: array

            $qa_content['q_view']['form']['buttons']['delete'] = array('tags' => 'NAME="dodeleteq"', 'label' => qa_lang_html('question/delete_button'), 'popup' => qa_lang_html('question/delete_q_popup'));
        }
        if ($question['claimable']) {
            $qa_content['q_view']['form']['buttons']['claim'] = array('tags' => 'NAME="doclaimq"', 'label' => qa_lang_html('question/claim_button'));
        }
        if ($question['answerbutton'] && $formtype != 'a_add') {
            // don't show if shown by default
            $qa_content['q_view']['form']['buttons']['answer'] = array('tags' => 'NAME="doanswerq"', 'label' => qa_lang_html('question/answer_button'), 'popup' => qa_lang_html('question/answer_q_popup'));
        }
        if ($question['commentbutton']) {
            $qa_content['q_view']['form']['buttons']['comment'] = array('tags' => 'NAME="docommentq"', 'label' => qa_lang_html('question/comment_button'), 'popup' => qa_lang_html('question/comment_q_popup'));
        }
    }
    //	Information about the question of the answer that this question follows on from (or a question directly)
    if (isset($parentquestion)) {
        $parentquestion['title'] = qa_block_words_replace($parentquestion['title'], qa_get_block_words_preg());
        $qa_content['q_view']['follows'] = array('label' => qa_lang_html($question['parentid'] == $parentquestion['postid'] ? 'question/follows_q' : 'question/follows_a'), 'title' => qa_html($parentquestion['title']), 'url' => qa_path_html(qa_q_request($parentquestion['postid'], $parentquestion['title']), null, null, null, $question['parentid'] == $parentquestion['postid'] ? null : qa_anchor('A', $question['parentid'])));
    }
}
//	Prepare content for an answer being edited (if any)
if ($formtype == 'a_edit') {
    $qa_content['q_view']['a_form'] = qa_page_q_edit_a_form($formpostid);
}
//	Prepare content for comments on the question, plus add or edit comment forms
$qa_content['q_view']['c_list'] = qa_page_q_comment_follow_list($question);
// ...for viewing
if ($formtype == 'c_add' && $formpostid == $questionid) {
    // ...to be added
    $qa_content['q_view']['c_form'] = qa_page_q_add_c_form(null);
} elseif ($formtype == 'c_edit' && @$commentsfollows[$formpostid]['parentid'] == $questionid) {
    // ...being edited
开发者ID:rkarimabadi,项目名称:q2a-expert-questions,代码行数:31,代码来源:qa-expert-question.php


示例10: get_text

 function get_text($content, $format, $options)
 {
     if ($format == 'html') {
         $text = strtr($content, "\n\r\t", '   ');
         // convert all white space in HTML to spaces
         $text = preg_replace('/<\\s*(' . $this->htmllineseparators . ')[^A-Za-z0-9]/i', "\n\\0", $text);
         // tags to single new line
         $text = preg_replace('/<\\s*(' . $this->htmlparagraphseparators . ')[^A-Za-z0-9]/i', "\n\n\\0", $text);
         // tags to double new line
         $text = strip_tags($text);
         // all tags removed
         $text = preg_replace('/  +/', ' ', $text);
         // combine multiple spaces into one
         $text = preg_replace('/ *\\n */', "\n", $text);
         // remove spaces either side new lines
         $text = preg_replace('/\\n\\n\\n+/', "\n\n", $text);
         // more than two new lines combine into two
         $text = strtr($text, array('&#34;' => "\"", '&#38;' => "&", '&#39;' => "'", '&#60;' => "<", '&#62;' => ">", '&nbsp;' => " ", '&quot;' => "\"", '&amp;' => "&", '&lt;' => "<", '&gt;' => ">"));
         // base HTML entities (others should not be stored in database)
         $text = trim($text);
     } elseif ($format == '') {
         $text = $content;
     } else {
         $text = '[no viewer found for format: ' . $format . ']';
     }
     // for unknown formats
     if (isset($options['blockwordspreg'])) {
         require_once QA_INCLUDE_DIR . 'qa-util-string.php';
         $text = qa_block_words_replace($text, $options['blockwordspreg']);
     }
     return $text;
 }
开发者ID:ramo01,项目名称:1kapp,代码行数:32,代码来源:qa-viewer-basic.php


示例11: qa_comment_create

function qa_comment_create($userid, $handle, $cookieid, $content, $format, $text, $notify, $email, $question, $answer, $commentsfollows)
{
    require_once QA_INCLUDE_DIR . 'qa-app-emails.php';
    require_once QA_INCLUDE_DIR . 'qa-app-options.php';
    require_once QA_INCLUDE_DIR . 'qa-app-format.php';
    require_once QA_INCLUDE_DIR . 'qa-util-string.php';
    $parent = isset($answer) ? $answer : $question;
    $postid = qa_db_post_create('C', $parent['postid'], $userid, isset($userid) ? null : $cookieid, qa_remote_ip_address(), null, $content, $format, null, qa_combine_notify_email($userid, $notify, $email), $question['categoryid']);
    qa_db_posts_calc_category_path($postid);
    if (!($question['hidden'] || @$answer['hidden'])) {
        // don't index comment if parent or parent of parent is hidden
        qa_post_index($postid, 'C', $question['postid'], null, $text, null);
    }
    qa_db_points_update_ifuser($userid, 'cposts');
    qa_db_ccount_update();
    //	$senttoemail and $senttouserid ensure each user or email gets only one notification about an added comment,
    //	even if they have several previous comments in the same thread and asked for notifications for the parent.
    //	Still, if a person posted some comments as a registered user and some others anonymously,
    //	they could get two emails about a subsequent comment. Shouldn't be much of a problem in practice.
    $senttoemail = array();
    $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 : qa_lang('main/anonymous');
    $sendcontext = qa_block_words_replace($context, $blockwordspreg);
    $sendtext = qa_block_words_replace($text, $blockwordspreg);
    $sendtitle = qa_block_words_replace($question['title'], $blockwordspreg);
    $sendurl = qa_path(qa_q_request($question['postid'], $sendtitle), null, qa_opt('site_url'), null, qa_anchor($parent['basetype'], $parent['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 ($commentsfollows as $comment) {
        if ($comment['basetype'] == 'C' && $comment['parentid'] == $parent['postid'] && !$comment['hidden']) {
            // find just those for this parent
            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));
            }
        }
    }
    qa_report_event('c_post', $userid, $handle, $cookieid, array('postid' => $postid, 'parentid' => $parent['postid'], 'parenttype' => $parent['basetype'], 'questionid' => $question['postid'], 'content' => $content, 'format' => $format, 'text' => $text, 'categoryid' => $question['categoryid'], 'notify' => $notify, 'email' => $email));
    return $postid;
}
开发者ID:TheProjecter,项目名称:microprobe,代码行数:73,代码来源:qa-app-post-create.php


示例12: ra_post_list

function ra_post_list($type, $limit)
{
    require_once QA_INCLUDE_DIR . 'qa-app-posts.php';
    $post = qa_db_query_sub('SELECT * FROM ^posts WHERE ^posts.type=$ ORDER BY ^posts.created DESC LIMIT #', $type, $limit);
    $output = '<ul class="question-list">';
    while ($p = mysql_fetch_array($post)) {
        $p['title'] = qa_block_words_replace($p['title'], qa_get_block_words_preg(), '*');
        $p['content'] = qa_block_words_replace($p['content'], qa_get_block_words_preg(), '*');
        if ($type == 'Q') {
            $what = _ra_lang('asked');
        } elseif ($type == 'A') {
            $what = _ra_lang('answered');
        } elseif ('C') {
            $what = _ra_lang('commented');
        }
        $handle = qa_post_userid_to_handle($p['userid']);
        $output .= '<li id="q-list-' . $p['postid'] . '" class="question-item">';
        $output .= '<div class="pull-left avatar" data-handle="' . $handle . '" data-id="' . qa_handle_to_userid($handle) . '">' . ra_get_avatar($handle, 40) . '</div>';
        $output .= '<div class="list-right">';
        $output .= '<h5><a href="' . qa_path_html('user/' . $handle) . '">' . ra_name($handle) . '</a> ' . $what . '</h5>';
        if ($type == 'Q') {
            $output .= '<p><a href="' . qa_q_path_html($p['postid'], $p['title']) . '" title="' . $p['title'] . '">' . qa_html($p['title']) . '</a></p>';
        } elseif ($type == 'A') {
            $output .= '<p><a href="' . ra_post_link($p['parentid']) . '#a' . $p['postid'] . '">' . substr(strip_tags($p['content']), 0, 50) . '</a></p>';
        } else {
            $output .= '<p><a href="' . ra_post_link($p['parentid']) . '#c' . $p['postid'] . '">' . substr(strip_tags($p['content']), 0, 50) . '</a></p>';
        }
        if ($type == 'Q') {
            $output .= '<div class="counts"><div class="vote-count icon-chevron-up"><span>' . $p['netvotes'] . '</span></div>';
            $output .= '<div class="ans-count icon-chat-4"><span>' . $p['acount'] . '</span></div></div>';
        } elseif ($type == 'A') {
            $output .= '<div class="counts"><div class="vote-count icon-chevron-up"><span>' . $p['netvotes'] . '</span></div>';
        }
        $output .= '</div>';
        $output .= '</li>';
    }
    $output .= '</ul>';
    echo $output;
}
开发者ID:rahularyan,项目名称:dude-theme,代码行数:39,代码来源:widgets.php


示例13: qw_notify_users_by_email

function qw_notify_users_by_email($event, $postid, $userid, $effecteduserid, $params)
{
    if (!!$effecteduserid) {
        //get the working user data
        $logged_in_handle = qa_get_logged_in_handle();
        $logged_in_user_name = qw_get_name_from_userid($userid);
        $logged_in_user_name = !!$logged_in_user_name ? $logged_in_user_name : $logged_in_handle;
        $name = qw_get_name_from_userid($effecteduserid);
        switch ($event) {
            case 'a_post':
            case 'related':
                $parent = isset($params['parent']) ? $params['parent'] : "";
                if (!!$parent) {
                    $name = !!$name ? $name : $parent['handle'];
                    $email = $parent['email'];
                    $handle = $parent['handle'];
                } else {
                    //seems proper values are not available
                    return;
                }
                break;
            case 'c_post':
            case 'q_reshow':
            case 'a_reshow':
            case 'c_reshow':
            case 'a_select':
            case 'q_vote_up':
            case 'q_vote_down':
            case 'a_vote_up':
            case 'a_vote_down':
            case 'q_favorite':
            case 'u_favorite':
            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;
//.........这里部分代码省略.........
开发者ID:rahularyan,项目名称:dude-theme,代码行数:101,代码来源:email-events.php


示例14: qa_post_html_fields

function qa_post_html_fields($post, $userid, $cookieid, $usershtml, $dummy, $options = array())
{
    if (isset($options['blockwordspreg'])) {
        require_once QA_INCLUDE_DIR . 'qa-util-string.php';
    }
    $fields = array();
    $fields['raw'] = $post;
    //	Useful stuff used throughout function
    $postid = $post['postid'];
    $isquestion = $post['basetype'] == 'Q';
    $isanswer = $post['basetype'] == 'A';
    $isbyuser = qa_post_is_by_user($post, $userid, $cookieid);
    $anchor = urlencode(qa_anchor($post['basetype'], $postid));
    $microformats = @$options['microformats'];
    $isselected = @$options['isselected'];
    //	High level information
    $fields['hidden'] = $post['hidden'];
    $fields['tags'] = 'ID="' . $anchor . '"';
    if ($microformats) {
        $fields['classes'] = 'hentry ' . ($isquestion ? 'question' : ($isanswer ? $isselected ? 'answer answer-selected' : 'answer' : 'comment'));
    }
    //	Question-specific stuff (title, URL, tags, answer count, category)
    if ($isquestion) {
        if (isset($post['title'])) {
            if (isset($options['blockwordspreg'])) {
                $post['title'] = qa_block_words_replace($post['title'], $options['blockwordspreg']);
            }
            $fields['title'] = qa_html($post['title']);
            if ($microformats) {
                $fields['title'] = '<SPAN CLASS="entry-title">' . $fields['title'] . '</SPAN>';
            }
            $fields['url'] = qa_path_html(qa_q_request($postid, $post['title']));
            /*if (isset($post['score'])) // useful for setting match thresholds
            		$fields['title'].=' <SMALL>('.$post['score'].')</SMALL>';*/
        }
        if (@$options['tagsview'] && isset($post['tags'])) {
            $fields['q_tags'] = array();
            $tags = qa_tagstring_to_tags($post['tags']);
            foreach ($tags as $tag) {
                if (isset($options['blockwordspreg']) && count(qa_block_words_match_all($tag, $options['blockwordspreg']))) {
                    // skip censored tags
                    continue;
                }
                $fields['q_tags'][] = qa_tag_html($tag, $microformats);
            }
        }
        if (@$options['answersview'] && isset($post['acount'])) {
            $fields['answers_raw'] = $post['acount'];
            $fields['answers'] = $post['acount'] == 1 ? qa_lang_html_sub_split('main/1_answer', '1', '1') : qa_lang_html_sub_split('main/x_answers', number_format($post['acount']));
            $fields['answer_selected'] = isset($post['selchildid']);
        }
        if (@$options['viewsview'] && isset($post['views'])) {
            $fields['views_raw'] = $post['views'];
            $fields['views'] = $post['views'] == 1 ? qa_lang_html_sub_split('main/1_view', '1', '1') : qa_lang_html_sub_split('main/x_views', number_format($post['views']));
        }
        if (isset($post['categoryname']) && isset($post['categorybackpath'])) {
            $fields['where'] = qa_lang_html_sub_split('main/in_category_x', '<A HREF="' . qa_path_html(@$options['categorypathprefix'] . implode('/', array_reverse(explode('/', $post['categorybackpath'])))) . '" CLASS="qa-category-link">' . qa_html($post['categoryname']) . '</A>');
        }
    }
    //	Answer-specific stuff (selection)
    if ($isanswer) {
        $fields['selected'] = $isselected;
        if ($isselected) {
            $fields['select_text'] = qa_lang_html('question/select_text');
        }
    }
    //	Post content
    if (!empty($post['content'])) {
        $viewer = qa_load_viewer($post['content'], $post['format']);
        $fields['content'] = $viewer->get_html($post['content'], $post['format'], array('blockwordspreg' => @$options['blockwordspreg'], 'showurllinks' => @$options['showurllinks'], 'linksnewwindow' => @$options['linksnewwindow']));
        if ($microformats) {
            $fields['content'] = '<SPAN CLASS="entry-content">' . $fields['content'] . '</SPAN>';
        }
        $fields['content'] = '<A NAME="' . qa_html($postid) . '"></A>' . $fields['content'];
        // this is for backwards compatibility with any existing links using the old style of anchor
        // that contained the post id only (changed to be valid under W3C specifications)
    }
    //	Voting stuff
    if (@$options['voteview']) {
        $voteview = $options['voteview'];
        //	Calculate raw values and pass through
        $upvotes = (int) @$post['upvotes'];
        $downvotes = (int) @$post['downvotes'];
        $netvotes = (int) ($upvotes - $downvotes);
        $fields['upvotes_raw'] = $upvotes;
        $fields['downvotes_raw'] = $downvotes;
        $fields['netvotes_raw'] = $netvotes;
        //	Create HTML versions...
        $upvoteshtml = qa_html($upvotes);
        $downvoteshtml = qa_html($downvotes);
        if ($netvotes >= 1) {
            $netvoteshtml = '+' . qa_html($netvotes);
        } elseif ($netvotes <= -1) {
            $netvoteshtml = '&ndash;' . qa_html(-$netvotes);
        } else {
            $netvoteshtml = '0';
        }
        //	...with microformats if appropriate
        if ($microformats) {
            $netvoteshtml .= '<SPAN CLASS="votes-up"><SPAN CLASS="value-title" TITLE="' . $upvoteshtml . '"></SPAN></SPAN>' . '<SPAN CLASS="votes-down"><SPAN CLASS="value-title" TITLE="' . $downvoteshtml . '"></SPAN></SPAN>';
//.........这里部分代码省略.........
开发者ID:TheProjecter,项目名称:microprobe,代码行数:101,代码来源:qa-app-format.php


示例15: foreach

            $qdefaults['answersview'] = false;
            $qdefaults['viewsview'] = false;
            break;
        }
    }
    foreach ($results as $result) {
        if (isset($result['question'])) {
            $fields = qa_post_html_fields($result['question'], $userid, qa_cookie_get(), $usershtml, null, qa_post_html_options($result['question'], $qdefaults));
        } elseif (isset($result['url'])) {
            $fields = array('what' => qa_html($result['url']), 'meta_order' => qa_lang_html('main/meta_order'));
        } else {
            continue;
        }
        // nothing to show here
        if (isset($qdefaults['blockwordspreg'])) {
            $result['title'] = qa_block_words_replace($result['title'], $qdefaults['blockwordspreg']);
        }
        $fields['title'] = qa_html($result['title']);
        $fields['url'] = qa_html($result['url']);
        $qa_content['q_list']['qs'][] = $fields;
    }
    $qa_content['page_links'] = qa_html_page_links(qa_request(), $start, $pagesize, $start + $gotcount, qa_opt('pages_prev_next'), array('q' => $inquery), $gotcount >= $count);
    if (qa_opt('feed_for_search')) {
        $qa_content['feed'] = array('url' => qa_path_html(qa_feed_request('search/' . $inquery)), 'label' => qa_lang_html_sub('main/results_for_x', qa_html($inquery)));
    }
    if (empty($qa_content['page_links'])) {
        $qa_content['suggest_next'] = qa_html_suggest_qs_tags(qa_using_tags());
    }
} else {
    $qa_content['error'] = qa_lang_html('main/search_explanation');
}
开发者ID:gogupe,项目名称:question2answer-releases,代码行数:31,代码来源:qa-page-search.php


示例16: process_event

该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP qa_call_override函数代码示例发布时间:2022-05-15
下一篇:
PHP qa_block_words_match_all函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap