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


PHP DIProperty::findPropertyID方法代碼示例

本文整理匯總了PHP中SMW\DIProperty::findPropertyID方法的典型用法代碼示例。如果您正苦於以下問題:PHP DIProperty::findPropertyID方法的具體用法?PHP DIProperty::findPropertyID怎麽用?PHP DIProperty::findPropertyID使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在SMW\DIProperty的用法示例。


在下文中一共展示了DIProperty::findPropertyID方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getPredefinedData

 /**
  * Normalize the information for an SMW object (page etc.) and return
  * the predefined ID if any. All parameters are call-by-reference and
  * will be changed to perform any kind of built-in normalization that
  * SMW requires. This mainly applies to predefined properties that
  * should always use their property key as a title, have fixed
  * sortkeys, etc. Some very special properties also have fixed IDs that
  * do not require any DB lookups. In such cases, the method returns
  * this ID; otherwise it returns 0.
  *
  * @note This function could be extended to account for further kinds
  * of normalization and predefined ID. However, both getSMWPropertyID
  * and makeSMWPropertyID must then also be adjusted to do the same.
  *
  * @since 1.8
  * @param string $title DB key
  * @param integer $namespace namespace
  * @param string $iw interwiki prefix
  * @param string $subobjectName
  * @param string $sortkey
  * @return integer predefined id or 0 if none
  */
 protected function getPredefinedData(&$title, &$namespace, &$iw, &$subobjectName, &$sortkey)
 {
     if ($namespace == SMW_NS_PROPERTY && ($iw === '' || $iw == SMW_SQL3_SMWINTDEFIW) && $title != '') {
         // Check if this is a predefined property:
         if ($title[0] != '_') {
             // This normalization also applies to
             // subobjects of predefined properties.
             $newTitle = SMW\DIProperty::findPropertyID(str_replace('_', ' ', $title));
             if ($newTitle) {
                 $title = $newTitle;
                 $sortkey = SMW\DIProperty::findPropertyLabel($title);
                 if ($sortkey === '') {
                     $iw = SMW_SQL3_SMWINTDEFIW;
                 }
             }
         }
         // Check if this is a property with a fixed SMW ID:
         if ($subobjectName === '' && array_key_exists($title, self::$special_ids)) {
             return self::$special_ids[$title];
         }
     }
     return 0;
 }
開發者ID:jongfeli,項目名稱:SemanticMediaWiki,代碼行數:45,代碼來源:SMW_Sql3SmwIds.php


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