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


PHP Answer::getSpecialCategoryTag方法代码示例

本文整理汇总了PHP中Answer::getSpecialCategoryTag方法的典型用法代码示例。如果您正苦于以下问题:PHP Answer::getSpecialCategoryTag方法的具体用法?PHP Answer::getSpecialCategoryTag怎么用?PHP Answer::getSpecialCategoryTag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Answer的用法示例。


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

示例1: create

 function create()
 {
     global $wgUser, $wgContLang;
     if (wfReadOnly()) {
         return false;
     }
     if (empty($this->title) || !$this->title->userCan('edit') || !$this->title->userCan('create')) {
         return false;
     }
     if ($this->badWordsTest()) {
         return false;
     }
     if (!wfRunHooks('CreateDefaultQuestionPageFilter', array($this->title))) {
         wfDebug(__METHOD__ . ": question '{$this->title}' filtered out by hook\n");
         return false;
     }
     if ($this->searchTest()) {
         return false;
     }
     $default_text = Answer::getSpecialCategoryTag("unanswered");
     //add default category tags passed in
     if ($this->categories) {
         $categories_array = explode("|", $this->categories);
         foreach ($categories_array as $category) {
             $default_text .= "\n[[" . $wgContLang->getNsText(NS_CATEGORY) . ":" . ucfirst($category) . "]]";
         }
     }
     $flags = EDIT_NEW;
     $article = new Article($this->title);
     $article->doEdit($default_text, wfMsgForContent("new_question_comment"), $flags);
     if ($wgUser->isLoggedIn()) {
         // check user preferences before adding to watchlist (RT #45647)
         $watchCreations = $wgUser->getGlobalPreference('watchcreations');
         if (!empty($watchCreations)) {
             $wgUser->addWatch($this->title);
         }
     }
     //store question in session so we can give attribution if they create an account afterwards
     $_SESSION['wsQuestionAsk'] = "";
     if ($wgUser->isAnon()) {
         $_SESSION['wsQuestionAsk'] = $this->question;
     }
     return true;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:44,代码来源:DefaultQuestion.php

示例2: create

 function create($text)
 {
     global $wgOut, $wgUser, $wgContLang;
     if (wfReadOnly()) {
         return false;
     }
     if ($this->badWordsTest()) {
         return false;
     }
     if (!wfRunHooks('CreateDefaultQuestionPageFilter', array($this->title))) {
         return false;
     }
     if (!$this->title->userCan('edit') || !$this->title->userCan('create')) {
         return false;
     }
     if ($this->searchTest()) {
         return false;
     }
     $default_text = $text . Answer::getSpecialCategoryTag("unanswered");
     //add default category tags passed in
     if ($this->categories) {
         $categories_array = explode("|", $this->categories);
         foreach ($categories_array as $category) {
             $default_text .= "\n[[" . $wgContLang->getNsText(NS_CATEGORY) . ":" . ucfirst($category) . "]]";
         }
     }
     $flags = EDIT_NEW;
     $article = new Article($this->title);
     $article->doEdit($default_text, wfMsgForContent("new_question_comment"), $flags);
     if ($wgUser->isLoggedIn()) {
         $wgUser->addWatch($this->title);
     }
     //store question in session so we can give attribution if they create an account afterwards
     $_SESSION['wsQuestionAsk'] = "";
     if ($wgUser->isAnon()) {
         $_SESSION['wsQuestionAsk'] = $this->question;
     }
     return true;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:39,代码来源:PrefilledDefaultQuestion.php

示例3: fnMarkAsAnswered

function fnMarkAsAnswered($editpage)
{
    global $wgRequest;
    $answered = Answer::getSpecialCategoryTag("answered");
    $unanswered = Answer::getSpecialCategoryTag("unanswered");
    if (!Answer::newFromTitle($editpage->mTitle)->isQuestion(false, false)) {
        return true;
    }
    if (Title::newFromRedirect($editpage->textbox1) != NULL) {
        return true;
    }
    if (Answer::isMarkedForDeletion($editpage->textbox1)) {
        $editpage->textbox1 = trim(str_ireplace(array($answered, $unanswered), '', $editpage->textbox1));
        return true;
    }
    if (Answer::isContentAnswered($editpage->textbox1)) {
        $editpage->textbox1 = trim(str_ireplace($unanswered, '', $editpage->textbox1));
        if (strpos($editpage->textbox1, $answered) === false) {
            $editpage->textbox1 = $editpage->textbox1 . "\n" . $answered;
        }
    } else {
        $editpage->textbox1 = trim(str_ireplace($answered, '', $editpage->textbox1));
        if (strpos($editpage->textbox1, $unanswered) === false) {
            $editpage->textbox1 = $unanswered . "\n" . $editpage->textbox1;
        }
    }
    $editpage->textbox1 = trim($editpage->textbox1);
    return true;
}
开发者ID:yusufchang,项目名称:app,代码行数:29,代码来源:Answers.php


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