/**
  * @since 2.3
  *
  * @return InMemoryPoolCache
  */
 public static function getInstance()
 {
     if (self::$instance === null) {
         self::$instance = new self(ApplicationFactory::getInstance()->newCacheFactory());
     }
     return self::$instance;
 }
 /**
  * @since 2.4
  */
 public static function disableSemantics()
 {
     $disabledSettings = array('smwgSemanticsEnabled' => false, 'smwgNamespacesWithSemanticLinks' => array(), 'smwgQEnabled' => false, 'smwgAutoRefreshOnPurge' => false, 'smwgAutoRefreshOnPageMove' => false, 'smwgFactboxCacheRefreshOnPurge' => false, 'smwgAdminRefreshStore' => false, 'smwgPageSpecialProperties' => array(), 'smwgEnableUpdateJobs' => false, 'smwgEnabledEditPageHelp' => false, 'smwgInlineErrors' => false);
     foreach ($disabledSettings as $key => $value) {
         ApplicationFactory::getInstance()->getSettings()->set($key, $value);
         $GLOBALS[$key] = $value;
     }
 }
예제 #3
0
 /**
  * @since 2.1
  *
  * @return PropertyRegistry
  */
 public static function getInstance()
 {
     if (self::$instance === null) {
         $propertyLabelFinder = new PropertyLabelFinder(ApplicationFactory::getInstance()->getStore(), $GLOBALS['smwgContLang']->getPropertyLabels());
         self::$instance = new self(DataTypeRegistry::getInstance(), $propertyLabelFinder, $GLOBALS['smwgContLang']->getPropertyAliases());
         self::$instance->registerPredefinedProperties($GLOBALS['smwgUseCategoryHierarchy']);
     }
     return self::$instance;
 }
 /**
  * @since 2.1
  *
  * @return PropertyRegistry
  */
 public static function getInstance()
 {
     if (self::$instance !== null) {
         return self::$instance;
     }
     $propertyLabelFinder = ApplicationFactory::getInstance()->getPropertyLabelFinder();
     $extraneousLanguage = Localizer::getInstance()->getExtraneousLanguage();
     $propertyAliasFinder = new PropertyAliasFinder($extraneousLanguage->getPropertyAliases(), $extraneousLanguage->getCanonicalPropertyAliases());
     self::$instance = new self(DataTypeRegistry::getInstance(), $propertyLabelFinder, $propertyAliasFinder, $GLOBALS['smwgDataTypePropertyExemptionList']);
     self::$instance->registerPredefinedProperties($GLOBALS['smwgUseCategoryHierarchy']);
     return self::$instance;
 }
예제 #5
0
 /**
  * @since 1.9
  *
  * @param boolean $addJob
  */
 protected function notifyUpdateDispatcher($addJob = true)
 {
     if ($addJob && !$this->hasDiff) {
         ApplicationFactory::getInstance()->newJobFactory()->newUpdateDispatcherJob($this->semanticData->getSubject()->getTitle())->run();
         $this->hasDiff = true;
     }
 }
 /**
  * @since 2.5
  *
  * @param string $text
  * @param string $languageCode
  *
  * @return DIProperty[]|[]
  */
 public function findPropertyListFromLabelByLanguageCode($text, $languageCode = '')
 {
     if ($text === '') {
         return array();
     }
     if ($languageCode === '') {
         $languageCode = Localizer::getInstance()->getContentLanguage()->getCode();
     }
     $dataValue = DataValueFactory::getInstance()->newDataValueByProperty(new DIProperty('_PPLB'));
     $dataValue->setUserValue($dataValue->getTextWithLanguageTag($text, $languageCode));
     $queryFactory = ApplicationFactory::getInstance()->getQueryFactory();
     $descriptionFactory = $queryFactory->newDescriptionFactory();
     $description = $descriptionFactory->newConjunction(array($descriptionFactory->newNamespaceDescription(SMW_NS_PROPERTY), $descriptionFactory->newFromDataValue($dataValue)));
     $propertyList = array();
     $queryResult = $this->store->getQueryResult($queryFactory->newQuery($description));
     if (!$queryResult instanceof \SMWQueryResult) {
         return $propertyList;
     }
     foreach ($queryResult->getResults() as $result) {
         $propertyList[] = DIProperty::newFromUserLabel($result->getDBKey());
     }
     return $propertyList;
 }