本文整理汇总了PHP中SMWPropertyValue::isValid方法的典型用法代码示例。如果您正苦于以下问题:PHP SMWPropertyValue::isValid方法的具体用法?PHP SMWPropertyValue::isValid怎么用?PHP SMWPropertyValue::isValid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SMWPropertyValue
的用法示例。
在下文中一共展示了SMWPropertyValue::isValid方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initialize
/**
* @since 2.1
*/
public function initialize()
{
$params = explode('/', $this->queryString);
reset($params);
$escaped = false;
// Remove empty elements
$params = array_filter($params, 'strlen');
$property = isset($this->requestOptions['property']) ? $this->requestOptions['property'] : current($params);
$value = isset($this->requestOptions['value']) ? $this->requestOptions['value'] : next($params);
// Auto-generated link is marked with a leading :
if ($property !== '' && $property[0] === ':') {
$escaped = true;
$property = $this->urlEncoder->unescape(ltrim($property, ':'));
}
$this->property = PropertyValue::makeUserProperty(str_replace(array('_'), array(' '), $property));
if (!$this->property->isValid()) {
$this->propertyString = $property;
$this->value = null;
$this->valueString = $value;
} else {
$this->propertyString = $this->property->getDataItem()->getLabel();
$this->valueString = $this->getValue((string) $value, $escaped);
}
$this->setLimit();
$this->setOffset();
$this->setNearbySearch();
}
示例2: initialize
/**
* @since 2.1
*/
public function initialize()
{
$params = explode('/', $this->queryString);
reset($params);
// Remove empty elements
$params = array_filter($params, 'strlen');
$property = isset($this->requestOptions['property']) ? $this->requestOptions['property'] : current($params);
$value = isset($this->requestOptions['value']) ? $this->requestOptions['value'] : next($params);
$property = $this->urlEncoder->decode($property);
$value = str_replace(array('-25'), array('%'), $value);
$this->property = PropertyValue::makeUserProperty($property);
if (!$this->property->isValid()) {
$this->propertyString = $property;
$this->value = null;
$this->valueString = $value;
} else {
$this->propertyString = $this->property->getWikiValue();
$this->value = DataValueFactory::getInstance()->newPropertyObjectValue($this->property->getDataItem(), $this->urlEncoder->decode($value));
$this->valueString = $this->value->isValid() ? $this->value->getWikiValue() : $value;
}
$this->setLimit();
$this->setOffset();
$this->setNearbySearch();
}
示例3: initPropertyChain
private function initPropertyChain($value)
{
$chain = explode('.', $value);
// Get the last which represents the final output
// Foo.Bar.Foobar.Baz
$last = array_pop($chain);
$this->lastPropertyChainValue = PropertyValue::makeUserProperty($last);
if (!$this->lastPropertyChainValue->isValid()) {
return $this->addError($this->lastPropertyChainValue->getErrors());
}
$this->lastPropertyChainValue->setOptions($this->getOptions());
// Generate a forward list from the remaining property labels
// Foo.Bar.Foobar
foreach ($chain as $value) {
$propertyValue = PropertyValue::makeUserProperty($value);
if (!$propertyValue->isValid()) {
continue;
}
$propertyValue->setOptions($this->getOptions());
$this->propertyValues[] = $propertyValue;
}
}