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


PHP DataValueFactory::newPropertyValue方法代码示例

本文整理汇总了PHP中SMW\DataValueFactory::newPropertyValue方法的典型用法代码示例。如果您正苦于以下问题:PHP DataValueFactory::newPropertyValue方法的具体用法?PHP DataValueFactory::newPropertyValue怎么用?PHP DataValueFactory::newPropertyValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SMW\DataValueFactory的用法示例。


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

示例1: addDataValuesToSubobject

 protected function addDataValuesToSubobject(ParserParameterProcessor $parameters)
 {
     $subject = $this->parserData->getSemanticData()->getSubject();
     // Named subobjects containing a "." in the first five characters are reserved to be
     // used by extensions only in order to separate them from user land and avoid them
     // accidentally to refer to the same named ID
     // (i.e. different access restrictions etc.)
     if (strpos(mb_substr($parameters->getFirst(), 0, 5), '.') !== false) {
         return $this->addErrorWithMsg($subject, wfMessage('smw-subobject-parser-invalid-naming-scheme', $parameters->getFirst())->escaped());
     }
     $this->subobject->setEmptyContainerForId($this->createSubobjectId($parameters));
     foreach ($this->transformParametersToArray($parameters) as $property => $values) {
         if ($property === self::PARAM_SORTKEY) {
             $property = DIProperty::TYPE_SORTKEY;
         }
         if ($property === self::PARAM_CATEGORY) {
             $property = DIProperty::TYPE_CATEGORY;
         }
         foreach ($values as $value) {
             $dataValue = $this->dataValueFactory->newPropertyValue($property, $value, false, $subject);
             $this->subobject->addDataValue($dataValue);
         }
     }
     return true;
 }
开发者ID:WolfgangFahl,项目名称:SemanticMediaWiki,代码行数:25,代码来源:SubobjectParserFunction.php

示例2: addDataValuesToSubobject

 protected function addDataValuesToSubobject(ArrayFormatter $parameters)
 {
     $subject = $this->parserData->getSemanticData()->getSubject();
     $this->subobject->setEmptyContainerForId($this->createSubobjectId($parameters));
     foreach ($this->transformParametersToArray($parameters) as $property => $values) {
         if ($property === self::PARAM_SORTKEY) {
             $property = DIProperty::TYPE_SORTKEY;
         }
         foreach ($values as $value) {
             $dataValue = $this->dataValueFactory->newPropertyValue($property, $value, false, $subject);
             $this->subobject->addDataValue($dataValue);
         }
     }
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:14,代码来源:SubobjectParserFunction.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 : as placeholder
         $result = str_replace(':', ':', $result) . $dataValue->getErrorText();
     }
     return $result;
 }
开发者ID:WolfgangFahl,项目名称:SemanticMediaWiki,代码行数:29,代码来源:InTextAnnotationParser.php


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