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


PHP smwfGetStore函数代码示例

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


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

示例1: run

	/**
	 * Run job
	 *
	 * @return boolean success
	 */
	function run() {
		wfProfileIn( 'SMWRefreshJob::run (SMW)' );

		if ( !array_key_exists( 'spos', $this->params ) ) {
			wfProfileOut( 'SMWRefreshJob::run (SMW)' );
			return true;
		}

		$run = array_key_exists( 'run', $this->params ) ? $this->params['run']:1;
		$spos = $this->params['spos'];
		$namespaces = ( ( $this->params['rc'] > 1 ) && ( $run == 1 ) ) ? array( SMW_NS_PROPERTY, SMW_NS_TYPE ):false;
		$progress = smwfGetStore()->refreshData( $spos, 20, $namespaces );

		if ( $spos > 0 ) {
			$nextjob = new SMWRefreshJob( $this->title, array( 'spos' => $spos, 'prog' => $progress, 'rc' => $this->params['rc'], 'run' => $run ) );
			$nextjob->insert();
		} elseif ( $this->params['rc'] > $run ) { // do another run from the beginning
			$nextjob = new SMWRefreshJob( $this->title, array( 'spos' => 1, 'prog' => 0, 'rc' => $this->params['rc'], 'run' => $run + 1 ) );
			$nextjob->insert();
		}

		wfProfileOut( 'SMWRefreshJob::run (SMW)' );

		return true;
	}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:30,代码来源:SMW_RefreshJob.php

示例2: setTypeAndPossibleValues

 function setTypeAndPossibleValues()
 {
     $proptitle = Title::makeTitleSafe(SMW_NS_PROPERTY, $this->mSemanticProperty);
     if ($proptitle === null) {
         return;
     }
     $store = smwfGetStore();
     // this returns an array of objects
     $allowed_values = SFUtils::getSMWPropertyValues($store, $proptitle, "Allows value");
     $label_formats = SFUtils::getSMWPropertyValues($store, $proptitle, "Has field label format");
     $propValue = SMWDIProperty::newFromUserLabel($this->mSemanticProperty);
     $this->mPropertyType = $propValue->findPropertyTypeID();
     foreach ($allowed_values as $allowed_value) {
         // HTML-unencode each value
         $this->mPossibleValues[] = html_entity_decode($allowed_value);
         if (count($label_formats) > 0) {
             $label_format = $label_formats[0];
             $prop_instance = SMWDataValueFactory::findTypeID($this->mPropertyType);
             $label_value = SMWDataValueFactory::newTypeIDValue($prop_instance, $wiki_value);
             $label_value->setOutputFormat($label_format);
             $this->mValueLabels[$wiki_value] = html_entity_decode($label_value->getWikiValue());
         }
     }
     // HACK - if there were any possible values, set the property
     // type to be 'enumeration', regardless of what the actual type is
     if (count($this->mPossibleValues) > 0) {
         $this->mPropertyType = 'enumeration';
     }
 }
开发者ID:seedbank,项目名称:old-repo,代码行数:29,代码来源:SF_TemplateField.php

示例3: getTypeProperties

 protected function getTypeProperties($typeLabel)
 {
     global $wgRequest, $smwgTypePagingLimit;
     if ($smwgTypePagingLimit <= 0) {
         return '';
     }
     // not too useful, but we comply to this request
     $from = $wgRequest->getVal('from');
     $until = $wgRequest->getVal('until');
     $typeValue = SMWDataValueFactory::newTypeIDValue('__typ', $typeLabel);
     $store = smwfGetStore();
     $options = SMWPageLister::getRequestOptions($smwgTypePagingLimit, $from, $until);
     $diWikiPages = $store->getPropertySubjects(new SMWDIProperty('_TYPE'), $typeValue->getDataItem(), $options);
     if (!$options->ascending) {
         $diWikiPages = array_reverse($diWikiPages);
     }
     $result = '';
     if (count($diWikiPages) > 0) {
         $pageLister = new SMWPageLister($diWikiPages, null, $smwgTypePagingLimit, $from, $until);
         $title = $this->getTitleFor('Types', $typeLabel);
         $title->setFragment('#SMWResults');
         // Make navigation point to the result list.
         $navigation = $pageLister->getNavigationLinks($title);
         $resultNumber = min($smwgTypePagingLimit, count($diWikiPages));
         $typeName = $typeValue->getLongWikiText();
         $result .= "<a name=\"SMWResults\"></a><div id=\"mw-pages\">\n" . '<h2>' . wfMsg('smw_type_header', $typeName) . "</h2>\n<p>" . wfMsgExt('smw_typearticlecount', array('parsemag'), $resultNumber) . "</p>\n" . $navigation . $pageLister->formatList() . $navigation . "\n</div>";
     }
     return $result;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:29,代码来源:SMW_SpecialTypes.php

示例4: run

 /**
  * Run job
  *
  * @return boolean success
  */
 function run()
 {
     wfProfileIn('SMWRefreshJob::run (SMW)');
     if (!array_key_exists('spos', $this->params)) {
         wfProfileOut('SMWRefreshJob::run (SMW)');
         return true;
     }
     $run = array_key_exists('run', $this->params) ? $this->params['run'] : 1;
     $spos = $this->params['spos'];
     $namespaces = $this->params['rc'] > 1 && $run == 1 ? array(SMW_NS_PROPERTY, SMW_NS_TYPE) : false;
     $progress = smwfGetStore()->refreshData($spos, 20, $namespaces);
     $jobParams = null;
     if ($spos > 0) {
         $jobParams = array('spos' => $spos, 'prog' => $progress, 'rc' => $this->params['rc'], 'run' => $run);
     } elseif ($this->params['rc'] > $run) {
         // do another run from the beginning
         $jobParams = array('spos' => 1, 'prog' => 0, 'rc' => $this->params['rc'], 'run' => $run + 1);
     }
     if (!empty($jobParams)) {
         // wikia change start - jobqueue migration
         $task = new \Wikia\Tasks\Tasks\JobWrapperTask();
         $task->call('SMWRefreshJob', $this->title, $jobParams);
         $task->queue();
         // wikia change end
     }
     wfProfileOut('SMWRefreshJob::run (SMW)');
     return true;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:33,代码来源:SMW_RefreshJob.php

示例5: getAllPropertyNames

 public static function getAllPropertyNames()
 {
     $all_properties = array();
     // Set limit on results - we don't want a massive dropdown
     // of properties, if there are a lot of properties in this wiki.
     // getProperties() functions stop requiring a limit
     $options = new SMWRequestOptions();
     $options->limit = 500;
     $used_properties = smwfGetStore()->getPropertiesSpecial($options);
     foreach ($used_properties as $property) {
         if ($property[0] instanceof SMWDIProperty) {
             // SMW 1.6+
             $propName = $property[0]->getKey();
             if ($propName[0] != '_') {
                 $all_properties[] = str_replace('_', ' ', $propName);
             }
         } else {
             $all_properties[] = $property[0]->getWikiValue();
         }
     }
     $unused_properties = smwfGetStore()->getUnusedPropertiesSpecial($options);
     foreach ($unused_properties as $property) {
         if ($property instanceof SMWDIProperty) {
             // SMW 1.6+
             $all_properties[] = str_replace('_', ' ', $property->getKey());
         } else {
             $all_properties[] = $property->getWikiValue();
         }
     }
     // Sort properties list alphabetically.
     sort($all_properties);
     return $all_properties;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:33,代码来源:SF_CreateTemplate.php

示例6: getHtml

 /**
  * Returns the HTML which is added to $wgOut after the article text.
  *
  * @return string
  */
 protected function getHtml()
 {
     wfProfileIn(__METHOD__ . ' (SMW)');
     if ($this->limit > 0) {
         // limit==0: configuration setting to disable this completely
         $store = smwfGetStore();
         $description = new SMWConceptDescription($this->getDataItem());
         $query = SMWPageLister::getQuery($description, $this->limit, $this->from, $this->until);
         $queryResult = $store->getQueryResult($query);
         $diWikiPages = $queryResult->getResults();
         if ($this->until !== '') {
             $diWikiPages = array_reverse($diWikiPages);
         }
         $errors = $queryResult->getErrors();
     } else {
         $diWikiPages = array();
         $errors = array();
     }
     $pageLister = new SMWPageLister($diWikiPages, null, $this->limit, $this->from, $this->until);
     $this->mTitle->setFragment('#SMWResults');
     // Make navigation point to the result list.
     $navigation = $pageLister->getNavigationLinks($this->mTitle);
     $titleText = htmlspecialchars($this->mTitle->getText());
     $resultNumber = min($this->limit, count($diWikiPages));
     $result = "<a name=\"SMWResults\"></a><div id=\"mw-pages\">\n" . '<h2>' . wfMsg('smw_concept_header', $titleText) . "</h2>\n" . wfMsgExt('smw_conceptarticlecount', array('parsemag'), $resultNumber) . smwfEncodeMessages($errors) . "\n" . $navigation . $pageLister->formatList() . $navigation . "</div>\n";
     wfProfileOut(__METHOD__ . ' (SMW)');
     return $result;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:33,代码来源:SMW_ConceptPage.php

示例7: run

 /**
  * Run job
  * @return boolean success
  */
 function run()
 {
     wfProfileIn('SMWUpdateJob::run (SMW)');
     global $wgParser;
     LinkCache::singleton()->clear();
     if (is_null($this->title)) {
         $this->error = "SMWUpdateJob: Invalid title";
         wfProfileOut('SMWUpdateJob::run (SMW)');
         return false;
     } elseif (!$this->title->exists()) {
         smwfGetStore()->deleteSubject($this->title);
         // be sure to clear the data
         wfProfileOut('SMWUpdateJob::run (SMW)');
         return true;
     }
     $revision = Revision::newFromTitle($this->title);
     if (!$revision) {
         $this->error = 'SMWUpdateJob: Page exists but no revision was found for "' . $this->title->getPrefixedDBkey() . '"';
         wfProfileOut('SMWUpdateJob::run (SMW)');
         return false;
     }
     wfProfileIn(__METHOD__ . '-parse');
     $options = new ParserOptions();
     $output = $wgParser->parse($revision->getText(), $this->title, $options, true, true, $revision->getID());
     wfProfileOut(__METHOD__ . '-parse');
     wfProfileIn(__METHOD__ . '-update');
     SMWParseData::storeData($output, $this->title, false);
     wfProfileOut(__METHOD__ . '-update');
     wfProfileOut('SMWUpdateJob::run (SMW)');
     return true;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:35,代码来源:SMW_UpdateJob.php

示例8: testCheckIfPropertyRenamed

 function testCheckIfPropertyRenamed()
 {
     // do some checks
     $page = Title::newFromText("5 cylinder", NS_MAIN);
     $prop = SMWPropertyValue::makeUserProperty("Torsional moment");
     $values = smwfGetStore()->getPropertyValues($page, $prop);
     $this->assertTrue(count($values) > 0);
 }
开发者ID:seedbank,项目名称:old-repo,代码行数:8,代码来源:TestWikiJobResults.php

示例9: getSMWStore

 /**
  * Helper function to get the SMW data store for different versions
  * of SMW.
  */
 public static function getSMWStore()
 {
     if (class_exists('\\SMW\\StoreFactory')) {
         // SMW 1.9+
         return \SMW\StoreFactory::getStore();
     } else {
         return smwfGetStore();
     }
 }
开发者ID:yusufchang,项目名称:app,代码行数:13,代码来源:SD_Utils.php

示例10: testGetInstanceAsTarget

 function testGetInstanceAsTarget()
 {
     $exp_values = array("Kai");
     $domainRangeAnnotations = smwfGetStore()->getPropertyValues(Title::newFromText("Has Child", SMW_NS_PROPERTY), smwfGetSemanticStore()->domainRangeHintProp);
     $values = smwfGetAutoCompletionStore()->getInstanceAsTarget("K", $domainRangeAnnotations);
     foreach ($values as $v) {
         $this->assertContains($v->getText(), $exp_values, $v->getText() . " missing");
     }
 }
开发者ID:seedbank,项目名称:old-repo,代码行数:9,代码来源:TestAutocompletionStore.php

示例11: run

 public function run($paramArray, $isAsync, $delay)
 {
     $this->cleanCompleteCache();
     global $smwgDefaultStore;
     if ($smwgDefaultStore == 'SMWTripleStore' || $smwgDefaultStore == 'SMWTripleStoreQuad') {
         define('SMWH_FORCE_TS_UPDATE', 'TRUE');
         smwfGetStore()->initialize(true);
     }
     return '';
 }
开发者ID:seedbank,项目名称:old-repo,代码行数:10,代码来源:SMW_WSCacheBot.php

示例12: execute

 public function execute($param)
 {
     global $wgOut, $wgLang;
     $wgOut->setPageTitle(wfMessage('semanticstatistics')->text());
     $semanticStatistics = smwfGetStore()->getStatistics();
     $dbr = wfGetDB(DB_SLAVE);
     $propertyPageAmount = $dbr->estimateRowCount('page', '*', array('page_namespace' => SMW_NS_PROPERTY));
     $out = wfMsgExt('smw_semstats_text', array('parse'), $wgLang->formatNum($semanticStatistics['PROPUSES']), $wgLang->formatNum($semanticStatistics['USEDPROPS']), $wgLang->formatNum($propertyPageAmount), $wgLang->formatNum($semanticStatistics['DECLPROPS']));
     $wgOut->addHTML($out);
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:10,代码来源:SMW_SpecialStatistics.php

示例13: saclGetPermissionErrors

function saclGetPermissionErrors($title, $user, $action, &$result)
{
    // Failsafe: Some users are exempt from Semantic ACLs
    if ($user->isAllowed('sacl-exempt')) {
        return true;
    }
    $store = smwfGetStore();
    $subject = SMWDIWikiPage::newFromTitle($title);
    // The prefix for the whitelisted group and user properties
    // Either ___VISIBLE or ___EDITABLE
    $prefix = '';
    if ($action == 'read') {
        $prefix = '___VISIBLE';
    } else {
        $type_property = 'Editable by';
        $prefix = '___EDITABLE';
    }
    $property = new SMWDIProperty($prefix);
    $aclTypes = $store->getPropertyValues($subject, $property);
    foreach ($aclTypes as $valueObj) {
        $value = strtolower($valueObj->getString());
        if ($value == 'users') {
            if ($user->isAnon()) {
                $result = false;
                return false;
            }
        } elseif ($value == 'whitelist') {
            $isWhitelisted = false;
            $groupProperty = new SMWDIProperty("{$prefix}_WL_GROUP");
            $userProperty = new SMWDIProperty("{$prefix}_WL_USER");
            $whitelistValues = $store->getPropertyValues($subject, $groupProperty);
            foreach ($whitelistValues as $whitelistValue) {
                $group = strtolower($whitelistValue->getString());
                if (in_array($group, $user->getEffectiveGroups())) {
                    $isWhitelisted = true;
                    break;
                }
            }
            $whitelistValues = $store->getPropertyValues($subject, $userProperty);
            foreach ($whitelistValues as $whitelistValue) {
                $title = $whitelistValue->getTitle();
                if ($title->equals($user->getUserPage())) {
                    $isWhitelisted = true;
                }
            }
            if (!$isWhitelisted) {
                $result = false;
                return false;
            }
        } elseif ($value == 'public') {
            return true;
        }
    }
    return true;
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:55,代码来源:SemanticACL.php

示例14: run

 /**
  * This method is called by the bot framework.
  */
 public function run($paramArray, $isAsync, $delay)
 {
     echo "...started!\n";
     $this->updateTermImports();
     global $smwgDefaultStore;
     if ($smwgDefaultStore == 'SMWTripleStore' || $smwgDefaultStore == 'SMWTripleStoreQuad') {
         define('SMWH_FORCE_TS_UPDATE', 'TRUE');
         smwfGetStore()->initialize(true);
     }
     return;
 }
开发者ID:seedbank,项目名称:old-repo,代码行数:14,代码来源:SMW_TermImportUpdateBot.php

示例15: testExcelQueryPrinter

 function testExcelQueryPrinter()
 {
     $params = array();
     $context = SMWQueryProcessor::INLINE_QUERY;
     $format = "exceltable";
     $extraprintouts = array();
     $querystring = "[[Category:Car]]";
     $query = SMWQueryProcessor::createQuery($querystring, $params, $context, $format, $extraprintouts);
     $res = smwfGetStore()->getQueryResult($query);
     $result = SMWQueryProcessor::getResultFromQuery($query, $params, $extraprintouts, SMW_OUTPUT_FILE, $context, $format);
     $this->assertFileContentsIgnoringWhitespaces("testcases/resources/excel_qp_result.dat", $result);
 }
开发者ID:seedbank,项目名称:old-repo,代码行数:12,代码来源:TestQueryPrinters.php


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