本文整理汇总了PHP中SMW\DIWikiPage::getInterwiki方法的典型用法代码示例。如果您正苦于以下问题:PHP DIWikiPage::getInterwiki方法的具体用法?PHP DIWikiPage::getInterwiki怎么用?PHP DIWikiPage::getInterwiki使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SMW\DIWikiPage
的用法示例。
在下文中一共展示了DIWikiPage::getInterwiki方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getContainerFor
/**
* @since 2.4
*
* @param DIProperty $property
* @param array|string $errorMsg
*
* @return DIContainer
*/
public function getContainerFor(DIProperty $property = null, $errorMsg = '')
{
if ($property !== null && $property->isInverse()) {
$property = new DIProperty($property->getKey());
}
$errorMsg = is_array($errorMsg) ? implode(' ', $errorMsg) : $errorMsg;
$subject = new DIWikiPage($this->subject->getDBkey(), $this->subject->getNamespace(), $this->subject->getInterwiki(), '_ERR' . md5(($property !== null ? $property->getKey() : 'UNKNOWN') . $errorMsg));
// Encode brackets to avoid an annotion is created/included
return $this->newDiContainer($subject, $property, InTextAnnotationParser::obscureAnnotation($errorMsg));
}
示例2: encodePage
/**
* @since 2.2
*
* @param DIWikiPage $diWikiPage
*
* @return string
*/
public static function encodePage(DIWikiPage $diWikiPage)
{
$localName = '';
if ($diWikiPage->getInterwiki() !== '') {
$localName = $diWikiPage->getInterwiki() . ':';
}
if ($diWikiPage->getNamespace() !== 0) {
$localName .= str_replace(' ', '_', $GLOBALS['wgContLang']->getNSText($diWikiPage->getNamespace())) . ':' . $diWikiPage->getDBkey();
} else {
$localName .= $diWikiPage->getDBkey();
}
return self::encodeUri(wfUrlencode($localName));
}
示例3: newDIContainer
/**
* #1416 create container manually to avoid any issues that may arise from
* a failed Title::makeTitleSafe.
*/
private function newDIContainer(Query $query)
{
$subject = $query->getContextPage();
if ($subject === null) {
$containerSemanticData = ContainerSemanticData::makeAnonymousContainer();
} else {
$subject = new DIWikiPage($subject->getDBkey(), $subject->getNamespace(), $subject->getInterwiki(), $query->getQueryId());
$containerSemanticData = new ContainerSemanticData($subject);
}
return new DIContainer($containerSemanticData);
}
示例4: newContainerSemanticData
private function newContainerSemanticData($hash)
{
if ($this->subject === null) {
$containerSemanticData = ContainerSemanticData::makeAnonymousContainer();
$containerSemanticData->skipAnonymousCheck();
} else {
$subobjectName = '_ERR' . md5($hash);
$subject = new DIWikiPage($this->subject->getDBkey(), $this->subject->getNamespace(), $this->subject->getInterwiki(), $subobjectName);
$containerSemanticData = new ContainerSemanticData($subject);
}
return $containerSemanticData;
}
示例5: getHashFrom
/**
* The subobject is attached to a root subject therefore using the root as
* identifier to allow it to be invalidated at once with all other subobjects
* that relate to a subject
*/
private function getHashFrom(DIWikiPage $subject, $suffix = '')
{
return md5(HashBuilder::createHashIdFromSegments($subject->getDBkey(), $subject->getNamespace(), $subject->getInterwiki()) . $suffix);
}
示例6: getProperties
/**
* @see Store::getProperties
*
* @param DIWikiPage $subject
* @param SMWRequestOptions|null $requestOptions
*
* @return SMWDataItem[]
*/
public function getProperties(DIWikiPage $subject, SMWRequestOptions $requestOptions = null)
{
$sid = $this->store->smwIds->getSMWPageID($subject->getDBkey(), $subject->getNamespace(), $subject->getInterwiki(), $subject->getSubobjectName());
if ($sid == 0) {
// no id, no page, no properties
return array();
}
$db = $this->store->getConnection();
$result = array();
// potentially need to get more results, since options apply to union
if ($requestOptions !== null) {
$suboptions = clone $requestOptions;
$suboptions->limit = $requestOptions->limit + $requestOptions->offset;
$suboptions->offset = 0;
} else {
$suboptions = null;
}
foreach ($this->store->getPropertyTables() as $propertyTable) {
if ($propertyTable->usesIdSubject()) {
$where = 's_id=' . $db->addQuotes($sid);
} elseif ($subject->getInterwiki() === '') {
$where = 's_title=' . $db->addQuotes($subject->getDBkey()) . ' AND s_namespace=' . $db->addQuotes($subject->getNamespace());
} else {
// subjects with non-emtpy interwiki cannot have properties
continue;
}
if ($propertyTable->isFixedPropertyTable()) {
// just check if subject occurs in table
$res = $db->select($propertyTable->getName(), '*', $where, __METHOD__, array('LIMIT' => 1));
if ($db->numRows($res) > 0) {
$result[] = new SMW\DIProperty($propertyTable->getFixedProperty());
}
} else {
// select all properties
$from = $db->tableName($propertyTable->getName());
$from .= " INNER JOIN " . $db->tableName(SMWSql3SmwIds::TABLE_NAME) . " ON smw_id=p_id";
$res = $db->select($from, 'DISTINCT smw_title,smw_sortkey', $where . $this->store->getSQLConditions($suboptions, 'smw_sortkey', 'smw_sortkey'), __METHOD__, $this->store->getSQLOptions($suboptions, 'smw_sortkey'));
foreach ($res as $row) {
$result[] = new SMW\DIProperty($row->smw_title);
}
}
$db->freeResult($res);
}
// apply options to overall result
$result = $this->store->applyRequestOptions($result, $requestOptions);
return $result;
}
示例7: createId
/**
* @since 2.4
*
* @param DIWikiPage $subject, $subobjectName
* @param string $subobjectName
*/
public function createId(DIWikiPage $subject, $subobjectName = '')
{
$id = $this->store->getObjectIds()->makeSMWPageID($subject->getDBkey(), $subject->getNamespace(), $subject->getInterwiki(), $subobjectName, false);
wfDebugLog('smw', __METHOD__ . " add new {$id} ID for " . $subject->getHash() . " {$subobjectName}");
return $id;
}
示例8: getHashIdForDiWikiPage
/**
* @since 2.1
*
* @param DIWikiPage $dataItem
*
* @return string
*/
public static function getHashIdForDiWikiPage(DIWikiPage $dataItem)
{
return self::createFromSegments($dataItem->getDBKey(), $dataItem->getNamespace(), $dataItem->getInterwiki(), $dataItem->getSubobjectName());
}
示例9: getIdForSubject
public function getIdForSubject(DIWikiPage $subject, $subobjectName = '')
{
return $this->store->getObjectIds()->getSMWPageID($subject->getDBkey(), $subject->getNamespace(), $subject->getInterwiki(), $subobjectName, false);
}
示例10: tryToMakeIdForSubject
/**
* @since 2.3
*
* @param DIWikiPage $subject, $subobjectName
* @param string $subobjectName
*/
public function tryToMakeIdForSubject(DIWikiPage $subject, $subobjectName = '')
{
if ($subject->getNamespace() !== NS_CATEGORY && $subject->getNamespace() !== SMW_NS_PROPERTY) {
return 0;
}
$id = $this->store->getObjectIds()->makeSMWPageID($subject->getDBkey(), $subject->getNamespace(), $subject->getInterwiki(), $subobjectName, false);
wfDebugLog('smw', __METHOD__ . " add new {$id} ID for " . $subject->getHash() . " \n");
return $id;
}
示例11: newResultIterator
private function newResultIterator(DIWikiPage $subject)
{
$connection = $this->store->getConnection('mw.db');
$dbKey = $subject->getDBkey();
// #1955 Ensure to match a possible predefined property
// (Modification date -> _MDAT)
if ($subject->getNamespace() === SMW_NS_PROPERTY) {
$dbKey = DIProperty::newFromUserLabel($subject->getDBkey())->getKey();
}
$condition = 'smw_title = ' . $connection->addQuotes($dbKey) . ' AND ' . 'smw_namespace = ' . $connection->addQuotes($subject->getNamespace()) . ' AND ' . 'smw_iw = ' . $connection->addQuotes($subject->getInterwiki()) . ' AND ' . 'smw_subobject != ' . $connection->addQuotes('');
foreach ($this->skipOn as $skipOn) {
$condition .= ' AND smw_subobject != ' . $connection->addQuotes($skipOn);
}
$res = $connection->select($connection->tablename(SQLStore::ID_TABLE), array('smw_id', 'smw_subobject', 'smw_sortkey'), $condition, __METHOD__);
return $this->iteratorFactory->newResultIterator($res);
}