当前位置: 首页>>代码示例>>PHP>>正文


PHP SMWDataItem::getURI方法代码示例

本文整理汇总了PHP中SMWDataItem::getURI方法的典型用法代码示例。如果您正苦于以下问题:PHP SMWDataItem::getURI方法的具体用法?PHP SMWDataItem::getURI怎么用?PHP SMWDataItem::getURI使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SMWDataItem的用法示例。


在下文中一共展示了SMWDataItem::getURI方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: loadDataItem

 /**
  * @see SMWDataValue::loadDataItem()
  * @param $dataitem SMWDataItem
  * @return boolean
  */
 protected function loadDataItem(SMWDataItem $dataItem)
 {
     if ($dataItem->getDIType() !== SMWDataItem::TYPE_URI) {
         return false;
     }
     $this->m_dataitem = $dataItem;
     if ($this->m_mode == SMW_URI_MODE_EMAIL) {
         $this->m_wikitext = substr($dataItem->getURI(), 7);
     } elseif ($this->m_mode == SMW_URI_MODE_TEL) {
         $this->m_wikitext = substr($dataItem->getURI(), 4);
     } else {
         $this->m_wikitext = $dataItem->getURI();
     }
     $this->m_caption = $this->m_wikitext;
     $this->showUrlContextInRawFormat = false;
     return true;
 }
开发者ID:WolfgangFahl,项目名称:SemanticMediaWiki,代码行数:22,代码来源:SMW_DV_URI.php

示例2: equals

 public function equals(SMWDataItem $di)
 {
     if ($di->getDIType() !== SMWDataItem::TYPE_URI) {
         return false;
     }
     return $di->getURI() === $this->getURI();
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:7,代码来源:SMW_DI_URI.php

示例3: getDataItemExpElement

 /**
  * Create an SWMExpElement that encodes the data of the given
  * dataitem object. This method is meant to be used when exporting a
  * dataitem as a subject or object. To get the URI of a property, use
  * SMWExporter::getResourceElementForProperty() or
  * SMWExporter::getSpecialPropertyResource().
  * 
  * @param $dataItem SMWDataItem
  * @return SMWExpElement
  */
 public static function getDataItemExpElement(SMWDataItem $dataItem)
 {
     switch ($dataItem->getDIType()) {
         case SMWDataItem::TYPE_NUMBER:
             $lit = new SMWExpLiteral($dataItem->getNumber(), 'http://www.w3.org/2001/XMLSchema#double', $dataItem);
             return $lit;
         case SMWDataItem::TYPE_STRING:
         case SMWDataItem::TYPE_BLOB:
             $lit = new SMWExpLiteral(smwfHTMLtoUTF8($dataItem->getString()), 'http://www.w3.org/2001/XMLSchema#string', $dataItem);
             return $lit;
         case SMWDataItem::TYPE_BOOLEAN:
             $xsdvalue = $dataItem->getBoolean() ? 'true' : 'false';
             $lit = new SMWExpLiteral($xsdvalue, 'http://www.w3.org/2001/XMLSchema#boolean', $dataItem);
             return $lit;
         case SMWDataItem::TYPE_URI:
             $res = new SMWExpResource($dataItem->getURI(), $dataItem);
             return $res;
         case SMWDataItem::TYPE_TIME:
             $gregorianTime = $dataItem->getForCalendarModel(SMWDITime::CM_GREGORIAN);
             if ($gregorianTime->getYear() > 0) {
                 $xsdvalue = str_pad($gregorianTime->getYear(), 4, "0", STR_PAD_LEFT);
             } else {
                 $xsdvalue = '-' . str_pad(1 - $gregorianTime->getYear(), 4, "0", STR_PAD_LEFT);
             }
             $xsdtype = 'http://www.w3.org/2001/XMLSchema#gYear';
             if ($gregorianTime->getPrecision() >= SMWDITime::PREC_YM) {
                 $xsdtype = 'http://www.w3.org/2001/XMLSchema#gYearMonth';
                 $xsdvalue .= '-' . str_pad($gregorianTime->getMonth(), 2, "0", STR_PAD_LEFT);
                 if ($gregorianTime->getPrecision() >= SMWDITime::PREC_YMD) {
                     $xsdtype = 'http://www.w3.org/2001/XMLSchema#date';
                     $xsdvalue .= '-' . str_pad($gregorianTime->getDay(), 2, "0", STR_PAD_LEFT);
                     if ($gregorianTime->getPrecision() == SMWDITime::PREC_YMDT) {
                         $xsdtype = 'http://www.w3.org/2001/XMLSchema#dateTime';
                         $xsdvalue .= 'T' . sprintf("%02d", $gregorianTime->getHour()) . ':' . sprintf("%02d", $gregorianTime->getMinute()) . ':' . sprintf("%02d", $gregorianTime->getSecond());
                     }
                 }
             }
             $xsdvalue .= 'Z';
             $lit = new SMWExpLiteral($xsdvalue, $xsdtype, $gregorianTime);
             return $lit;
         case SMWDataItem::TYPE_GEO:
             /// TODO
             return null;
         case SMWDataItem::TYPE_CONTAINER:
             return self::makeExportData($dataItem->getSemanticData());
         case SMWDataItem::TYPE_WIKIPAGE:
             return self::getResourceElementForWikiPage($dataItem);
         case SMWDataItem::TYPE_CONCEPT:
             /// TODO
             return null;
         case SMWDataItem::TYPE_PROPERTY:
             return self::getResourceElementForProperty($dataItem);
     }
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:64,代码来源:SMW_Exporter.php

示例4: loadDataItem

 /**
  * @see SMWDataValue::loadDataItem()
  * @param $dataitem SMWDataItem
  * @return boolean
  */
 protected function loadDataItem(SMWDataItem $dataItem)
 {
     SWBSpecialBrowseWiki::debug("loadItem");
     if ($dataItem->getDIType() == SMWDataItem::TYPE_URI) {
         $this->m_dataitem = $dataItem;
         if ($this->m_mode == SMW_URI_MODE_EMAIL) {
             $this->m_wikitext = substr($dataItem->getURI(), 7);
         } elseif ($this->m_mode == SMW_URI_MODE_TEL) {
             $this->m_wikitext = substr($dataItem->getURI(), 4);
         } else {
             $this->m_wikitext = $dataItem->getURI();
         }
         $this->m_caption = $this->m_wikitext;
         return true;
     } else {
         return false;
     }
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:23,代码来源:SWBResolvableUriValue.php


注:本文中的SMWDataItem::getURI方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。