本文整理汇总了PHP中SMWDataItem::getSerialization方法的典型用法代码示例。如果您正苦于以下问题:PHP SMWDataItem::getSerialization方法的具体用法?PHP SMWDataItem::getSerialization怎么用?PHP SMWDataItem::getSerialization使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SMWDataItem
的用法示例。
在下文中一共展示了SMWDataItem::getSerialization方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: equals
public function equals(SMWDataItem $di)
{
if ($di->getDIType() !== SMWDataItem::TYPE_ERROR) {
return false;
}
return $di->getSerialization() === $this->getSerialization();
}
示例2: getInsertValues
/**
* @since 1.8
*
* {@inheritDoc}
*/
public function getInsertValues(DataItem $dataItem)
{
$serialization = rawurldecode($dataItem->getSerialization());
$text = mb_strlen($serialization) <= self::MAX_LENGTH ? null : $serialization;
// bytea type handling
if ($text !== null && $GLOBALS['wgDBtype'] === 'postgres') {
$text = pg_escape_bytea($text);
}
return array('o_blob' => $text, 'o_serialized' => $serialization);
}
示例3: getSerialization
/**
* Get the serialization for the provided data item.
*
* @since 1.7
*
* @param SMWDataItem $dataItem
*
* @return mixed
*/
public static function getSerialization(SMWDataItem $dataItem)
{
switch ($dataItem->getDIType()) {
case SMWDataItem::TYPE_WIKIPAGE:
$title = $dataItem->getTitle();
$result = array('fulltext' => $title->getFullText(), 'fullurl' => $title->getFullUrl());
break;
case SMWDataItem::TYPE_NUMBER:
$result = $dataItem->getNumber();
break;
case SMWDataItem::TYPE_GEO:
$result = $dataItem->getCoordinateSet();
break;
case SMWDataItem::TYPE_TIME:
$result = $dataItem->getMwTimestamp();
break;
default:
$result = $dataItem->getSerialization();
break;
}
return $result;
}
示例4: getInsertValues
/**
* @see SMWDataItemHandler::getInsertValues()
* @return array
*/
public function getInsertValues(SMWDataItem $dataItem)
{
return array('o_serialized' => $dataItem->getSerialization(), 'o_lat' => $dataItem->getLatitude(), 'o_lon' => $dataItem->getLongitude());
}
示例5: getInsertValues
/**
* Method to return an array of fields=>values for a DataItem
* This array is used to perform all insert operations into the DB
* To optimize return minimum fields having indexes
*
* @return array
*/
public function getInsertValues(SMWDataItem $dataItem)
{
return array('o_serialized' => $dataItem->getSerialization());
}
示例6: getInsertValues
/**
* @since 1.8
*
* {@inheritDoc}
*/
public function getInsertValues(DataItem $dataItem)
{
return array('o_serialized' => $dataItem->getSerialization(), 'o_sortkey' => $dataItem->getSortKey());
}
示例7: getInsertValues
/**
* @see SMWDataItemHandler::getInsertValues
* @return array
*/
public function getInsertValues(SMWDataItem $dataItem)
{
return array('o_serialized' => $dataItem->getSerialization(), 'o_sortkey' => floatval($dataItem->getNumber()));
}
示例8: getDBkeysFromDataItem
/**
* Compatibility function for computing the old getDBkeys() array for
* the new SMW data items.
*
* @param $dataItem SMWDataItem
* @return array of mixed
*/
public static function getDBkeysFromDataItem(SMWDataItem $dataItem)
{
switch ($dataItem->getDIType()) {
case SMWDataItem::TYPE_STRING:
case SMWDataItem::TYPE_BLOB:
return array($dataItem->getString());
case SMWDataItem::TYPE_URI:
return array($dataItem->getSerialization());
case SMWDataItem::TYPE_WIKIPAGE:
return array($dataItem->getDBkey(), $dataItem->getNamespace(), $dataItem->getInterwiki(), $dataItem->getSortKey());
case SMWDataItem::TYPE_NUMBER:
return array($dataItem->getSerialization(), floatval($dataItem->getNumber()));
case SMWDataItem::TYPE_TIME:
$xsdvalue = $dataItem->getYear() . "/" . ($dataItem->getPrecision() >= SMWDITime::PREC_YM ? $dataItem->getMonth() : '') . "/" . ($dataItem->getPrecision() >= SMWDITime::PREC_YMD ? $dataItem->getDay() : '') . "T";
if ($dataItem->getPrecision() == SMWDITime::PREC_YMDT) {
$xsdvalue .= sprintf("%02d", $dataItem->getHour()) . ':' . sprintf("%02d", $dataItem->getMinute()) . ':' . sprintf("%02d", $dataItem->getSecond());
}
return array($xsdvalue, $dataItem->getSortKey());
case SMWDataItem::TYPE_BOOLEAN:
return $dataItem->getBoolean() ? array('1', 1) : array('0', 0);
case SMWDataItem::TYPE_CONTAINER:
return array(false);
case SMWDataItem::TYPE_CONCEPT:
return array($dataItem->getConceptQuery(), $dataItem->getDocumentation(), $dataItem->getQueryFeatures(), $dataItem->getSize(), $dataItem->getDepth());
case SMWDataItem::TYPE_PROPERTY:
return array($dataItem->getKey());
case SMWDataItem::TYPE_GEO:
$coordinateSet = $dataItem->getCoordinateSet();
return array($coordinateSet['lat'], $coordinateSet['lon']);
default:
return array(false);
}
}