本文整理汇总了PHP中SMW\DIProperty::getCanonicalLabel方法的典型用法代码示例。如果您正苦于以下问题:PHP DIProperty::getCanonicalLabel方法的具体用法?PHP DIProperty::getCanonicalLabel怎么用?PHP DIProperty::getCanonicalLabel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SMW\DIProperty
的用法示例。
在下文中一共展示了DIProperty::getCanonicalLabel方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getQueryString
public function getQueryString($asValue = false)
{
$subDescription = $this->description;
// Use the canonical label to ensure that conditions contain
// language indep. references
$propertyChainString = $this->property->getCanonicalLabel();
$propertyname = $propertyChainString;
while ($propertyname !== '' && $subDescription instanceof SomeProperty) {
// try to use property chain syntax
$propertyname = $subDescription->getProperty()->getCanonicalLabel();
if ($propertyname !== '') {
$propertyChainString .= '.' . $propertyname;
$subDescription = $subDescription->getDescription();
}
}
if ($asValue) {
return '<q>[[' . $propertyChainString . '::' . $subDescription->getQueryString(true) . ']]</q>';
}
return '[[' . $propertyChainString . '::' . $subDescription->getQueryString(true) . ']]';
}
示例2: findPropertyIdByLabel
private function findPropertyIdByLabel($label)
{
$property = new DIProperty(PropertyRegistry::getInstance()->findPropertyIdByLabel($label));
$canonicalLabel = $property->getCanonicalLabel();
// #1966 and #1968
// In case something goes wrong, a recursive loop will kill PHP
// and we know we messed up
if ($canonicalLabel !== '' && $label !== $canonicalLabel) {
$this->findPropertyIdByLabel($property->getCanonicalDiWikiPage()->getTitle()->getText());
}
return array($label, $property);
}
示例3: testCanonicalRepresentation
public function testCanonicalRepresentation()
{
$property = new DIProperty('_MDAT');
$this->assertEquals('Modification date', $property->getCanonicalLabel());
$this->assertEquals(new DIWikiPage('Modification_date', SMW_NS_PROPERTY), $property->getCanonicalDiWikiPage());
}
示例4: findBasePropertyToRedirectFor
private function findBasePropertyToRedirectFor($label)
{
$property = new DIProperty(PropertyRegistry::getInstance()->findPropertyIdByLabel($label));
// Ensure to redirect to `Property:Modification date` and not using
// a possible user contextualized version such as `Property:Date de modification`
$canonicalLabel = $property->getCanonicalLabel();
if ($canonicalLabel !== '' && $label !== $canonicalLabel) {
$outputPage = $this->getContext()->getOutput();
$outputPage->redirect($property->getCanonicalDiWikiPage()->getTitle()->getFullURL());
}
}