本文整理匯總了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());
}
}