예제 #1
0
 /**
  * Store a value for a given property identified by its text label
  * (without namespace prefix).
  *
  * @param $propertyName string
  * @param $dataItem SMWDataItem
  */
 public function addPropertyValue($propertyName, SMWDataItem $dataItem)
 {
     $propertyKey = smwfNormalTitleDBKey($propertyName);
     if (array_key_exists($propertyKey, $this->mProperties)) {
         $property = $this->mProperties[$propertyKey];
     } else {
         if (self::$mPropertyPrefix === '') {
             global $wgContLang;
             self::$mPropertyPrefix = $wgContLang->getNsText(SMW_NS_PROPERTY) . ':';
         }
         // explicitly use prefix to cope with things like [[Property:User:Stupid::somevalue]]
         $propertyDV = SMWPropertyValue::makeUserProperty(self::$mPropertyPrefix . $propertyName);
         if (!$propertyDV->isValid()) {
             // error, maybe illegal title text
             return;
         }
         $property = $propertyDV->getDataItem();
     }
     $this->addPropertyObjectValue($property, $dataItem);
 }