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


PHP DIWikiPage::getSortKey方法代码示例

本文整理汇总了PHP中SMW\DIWikiPage::getSortKey方法的典型用法代码示例。如果您正苦于以下问题:PHP DIWikiPage::getSortKey方法的具体用法?PHP DIWikiPage::getSortKey怎么用?PHP DIWikiPage::getSortKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SMW\DIWikiPage的用法示例。


在下文中一共展示了DIWikiPage::getSortKey方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getSemanticData

 /**
  * @see SMWStore::getSemanticData()
  * @since 1.8
  *
  * @param DIWikiPage $subject
  * @param string[]|bool $filter
  */
 public function getSemanticData(DIWikiPage $subject, $filter = false)
 {
     // *** Find out if this subject exists ***//
     $sortKey = '';
     $sid = $this->store->smwIds->getSMWPageIDandSort($subject->getDBkey(), $subject->getNamespace(), $subject->getInterwiki(), $subject->getSubobjectName(), $sortKey, true, true);
     // Ensures that a cached item to contain an expected sortKey when
     // for example the ID was just created and the sortKey from the DB
     // is empty otherwise the DB wins over the invoked sortKey
     if (!$sortKey) {
         $sortKey = $subject->getSortKey();
     }
     $subject->setSortKey($sortKey);
     if ($sid == 0) {
         // We consider redirects for getting $sid,
         // so $sid == 0 also means "no redirects".
         return new SMWSemanticData($subject);
     }
     $propertyTableHashes = $this->store->smwIds->getPropertyTableHashes($sid);
     foreach ($this->store->getPropertyTables() as $tid => $proptable) {
         if (!array_key_exists($proptable->getName(), $propertyTableHashes)) {
             continue;
         }
         if ($filter !== false) {
             $relevant = false;
             foreach ($filter as $typeId) {
                 $diType = DataTypeRegistry::getInstance()->getDataItemId($typeId);
                 $relevant = $relevant || $proptable->getDiType() == $diType;
                 if ($relevant) {
                     break;
                 }
             }
             if (!$relevant) {
                 continue;
             }
         }
         $this->getSemanticDataFromTable($sid, $subject, $proptable);
     }
     // Note: the sortkey is always set but belongs to no property table,
     // hence no entry in $this->store->m_sdstate[$sid] is made.
     self::$in_getSemanticData++;
     $this->initSemanticDataCache($sid, $subject);
     // Avoid adding a sortkey for an already extended stub
     if (!$this->store->m_semdata[$sid]->hasProperty(new DIProperty('_SKEY'))) {
         $this->store->m_semdata[$sid]->addPropertyStubValue('_SKEY', array('', $sortKey));
     }
     self::$in_getSemanticData--;
     return $this->store->m_semdata[$sid];
 }
开发者ID:jongfeli,项目名称:SemanticMediaWiki,代码行数:55,代码来源:SMW_SQLStore3_Readers.php

示例2: updateInterwikiField

 /**
  * @since  2.1
  *
  * @param integer $sid
  * @param DIWikiPage $subject
  * @param integer|string|null $interWiki
  */
 public function updateInterwikiField($sid, DIWikiPage $subject, $interWiki = null)
 {
     $this->store->getConnection()->update(self::tableName, array('smw_iw' => $interWiki !== null ? $interWiki : $subject->getInterWiki()), array('smw_id' => $sid), __METHOD__);
     $this->setCache($subject->getDBKey(), $subject->getNamespace(), $subject->getInterWiki(), $subject->getSubobjectName(), $sid, $subject->getSortKey());
 }
开发者ID:bogota,项目名称:SemanticMediaWiki,代码行数:12,代码来源:SMW_Sql3SmwIds.php

示例3: testSortKeyRoundtrip

 /**
  * @dataProvider sortKeyProvider
  */
 public function testSortKeyRoundtrip($title, $sortkey, $expected)
 {
     $instance = new DIWikiPage($title, NS_MAIN);
     $instance->setSortKey($sortkey);
     $this->assertEquals($expected, $instance->getSortKey());
 }
开发者ID:WolfgangFahl,项目名称:SemanticMediaWiki,代码行数:9,代码来源:DIWikiPageTest.php


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