當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Settings::get方法代碼示例

本文整理匯總了PHP中SMW\Settings::get方法的典型用法代碼示例。如果您正苦於以下問題:PHP Settings::get方法的具體用法?PHP Settings::get怎麽用?PHP Settings::get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在SMW\Settings的用法示例。


在下文中一共展示了Settings::get方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getUserDefinedPropertyInfo

 /**
  * Returns information related to user-defined properties
  *
  * @since 1.9
  *
  * @param Title $title
  * @param DIProperty $property
  * @param integer $useCount
  *
  * @return array
  */
 private function getUserDefinedPropertyInfo($title, $property, $useCount)
 {
     if ($useCount <= $this->settings->get('smwgPropertyLowUsageThreshold')) {
         $this->getMessageFormatter()->addFromKey('smw_propertyhardlyused');
     }
     // User defined types default to Page
     $typestring = SMWTypesValue::newFromTypeId($this->settings->get('smwgPDefaultType'))->getLongHTMLText($this->getLinker());
     $label = htmlspecialchars($property->getLabel());
     $linkAttributes = array();
     if (isset($property->id)) {
         $linkAttributes['title'] = 'ID: ' . $property->id;
     }
     $dataValue = DataValueFactory::getInstance()->newDataValueByItem($property);
     $dataValue->setLinkAttributes($linkAttributes);
     $proplink = $dataValue->getFormattedLabel(DataValueFormatter::HTML_SHORT, $this->getLinker());
     if (!$title->exists()) {
         $this->getMessageFormatter()->addFromKey('smw_propertylackspage');
     }
     $typeProperty = new DIProperty('_TYPE');
     $types = $this->store->getPropertyValues($property->getDiWikiPage(), $typeProperty);
     if (count($types) >= 1) {
         $typeDataValue = DataValueFactory::getInstance()->newDataValueByItem(current($types), $typeProperty);
         $typestring = $typeDataValue->getLongHTMLText($this->getLinker());
     } else {
         $this->getMessageFormatter()->addFromKey('smw_propertylackstype', $typestring);
     }
     return array($typestring, $proplink);
 }
開發者ID:jongfeli,項目名稱:SemanticMediaWiki,代碼行數:39,代碼來源:PropertiesQueryPage.php

示例2: skipConcept

 protected function skipConcept($title, $concept = null)
 {
     $skip = false;
     if ($concept === null) {
         $skip = 'page not cachable (no concept description, maybe a redirect)';
     } elseif ($this->hasOption('update') && $concept->getCacheStatus() !== 'full') {
         $skip = 'page not cached yet';
     } elseif ($this->hasOption('old') && $concept->getCacheStatus() === 'full' && $concept->getCacheDate() > strtotime('now') - intval($this->options['old']) * 60) {
         $skip = 'cache is not old yet';
     } elseif ($this->hasOption('hard') && $this->settings->get('smwgQMaxSize') >= $concept->getSize() && ($this->settings->get('smwgQMaxDepth') >= $concept->getDepth() && ~(~($concept->getQueryFeatures() + 0) | $this->settings->get('smwgQFeatures')) == 0)) {
         $skip = 'concept is not "hard" according to wiki settings';
     }
     if ($skip) {
         $line = $this->lines !== false ? "({$this->lines}) " : '';
         $this->reportMessage($line . 'Skipping concept "' . $title->getPrefixedText() . "\": {$skip}\n", $this->verbose);
     }
     return $skip;
 }
開發者ID:whysasse,項目名稱:kmwiki,代碼行數:18,代碼來源:ConceptCacheRebuilder.php

示例3: addPropertyValue

 /**
  * Adds property values to the ParserOutput instance
  *
  * @since 1.9
  *
  * @param array $properties
  *
  * @return string
  */
 protected function addPropertyValue(array $properties, $value, $valueCaption)
 {
     $subject = $this->parserData->getSemanticData()->getSubject();
     // Add properties to the semantic container
     foreach ($properties as $property) {
         $dataValue = $this->dataValueFactory->newPropertyValue($property, $value, $valueCaption, $subject);
         if ($this->isEnabledNamespace && $this->isAnnotation) {
             $this->parserData->addDataValue($dataValue);
         }
     }
     // Return the text representation
     $result = $dataValue->getShortWikitext(true);
     // If necessary add an error text
     if ($this->settings->get('smwgInlineErrors') && $this->isEnabledNamespace && $this->isAnnotation && !$dataValue->isValid()) {
         $result .= $dataValue->getErrorText();
     }
     return $result;
 }
開發者ID:whysasse,項目名稱:kmwiki,代碼行數:27,代碼來源:InTextAnnotationParser.php

示例4: addPropertyValue

 /**
  * Adds property values to the ParserOutput instance
  *
  * @since 1.9
  *
  * @param array $properties
  *
  * @return string
  */
 protected function addPropertyValue(array $properties, $value, $valueCaption)
 {
     $subject = $this->parserData->getSubject();
     // Add properties to the semantic container
     foreach ($properties as $property) {
         $dataValue = $this->dataValueFactory->newPropertyValue($property, $value, $valueCaption, $subject);
         if ($this->isEnabledNamespace && $this->isAnnotation) {
             $this->parserData->addDataValue($dataValue);
         }
     }
     // Return the text representation
     $result = $dataValue->getShortWikitext(true);
     // If necessary add an error text
     if ($this->settings->get('smwgInlineErrors') && $this->isEnabledNamespace && $this->isAnnotation && !$dataValue->isValid()) {
         // Encode `:` to avoid a comment block and instead of the nowiki tag
         // use &#58; as placeholder
         $result = str_replace(':', '&#58;', $result) . $dataValue->getErrorText();
     }
     return $result;
 }
開發者ID:WolfgangFahl,項目名稱:SemanticMediaWiki,代碼行數:29,代碼來源:InTextAnnotationParser.php

示例5: cacheSetup

 /**
  * @see CacheableObjectCollector::cacheSetup
  *
  * @since 1.9
  *
  * @return ObjectDictionary
  */
 protected function cacheSetup()
 {
     return new SimpleDictionary(array('id' => array('smwgWantedPropertiesCache', $this->settings->get('smwgPDefaultType'), $this->requestOptions), 'type' => $this->settings->get('smwgCacheType'), 'enabled' => $this->settings->get('smwgWantedPropertiesCache'), 'expiry' => $this->settings->get('smwgWantedPropertiesCacheExpiry')));
 }
開發者ID:whysasse,項目名稱:kmwiki,代碼行數:11,代碼來源:WantedPropertiesCollector.php

示例6: cacheSetup

 /**
  * @see CacheableObjectCollector::cacheSetup
  *
  * @since 1.9
  *
  * @return ObjectDictionary
  */
 protected function cacheSetup()
 {
     return new SimpleDictionary(array('id' => array('smwgStatisticsCache', $this->requestOptions), 'type' => $this->settings->get('smwgCacheType'), 'enabled' => $this->settings->get('smwgStatisticsCache'), 'expiry' => $this->settings->get('smwgStatisticsCacheExpiry')));
 }
開發者ID:whysasse,項目名稱:kmwiki,代碼行數:11,代碼來源:StatisticsCollector.php

示例7: parse

 /**
  * Parse parameters and set internal properties
  *
  * @since 1.9
  *
  * @param $params
  */
 protected function parse($parameters)
 {
     // Initialize variables.
     $all_date_strings = array();
     $unused_params = array();
     $property_name = $start_date = $end_date = $unit = $period = $week_num = null;
     $included_dates = array();
     $excluded_dates = array();
     $excluded_dates_jd = array();
     // Parse parameters and assign values
     foreach ($parameters as $name => $values) {
         foreach ($values as $value) {
             switch ($name) {
                 case 'property':
                     $this->property = $value;
                     break;
                 case 'start':
                     $start_date = DataValueFactory::getInstance()->newTypeIDValue('_dat', $value);
                     break;
                 case 'end':
                     $end_date = DataValueFactory::getInstance()->newTypeIDValue('_dat', $value);
                     break;
                 case 'limit':
                     // Override default limit with query specific limit
                     $this->settings->set('smwgDefaultNumRecurringEvents', (int) $value);
                     break;
                 case 'unit':
                     $unit = $value;
                     break;
                 case 'period':
                     $period = (int) $value;
                     break;
                 case 'week number':
                     $week_num = (int) $value;
                     break;
                 case 'include':
                     // This is for compatibility only otherwise we break
                     // to much at once. Instead of writing include=...;...
                     // it should be include=...;...|+sep=; because the
                     // ParameterParser class is conditioned to split those
                     // parameter accordingly
                     if (strpos($value, ';')) {
                         $included_dates = explode(';', $value);
                     } else {
                         $included_dates[] = $value;
                     }
                     break;
                 case 'exclude':
                     // Some as above
                     if (strpos($value, ';')) {
                         $excluded_dates = explode(';', $value);
                     } else {
                         $excluded_dates[] = $value;
                     }
                     break;
                 default:
                     $this->parameters[$name][] = $value;
             }
         }
     }
     if ($start_date === null) {
         $this->errors[] = new Message('smw-events-start-date-missing');
         return;
     } else {
         if (!$start_date->getDataItem() instanceof SMWDITime) {
             $this->setError($start_date->getErrors());
             return;
         }
     }
     // Check property
     if (is_null($this->property)) {
         $this->errors[] = new Message('smw-events-property-missing');
         return;
     }
     // Exclude dates
     foreach ($excluded_dates as $date_str) {
         $excluded_dates_jd[] = $this->getJulianDay(DataValueFactory::getInstance()->newTypeIDValue('_dat', $date_str));
     }
     // If the period is null, or outside of normal bounds, set it to 1.
     if (is_null($period) || $period < 1 || $period > 500) {
         $period = 1;
     }
     // Handle 'week number', but only if it's of unit 'month'.
     if ($unit == 'month' && !is_null($week_num)) {
         $unit = 'dayofweekinmonth';
         if ($week_num < -4 || $week_num > 5 || $week_num == 0) {
             $week_num = null;
         }
     }
     if ($unit == 'dayofweekinmonth' && is_null($week_num)) {
         $week_num = ceil($start_date->getDay() / 7);
     }
     // Get the Julian day value for both the start and end date.
//.........這裏部分代碼省略.........
開發者ID:whysasse,項目名稱:kmwiki,代碼行數:101,代碼來源:RecurringEvents.php


注:本文中的SMW\Settings::get方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。