예제 #1
0
 function __construct($question)
 {
     global $wgRequest;
     //if its all caps, tone it down!
     if (strtoupper($question) == $question) {
         $question = strtolower($question);
     }
     //strip question marks and slashes
     $question = Answer::q2s($question);
     $question = str_replace("?", " ", $question);
     //remove "Ask a question" or equivalent if it got here
     //question is in DBkey form, with underscores
     $search = str_replace(" ", "_", wfMsgForContent('ask_a_question'));
     if (strpos($question, $search) === 0) {
         $question = substr($question, strlen($search));
         $question = ltrim($question);
     }
     $this->title = Title::makeTitleSafe(NS_MAIN, $question);
     if (!$this->title) {
         return null;
     }
     $this->question = $this->title->getText();
     $this->categories = $wgRequest->getVal("categories");
 }