本文整理汇总了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;
}
示例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;
}
示例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;
}