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


PHP SMWDIProperty::getLabel方法代码示例

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


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

示例1: getPropertyCustomText

 /**
  * Returns an array of CustomTexts set by the admin in WatchlistConditions
  * for this group and property.
  *
  * @since 0.2
  *
  * @param SMWDIProperty $property
  * @param String $newValue
  *
  * @return String or false
  */
 public function getPropertyCustomText(SMWDIProperty $property, $newValue)
 {
     $this->initCustomTexts();
     if (array_key_exists($property->getLabel(), $this->customTexts) && array_key_exists($newValue, $this->customTexts[$property->getLabel()])) {
         return $this->customTexts[$property->getLabel()][$newValue];
     } else {
         return false;
     }
 }
开发者ID:nischayn22,项目名称:mediawiki-extensions-SemanticWatchlist,代码行数:20,代码来源:SWL_CustomTexts.php

示例2: getInfolinks

 /**
  * Return an array of SMWLink objects that provide additional resources
  * for the given value. Captions can contain some HTML markup which is
  * admissible for wiki text, but no more. Result might have no entries
  * but is always an array.
  */
 public function getInfolinks()
 {
     if ($this->isValid() && !is_null($this->m_property)) {
         if (!$this->mHasSearchLink) {
             // add default search link
             $this->mHasSearchLink = true;
             $this->m_infolinks[] = SMWInfolink::newPropertySearchLink('+', $this->m_property->getLabel(), $this->getWikiValue());
         }
         if (!$this->mHasServiceLinks && $this->serviceLinksRenderState) {
             // add further service links
             $this->addServiceLinks();
         }
     }
     return $this->m_infolinks;
 }
开发者ID:ReachingOut,项目名称:SemanticMediaWiki,代码行数:21,代码来源:SMW_DataValue.php

示例3: execute

 public function execute()
 {
     global $wgDBtype;
     if ($this->hasOption('setup')) {
         $store = new SMWSQLStore3();
         // Lets do a drop to ensure the user doesn't has any Store3 tables already (happens when running this script twice)
         $tables = array('smw_stats');
         foreach (SMWSQLStore3::getPropertyTables() as $proptable) {
             $tables[] = $proptable->name;
         }
         $dbw = wfGetDB(DB_MASTER);
         foreach ($tables as $table) {
             $name = $dbw->tableName($table);
             $dbw->query('DROP TABLE ' . ($wgDBtype == 'postgres' ? '' : 'IF EXISTS ') . $name, 'SMWMigrate::drop');
         }
         $store->setup();
         //enter user defined properties into smw_stats (internal ones are handled by setup already )
         $query = 'Replace into ' . $dbw->tableName('smw_stats') . ' (pid,usage_count) Select smw_id,0 from ' . $dbw->tableName('smw_ids') . ' where smw_namespace = ' . SMW_NS_PROPERTY . ' and smw_iw = "" ';
         $dbw->query($query, 'SMWMigrate:commandLine');
     } elseif ($this->hasOption('migrate')) {
         $options = array();
         if ($this->hasArg(0)) {
             if ($this->hasArg(1)) {
                 $options['LIMIT'] = $this->getArg(0);
                 $options['OFFSET'] = $this->getArg(1);
             }
         }
         $dbw = wfGetDB(DB_MASTER);
         $oldStore = new SMWSQLStore2();
         $newStore = new SMWSQLStore3();
         $proptables = SMWSQLStore3::getPropertyTables();
         //get properties
         $res = $dbw->select('smw_ids', array('smw_id', 'smw_title', 'smw_namespace'), array('smw_namespace' => SMW_NS_PROPERTY), __METHOD__, $options);
         foreach ($res as $row) {
             $property = new SMWDIProperty($row->smw_title);
             echo 'Now migrating data for Property ' . $property->getLabel() . " into Store3 \n";
             //get the table
             $tableId = SMWSQLStore3::findPropertyTableID($property);
             $proptable = $proptables[$tableId];
             //get the DIHandler
             $dataItemId = SMWDataValueFactory::getDataItemId($property->findPropertyTypeId());
             $diHandler = $newStore->getDataItemHandlerForDIType($dataItemId);
             $subjects = $oldStore->getPropertySubjects($property, null);
             $insertions = array();
             foreach ($subjects as $subject) {
                 $sid = $newStore->makeSMWPageID($subject->getDBkey(), $subject->getNamespace(), $subject->getInterwiki(), $subject->getSubobjectName(), true, str_replace('_', ' ', $subject->getDBkey()) . $subject->getSubobjectName());
                 //now prepare udpates
                 $propvals = $oldStore->getPropertyValues($subject, $property);
                 $uvals = $proptable->idsubject ? array('s_id' => $sid) : array('s_title' => $subject->getDBkey(), 's_namespace' => $subject->getNamespace());
                 if ($proptable->fixedproperty == false) {
                     $uvals['p_id'] = $newStore->makeSMWPropertyID($property);
                 }
                 foreach ($propvals as $propval) {
                     $uvals = array_merge($uvals, $diHandler->getInsertValues($propval));
                     $insertions[] = $uvals;
                 }
             }
             // now write to the DB for all subjects (is this too much?)
             $dbw->insert($proptable->name, $insertions, "SMW::migrate{$proptable->name}");
         }
         $dbw->freeResult($res);
     } else {
         echo "Sorry I refuse to work without any options currently";
     }
 }
开发者ID:yusufchang,项目名称:app,代码行数:65,代码来源:SMW_migration.php

示例4: getPropertyInterwiki

 /**
  * Properties have a mechanisms for being predefined (i.e. in PHP instead
  * of in wiki). Special "interwiki" prefixes separate the ids of such
  * predefined properties from the ids for the current pages (which may,
  * e.g., be moved, while the predefined object is not movable).
  */
 protected function getPropertyInterwiki(SMWDIProperty $property)
 {
     if ($property->isUserDefined()) {
         return '';
     } else {
         return $property->getLabel() !== '' ? SMW_SQL2_SMWPREDEFIW : SMW_SQL2_SMWINTDEFIW;
     }
 }
开发者ID:nischayn22,项目名称:SemanticMediawiki,代码行数:14,代码来源:SMW_SQLStore2.php

示例5: getPropertyInterwiki

 /**
  * Properties have a mechanisms for being predefined (i.e. in PHP instead
  * of in wiki). Special "interwiki" prefixes separate the ids of such
  * predefined properties from the ids for the current pages (which may,
  * e.g., be moved, while the predefined object is not movable).
  *
  * @todo This documentation is out of date. Right now, the special
  * interwiki is used only for special properties without a label, i.e.,
  * which cannot be shown to a user. This allows us to filter such cases
  * from all queries that retrieve lists of properties. It should be
  * checked that this is really the only use that this has throughout
  * the code.
  *
  * @since 1.8
  * @param SMWDIProperty $property
  * @return string
  */
 public function getPropertyInterwiki(SMWDIProperty $property)
 {
     return $property->getLabel() !== '' ? '' : SMW_SQL3_SMWINTDEFIW;
 }
开发者ID:yusufchang,项目名称:app,代码行数:21,代码来源:SMW_Sql3SmwIds.php

示例6: formatPropertyItem

 /**
  * Produce a formatted string representation for showing a property in
  * the list of unused properties.
  *
  * @since 1.8
  *
  * @param SMWDIProperty $property
  * @return string
  */
 protected function formatPropertyItem(SMWDIProperty $property)
 {
     $linker = smwfGetLinker();
     $errors = array();
     if ($property->isUserDefined()) {
         $proplink = $linker->link($property->getDiWikiPage()->getTitle(), $property->getLabel());
         $types = smwfGetStore()->getPropertyValues($property->getDiWikiPage(), new SMWDIProperty('_TYPE'));
         if (count($types) >= 1) {
             $typeDataValue = SMWDataValueFactory::newDataItemValue(current($types), new SMWDIProperty('_TYPE'));
         } else {
             $typeDataValue = SMWTypesValue::newFromTypeId('_wpg');
             $errors[] = wfMessage('smw_propertylackstype', $typeDataValue->getLongHTMLText())->text();
         }
         $typeString = $typeDataValue->getLongHTMLText($linker);
     } else {
         $typeid = $property->findPropertyTypeID();
         $typeDataValue = SMWTypesValue::newFromTypeId($typeid);
         $typeString = $typeDataValue->getLongHTMLText($linker);
         $propertyDataValue = SMWDataValueFactory::newDataItemValue($property, null);
         $proplink = $propertyDataValue->getShortHtmlText($linker);
     }
     return wfMessage('smw_unusedproperty_template', $proplink, $typeString)->text() . ' ' . smwfEncodeMessages($errors);
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:32,代码来源:SMW_SpecialUnusedProperties.php

示例7: formatPropertyItem

 /**
  * Produce a formatted string representation for showing a property and
  * its usage count in the list of used properties.
  *
  * @since 1.8
  *
  * @param SMWDIProperty $property
  * @param integer $useCount
  * @return string
  */
 protected function formatPropertyItem(SMWDIProperty $property, $useCount)
 {
     global $wgLang;
     $linker = smwfGetLinker();
     $errors = array();
     $diWikiPage = $property->getDiWikiPage();
     $title = !is_null($diWikiPage) ? $diWikiPage->getTitle() : null;
     if ($property->isUserDefined() && is_null($title)) {
         // Show even messed up property names.
         $typestring = '';
         $proplink = $property->getLabel();
         $errors[] = wfMessage('smw_notitle', $property->getLabel())->escaped();
     } elseif ($property->isUserDefined()) {
         if ($useCount <= 5) {
             $errors[] = wfMessage('smw_propertyhardlyused')->escaped();
         }
         // User defined types default to Page
         global $smwgPDefaultType;
         $typeDataValue = SMWTypesValue::newFromTypeId($smwgPDefaultType);
         $typestring = $typeDataValue->getLongHTMLText($linker);
         $label = htmlspecialchars($property->getLabel());
         if ($title->exists()) {
             $typeProperty = new SMWDIProperty('_TYPE');
             $types = smwfGetStore()->getPropertyValues($diWikiPage, $typeProperty);
             if (count($types) >= 1) {
                 $typeDataValue = SMWDataValueFactory::newDataItemValue(current($types), $typeProperty);
                 $typestring = $typeDataValue->getLongHTMLText($linker);
             } else {
                 $errors[] = wfMessage('smw_propertylackstype')->rawParams($typestring)->escaped();
             }
             $proplink = $linker->link($title, $label);
         } else {
             $errors[] = wfMessage('smw_propertylackspage')->escaped();
             $proplink = $linker->link($title, $label, array(), array('action' => 'view'));
         }
     } else {
         // predefined property
         $typeid = $property->findPropertyTypeID();
         $typeDataValue = SMWTypesValue::newFromTypeId($typeid);
         $typestring = $typeDataValue->getLongHTMLText($linker);
         $propertyDataValue = SMWDataValueFactory::newDataItemValue($property, null);
         $proplink = $propertyDataValue->getShortHtmlText($linker);
     }
     $warnings = smwfEncodeMessages($errors, 'warning', '', false);
     $useCount = $wgLang->formatNum($useCount);
     if ($typestring === '') {
         // Builtins have no type
         // @todo Should use numParams for $useCount?
         return wfMessage('smw_property_template_notype')->rawParams($proplink)->params($useCount)->text() . ' ' . $warnings;
     } else {
         // @todo Should use numParams for $useCount?
         return wfMessage('smw_property_template')->rawParams($proplink, $typestring)->params($useCount)->escaped() . ' ' . $warnings;
     }
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:64,代码来源:SMW_SpecialProperties.php


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