本文整理汇总了PHP中Place::placeAbbrevsDelete方法的典型用法代码示例。如果您正苦于以下问题:PHP Place::placeAbbrevsDelete方法的具体用法?PHP Place::placeAbbrevsDelete怎么用?PHP Place::placeAbbrevsDelete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Place
的用法示例。
在下文中一共展示了Place::placeAbbrevsDelete方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: propagateMoveDeleteUndelete
/**
* Propagate move, delete, or undelete to other articles if necessary
*
* @param String $newTitleString null in case of delete; same as this title string in case of undelete
* @param String $text text of article
* @param bool $textChanged we never change the text, so this is never set to true
* @return bool true if success
*/
protected function propagateMoveDeleteUndelete($newTitleString, $newNs, &$text, &$textChanged)
{
$result = true;
// move: maintain place abbrevs and add place redirect job
if ($newTitleString && $newTitleString != $this->titleString) {
Place::placeAbbrevsDelete($this->titleString);
Place::placeAbbrevsDelete($newTitleString);
Place::placeAbbrevsAdd($newTitleString, $this->xml);
// edit wlh pages to point to the target title
$newTitle = Title::newFromText($newTitleString, NS_PLACE);
$job = new PlaceRedirectJob(array('old_title' => $this->titleString, 'new_title' => $newTitle->getText()));
$job->insert();
} else {
if (!$newTitleString) {
Place::placeAbbrevsDelete($this->titleString);
}
}
// determine parents and type and lat and lng
list($alsoLocatedIn, $type, $lat, $lng, $fromYear, $toYear) = Place::getPropagatedData($this->xml);
// get new name pieces
$newName = Place::getPrefNameLocatedIn($newTitleString);
// follow redirects
$t = (string) $this->locatedIn ? Title::newFromText((string) $this->locatedIn, NS_PLACE) : null;
if ($t) {
$t = StructuredData::getRedirectToTitle($t);
}
$oldLocatedIn = $t ? $t->getText() : (string) $this->locatedIn;
$t = $newName[1] ? Title::newFromText($newName[1], NS_PLACE) : null;
if ($t) {
$t = StructuredData::getRedirectToTitle($t);
}
$newLocatedIn = $t ? $t->getText() : $newName[1];
foreach ($alsoLocatedIn as $ali) {
$t = $ali['place'] ? Title::newFromText($ali['place'], NS_PLACE) : null;
if ($t) {
$t = StructuredData::getRedirectToTitle($t);
}
if ($t) {
$ali['place'] = $t->getText();
}
}
// if current located-in place is not also an also-located-in place
if (StructuredData::mapArraySearch($oldLocatedIn, $alsoLocatedIn, 'place') === false) {
if ($oldLocatedIn == $newLocatedIn) {
// update title in located-in place
$article = StructuredData::getArticle(Title::newFromText($oldLocatedIn, NS_PLACE), true);
if ($article) {
$content =& $article->fetchContent();
$updatedContent =& $this->updateContainedPlace($newTitleString, $type, $lat, $lng, $fromYear, $toYear, $content);
if ($updatedContent) {
$updateResult = $article->doEdit($updatedContent, self::PROPAGATE_MESSAGE . ' [[' . $this->title->getPrefixedText() . ']]', PROPAGATE_EDIT_FLAGS);
$result = $result && $updateResult;
}
}
} else {
// remove from current parent
$parentArticle = StructuredData::getArticle(Title::newFromText($oldLocatedIn, NS_PLACE), true);
if ($parentArticle) {
$content =& $parentArticle->fetchContent();
$updatedContent =& $this->updateContainedPlace(null, null, null, null, null, null, $content);
if ($updatedContent) {
$updateResult = $parentArticle->doEdit($updatedContent, self::PROPAGATE_MESSAGE . ' [[' . $this->title->getPrefixedText() . ']]', PROPAGATE_EDIT_FLAGS);
$result = $result && $updateResult;
}
}
}
}
// add to new parent if necessary
if ($oldLocatedIn != $newLocatedIn && StructuredData::mapArraySearch($newLocatedIn, $alsoLocatedIn, 'place') === false) {
$article = StructuredData::getArticle(Title::newFromText($newLocatedIn, NS_PLACE), true);
if ($article) {
$content =& $article->fetchContent();
$updatedContent =& $this->updateContainedPlace($newTitleString, $type, $lat, $lng, $fromYear, $toYear, $content);
if ($updatedContent) {
$updateResult = $article->doEdit($updatedContent, self::PROPAGATE_MESSAGE . ' [[' . $this->title->getPrefixedText() . ']]', PROPAGATE_EDIT_FLAGS);
$result = $result && $updateResult;
}
}
}
// update title in also-located-in places
foreach ($alsoLocatedIn as $pli) {
$article = StructuredData::getArticle(Title::newFromText((string) $pli['place'], NS_PLACE), true);
if ($article) {
$content =& $article->fetchContent();
$updatedContent =& $this->updateContainedPlace($newTitleString, $type, $lat, $lng, (string) $pli['from_year'], (string) $pli['to_year'], $content);
if ($updatedContent) {
$updateResult = $article->doEdit($updatedContent, self::PROPAGATE_MESSAGE . ' [[' . $this->title->getPrefixedText() . ']]', PROPAGATE_EDIT_FLAGS);
$result = $result && $updateResult;
}
}
}
if (!$result) {
//.........这里部分代码省略.........