示例#1
0
 /**
  * Fetch the unparsed text of a template and register a reference to it.
  * @param Title $title
  * @return array ( string or false, Title )
  */
 public function fetchTemplateAndTitle($title)
 {
     // Defaults to Parser::statelessFetchTemplate()
     $templateCb = $this->mOptions->getTemplateCallback();
     $stuff = call_user_func($templateCb, $title, $this);
     // We use U+007F DELETE to distinguish strip markers from regular text.
     $text = $stuff['text'];
     if (is_string($stuff['text'])) {
         $text = strtr($text, "", "?");
     }
     $finalTitle = isset($stuff['finalTitle']) ? $stuff['finalTitle'] : $title;
     if (isset($stuff['deps'])) {
         foreach ($stuff['deps'] as $dep) {
             $this->mOutput->addTemplate($dep['title'], $dep['page_id'], $dep['rev_id']);
             if ($dep['title']->equals($this->getTitle())) {
                 // If we transclude ourselves, the final result
                 // will change based on the new version of the page
                 $this->mOutput->setFlag('vary-revision');
             }
         }
     }
     return array($text, $finalTitle);
 }
示例#2
0
 /**
  * Fetch the unparsed text of a template and register a reference to it.
  * @param Title $title
  * @return Array ( string or false, Title )
  */
 function fetchTemplateAndTitle($title)
 {
     $templateCb = $this->mOptions->getTemplateCallback();
     # Defaults to Parser::statelessFetchTemplate()
     $stuff = call_user_func($templateCb, $title, $this);
     $text = $stuff['text'];
     $finalTitle = isset($stuff['finalTitle']) ? $stuff['finalTitle'] : $title;
     if (isset($stuff['deps'])) {
         foreach ($stuff['deps'] as $dep) {
             $this->mOutput->addTemplate($dep['title'], $dep['page_id'], $dep['rev_id']);
             if ($dep['title']->equals($this->getTitle())) {
                 // If we transclude ourselves, the final result
                 // will change based on the new version of the page
                 $this->mOutput->setFlag('vary-revision');
             }
         }
     }
     return array($text, $finalTitle);
 }
示例#3
0
 /**
  * Fetch the unparsed text of a template and register a reference to it.
  * @param Title $title
  * @return Array ( string or false, Title )
  */
 function fetchTemplateAndTitle($title)
 {
     $templateCb = $this->mOptions->getTemplateCallback();
     # Defaults to Parser::statelessFetchTemplate()
     $stuff = call_user_func($templateCb, $title, $this);
     $text = $stuff['text'];
     $finalTitle = isset($stuff['finalTitle']) ? $stuff['finalTitle'] : $title;
     if (isset($stuff['deps'])) {
         foreach ($stuff['deps'] as $dep) {
             $this->mOutput->addTemplate($dep['title'], $dep['page_id'], $dep['rev_id']);
         }
     }
     return array($text, $finalTitle);
 }