當前位置: 首頁>>代碼示例>>PHP>>正文


PHP DIProperty::getCanonicalLabel方法代碼示例

本文整理匯總了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) . ']]';
 }
開發者ID:jongfeli,項目名稱:SemanticMediaWiki,代碼行數:20,代碼來源:SomeProperty.php

示例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);
 }
開發者ID:jongfeli,項目名稱:SemanticMediaWiki,代碼行數:12,代碼來源:PropertyLabelCanonicalMatchTest.php

示例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());
 }
開發者ID:jongfeli,項目名稱:SemanticMediaWiki,代碼行數:6,代碼來源:DIPropertyTest.php

示例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());
     }
 }
開發者ID:jongfeli,項目名稱:SemanticMediaWiki,代碼行數:11,代碼來源:SMW_OrderedListPage.php


注:本文中的SMW\DIProperty::getCanonicalLabel方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。