本文整理汇总了PHP中Place::placeAbbrevsGetData方法的典型用法代码示例。如果您正苦于以下问题:PHP Place::placeAbbrevsGetData方法的具体用法?PHP Place::placeAbbrevsGetData怎么用?PHP Place::placeAbbrevsGetData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Place
的用法示例。
在下文中一共展示了Place::placeAbbrevsGetData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: placeAbbrevsAdd
protected function placeAbbrevsAdd($titleString, $xml)
{
$this->placeAbbrevsSeenPlaces = array();
$title = Title::newFromText($titleString, NS_PLACE);
$titleString = $title->getDBkey();
list($prefName, $locatedIn) = Place::getPrefNameLocatedIn($titleString);
list($alis, $altNames) = Place::placeAbbrevsGetData($xml);
// get wlh
$dbr =& wfGetDB(DB_SLAVE);
$sql = 'select * from pagelinks' . ' where pl_namespace = 106 and pl_title = ' . $dbr->addQuotes($titleString) . ' and exists (select * from page where page_namespace = 106 and page_title = pl_title and page_is_redirect = 0)' . ' and exists (select * from page where page_id = pl_from and page_namespace = 108)' . ' limit 1';
$rows = $dbr->query($sql, 'placeAbbrevsCountPagelinks');
$errno = $dbr->lastErrno();
$wlh = 1;
while ($row = $dbr->fetchObject($rows)) {
$wlh = 0;
}
$dbr->freeResult($rows);
// $priority includes $numSpaces from parent places, which it shouldn't
$parents = Place::placeAbbrevsGetParents($locatedIn);
foreach ($parents as $parentName => $priority) {
$numSpaces = substr_count($prefName, ' ');
Place::placeAbbrevsInsertAbbrevs($prefName, $prefName, $parentName, $titleString, $wlh + $numSpaces + $priority + 10);
foreach ($altNames as $altName) {
$numSpaces = substr_count($altName, ' ');
Place::placeAbbrevsInsertAbbrevs($altName, $prefName, $parentName, $titleString, $wlh + $numSpaces + $priority + 24);
}
}
foreach ($alis as $ali) {
$parents = Place::placeAbbrevsGetParents($ali);
foreach ($parents as $primaryName => $priority) {
$numSpaces = substr_count($prefName, ' ');
Place::placeAbbrevsInsertAbbrevs($prefName, $prefName, $primaryName, $titleString, $wlh + $numSpaces + $priority + 11);
foreach ($altNames as $altName) {
$numSpaces = substr_count($altName, ' ');
Place::placeAbbrevsInsertAbbrevs($altName, $prefName, $primaryName, $titleString, $wlh + $numSpaces + $priority + 25);
}
}
}
}