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


PHP SMW\ApplicationFactory类代码示例

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


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

示例1: execute

 /**
  * @see ApiBase::execute
  */
 public function execute()
 {
     $params = $this->extractRequestParams();
     $propertyListByApiRequest = new PropertyListByApiRequest(ApplicationFactory::getInstance()->getStore());
     $propertyListByApiRequest->setLimit($params['limit']);
     $propertyListByApiRequest->findPropertyListFor($params['property']);
     foreach ($propertyListByApiRequest->getNamespaces() as $ns) {
         $uri = NamespaceUriFinder::getUri($ns);
         if (!$uri) {
             continue;
         }
         $this->getResult()->addValue(null, 'xmlns:' . $ns, $uri);
     }
     $data = $propertyListByApiRequest->getPropertyList();
     // I'm without words for this utter nonsense introduced here
     // because property keys can have a underscore _MDAT or for that matter
     // any other data field can
     // https://www.mediawiki.org/wiki/API:JSON_version_2
     // " ... can indicate that a property beginning with an underscore is not metadata using"
     if (method_exists($this->getResult(), 'setPreserveKeysList')) {
         $this->getResult()->setPreserveKeysList($data, array_keys($data));
     }
     $this->getResult()->addValue(null, 'query', $data);
     $this->getResult()->addValue(null, 'version', 0.1);
     $this->getResult()->addValue(null, 'query-continue-offset', $propertyListByApiRequest->getContinueOffset());
     $this->getResult()->addValue(null, 'meta', $propertyListByApiRequest->getMeta());
 }
开发者ID:WolfgangFahl,项目名称:SemanticMediaWiki,代码行数:30,代码来源:BrowseByProperty.php

示例2: newEntityIdListRelevanceDetectionFilter

 /**
  * @since 2.4
  *
  * @param Store $store
  * @param CompositePropertyTableDiffIterator $compositePropertyTableDiffIterator
  *
  * @return EntityIdListRelevanceDetectionFilter
  */
 public function newEntityIdListRelevanceDetectionFilter(Store $store, CompositePropertyTableDiffIterator $compositePropertyTableDiffIterator)
 {
     $entityIdListRelevanceDetectionFilter = new EntityIdListRelevanceDetectionFilter($store, $compositePropertyTableDiffIterator);
     $entityIdListRelevanceDetectionFilter->setPropertyExemptionlist(ApplicationFactory::getInstance()->getSettings()->get('smwgQueryDependencyPropertyExemptionlist'));
     $entityIdListRelevanceDetectionFilter->setAffiliatePropertyDetectionlist(ApplicationFactory::getInstance()->getSettings()->get('smwgQueryDependencyAffiliatePropertyDetectionlist'));
     return $entityIdListRelevanceDetectionFilter;
 }
开发者ID:jongfeli,项目名称:SemanticMediaWiki,代码行数:15,代码来源:QueryDependencyLinksStoreFactory.php

示例3: setUp

 protected function setUp()
 {
     parent::setUp();
     $utilityFactory = UtilityFactory::getInstance();
     $this->fixturesFileProvider = $utilityFactory->newFixturesFactory()->newFixturesFileProvider();
     $this->semanticDataValidator = $utilityFactory->newValidatorFactory()->newSemanticDataValidator();
     $this->pageEditor = $utilityFactory->newPageEditor();
     $this->mwHooksHandler = $utilityFactory->newMwHooksHandler();
     $this->mwHooksHandler->deregisterListedHooks();
     $this->applicationFactory = ApplicationFactory::getInstance();
     $settings = array('smwgPageSpecialProperties' => array('_MEDIA', '_MIME'), 'smwgNamespacesWithSemanticLinks' => array(NS_MAIN => true, NS_FILE => true), 'smwgCacheType' => 'hash');
     foreach ($settings as $key => $value) {
         $this->applicationFactory->getSettings()->set($key, $value);
     }
     //	$this->getStore()->clear();
     //	$this->getStore()->setupStore( false );
     $this->wgEnableUploads = $GLOBALS['wgEnableUploads'];
     $this->wgFileExtensions = $GLOBALS['wgFileExtensions'];
     $this->wgVerifyMimeType = $GLOBALS['wgVerifyMimeType'];
     $this->mwHooksHandler->register('FileUpload', $this->mwHooksHandler->getHookRegistry()->getHandlerFor('FileUpload'));
     $this->mwHooksHandler->register('InternalParseBeforeLinks', $this->mwHooksHandler->getHookRegistry()->getHandlerFor('InternalParseBeforeLinks'));
     $this->mwHooksHandler->register('LinksUpdateConstructed', $this->mwHooksHandler->getHookRegistry()->getHandlerFor('LinksUpdateConstructed'));
     $GLOBALS['wgEnableUploads'] = true;
     $GLOBALS['wgFileExtensions'] = array('txt');
     $GLOBALS['wgVerifyMimeType'] = true;
 }
开发者ID:WolfgangFahl,项目名称:SemanticMediaWiki,代码行数:26,代码来源:FileUploadIntegrationTest.php

示例4: process

 /**
  * @since 1.9
  *
  * @return true
  */
 public function process()
 {
     $applicationFactory = ApplicationFactory::getInstance();
     // Delete all data for a non-enabled target NS
     if (!$applicationFactory->getNamespaceExaminer()->isSemanticEnabled($this->newTitle->getNamespace()) || $this->newId == 0) {
         $applicationFactory->getStore()->deleteSubject($this->oldTitle);
     } else {
         // Using a different approach since the hook is not triggered
         // by #REDIRECT which can cause inconsistencies
         // @see 2.3 / StoreUpdater
         //	$applicationFactory->getStore()->changeTitle(
         //		$this->oldTitle,
         //		$this->newTitle,
         //		$this->oldId,
         //		$this->newId
         //	);
     }
     $eventHandler = EventHandler::getInstance();
     $dispatchContext = $eventHandler->newDispatchContext();
     $dispatchContext->set('title', $this->oldTitle);
     $eventHandler->getEventDispatcher()->dispatch('cached.propertyvalues.prefetcher.reset', $dispatchContext);
     $dispatchContext = $eventHandler->newDispatchContext();
     $dispatchContext->set('title', $this->newTitle);
     $eventHandler->getEventDispatcher()->dispatch('cached.propertyvalues.prefetcher.reset', $dispatchContext);
     return true;
 }
开发者ID:jongfeli,项目名称:SemanticMediaWiki,代码行数:31,代码来源:TitleMoveComplete.php

示例5: smwgNamespacesWithSemanticLinksProvider

 /**
  * @since 1.9
  */
 public function smwgNamespacesWithSemanticLinksProvider()
 {
     $provider = array();
     $provider[] = array('GLOBALS', GlobalsProvider::getInstance()->get('smwgNamespacesWithSemanticLinks'));
     $provider[] = array('Settings', ApplicationFactory::getInstance()->getSettings()->get('smwgNamespacesWithSemanticLinks'));
     return $provider;
 }
开发者ID:jongfeli,项目名称:SemanticMediaWiki,代码行数:10,代码来源:InstallationConfigurationIntegrityTest.php

示例6: tearDown

 protected function tearDown()
 {
     ApplicationFactory::getInstance()->clear();
     $pageDeleter = UtilityFactory::getInstance()->newPageDeleter();
     $pageDeleter->doDeletePoolOfPages($this->importedTitles);
     parent::tearDown();
 }
开发者ID:WolfgangFahl,项目名称:SemanticMediaWiki,代码行数:7,代码来源:DumpRdfMaintenanceTest.php

示例7: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->applicationFactory = ApplicationFactory::getInstance();
     $settings = Settings::newFromArray(array('smwgFactboxUseCache' => true, 'smwgCacheType' => 'hash'));
     $this->applicationFactory->registerObject('Settings', $settings);
 }
开发者ID:WolfgangFahl,项目名称:SemanticMediaWiki,代码行数:7,代码来源:SkinAfterContentTest.php

示例8: process

 /**
  * @since 2.0
  *
  * @return true
  */
 public function process()
 {
     $settings = ApplicationFactory::getInstance()->getSettings();
     $deleteSubjectJob = new DeleteSubjectJob($this->wikiPage->getTitle(), array('asDeferredJob' => $settings->get('smwgDeleteSubjectAsDeferredJob'), 'withAssociates' => $settings->get('smwgDeleteSubjectWithAssociatesRefresh')));
     $deleteSubjectJob->execute();
     return true;
 }
开发者ID:WolfgangFahl,项目名称:SemanticMediaWiki,代码行数:12,代码来源:ArticleDelete.php

示例9: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->applicationFactory = ApplicationFactory::getInstance();
     $this->applicationFactory->getSettings()->set('smwgEnableUpdateJobs', false);
     $this->applicationFactory->getSettings()->set('smwgDeleteSubjectWithAssociatesRefresh', false);
 }
开发者ID:WolfgangFahl,项目名称:SemanticMediaWiki,代码行数:7,代码来源:ArticleDeleteTest.php

示例10: testCreateFromString

 /**
  * @dataProvider queryStringProvider
  */
 public function testCreateFromString($queryString, $configuration, $expected)
 {
     $instance = new ConfigurableQueryCreator(ApplicationFactory::getInstance()->getQueryFactory());
     $query = $instance->withConfiguration($configuration)->createFromString($queryString);
     $this->assertInstanceOf('\\SMWQuery', $query);
     $this->assertSame($expected, $query->getAsString());
 }
开发者ID:jongfeli,项目名称:SemanticMediaWiki,代码行数:10,代码来源:ConfigurableQueryCreatorTest.php

示例11: getInstance

 /**
  * @since 2.3
  *
  * @return InMemoryPoolCache
  */
 public static function getInstance()
 {
     if (self::$instance === null) {
         self::$instance = new self(ApplicationFactory::getInstance()->newCacheFactory());
     }
     return self::$instance;
 }
开发者ID:WolfgangFahl,项目名称:SemanticMediaWiki,代码行数:12,代码来源:InMemoryPoolCache.php

示例12: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->semanticDataValidator = new SemanticDataValidator();
     $this->applicationFactory = ApplicationFactory::getInstance();
     $this->parserFactory = new ParserFactory();
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:7,代码来源:ParserAfterTidyTest.php

示例13: validate

 /**
  * @since 2.4
  *
  * {@inheritDoc}
  */
 public function validate($dataValue)
 {
     $this->hasConstraintViolation = false;
     if (!$this->canValidate($dataValue)) {
         return $this->hasConstraintViolation;
     }
     $property = $dataValue->getProperty();
     if (!ApplicationFactory::getInstance()->getPropertySpecificationLookup()->hasUniquenessConstraintBy($property)) {
         return $this->hasConstraintViolation;
     }
     $blobStore = $this->cachedPropertyValuesPrefetcher->getBlobStore();
     $dataItem = $dataValue->getDataItem();
     $hash = $this->cachedPropertyValuesPrefetcher->createHashFromString($property->getKey() . ':' . $dataItem->getHash());
     $container = $blobStore->read($hash);
     $key = 'PVUC';
     if (!$container->has($key)) {
         $page = $this->tryFindMatchResultFor($hash, $dataValue);
         $container->set($key, $page);
         $blobStore->save($container);
     }
     $wikiPage = $container->get($key);
     // Verify that the contextPage (where the annotation has its origin) is
     // matchable to the request and in case it is not a match inform the user
     // about the origin
     if ($wikiPage instanceof DIWikiPage && !$dataValue->getContextPage()->equals($wikiPage)) {
         $dataValue->addErrorMsg(array('smw-datavalue-uniqueness-constraint-error', $property->getLabel(), $dataValue->getWikiValue(), $wikiPage->getTitle()->getPrefixedText()));
         $this->hasConstraintViolation = true;
     }
 }
开发者ID:jongfeli,项目名称:SemanticMediaWiki,代码行数:34,代码来源:UniquenessConstraintValueValidator.php

示例14: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->semanticDataValidator = UtilityFactory::getInstance()->newValidatorFactory()->newSemanticDataValidator();
     $this->applicationFactory = ApplicationFactory::getInstance();
     $this->applicationFactory->getSettings()->set('smwgQueryDurationEnabled', false);
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:7,代码来源:ShowParserFunctionTest.php

示例15: clear

 /**
  * @since 2.0
  */
 public static function clear()
 {
     if (self::$instance !== null) {
         self::$instance->getSettings()->clear();
     }
     self::$instance = null;
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:10,代码来源:ApplicationFactory.php


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