/** * @since 2.1 * * @param HtmlFormBuilder $htmlFormBuilder * @param PageRequestOptions $pageRequestOptions * @param QueryResultLookup $queryResultLookup */ public function __construct(HtmlFormBuilder $htmlFormBuilder, PageRequestOptions $pageRequestOptions, QueryResultLookup $queryResultLookup) { $this->htmlFormBuilder = $htmlFormBuilder; $this->pageRequestOptions = $pageRequestOptions; $this->queryResultLookup = $queryResultLookup; $this->linker = smwfGetLinker(); }
public function uriProvider() { $linker = smwfGetLinker(); // FIXME MW 1.19* $noFollowAttribute = version_compare($GLOBALS['wgVersion'], '1.20', '<') ? '' : ' rel="nofollow"'; // https://github.com/lanthaler/IRI/blob/master/Test/IriTest.php $provider[] = array('http://example.org/aaa/bbb#ccc', false, null, array('wikiValue' => 'http://example.org/aaa/bbb#ccc', 'longHTMLText' => 'http://example.org/aaa/bbb#ccc', 'longWikiText' => 'http://example.org/aaa/bbb#ccc', 'shortHTMLText' => 'http://example.org/aaa/bbb#ccc', 'shortWikiText' => 'http://example.org/aaa/bbb#ccc')); $provider[] = array('http://example.org/aaa/bbb#ccc', 'Foo', null, array('wikiValue' => 'http://example.org/aaa/bbb#ccc', 'longHTMLText' => 'http://example.org/aaa/bbb#ccc', 'longWikiText' => 'http://example.org/aaa/bbb#ccc', 'shortHTMLText' => 'Foo', 'shortWikiText' => 'Foo')); $provider[] = array('http://example.org/aaa/bbb#ccc', false, $linker, array('wikiValue' => 'http://example.org/aaa/bbb#ccc', 'longHTMLText' => '<a class="external"' . $noFollowAttribute . ' href="http://example.org/aaa/bbb#ccc">http://example.org/aaa/bbb#ccc</a>', 'longWikiText' => '[http://example.org/aaa/bbb#ccc http://example.org/aaa/bbb#ccc]', 'shortHTMLText' => '<a class="external"' . $noFollowAttribute . ' href="http://example.org/aaa/bbb#ccc">http://example.org/aaa/bbb#ccc</a>', 'shortWikiText' => '[http://example.org/aaa/bbb#ccc http://example.org/aaa/bbb#ccc]')); #3 $provider[] = array('http://example.org/aaa/bbb#ccc', 'Foo', $linker, array('wikiValue' => 'http://example.org/aaa/bbb#ccc', 'longHTMLText' => '<a class="external"' . $noFollowAttribute . ' href="http://example.org/aaa/bbb#ccc">http://example.org/aaa/bbb#ccc</a>', 'longWikiText' => '[http://example.org/aaa/bbb#ccc http://example.org/aaa/bbb#ccc]', 'shortHTMLText' => '<a class="external"' . $noFollowAttribute . ' href="http://example.org/aaa/bbb#ccc">Foo</a>', 'shortWikiText' => '[http://example.org/aaa/bbb#ccc Foo]')); #4 $provider[] = array('http://example.org/aaa%2Fbbb#ccc', false, null, array('wikiValue' => 'http://example.org/aaa%2Fbbb#ccc', 'longHTMLText' => 'http://example.org/aaa%2Fbbb#ccc', 'longWikiText' => 'http://example.org/aaa%2Fbbb#ccc', 'shortHTMLText' => 'http://example.org/aaa%2Fbbb#ccc', 'shortWikiText' => 'http://example.org/aaa%2Fbbb#ccc')); $provider[] = array('http://example.org/aaa%2Fbbb#ccc', 'Foo', null, array('wikiValue' => 'http://example.org/aaa%2Fbbb#ccc', 'longHTMLText' => 'http://example.org/aaa%2Fbbb#ccc', 'longWikiText' => 'http://example.org/aaa%2Fbbb#ccc', 'shortHTMLText' => 'Foo', 'shortWikiText' => 'Foo')); #6 $provider[] = array('http://example.org/aaa%2Fbbb#ccc', false, $linker, array('wikiValue' => 'http://example.org/aaa%2Fbbb#ccc', 'longHTMLText' => '<a class="external"' . $noFollowAttribute . ' href="http://example.org/aaa/bbb#ccc">http://example.org/aaa%2Fbbb#ccc</a>', 'longWikiText' => '[http://example.org/aaa/bbb#ccc http://example.org/aaa%2Fbbb#ccc]', 'shortHTMLText' => '<a class="external"' . $noFollowAttribute . ' href="http://example.org/aaa/bbb#ccc">http://example.org/aaa%2Fbbb#ccc</a>', 'shortWikiText' => '[http://example.org/aaa/bbb#ccc http://example.org/aaa%2Fbbb#ccc]')); $provider[] = array('http://example.org/aaa%2Fbbb#ccc', 'Foo', $linker, array('wikiValue' => 'http://example.org/aaa%2Fbbb#ccc', 'longHTMLText' => '<a class="external"' . $noFollowAttribute . ' href="http://example.org/aaa/bbb#ccc">http://example.org/aaa%2Fbbb#ccc</a>', 'longWikiText' => '[http://example.org/aaa/bbb#ccc http://example.org/aaa%2Fbbb#ccc]', 'shortHTMLText' => '<a class="external"' . $noFollowAttribute . ' href="http://example.org/aaa/bbb#ccc">Foo</a>', 'shortWikiText' => '[http://example.org/aaa/bbb#ccc Foo]')); #8 UTF-8 encoded string $provider[] = array('http://example.org/ようこそ--23-7B-7D', false, null, array('wikiValue' => 'http://example.org/ようこそ--23-7B-7D', 'longHTMLText' => 'http://example.org/ようこそ--23-7B-7D', 'longWikiText' => 'http://example.org/ようこそ--23-7B-7D', 'shortHTMLText' => 'http://example.org/ようこそ--23-7B-7D', 'shortWikiText' => 'http://example.org/ようこそ--23-7B-7D')); #9 $provider[] = array('http://example.org/%E3%82%88%E3%81%86%E3%81%93%E3%81%9D-23-7B-7D', false, null, array('wikiValue' => 'http://example.org/%E3%82%88%E3%81%86%E3%81%93%E3%81%9D-23-7B-7D', 'longHTMLText' => 'http://example.org/%E3%82%88%E3%81%86%E3%81%93%E3%81%9D-23-7B-7D', 'longWikiText' => 'http://example.org/%E3%82%88%E3%81%86%E3%81%93%E3%81%9D-23-7B-7D', 'shortHTMLText' => 'http://example.org/%E3%82%88%E3%81%86%E3%81%93%E3%81%9D-23-7B-7D', 'shortWikiText' => 'http://example.org/%E3%82%88%E3%81%86%E3%81%93%E3%81%9D-23-7B-7D')); $provider[] = array('http://example.org/%E3%82%88%E3%81%86%E3%81%93%E3%81%9D-23-7B-7D', '一二三', null, array('wikiValue' => 'http://example.org/%E3%82%88%E3%81%86%E3%81%93%E3%81%9D-23-7B-7D', 'longHTMLText' => 'http://example.org/%E3%82%88%E3%81%86%E3%81%93%E3%81%9D-23-7B-7D', 'longWikiText' => 'http://example.org/%E3%82%88%E3%81%86%E3%81%93%E3%81%9D-23-7B-7D', 'shortHTMLText' => '一二三', 'shortWikiText' => '一二三')); # 11 $provider[] = array('http://example.org/%E3%82%88%E3%81%86%E3%81%93%E3%81%9D-23-7B-7D', false, $linker, array('wikiValue' => 'http://example.org/%E3%82%88%E3%81%86%E3%81%93%E3%81%9D-23-7B-7D', 'longHTMLText' => '<a class="external"' . $noFollowAttribute . ' href="http://example.org/%E3%82%88%E3%81%86%E3%81%93%E3%81%9D-23-7B-7D">http://example.org/%E3%82%88%E3%81%86%E3%81%93%E3%81%9D-23-7B-7D</a>', 'longWikiText' => '[http://example.org/%E3%82%88%E3%81%86%E3%81%93%E3%81%9D-23-7B-7D http://example.org/%E3%82%88%E3%81%86%E3%81%93%E3%81%9D-23-7B-7D]', 'shortHTMLText' => '<a class="external"' . $noFollowAttribute . ' href="http://example.org/%E3%82%88%E3%81%86%E3%81%93%E3%81%9D-23-7B-7D">http://example.org/%E3%82%88%E3%81%86%E3%81%93%E3%81%9D-23-7B-7D</a>', 'shortWikiText' => '[http://example.org/%E3%82%88%E3%81%86%E3%81%93%E3%81%9D-23-7B-7D http://example.org/%E3%82%88%E3%81%86%E3%81%93%E3%81%9D-23-7B-7D]')); $provider[] = array('http://example.org/%E3%82%88%E3%81%86%E3%81%93%E3%81%9D-23-7B-7D', '一二三', $linker, array('wikiValue' => 'http://example.org/%E3%82%88%E3%81%86%E3%81%93%E3%81%9D-23-7B-7D', 'longHTMLText' => '<a class="external"' . $noFollowAttribute . ' href="http://example.org/%E3%82%88%E3%81%86%E3%81%93%E3%81%9D-23-7B-7D">http://example.org/%E3%82%88%E3%81%86%E3%81%93%E3%81%9D-23-7B-7D</a>', 'longWikiText' => '[http://example.org/%E3%82%88%E3%81%86%E3%81%93%E3%81%9D-23-7B-7D http://example.org/%E3%82%88%E3%81%86%E3%81%93%E3%81%9D-23-7B-7D]', 'shortHTMLText' => '<a class="external"' . $noFollowAttribute . ' href="http://example.org/%E3%82%88%E3%81%86%E3%81%93%E3%81%9D-23-7B-7D">一二三</a>', 'shortWikiText' => '[http://example.org/%E3%82%88%E3%81%86%E3%81%93%E3%81%9D-23-7B-7D 一二三]')); # 13 $provider[] = array('http://example.org/api?query=!_:;@* #Foo&=%20-3DBar', false, null, array('wikiValue' => 'http://example.org/api?query=!_:;@* #Foo&=%20-3DBar', 'longHTMLText' => 'http://example.org/api?query=!_:;@* #Foo&=%20-3DBar', 'longWikiText' => 'http://example.org/api?query=!_:;@* #Foo&=%20-3DBar', 'shortHTMLText' => 'http://example.org/api?query=!_:;@* #Foo&=%20-3DBar', 'shortWikiText' => 'http://example.org/api?query=!_:;@* #Foo&=%20-3DBar')); $provider[] = array('http://example.org/api?query=!_:;@* #Foo&=%20-3DBar', '&!_:;@*#Foo', null, array('wikiValue' => 'http://example.org/api?query=!_:;@* #Foo&=%20-3DBar', 'longHTMLText' => 'http://example.org/api?query=!_:;@* #Foo&=%20-3DBar', 'longWikiText' => 'http://example.org/api?query=!_:;@* #Foo&=%20-3DBar', 'shortHTMLText' => '&!_:;@*#Foo', 'shortWikiText' => '&!_:;@*#Foo')); $provider[] = array('http://example.org/api?query=!_:;@* #Foo&=%20-3DBar', false, $linker, array('wikiValue' => 'http://example.org/api?query=!_:;@* #Foo&=%20-3DBar', 'longHTMLText' => '<a class="external"' . $noFollowAttribute . ' href="http://example.org/api?query=%21_:%3B@%2A%20#Foo&=%20-3DBar">http://example.org/api?query=!_:;@* #Foo&=%20-3DBar</a>', 'longWikiText' => '[http://example.org/api?query=%21_:%3B@%2A%20#Foo&=%20-3DBar http://example.org/api?query=!_:;@* #Foo&=%20-3DBar]', 'shortHTMLText' => '<a class="external"' . $noFollowAttribute . ' href="http://example.org/api?query=%21_:%3B@%2A%20#Foo&=%20-3DBar">http://example.org/api?query=!_:;@* #Foo&=%20-3DBar</a>', 'shortWikiText' => '[http://example.org/api?query=%21_:%3B@%2A%20#Foo&=%20-3DBar http://example.org/api?query=!_:;@* #Foo&=%20-3DBar]')); $provider[] = array('http://example.org/api?query=!_:;@* #Foo&=%20-3DBar', '&!_:;@* #Foo', $linker, array('wikiValue' => 'http://example.org/api?query=!_:;@* #Foo&=%20-3DBar', 'longHTMLText' => '<a class="external"' . $noFollowAttribute . ' href="http://example.org/api?query=%21_:%3B@%2A%20#Foo&=%20-3DBar">http://example.org/api?query=!_:;@* #Foo&=%20-3DBar</a>', 'longWikiText' => '[http://example.org/api?query=%21_:%3B@%2A%20#Foo&=%20-3DBar http://example.org/api?query=!_:;@* #Foo&=%20-3DBar]', 'shortHTMLText' => '<a class="external"' . $noFollowAttribute . ' href="http://example.org/api?query=%21_:%3B@%2A%20#Foo&=%20-3DBar">&!_:;@* #Foo</a>', 'shortWikiText' => '[http://example.org/api?query=%21_:%3B@%2A%20#Foo&=%20-3DBar &!_:;@* #Foo]')); return $provider; }
/** * @param $skin * @param array $result First item is SMWDIProperty, second item is int * * @return string */ function formatResult($skin, $result) { $linker = smwfGetLinker(); if ($result[0]->isUserDefined()) { $proplink = $linker->makeLinkObj($result[0]->getDiWikiPage()->getTitle(), htmlspecialchars($result[0]->getLabel()), 'action=view'); } else { $proplink = SMWDataValueFactory::newDataItemValue($result[0], new SMWDIProperty('_TYPE'))->getLongHTMLText($linker); } return wfMsgExt('smw_wantedproperty_template', array('parsemag'), $proplink, $result[1]); }
/** * 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; } }
protected function getTypesList() { $html = '<p>' . wfMessage('smw_types_docu')->escaped() . "</p><br />\n"; $typeLabels = DataTypeRegistry::getInstance()->getKnownTypeLabels(); asort($typeLabels, SORT_STRING); $html .= "<ul>\n"; foreach ($typeLabels as $typeId => $label) { $typeValue = SMWTypesValue::newFromTypeId($typeId); $html .= '<li>' . $typeValue->getLongHTMLText(smwfGetLinker()) . "</li>\n"; } $html .= "</ul>\n"; return $html; }
protected function getTypesList() { $html = '<p>' . htmlspecialchars(wfMsg('smw_types_docu')) . "</p><br />\n"; $typeLabels = SMWDataValueFactory::getKnownTypeLabels(); asort($typeLabels, SORT_STRING); $html .= "<ul>\n"; foreach ($typeLabels as $typeId => $label) { $typeValue = SMWTypesValue::newFromTypeId($typeId); $html .= '<li>' . $typeValue->getLongHTMLText(smwfGetLinker()) . "</li>\n"; } $html .= "</ul>\n"; return $html; }
function formatResult($skin, $result) { global $wgLang; $linker = smwfGetLinker(); list($property, $useCount) = $result; $errors = array(); $diWikiPage = $property->getDiWikiPage(); $title = !is_null($diWikiPage) ? $diWikiPage->getTitle() : null; if ($property->isUserDefined()) { if ($title === null) { return ''; } if ($useCount <= 5) { $errors[] = wfMsgHtml('smw_propertyhardlyused'); } // 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[] = wfMsgHtml('smw_propertylackstype', $typestring); } $proplink = $linker->link($title, $label); } else { $errors[] = wfMsgHtml('smw_propertylackspage'); $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 return wfMsgHtml('smw_property_template_notype', $proplink, $useCount) . ' ' . $warnings; } else { return wfMsgHtml('smw_property_template', $proplink, $typestring, $useCount) . ' ' . $warnings; } }
function formatResult($skin, $result) { $linker = smwfGetLinker(); $proplink = $linker->link($result->getDiWikiPage()->getTitle(), $result->getLabel()); $types = smwfGetStore()->getPropertyValues($result->getDiWikiPage(), new SMWDIProperty('_TYPE')); $errors = array(); if (count($types) >= 1) { $typestring = SMWDataValueFactory::newDataItemValue(current($types), new SMWDIProperty('_TYPE'))->getLongHTMLText($linker); } else { $type = SMWTypesValue::newFromTypeId('_wpg'); $typestring = $type->getLongHTMLText($linker); $errors[] = wfMsg('smw_propertylackstype', $type->getLongHTMLText()); } return wfMsg('smw_unusedproperty_template', $proplink, $typestring) . ' ' . smwfEncodeMessages($errors); }
protected function getTypesList() { $typeLabels = DataTypeRegistry::getInstance()->getKnownTypeLabels(); asort($typeLabels, SORT_STRING); $mwCollaboratorFactory = ApplicationFactory::getInstance()->newMwCollaboratorFactory(); $htmlColumnListRenderer = $mwCollaboratorFactory->newHtmlColumnListRenderer(); foreach ($typeLabels as $typeId => $label) { $typeValue = SMWTypesValue::newFromTypeId($typeId); $startChar = $this->getLanguage()->convert($this->getLanguage()->firstChar($typeValue->getWikiValue())); $contentsByIndex[] = $typeValue->getLongHTMLText(smwfGetLinker()); } $htmlColumnListRenderer->setNumberOfColumns(2); $htmlColumnListRenderer->addContentsByNoIndex($contentsByIndex); $htmlColumnListRenderer->setColumnListClass('smw-sp-types-list'); $html = \Html::rawElement('p', array('class' => 'smw-sp-types-intro'), wfMessage('smw_types_docu')->parse()) . \Html::element('h2', array(), wfMessage('smw-sp-types-list')->escaped()); return $html . $htmlColumnListRenderer->getHtml(); }
/** * 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); }
/** * Creates the HTML for a bullet list with all the results of the set * query. Values can be highlighted to show exact matches among nearby * ones. * * @todo I18N: some parentheses hardcoded * * @since 1.8 (was private displayResults before) * @param array $results (array of (array of one or two SMWDataValues)) * @param integer $number How many results should be displayed? -1 for all * @param boolean $first If less results should be displayed than * given, should they show the first $number results, or the last * $number results? * @param boolean $highlight Should the results be highlighted? * * @return string HTML with the bullet list, including header */ protected function getResultList($results, $number, $first, $highlight = false) { if ($number > 0) { $results = $first ? array_slice($results, 0, $number) : array_slice($results, $number); } $html = ''; foreach ($results as $result) { $listitem = $result[0]->getLongHTMLText(smwfGetLinker()); // Add browsing link for wikipage results // Note: non-wikipage results are possible using inverse properties if ($result[0]->getTypeID() == '_wpg') { $listitem .= '  ' . SMWInfolink::newBrowsingLink('+', $result[0]->getLongWikiText())->getHTML(smwfGetLinker()); } // Show value if not equal to the value that was searched // or if the current results are to be highlighted: if (array_key_exists(1, $result) && $result[1] instanceof SMWDataValue && (!$this->value->getDataItem()->equals($result[1]->getDataItem()) || $highlight)) { // TODO i18n: Hardcoded parentheses $listitem .= " <em><small>(" . $result[1]->getLongHTMLText(smwfGetLinker()) . ")</small></em>"; } // Highlight values if ($highlight) { $listitem = "<strong>{$listitem}</strong>"; } $html .= "<li>{$listitem}</li>\n"; } return "<ul>\n{$html}</ul>\n"; }
/** * Displays the subject that is currently being browsed to. * * @return A string containing the HTML with the subject line */ private function displayHead() { global $wgOut; $wgOut->setHTMLTitle( $this->subject->getTitle() ); $html = "<table class=\"smwb-factbox\" cellpadding=\"0\" cellspacing=\"0\">\n" . "<tr class=\"smwb-title\"><td colspan=\"2\">\n" . $this->subject->getLongHTMLText( smwfGetLinker() ) . "\n" . "</td></tr>\n</table>\n"; return $html; }
public function execute($query) { global $wgRequest, $wgOut; $linker = smwfGetLinker(); $this->setHeaders(); // Get parameters $pagename = $wgRequest->getVal('from'); $propname = $wgRequest->getVal('type'); $limit = $wgRequest->getVal('limit'); $offset = $wgRequest->getVal('offset'); if ($limit === '') { $limit = 20; } if ($offset === '') { $offset = 0; } if ($propname === '') { // No GET parameters? Try the URL: $queryparts = explode('::', $query); $propname = $query; if (count($queryparts) > 1) { $pagename = $queryparts[0]; $propname = implode('::', array_slice($queryparts, 1)); } } $subject = SMWDataValueFactory::newTypeIDValue('_wpg', $pagename); $pagename = $subject->isValid() ? $subject->getPrefixedText() : ''; $property = SMWPropertyValue::makeUserProperty($propname); $propname = $property->isValid() ? $property->getWikiValue() : ''; // Produce output $html = ''; if ($propname === '') { // no property given, show a message $html .= wfMsg('smw_pp_docu') . "\n"; } else { // property given, find and display results // FIXME: very ugly, needs i18n $wgOut->setPagetitle(($pagename !== '' ? $pagename . ' ' : '') . $property->getWikiValue()); // get results (get one more, to see if we have to add a link to more) $options = new SMWRequestOptions(); $options->limit = $limit + 1; $options->offset = $offset; $options->sort = true; $results = smwfGetStore()->getPropertyValues($pagename !== '' ? $subject->getDataItem() : null, $property->getDataItem(), $options); // prepare navigation bar if needed if ($offset > 0 || count($results) > $limit) { if ($offset > 0) { $navigation = Html::element('a', array('href' => $this->getTitle()->getLocalURL(array('offset' => max(0, $offset - $limit), 'limit' => $limit, 'type' => $propname, 'from' => $pagename))), wfMsg('smw_result_prev')); } else { $navigation = wfMsg('smw_result_prev'); } $navigation .= '     <b>' . wfMsg('smw_result_results') . ' ' . ($offset + 1) . '– ' . ($offset + min(count($results), $limit)) . '</b>    '; if (count($results) == $limit + 1) { $navigation = Html::element('a', array('href' => $this->getTitle()->getLocalURL(array('offset' => $offset + $limit, 'limit' => $limit, 'type' => $propname, 'from' => $pagename))), wfMsg('smw_result_next')); } else { $navigation .= wfMsg('smw_result_next'); } } else { $navigation = ''; } // display results $html .= '<br />' . $navigation; if (count($results) == 0) { $html .= wfMsg('smw_result_noresults'); } else { $html .= "<ul>\n"; $count = $limit + 1; foreach ($results as $di) { $count--; if ($count < 1) { continue; } $dv = SMWDataValueFactory::newDataItemValue($di, $property->getDataItem()); $html .= '<li>' . $dv->getLongHTMLText($linker); // do not show infolinks, the magnifier "+" is ambiguous with the browsing '+' for '_wpg' (see below) if ($property->getDataItem()->findPropertyTypeID() == '_wpg') { $browselink = SMWInfolink::newBrowsingLink('+', $dv->getLongWikiText()); $html .= '  ' . $browselink->getHTML($linker); } $html .= "</li> \n"; } $html .= "</ul>\n"; } $html .= $navigation; } // Display query form $spectitle = $this->getTitle(); $html .= '<p> </p>'; $html .= '<form name="pageproperty" action="' . htmlspecialchars($spectitle->getLocalURL()) . '" method="get">' . "\n" . '<input type="hidden" name="title" value="' . $spectitle->getPrefixedText() . '"/>'; $html .= wfMsg('smw_pp_from') . ' <input type="text" name="from" value="' . htmlspecialchars($pagename) . '" />' . "   \n"; $html .= wfMsg('smw_pp_type') . ' <input type="text" name="type" value="' . htmlspecialchars($propname) . '" />' . "\n"; $html .= '<input type="submit" value="' . wfMsg('smw_pp_submit') . "\"/>\n</form>\n"; $wgOut->addHTML($html); SMWOutputs::commitToOutputPage($wgOut); // make sure locally collected output data is pushed to the output! }
/** * Creates the HTML for a bullet list with all the results of the set query. * * @param[in] $results array of array of SMWWikiPageValue, SMWDataValue The entity and its datavalue * @param[in] $number int How many results should be displayed? -1 for all * @param[in] $first bool If less results should be displayed than given, should they show the first $number results, or the last $number results? * @param[in] $highlight bool Should the results be highlighted? * * @return string HTML with the bullet list and a header */ private function displayResults($results, $number = -1, $first = true, $highlight = false) { $html = "<ul>\n"; if (!$first && $number > 0) { // TODO: why is this reversed? // I (jeroendedauw) replaced a loop using array_shift by this, which is equivalent. $results = array_slice(array_reverse($results), 0, $number); } while ($results && $number != 0) { $result = array_shift($results); $html .= '<li>' . $result[0]->getLongHTMLText(smwfGetLinker()); if ($result[0]->getTypeID() == '_wpg') { $html .= '  ' . SMWInfolink::newBrowsingLink('+', $result[0]->getLongWikiText())->getHTML(smwfGetLinker()); } if (array_key_exists(1, $result) && is_object($result[1]) && ($this->value != $result[1] || $highlight)) { $html .= " <em><small>(" . $result[1]->getLongHTMLText(smwfGetLinker()) . ")</small></em>"; } $html .= "</li>"; if ($highlight) { $html = "<strong>" . $html . "</strong>"; } $html .= "\n"; $number--; } $html .= "</ul>\n"; return $html; }
/** * Creates a link to a special page, using that page's top-level description as the link text. */ public static function linkForSpecialPage($specialPageName) { $specialPage = SpecialPage::getPage($specialPageName); return smwfGetLinker()->link($specialPage->getTitle(), $specialPage->getDescription()); }
static function cancelLinkHTML($is_disabled, $label = null, $attr = array()) { global $wgTitle, $wgParser; if ($label == null) { $label = $wgParser->recursiveTagParse(wfMessage('cancel')->text()); } if ($wgTitle == null) { $cancel = ''; } elseif ($wgTitle->isSpecial('FormEdit')) { $stepsBack = 1; // For IE, we need to go back twice, past the redirect. if (array_key_exists('HTTP_USER_AGENT', $_SERVER) && stristr($_SERVER['HTTP_USER_AGENT'], "msie")) { $stepsBack = 2; } $cancel = "<a href=\"javascript:history.go(-{$stepsBack});\">{$label}</a>"; } else { $cancel = smwfGetLinker()->link($wgTitle, $label, array(), array(), 'known'); } return "\t\t" . Html::rawElement('span', array('class' => 'editHelp'), $cancel) . "\n"; }
/** * (non-PHPdoc) * @see SMWResultPrinter::getResultText() * * TODO: split up megamoth */ protected function getResultText( SMWQueryResult $res, $outputmode ) { $events = array(); // print all result rows while ( $row = $res->getNext() ) { $dates = array(); $title = $text = $color = ''; if ( $this->mTemplate != '' ) { // build template code $this->hasTemplates = true; if ( $this->mUserParam ) { $text = "|userparam=$this->mUserParam"; } foreach ( $row as $i => $field ) { $pr = $field->getPrintRequest(); $text .= '|' . ( $i + 1 ) . '='; while ( ( $object = $field->getNextDataValue() ) !== false ) { if ( $object->getTypeID() == '_dat' ) { $text .= $object->getLongWikiText(); } elseif ( $object->getTypeID() == '_wpg' ) { // use shorter "LongText" for wikipage // handling of "link=" param if ( $this->mLinkOthers ) { $text .= $object->getLongText( $outputmode, null ); } else { $text .= $object->getWikiValue(); } } else { $text .= $object->getShortText( $outputmode, null ); } if ( $pr->getMode() == SMWPrintRequest::PRINT_PROP && $pr->getTypeID() == '_dat' ) { $dates[] = $this->formatDateStr( $object ); } } } } else { // build simple text $numNonDateProperties = 0; // cycle through a 'row', which is the page // name (the first field) plus all its // properties foreach ( $row as $i => $field ) { $pr = $field->getPrintRequest(); // a property can have more than one // value - cycle through all the values // for this property $textForProperty = ''; while ( ( $object = $field->getNextDataValue() ) !== false ) { if ( $object->getTypeID() == '_dat' ) { // don't add date values to the display } elseif ( $object->getTypeID() == '_wpg' ) { // use shorter "LongText" for wikipage if ( $i == 0 ) { $title = Title::newFromText( $object->getShortWikiText( false ) ); } else { $numNonDateProperties++; // handling of "headers=" param if ( $this->mShowHeaders == SMW_HEADERS_SHOW ) { $textForProperty .= $pr->getHTMLText( smwfGetLinker() ) . ' '; } elseif ( $this->mShowHeaders == SMW_HEADERS_PLAIN ) { $textForProperty .= $pr->getLabel() . ' '; } // if $this->mShowHeaders == SMW_HEADERS_HIDE, print nothing // handling of "link=" param if ( $this->mLinkOthers ) { $textForProperty .= $object->getLongText( $outputmode, smwfGetLinker() ); } else { $textForProperty .= $object->getWikiValue(); } } } else { $numNonDateProperties++; $textForProperty .= $pr->getHTMLText( smwfGetLinker() ) . ' ' . $object->getShortText( $outputmode, smwfGetLinker() ); } if ( $pr->getMode() == SMWPrintRequest::PRINT_PROP && $pr->getTypeID() == '_dat' ) { $dates[] = $this->formatDateStr( $object ); } } // add the text for this property to // the main text, adding on parentheses // or commas as needed if ( $numNonDateProperties == 1 ) { $text .= ' ('; } elseif ( $numNonDateProperties > 1 ) { $text .= ', '; } $text .= $textForProperty; } if ( $numNonDateProperties > 0 ) { $text .= ')'; } } if ( count( $dates ) > 0 ) { // handle the 'color=' value, whether it came // from a compound query or a regular one // handling is different for SMW 1.5+ $realFunction = array( $field, 'getResultSubject' ); if ( is_callable( $realFunction ) ) { $res_subject = $field->getResultSubject(); if ( isset( $res_subject->display_options ) && is_array( $res_subject->display_options ) && array_key_exists( 'color', $res_subject->display_options ) ) { $color = $res_subject->display_options['color']; } } elseif ( property_exists( $row[0], 'display_options' ) ) { if ( is_array( $row[0]->display_options ) && array_key_exists( 'color', $row[0]->display_options ) ) { $color = $row[0]->display_options['color']; } } elseif ( array_key_exists( 'color', $this->m_params ) ) { $color = $this->m_params['color']; } foreach ( $dates as $date ) { $events[] = array( $title, $text, $date, $color ); } } } $result = $this->displayCalendar( $events ); // go back to the actual user's language, in case a different // language had been specified for this calendar if ( ! is_null( $this->mRealUserLang ) ) { global $wgLang; $wgLang = $this->mRealUserLang; } global $wgParser; if ( is_null( $wgParser->getTitle() ) ) { return $result; } else { return array( $result, 'noparse' => 'true', 'isHTML' => 'true' ); } }
private function getFormattedColumns(array $diWikiPages) { if ($diWikiPages === array()) { return ''; } $mwCollaboratorFactory = ApplicationFactory::getInstance()->newMwCollaboratorFactory(); $htmlColumnListRenderer = $mwCollaboratorFactory->newHtmlColumnListRenderer(); foreach ($diWikiPages as $value) { $dv = DataValueFactory::getInstance()->newDataValueByItem($value); $contentsByIndex[$this->getFirstLetterForCategory($value)][] = $dv->getLongHTMLText(smwfGetLinker()); } $htmlColumnListRenderer->setColumnRTLDirectionalityState($this->getContext()->getLanguage()->isRTL()); $htmlColumnListRenderer->setColumnClass('smw-column-responsive'); $htmlColumnListRenderer->setNumberOfColumns(1); $htmlColumnListRenderer->addContentsByIndex($contentsByIndex); return $htmlColumnListRenderer->getHtml(); }
/** * Handles a single property (SMWPrintRequest) to be displayed for a record (SMWDataValue). * * @since 1.0 * * @param SMWDataValue $object * @param SMWPrintRequest $printRequest * * @return string */ protected function handleResultProperty(SMWDataValue $object, SMWPrintRequest $printRequest) { if ($this->template) { if ($object instanceof SMWWikiPageValue) { return $object->getTitle()->getPrefixedText(); } else { return $object->getLongText(SMW_OUTPUT_WIKI, NULL); } } if ($this->linkAbsolute) { $t = Title::newFromText($printRequest->getHTMLText(NULL), SMW_NS_PROPERTY); if ($t instanceof Title && $t->exists()) { $propertyName = $propertyName = Html::element('a', array('href' => $t->getFullUrl()), $printRequest->getHTMLText(NULL)); } else { $propertyName = $printRequest->getHTMLText(NULL); } } else { $propertyName = $printRequest->getHTMLText(smwfGetLinker()); } if ($this->linkAbsolute) { $hasPage = $object->getTypeID() == '_wpg'; if ($hasPage) { $t = Title::newFromText($object->getLongText($this->outputmode, NULL), NS_MAIN); $hasPage = $t->exists(); } if ($hasPage) { $propertyValue = Html::element('a', array('href' => $t->getFullUrl()), $object->getLongText($this->outputmode, NULL)); } else { $propertyValue = $object->getLongText($this->outputmode, NULL); } } else { $propertyValue = $object->getLongText($this->outputmode, smwfGetLinker()); } return $propertyName . ($propertyName === '' ? '' : ': ') . $propertyValue; }
/** * Displays the subject that is currently being browsed to. * * @return A string containing the HTML with the subject line */ private function displayHead() { global $wgOut; /** * if subject(that is currently browsed to) contains a "_" so * this symbols are replaced in this subject by SMWDataValueFactory with a blank. * for solve this problem we replace string $this->subject->getTitle() to * the original title($this->articletext) */ $getTitle = smwfGetLinker()->makeLinkObj( $this->subject->getTitle() ); $replaceTitle = str_replace( $this->subject->getTitle(), $this->articletext, $getTitle ); $wgOut->setHTMLTitle( $this->subject->getTitle() ); $html = "<table class=\"smwb-factbox\" cellpadding=\"0\" cellspacing=\"0\">\n"; $html .= "<tr class=\"smwb-title\"><td colspan=\"2\">\n"; //$html .= smwfGetLinker()->makeLinkObj( $this->subject->getTitle() ) . "\n"; // @todo Replace makeLinkObj with link as soon as we drop MW1.12 compatibility $html .= $replaceTitle . "\n"; // @todo Replace makeLinkObj with link as soon as we drop MW1.12 compatibility $html .= "</td></tr>\n"; $html .= "</table>\n"; return $html; }
/** * Returns a Linker object * * @since 1.9 * * @return Linker */ public function getLinker() { if ($this->linker === null) { $this->linker = smwfGetLinker(); } return $this->linker; }
private function getPropertyLink($subject, $properties, $value, $valueCaption) { // #1855 if (substr($value, 0, 3) === '@@@') { $property = end($properties); $dataValue = $this->dataValueFactory->newPropertyValueByLabel($property, $valueCaption, $subject); if (($lang = Localizer::getAnnotatedLanguageCodeFrom($value)) !== false) { $dataValue->setOption($dataValue::OPT_USER_LANGUAGE, $lang); $dataValue->setCaption($valueCaption === false ? $dataValue->getWikiValue() : $valueCaption); } return $dataValue->getShortWikitext(smwfGetLinker()); } return ''; }
/** * (non-PHPdoc) * @see SMWResultPrinter::getResultText() * * @todo Split up megamoth */ protected function getResultText(SMWQueryResult $res, $outputmode) { $events = array(); // Print all result rows. while ($row = $res->getNext()) { $dates = array(); $title = $text = $color = ''; if ($this->mTemplate != '') { // Build template code $this->hasTemplates = true; if ($this->mUserParam) { $text = "|userparam={$this->mUserParam}"; } foreach ($row as $i => $field) { $pr = $field->getPrintRequest(); $text .= '|' . ($i + 1) . '='; while (($object = $field->getNextDataValue()) !== false) { if ($object->getTypeID() == '_dat') { $text .= $object->getLongWikiText(); // use shorter "LongText" for wikipage } elseif ($object->getTypeID() == '_wpg') { // handling of "link=" param if ($this->mLinkOthers) { $text .= $object->getLongText($outputmode, null); } else { $text .= $object->getWikiValue(); } } else { $text .= $object->getShortText($outputmode, null); } if ($pr->getMode() == SMWPrintRequest::PRINT_PROP && $pr->getTypeID() == '_dat') { $datePropLabel = $pr->getLabel(); if (!array_key_exists($datePropLabel, $dates)) { $dates[$datePropLabel] = array(); } $dates[$datePropLabel][] = $this->formatDateStr($object); } } } } else { // Build simple text. $numNonDateProperties = 0; // Cycle through a 'row', which is the page // name (the first field) plus all its // properties. foreach ($row as $i => $field) { $pr = $field->getPrintRequest(); // A property can have more than one // value - cycle through all the values // for this property. $textForProperty = ''; while (($object = $field->getNextDataValue()) !== false) { if ($object->getTypeID() == '_dat') { // Don't add date values to the display. // use shorter "LongText" for wikipage } elseif ($object->getTypeID() == '_wpg') { if ($i == 0) { $title = Title::newFromText($object->getShortWikiText(false)); } else { $numNonDateProperties++; // handling of "headers=" param if ($this->mShowHeaders == SMW_HEADERS_SHOW) { $textForProperty .= $pr->getHTMLText(smwfGetLinker()) . ' '; } elseif ($this->mShowHeaders == SMW_HEADERS_PLAIN) { $textForProperty .= $pr->getLabel() . ' '; } // If $this->mShowHeaders == SMW_HEADERS_HIDE, // print nothing. // handling of "link=" param if ($this->mLinkOthers) { $textForProperty .= $object->getLongText($outputmode, smwfGetLinker()); } else { $textForProperty .= $object->getWikiValue(); } } } else { $numNonDateProperties++; $textForProperty .= $pr->getHTMLText(smwfGetLinker()) . ' ' . $object->getShortText($outputmode, smwfGetLinker()); } if ($pr->getMode() == SMWPrintRequest::PRINT_PROP && $pr->getTypeID() == '_dat') { $datePropLabel = $pr->getLabel(); if (!array_key_exists($datePropLabel, $dates)) { $dates[$datePropLabel] = array(); } $dates[$datePropLabel][] = $this->formatDateStr($object); } } // Add the text for this property to // the main text, adding on parentheses // or commas as needed. if ($numNonDateProperties == 1) { $text .= ' ('; } elseif ($numNonDateProperties > 1) { $text .= ', '; } $text .= $textForProperty; } if ($numNonDateProperties > 0) { $text .= ')'; } } if (count($dates) > 0) { // Handle the 'color=' value, whether it came // from a compound query or a regular one. $resSubject = $field->getResultSubject(); if (isset($resSubject->display_options) && is_array($resSubject->display_options)) { if (array_key_exists('color', $resSubject->display_options)) { $color = $resSubject->display_options['color']; } if (array_key_exists('colors', $resSubject->display_options)) { $this->setColors($resSubject->display_options['colors']); } } foreach ($dates as $label => $datesForLabel) { foreach ($datesForLabel as $date) { $curText = $text; // If there's more than one // label, i.e. more than one // date property being displayed, // show the name of the current // property in parentheses. if (count($dates) > 1) { $curText = "({$label}) " . $curText; } $curColor = $color; if (array_key_exists($label, $this->mColors)) { $curColor = $this->mColors[$label]; } $events[] = array($title, $curText, $date, $curColor); } } } } $result = $this->displayCalendar($events); // Go back to the actual user's language, in case a different // language had been specified for this calendar. if (!is_null($this->mRealUserLang)) { global $wgLang; $wgLang = $this->mRealUserLang; } global $wgParser; if (is_null($wgParser->getTitle())) { return $result; } else { return array($result, 'noparse' => 'true', 'isHTML' => 'true'); } }
private function findValueOutputFor($isValue, $type, $dataValue, $linker) { $dataItem = $dataValue->getDataItem(); // Turn Uri/Page links into a href representation when not used as value if (!$isValue && ($dataItem instanceof DIUri || $dataItem instanceof DIWikiPage) && $type !== self::VALUE) { return $dataValue->getShortHTMLText(smwfGetLinker()); } // Dates and times are to be displayed in a localized format if (!$isValue && $dataItem instanceof DITime && $type !== self::VALUE) { $dataValue->setOutputFormat('LOCL'); } switch ($type) { case self::VALUE: return $dataValue->getWikiValue(); case self::WIKI_SHORT: return $dataValue->getShortWikiText($linker); case self::HTML_SHORT: return $dataValue->getShortHTMLText($linker); case self::WIKI_LONG: return $dataValue->getLongWikiText($linker); case self::HTML_LONG: return $dataValue->getLongHTMLText($linker); } }
/** * Format a list of diWikiPages chunked by letter in a bullet list. * * @param $start integer * @param $end integer * @param $diWikiPages array of SMWDataItem * @param $diProperty SMWDIProperty that the wikipages are values of, or null * * @return string */ public static function getShortList($start, $end, array $diWikiPages, $diProperty) { global $wgContLang; $startDv = \SMW\DataValueFactory::getInstance()->newDataItemValue($diWikiPages[$start], $diProperty); $sortkey = \SMW\StoreFactory::getStore()->getWikiPageSortKey($diWikiPages[$start]); $startChar = $wgContLang->convert($wgContLang->firstChar($sortkey)); $r = '<h3>' . htmlspecialchars($startChar) . "</h3>\n" . '<ul><li>' . $startDv->getLongHTMLText(smwfGetLinker()) . '</li>'; $prevStartChar = $startChar; for ($index = $start + 1; $index < $end; $index++) { $dataValue = \SMW\DataValueFactory::getInstance()->newDataItemValue($diWikiPages[$index], $diProperty); $sortkey = \SMW\StoreFactory::getStore()->getWikiPageSortKey($diWikiPages[$index]); $startChar = $wgContLang->convert($wgContLang->firstChar($sortkey)); if ($startChar != $prevStartChar) { $r .= "</ul><h3>" . htmlspecialchars($startChar) . "</h3>\n<ul>"; $prevStartChar = $startChar; } $r .= '<li>' . $dataValue->getLongHTMLText(smwfGetLinker()) . '</li>'; } $r .= '</ul>'; return $r; }
function formatResult($skin, $result) { $title = Title::makeTitle(NS_TEMPLATE, $result->value); $text = smwfGetLinker()->makeLinkObj($title, htmlspecialchars($title->getText())); $category = $this->getCategoryDefinedByTemplate($title); if ($category !== '') { $text .= ' ' . wfMessage('sf_templates_definescat', SFUtils::linkText(NS_CATEGORY, $category))->parse(); } return $text; }
/** * Displays the subject that is currently being browsed to. * * @return string A string containing the HTML with the subject line */ private function displayHead() { if ($this->subject->getDataItem()->getNamespace() === SMW_NS_PROPERTY) { $caption = ''; $dv = DataValueFactory::getInstance()->newDataValueByItem(DIProperty::newFromUserLabel($this->subject->getDataItem()->getDBKey())); $this->subject->setCaption($dv->getFormattedLabel(DataValueFormatter::WIKI_LONG)); } $html = "<table class=\"smwb-factbox\" cellpadding=\"0\" cellspacing=\"0\">\n" . "<tr class=\"smwb-title\"><td colspan=\"2\">\n" . $this->subject->getLongHTMLText(smwfGetLinker()) . "\n" . "</td></tr>\n</table>\n"; return $html; }
/** * @covers ::smwfGetLinker * @test smwfGetLinker * * @since 1.9 */ public function testSmwfGetLinker() { $instance = smwfGetLinker(); $linker = class_exists('DummyLinker') ? 'DummyLinker' : 'Linker'; $this->assertInstanceOf($linker, $instance); }
/** * Format $diWikiPages chunked by letter in a table that shows subject * articles in one column and object articles/values in the other one. * * @param $diWikiPages array * @return string */ protected function subjectObjectList(array $diWikiPages) { global $wgContLang, $smwgMaxPropertyValues; $ac = count($diWikiPages); if ($ac > $this->limit) { if ($this->until !== '') { $start = 1; } else { $start = 0; $ac = $ac - 1; } } else { $start = 0; } $r = '<table style="width: 100%; ">'; $prev_start_char = 'None'; for ($index = $start; $index < $ac; $index++) { $diWikiPage = $diWikiPages[$index]; $dvWikiPage = DataValueFactory::getInstance()->newDataItemValue($diWikiPage, null); $sortkey = $this->store->getWikiPageSortKey($diWikiPage); $start_char = $wgContLang->convert($wgContLang->firstChar($sortkey)); // Header for index letters if ($start_char != $prev_start_char) { $r .= '<tr><th class="smwpropname"><h3>' . htmlspecialchars($start_char) . "</h3></th><th></th></tr>\n"; $prev_start_char = $start_char; } // Property name $searchlink = SMWInfolink::newBrowsingLink('+', $dvWikiPage->getShortHTMLText()); $r .= '<tr><td class="smwpropname">' . $dvWikiPage->getShortHTMLText(smwfGetLinker()) . ' ' . $searchlink->getHTML(smwfGetLinker()) . '</td><td class="smwprops">'; // Property values $ropts = new SMWRequestOptions(); $ropts->limit = $smwgMaxPropertyValues + 1; $values = $this->store->getPropertyValues($diWikiPage, $this->mProperty, $ropts); $i = 0; foreach ($values as $di) { if ($i != 0) { $r .= ', '; } $i++; if ($i < $smwgMaxPropertyValues + 1) { $dv = DataValueFactory::getInstance()->newDataItemValue($di, $this->mProperty); $r .= $dv->getShortHTMLText(smwfGetLinker()) . $dv->getInfolinkText(SMW_OUTPUT_HTML, smwfGetLinker()); } else { $searchlink = SMWInfolink::newInversePropertySearchLink('…', $dvWikiPage->getWikiValue(), $this->mTitle->getText()); $r .= $searchlink->getHTML(smwfGetLinker()); } } $r .= "</td></tr>\n"; } $r .= '</table>'; return $r; }
/** * @covers ::smwfGetLinker * @test smwfGetLinker * * @since 1.9 */ public function testSmwfGetLinker() { $instance = smwfGetLinker(); $this->assertInstanceOf('Linker', $instance); }