當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Place::placeAbbrevsInsertAbbrevs方法代碼示例

本文整理匯總了PHP中Place::placeAbbrevsInsertAbbrevs方法的典型用法代碼示例。如果您正苦於以下問題:PHP Place::placeAbbrevsInsertAbbrevs方法的具體用法?PHP Place::placeAbbrevsInsertAbbrevs怎麽用?PHP Place::placeAbbrevsInsertAbbrevs使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Place的用法示例。


在下文中一共展示了Place::placeAbbrevsInsertAbbrevs方法的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);
             }
         }
     }
 }
開發者ID:k-hasan-19,項目名稱:wiki,代碼行數:39,代碼來源:Place.php


注:本文中的Place::placeAbbrevsInsertAbbrevs方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。