当前位置: 首页>>代码示例>>PHP>>正文


PHP Place::placeAbbrevsGetData方法代码示例

本文整理汇总了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);
             }
         }
     }
 }
开发者ID:k-hasan-19,项目名称:wiki,代码行数:39,代码来源:Place.php


注:本文中的Place::placeAbbrevsGetData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。