本文整理汇总了PHP中Article::fetchContent方法的典型用法代码示例。如果您正苦于以下问题:PHP Article::fetchContent方法的具体用法?PHP Article::fetchContent怎么用?PHP Article::fetchContent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Article
的用法示例。
在下文中一共展示了Article::fetchContent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: redircite_render
function redircite_render($input, $args, &$parser) {
// Generate HTML code and add it to the $redirciteMarkerList array
// Add "xx-redircite-marker-NUMBER-redircite-xx" to the output,
// which will be translated to the HTML stored in $redirciteMarkerList by
// redircite_afterTidy()
global $redirciteMarkerList;
# Verify that $input is a valid title
$inputTitle = Title::newFromText($input);
if(!$inputTitle)
return $input;
$link1 = $parser->recursiveTagParse("[[$input]]");
$title1 = Title::newFromText($input);
if(!$title1->exists()) // Page doesn't exist
// Just output a normal (red) link
return $link1;
$articleObj = new Article($title1);
$title2 = Title::newFromRedirect($articleObj->fetchContent());
if(!$title2) // Page is not a redirect
// Just output a normal link
return $link1;
$link2 = $parser->recursiveTagParse("[[{$title2->getPrefixedText()}|$input]]");
$marker = "xx-redircite-marker-" . count($redirciteMarkerList) . "-redircite-xx";
$onmouseout = 'this.firstChild.innerHTML = "'. Xml::escapeJsString($input) . '";';
$onmouseover = 'this.firstChild.innerHTML = "' . Xml::escapeJsString($title2->getPrefixedText()) . '";';
return Xml::tags('span', array(
'onmouseout' => $onmouseout,
'onmouseover' => $onmouseover),
$link2);
}
示例2: execute
function execute($query)
{
global $wgRequest, $wgOut;
$wgOut->disable();
$this->setHeaders();
$page_name = $query;
$title = Title::newFromText($page_name);
if (is_null($title)) {
return;
}
if (!$title->userCan('read')) {
return;
}
$article = new Article($title);
$page_text = $article->fetchContent();
// Remove <noinclude> sections and <includeonly> tags from text
$page_text = StringUtils::delimiterReplace('<noinclude>', '</noinclude>', '', $page_text);
$page_text = strtr($page_text, array('<includeonly>' => '', '</includeonly>' => ''));
$orig_lines = explode("\n", $page_text);
// ignore lines that are either blank or start with a semicolon
$page_lines = array();
foreach ($orig_lines as $i => $line) {
if ($line != '' && $line[0] != ';') {
$page_lines[] = $line;
}
}
$headers = EDUtils::getValuesFromCSVLine($page_lines[0]);
$queried_headers = array();
foreach ($wgRequest->getValues() as $key => $value) {
foreach ($headers as $header_index => $header_value) {
$header_value = str_replace(' ', '_', $header_value);
if ($key == $header_value) {
$queried_headers[$header_index] = $value;
}
}
}
// include header in output
$text = $page_lines[0];
foreach ($page_lines as $i => $line) {
if ($i == 0) {
continue;
}
$row_values = EDUtils::getValuesFromCSVLine($line);
$found_match = true;
foreach ($queried_headers as $i => $query_value) {
$single_value = str_replace(' ', '_', $row_values[$i]);
if ($single_value != $query_value) {
$found_match = false;
}
}
if ($found_match) {
if ($text != '') {
$text .= "\n";
}
$text .= $line;
}
}
print $text;
}
示例3: Article
/**
* Take a bit of WikiText that looks like
* <rss max=5>http://example.com/</rss>
* and return an object that can produce rendered output.
*/
function __construct($url, $args)
{
$this->url = $url;
# Get max number of headlines from argument-array
if (isset($args['max'])) {
$this->maxheads = $args['max'];
}
# Get reverse flag from argument array
if (isset($args['reverse'])) {
$this->reversed = true;
}
# Get date format from argument array
# FIXME: not used yet
if (isset($args['date'])) {
$this->date = $args['date'];
}
# Get highlight terms from argument array
if (isset($args['highlight'])) {
# mapping to lowercase here so the regex can be case insensitive below.
$this->highlight = self::explodeOnSpaces($args['highlight']);
}
# Get filter terms from argument array
if (isset($args['filter'])) {
$this->filter = self::explodeOnSpaces($args['filter']);
}
if (isset($args['filterout'])) {
$this->filterOut = self::explodeOnSpaces($args['filterout']);
}
// 'template' is the pagename of a user's itemTemplate including
// a further pagename for the feedTemplate
// In that way everything is handled via these two pages
// and no default pages or templates are used.
// 'templatename' is an optional pagename of a user's feedTemplate
// In that way it substitutes $1 (default: RSSPost) in MediaWiki:Rss-item
if (isset($args['template'])) {
$itemTemplateTitleObject = Title::newFromText($args['template'], NS_TEMPLATE);
$itemTemplateArticleObject = new Article($itemTemplateTitleObject, 0);
$this->itemTemplate = $itemTemplateArticleObject->fetchContent();
} else {
if (isset($args['templatename'])) {
$feedTemplatePagename = $args['templatename'];
} else {
// compatibility patch for rss extension
$feedTemplatePagename = 'RSSPost';
$feedTemplateTitleObject = Title::newFromText($feedTemplatePagename, NS_TEMPLATE);
if (!$feedTemplateTitleObject->exists()) {
$feedTemplatePagename = Title::makeTitleSafe(NS_MEDIAWIKI, 'Rss-feed');
}
}
// MediaWiki:Rss-item = {{ feedTemplatePagename | title = {{{title}}} | ... }}
// if the attribute parameter templatename= is not present
// then it defaults to
// {{ Template:RSSPost | title = {{{title}}} | ... }} - if Template:RSSPost exists from pre-1.9 versions
// {{ MediaWiki:Rss-feed | title = {{{title}}} | ... }} - otherwise
$this->itemTemplate = wfMsgNoTrans('rss-item', $feedTemplatePagename);
}
}
示例4: addImageToArticle
function addImageToArticle($name)
{
$title = Title::newFromText($name);
echo $title->getText() . "\n";
$article = new Article($title, 0);
if (!$article) {
echo 'replaceText: Article not found.' . "\n";
return false;
}
$content = $article->fetchContent();
}
示例5: selection
/**
* Parses 'MediaWiki:Flagarticle-templatelist' with replaceLinks() and normal mediawiki parser
* Shows a selection of different templates (which are defined in the above message)
*
* @param $page String: title of the page that needs to be edited
*/
function selection($page)
{
global $wgOut;
$templatelist = new Article(Title::newFromText('flagpage-templatelist', NS_MEDIAWIKI));
$templatelistcontent = $templatelist->fetchContent();
if ($templatelistcontent == "") {
$wgOut->showErrorPage('flagpage-emptylisttitle', 'flagpage-emptylist');
}
$templatelistcontent = $this->replaceLinks($page, $templatelistcontent);
$wgOut->addWikiText('<div class="plainlinks">' . $templatelistcontent . '</div>');
}
示例6: getRS
function getRS()
{
global $wgMemc;
$key_rs = wfMemcKey("risingstar-feed3:" . date('YmdG') . ":" . number_format(date('i') / 10, 0, '', ''));
$rsOut = $wgMemc->get($key_rs);
if (!empty($rsOut)) {
return $rsOut;
}
$t = Title::newFromText('wikiHow:Rising-star-feed');
if ($t->getArticleId() > 0) {
$r = Revision::newFromTitle($t);
$text = $r->getText();
} else {
return false;
}
//NOTE: temporary patch to handle archives. the authoritative source for RS needs to be moved to the DB versus the feed article. add archive to array.
$archives = array('wikiHow:Rising-star-feed/archive1');
foreach ($archives as $archive) {
$tarch = Title::newFromText($archive);
if ($tarch->getArticleId() > 0) {
$r = Revision::newFromTitle($tarch);
$text = $r->getText() . "\n" . $text;
}
}
$rsout = array();
$rs = $text;
$rs = preg_replace("/==\n/", ',', $rs);
$rs = preg_replace("/^==/", "", $rs);
$lines = preg_split("/\r|\n/", $rs, null, PREG_SPLIT_NO_EMPTY);
$count = 0;
foreach ($lines as $line) {
if (preg_match('/^==(.*?),(.*?)$/', $line, $matches)) {
$dt = $matches[1];
$pattern = "/{$wgServer}/";
$title = preg_replace("/http:\\/\\/www\\.wikihow\\.com\\//", "", $matches[2]);
$title = preg_replace("/http:\\/\\/.*?\\.com\\//", "", $matches[2]);
$t = Title::newFromText($title);
if (!isset($t)) {
continue;
}
$a = new Article($t);
if ($a->isRedirect()) {
$t = Title::newFromRedirect($a->fetchContent());
$a = new Article($t);
}
$rsout[$t->getPartialURL()] = $dt;
}
}
// sort by most recent first
$rsout = array_reverse($rsout);
$wgMemc->set($key_rs, $rsout);
return $rsout;
}
示例7: getParsedArticleContent
/**
* Gets the content of the article with the provided page name,
* or an empty string when there is no such article.
*
* @since 0.1
*
* @param string $pageName
*
* @return string
*/
public static function getParsedArticleContent($pageName)
{
$title = Title::newFromText($pageName);
if (is_null($title)) {
return '';
}
$article = new Article($title, 0);
global $wgParser, $wgContestEmailParse;
$wgContestEmailParse = true;
$text = $wgParser->parse($article->fetchContent(), $article->getTitle(), $article->getParserOptions())->getText();
$wgContestEmailParse = false;
return $text;
}
示例8: execute
public function execute()
{
global $wgTitle;
$res = $this->queryPages();
if (!$res || count($res) === 0) {
$this->log('No results');
} else {
$this->log(count($res) . ' results found');
}
if ($this->hasOption('from')) {
$from = trim($this->getOption('from'));
$skip = true;
}
//echo $from; exit;
//$this->log(print_r($res,true));
foreach ($res as $row) {
if (isset($from)) {
if (trim($row->page_title) == $from) {
$skip = false;
}
if ($skip) {
$this->log('Skipping ' . $row->page_title);
continue;
}
}
$title = Title::newFromText($row->page_title);
$article = new Article($title, 0);
if (!$article) {
$this->log('Page title not found: ' . $row->page_title);
return false;
}
$content = $article->fetchContent();
if (preg_match('%{{(Plant|Cultivar|Cultivar group|Variety|Subspecies)%ui', $content, $m)) {
$has_tpl = preg_match('%{{Article state%ui', $content, $matched);
if (!$has_tpl) {
$this->log($title->getText());
$this->log('Adding article state template');
$content .= "{{Article state\n|article cleanup=Yes\n|article incomplete=Yes\n|article citations=No\n}}";
$edit_summary = 'Adding article state template.';
$article->doEdit($content, $edit_summary, EDIT_MINOR);
} else {
$this->log($row->page_title . ' already has article state template. Skipping.');
}
}
}
}
示例9: showDiff
/**
* Get a diff between the current contents of the edit box and the
* version of the page we're editing from.
*
* If this is a section edit, we'll replace the section as for final
* save and then make a comparison.
*/
function showDiff()
{
$oldtext = $this->mArticle->fetchContent();
$newtext = $this->mArticle->replaceSection($this->section, $this->textbox1, $this->summary, $this->edittime);
wfRunHooks('EditPageGetDiffText', array($this, &$newtext));
$newtext = $this->mArticle->preSaveTransform($newtext);
$oldtitle = wfMsgExt('currentrev', array('parseinline'));
$newtitle = wfMsgExt('yourtext', array('parseinline'));
if ($oldtext !== false || $newtext != '') {
$de = new DifferenceEngine($this->mTitle);
$de->setText($oldtext, $newtext);
$difftext = $de->getDiff($oldtitle, $newtitle);
$de->showDiffStyle();
} else {
$difftext = '';
}
global $wgOut;
$wgOut->addHTML('<div id="wikiDiff">' . $difftext . '</div>');
}
示例10: convert
function convert($source, $target, $startdate)
{
$date = getdate(strtotime($startdate));
$month = $date['mon'];
$day = $date['mday'];
$year = $date['year'];
//$date = "$month-$day-$year";
$search = $source;
$pages = PrefixSearch::titleSearch($search, '10000');
$count = 0;
foreach ($pages as $page) {
$article = new Article(Title::newFromText($page));
$title = $article->getTitle()->getText();
$body = $article->fetchContent(0, false, false);
$titles .= $this->create_event($title, $body, $target);
$count++;
}
return $titles;
//return "$count records converted!";
}
示例11: Article
/**
* Take a bit of WikiText that looks like
* <rss max=5>http://example.com/</rss>
* and return an object that can produce rendered output.
*/
function __construct($url, $args)
{
$this->url = $url;
# Get max number of headlines from argument-array
if (isset($args['max'])) {
$this->maxheads = $args['max'];
}
# Get reverse flag from argument array
if (isset($args['reverse'])) {
$this->reversed = true;
}
# Get date format from argument array
# FIXME: not used yet
if (isset($args['date'])) {
$this->date = $args['date'];
}
# Get highlight terms from argument array
if (isset($args['highlight'])) {
# mapping to lowercase here so the regex can be case insensitive below.
$this->highlight = self::explodeOnSpaces($args['highlight']);
}
# Get filter terms from argument array
if (isset($args['filter'])) {
$this->filter = self::explodeOnSpaces($args['filter']);
}
if (isset($args['filterout'])) {
$this->filterOut = self::explodeOnSpaces($args['filterout']);
}
if (isset($args['template'])) {
$titleObject = Title::newFromText($args['template'], NS_TEMPLATE);
$article = new Article($titleObject, 0);
$this->itemTemplate = $article->fetchContent();
} else {
$templateName = isset($args['templatename']) ? $args['templatename'] : 'RSSPost';
$this->itemTemplate = wfMsgNoTrans('rss-item', $templateName);
}
}
示例12: efMultiBoilerplate
/**
* Generate the form to be displayed at the top of the edit page and insert it.
* @param $form EditPage object.
* @return true
*/
function efMultiBoilerplate($form)
{
// Get various variables needed for this extension.
global $wgMultiBoilerplateOptions, $wgMultiBoilerplateOverwrite, $wgTitle, $wgRequest;
// If $wgMultiBoilerplateOverwrite is true then detect whether
// the current page exists or not and if it does return true
// to end execution of this function.
if (!$wgMultiBoilerplateOverwrite && $wgTitle->exists($wgTitle->getArticleID())) {
return true;
}
// Generate the options list used inside the boilerplate selection box.
// If $wgMultiBoilerplateOptions is an array then use that, else fall back
// to the MediaWiki:Multiboilerplate message.
if (is_array($wgMultiBoilerplateOptions)) {
$options = '';
foreach ($wgMultiBoilerplateOptions as $name => $template) {
$selected = false;
if ($wgRequest->getVal('boilerplate') == $template) {
$selected = true;
}
$options .= Xml::option($name, $template, $selected);
}
} else {
$things = wfMsgForContent('multiboilerplate');
$options = '';
$things = explode("\n", str_replace("\r", "\n", str_replace("\r\n", "\n", $things)));
// Ensure line-endings are \n
foreach ($things as $row) {
if (substr(ltrim($row), 0, 1) === "*") {
$row = ltrim($row, '* ');
// Remove the asterix (and a space if found) from the start of the line.
$row = explode('|', $row);
if (!isset($row[1])) {
return true;
}
// Invalid syntax, abort.
$selected = false;
if ($wgRequest->getVal('boilerplate') == $row[1]) {
$selected = true;
}
$options .= Xml::option($row[0], $row[1], $selected);
}
}
}
// No options found in either configuration file, abort.
if ($options == '') {
return true;
}
// Append the selection form to the top of the edit page.
$form->editFormPageTop .= Xml::openElement('form', array('id' => 'multiboilerplateform', 'name' => 'multiboilerplateform', 'method' => 'get', 'action' => $wgTitle->getEditURL())) . Xml::openElement('fieldset') . Xml::element('legend', null, wfMsg('multiboilerplate-legend')) . Xml::openElement('label') . wfMsg('multiboilerplate-label') . Xml::openElement('select', array('name' => 'boilerplate')) . $options . Xml::closeElement('select') . Xml::closeElement('label') . ' ' . Html::Hidden('action', 'edit') . Html::Hidden('title', $wgRequest->getText('title')) . Xml::submitButton(wfMsg('multiboilerplate-submit')) . Xml::closeElement('fieldset') . Xml::closeElement('form');
// If the Load button has been pushed replace the article text with the boilerplate.
if ($wgRequest->getText('boilerplate', false)) {
$plate = new Article(Title::newFromURL($wgRequest->getVal('boilerplate')));
$content = $plate->fetchContent();
/* Strip out noinclude tags and contained data, and strip includeonly
* tags (but retain contained data). If a function exists in the
* parser exists to do this it would be nice to replace this with it (I
* found one with a name as if it would do this, but it didn't seam to
* work).
*/
$content = preg_replace('#<noinclude>(.*?)</noinclude>#ims', '', $content);
$content = preg_replace('#<includeonly>(.*?)</includeonly>#ims', '$1', $content);
// TODO: Handle <onlyinclude> tags.
$form->textbox1 = $content;
}
// Return true so things don't break.
return true;
}
示例13: execute
function execute($param)
{
global $wgOut, $wgRequest, $wgTitle, $wgUser, $wgMessageCache;
$this->setHeaders();
$title = Title::makeTitle(NS_SPECIAL, 'EasyGallery');
$par = 8;
# The $param is the number of text inputs to be replicated in the form
if (isset($param)) {
$par = $param;
} else {
if ($wgRequest->getText('wpParam', "")) {
$par = $wgRequest->getText('wpParam', "");
} else {
$par = 8;
}
}
# Extract any posted data
$posted = $wgRequest->getText('wpSubmit', false);
# Extract any contents of fields
$gtitle = $wgRequest->getText('wpGtitle', "");
$width = $wgRequest->getText('wpWidth', "");
$column = $wgRequest->getText('wpColumn', "");
# Render the form
$wgOut->addWikiText(wfMsg('easygalleryMessage', 'easygalleryParameter'));
$wgOut->addHTML(wfElement('form', array('action' => $title->getLocalURL('action=submit'), 'method' => 'post'), null) . "<br /><p><b>Usage</b></p>\n\t\t<p>This form creates a gallery in the page you enter below, whether the page exists or not.</p>\n\t\t<p>If there is already text in the page it will be retained but an existing gallery will be replaced by this one. You can have one gallery per page.</p>\n\t\t<p>This extension defaults to 8 pictures (plus captions), unless the number of pictures in your intended gallery is added to the address bar title, for example for five images:\n\t\thttp://localhost/wiki/index.php/Special:EasyGallery/5</p>\n\t\t<p>Here is the expected form of the picture and the caption:\n\t\tImage:Example.jpg\n Example Caption</p>\n\t\t<p>You can upload your pictures by clicking <a href='" . $wgServer . $wgScript . "/Special:Upload' target='_blank'>Special:Upload</a>.</p>\n\t\t<p>You can access the names of images already uploaded by clicking <a href='" . $wgServer . $wgScript . "/Special:ImageList' target='_blank'>Special:ImageList</a>.</p>\n\t\t<p>Press the Submit Query button, then you can go to the page and edit it normally if you want.</p>\n\t\t<br/ >\n\t\t<p><b>Page Setup</b></p>\n\t\t<p>What is the title of the page your gallery will be in? This is a compulsory field.</p>\n\t\t<input name='wpGtitle' size = '35' />\n\t\t<p>How many columns do you want the easygallery to have? If you leave the field empty it is 2.</p>\n\t\t<input name='wpColumn' size = '10' />\n\t\t<p>How wide do you want each thumbnail to be (in pixels)? Empty field is 150.</p>\n\t\t<input name='wpWidth' size = '10' />\n\t\t<input type='hidden' name='wpParam' value={$par}><br /><br />");
# Render multiple inputs using the /$par from the url
for ($ctr = 1; $ctr <= $par; $ctr++) {
$wgOut->addHTML("<p><b>Gallery " . $ctr . "</b></p>\n\t\t\t<p>The image you want for the thumbnail.</p>\n\t\t\t<input name='wpUrl" . $ctr . "' size = '50' />\n\t\t\t<p>The caption for this image.</p>\n\t\t\t<input name='wpCaption" . $ctr . "' size = '50' />");
}
# Post
$wgOut->addHTML("<br /><br />" . wfElement('input', array('name' => 'wpSubmit', 'type' => 'submit')) . "<br /><br />");
# Process results if data posted
if ($posted) {
# Defaults for posted style elements
if ($width == "") {
$width = 200;
}
if ($column == "") {
$column = 2;
}
# Build tag
$tag = "<\ngallery widths='" . $width . "px' perrow='" . $column . "'>\n";
# Some arrays to populate with loops
$url[] = array();
$caption[] = array();
# Make some variables out of the posted fields
for ($n = 1; $n <= $par; $n++) {
$url[$n] = $wgRequest->getText('wpUrl' . $n, "");
$caption[$n] = $wgRequest->getText('wpCaption' . $n, "");
}
for ($n = 1; $n <= $par; $n++) {
if ($url[$n] != "") {
$tag .= $url[$n] . "|<center>" . $caption[$n] . "</center>\n";
}
}
$tag .= "</gallery>";
if ($wgUser->isAllowed('edit')) {
$title = Title::newFromText($gtitle);
if (trim($wgRequest->getText('wpGtitle')) == '') {
$wgTitle = Title::newFromText(wfMsgForContent('badtitle'));
$wgOut->errorpage('badtitle', 'badtitletext');
}
# Make the new page if no page exists.
if (isset($title) && $title->getArticleID() == 0) {
$article = new Article($title);
$article->doEdit($tag, "", EDIT_NEW);
$wgOut->addHTML(wfMsg('easygallerySuccessMessage'));
} elseif (isset($title) && $title->getArticleID() != 0) {
$article = new Article($title, 0);
$original = $article->fetchContent(0);
$intro = preg_replace("%<gallery.*%is", "", $original);
$outro = preg_replace("%.*</gallery>%is", "", $original);
$tag = $intro . $tag . $outro;
$article->doEdit($tag, "", EDIT_UPDATE);
$wgOut->addHTML(wfMsg('easygallerySuccessMessage'));
} else {
$wgTitle = Title::newFromText(wfMsgForContent('badtitle'));
$wgOut->errorpage('error', 'badtitletext');
}
} else {
$wgTitle = Title::newFromText(wfMsgForContent('badtitle'));
$wgOut->errorpage('error', 'badarticleerror');
}
}
}
示例14: doMerge
//.........这里部分代码省略.........
} else {
$this->addFamilyMembersToRequestData($requestData, $mergingPeople, 'husband', $husbandCount, $this->data[$m][$p]['husbands']);
$this->addFamilyMembersToRequestData($requestData, $mergingPeople, 'wife', $wifeCount, $this->data[$m][$p]['wives']);
$this->addFamilyMembersToRequestData($requestData, $mergingPeople, 'child', $childrenCount, $this->data[$m][$p]['children']);
}
$pageContents = $this->mapContents($sourcesMap[$p], $imagesMap[$p], $notesMap[$p], $this->data[$m][$p]['contents']);
$this->addContents($contents, $keepKeys[$p], $pageContents);
if ($p > 0) {
if ($mergeSummary) {
$mergeSummary .= ', ';
}
if ($mainOutput) {
$mainOutput .= ', ';
}
if ($this->data[$m][$p]['gedcom']) {
$mergeSummary .= 'gedcom';
$mainOutput .= htmlspecialchars(($mergeTargetNs == NS_FAMILY ? 'Family:' : 'Person:') . $this->data[$m][$p]['title']);
} else {
$title = Title::newFromText($this->data[$m][$p]['title'], $mergeTargetNs);
$mergeSummary .= "[[" . $title->getPrefixedText() . "]]";
$mainOutput .= $skin->makeKnownLinkObj($title, htmlspecialchars($title->getPrefixedText()), 'redirect=no');
}
}
}
}
// redirect other pages to merge target
$redir = "#REDIRECT [[" . $mergeTargetTitle->getPrefixedText() . "]]";
$talkRedir = "#REDIRECT [[" . $mergeTargetTalkTitle->getPrefixedText() . "]]";
for ($p = 1; $p < count($this->data[$m]); $p++) {
if (!$this->data[$m][$p]['gedcom']) {
$obj = $this->data[$m][$p]['object'];
$comment = $this->makeComment($this->userComment, "merge into [[" . $mergeTargetTitle->getPrefixedText() . "]]" . $mergeCmtFamily, $mergeCmtSuffix);
$obj->editPage($emptyRequest, $redir, $comment, $editFlags, false);
// redir talk page as well
if ($this->data[$m][$p]['talkrevid']) {
// if talk page exists
$talkTitle = Title::newFromText($this->data[$m][$p]['title'], $mergeTargetTalkNs);
$article = new Article($talkTitle, 0);
if ($article) {
$this->addTalkContents($talkContents, $talkTitle, $article->fetchContent());
if ($talkMergeSummary) {
$talkMergeSummary .= ', ';
}
if ($talkOutput) {
$talkOutput .= ', ';
}
$talkMergeSummary .= "[[" . $talkTitle->getPrefixedText() . "]]";
$talkOutput .= $skin->makeKnownLinkObj($talkTitle, htmlspecialchars($talkTitle->getPrefixedText()), 'redirect=no');
$comment = $this->makeComment($this->userComment, "merge into [[" . $mergeTargetTalkTitle->getPrefixedText() . "]]" . $mergeCmtFamily, $mergeCmtSuffix);
$article->doEdit($talkRedir, $comment, $editFlags);
}
}
}
}
// update merge target talk
if ($talkContents) {
$article = new Article($mergeTargetTalkTitle, 0);
if ($article) {
$mergeTargetTalkContents = $article->fetchContent();
if ($mergeTargetTalkContents) {
$mergeTargetTalkContents = rtrim($mergeTargetTalkContents) . "\n\n";
}
$comment = $this->makeComment($this->userComment, 'merged with ' . $talkMergeSummary . $mergeCmtFamily, $mergeCmtSuffix);
$article->doEdit($mergeTargetTalkContents . $talkContents, $comment, $editFlags);
if ($this->addWatches) {
StructuredData::addWatch($wgUser, $article, true);
}
}
$outputRow .= '<li>Merged ' . $talkOutput . ' into ' . $skin->makeKnownLinkObj($mergeTargetTalkTitle, htmlspecialchars($mergeTargetTalkTitle->getPrefixedText())) . "</li>";
}
$obj = $this->data[$m][0]['object'];
if ($mergeTargetNs == NS_PERSON) {
Person::addGenderToRequestData($requestData, $this->data[$m][0]['gender']);
} else {
// family
$obj->isMerging(true);
// to read propagated data from person pages, not from prev family revision
}
// update merge target
$req = new FauxRequest($requestData, true);
$comment = $this->makeComment($this->userComment, ($mergeSummary == 'gedcom' ? 'Add data from gedcom' : 'merged with ' . $mergeSummary) . $mergeCmtFamily, $mergeCmtSuffix);
$obj->editPage($req, $contents, $comment, $editFlags, $this->addWatches);
$outputRow .= '<li>Merged ' . $mainOutput . ' into ' . $skin->makeKnownLinkObj($mergeTargetTitle, htmlspecialchars($mergeTargetTitle->getPrefixedText())) . "</li>";
$outputRows[] = $outputRow;
}
// add log and recent changes
if (!$this->isGedcom()) {
if (!$mergeSummary) {
$mergeSummary = 'members of other families';
}
$mergeComment = 'Merge [[' . $mergeTargetTitle->getPrefixedText() . ']] and ' . $mergeSummary;
$log = new LogPage('merge', false);
$t = Title::makeTitle(NS_SPECIAL, "ReviewMerge/{$mergeLogId}");
$log->addEntry('merge', $t, $mergeComment);
RecentChange::notifyLog(wfTimestampNow(), $t, $wgUser, $mergeComment, '', 'merge', 'merge', $t->getPrefixedText(), $mergeComment, '', $isTrustedMerge, 0);
}
$nonmergedPages = $this->getNonmergedPages();
$output .= join("\n", array_reverse($outputRows)) . '</ul>' . ($nonmergedPages ? '<p>In addition to the people listed above, the following have also been included in the target family' . ($this->isGedcom() ? '<br/>(GEDCOM people listed will be added when the GEDCOM is imported)' : '') . $nonmergedPages . "</p>\n" : '') . ($this->isGedcom() ? '' : '<p>' . $skin->makeKnownLinkObj(Title::makeTitle(NS_SPECIAL, 'ReviewMerge/' . $mergeLogId), htmlspecialchars("Review/undo merge")) . '<br>' . $skin->makeKnownLinkObj(Title::makeTitle(NS_SPECIAL, 'ShowDuplicates'), htmlspecialchars("Show more duplicates")) . '</p>');
return $output;
}
示例15: execute
//.........这里部分代码省略.........
</div>
</div>
<div class="portlet" id="p-logo">
<a style="background-image: url(<?php
$this->text('logopath');
?>
);" <?php
?>
href="<?php
echo htmlspecialchars($this->data['nav_urls']['mainpage']['href']);
?>
"<?php
echo $skin->tooltipAndAccesskey('n-mainpage');
?>
></a>
</div>
<table id="column-content" width="!00%" cellpadding="0" cellspacing="0">
<tr>
<td colspan="2">
<div id="top-div" />
</td>
<tr>
<td id="column-one">
<script type="<?php
$this->text('jsmimetype');
?>
"> if (window.isMSIE55) fixalpha(); </script>
<?php
# MediaWiki:Sidebar
global $wgUser, $wgTitle, $wgParser;
$title = 'sidebar';
$article = new Article(Title::newFromText($title, NS_MEDIAWIKI));
$text = $article->fetchContent();
if (empty($text)) {
$text = wfMsg($title);
}
if (is_object($wgParser)) {
$psr = $wgParser;
$opt = $wgParser->mOptions;
} else {
$psr = new Parser();
$opt = NULL;
}
if (!is_object($opt)) {
$opt = ParserOptions::newFromUser($wgUser);
}
echo $psr->parse($text, $wgTitle, $opt, true, true)->getText();
?>
</td><!-- end of the left (by default at least) column -->
<td id="content" width="100%">
<a name="top" id="top"></a>
<?php
if ($this->data['sitenotice']) {
?>
<div id="siteNotice"><?php
$this->html('sitenotice');
?>
</div><?php
}
?>
<h1 class="firstHeading"><?php
$this->html('title');
?>
</h1>
<div id="bodyContent">