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


PHP DIWikiPage::getNamespace方法代码示例

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


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

示例1: getContainerFor

 /**
  * @since 2.4
  *
  * @param DIProperty $property
  * @param array|string $errorMsg
  *
  * @return DIContainer
  */
 public function getContainerFor(DIProperty $property = null, $errorMsg = '')
 {
     if ($property !== null && $property->isInverse()) {
         $property = new DIProperty($property->getKey());
     }
     $errorMsg = is_array($errorMsg) ? implode(' ', $errorMsg) : $errorMsg;
     $subject = new DIWikiPage($this->subject->getDBkey(), $this->subject->getNamespace(), $this->subject->getInterwiki(), '_ERR' . md5(($property !== null ? $property->getKey() : 'UNKNOWN') . $errorMsg));
     // Encode brackets to avoid an annotion is created/included
     return $this->newDiContainer($subject, $property, InTextAnnotationParser::obscureAnnotation($errorMsg));
 }
开发者ID:WolfgangFahl,项目名称:SemanticMediaWiki,代码行数:18,代码来源:Error.php

示例2: encodePage

 /**
  * @since 2.2
  *
  * @param DIWikiPage $diWikiPage
  *
  * @return string
  */
 public static function encodePage(DIWikiPage $diWikiPage)
 {
     $localName = '';
     if ($diWikiPage->getInterwiki() !== '') {
         $localName = $diWikiPage->getInterwiki() . ':';
     }
     if ($diWikiPage->getNamespace() !== 0) {
         $localName .= str_replace(' ', '_', $GLOBALS['wgContLang']->getNSText($diWikiPage->getNamespace())) . ':' . $diWikiPage->getDBkey();
     } else {
         $localName .= $diWikiPage->getDBkey();
     }
     return self::encodeUri(wfUrlencode($localName));
 }
开发者ID:WolfgangFahl,项目名称:SemanticMediaWiki,代码行数:20,代码来源:Escaper.php

示例3: tryToFindLinksFor

 /**
  * @since  1.0
  *
  * @param DIWikiPage $subject
  */
 public function tryToFindLinksFor(DIWikiPage $subject)
 {
     if (!isset($this->propertySearchPatternByNamespace[$subject->getNamespace()])) {
         return;
     }
     $propertySearchPattern = $this->propertySearchPatternByNamespace[$subject->getNamespace()];
     $requestOptions = new RequestOptions();
     $requestOptions->sort = true;
     // Use 3 as buffer to broaden match possibilities
     $requestOptions->limit = 3;
     $this->doResolveAntecedentHierarchyRecursively($subject, $propertySearchPattern, $requestOptions);
     krsort($this->antecedentHierarchyLinks);
     if (!$this->findClosestDescendant) {
         return;
     }
     $this->doFindClosestDescendantByInverseLink($subject, $propertySearchPattern, $requestOptions);
 }
开发者ID:brandonphuong,项目名称:mediawiki,代码行数:22,代码来源:ByPropertyHierarchicalLinksFinder.php

示例4: newDIContainer

 /**
  * #1416 create container manually to avoid any issues that may arise from
  * a failed Title::makeTitleSafe.
  */
 private function newDIContainer(Query $query)
 {
     $subject = $query->getContextPage();
     if ($subject === null) {
         $containerSemanticData = ContainerSemanticData::makeAnonymousContainer();
     } else {
         $subject = new DIWikiPage($subject->getDBkey(), $subject->getNamespace(), $subject->getInterwiki(), $query->getQueryId());
         $containerSemanticData = new ContainerSemanticData($subject);
     }
     return new DIContainer($containerSemanticData);
 }
开发者ID:jongfeli,项目名称:SemanticMediaWiki,代码行数:15,代码来源:ProfileAnnotatorFactory.php

示例5: newContainerSemanticData

 private function newContainerSemanticData($hash)
 {
     if ($this->subject === null) {
         $containerSemanticData = ContainerSemanticData::makeAnonymousContainer();
         $containerSemanticData->skipAnonymousCheck();
     } else {
         $subobjectName = '_ERR' . md5($hash);
         $subject = new DIWikiPage($this->subject->getDBkey(), $this->subject->getNamespace(), $this->subject->getInterwiki(), $subobjectName);
         $containerSemanticData = new ContainerSemanticData($subject);
     }
     return $containerSemanticData;
 }
开发者ID:jongfeli,项目名称:SemanticMediaWiki,代码行数:12,代码来源:ProcessingErrorMsgHandler.php

示例6: getProperties

 /**
  * @see Store::getProperties
  *
  * @param DIWikiPage $subject
  * @param SMWRequestOptions|null $requestOptions
  *
  * @return SMWDataItem[]
  */
 public function getProperties(DIWikiPage $subject, SMWRequestOptions $requestOptions = null)
 {
     $sid = $this->store->smwIds->getSMWPageID($subject->getDBkey(), $subject->getNamespace(), $subject->getInterwiki(), $subject->getSubobjectName());
     if ($sid == 0) {
         // no id, no page, no properties
         return array();
     }
     $db = $this->store->getConnection();
     $result = array();
     // potentially need to get more results, since options apply to union
     if ($requestOptions !== null) {
         $suboptions = clone $requestOptions;
         $suboptions->limit = $requestOptions->limit + $requestOptions->offset;
         $suboptions->offset = 0;
     } else {
         $suboptions = null;
     }
     foreach ($this->store->getPropertyTables() as $propertyTable) {
         if ($propertyTable->usesIdSubject()) {
             $where = 's_id=' . $db->addQuotes($sid);
         } elseif ($subject->getInterwiki() === '') {
             $where = 's_title=' . $db->addQuotes($subject->getDBkey()) . ' AND s_namespace=' . $db->addQuotes($subject->getNamespace());
         } else {
             // subjects with non-emtpy interwiki cannot have properties
             continue;
         }
         if ($propertyTable->isFixedPropertyTable()) {
             // just check if subject occurs in table
             $res = $db->select($propertyTable->getName(), '*', $where, __METHOD__, array('LIMIT' => 1));
             if ($db->numRows($res) > 0) {
                 $result[] = new SMW\DIProperty($propertyTable->getFixedProperty());
             }
         } else {
             // select all properties
             $from = $db->tableName($propertyTable->getName());
             $from .= " INNER JOIN " . $db->tableName(SMWSql3SmwIds::TABLE_NAME) . " ON smw_id=p_id";
             $res = $db->select($from, 'DISTINCT smw_title,smw_sortkey', $where . $this->store->getSQLConditions($suboptions, 'smw_sortkey', 'smw_sortkey'), __METHOD__, $this->store->getSQLOptions($suboptions, 'smw_sortkey'));
             foreach ($res as $row) {
                 $result[] = new SMW\DIProperty($row->smw_title);
             }
         }
         $db->freeResult($res);
     }
     // apply options to overall result
     $result = $this->store->applyRequestOptions($result, $requestOptions);
     return $result;
 }
开发者ID:jongfeli,项目名称:SemanticMediaWiki,代码行数:55,代码来源:SMW_SQLStore3_Readers.php

示例7: getStatus

 /**
  * @param Title|SMWWikiPageValue|DIWikiPage $concept
  *
  * @return DIConcept|null
  */
 public function getStatus($concept)
 {
     $db = $this->store->getConnection();
     $cid = $this->store->smwIds->getSMWPageID($concept->getDBkey(), $concept->getNamespace(), '', '', false);
     // TODO: catch db exception
     $row = $db->selectRow('smw_fpt_conc', array('concept_txt', 'concept_features', 'concept_size', 'concept_depth', 'cache_date', 'cache_count'), array('s_id' => $cid), __METHOD__);
     if ($row === false) {
         return null;
     }
     $dataItem = new DIConcept($concept, null, $row->concept_features, $row->concept_size, $row->concept_depth);
     if ($row->cache_date) {
         $dataItem->setCacheStatus('full');
         $dataItem->setCacheDate($row->cache_date);
         $dataItem->setCacheCount($row->cache_count);
     } else {
         $dataItem->setCacheStatus('empty');
     }
     return $dataItem;
 }
开发者ID:jongfeli,项目名称:SemanticMediaWiki,代码行数:24,代码来源:ConceptCache.php

示例8: 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

示例9: newResultIterator

 private function newResultIterator(DIWikiPage $subject)
 {
     $connection = $this->store->getConnection('mw.db');
     $dbKey = $subject->getDBkey();
     // #1955 Ensure to match a possible predefined property
     // (Modification date -> _MDAT)
     if ($subject->getNamespace() === SMW_NS_PROPERTY) {
         $dbKey = DIProperty::newFromUserLabel($subject->getDBkey())->getKey();
     }
     $condition = 'smw_title = ' . $connection->addQuotes($dbKey) . ' AND ' . 'smw_namespace = ' . $connection->addQuotes($subject->getNamespace()) . ' AND ' . 'smw_iw = ' . $connection->addQuotes($subject->getInterwiki()) . ' AND ' . 'smw_subobject != ' . $connection->addQuotes('');
     foreach ($this->skipOn as $skipOn) {
         $condition .= ' AND smw_subobject != ' . $connection->addQuotes($skipOn);
     }
     $res = $connection->select($connection->tablename(SQLStore::ID_TABLE), array('smw_id', 'smw_subobject', 'smw_sortkey'), $condition, __METHOD__);
     return $this->iteratorFactory->newResultIterator($res);
 }
开发者ID:jongfeli,项目名称:SemanticMediaWiki,代码行数:16,代码来源:EntitySubobjectListIterator.php

示例10: tryToInvalidateCachedListLookupEntryFor

 private function tryToInvalidateCachedListLookupEntryFor(DIWikiPage $subject)
 {
     if ($subject->getNamespace() !== SMW_NS_PROPERTY) {
         return null;
     }
     $this->factory->newPropertyUsageCachedListLookup()->deleteCache();
     $this->factory->newUnusedPropertyCachedListLookup()->deleteCache();
     $this->factory->newUndeclaredPropertyCachedListLookup()->deleteCache();
     $this->factory->newUsageStatisticsCachedListLookup()->deleteCache();
 }
开发者ID:jaideraf,项目名称:SemanticMediaWiki,代码行数:10,代码来源:SMW_SQLStore3.php

示例11: tryToFindImportDataItem

 private function tryToFindImportDataItem(DIWikiPage $diWikiPage, $modifier)
 {
     $importDataItems = null;
     // Only try to find an import vocab for a matchable entity
     if ($diWikiPage->getNamespace() === NS_CATEGORY || $diWikiPage->getNamespace() === SMW_NS_PROPERTY) {
         $importDataItems = $this->store->getPropertyValues($diWikiPage, new DIProperty('_IMPO'));
     }
     if ($importDataItems !== null && $importDataItems !== array()) {
         $importDataItems = current($importDataItems);
     }
     return $importDataItems;
 }
开发者ID:Rikuforever,项目名称:wiki,代码行数:12,代码来源:DataItemToExpResourceEncoder.php

示例12: getHashIdForDiWikiPage

 /**
  * @since 2.1
  *
  * @param DIWikiPage $dataItem
  *
  * @return string
  */
 public static function getHashIdForDiWikiPage(DIWikiPage $dataItem)
 {
     return self::createFromSegments($dataItem->getDBKey(), $dataItem->getNamespace(), $dataItem->getInterwiki(), $dataItem->getSubobjectName());
 }
开发者ID:jongfeli,项目名称:SemanticMediaWiki,代码行数:11,代码来源:HashBuilder.php

示例13: doDeferredCachedListLookupUpdate

 private function doDeferredCachedListLookupUpdate(DIWikiPage $subject)
 {
     if ($subject->getNamespace() !== SMW_NS_PROPERTY) {
         return null;
     }
     $deferredCallableUpdate = $this->factory->newDeferredCallableCachedListLookupUpdate();
     $deferredCallableUpdate->setOrigin(__METHOD__);
     $deferredCallableUpdate->pushToUpdateQueue();
 }
开发者ID:jongfeli,项目名称:SemanticMediaWiki,代码行数:9,代码来源:SMW_SQLStore3.php

示例14: getIdForSubject

 public function getIdForSubject(DIWikiPage $subject, $subobjectName = '')
 {
     return $this->store->getObjectIds()->getSMWPageID($subject->getDBkey(), $subject->getNamespace(), $subject->getInterwiki(), $subobjectName, false);
 }
开发者ID:kimcollin,项目名称:SemanticMediaWiki,代码行数:4,代码来源:EmbeddedQueryDependencyLinksStore.php

示例15: tryToMakeIdForSubject

 /**
  * @since 2.3
  *
  * @param DIWikiPage $subject, $subobjectName
  * @param string $subobjectName
  */
 public function tryToMakeIdForSubject(DIWikiPage $subject, $subobjectName = '')
 {
     if ($subject->getNamespace() !== NS_CATEGORY && $subject->getNamespace() !== SMW_NS_PROPERTY) {
         return 0;
     }
     $id = $this->store->getObjectIds()->makeSMWPageID($subject->getDBkey(), $subject->getNamespace(), $subject->getInterwiki(), $subobjectName, false);
     wfDebugLog('smw', __METHOD__ . " add new {$id} ID for " . $subject->getHash() . " \n");
     return $id;
 }
开发者ID:jdforrester,项目名称:SemanticMediaWiki,代码行数:15,代码来源:EmbeddedQueryDependencyLinksStore.php


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