本文整理汇总了PHP中SMW\ApplicationFactory::getSettings方法的典型用法代码示例。如果您正苦于以下问题:PHP ApplicationFactory::getSettings方法的具体用法?PHP ApplicationFactory::getSettings怎么用?PHP ApplicationFactory::getSettings使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SMW\ApplicationFactory
的用法示例。
在下文中一共展示了ApplicationFactory::getSettings方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: clear
/**
* @since 2.0
*/
public static function clear()
{
if (self::$instance !== null) {
self::$instance->getSettings()->clear();
}
self::$instance = null;
}
示例2: newConnectionManager
/**
* @since 2.2
*
* @return ConnectionManager
*/
public function newConnectionManager()
{
$connectionManager = new ConnectionManager();
$repositoryConnectionProvider = new RepositoryConnectionProvider();
$repositoryConnectionProvider->setHttpVersionTo($this->applicationFactory->getSettings()->get('smwgSparqlRepositoryConnectorForcedHttpVersion'));
$connectionManager->registerConnectionProvider('sparql', $repositoryConnectionProvider);
return $connectionManager;
}
示例3: doFetchResultsForRawParameters
private function doFetchResultsForRawParameters(array $rawParams)
{
// FIXME QueryDuration should be a property of the QueryProcessor or
// QueryEngine but since we don't want to open the pandora's box and
// increase issues within the current QueryProcessor implementation
// we will track the time outside of the actual execution framework
$queryDuration = 0;
$start = microtime(true);
list($this->query, $this->params) = SMWQueryProcessor::getQueryAndParamsFromFunctionParams($rawParams, SMW_OUTPUT_WIKI, SMWQueryProcessor::INLINE_QUERY, $this->showMode);
$this->query->setSubject(DIWIkiPage::newFromTitle($this->parserData->getTitle()));
$queryHash = $this->query->getHash();
$this->circularReferenceGuard->mark($queryHash);
// If we caught in a circular loop (due to a template referencing to itself)
// then we stop here before the next query execution to avoid an infinite
// self-reference
if ($this->circularReferenceGuard->isCircularByRecursionFor($queryHash)) {
return '';
}
$result = SMWQueryProcessor::getResultFromQuery($this->query, $this->params, SMW_OUTPUT_WIKI, SMWQueryProcessor::INLINE_QUERY);
$format = $this->params['format']->getValue();
// FIXME Parser should be injected into the ResultPrinter
// Enables specific formats to import its annotation data from
// a recursive parse process in the result format
// e.g. using ask query to search/set an invert property value
if (isset($this->params['import-annotation']) && $this->params['import-annotation']->getValue()) {
$this->parserData->importFromParserOutput($GLOBALS['wgParser']->getOutput());
}
if ($this->applicationFactory->getSettings()->get('smwgQueryDurationEnabled')) {
$queryDuration = microtime(true) - $start;
}
$this->circularReferenceGuard->unmark($queryHash);
$this->createQueryProfile($this->query, $format, $queryDuration);
return $result;
}
示例4: doFetchResultsForRawParameters
private function doFetchResultsForRawParameters(array $rawParams)
{
// FIXME QueryDuration should be a property of the QueryProcessor or
// QueryEngine but since we don't want to open the pandora's box and
// increase issues within the current QueryProcessor implementation
// we will track the time outside of the actual execution framework
$queryDuration = 0;
$start = microtime(true);
list($this->query, $this->params) = SMWQueryProcessor::getQueryAndParamsFromFunctionParams($rawParams, SMW_OUTPUT_WIKI, SMWQueryProcessor::INLINE_QUERY, $this->showMode);
$queryHash = $this->query->getHash();
$this->circularReferenceGuard->mark($queryHash);
// If we caught in a circular loop (due to a template referencing to itself)
// then we stop here before the next query execution to avoid an infinite
// self-reference
if ($this->circularReferenceGuard->isCircularByRecursionFor($queryHash)) {
return '';
}
$result = SMWQueryProcessor::getResultFromQuery($this->query, $this->params, SMW_OUTPUT_WIKI, SMWQueryProcessor::INLINE_QUERY);
// FIXME Should be injected
// A printer run its own isolated wgParser process therefore if the printer
// or a template inclusion is used by a printer, possible extra annotations
// need to be imported for further usage
$this->parserData->importFromParserOutput($GLOBALS['wgParser']->getOutput());
if ($this->applicationFactory->getSettings()->get('smwgQueryDurationEnabled')) {
$queryDuration = microtime(true) - $start;
}
$this->circularReferenceGuard->unmark($queryHash);
$this->createQueryProfile($this->query, $this->params['format']->getValue(), $queryDuration);
return $result;
}
示例5: inspectPropertySpecification
/**
* @note Comparison must happen *before* the storage update;
* even finding uses of a property fails after its type changed.
*/
private function inspectPropertySpecification()
{
if (!$this->enabledWithUpdateJobs) {
return;
}
$propertySpecificationChangeNotifier = new PropertySpecificationChangeNotifier($this->store, $this->semanticData);
$propertySpecificationChangeNotifier->compareWith($this->applicationFactory->getSettings()->get('smwgDeclarationProperties'));
}
示例6: newPropertyTableInfoFetcher
/**
* @since 2.3
*
* @return PropertyTableInfoFetcher
*/
public function newPropertyTableInfoFetcher()
{
$settings = $this->applicationFactory->getSettings();
$propertyTableInfoFetcher = new PropertyTableInfoFetcher();
$propertyTableInfoFetcher->setCustomFixedPropertyList($settings->get('smwgFixedProperties'));
$propertyTableInfoFetcher->setCustomSpecialPropertyList($settings->get('smwgPageSpecialProperties'));
return $propertyTableInfoFetcher;
}
示例7: addPropertyValues
/**
* @see PropertyAnnotatorDecorator::addPropertyValues
*/
protected function addPropertyValues()
{
$this->applicationFactory = ApplicationFactory::getInstance();
$settings = $this->applicationFactory->getSettings();
$namespace = $this->getSemanticData()->getSubject()->getNamespace();
foreach ($this->categories as $catname) {
if (!$settings->get('smwgShowHiddenCategories') && $this->isHiddenCategory($catname)) {
continue;
}
if ($settings->get('smwgCategoriesAsInstances') && $namespace !== NS_CATEGORY) {
$this->getSemanticData()->addPropertyObjectValue(new DIProperty(DIProperty::TYPE_CATEGORY), new DIWikiPage($catname, NS_CATEGORY, ''));
}
if ($settings->get('smwgUseCategoryHierarchy') && $namespace === NS_CATEGORY) {
$this->getSemanticData()->addPropertyObjectValue(new DIProperty(DIProperty::TYPE_SUBCATEGORY), new DIWikiPage($catname, NS_CATEGORY, ''));
}
}
}
示例8: registerI18n
/**
* @see https://www.mediawiki.org/wiki/Manual:$wgExtensionMessagesFiles
*/
private function registerI18n()
{
$smwgIP = $this->applicationFactory->getSettings()->get('smwgIP');
$this->globalVars['wgMessagesDirs']['SemanticMediaWiki'] = $smwgIP . 'i18n';
$this->globalVars['wgExtensionMessagesFiles']['SemanticMediaWiki'] = $smwgIP . 'languages/SMW_Messages.php';
$this->globalVars['wgExtensionMessagesFiles']['SemanticMediaWikiAlias'] = $smwgIP . 'languages/SMW_Aliases.php';
$this->globalVars['wgExtensionMessagesFiles']['SemanticMediaWikiMagic'] = $smwgIP . 'languages/SMW_Magic.php';
$this->globalVars['wgExtensionMessagesFiles']['SemanticMediaWikiNamespaces'] = $smwgIP . 'languages/SemanticMediaWiki.namespaces.php';
}
示例9: tearDown
/**
* @since 2.4
*/
public function tearDown()
{
foreach ($this->configuration as $key => $value) {
$GLOBALS[$key] = $value;
$this->applicationFactory->getSettings()->set($key, $value);
}
$this->applicationFactory->clear();
$this->dataValueFactory->clear();
}
示例10: inspectPropertySpecification
/**
* @note Comparison must happen *before* the storage update;
* even finding uses of a property fails after its type changed.
*/
private function inspectPropertySpecification()
{
if (!$this->updateJobsEnabledState) {
return;
}
$propertySpecDiffFinder = new PropertySpecDiffFinder($this->store, $this->semanticData);
$propertySpecDiffFinder->setPropertiesToCompare($this->applicationFactory->getSettings()->get('smwgDeclarationProperties'));
$propertySpecDiffFinder->findDiff();
}
示例11: newHtmlContentBuilder
private function newHtmlContentBuilder($webRequest)
{
$htmlContentBuilder = new HtmlContentBuilder($this->applicationFactory->getStore(), $this->subjectDV->getDataItem());
$htmlContentBuilder->setOption('dir', $webRequest->getVal('dir'));
$htmlContentBuilder->setOption('printable', $webRequest->getVal('printable'));
$htmlContentBuilder->setOption('offset', $webRequest->getVal('offset'));
$htmlContentBuilder->setOption('showInverse', $this->applicationFactory->getSettings()->get('smwgBrowseShowInverse'));
$htmlContentBuilder->setOption('showAll', $this->applicationFactory->getSettings()->get('smwgBrowseShowAll'));
$htmlContentBuilder->setOption('byApi', $this->applicationFactory->getSettings()->get('smwgBrowseByApi'));
return $htmlContentBuilder;
}
示例12: registerHooks
/**
* @see https://www.mediawiki.org/wiki/Manual:$wgHooks
*
* @note $wgHooks contains a list of hooks which specifies for every event an
* array of functions to be called.
*/
private function registerHooks()
{
$hookRegistry = new HookRegistry($this->globalVars, $this->directory);
$hookRegistry->register();
if (!$this->applicationFactory->getSettings()->get('smwgSemanticsEnabled')) {
return;
}
// Old-style registration
$this->globalVars['wgHooks']['AdminLinks'][] = 'SMWExternalHooks::addToAdminLinks';
$this->globalVars['wgHooks']['PageSchemasRegisterHandlers'][] = 'SMWExternalHooks::onPageSchemasRegistration';
}
示例13: createQueryProfile
private function createQueryProfile($query, $format)
{
// If the smwgQueryProfiler is marked with FALSE then just don't create a profile.
if ($this->applicationFactory->getSettings()->get('smwgQueryProfiler') === false) {
return;
}
$query->setOption('smwgQueryDurationEnabled', $this->applicationFactory->getSettings()->get('smwgQueryDurationEnabled'));
$profileAnnotatorFactory = $this->applicationFactory->getQueryFactory()->newProfileAnnotatorFactory();
$combinedProfileAnnotator = $profileAnnotatorFactory->newCombinedProfileAnnotator($query, $format);
$combinedProfileAnnotator->pushAnnotationsTo($this->parserData->getSemanticData());
}
示例14: canPerformUpdate
private function canPerformUpdate()
{
if ($this->getRedirectTarget() !== null) {
return true;
}
// ParserOptions::getInterfaceMessage is being used to identify whether a
// parse was initiated by `Message::parse`
if ($this->text === '' || $this->parser->getOptions()->getInterfaceMessage()) {
return false;
}
if (!$this->parser->getTitle()->isSpecialPage()) {
return true;
}
$isEnabledSpecialPage = $this->applicationFactory->getSettings()->get('smwgEnabledSpecialPage');
foreach ($isEnabledSpecialPage as $specialPage) {
if ($this->parser->getTitle()->isSpecial($specialPage)) {
return true;
}
}
return false;
}
示例15: parse
/**
* Parsing text before an article is displayed or previewed, strip out
* semantic properties and add them to the ParserOutput object
*
* @since 1.9
*
* @param string &$text
*/
public function parse(&$text)
{
$title = $this->parserData->getTitle();
$this->settings = $this->applicationFactory->getSettings();
$this->doStripMagicWordsFromText($text);
$this->setSemanticEnabledNamespaceState($title);
$this->addRedirectTargetAnnotation($text);
$linksInValues = $this->settings->get('smwgLinksInValues');
$text = preg_replace_callback($this->getRegexpPattern($linksInValues), $linksInValues ? 'self::process' : 'self::preprocess', $text);
$this->parserData->getOutput()->addModules($this->getModules());
$this->parserData->pushSemanticDataToParserOutput();
SMWOutputs::commitToParserOutput($this->parserData->getOutput());
}